Commit 6864a6c6 by Bruce Korb Committed by Bruce Korb

Kaveh's warning patch from 11/19

From-SVN: r37958
parent 2c864b9a
2000-12-02 Bruce Korb <bkorb@gnu.org> 2000-12-02 Bruce Korb <bkorb@gnu.org>
From: 2000-11-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* fixfixes.c (emit_gnu_type, format_write): Prototype.
(format_write, char_macro_use_fix, char_macro_def_fix): Use gcc's
custom uppercase ctype macros.
* fixincl.c (do_version): Make static and add ATTRIBUTE_NORETURN.
Use gcc's custom uppercase ctype macros.
(main): Prototype.
(machine_matches): Add static prototype and constify variable.
(create_file, test_test, egrep_test): Add static prototype.
(quoted_file_exists): Likewise, and constify parameters.
(extract_quoted_files, internal_fix, start_fixer, fix_applies,
write_replacement, test_for_changes): Add static prototype.
(write_replacement, test_for_changes): Delete excess argument to
`create_file'.
* fixtests.c (test): Make static.
* server.c (load_data, sig_handler, server_setup, find_shell): Add
static prototype.
(sig_handler): Mark parameter with ATTRIBUTE_UNUSED.
2000-12-02 Bruce Korb <bkorb@gnu.org>
* fixnc/mkfixinc.sh(msdosdjgpp): remove from fixincludes exception list * fixnc/mkfixinc.sh(msdosdjgpp): remove from fixincludes exception list
(per Laurynas Biveinis <lauras@softhome.net>) (per Laurynas Biveinis <lauras@softhome.net>)
......
...@@ -138,6 +138,7 @@ print_quote( q, text ) ...@@ -138,6 +138,7 @@ print_quote( q, text )
* this thing can be encountered countless times during a compile * this thing can be encountered countless times during a compile
* and not cause even a warning. * and not cause even a warning.
*/ */
static const char *emit_gnu_type PARAMS ((const char *, regmatch_t *));
static const char* static const char*
emit_gnu_type ( text, rm ) emit_gnu_type ( text, rm )
const char* text; const char* text;
...@@ -188,6 +189,7 @@ typedef __%s_TYPE__ %s_t;\n\ ...@@ -188,6 +189,7 @@ typedef __%s_TYPE__ %s_t;\n\
* '%' characters in other contexts and all other characters are * '%' characters in other contexts and all other characters are
* copied out verbatim. * copied out verbatim.
*/ */
static void format_write PARAMS ((tCC *, tCC *, regmatch_t[]));
static void static void
format_write (format, text, av) format_write (format, text, av)
tCC* format; tCC* format;
...@@ -212,7 +214,7 @@ format_write (format, text, av) ...@@ -212,7 +214,7 @@ format_write (format, text, av)
* not emit the following character. We will end on * not emit the following character. We will end on
* a NUL and we will emit only one of a pair of '%'. * a NUL and we will emit only one of a pair of '%'.
*/ */
if (! isdigit( c )) if (! ISDIGIT ( c ))
{ {
putchar( '%' ); putchar( '%' );
switch (c) { switch (c) {
...@@ -373,12 +375,12 @@ FIX_PROC_HEAD( char_macro_use_fix ) ...@@ -373,12 +375,12 @@ FIX_PROC_HEAD( char_macro_use_fix )
/* Found STR on this line. If the macro needs fixing, /* Found STR on this line. If the macro needs fixing,
the next few chars will be whitespace or uppercase, the next few chars will be whitespace or uppercase,
then an open paren, then a single letter. */ then an open paren, then a single letter. */
while ((isspace (*p) || isupper (*p)) && p < limit) p++; while ((ISSPACE (*p) || ISUPPER (*p)) && p < limit) p++;
if (*p++ != '(') if (*p++ != '(')
continue; continue;
if (!isalpha (*p)) if (!ISALPHA (*p))
continue; continue;
if (isalnum (p[1]) || p[1] == '_') if (ISALNUM (p[1]) || p[1] == '_')
continue; continue;
/* Splat all preceding text into the output buffer, /* Splat all preceding text into the output buffer,
...@@ -450,7 +452,7 @@ FIX_PROC_HEAD( char_macro_def_fix ) ...@@ -450,7 +452,7 @@ FIX_PROC_HEAD( char_macro_def_fix )
goto found; goto found;
p++; p++;
} }
while (isalpha (*p) || isalnum (*p) || *p == '_'); while (ISALPHA (*p) || ISALNUM (*p) || *p == '_');
/* Hit end of macro name without finding the string. */ /* Hit end of macro name without finding the string. */
continue; continue;
...@@ -459,12 +461,12 @@ FIX_PROC_HEAD( char_macro_def_fix ) ...@@ -459,12 +461,12 @@ FIX_PROC_HEAD( char_macro_def_fix )
there may be a few uppercase letters, then there will be an there may be a few uppercase letters, then there will be an
open paren with _no_ intervening whitespace, and then a open paren with _no_ intervening whitespace, and then a
single letter. */ single letter. */
while (isupper (*p) && p < limit) p++; while (ISUPPER (*p) && p < limit) p++;
if (*p++ != '(') if (*p++ != '(')
continue; continue;
if (!isalpha (*p)) if (!ISALPHA (*p))
continue; continue;
if (isalnum (p[1]) || p[1] == '_') if (ISALNUM (p[1]) || p[1] == '_')
continue; continue;
/* The character at P is the one to look for in the following /* The character at P is the one to look for in the following
...@@ -604,10 +606,10 @@ FIX_PROC_HEAD( wrap_fix ) ...@@ -604,10 +606,10 @@ FIX_PROC_HEAD( wrap_fix )
for (;;) { for (;;) {
char ch = *(pz_src++); char ch = *(pz_src++);
if (islower(ch)) if (ISLOWER (ch))
*(pz_dst++) = toupper( ch ); *(pz_dst++) = TOUPPER ( ch );
else if (isalnum( ch )) else if (ISALNUM ( ch ))
*(pz_dst++) = ch; *(pz_dst++) = ch;
else if (ch == NUL) { else if (ch == NUL) {
...@@ -756,7 +758,7 @@ main( argc, argv ) ...@@ -756,7 +758,7 @@ main( argc, argv )
char* pz = argv[1]; char* pz = argv[1];
long idx; long idx;
if (! isdigit( *pz )) if (! ISDIGIT ( *pz ))
goto usage_failure; goto usage_failure;
idx = strtol( pz, &pz, 10 ); idx = strtol( pz, &pz, 10 );
......
...@@ -93,7 +93,7 @@ const char incl_quote_pat[] = "^[ \t]*#[ \t]*include[ \t]*\"[^/]"; ...@@ -93,7 +93,7 @@ const char incl_quote_pat[] = "^[ \t]*#[ \t]*include[ \t]*\"[^/]";
tSCC z_fork_err[] = "Error %d (%s) starting filter process for %s\n"; tSCC z_fork_err[] = "Error %d (%s) starting filter process for %s\n";
regex_t incl_quote_re; regex_t incl_quote_re;
void do_version PARAMS((void)); static void do_version PARAMS((void)) ATTRIBUTE_NORETURN;
char *load_file PARAMS((const char *)); char *load_file PARAMS((const char *));
void run_compiles PARAMS((void)); void run_compiles PARAMS((void));
void initialize PARAMS((int argc,char** argv)); void initialize PARAMS((int argc,char** argv));
...@@ -107,6 +107,7 @@ void process PARAMS((void)); ...@@ -107,6 +107,7 @@ void process PARAMS((void));
* *
* MAIN ROUTINE * MAIN ROUTINE
*/ */
extern int main PARAMS ((int, char **));
int int
main (argc, argv) main (argc, argv)
int argc; int argc;
...@@ -188,7 +189,7 @@ Altering %5d of them\n"; ...@@ -188,7 +189,7 @@ Altering %5d of them\n";
} }
void static void
do_version () do_version ()
{ {
static const char zFmt[] = "echo '%s'"; static const char zFmt[] = "echo '%s'";
...@@ -258,7 +259,7 @@ ENV_TABLE ...@@ -258,7 +259,7 @@ ENV_TABLE
#undef _ENV_ #undef _ENV_
if (isdigit( *pz_verbose )) if (ISDIGIT ( *pz_verbose ))
verbose_level = (te_verbose)atoi( pz_verbose ); verbose_level = (te_verbose)atoi( pz_verbose );
else else
switch (*pz_verbose) { switch (*pz_verbose) {
...@@ -376,7 +377,8 @@ load_file ( fname ) ...@@ -376,7 +377,8 @@ load_file ( fname )
return res; return res;
} }
int static int machine_matches PARAMS ((tFixDesc *));
static int
machine_matches( p_fixd ) machine_matches( p_fixd )
tFixDesc *p_fixd; tFixDesc *p_fixd;
{ {
...@@ -390,7 +392,7 @@ machine_matches( p_fixd ) ...@@ -390,7 +392,7 @@ machine_matches( p_fixd )
const char **papz_machs = p_fixd->papz_machs; const char **papz_machs = p_fixd->papz_machs;
char *pz; char *pz;
char *pz_sep = ""; const char *pz_sep = "";
tCC *pz_if_true; tCC *pz_if_true;
tCC *pz_if_false; tCC *pz_if_false;
char cmd_buf[ MACH_LIST_SIZE_LIMIT ]; /* size lim from fixincl.tpl */ char cmd_buf[ MACH_LIST_SIZE_LIMIT ]; /* size lim from fixincl.tpl */
...@@ -547,7 +549,8 @@ run_compiles () ...@@ -547,7 +549,8 @@ run_compiles ()
#endif #endif
FILE * static FILE *create_file PARAMS ((void));
static FILE *
create_file () create_file ()
{ {
int fd; int fd;
...@@ -611,7 +614,8 @@ create_file () ...@@ -611,7 +614,8 @@ create_file ()
Result: APPLY_FIX or SKIP_FIX, depending on the result of the Result: APPLY_FIX or SKIP_FIX, depending on the result of the
shell script we run. */ shell script we run. */
#ifndef __MSDOS__ #ifndef __MSDOS__
int static int test_test PARAMS ((tTestDesc *, char *));
static int
test_test (p_test, pz_test_file) test_test (p_test, pz_test_file)
tTestDesc *p_test; tTestDesc *p_test;
char* pz_test_file; char* pz_test_file;
...@@ -666,7 +670,8 @@ fi"; ...@@ -666,7 +670,8 @@ fi";
The caller may choose to reverse meaning if the sense of the test The caller may choose to reverse meaning if the sense of the test
is inverted. */ is inverted. */
int static int egrep_test PARAMS ((char *, tTestDesc *));
static int
egrep_test (pz_data, p_test) egrep_test (pz_data, p_test)
char *pz_data; char *pz_data;
tTestDesc *p_test; tTestDesc *p_test;
...@@ -688,11 +693,12 @@ egrep_test (pz_data, p_test) ...@@ -688,11 +693,12 @@ egrep_test (pz_data, p_test)
the file name. If we emit the name, our invoking shell will try the file name. If we emit the name, our invoking shell will try
to copy a non-existing file into the destination directory. */ to copy a non-existing file into the destination directory. */
int static int quoted_file_exists PARAMS ((const char *, const char *, const char *));
static int
quoted_file_exists (pz_src_path, pz_file_path, pz_file) quoted_file_exists (pz_src_path, pz_file_path, pz_file)
char* pz_src_path; const char *pz_src_path;
char* pz_file_path; const char *pz_file_path;
char* pz_file; const char *pz_file;
{ {
char z[ MAXPATHLEN ]; char z[ MAXPATHLEN ];
char* pz; char* pz;
...@@ -739,7 +745,8 @@ quoted_file_exists (pz_src_path, pz_file_path, pz_file) ...@@ -739,7 +745,8 @@ quoted_file_exists (pz_src_path, pz_file_path, pz_file)
for interpretation by the invoking shell */ for interpretation by the invoking shell */
void static void extract_quoted_files PARAMS ((char *, const char *, regmatch_t *));
static void
extract_quoted_files (pz_data, pz_fixed_file, p_re_match) extract_quoted_files (pz_data, pz_fixed_file, p_re_match)
char *pz_data; char *pz_data;
const char *pz_fixed_file; const char *pz_fixed_file;
...@@ -806,7 +813,8 @@ extract_quoted_files (pz_data, pz_fixed_file, p_re_match) ...@@ -806,7 +813,8 @@ extract_quoted_files (pz_data, pz_fixed_file, p_re_match)
Somebody wrote a *_fix subroutine that we must call. Somebody wrote a *_fix subroutine that we must call.
*/ */
#ifndef __MSDOS__ #ifndef __MSDOS__
int static int internal_fix PARAMS ((int, tFixDesc *));
static int
internal_fix (read_fd, p_fixd) internal_fix (read_fd, p_fixd)
int read_fd; int read_fd;
tFixDesc* p_fixd; tFixDesc* p_fixd;
...@@ -1012,7 +1020,8 @@ fix_with_system (p_fixd, pz_fix_file, pz_file_source, pz_temp_file) ...@@ -1012,7 +1020,8 @@ fix_with_system (p_fixd, pz_fix_file, pz_file_source, pz_temp_file)
for stdout. */ for stdout. */
#else /* is *NOT* __MSDOS__ */ #else /* is *NOT* __MSDOS__ */
int static int start_fixer PARAMS ((int, tFixDesc *, char *));
static int
start_fixer (read_fd, p_fixd, pz_fix_file) start_fixer (read_fd, p_fixd, pz_fix_file)
int read_fd; int read_fd;
tFixDesc* p_fixd; tFixDesc* p_fixd;
...@@ -1086,7 +1095,8 @@ start_fixer (read_fd, p_fixd, pz_fix_file) ...@@ -1086,7 +1095,8 @@ start_fixer (read_fd, p_fixd, pz_fix_file)
Input: the original text of the file and the file's name Input: the original text of the file and the file's name
Result: none. A new file may or may not be created. */ Result: none. A new file may or may not be created. */
t_bool static t_bool fix_applies PARAMS ((tFixDesc *));
static t_bool
fix_applies (p_fixd) fix_applies (p_fixd)
tFixDesc *p_fixd; tFixDesc *p_fixd;
{ {
...@@ -1200,7 +1210,8 @@ fix_applies (p_fixd) ...@@ -1200,7 +1210,8 @@ fix_applies (p_fixd)
Write out a replacement file */ Write out a replacement file */
void static void write_replacement PARAMS ((tFixDesc *));
static void
write_replacement (p_fixd) write_replacement (p_fixd)
tFixDesc *p_fixd; tFixDesc *p_fixd;
{ {
...@@ -1210,7 +1221,7 @@ write_replacement (p_fixd) ...@@ -1210,7 +1221,7 @@ write_replacement (p_fixd)
return; return;
{ {
FILE* out_fp = create_file (pz_curr_file); FILE* out_fp = create_file ();
fputs (pz_text, out_fp); fputs (pz_text, out_fp);
fclose (out_fp); fclose (out_fp);
} }
...@@ -1226,7 +1237,8 @@ write_replacement (p_fixd) ...@@ -1226,7 +1237,8 @@ write_replacement (p_fixd)
the matched text and then copy any remaining data from the the matched text and then copy any remaining data from the
output of the filter chain. output of the filter chain.
*/ */
void static void test_for_changes PARAMS ((int));
static void
test_for_changes (read_fd) test_for_changes (read_fd)
int read_fd; int read_fd;
{ {
...@@ -1256,7 +1268,7 @@ test_for_changes (read_fd) ...@@ -1256,7 +1268,7 @@ test_for_changes (read_fd)
*/ */
else if (ch != *pz_cmp) else if (ch != *pz_cmp)
{ {
out_fp = create_file (pz_curr_file); out_fp = create_file ();
#ifdef DO_STATS #ifdef DO_STATS
altered_ct++; altered_ct++;
......
...@@ -58,7 +58,7 @@ typedef struct { ...@@ -58,7 +58,7 @@ typedef struct {
_FT_( "machine_name", machine_name_test ) _FT_( "machine_name", machine_name_test )
#define TEST_FOR_FIX_PROC_HEAD( test ) \ #define TEST_FOR_FIX_PROC_HEAD( test ) \
apply_fix_p_t test PARAMS(( tCC* file, tCC* text )); /* avoid warning */ \ static apply_fix_p_t test PARAMS(( tCC* file, tCC* text )); \
static apply_fix_p_t test ( fname, text ) \ static apply_fix_p_t test ( fname, text ) \
tCC* fname; \ tCC* fname; \
tCC* text; tCC* text;
......
...@@ -107,6 +107,7 @@ STATIC t_pchar p_cur_dir = (char *) NULL; ...@@ -107,6 +107,7 @@ STATIC t_pchar p_cur_dir = (char *) NULL;
* The read data are stored in a malloc-ed string that is truncated * The read data are stored in a malloc-ed string that is truncated
* to size at the end. Input is assumed to be an ASCII string. * to size at the end. Input is assumed to be an ASCII string.
*/ */
static char *load_data PARAMS ((FILE *));
static char * static char *
load_data (fp) load_data (fp)
FILE *fp; FILE *fp;
...@@ -202,9 +203,10 @@ close_server () ...@@ -202,9 +203,10 @@ close_server ()
* to our server, and also that if the server dies, we do not * to our server, and also that if the server dies, we do not
* die from a sigpipe problem. * die from a sigpipe problem.
*/ */
static void sig_handler PARAMS ((int));
static void static void
sig_handler (signo) sig_handler (signo)
int signo; int signo ATTRIBUTE_UNUSED;
{ {
#ifdef DEBUG #ifdef DEBUG
/* FIXME: this is illegal to do in a signal handler. */ /* FIXME: this is illegal to do in a signal handler. */
...@@ -222,6 +224,7 @@ sig_handler (signo) ...@@ -222,6 +224,7 @@ sig_handler (signo)
* Also establishes the current directory to give to the * Also establishes the current directory to give to the
* server process at the start of every server command. * server process at the start of every server command.
*/ */
static void server_setup PARAMS ((void));
static void static void
server_setup () server_setup ()
{ {
...@@ -254,6 +257,7 @@ server_setup () ...@@ -254,6 +257,7 @@ server_setup ()
* override with $CONFIG_SHELL, so we do the same. * override with $CONFIG_SHELL, so we do the same.
*/ */
static char *find_shell PARAMS ((void));
static char * static char *
find_shell () find_shell ()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment