]> thyrsus.com Git - intercal.git/commitdiff
Suppress a bunch of GCC 4 warnings. All regression tests pass.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 31 Aug 2010 06:01:53 +0000 (02:01 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 31 Aug 2010 06:01:53 +0000 (02:01 -0400)
src/lexer.l
src/oil.y
src/perpet.c
src/yuk.c

index 0bd8da2e16aa628fd534599d0dc7135cc028046b..f0ca2d20ef5effecc366c1244b020f5734340a2b 100644 (file)
@@ -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;
index 5e5cecbec5c1f017dee0d89d4e1c0f1f0e58b62f..c19c19955046f6b36dea269d53e59da966ff0d4f 100644 (file)
--- 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\"");
index 65914b981bf5e3c715cd00dc81c5b87da50388b7..378bee4442318dedb6785719e02e2d556e9c8519 100644 (file)
@@ -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;
 }
index 1a50f8251347224c22304967cad2fbe1993f8bed..3c80447c55391dc23c8ab7f2a552497e42f9b303 100644 (file)
--- 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<yukcommands)
@@ -334,7 +336,8 @@ void yukline(int aboff,int emitlineno)
       {
        printf("yuk007 "); /* this is our prompt, a sort of reverse
                              INTERCAL version of % */
-       (void) fgets(buf,20,stdin);
+       if (fgets(buf,20,stdin) == NULL)
+           break;;
        if(!strchr(buf,'\n'))
        {
          ick_lose(IE810,emitlineno,(const char*)NULL);
@@ -818,7 +821,8 @@ void yukline(int aboff,int emitlineno)
 #else
            (void) snprintf(copyloc,sizeof copyloc,"more < %s",tempcharp);
 #endif
-           (void) system(copyloc); /* display the GNU GPL copyright */
+           if (system(copyloc) != 0) /* display the GNU GPL copyright */
+               (void) puts("Your system is more confused.");
          }
          else
            (void) puts("Couldn't find license file. See the file COPYING.txt that\n"