From: Eric S. Raymond Date: Tue, 31 Aug 2010 06:01:53 +0000 (-0400) Subject: Suppress a bunch of GCC 4 warnings. All regression tests pass. X-Git-Tag: 0.29~79^2 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=212311f7fe57c5ff3c1ec77aa6779f6eab5bbdf0;p=intercal.git Suppress a bunch of GCC 4 warnings. All regression tests pass. --- diff --git a/src/lexer.l b/src/lexer.l index 0bd8da2..f0ca2d2 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -135,14 +135,15 @@ int getc(FILE *fp) { int c; char c_char; + size_t dummy; /*fprintf(stderr,"about to fgetc(\045p)",(void*)fp);*/ c_char=0; /* AIS */ - (void)fread(&c_char,1,1,fp); + dummy = fread(&c_char,1,1,fp); /* AIS: ignore the first \r in a row to deal with DOS newlines. The second in a row is definitely an error, though, and will be caught later on. */ - if(c_char=='\r') (void)fread(&c_char,1,1,fp); + if(c_char=='\r') dummy = fread(&c_char,1,1,fp); c = c_char; if(feof(fp)) c=EOF; diff --git a/src/oil.y b/src/oil.y index 5e5cecb..c19c199 100644 --- a/src/oil.y +++ b/src/oil.y @@ -711,13 +711,14 @@ int countungetc(int c, FILE* f) void splitstart(void) { static char fname[]="oilout00.c"; + FILE *dummy; /* GCC 4 un-suppressable warning suck */ if(filenumber>255) { filenumber=255; fprintf(stdout,"Input file too long.\n"); } sprintf(fname,"oilout%02x.c",filenumber); - freopen(fname,"w",stdout); + dummy = freopen(fname,"w",stdout); puts("/* Automatically generated output, edit source and recompile to " "change */"); printf("#include \"oil.h\"\n" @@ -748,6 +749,7 @@ void splitend(void) int main(void) { int e,i; + FILE *dummy; /* GCC 4 un-suppressible warnings suck */ /* " if(!np) return 0;\n" " if(np->lval) opted|=optimize_pass1(np->lval);\n" @@ -759,7 +761,7 @@ int main(void) e=yyparse(); while(tfi--) free(tofree[tfi]); splitend(); - freopen("oilout-m.c","w",stdout); + dummy = freopen("oilout-m.c","w",stdout); puts("/* Automatically generated output, edit source and recompile to " "change */"); puts("#include \"config.h\""); diff --git a/src/perpet.c b/src/perpet.c index 65914b9..378bee4 100644 --- a/src/perpet.c +++ b/src/perpet.c @@ -61,8 +61,9 @@ LICENSE TERMS #define ARGSTRING "abcdefghlmoptuvwxyCEFHOPUYX@" -#define ICK_SYSTEM(x) do{if(showsystem)fprintf(stderr,"%s\n",x); \ - (void) system(x);}while(0) +/* unused st variable quiets a GCC4 warning */ +#define ICK_SYSTEM(x) do{int st;if(showsystem)fprintf(stderr,"%s\n",x); \ + st=system(x);}while(0) #ifdef USE_YYRESTART /* function supplied by lex */ @@ -197,7 +198,8 @@ int getopt(int argc, char * const *argv, const char *options) static int myfgetc(FILE* in) { char c; - (void) fread(&c,1,1,in); + size_t dummy; + dummy = fread(&c,1,1,in); if(feof(in)) return EOF; return (int)c; } diff --git a/src/yuk.c b/src/yuk.c index 1a50f82..3c80447 100644 --- a/src/yuk.c +++ b/src/yuk.c @@ -154,11 +154,13 @@ void yukterm(void) { int i,lastline,thisline,inrow=0; yptimer avgtime,avgtime2; + FILE *dummy; if(yukopts==2) (void) puts("Program ended without error."); if(!(yukopts&1)) return; /* Print profiling information */ (void) puts("Profiling information saved to \"yuk.out\"."); - (void) freopen("yuk.out","w",stdout); + /* Bletch. GCC's unsuppressible warning forces us to this */ + dummy = freopen("yuk.out","w",stdout); i=-1; lastline=-1; while(++i