diff options
author | johnvg | 2016-09-29 12:06:45 +0000 |
---|---|---|
committer | johnvg | 2016-09-29 12:06:45 +0000 |
commit | 212b4d08ec043edc8eab0fe18d9dc4c25039cc5d (patch) | |
tree | c77ae7728b7408f91a4f23777dcd0e28a371d4fa /backendC/CleanCompilerSources | |
parent | use "a" instead of "aw" in fopen and freopen calls, to prevent immediately cr... (diff) |
don't use freopen with Visual Studio, to prevent crashes
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@2743 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'backendC/CleanCompilerSources')
-rw-r--r-- | backendC/CleanCompilerSources/cocl.c | 14 | ||||
-rw-r--r-- | backendC/CleanCompilerSources/windows_io.h | 25 |
2 files changed, 25 insertions, 14 deletions
diff --git a/backendC/CleanCompilerSources/cocl.c b/backendC/CleanCompilerSources/cocl.c index 206a605..7a6ebfa 100644 --- a/backendC/CleanCompilerSources/cocl.c +++ b/backendC/CleanCompilerSources/cocl.c @@ -8,7 +8,7 @@ #include "MAIN_CLM.d" -#ifdef _SUN_ +#if defined (_MSC_VER) || defined (_SUN_) FILE *std_out_file_p,*std_error_file_p; #endif @@ -95,7 +95,7 @@ Bool CallCompiler (int argc, char **argv) char *fname,*output_file_name; int i; -# ifdef _SUN_ +# if defined (_MSC_VER) || defined (_SUN_) std_out_file_p = stdout; std_error_file_p = stderr; # endif @@ -218,7 +218,7 @@ Bool CallCompiler (int argc, char **argv) } } else if (strcmp (argv_i, "-RE") == 0){ if (++i < argc){ -#ifdef _SUN_ +# if defined (_MSC_VER) || defined (_SUN_) std_error_file_p = fopen (argv[i],"w"); if (std_error_file_p!=NULL) StdErrorReopened = True; @@ -236,7 +236,7 @@ Bool CallCompiler (int argc, char **argv) } } else if (strcmp (argv_i, "-RAE") == 0){ if (++i < argc){ -#ifdef _SUN_ +#if defined (_MSC_VER) || defined (_SUN_) std_error_file_p = fopen (argv[i],"a"); if (std_error_file_p!=NULL) StdErrorReopened = True; @@ -254,7 +254,7 @@ Bool CallCompiler (int argc, char **argv) } } else if (strcmp (argv_i, "-RO") == 0){ if (++i < argc){ -#ifdef _SUN_ +#if defined (_MSC_VER) || defined (_SUN_) std_out_file_p = fopen (argv[i],"w"); if (std_out_file_p!=NULL) StdOutReopened = True; @@ -272,7 +272,7 @@ Bool CallCompiler (int argc, char **argv) } } else if (strcmp (argv_i, "-RAO") == 0){ if (++i < argc){ -#ifdef _SUN_ +#if defined (_MSC_VER) || defined (_SUN_) std_out_file_p = fopen (argv[i],"a"); if (std_out_file_p!=NULL) StdOutReopened = True; @@ -340,7 +340,7 @@ Bool CallCompiler (int argc, char **argv) #if ! defined (MAIN_CLM) int main (int argc, char *argv[]) { -# ifdef _SUN_ +# if defined (_MSC_VER) || defined (_SUN_) std_out_file_p = stdout; std_error_file_p = stderr; # endif diff --git a/backendC/CleanCompilerSources/windows_io.h b/backendC/CleanCompilerSources/windows_io.h index 6567980..d808013 100644 --- a/backendC/CleanCompilerSources/windows_io.h +++ b/backendC/CleanCompilerSources/windows_io.h @@ -36,13 +36,24 @@ typedef FILE *File; extern void InitIO (void); extern void GetPreferences (char *fname); -#define StdOut stdout -#define StdError stderr -#define StdVerboseH stdout -#define StdVerboseL stdout -#define StdTrace stdout -#define StdDebug stdout; -#define StdListTypes stdout +#ifdef _MSC_VER +extern FILE *std_out_file_p,*std_error_file_p; +# define StdOut std_out_file_p +# define StdError std_error_file_p +# define StdVerboseH std_out_file_p +# define StdVerboseL std_out_file_p +# define StdTrace std_out_file_p +# define StdDebug std_out_file_p +# define StdListTypes std_out_file_p +#else +# define StdOut stdout +# define StdError stderr +# define StdVerboseH stdout +# define StdVerboseL stdout +# define StdTrace stdout +# define StdDebug stdout; +# define StdListTypes stdout +#endif #define FGetC(f) fgetc(f) #define FPutC(c,f) fputc(c,f) |