This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fixproto tweek


GNU libc's math.h contains:

# ifdef __cplusplus
extern int matherr (struct __exception *__exc) throw ();
# else
extern int matherr (struct exception *__exc);
# endif

The throw expression confuses fixproto into thinking that matherr has
not been prototyped.  Therefore we get an unnecessarily-modified
math.h:

--- /usr/include/math.h Sun May  6 13:15:44 2001
+++ math.h      Wed May  9 18:39:04 2001
@@ -22,6 +22,13 @@
  */
 
 #ifndef        _MATH_H
+#ifndef _PARAMS
+#if defined(__STDC__) || defined(__cplusplus)
+#define _PARAMS(ARGS) ARGS
+#else
+#define _PARAMS(ARGS) ()
+#endif
+#endif /* _PARAMS */
 #define        _MATH_H 1
 
 #include <features.h>
@@ -273,7 +280,7 @@
   };
 
 # ifdef __cplusplus
-extern int matherr (struct __exception *__exc) throw ();
+extern int matherr(struct __exception *__exc) throw ();
 # else
 extern int matherr (struct exception *__exc);
 # endif

This patch corrects the problem, by causing us to skip to the next
semicolon after processing an argument list.  I believe this is safe.

Yes, I know fix-header normally is not run on Linux.

-- 
zw                I'm on a spaceship full of college students.
                  	-- Martin "PCHammer" Rose


	* scan-decls.c (scan_decls): Skip tokens between an argument
	list and the next semicolon.

===================================================================
Index: scan-decls.c
--- scan-decls.c	2001/01/13 01:07:32	1.24
+++ scan-decls.c	2001/05/10 01:52:21
@@ -187,8 +187,12 @@ scan_decls (pfile, argc, argv)
 		  skip_to_closing_brace (pfile);
 		  goto new_statement;
 		}
-	      if (token.type == CPP_SEMICOLON)
-		goto new_statement;
+
+	      /* skip a possible __attribute__ or throw expression after the
+		 parameter list */
+	      while (token.type != CPP_SEMICOLON && token.type != CPP_EOF)
+		cpp_get_token (pfile, &token);
+	      goto new_statement;
 	    }
 	  break;
 	case CPP_NAME:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]