Patch [libf2c]: eliminate ambiguous else warnings

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Sat Jun 1 09:58:00 GMT 2002


Fixes:
libI77/inquire.c:57: warning: suggest explicit braces to avoid ambiguous `else'
libI77/inquire.c:62: warning: suggest explicit braces to avoid ambiguous `else'
libI77/inquire.c:69: warning: suggest explicit braces to avoid ambiguous `else'
libI77/inquire.c:74: warning: suggest explicit braces to avoid ambiguous `else'
libI77/inquire.c:79: warning: suggest explicit braces to avoid ambiguous `else'
libI77/inquire.c:84: warning: suggest explicit braces to avoid ambiguous `else'
libI77/inquire.c:89: warning: suggest explicit braces to avoid ambiguous `else'
libI77/inquire.c:94: warning: suggest explicit braces to avoid ambiguous `else'
libI77/inquire.c:99: warning: suggest explicit braces to avoid ambiguous `else'
libI77/inquire.c:104: warning: suggest explicit braces to avoid ambiguous `else'
libI77/inquire.c:115: warning: suggest explicit braces to avoid ambiguous `else'
libI77/lread.c:306: warning: suggest explicit braces to avoid ambiguous `else'
libI77/lread.c:443: warning: suggest explicit braces to avoid ambiguous `else'
libI77/open.c:269: warning: suggest explicit braces to avoid ambiguous `else'
libI77/rsne.c:527: warning: suggest explicit braces to avoid ambiguous `else'
libI77/wref.c:234: warning: suggest explicit braces to avoid ambiguous `else'

Tested on solaris2.7, ok to install?

		Thanks,
		--Kaveh


2002-06-01  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* libI77/inquire.c (f_inqu): Avoid ambiguous else clauses.
	* libI77/lread.c (l_C, l_L): Likewise.
	* libI77/open.c (f_open): Likewise.
	* libI77/rsne.c (x_rsne): Likewise.
	* libI77/wref.c (wrt_F): Likewise.

diff -rup orig/egcc-CVS20020531/libf2c/libI77/inquire.c egcc-CVS20020531/libf2c/libI77/inquire.c
--- orig/egcc-CVS20020531/libf2c/libI77/inquire.c	2002-06-01 08:53:15.469674781 -0400
+++ egcc-CVS20020531/libf2c/libI77/inquire.c	2002-06-01 09:36:40.110055713 -0400
@@ -55,67 +55,89 @@ f_inqu (inlist * a)
 	}
     }
   if (a->inex != NULL)
-    if (byfile && x != -1 || !byfile && p != NULL)
-      *a->inex = 1;
-    else
-      *a->inex = 0;
+    {
+      if (byfile && x != -1 || !byfile && p != NULL)
+	*a->inex = 1;
+      else
+	*a->inex = 0;
+    }
   if (a->inopen != NULL)
-    if (byfile)
-      *a->inopen = (p != NULL);
-    else
-      *a->inopen = (p != NULL && p->ufd != NULL);
+    {
+      if (byfile)
+	*a->inopen = (p != NULL);
+      else
+	*a->inopen = (p != NULL && p->ufd != NULL);
+    }
   if (a->innum != NULL)
     *a->innum = p - f__units;
   if (a->innamed != NULL)
-    if (byfile || p != NULL && p->ufnm != NULL)
-      *a->innamed = 1;
-    else
-      *a->innamed = 0;
+    {
+      if (byfile || p != NULL && p->ufnm != NULL)
+	*a->innamed = 1;
+      else
+	*a->innamed = 0;
+    }
   if (a->inname != NULL)
-    if (byfile)
-      b_char (buf, a->inname, a->innamlen);
-    else if (p != NULL && p->ufnm != NULL)
-      b_char (p->ufnm, a->inname, a->innamlen);
+    {
+      if (byfile)
+	b_char (buf, a->inname, a->innamlen);
+      else if (p != NULL && p->ufnm != NULL)
+	b_char (p->ufnm, a->inname, a->innamlen);
+    }
   if (a->inacc != NULL && p != NULL && p->ufd != NULL)
