Another libgfortran warning round

Andreas Jaeger aj@suse.de
Mon May 16 07:00:00 GMT 2005


"Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:

>  > I've added the following warning flags for the C programs in
>  > libgfortran:
>  > 
>  >   -Wmissing-prototypes -Wold-style-definition -Wextra
>  > 
>
> Thanks for doing this, it's great!
>
> (Please consider also adding -Wwrite-strings.)

The appended two small patches are needed and it compiles still with
-Werror, so I've added -Wwrite-strings to configure as well.

Ok to commit?  Tested on Linux/x86-64.

Andreas

2005-05-16  Andreas Jaeger  <aj@suse.de>

	* io/write.c: Make variable const to support -Wwrite-strings.

	* io/list_read.c (nml_match_name): Add const to make compile with
	-Wwrite-strings.

	* configure.ac: Add additional warning flags.
	* configure: Regenerate.

============================================================
Index: libgfortran/io/write.c
--- io/write.c	15 May 2005 15:33:12 -0000	1.36
+++ io/write.c	16 May 2005 06:41:54 -0000
@@ -1325,7 +1325,7 @@ list_formatted_write (bt type, void *p, 
 
 /* Stores the delimiter to be used for character objects.  */
 
-static char * nml_delim;
+static const char * nml_delim;
 
 static namelist_info *
 nml_write_obj (namelist_info * obj, index_type offset,
============================================================
Index: libgfortran/io/list_read.c
--- io/list_read.c	15 May 2005 15:50:08 -0000	1.21
+++ io/list_read.c	16 May 2005 06:41:55 -0000
@@ -1693,7 +1693,7 @@ nml_untouch_nodes (void)
    on no match.  */
 
 static void
-nml_match_name (char *name, index_type len)
+nml_match_name (const char *name, index_type len)
 {
   index_type i;
   char c;
============================================================
Index: libgfortran/configure.ac
--- libgfortran/configure.ac	15 May 2005 15:37:06 -0000	1.25
+++ libgfortran/configure.ac	16 May 2005 06:41:55 -0000
@@ -114,7 +114,7 @@ if test "x$GCC" = "xyes"; then
   AM_FCFLAGS="-Wall"
   ## We like to use C99 routines when available.  This makes sure that
   ## __STDC_VERSION__ is set such that libc includes make them available.
-  AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes"
+  AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings"
 fi
 AC_SUBST(AM_FCFLAGS)
 AC_SUBST(AM_CFLAGS)
============================================================
Index: libgfortran/configure
--- libgfortran/configure	15 May 2005 15:37:15 -0000	1.34
+++ libgfortran/configure	16 May 2005 06:41:58 -0000
@@ -2937,7 +2937,7 @@ if test "x$GCC" = "xyes"; then
   AM_FCFLAGS="-Wall"
   ## We like to use C99 routines when available.  This makes sure that
   ## __STDC_VERSION__ is set such that libc includes make them available.
-  AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes"
+  AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes  -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings"
 fi
 
 

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050516/0597b5a4/attachment.sig>


More information about the Gcc-patches mailing list