This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fortran dir warning patches part 3/3
- To: egcs-patches at egcs dot cygnus dot com
- Subject: Fortran dir warning patches part 3/3
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Sat, 27 Mar 1999 09:43:17 -0500 (EST)
These patches address warnings in the gcc/f/ directory exposed
by using extra warning flags: -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations and -Wwrite-strings.
This is part 3/3 okay to install?
Thanks,
--Kaveh
Sat Mar 27 08:49:20 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* lex.c (ffelex_type_string_, ffelex_token_new_character,
ffelex_token_new_name, ffelex_token_new_names,
ffelex_token_new_number): Const-ify a char*.
* lex.h (ffelex_token_new_character, ffelex_token_new_name,
ffelex_token_new_names, ffelex_token_new_number): Likewise.
* malloc.c (malloc_types_, malloc_pool_new, malloc_new_inpool_,
malloc_new_zinpool_): Likewise.
* malloc.h (malloc_new_inpool_, malloc_new_zinpool_,
malloc_pool_new): Likewise.
* name.c (ffename_space_drive_global, ffename_space_drive_symbol):
Protoize.
* name.h (ffename_space_drive_global, ffename_space_drive_symbol):
Likewise.
* symbol.c (ffesymbol_state_name_, ffesymbol_attr_name_,
ffesymbol_attrs_string): Const-ify a char*.
(ffesymbol_drive, ffesymbol_drive_sfnames): Protoize.
(ffesymbol_state_string): Const-ify a char*.
* symbol.h (ffesymbol_attrs_string): Likewise.
(ffesymbol_drive, ffesymbol_drive_sfnames): Protoize.
(ffesymbol_state_string): Const-ify a char*.
* target.c (ffetarget_layout): Likewise.
* target.h (ffetarget_layout): Likewise.
diff -rup orig/egcs-CVS19990325/gcc/f/lex.c egcs-CVS19990325/gcc/f/lex.c
--- orig/egcs-CVS19990325/gcc/f/lex.c Tue Feb 16 10:20:25 1999
+++ egcs-CVS19990325/gcc/f/lex.c Fri Mar 26 13:28:22 1999
@@ -1751,10 +1751,10 @@ ffelex_token_new_ ()
return t;
}
-static char *
+static const char *
ffelex_type_string_ (ffelexType type)
{
- static char *types[] = {
+ static const char *types[] = {
"FFELEX_typeNONE",
"FFELEX_typeCOMMENT",
"FFELEX_typeEOS",
@@ -4546,7 +4546,7 @@ ffelex_token_names_from_names (ffelexTok
/* Make a new CHARACTER token. */
ffelexToken
-ffelex_token_new_character (char *s, ffewhereLine l, ffewhereColumn c)
+ffelex_token_new_character (const char *s, ffewhereLine l, ffewhereColumn c)
{
ffelexToken t;
@@ -4581,7 +4581,7 @@ ffelex_token_new_eof ()
/* Make a new NAME token. */
ffelexToken
-ffelex_token_new_name (char *s, ffewhereLine l, ffewhereColumn c)
+ffelex_token_new_name (const char *s, ffewhereLine l, ffewhereColumn c)
{
ffelexToken t;
@@ -4602,7 +4602,7 @@ ffelex_token_new_name (char *s, ffewhere
/* Make a new NAMES token. */
ffelexToken
-ffelex_token_new_names (char *s, ffewhereLine l, ffewhereColumn c)
+ffelex_token_new_names (const char *s, ffewhereLine l, ffewhereColumn c)
{
ffelexToken t;
@@ -4631,7 +4631,7 @@ ffelex_token_new_names (char *s, ffewher
in the original string. */
ffelexToken
-ffelex_token_new_number (char *s, ffewhereLine l, ffewhereColumn c)
+ffelex_token_new_number (const char *s, ffewhereLine l, ffewhereColumn c)
{
ffelexToken t;
ffeTokenLength len;
diff -rup orig/egcs-CVS19990325/gcc/f/lex.h egcs-CVS19990325/gcc/f/lex.h
--- orig/egcs-CVS19990325/gcc/f/lex.h Tue Feb 16 10:20:25 1999
+++ egcs-CVS19990325/gcc/f/lex.h Fri Mar 26 13:28:47 1999
@@ -148,14 +148,14 @@ ffelexToken ffelex_token_names_from_name
ffeTokenLength start,
ffeTokenLength len);
ffelexToken ffelex_token_new (void);
-ffelexToken ffelex_token_new_character (char *s, ffewhereLine l,
+ffelexToken ffelex_token_new_character (const char *s, ffewhereLine l,
ffewhereColumn c);
ffelexToken ffelex_token_new_eof (void);
-ffelexToken ffelex_token_new_name (char *s, ffewhereLine l,
+ffelexToken ffelex_token_new_name (const char *s, ffewhereLine l,
ffewhereColumn c);
-ffelexToken ffelex_token_new_names (char *s, ffewhereLine l,
+ffelexToken ffelex_token_new_names (const char *s, ffewhereLine l,
ffewhereColumn c);
-ffelexToken ffelex_token_new_number (char *s, ffewhereLine l,
+ffelexToken ffelex_token_new_number (const char *s, ffewhereLine l,
ffewhereColumn c);
ffelexToken ffelex_token_new_simple_ (ffelexType type, ffewhereLine l,
ffewhereColumn c);
diff -rup orig/egcs-CVS19990325/gcc/f/malloc.c egcs-CVS19990325/gcc/f/malloc.c
--- orig/egcs-CVS19990325/gcc/f/malloc.c Tue Feb 16 10:20:25 1999
+++ egcs-CVS19990325/gcc/f/malloc.c Fri Mar 26 11:11:15 1999
@@ -70,7 +70,7 @@ struct _malloc_root_ malloc_root_
static void *malloc_reserve_ = NULL; /* For crashes. */
#if MALLOC_DEBUG
-static char *malloc_types_[] =
+static const char *malloc_types_[] =
{"KS", "KSR", "NF", "NFR", "US", "USR"};
#endif
@@ -234,7 +234,7 @@ malloc_pool_kill (mallocPool p)
Makes a new pool with the given name and default new-chunk allocation. */
mallocPool
-malloc_pool_new (char *name, mallocPool parent,
+malloc_pool_new (const char *name, mallocPool parent,
unsigned long chunks UNUSED)
{
mallocPool p;
@@ -384,7 +384,7 @@ malloc_new_ (mallocSize s)
add it to the list of mallocArea_s for the pool. */
void *
-malloc_new_inpool_ (mallocPool pool, mallocType_ type, char *name, mallocSize s)
+malloc_new_inpool_ (mallocPool pool, mallocType_ type, const char *name, mallocSize s)
{
void *ptr;
mallocArea_ a;
@@ -437,7 +437,7 @@ malloc_new_inpool_ (mallocPool pool, mal
you pass it a 0). */
void *
-malloc_new_zinpool_ (mallocPool pool, mallocType_ type, char *name, mallocSize s,
+malloc_new_zinpool_ (mallocPool pool, mallocType_ type, const char *name, mallocSize s,
int z)
{
void *ptr;
diff -rup orig/egcs-CVS19990325/gcc/f/malloc.h egcs-CVS19990325/gcc/f/malloc.h
--- orig/egcs-CVS19990325/gcc/f/malloc.h Tue Feb 16 10:20:25 1999
+++ egcs-CVS19990325/gcc/f/malloc.h Fri Mar 26 11:11:12 1999
@@ -109,14 +109,14 @@ void malloc_init (void);
void malloc_kill_inpool_ (mallocPool pool, mallocType_ type, void *ptr,
mallocSize size);
void *malloc_new_ (mallocSize size);
-void *malloc_new_inpool_ (mallocPool pool, mallocType_ type, char *name,
+void *malloc_new_inpool_ (mallocPool pool, mallocType_ type, const char *name,
mallocSize size);
-void *malloc_new_zinpool_ (mallocPool pool, mallocType_ type, char *name,
+void *malloc_new_zinpool_ (mallocPool pool, mallocType_ type, const char *name,
mallocSize size, int z);
void malloc_pool_display (mallocPool p);
char malloc_pool_find_ (mallocPool p, mallocPool parent);
void malloc_pool_kill (mallocPool p);
-mallocPool malloc_pool_new (char *name, mallocPool parent, unsigned long chunks);
+mallocPool malloc_pool_new (const char *name, mallocPool parent, unsigned long chunks);
mallocPool malloc_pool_use (mallocPool p);
void *malloc_resize_ (void *ptr, mallocSize new_size);
void *malloc_resize_inpool_ (mallocPool pool, mallocType_ type, void *ptr,
diff -rup orig/egcs-CVS19990325/gcc/f/name.c egcs-CVS19990325/gcc/f/name.c
--- orig/egcs-CVS19990325/gcc/f/name.c Tue Feb 16 10:20:25 1999
+++ egcs-CVS19990325/gcc/f/name.c Fri Mar 26 10:44:04 1999
@@ -167,7 +167,7 @@ ffename_lookup (ffenameSpace ns, ffelexT
ffename_space_drive_global(ns,fn); */
void
-ffename_space_drive_global (ffenameSpace ns, ffeglobal (*fn) ())
+ffename_space_drive_global (ffenameSpace ns, ffeglobal (*fn) (ffeglobal))
{
ffename n;
@@ -188,7 +188,7 @@ ffename_space_drive_global (ffenameSpace
ffename_space_drive_symbol(ns,fn); */
void
-ffename_space_drive_symbol (ffenameSpace ns, ffesymbol (*fn) ())
+ffename_space_drive_symbol (ffenameSpace ns, ffesymbol (*fn) (ffesymbol))
{
ffename n;
diff -rup orig/egcs-CVS19990325/gcc/f/name.h egcs-CVS19990325/gcc/f/name.h
--- orig/egcs-CVS19990325/gcc/f/name.h Tue Feb 16 10:20:25 1999
+++ egcs-CVS19990325/gcc/f/name.h Fri Mar 26 10:43:57 1999
@@ -75,8 +75,8 @@ struct _ffename_space_
ffename ffename_find (ffenameSpace ns, ffelexToken t);
void ffename_kill (ffenameSpace ns, ffename n);
ffename ffename_lookup (ffenameSpace ns, ffelexToken t);
-void ffename_space_drive_global (ffenameSpace ns, ffeglobal (*fn) ());
-void ffename_space_drive_symbol (ffenameSpace ns, ffesymbol (*fn) ());
+void ffename_space_drive_global (ffenameSpace ns, ffeglobal (*fn) (ffeglobal));
+void ffename_space_drive_symbol (ffenameSpace ns, ffesymbol (*fn) (ffesymbol));
void ffename_space_kill (ffenameSpace ns);
ffenameSpace ffename_space_new (mallocPool pool);
diff -rup orig/egcs-CVS19990325/gcc/f/symbol.c egcs-CVS19990325/gcc/f/symbol.c
--- orig/egcs-CVS19990325/gcc/f/symbol.c Tue Feb 16 10:21:50 1999
+++ egcs-CVS19990325/gcc/f/symbol.c Fri Mar 26 11:06:22 1999
@@ -117,7 +117,7 @@ static ffesymbolRetract_ *ffesymbol_retr
/* List of state names. */
-static char *ffesymbol_state_name_[] =
+static const char *ffesymbol_state_name_[] =
{
"?",
"@",
@@ -127,7 +127,7 @@ static char *ffesymbol_state_name_[] =
/* List of attribute names. */
-static char *ffesymbol_attr_name_[] =
+static const char *ffesymbol_attr_name_[] =
{
#define DEFATTR(ATTR,ATTRS,NAME) NAME,
#include "symbol.def"
@@ -316,7 +316,7 @@ ffesymbol_whine_state_ (ffebad bad, ffel
/* Returns a string representing the attributes set. */
-char *
+const char *
ffesymbol_attrs_string (ffesymbolAttrs attrs)
{
static char string[FFESYMBOL_attr * 12 + 20];
@@ -773,7 +773,7 @@ ffesymbol_declare_subrunit (ffelexToken
ffesymbol_drive (fn); */
void
-ffesymbol_drive (ffesymbol (*fn) ())
+ffesymbol_drive (ffesymbol (*fn) (ffesymbol))
{
assert (ffesymbol_sfunc_ == NULL); /* Might be ok, but not for current
uses. */
@@ -787,7 +787,7 @@ ffesymbol_drive (ffesymbol (*fn) ())
ffesymbol_drive_sfnames (fn); */
void
-ffesymbol_drive_sfnames (ffesymbol (*fn) ())
+ffesymbol_drive_sfnames (ffesymbol (*fn) (ffesymbol))
{
ffename_space_drive_symbol (ffesymbol_sfunc_, fn);
}
@@ -1348,7 +1348,7 @@ ffesymbol_signal_change (ffesymbol s)
/* Returns the string based on the state. */
-char *
+const char *
ffesymbol_state_string (ffesymbolState state)
{
if (state >= ARRAY_SIZE (ffesymbol_state_name_))
diff -rup orig/egcs-CVS19990325/gcc/f/symbol.h egcs-CVS19990325/gcc/f/symbol.h
--- orig/egcs-CVS19990325/gcc/f/symbol.h Tue Feb 16 10:21:54 1999
+++ egcs-CVS19990325/gcc/f/symbol.h Fri Mar 26 11:06:24 1999
@@ -158,7 +158,7 @@ struct _ffesymbol_
#define ffesymbol_arraysize(s) ((s)->array_size)
#define ffesymbol_attr(s,a) ((s)->attrs & ((ffesymbolAttrs) 1 << (a)))
#define ffesymbol_attrs(s) ((s)->attrs)
-char *ffesymbol_attrs_string (ffesymbolAttrs attrs);
+const char *ffesymbol_attrs_string (ffesymbolAttrs attrs);
#define ffesymbol_basictype(s) ffeinfo_basictype((s)->info)
void ffesymbol_check (ffesymbol s, ffelexToken t, bool maybe_intrin);
#define ffesymbol_common(s) ((s)->common)
@@ -177,8 +177,8 @@ ffesymbol ffesymbol_declare_sfdummy (ffe
ffesymbol ffesymbol_declare_subrunit (ffelexToken t);
#define ffesymbol_dims(s) ((s)->dims)
#define ffesymbol_dim_syms(s) ((s)->dim_syms)
-void ffesymbol_drive (ffesymbol (*fn) ());
-void ffesymbol_drive_sfnames (ffesymbol (*fn) ());
+void ffesymbol_drive (ffesymbol (*fn) (ffesymbol));
+void ffesymbol_drive_sfnames (ffesymbol (*fn) (ffesymbol));
#define ffesymbol_dummyargs(s) ((s)->dummy_args)
#if FFECOM_targetCURRENT == FFECOM_targetFFE
void ffesymbol_dump (ffesymbol s);
@@ -269,7 +269,7 @@ void ffesymbol_signal_change (ffesymbol
#define ffesymbol_specific(s) ((s)->specific)
#define ffesymbol_state(s) ((s)->state)
#define ffesymbol_state_is_specable(s) ((s) <= FFESYMBOL_stateSEEN)
-char *ffesymbol_state_string (ffesymbolState state);
+const char *ffesymbol_state_string (ffesymbolState state);
#define ffesymbol_storage(s) ((s)->storage)
void ffesymbol_terminate_0 (void);
void ffesymbol_terminate_1 (void);
diff -rup orig/egcs-CVS19990325/gcc/f/target.c egcs-CVS19990325/gcc/f/target.c
--- orig/egcs-CVS19990325/gcc/f/target.c Tue Feb 16 10:21:56 1999
+++ egcs-CVS19990325/gcc/f/target.c Fri Mar 26 12:12:08 1999
@@ -469,7 +469,7 @@ ffetarget_iszero_hollerith (ffetargetHol
data type info and the number of elements an array (1 for a scalar). */
void
-ffetarget_layout (char *error_text UNUSED, ffetargetAlign *alignment,
+ffetarget_layout (const char *error_text UNUSED, ffetargetAlign *alignment,
ffetargetAlign *modulo, ffetargetOffset *size,
ffeinfoBasictype bt, ffeinfoKindtype kt,
ffetargetCharacterSize charsize,
diff -rup orig/egcs-CVS19990325/gcc/f/target.h egcs-CVS19990325/gcc/f/target.h
--- orig/egcs-CVS19990325/gcc/f/target.h Sat Mar 13 21:29:56 1999
+++ egcs-CVS19990325/gcc/f/target.h Fri Mar 26 12:12:11 1999
@@ -732,7 +732,7 @@ void ffetarget_integer_bad_magical_prece
bool ffetarget_iszero_character1 (ffetargetCharacter1 constant);
#endif
bool ffetarget_iszero_hollerith (ffetargetHollerith constant);
-void ffetarget_layout (char *error_text, ffetargetAlign *alignment,
+void ffetarget_layout (const char *error_text, ffetargetAlign *alignment,
ffetargetAlign *modulo, ffetargetOffset *size,
ffeinfoBasictype bt, ffeinfoKindtype kt,
ffetargetCharacterSize charsize,