-    if (p->url)
-      b_char ("DIRECT", a->inacc, a->inacclen);
-    else
-      b_char ("SEQUENTIAL", a->inacc, a->inacclen);
+    {
+      if (p->url)
+	b_char ("DIRECT", a->inacc, a->inacclen);
+      else
+	b_char ("SEQUENTIAL", a->inacc, a->inacclen);
+    }
   if (a->inseq != NULL)
-    if (p != NULL && p->url)
-      b_char ("NO", a->inseq, a->inseqlen);
-    else
-      b_char ("YES", a->inseq, a->inseqlen);
+    {
+      if (p != NULL && p->url)
+	b_char ("NO", a->inseq, a->inseqlen);
+      else
+	b_char ("YES", a->inseq, a->inseqlen);
+    }
   if (a->indir != NULL)
-    if (p == NULL || p->url)
-      b_char ("YES", a->indir, a->indirlen);
-    else
-      b_char ("NO", a->indir, a->indirlen);
+    {
+      if (p == NULL || p->url)
+	b_char ("YES", a->indir, a->indirlen);
+      else
+	b_char ("NO", a->indir, a->indirlen);
+    }
   if (a->infmt != NULL)
-    if (p != NULL && p->ufmt == 0)
-      b_char ("UNFORMATTED", a->infmt, a->infmtlen);
-    else
-      b_char ("FORMATTED", a->infmt, a->infmtlen);
+    {
+      if (p != NULL && p->ufmt == 0)
+	b_char ("UNFORMATTED", a->infmt, a->infmtlen);
+      else
+	b_char ("FORMATTED", a->infmt, a->infmtlen);
+    }
   if (a->inform != NULL)
-    if (p != NULL && p->ufmt == 0)
-      b_char ("NO", a->inform, a->informlen);
-    else
-      b_char ("YES", a->inform, a->informlen);
+    {
+      if (p != NULL && p->ufmt == 0)
+	b_char ("NO", a->inform, a->informlen);
+      else
+	b_char ("YES", a->inform, a->informlen);
+    }
   if (a->inunf)
-    if (p != NULL && p->ufmt == 0)
-      b_char ("YES", a->inunf, a->inunflen);
-    else if (p != NULL)
-      b_char ("NO", a->inunf, a->inunflen);
-    else
-      b_char ("UNKNOWN", a->inunf, a->inunflen);
+    {
+      if (p != NULL && p->ufmt == 0)
+	b_char ("YES", a->inunf, a->inunflen);
+      else if (p != NULL)
+	b_char ("NO", a->inunf, a->inunflen);
+      else
+	b_char ("UNKNOWN", a->inunf, a->inunflen);
+    }
   if (a->inrecl != NULL && p != NULL)
     *a->inrecl = p->url;
   if (a->innrec != NULL && p != NULL && p->url > 0)
     *a->innrec = FTELL (p->ufd) / p->url + 1;
   if (a->inblank && p != NULL && p->ufmt)
-    if (p->ublnk)
-      b_char ("ZERO", a->inblank, a->inblanklen);
-    else
-      b_char ("NULL", a->inblank, a->inblanklen);
+    {
+      if (p->ublnk)
+	b_char ("ZERO", a->inblank, a->inblanklen);
+      else
+	b_char ("NULL", a->inblank, a->inblanklen);
+    }
   return (0);
 }
diff -rup orig/egcc-CVS20020531/libf2c/libI77/lread.c egcc-CVS20020531/libf2c/libI77/lread.c
--- orig/egcc-CVS20020531/libf2c/libI77/lread.c	2002-06-01 09:25:17.218143589 -0400
+++ egcc-CVS20020531/libf2c/libI77/lread.c	2002-06-01 09:37:12.276868119 -0400
@@ -305,10 +305,12 @@ l_C (void)
 	  return 0;
 	}
       if (rd_count (ch))
