Further warning fixes for libgfortran
Andreas Jaeger
aj@suse.de
Sun May 15 12:05:00 GMT 2005
With these patches there will be no warnings generated by
"-Wstrict-prototypes" - and some less with "-W -pedantic".
Tested on Linux/x86-64. Ok to commit?
Andreas
2005-05-15 Andreas Jaeger <aj@suse.de>
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
Index: runtime/normalize.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/runtime/normalize.c,v
retrieving revision 1.3
diff -u -p -r1.3 normalize.c
--- runtime/normalize.c 12 Jan 2005 21:27:31 -0000 1.3
+++ runtime/normalize.c 15 May 2005 12:03:47 -0000
@@ -1,5 +1,5 @@
/* Nelper routines to convert from integer to real.
- Copyright 2004 Free Software Foundation, Inc.
+ Copyright 2004, 2005 Free Software Foundation, Inc.
Contributed by Paul Brook.
This file is part of the GNU Fortran 95 runtime library (libgfortran).
@@ -36,7 +36,7 @@ Boston, MA 02111-1307, USA. */
/* Return the largest value less than one representable in a REAL*4. */
static inline GFC_REAL_4
-almostone_r4 ()
+almostone_r4 (void)
{
#ifdef HAVE_NEXTAFTERF
return nextafterf (1.0f, 0.0f);
@@ -65,7 +65,7 @@ almostone_r4 ()
/* Return the largest value less than one representable in a REAL*8. */
static inline GFC_REAL_8
-almostone_r8 ()
+almostone_r8 (void)
{
#ifdef HAVE_NEXTAFTER
return nextafter (1.0, 0.0);
Index: runtime/environ.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/runtime/environ.c,v
retrieving revision 1.11
diff -u -p -r1.11 environ.c
--- runtime/environ.c 10 Apr 2005 13:08:12 -0000 1.11
+++ runtime/environ.c 15 May 2005 12:03:47 -0000
@@ -46,7 +46,7 @@ Boston, MA 02111-1307, USA. */
* but other variables are checked during execution of the user's
* program. */
-options_t options = { };
+options_t options;
typedef struct variable
@@ -326,7 +326,7 @@ show_sep (variable * v)
static void
-init_string (variable * v)
+init_string (variable * v __attribute__ ((unused)))
{
}
@@ -361,7 +361,7 @@ static choice rounding[] = {
{"UP", FP_ROUND_UP},
{"DOWN", FP_ROUND_DOWN},
{"ZERO", FP_ROUND_ZERO},
- {NULL}
+ {NULL, 0}
};
static choice precision[] =
@@ -369,14 +369,14 @@ static choice precision[] =
{ "24", 1},
{ "53", 2},
{ "64", 0},
- { NULL}
+ { NULL, 0}
};
static choice signal_choices[] =
{
{ "IGNORE", 1},
{ "ABORT", 0},
- { NULL}
+ { NULL, 0}
};
@@ -463,98 +463,100 @@ show_signal (variable * v)
static variable variable_table[] = {
{"GFORTRAN_STDIN_UNIT", 5, &options.stdin_unit, init_integer, show_integer,
"Unit number that will be preconnected to standard input\n"
- "(No preconnection if negative)"},
+ "(No preconnection if negative)", 0},
{"GFORTRAN_STDOUT_UNIT", 6, &options.stdout_unit, init_integer,
show_integer,
"Unit number that will be preconnected to standard output\n"
- "(No preconnection if negative)"},
+ "(No preconnection if negative)", 0},
{"GFORTRAN_STDERR_UNIT", 0, &options.stderr_unit, init_integer,
show_integer,
"Unit number that will be preconnected to standard error\n"
- "(No preconnection if negative)"},
+ "(No preconnection if negative)", 0},
{"GFORTRAN_USE_STDERR", 1, &options.use_stderr, init_boolean,
show_boolean,
- "Sends library output to standard error instead of standard output."},
+ "Sends library output to standard error instead of standard output.", 0},
{"GFORTRAN_TMPDIR", 0, NULL, init_string, show_string,
"Directory for scratch files. Overrides the TMP environment variable\n"
- "If TMP is not set " DEFAULT_TEMPDIR " is used."},
+ "If TMP is not set " DEFAULT_TEMPDIR " is used.", 0},
{"GFORTRAN_UNBUFFERED_ALL", 0, &options.all_unbuffered, init_boolean,
show_boolean,
"If TRUE, all output is unbuffered. This will slow down large writes "
- "but can be\nuseful for forcing data to be displayed immediately."},
+ "but can be\nuseful for forcing data to be displayed immediately.", 0},
{"GFORTRAN_SHOW_LOCUS", 1, &options.locus, init_boolean, show_boolean,
- "If TRUE, print filename and line number where runtime errors happen."},
+ "If TRUE, print filename and line number where runtime errors happen.", 0},
{"GFORTRAN_OPTIONAL_PLUS", 0, &options.optional_plus, init_boolean, show_boolean,
- "Print optional plus signs in numbers where permitted. Default FALSE."},
+ "Print optional plus signs in numbers where permitted. Default FALSE.", 0},
{"GFORTRAN_DEFAULT_RECL", DEFAULT_RECL, &options.default_recl,
init_unsigned_integer, show_integer,
"Default maximum record length for sequential files. Most useful for\n"
"adjusting line length of preconnected units. Default "
- stringize (DEFAULT_RECL)},
+ stringize (DEFAULT_RECL), 0},
{"GFORTRAN_LIST_SEPARATOR", 0, NULL, init_sep, show_sep,
"Separatator to use when writing list output. May contain any number of "
- "spaces\nand at most one comma. Default is a single space."},
+ "spaces\nand at most one comma. Default is a single space.", 0},
/* Memory related controls */
{"GFORTRAN_MEM_INIT", 0, NULL, init_mem, show_mem,
"How to initialize allocated memory. Default value is NONE for no "
"initialization\n(faster), NAN for a Not-a-Number with the mantissa "
- "0x40f95 or a custom\nhexadecimal value"},
+ "0x40f95 or a custom\nhexadecimal value", 0},
{"GFORTRAN_MEM_CHECK", 0, &options.mem_check, init_boolean, show_boolean,
- "Whether memory still allocated will be reported when the program ends."},
+ "Whether memory still allocated will be reported when the program ends.",
+ 0},
/* Signal handling (Unix). */
{"GFORTRAN_SIGHUP", 0, &options.sighup, init_signal, show_signal,
- "Whether the program will IGNORE or ABORT on SIGHUP."},
+ "Whether the program will IGNORE or ABORT on SIGHUP.", 0},
{"GFORTRAN_SIGINT", 0, &options.sigint, init_signal, show_signal,
- "Whether the program will IGNORE or ABORT on SIGINT."},
+ "Whether the program will IGNORE or ABORT on SIGINT.", 0},
/* Floating point control */
{"GFORTRAN_FPU_ROUND", 0, &options.fpu_round, init_round, show_round,
- "Set floating point rounding. Values are NEAREST, UP, DOWN, ZERO."},
+ "Set floating point rounding. Values are NEAREST, UP, DOWN, ZERO.", 0},
{"GFORTRAN_FPU_PRECISION", 0, &options.fpu_precision, init_precision,
show_precision,
- "Precision of intermediate results. Values are 24, 53 and 64."},
+ "Precision of intermediate results. Values are 24, 53 and 64.", 0},
{"GFORTRAN_FPU_INVALID", 1, &options.fpu_invalid, init_boolean,
show_boolean,
- "Raise a floating point exception on invalid FP operation."},
+ "Raise a floating point exception on invalid FP operation.", 0},
{"GFORTRAN_FPU_DENORMAL", 1, &options.fpu_denormal, init_boolean,
show_boolean,
- "Raise a floating point exception when denormal numbers are encountered."},
+ "Raise a floating point exception when denormal numbers are encountered.",
+ 0},
{"GFORTRAN_FPU_ZERO", 0, &options.fpu_zerodiv, init_boolean, show_boolean,
- "Raise a floating point exception when dividing by zero."},
+ "Raise a floating point exception when dividing by zero.", 0},
{"GFORTRAN_FPU_OVERFLOW", 0, &options.fpu_overflow, init_boolean,
show_boolean,
- "Raise a floating point exception on overflow."},
+ "Raise a floating point exception on overflow.", 0},
{"GFORTRAN_FPU_UNDERFLOW", 0, &options.fpu_underflow, init_boolean,
show_boolean,
- "Raise a floating point exception on underflow."},
+ "Raise a floating point exception on underflow.", 0},
{"GFORTRAN_FPU_PRECISION", 0, &options.fpu_precision_loss, init_boolean,
show_boolean,
- "Raise a floating point exception on precision loss."},
+ "Raise a floating point exception on precision loss.", 0},
- {NULL}
+ {NULL, 0, NULL, NULL, NULL, NULL, 0}
};
Index: runtime/main.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/runtime/main.c,v
retrieving revision 1.6
diff -u -p -r1.6 main.c
--- runtime/main.c 12 Jan 2005 21:27:31 -0000 1.6
+++ runtime/main.c 15 May 2005 12:03:47 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
Contributed by Andy Vaught and Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran 95 runtime library (libgfortran).
@@ -113,7 +113,7 @@ init (void)
/* Cleanup the runtime library. */
static void __attribute__((destructor))
-cleanup ()
+cleanup (void)
{
close_units ();
}
Index: intrinsics/random.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/intrinsics/random.c,v
retrieving revision 1.13
diff -u -p -r1.13 random.c
--- intrinsics/random.c 4 May 2005 21:38:15 -0000 1.13
+++ intrinsics/random.c 15 May 2005 12:03:47 -0000
@@ -1,5 +1,5 @@
/* Implementation of the RANDOM intrinsics
- Copyright 2002, 2004 Free Software Foundation, Inc.
+ Copyright 2002, 2004, 2005 Free Software Foundation, Inc.
Contributed by Lars Segerlund <seger@linuxmail.org>
and Steve Kargl.
@@ -440,7 +440,7 @@ KISS algorithm. */
#define GFC_SR(k, n) ((k)^((k)>>(n)))
static const GFC_INTEGER_4 kiss_size = 4;
-#define KISS_DEFAULT_SEED {123456789, 362436069, 521288629, 916191069};
+#define KISS_DEFAULT_SEED {123456789, 362436069, 521288629, 916191069}
static const GFC_UINTEGER_4 kiss_default_seed[4] = KISS_DEFAULT_SEED;
static GFC_UINTEGER_4 kiss_seed[4] = KISS_DEFAULT_SEED;
Index: io/transfer.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/transfer.c,v
retrieving revision 1.37
diff -u -p -r1.37 transfer.c
--- io/transfer.c 17 Apr 2005 20:09:37 -0000 1.37
+++ io/transfer.c 15 May 2005 12:03:48 -0000
@@ -82,7 +82,7 @@ gfc_unit *current_unit = NULL;
static int sf_seen_eor = 0;
static int eor_condition = 0;
-char scratch[SCRATCH_SIZE] = { };
+char scratch[SCRATCH_SIZE];
static char *line_buffer = NULL;
static unit_advance advance_status;
@@ -90,7 +90,7 @@ static unit_advance advance_status;
static st_option advance_opt[] = {
{"yes", ADVANCE_YES},
{"no", ADVANCE_NO},
- {NULL}
+ {NULL, 0}
};
Index: io/lock.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/lock.c,v
retrieving revision 1.6
diff -u -p -r1.6 lock.c
--- io/lock.c 17 Apr 2005 20:09:37 -0000 1.6
+++ io/lock.c 15 May 2005 12:03:48 -0000
@@ -33,11 +33,11 @@ Boston, MA 02111-1307, USA. */
#include "libgfortran.h"
#include "io.h"
-st_parameter ioparm = { };
+st_parameter ioparm;
iexport_data(ioparm);
-namelist_info *ionml = 0;
-global_t g = { };
+namelist_info *ionml;
+global_t g;
/* library_start()-- Called with a library call is entered. */
Index: io/close.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/close.c,v
retrieving revision 1.5
diff -u -p -r1.5 close.c
--- io/close.c 12 Jan 2005 21:27:30 -0000 1.5
+++ io/close.c 15 May 2005 12:03:48 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
Contributed by Andy Vaught
This file is part of the GNU Fortran 95 runtime library (libgfortran).
@@ -38,7 +38,7 @@ close_status;
static st_option status_opt[] = {
{"keep", CLOSE_KEEP},
{"delete", CLOSE_DELETE},
- {NULL}
+ {NULL, 0}
};
Index: io/io.h
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/io.h,v
retrieving revision 1.18
diff -u -p -r1.18 io.h
--- io/io.h 17 Apr 2005 20:09:37 -0000 1.18
+++ io/io.h 15 May 2005 12:03:48 -0000
@@ -597,13 +597,13 @@ internal_proto(list_formatted_read);
extern void finish_list_read (void);
internal_proto(finish_list_read);
-extern void init_at_eol();
+extern void init_at_eol (void);
internal_proto(init_at_eol);
-extern void namelist_read();
+extern void namelist_read (void);
internal_proto(namelist_read);
-extern void namelist_write();
+extern void namelist_write (void);
internal_proto(namelist_write);
/* write.c */
--
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/fortran/attachments/20050515/ade7a1b5/attachment.sig>
More information about the Fortran
mailing list