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] |
Other format: | [Raw text] |
I've added the following warning flags for the C programs in libgfortran: -Wmissing-prototypes -Wold-style-definition -Wextra And compiled everything with 0 warnings on Linux/x86-64 and will check Linux/i686 now. So, we might even add -Werror like we do for the gcc directory but I leave this for others to decide. Regtested on Linux/x86-64. Ok to commit? Andreas * configure.ac: Add additional warning flags. * configure: Regenerate. * io/write.c (nml_write_obj): Avoid signed warning. * io/list_read.c (list_formatted_read): Mark parameter as volatile to avoid warning about clobbering by longjmp. * io/write.c (calculate_G_format): Remove unused parameter. (output_float): Remove unused parameter. (write_float): Change callers. * io/unix.c (fd_alloc, mmap_open, mmap_sfree, mem_sfree, mem_truncate): Mark argument as unused. * io/unit.c (get_unit): Mark argument as unused. (init_units): Avoid warning about signed comparision. * io/transfer.c (next_record_r): Remove unused parameter. (next_record_w): Remove unused parameter. (next_record): Change callers. (iolength_transfer): Mark arguments as unused. * io/open.c: Add initializer. * io/list_read.c (read_character): Mark argument as unused. * io/format.c: Add initializer. ============================================================ Index: libgfortran/io/format.c --- io/format.c 9 Apr 2005 18:44:06 -0000 1.11 +++ io/format.c 15 May 2005 21:53:39 -0000 @@ -1,4 +1,5 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. Contributed by Andy Vaught This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -54,7 +55,9 @@ static const char *error; static format_token saved_token; static int value, format_string_len, reversion_ok; -static fnode *saved_format, colon_node = { FMT_COLON }; +static fnode *saved_format; +static fnode colon_node = { FMT_COLON, 0, NULL, NULL, {{ 0, 0, 0 }}, 0, + NULL }; /* Error messages */ ============================================================ Index: libgfortran/io/list_read.c --- io/list_read.c 15 May 2005 15:50:08 -0000 1.21 +++ io/list_read.c 15 May 2005 21:53:40 -0000 @@ -704,7 +704,7 @@ read_integer (int length) /* Read a character variable. */ static void -read_character (int length) +read_character (int length __attribute__ ((unused))) { char c, quote, message[100]; @@ -1277,7 +1277,7 @@ check_type (bt type, int len) greater than one, we copy the data item multiple times. */ void -list_formatted_read (bt type, void *p, int len) +list_formatted_read (bt type, void *p, volatile int len) { char c; int m; ============================================================ Index: libgfortran/io/open.c --- io/open.c 12 May 2005 17:50:31 -0000 1.14 +++ io/open.c 15 May 2005 21:53:40 -0000 @@ -1,4 +1,5 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. Contributed by Andy Vaught This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -38,7 +39,7 @@ Boston, MA 02111-1307, USA. */ static st_option access_opt[] = { {"sequential", ACCESS_SEQUENTIAL}, {"direct", ACCESS_DIRECT}, - {NULL} + {NULL, 0} }; static st_option action_opt[] = @@ -46,14 +47,14 @@ static st_option action_opt[] = { "read", ACTION_READ}, { "write", ACTION_WRITE}, { "readwrite", ACTION_READWRITE}, - { NULL} + { NULL, 0} }; static st_option blank_opt[] = { { "null", BLANK_NULL}, { "zero", BLANK_ZERO}, - { NULL} + { NULL, 0} }; static st_option delim_opt[] = @@ -61,14 +62,14 @@ static st_option delim_opt[] = { "none", DELIM_NONE}, { "apostrophe", DELIM_APOSTROPHE}, { "quote", DELIM_QUOTE}, - { NULL} + { NULL, 0} }; static st_option form_opt[] = { { "formatted", FORM_FORMATTED}, { "unformatted", FORM_UNFORMATTED}, - { NULL} + { NULL, 0} }; static st_option position_opt[] = @@ -76,7 +77,7 @@ static st_option position_opt[] = { "asis", POSITION_ASIS}, { "rewind", POSITION_REWIND}, { "append", POSITION_APPEND}, - { NULL} + { NULL, 0} }; static st_option status_opt[] = @@ -86,14 +87,14 @@ static st_option status_opt[] = { "new", STATUS_NEW}, { "replace", STATUS_REPLACE}, { "scratch", STATUS_SCRATCH}, - { NULL} + { NULL, 0} }; static st_option pad_opt[] = { { "yes", PAD_YES}, { "no", PAD_NO}, - { NULL} + { NULL, 0} }; ============================================================ Index: libgfortran/io/transfer.c --- io/transfer.c 15 May 2005 13:25:19 -0000 1.40 +++ io/transfer.c 15 May 2005 21:53:41 -0000 @@ -1205,7 +1205,7 @@ data_transfer_init (int read_flag) #define MAX_READ 4096 static void -next_record_r (int done) +next_record_r (void) { int rlength, length; gfc_offset new; @@ -1296,7 +1296,7 @@ next_record_r (int done) /* Position to the next record in write mode. */ static void -next_record_w (int done) +next_record_w (void) { gfc_offset c, m; int length; @@ -1395,9 +1395,9 @@ next_record (int done) current_unit->read_bad = 0; if (g.mode == READING) - next_record_r (done); + next_record_r (); else - next_record_w (done); + next_record_w (); /* keep position up to date for INQUIRE */ current_unit->flags.position = POSITION_ASIS; @@ -1482,7 +1482,9 @@ finalize_transfer (void) data transfer, it just updates the length counter. */ static void -iolength_transfer (bt type, void *dest, int len) +iolength_transfer (bt type __attribute__ ((unused)), + void *dest __attribute__ ((unused)), + int len) { if (ioparm.iolength != NULL) *ioparm.iolength += len; ============================================================ Index: libgfortran/io/unit.c --- io/unit.c 15 May 2005 13:25:18 -0000 1.11 +++ io/unit.c 15 May 2005 21:53:41 -0000 @@ -248,7 +248,7 @@ find_unit (int n) * unit or the internal file. */ gfc_unit * -get_unit (int read_flag) +get_unit (int read_flag __attribute__ ((unused))) { if (ioparm.internal_unit != NULL) { @@ -289,7 +289,7 @@ void init_units (void) { gfc_unit *u; - int i; + unsigned int i; if (options.stdin_unit >= 0) { /* STDIN */ @@ -363,7 +363,7 @@ init_units (void) * set a 1 in the LSB and keep a running sum, stopping at MSB-1 bit. */ g.max_offset = 0; - for (i=0; i < sizeof(g.max_offset) * 8 - 1; i++) + for (i = 0; i < sizeof (g.max_offset) * 8 - 1; i++) g.max_offset = g.max_offset + ((gfc_offset) 1 << i); } ============================================================ Index: libgfortran/io/unix.c --- io/unix.c 12 May 2005 17:50:32 -0000 1.25 +++ io/unix.c 15 May 2005 21:53:41 -0000 @@ -1,4 +1,5 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. Contributed by Andy Vaught This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -329,7 +330,8 @@ fd_flush (unix_stream * s) * to come next. */ static void -fd_alloc (unix_stream * s, gfc_offset where, int *len) +fd_alloc (unix_stream * s, gfc_offset where, + int *len __attribute__ ((unused))) { char *new_buffer; int n, read_len; @@ -606,7 +608,8 @@ mmap_flush (unix_stream * s) * guaranteed to be mappable. */ static try -mmap_alloc (unix_stream * s, gfc_offset where, int *len) +mmap_alloc (unix_stream * s, gfc_offset where, + int *len __attribute__ ((unused))) { gfc_offset offset; int length; @@ -711,7 +714,7 @@ mmap_close (unix_stream * s) static try -mmap_sfree (unix_stream * s) +mmap_sfree (unix_stream * s __attribute__ ((unused))) { return SUCCESS; } @@ -721,7 +724,7 @@ mmap_sfree (unix_stream * s) * mmap()-ed, we fall back to the file descriptor functions. */ static try -mmap_open (unix_stream * s) +mmap_open (unix_stream * s __attribute__ ((unused))) { char *p; int i; @@ -827,7 +830,7 @@ mem_seek (unix_stream * s, gfc_offset of static int -mem_truncate (unix_stream * s) +mem_truncate (unix_stream * s __attribute__ ((unused))) { return SUCCESS; } @@ -843,7 +846,7 @@ mem_close (unix_stream * s) static try -mem_sfree (unix_stream * s) +mem_sfree (unix_stream * s __attribute__ ((unused))) { return SUCCESS; } ============================================================ Index: libgfortran/io/write.c --- io/write.c 15 May 2005 15:33:12 -0000 1.36 +++ io/write.c 15 May 2005 21:53:42 -0000 @@ -181,7 +181,7 @@ calculate_exp (int d) for Gw.dEe, n' ' means e+2 blanks */ static fnode * -calculate_G_format (fnode *f, double value, int len, int *num_blank) +calculate_G_format (fnode *f, double value, int *num_blank) { int e = f->u.real.e; int d = f->u.real.d; @@ -271,7 +271,7 @@ calculate_G_format (fnode *f, double val /* Output a real number according to its format which is FMT_G free. */ static void -output_float (fnode *f, double value, int len) +output_float (fnode *f, double value) { /* This must be large enough to accurately hold any value. */ char buffer[32]; @@ -732,13 +732,13 @@ write_float (fnode *f, const char *sourc if (f->format != FMT_G) { - output_float (f, n, len); + output_float (f, n); } else { save_scale_factor = g.scale_factor; - f2 = calculate_G_format(f, n, len, &nb); - output_float (f2, n, len); + f2 = calculate_G_format(f, n, &nb); + output_float (f2, n); g.scale_factor = save_scale_factor; if (f2 != NULL) free_mem(f2); @@ -1359,13 +1359,13 @@ nml_write_obj (namelist_info * obj, inde if (base) { len =strlen (base->var_name); - for (dim_i = 0; dim_i < strlen (base_name); dim_i++) + for (dim_i = 0; dim_i < (index_type) strlen (base_name); dim_i++) { cup = toupper (base_name[dim_i]); write_character (&cup, 1); } } - for (dim_i =len; dim_i < strlen (obj->var_name); dim_i++) + for (dim_i =len; dim_i < (index_type) strlen (obj->var_name); dim_i++) { cup = toupper (obj->var_name[dim_i]); write_character (&cup, 1); ============================================================ Index: libgfortran/configure.ac --- libgfortran/configure.ac 15 May 2005 15:37:06 -0000 1.25 +++ libgfortran/configure.ac 15 May 2005 21:53:42 -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" 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 15 May 2005 21:53:45 -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" 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
Attachment:
pgp00000.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |