+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
* 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;
* '%' 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;
* 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) {
/* 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,
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;
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
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) {
char* pz = argv[1];
long idx;
- if (! isdigit( *pz ))
+ if (! ISDIGIT ( *pz ))
goto usage_failure;
idx = strtol( pz, &pz, 10 );
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));
*
* MAIN ROUTINE
*/
+extern int main PARAMS ((int, char **));
int
main (argc, argv)
int argc;
}
-void
+static void
do_version ()
{
static const char zFmt[] = "echo '%s'";
#undef _ENV_
- if (isdigit( *pz_verbose ))
+ if (ISDIGIT ( *pz_verbose ))
verbose_level = (te_verbose)atoi( pz_verbose );
else
switch (*pz_verbose) {
return res;
}
-int
+static int machine_matches PARAMS ((tFixDesc *));
+static int
machine_matches( p_fixd )
tFixDesc *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 */
#endif
-FILE *
+static FILE *create_file PARAMS ((void));
+static FILE *
create_file ()
{
int fd;
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;
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;
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;
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;
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;
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;
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;
{
Write out a replacement file */
-void
+static void write_replacement PARAMS ((tFixDesc *));
+static void
write_replacement (p_fixd)
tFixDesc *p_fixd;
{
return;
{
- FILE* out_fp = create_file (pz_curr_file);
+ FILE* out_fp = create_file ();
fputs (pz_text, out_fp);
fclose (out_fp);
}
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;
{
*/
else if (ch != *pz_cmp)
{
- out_fp = create_file (pz_curr_file);
+ out_fp = create_file ();
#ifdef DO_STATS
altered_ct++;
_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;
* 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;
* 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. */
* 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 ()
{
* override with $CONFIG_SHELL, so we do the same.
*/
+static char *find_shell PARAMS ((void));
static char *
find_shell ()
{