Evgeniy Stepanov | bec2f0e | 2011-03-05 12:50:33 +0300 | [diff] [blame] | 1 | #ifndef TSAN_COMMON_UTIL__ |
| 2 | #define TSAN_COMMON_UTIL__ |
| 3 | |
| 4 | #include "ts_util.h" |
| 5 | |
| 6 | #if defined(__GNUC__) |
| 7 | typedef int TS_FILE; |
| 8 | #define TS_FILE_INVALID (-1) |
| 9 | #ifdef TS_LLVM |
| 10 | #define read(fd, buf, size) __real_read(fd, buf, size) |
| 11 | #endif |
| 12 | #elif defined(_MSC_VER) |
| 13 | typedef FILE *TS_FILE; |
| 14 | #define TS_FILE_INVALID (NULL) |
| 15 | #define read(fd, buf, size) fread(buf, 1, size, fd) |
| 16 | #define close fclose |
| 17 | #endif |
| 18 | |
| 19 | bool StringMatch(const string& wildcard, const string& text); |
| 20 | string ConvertToPlatformIndependentPath(const string &s); |
| 21 | TS_FILE OpenFileReadOnly(const string &file_name, bool die_if_failed); |
| 22 | string ReadFileToString(const string &file_name, bool die_if_failed); |
| 23 | |
| 24 | #endif |