-	if (!f__cf || !feof (f__cf))
-	  errfl (f__elist->cierr, 112, "complex format");
-	else
-	  err (f__elist->cierr, (EOF), "lread");
+        {
+	  if (!f__cf || !feof (f__cf))
+	    errfl (f__elist->cierr, 112, "complex format");
+	  else
+	    err (f__elist->cierr, (EOF), "lread");
+	}
       if (GETC (ch) != '*')
 	{
 	  if (!f__cf || !feof (f__cf))
@@ -442,10 +444,12 @@ l_L (void)
     {
       rd_count (ch);
       if (GETC (ch) != '*')
-	if (!f__cf || !feof (f__cf))
-	  errfl (f__elist->cierr, 112, "no star");
-	else
-	  err (f__elist->cierr, (EOF), "lread");
+        {
+	  if (!f__cf || !feof (f__cf))
+	    errfl (f__elist->cierr, 112, "no star");
+	  else
+	    err (f__elist->cierr, (EOF), "lread");
+	}
       GETC (ch);
     }
   sawdot = 0;
diff -rup orig/egcc-CVS20020531/libf2c/libI77/open.c egcc-CVS20020531/libf2c/libI77/open.c
--- orig/egcc-CVS20020531/libf2c/libI77/open.c	2002-06-01 09:25:17.218143589 -0400
+++ egcc-CVS20020531/libf2c/libI77/open.c	2002-06-01 09:37:32.774770450 -0400
@@ -267,11 +267,13 @@ f_open (olist * a)
     opnerr (a->oerr, 108, "open");
 #endif
   if (b->useek)
-    if (a->orl)
-      FSEEK (b->ufd, 0, SEEK_SET);
-    else if ((s = a->oacc) && (*s == 'a' || *s == 'A')
-	     && FSEEK (b->ufd, 0, SEEK_END))
-      opnerr (a->oerr, 129, "open");
+    {
+      if (a->orl)
+	FSEEK (b->ufd, 0, SEEK_SET);
+      else if ((s = a->oacc) && (*s == 'a' || *s == 'A')
+	       && FSEEK (b->ufd, 0, SEEK_END))
+	opnerr (a->oerr, 129, "open");
+    }
   return (0);
 }
 
diff -rup orig/egcc-CVS20020531/libf2c/libI77/rsne.c egcc-CVS20020531/libf2c/libI77/rsne.c
--- orig/egcc-CVS20020531/libf2c/libI77/rsne.c	2002-06-01 09:25:17.228147389 -0400
+++ egcc-CVS20020531/libf2c/libI77/rsne.c	2002-06-01 09:38:30.309099351 -0400
@@ -526,21 +526,23 @@ have_amp:
 	mustend:
 	  GETC (ch);
 	  if (readall)
-	    if (iva >= ivae)
-	      readall = 0;
-	    else
-	      for (;;)
-		{
-		  switch (ch)
-		    {
-		    case ' ':
-		    case '\t':
-		    case '\n':
-		      GETC (ch);
-		      continue;
-		    }
-		  break;
-		}
+	    {
+	      if (iva >= ivae)
+		readall = 0;
+	      else
+		for (;;)
+		  {
+		    switch (ch)
+		      {
+		      case ' ':
+		      case '\t':
+		      case '\n':
+			GETC (ch);
+			continue;
+		      }
+		    break;
+		  }
+	    }
 	  if (ch == '/' || ch == '$' || ch == '&')
 	    {
 	      f__lquit = 1;
diff -rup orig/egcc-CVS20020531/libf2c/libI77/wref.c egcc-CVS20020531/libf2c/libI77/wref.c
--- orig/egcc-CVS20020531/libf2c/libI77/wref.c	2002-06-01 09:25:17.228147389 -0400
+++ egcc-CVS20020531/libf2c/libI77/wref.c	2002-06-01 09:39:06.265452232 -0400
@@ -234,14 +234,16 @@ wrt_F (ufloat * p, int w, int d, ftnlen 
     }
 
   if (n = f__scale)
-    if (n > 0)
-      do
-	x *= 10.;
-      while (--n > 0);
-    else
-      do
-	x *= 0.1;
-      while (++n < 0);
+    {
+      if (n > 0)
+	do
+	  x *= 10.;
+	while (--n > 0);
+      else
+	do
+	  x *= 0.1;
+	while (++n < 0);
+    }
 
 #ifdef USE_STRLEN
   sprintf (b = buf, "%#.*f", d, x);



More information about the Gcc-patches mailing list