+2003-08-01 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ * fixinc/fixfixes.c, fixinc/fixlib.c, fixinc/fixlib.h,
+ fixinc/fixtests.c, fixinc/procopen.c, fixinc/server.c,
+ fixinc/server.h, fixinc/fixincl.c: ANSIfy function prototypes
+ and defintions.
+
+ * fixinc/inclhack.def (broken_cabs): Make matching more generous.
+ * fixinc/fixincl.x: Regenerate.
+ * fixinc/tests/base/math.h: Regenerate to match test_text change.
+
2003-08-01 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* ggc-common.c (gt_pch_restore): Case MAP_FAILED to void *.
tSCC zNeedsArg[] = "fixincl error: `%s' needs %s argument (c_fix_arg[%d])\n";
-typedef void t_fix_proc PARAMS ((const char *, const char *, tFixDesc *));
+typedef void t_fix_proc (const char *, const char *, tFixDesc *) ;
typedef struct {
const char* fix_name;
t_fix_proc* fix_proc;
_FT_( "gnu_type", gnu_type_fix )
-#define FIX_PROC_HEAD( fix ) \
-static void fix PARAMS ((const char *, const char *, tFixDesc *)); \
-static void fix ( filname, text, p_fixd ) \
- const char* filname ATTRIBUTE_UNUSED; \
- const char* text ATTRIBUTE_UNUSED; \
- tFixDesc* p_fixd ATTRIBUTE_UNUSED;
+#define FIX_PROC_HEAD( fix ) \
+static void fix (const char* filname ATTRIBUTE_UNUSED , \
+ const char* text ATTRIBUTE_UNUSED , \
+ tFixDesc* p_fixd ATTRIBUTE_UNUSED )
#ifdef NEED_PRINT_QUOTE
/*
* We are not doing a correctness syntax check here.
*/
static char*
-print_quote( q, text )
- char q;
- char* text;
+print_quote(char q, char* text )
{
fputc( q, stdout );
* 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;
- regmatch_t* rm;
+emit_gnu_type (const char* text, regmatch_t* rm )
{
char z_TYPE[ 64 ];
char z_type[ 64 ];
* '%' 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;
- tCC* text;
- regmatch_t av[];
+format_write (tCC* format, tCC* text, regmatch_t av[] )
{
int c;
*/
void
-apply_fix( p_fixd, filname )
- tFixDesc* p_fixd;
- tCC* filname;
+apply_fix( tFixDesc* p_fixd, tCC* filname )
{
#define _FT_(n,p) { n, p },
static fix_entry_t fix_table[] = { FIXUP_TABLE { NULL, NULL }};
"FS error %d (%s) reopening %s as std%s\n";
int
-main( argc, argv )
- int argc;
- char** argv;
+main( int argc, char** argv )
{
tFixDesc* pFix;
char* pz_tmptmp;
tSCC z_fork_err[] = "Error %d (%s) starting filter process for %s\n";
regex_t incl_quote_re;
-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));
-void process PARAMS((void));
+static void do_version (void) ATTRIBUTE_NORETURN;
+char *load_file (const char *);
+void run_compiles (void);
+void initialize (int argc, char** argv);
+void process (void);
/* External Source Code */
*
* MAIN ROUTINE
*/
-extern int main PARAMS ((int, char **));
+extern int main (int, char **);
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char** argv)
{
char *file_name_buf;
static void
-do_version ()
+do_version (void)
{
static const char zFmt[] = "echo '%s'";
char zBuf[ 1024 ];
/* * * * * * * * * * * * */
void
-initialize ( argc, argv )
- int argc;
- char** argv;
+initialize ( int argc, char** argv )
{
static const char var_not_found[] =
#ifndef __STDC__
result is the NUL terminated contents of the file. The file
is presumed to be an ASCII text file containing no NULs. */
char *
-load_file ( fname )
- const char* fname;
+load_file ( const char* fname )
{
struct stat stbf;
char* res;
return res;
}
-static int machine_matches PARAMS ((tFixDesc *));
static int
-machine_matches( p_fixd )
- tFixDesc *p_fixd;
+machine_matches( tFixDesc* p_fixd )
{
# ifndef SEPARATE_FIX_PROC
tSCC case_fmt[] = "case %s in\n"; /* 9 bytes, plus string */
run_compiles run all the regexp compiles for all the fixes once.
*/
void
-run_compiles ()
+run_compiles (void)
{
tFixDesc *p_fixd = fixDescList;
int fix_ct = FIX_COUNT;
#endif
-static FILE *create_file PARAMS ((void));
static FILE *
-create_file ()
+create_file (void)
{
int fd;
FILE *pf;
Result: APPLY_FIX or SKIP_FIX, depending on the result of the
shell script we run. */
#ifndef SEPARATE_FIX_PROC
-static int test_test PARAMS ((tTestDesc *, char *));
static int
-test_test (p_test, pz_test_file)
- tTestDesc *p_test;
- char* pz_test_file;
+test_test (tTestDesc* p_test, char* pz_test_file)
{
tSCC cmd_fmt[] =
"file=%s\n\
The caller may choose to reverse meaning if the sense of the test
is inverted. */
-static int egrep_test PARAMS ((char *, tTestDesc *));
static int
-egrep_test (pz_data, p_test)
- char *pz_data;
- tTestDesc *p_test;
+egrep_test (char* pz_data, tTestDesc* p_test)
{
#ifdef DEBUG
if (p_test->p_test_regex == 0)
the file name. If we emit the name, our invoking shell will try
to copy a non-existing file into the destination directory. */
-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)
- const char *pz_src_path;
- const char *pz_file_path;
- const char *pz_file;
+quoted_file_exists (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 */
-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;
- regmatch_t *p_re_match;
+extract_quoted_files (char* pz_data,
+ const char* pz_fixed_file,
+ regmatch_t* p_re_match)
{
char *pz_dir_end = strrchr (pz_fixed_file, '/');
char *pz_incl_quot = pz_data;
Somebody wrote a *_fix subroutine that we must call.
*/
#ifndef SEPARATE_FIX_PROC
-static int internal_fix PARAMS ((int, tFixDesc *));
static int
-internal_fix (read_fd, p_fixd)
- int read_fd;
- tFixDesc* p_fixd;
+internal_fix (int read_fd, tFixDesc* p_fixd)
{
int fd[2];
#ifdef SEPARATE_FIX_PROC
static void
-fix_with_system (p_fixd, pz_fix_file, pz_file_source, pz_temp_file)
- tFixDesc* p_fixd;
- tCC* pz_fix_file;
- tCC* pz_file_source;
- tCC* pz_temp_file;
+fix_with_system (tFixDesc* p_fixd,
+ tCC* pz_fix_file,
+ tCC* pz_file_source,
+ tCC* pz_temp_file)
{
char* pz_cmd;
char* pz_scan;
for stdout. */
#else /* is *NOT* SEPARATE_FIX_PROC */
-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;
- char* pz_fix_file;
+start_fixer (int read_fd, tFixDesc* p_fixd, char* pz_fix_file)
{
tCC* pz_cmd_save;
char* pz_cmd;
Input: the original text of the file and the file's name
Result: none. A new file may or may not be created. */
-static t_bool fix_applies PARAMS ((tFixDesc *));
static t_bool
-fix_applies (p_fixd)
- tFixDesc *p_fixd;
+fix_applies (tFixDesc* p_fixd)
{
const char *pz_fname = pz_curr_file;
const char *pz_scan = p_fixd->file_list;
Write out a replacement file */
-static void write_replacement PARAMS ((tFixDesc *));
static void
-write_replacement (p_fixd)
- tFixDesc *p_fixd;
+write_replacement (tFixDesc* p_fixd)
{
const char* pz_text = p_fixd->patch_args[0];
the matched text and then copy any remaining data from the
output of the filter chain.
*/
-static void test_for_changes PARAMS ((int));
static void
-test_for_changes (read_fd)
- int read_fd;
+test_for_changes (int read_fd)
{
FILE *in_fp = fdopen (read_fd, "r");
FILE *out_fp = (FILE *) NULL;
Result: none. A new file may or may not be created. */
void
-process ()
+process (void)
{
tFixDesc *p_fixd = fixDescList;
int todo_ct = FIX_COUNT;
is presumed to be an ASCII text file containing no NULs. */
char *
-load_file_data (fp)
- FILE* fp;
+load_file_data (FILE* fp)
{
char *pz_data = (char*)NULL;
int space_left = -1; /* allow for terminating NUL */
#ifdef IS_CXX_HEADER_NEEDED
t_bool
-is_cxx_header (fname, text)
- tCC *fname;
- tCC *text;
+is_cxx_header (tCC* fname, tCC* text)
{
/* First, check to see if the file is in a C++ directory */
for (;;)
* We are not doing a correctness syntax check here.
*/
tCC*
-skip_quote( q, text )
- char q;
- char* text;
+skip_quote(char q, char* text )
{
for (;;)
{
REG_EXTENDED|REG_NEWLINE produces identical regex syntax/semantics
to egrep (verified from 4.4BSD Programmer's Reference Manual). */
void
-compile_re( pat, re, match, e1, e2 )
- tCC *pat;
- regex_t *re;
- int match;
- tCC *e1;
- tCC *e2;
+compile_re( tCC* pat, regex_t* re, int match, tCC* e1, tCC* e2 )
{
tSCC z_bad_comp[] = "fixincl ERROR: cannot compile %s regex for %s\n\
\texpr = `%s'\n\terror %s\n";
static int mn_compiled = 0;
void
-mn_get_regexps( label_re, name_re, who )
- regex_t **label_re;
- regex_t **name_re;
- tCC *who;
+mn_get_regexps(regex_t** label_re, regex_t** name_re, tCC* who )
{
if (! mn_compiled)
{
#ifdef SEPARATE_FIX_PROC
char*
-make_raw_shell_str( pz_d, pz_s, smax )
- char* pz_d;
- tCC* pz_s;
- size_t smax;
+make_raw_shell_str( char* pz_d, tCC* pz_s, size_t smax )
{
tSCC zQ[] = "'\\''";
size_t dtaSize;
/*
* Exported procedures
*/
-char * load_file_data PARAMS(( FILE* fp ));
+char * load_file_data ( FILE* fp );
#ifdef IS_CXX_HEADER_NEEDED
-t_bool is_cxx_header PARAMS(( tCC* filename, tCC* filetext ));
+t_bool is_cxx_header ( tCC* filename, tCC* filetext );
#endif /* IS_CXX_HEADER_NEEDED */
#ifdef SKIP_QUOTE_NEEDED
-tCC* skip_quote PARAMS(( char q, char* text ));
+tCC* skip_quote ( char q, char* text );
#endif
-void compile_re PARAMS(( tCC* pat, regex_t* re, int match,
- tCC *e1, tCC *e2 ));
+void compile_re ( tCC* pat, regex_t* re, int match, tCC *e1, tCC *e2 );
-void apply_fix PARAMS(( tFixDesc* p_fixd, tCC* filname ));
+void apply_fix ( tFixDesc* p_fixd, tCC* filname );
apply_fix_p_t
- run_test PARAMS(( tCC* t_name, tCC* f_name, tCC* text ));
+ run_test ( tCC* t_name, tCC* f_name, tCC* text );
#ifdef SEPARATE_FIX_PROC
-char* make_raw_shell_str
- PARAMS(( char* pz_d, tCC* pz_s, size_t smax ));
+char* make_raw_shell_str ( char* pz_d, tCC* pz_s, size_t smax );
#endif
#ifdef MN_NAME_PAT
-void mn_get_regexps
- PARAMS(( regex_t** label_re, regex_t** name_re,
- tCC *who ));
+void mn_get_regexps ( regex_t** label_re, regex_t** name_re, tCC *who );
#endif
#endif /* ! GCC_FIXLIB_H */
ENV_TABLE
#undef _ENV_
-typedef apply_fix_p_t t_test_proc PARAMS(( tCC* file, tCC* text ));
+typedef apply_fix_p_t t_test_proc ( tCC* file, tCC* text );
typedef struct {
tCC* test_name;
_FT_( "machine_name", machine_name_test ) \
_FT_( "stdc_0_in_system_headers", stdc_0_in_system_headers_test )
-#define TEST_FOR_FIX_PROC_HEAD( test ) \
-static apply_fix_p_t test PARAMS(( tCC* file, tCC* text )); \
-static apply_fix_p_t test ( fname, text ) \
- tCC* fname ATTRIBUTE_UNUSED; \
- tCC* text ATTRIBUTE_UNUSED;
-
+#define TEST_FOR_FIX_PROC_HEAD( test ) \
+static apply_fix_p_t test ( tCC* fname ATTRIBUTE_UNUSED, \
+ tCC* text ATTRIBUTE_UNUSED )
TEST_FOR_FIX_PROC_HEAD( machine_name_test )
{
*/
apply_fix_p_t
-run_test( tname, fname, text )
- tCC* tname;
- tCC* fname;
- tCC* text;
+run_test( tCC* tname, tCC* fname, tCC* text )
{
#define _FT_(n,p) { n, p },
static test_entry_t test_table[] = { FIX_TEST_TABLE { NULL, NULL }};
* to store the child's process id.
*/
int
-chain_open (stdin_fd, pp_args, p_child)
- int stdin_fd;
- tCC **pp_args;
- pid_t *p_child;
+chain_open (int stdin_fd, tCC** pp_args, pid_t* p_child)
{
t_fd_pair stdout_pair;
pid_t ch_id;
* The return value is the process id of the created process.
*/
pid_t
-proc2_open (p_pair, pp_args)
- t_fd_pair *p_pair;
- tCC **pp_args;
+proc2_open (t_fd_pair* p_pair, tCC** pp_args)
{
pid_t ch_id;
* "fdopen(3)"-ed into file pointers instead.
*/
pid_t
-proc2_fopen (pf_pair, pp_args)
- t_pf_pair *pf_pair;
- tCC **pp_args;
+proc2_fopen (t_pf_pair* pf_pair, tCC** pp_args)
{
t_fd_pair fd_pair;
pid_t ch_id = proc2_open (&fd_pair, pp_args);
* 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;
+load_data (FILE* fp)
{
char *pz_text;
size_t text_size;
* pipes to it and from it, finally NULL out the file pointers
*/
void
-close_server ()
+close_server (void)
{
if ( (server_id != NULLPROCESS)
&& (server_master_pid == getpid ()))
* 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 ATTRIBUTE_UNUSED;
+sig_handler (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 ()
+server_setup (void)
{
static int atexit_done = 0;
char buff [MAXPATHLEN + 1];
* override with $CONFIG_SHELL, so we do the same.
*/
-static const char *find_shell PARAMS ((void));
static const char *
-find_shell ()
+find_shell (void)
{
char * shell = getenv ("CONFIG_SHELL");
if (shell)
* "ShElL-OuTpUt-HaS-bEeN-cOmPlEtEd"
*/
char *
-run_shell (pz_cmd)
- const char *pz_cmd;
+run_shell (const char* pz_cmd)
{
tSCC zNoServer[] = "Server not running, cannot run:\n%s\n\n";
t_bool retry = BOOL_TRUE;
FILE *pf_write; /* parent write fp */
} t_pf_pair;
-char *run_shell PARAMS (( const char *pzCmd));
-pid_t proc2_fopen PARAMS (( t_pf_pair * p_pair, tCC ** pp_args));
-pid_t proc2_open PARAMS (( t_fd_pair * p_pair, tCC ** pp_args));
-int chain_open PARAMS (( int in_fd, tCC ** pp_args,
- pid_t * p_child));
-void close_server PARAMS (( void ));
+char* run_shell( const char* pzCmd );
+pid_t proc2_fopen( t_pf_pair* p_pair, tCC** pp_args );
+pid_t proc2_open( t_fd_pair* p_pair, tCC** pp_args );
+int chain_open( int in_fd, tCC** pp_args, pid_t* p_child );
+void close_server( void );
#endif /* ! GCC_SERVER_H */