gold patch: use strict prototypes with .c files

Craig Silverstein csilvers@google.com
Wed Nov 5 07:28:00 GMT 2008


My compiler seems to add -Wstrict-prototypes and -Wmissing-prototypes
by default when compiling C files.  This was causing a few C-language
gold tests to fail.  The fix is easy enough.  If I were a more
confident gold developer, I might submit these as obvious. :-)  As it
is, can someone approve them?

craig

--cut here--

      * tls_test_c.c: Add prototype for t11 and t11_last.
      * tls_test_c.c (t11): Add explicit "void" to prototype.
      (t11_last): Likewise.
      * ver_test_6.c (main): Likewise.

Index: tls_test_c.c
===================================================================
RCS file: /cvs/src/src/gold/testsuite/tls_test_c.c,v
retrieving revision 1.1
diff -u -r1.1 tls_test_c.c
--- tls_test_c.c	17 Apr 2008 07:12:00 -0000	1.1
+++ tls_test_c.c	5 Nov 2008 07:25:31 -0000
@@ -42,8 +42,11 @@
 #pragma omp threadprivate (v7)
 #endif
 
+int t11(void);
+int t11_last(void);
+
 int
-t11()
+t11(void)
 {
 #ifdef HAVE_OMP_SUPPORT
   CHECK_EQ_OR_RETURN(v7, 0);
@@ -53,7 +56,7 @@
 }
 
 int
-t11_last()
+t11_last(void)
 {
 #ifdef HAVE_OMP_SUPPORT
   CHECK_EQ_OR_RETURN(v7, 70);
Index: ver_test_6.c
===================================================================
RCS file: /cvs/src/src/gold/testsuite/ver_test_6.c,v
retrieving revision 1.1
diff -u -r1.1 ver_test_6.c
--- ver_test_6.c	27 Mar 2008 18:19:09 -0000	1.1
+++ ver_test_6.c	5 Nov 2008 07:25:31 -0000
@@ -26,8 +26,10 @@
 
 int t3_2;
 
+/* Obviously, main doesn't actually take 0 arguments, but we don't use
+ * the arguments, and this quiets gcc -Wstrict-prototypes.  */
 int
-main()
+main(void)
 {
   return t3_2;
 }



More information about the Binutils mailing list