Kaveh's warning patch from 11/19

From-SVN: r37958
This commit is contained in:
Bruce Korb 2000-12-02 19:01:16 +00:00 committed by Bruce Korb
parent 2c864b9a56
commit 6864a6c66c
5 changed files with 74 additions and 34 deletions

View File

@ -1,3 +1,25 @@
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

View File

@ -138,6 +138,7 @@ print_quote( q, text )
* this thing can be encountered countless times during a compile
* and not cause even a warning.
*/
static const char *emit_gnu_type PARAMS ((const char *, regmatch_t *));
static const char*
emit_gnu_type ( text, rm )
const char* text;
@ -188,6 +189,7 @@ typedef __%s_TYPE__ %s_t;\n\
* '%' characters in other contexts and all other characters are
* copied out verbatim.
*/
static void format_write PARAMS ((tCC *, tCC *, regmatch_t[]));
static void
format_write (format, text, av)
tCC* format;
@ -212,7 +214,7 @@ format_write (format, text, av)
* not emit the following character. We will end on
* a NUL and we will emit only one of a pair of '%'.
*/
if (! isdigit( c ))
if (! ISDIGIT ( c ))
{
putchar( '%' );
switch (c) {
@ -373,12 +375,12 @@ FIX_PROC_HEAD( char_macro_use_fix )
/* Found STR on this line. If the macro needs fixing,
the next few chars will be whitespace or uppercase,
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++ != '(')
continue;
if (!isalpha (*p))
if (!ISALPHA (*p))
continue;
if (isalnum (p[1]) || p[1] == '_')
if (ISALNUM (p[1]) || p[1] == '_')
continue;
/* Splat all preceding text into the output buffer,
@ -450,7 +452,7 @@ FIX_PROC_HEAD( char_macro_def_fix )
goto found;
p++;
}
while (isalpha (*p) || isalnum (*p) || *p == '_');
while (ISALPHA (*p) || ISALNUM (*p) || *p == '_');
/* Hit end of macro name without finding the string. */
continue;
@ -459,12 +461,12 @@ FIX_PROC_HEAD( char_macro_def_fix )
there may be a few uppercase letters, then there will be an
open paren with _no_ intervening whitespace, and then a
single letter. */
while (isupper (*p) && p < limit) p++;
while (ISUPPER (*p) && p < limit) p++;
if (*p++ != '(')
continue;
if (!isalpha (*p))
if (!ISALPHA (*p))
continue;
if (isalnum (p[1]) || p[1] == '_')
if (ISALNUM (p[1]) || p[1] == '_')
continue;
/* The character at P is the one to look for in the following
@ -604,10 +606,10 @@ FIX_PROC_HEAD( wrap_fix )
for (;;) {
char ch = *(pz_src++);
if (islower(ch))
*(pz_dst++) = toupper( ch );
if (ISLOWER (ch))
*(pz_dst++) = TOUPPER ( ch );
else if (isalnum( ch ))
else if (ISALNUM ( ch ))
*(pz_dst++) = ch;
else if (ch == NUL) {
@ -756,7 +758,7 @@ main( argc, argv )
char* pz = argv[1];
long idx;
if (! isdigit( *pz ))
if (! ISDIGIT ( *pz ))
goto usage_failure;
idx = strtol( pz, &pz, 10 );

View File

@ -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";
regex_t incl_quote_re;
void do_version PARAMS((void));
static void do_version PARAMS((void)) ATTRIBUTE_NORETURN;
char *load_file PARAMS((const char *));
void run_compiles PARAMS((void));
void initialize PARAMS((int argc,char** argv));
@ -107,6 +107,7 @@ void process PARAMS((void));
*
* MAIN ROUTINE
*/
extern int main PARAMS ((int, char **));
int
main (argc, argv)
int argc;
@ -188,7 +189,7 @@ Altering %5d of them\n";
}
void
static void
do_version ()
{
static const char zFmt[] = "echo '%s'";
@ -258,7 +259,7 @@ ENV_TABLE
#undef _ENV_
if (isdigit( *pz_verbose ))
if (ISDIGIT ( *pz_verbose ))
verbose_level = (te_verbose)atoi( pz_verbose );
else
switch (*pz_verbose) {
@ -376,7 +377,8 @@ load_file ( fname )
return res;
}
int
static int machine_matches PARAMS ((tFixDesc *));
static int
machine_matches( p_fixd )
tFixDesc *p_fixd;
{
@ -390,7 +392,7 @@ machine_matches( p_fixd )
const char **papz_machs = p_fixd->papz_machs;
char *pz;
char *pz_sep = "";
const char *pz_sep = "";
tCC *pz_if_true;
tCC *pz_if_false;
char cmd_buf[ MACH_LIST_SIZE_LIMIT ]; /* size lim from fixincl.tpl */
@ -547,7 +549,8 @@ run_compiles ()
#endif
FILE *
static FILE *create_file PARAMS ((void));
static FILE *
create_file ()
{
int fd;
@ -611,7 +614,8 @@ create_file ()
Result: APPLY_FIX or SKIP_FIX, depending on the result of the
shell script we run. */
#ifndef __MSDOS__
int
static int test_test PARAMS ((tTestDesc *, char *));
static int
test_test (p_test, pz_test_file)
tTestDesc *p_test;
char* pz_test_file;
@ -666,7 +670,8 @@ fi";
The caller may choose to reverse meaning if the sense of the test
is inverted. */
int
static int egrep_test PARAMS ((char *, tTestDesc *));
static int
egrep_test (pz_data, p_test)
char *pz_data;
tTestDesc *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
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)
char* pz_src_path;
char* pz_file_path;
char* pz_file;
const char *pz_src_path;
const char *pz_file_path;
const char *pz_file;
{
char z[ MAXPATHLEN ];
char* pz;
@ -739,7 +745,8 @@ quoted_file_exists (pz_src_path, pz_file_path, pz_file)
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)
char *pz_data;
const char *pz_fixed_file;
@ -806,7 +813,8 @@ extract_quoted_files (pz_data, pz_fixed_file, p_re_match)
Somebody wrote a *_fix subroutine that we must call.
*/
#ifndef __MSDOS__
int
static int internal_fix PARAMS ((int, tFixDesc *));
static int
internal_fix (read_fd, p_fixd)
int read_fd;
tFixDesc* p_fixd;
@ -1012,7 +1020,8 @@ fix_with_system (p_fixd, pz_fix_file, pz_file_source, pz_temp_file)
for stdout. */
#else /* is *NOT* __MSDOS__ */
int
static int start_fixer PARAMS ((int, tFixDesc *, char *));
static int
start_fixer (read_fd, p_fixd, pz_fix_file)
int read_fd;
tFixDesc* p_fixd;
@ -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
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)
tFixDesc *p_fixd;
{
@ -1200,7 +1210,8 @@ fix_applies (p_fixd)
Write out a replacement file */
void
static void write_replacement PARAMS ((tFixDesc *));
static void
write_replacement (p_fixd)
tFixDesc *p_fixd;
{
@ -1210,7 +1221,7 @@ write_replacement (p_fixd)
return;
{
FILE* out_fp = create_file (pz_curr_file);
FILE* out_fp = create_file ();
fputs (pz_text, out_fp);
fclose (out_fp);
}
@ -1226,7 +1237,8 @@ write_replacement (p_fixd)
the matched text and then copy any remaining data from the
output of the filter chain.
*/
void
static void test_for_changes PARAMS ((int));
static void
test_for_changes (read_fd)
int read_fd;
{
@ -1256,7 +1268,7 @@ test_for_changes (read_fd)
*/
else if (ch != *pz_cmp)
{
out_fp = create_file (pz_curr_file);
out_fp = create_file ();
#ifdef DO_STATS
altered_ct++;

View File

@ -58,7 +58,7 @@ typedef struct {
_FT_( "machine_name", machine_name_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 ) \
tCC* fname; \
tCC* text;

View File

@ -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
* to size at the end. Input is assumed to be an ASCII string.
*/
static char *load_data PARAMS ((FILE *));
static char *
load_data (fp)
FILE *fp;
@ -202,9 +203,10 @@ close_server ()
* to our server, and also that if the server dies, we do not
* die from a sigpipe problem.
*/
static void sig_handler PARAMS ((int));
static void
sig_handler (signo)
int signo;
int signo ATTRIBUTE_UNUSED;
{
#ifdef DEBUG
/* FIXME: this is illegal to do in a signal handler. */
@ -222,6 +224,7 @@ sig_handler (signo)
* Also establishes the current directory to give to the
* server process at the start of every server command.
*/
static void server_setup PARAMS ((void));
static void
server_setup ()
{
@ -254,6 +257,7 @@ server_setup ()
* override with $CONFIG_SHELL, so we do the same.
*/
static char *find_shell PARAMS ((void));
static char *
find_shell ()
{