configure.ac: Add additional warning flags.

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

	* io/write.c (calculate_G_format): Remove unused parameter.
	(output_float): Remove unused parameter.
	(write_float): Change callers.
	(nml_write_obj): Avoid signed warning.
	Make variable const to support -Wwrite-strings.

	* 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.
	(nml_match_name): Add const to make compile with -Wwrite-strings.

	* io/format.c: Add initializer.

From-SVN: r99839
This commit is contained in:
Andreas Jaeger 2005-05-17 18:54:58 +02:00 committed by Andreas Jaeger
parent 2ba99e3da1
commit 8f2a14065c
9 changed files with 73 additions and 35 deletions

View File

@ -1,3 +1,32 @@
2005-05-16 Andreas Jaeger <aj@suse.de>
* configure.ac: Add additional warning flags.
* configure: Regenerate.
* io/write.c (calculate_G_format): Remove unused parameter.
(output_float): Remove unused parameter.
(write_float): Change callers.
(nml_write_obj): Avoid signed warning.
Make variable const to support -Wwrite-strings.
* 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.
(nml_match_name): Add const to make compile with -Wwrite-strings.
* io/format.c: Add initializer.
2005-05-15 Andreas Jaeger <aj@suse.de> 2005-05-15 Andreas Jaeger <aj@suse.de>
* m4/eoshift1.m4: Initialize variables to avoid warnings. * m4/eoshift1.m4: Initialize variables to avoid warnings.

View File

@ -2937,7 +2937,7 @@ if test "x$GCC" = "xyes"; then
AM_FCFLAGS="-Wall" AM_FCFLAGS="-Wall"
## We like to use C99 routines when available. This makes sure that ## We like to use C99 routines when available. This makes sure that
## __STDC_VERSION__ is set such that libc includes make them available. ## __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 fi

View File

@ -114,7 +114,7 @@ if test "x$GCC" = "xyes"; then
AM_FCFLAGS="-Wall" AM_FCFLAGS="-Wall"
## We like to use C99 routines when available. This makes sure that ## We like to use C99 routines when available. This makes sure that
## __STDC_VERSION__ is set such that libc includes make them available. ## __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 fi
AC_SUBST(AM_FCFLAGS) AC_SUBST(AM_FCFLAGS)
AC_SUBST(AM_CFLAGS) AC_SUBST(AM_CFLAGS)

View File

@ -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 Contributed by Andy Vaught
This file is part of the GNU Fortran 95 runtime library (libgfortran). 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 format_token saved_token;
static int value, format_string_len, reversion_ok; 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 */ /* Error messages */

View File

@ -704,7 +704,7 @@ read_integer (int length)
/* Read a character variable. */ /* Read a character variable. */
static void static void
read_character (int length) read_character (int length __attribute__ ((unused)))
{ {
char c, quote, message[100]; char c, quote, message[100];
@ -1693,7 +1693,7 @@ nml_untouch_nodes (void)
on no match. */ on no match. */
static void static void
nml_match_name (char *name, index_type len) nml_match_name (const char *name, index_type len)
{ {
index_type i; index_type i;
char c; char c;

View File

@ -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 Contributed by Andy Vaught
This file is part of the GNU Fortran 95 runtime library (libgfortran). 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[] = { static st_option access_opt[] = {
{"sequential", ACCESS_SEQUENTIAL}, {"sequential", ACCESS_SEQUENTIAL},
{"direct", ACCESS_DIRECT}, {"direct", ACCESS_DIRECT},
{NULL} {NULL, 0}
}; };
static st_option action_opt[] = static st_option action_opt[] =
@ -46,14 +47,14 @@ static st_option action_opt[] =
{ "read", ACTION_READ}, { "read", ACTION_READ},
{ "write", ACTION_WRITE}, { "write", ACTION_WRITE},
{ "readwrite", ACTION_READWRITE}, { "readwrite", ACTION_READWRITE},
{ NULL} { NULL, 0}
}; };
static st_option blank_opt[] = static st_option blank_opt[] =
{ {
{ "null", BLANK_NULL}, { "null", BLANK_NULL},
{ "zero", BLANK_ZERO}, { "zero", BLANK_ZERO},
{ NULL} { NULL, 0}
}; };
static st_option delim_opt[] = static st_option delim_opt[] =
@ -61,14 +62,14 @@ static st_option delim_opt[] =
{ "none", DELIM_NONE}, { "none", DELIM_NONE},
{ "apostrophe", DELIM_APOSTROPHE}, { "apostrophe", DELIM_APOSTROPHE},
{ "quote", DELIM_QUOTE}, { "quote", DELIM_QUOTE},
{ NULL} { NULL, 0}
}; };
static st_option form_opt[] = static st_option form_opt[] =
{ {
{ "formatted", FORM_FORMATTED}, { "formatted", FORM_FORMATTED},
{ "unformatted", FORM_UNFORMATTED}, { "unformatted", FORM_UNFORMATTED},
{ NULL} { NULL, 0}
}; };
static st_option position_opt[] = static st_option position_opt[] =
@ -76,7 +77,7 @@ static st_option position_opt[] =
{ "asis", POSITION_ASIS}, { "asis", POSITION_ASIS},
{ "rewind", POSITION_REWIND}, { "rewind", POSITION_REWIND},
{ "append", POSITION_APPEND}, { "append", POSITION_APPEND},
{ NULL} { NULL, 0}
}; };
static st_option status_opt[] = static st_option status_opt[] =
@ -86,14 +87,14 @@ static st_option status_opt[] =
{ "new", STATUS_NEW}, { "new", STATUS_NEW},
{ "replace", STATUS_REPLACE}, { "replace", STATUS_REPLACE},
{ "scratch", STATUS_SCRATCH}, { "scratch", STATUS_SCRATCH},
{ NULL} { NULL, 0}
}; };
static st_option pad_opt[] = static st_option pad_opt[] =
{ {
{ "yes", PAD_YES}, { "yes", PAD_YES},
{ "no", PAD_NO}, { "no", PAD_NO},
{ NULL} { NULL, 0}
}; };

