Index: tcc.c =================================================================== RCS file: /sources/tinycc/tinycc/tcc.c,v retrieving revision 1.189 diff -u -r1.189 tcc.c --- tcc.c 4 Dec 2007 20:38:09 -0000 1.189 +++ tcc.c 7 Dec 2007 12:47:40 -0000 @@ -38,11 +38,11 @@ #include #include #include -#ifdef WIN32 +#ifdef _WIN32 #include // #include #endif -#ifndef WIN32 +#ifndef _WIN32 #include #include #include @@ -86,12 +86,12 @@ #define TCC_TARGET_I386 #endif -#if !defined(WIN32) && !defined(TCC_UCLIBC) && !defined(TCC_TARGET_ARM) && \ +#if !defined(_WIN32) && !defined(TCC_UCLIBC) && !defined(TCC_TARGET_ARM) && \ !defined(TCC_TARGET_C67) #define CONFIG_TCC_BCHECK /* enable bound checking code */ #endif -#if defined(WIN32) && !defined(TCC_TARGET_PE) +#if defined(_WIN32) && !defined(TCC_TARGET_PE) #define CONFIG_TCC_STATIC #endif @@ -722,7 +722,7 @@ #define TOK_UIDENT TOK_DEFINE -#ifdef WIN32 +#ifdef _WIN32 int __stdcall GetModuleFileNameA(void *, char *, int); void *__stdcall GetProcAddress(void *, const char *); void *__stdcall GetModuleHandleA(const char *); @@ -967,7 +967,7 @@ return NULL; } -#elif !defined(WIN32) +#elif !defined(_WIN32) #include @@ -1035,7 +1035,7 @@ return 1; } -#ifdef WIN32 +#ifdef _WIN32 char *normalize_slashes(char *path) { char *p; @@ -1047,7 +1047,7 @@ char *w32_tcc_lib_path(void) { - /* on win32, we suppose the lib and includes are at the location + /* on _WIN32, we suppose the lib and includes are at the location of 'tcc.exe' */ char path[1024], *p; GetModuleFileNameA(NULL, path, sizeof path); @@ -1887,7 +1887,9 @@ bf->buf_end = bf->buffer; bf->buffer[0] = CH_EOB; /* put eob symbol */ pstrcpy(bf->filename, sizeof(bf->filename), filename); +#ifdef _WIN32 normalize_slashes(bf->filename); +#endif bf->line_num = 1; bf->ifndef_macro = 0; bf->ifdef_stack_ptr = s1->ifdef_stack_ptr; @@ -9724,7 +9726,7 @@ fprintf(stderr, "\n"); } -#if !defined(WIN32) && !defined(CONFIG_TCCBOOT) +#if !defined(_WIN32) && !defined(CONFIG_TCCBOOT) #ifdef __i386__ @@ -9889,7 +9891,7 @@ s = s1->sections[i]; if ((s->sh_flags & (SHF_ALLOC | SHF_EXECINSTR)) == (SHF_ALLOC | SHF_EXECINSTR)) { -#ifdef WIN32 +#ifdef _WIN32 { unsigned long old_protect; VirtualProtect(s->data, s->data_offset, @@ -9921,7 +9923,7 @@ prog_main = tcc_get_symbol_err(s1, "main"); if (do_debug) { -#if defined(WIN32) || defined(CONFIG_TCCBOOT) +#if defined(_WIN32) || defined(CONFIG_TCCBOOT) error("debug mode currently not available for Windows"); #else struct sigaction sigact; @@ -10461,7 +10463,7 @@ char *p = strchr(name, 0); while (p > name && p[-1] != '/' -#ifdef WIN32 +#ifdef _WIN32 && p[-1] != '\\' #endif ) @@ -10473,7 +10475,7 @@ static int64_t getclock_us(void) { -#ifdef WIN32 +#ifdef _WIN32 struct _timeb tb; _ftime(&tb); return (tb.time * 1000LL + tb.millitm) * 1000LL; @@ -10849,7 +10851,7 @@ char objfilename[1024]; int64_t start_time = 0; -#ifdef WIN32 +#ifdef _WIN32 tcc_lib_path = w32_tcc_lib_path(); #endif