View File

@ -1205,7 +1205,7 @@ data_transfer_init (int read_flag)
#define MAX_READ 4096 #define MAX_READ 4096
static void static void
next_record_r (int done) next_record_r (void)
{ {
int rlength, length; int rlength, length;
gfc_offset new; gfc_offset new;
@ -1296,7 +1296,7 @@ next_record_r (int done)
/* Position to the next record in write mode. */ /* Position to the next record in write mode. */
static void static void
next_record_w (int done) next_record_w (void)
{ {
gfc_offset c, m; gfc_offset c, m;
int length; int length;
@ -1395,9 +1395,9 @@ next_record (int done)
current_unit->read_bad = 0; current_unit->read_bad = 0;
if (g.mode == READING) if (g.mode == READING)
next_record_r (done); next_record_r ();
else else
next_record_w (done); next_record_w ();
/* keep position up to date for INQUIRE */ /* keep position up to date for INQUIRE */
current_unit->flags.position = POSITION_ASIS; current_unit->flags.position = POSITION_ASIS;
@ -1482,7 +1482,9 @@ finalize_transfer (void)
data transfer, it just updates the length counter. */ data transfer, it just updates the length counter. */
static void 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) if (ioparm.iolength != NULL)
*ioparm.iolength += len; *ioparm.iolength += len;

View File

@ -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 Contributed by Andy Vaught
This file is part of the GNU Fortran 95 runtime library (libgfortran). This file is part of the GNU Fortran 95 runtime library (libgfortran).
@ -329,7 +330,8 @@ fd_flush (unix_stream * s)
* to come next. */ * to come next. */
static void 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; char *new_buffer;
int n, read_len; int n, read_len;
@ -606,7 +608,8 @@ mmap_flush (unix_stream * s)
* guaranteed to be mappable. */ * guaranteed to be mappable. */
static try 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; gfc_offset offset;
int length; int length;
@ -711,7 +714,7 @@ mmap_close (unix_stream * s)
static try static try
mmap_sfree (unix_stream * s) mmap_sfree (unix_stream * s __attribute__ ((unused)))
{ {
return SUCCESS; return SUCCESS;
} }
@ -721,7 +724,7 @@ mmap_sfree (unix_stream * s)
* mmap()-ed, we fall back to the file descriptor functions. */ * mmap()-ed, we fall back to the file descriptor functions. */
static try static try
mmap_open (unix_stream * s) mmap_open (unix_stream * s __attribute__ ((unused)))
{ {
char *p; char *p;
int i; int i;
@ -827,7 +830,7 @@ mem_seek (unix_stream * s, gfc_offset offset)
static int static int
mem_truncate (unix_stream * s) mem_truncate (unix_stream * s __attribute__ ((unused)))
{ {
return SUCCESS; return SUCCESS;
} }
@ -843,7 +846,7 @@ mem_close (unix_stream * s)
static try static try
mem_sfree (unix_stream * s) mem_sfree (unix_stream * s __attribute__ ((unused)))
{ {
return SUCCESS; return SUCCESS;
} }

View File

@ -181,7 +181,7 @@ calculate_exp (int d)
for Gw.dEe, n' ' means e+2 blanks */ for Gw.dEe, n' ' means e+2 blanks */
static fnode * 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 e = f->u.real.e;
int d = f->u.real.d; int d = f->u.real.d;
@ -271,7 +271,7 @@ calculate_G_format (fnode *f, double value, int len, int *num_blank)
/* Output a real number according to its format which is FMT_G free. */ /* Output a real number according to its format which is FMT_G free. */
static void 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. */ /* This must be large enough to accurately hold any value. */
char buffer[32]; char buffer[32];
@ -732,13 +732,13 @@ write_float (fnode *f, const char *source, int len)
if (f->format != FMT_G) if (f->format != FMT_G)
{ {
output_float (f, n, len); output_float (f, n);
} }
else else
{ {
save_scale_factor = g.scale_factor; save_scale_factor = g.scale_factor;
f2 = calculate_G_format(f, n, len, &nb); f2 = calculate_G_format(f, n, &nb);
output_float (f2, n, len); output_float (f2, n);
g.scale_factor = save_scale_factor; g.scale_factor = save_scale_factor;
if (f2 != NULL) if (f2 != NULL)
free_mem(f2); free_mem(f2);
@ -1325,7 +1325,7 @@ list_formatted_write (bt type, void *p, int len)
/* Stores the delimiter to be used for character objects. */ /* Stores the delimiter to be used for character objects. */
static char * nml_delim; static const char * nml_delim;
static namelist_info * static namelist_info *
nml_write_obj (namelist_info * obj, index_type offset, nml_write_obj (namelist_info * obj, index_type offset,
@ -1359,13 +1359,13 @@ nml_write_obj (namelist_info * obj, index_type offset,
if (base) if (base)
{ {
len =strlen (base->var_name); 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]); cup = toupper (base_name[dim_i]);
write_character (&cup, 1); 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]); cup = toupper (obj->var_name[dim_i]);
write_character (&cup, 1); write_character (&cup, 1);