code cleanups

From-SVN: r36359
This commit is contained in:
Bruce Korb 2000-09-12 14:28:55 +00:00 committed by Bruce Korb
parent 32892c52e4
commit 3af556f74d
8 changed files with 311 additions and 298 deletions

View File

@ -1,3 +1,14 @@
2000-09-12 Bruce Korb <bkorb@gnu.org>
* fixinc/fixfixes.c: make a type for the fix procedure & use it,
remove obsolete code
* fixinc/fixincl.c: Use PARAMS, not _P_. Add no-op default to switch.
* fixinc/fixincl.tpl: make non-exported arrays static scope
* fixinc/fixincl.x: regenerate
* fixinc/fixlib.h: Use PARAMS, not _P_
* fixinc/fixtests.c: make a type for the test proc & use it
* fixinc/server.h: Use PARAMS, not _P_
2000-09-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2000-09-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* c-typeck.c (process_init_element): Avoid union init warnings on * c-typeck.c (process_init_element): Avoid union init warnings on

View File

@ -66,9 +66,10 @@ Boston, MA 02111-1307, USA. */
tSCC zNeedsArg[] = "fixincl error: `%s' needs %s argument (c_fix_arg[%d])\n"; 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 struct { typedef struct {
const char* fix_name; const char* fix_name;
void (*fix_proc)(); t_fix_proc* fix_proc;
} fix_entry_t; } fix_entry_t;
#define FIXUP_TABLE \ #define FIXUP_TABLE \
@ -80,13 +81,14 @@ typedef struct {
_FT_( "gnu_type", gnu_type_fix ) _FT_( "gnu_type", gnu_type_fix )
#define FIX_PROC_HEAD( fix ) \ #define FIX_PROC_HEAD( fix ) \
static void fix ( filname, text, p_fixd ) \ static t_fix_proc fix; /* avoid warning */ \
const char* filname; \ static void fix ( filname, text, p_fixd ) \
const char* text; \ const char* filname; \
const char* text; \
tFixDesc* p_fixd; tFixDesc* p_fixd;
#ifdef NEED_PRINT_QUOTE
/* /*
* Skip over a quoted string. Single quote strings may * Skip over a quoted string. Single quote strings may
* contain multiple characters if the first character is * contain multiple characters if the first character is
@ -128,6 +130,7 @@ print_quote( q, text )
return text; return text;
} }
#endif /* NEED_PRINT_QUOTE */
/* /*
@ -250,7 +253,6 @@ FIX_PROC_HEAD( format_fix )
{ {
tCC* pz_pat = p_fixd->patch_args[2]; tCC* pz_pat = p_fixd->patch_args[2];
tCC* pz_fmt = p_fixd->patch_args[1]; tCC* pz_fmt = p_fixd->patch_args[1];
const char *p;
regex_t re; regex_t re;
regmatch_t rm[10]; regmatch_t rm[10];
@ -295,9 +297,6 @@ FIX_PROC_HEAD( format_fix )
compile_re (pz_pat, &re, 1, "format search-text", "format_fix" ); compile_re (pz_pat, &re, 1, "format search-text", "format_fix" );
while (regexec (&re, text, 10, rm, 0) == 0) while (regexec (&re, text, 10, rm, 0) == 0)
{ {
char* apz[10];
int i;
fwrite( text, rm[0].rm_so, 1, stdout ); fwrite( text, rm[0].rm_so, 1, stdout );
format_write( pz_fmt, text, rm ); format_write( pz_fmt, text, rm );
text += rm[0].rm_eo; text += rm[0].rm_eo;

View File

@ -93,12 +93,11 @@ 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 (); void do_version PARAMS((void));
char *load_file _P_((const char *)); char *load_file PARAMS((const char *));
void process _P_((char *, const char *)); void run_compiles PARAMS((void));
void run_compiles (); void initialize PARAMS((int argc,char** argv));
void initialize _P_((int argc,char** argv)); void process PARAMS((void));
void process ();
/* External Source Code */ /* External Source Code */
@ -523,6 +522,7 @@ run_compiles ()
p_test->p_test_regex = p_re++; p_test->p_test_regex = p_re++;
compile_re (p_test->pz_test_text, p_test->p_test_regex, 0, compile_re (p_test->pz_test_text, p_test->p_test_regex, 0,
"select test", p_fixd->fix_name); "select test", p_fixd->fix_name);
default: break;
} }
p_test++; p_test++;
} }

View File

@ -124,7 +124,7 @@ _SETENV re_ct
re_ct _env _val re_ct _env _val
select _count + select _count +
bypass _count + =] bypass _count + =]
tTestDesc a[=hackname _cap=]Tests[] = {[= static tTestDesc a[=hackname _cap=]Tests[] = {[=
_FOR test =] _FOR test =]
{ TT_TEST, z[=hackname _cap=]Test[=_eval _index=], 0 /* unused */ },[= { TT_TEST, z[=hackname _cap=]Test[=_eval _index=], 0 /* unused */ },[=
@ -149,7 +149,7 @@ tTestDesc a[=hackname _cap=]Tests[] = {[=
/* /*
* Fix Command Arguments for [=hackname _cap=] * Fix Command Arguments for [=hackname _cap=]
*/ */
const char* apz[=hackname _cap=]Patch[] = {[= static const char* apz[=hackname _cap=]Patch[] = {[=
_IF sed _exist =] "sed"[= _IF sed _exist =] "sed"[=
_FOR sed=], _FOR sed=],
"-e", [=sed _krstr=][= "-e", [=sed _krstr=][=

File diff suppressed because it is too large Load Diff

View File

@ -79,6 +79,7 @@ typedef int t_success;
#define NULLPROCESS ((pid_t)0) #define NULLPROCESS ((pid_t)0)
#define EXIT_PANIC 99 #define EXIT_PANIC 99
#endif /* NOPROCESS */
#ifndef HAVE_T_BOOL_ENUM #ifndef HAVE_T_BOOL_ENUM
#define HAVE_T_BOOL_ENUM #define HAVE_T_BOOL_ENUM
@ -93,9 +94,6 @@ typedef int apply_fix_p_t; /* Apply Fix Predicate Type */
#define APPLY_FIX 0 #define APPLY_FIX 0
#define SKIP_FIX 1 #define SKIP_FIX 1
#define _P_(p) ()
#endif
#define ENV_TABLE \ #define ENV_TABLE \
_ENV_( pz_machine, BOOL_TRUE, "TARGET_MACHINE", \ _ENV_( pz_machine, BOOL_TRUE, "TARGET_MACHINE", \
"output from config.guess" ) \ "output from config.guess" ) \
@ -194,25 +192,31 @@ extern int gnu_type_map_ct;
/* /*
* Exported procedures * Exported procedures
*/ */
char * load_file_data _P_(( FILE* fp )); char * load_file_data PARAMS(( FILE* fp ));
#ifdef IS_CXX_HEADER_NEEDED
t_bool is_cxx_header _P_(( tCC* filename, tCC* filetext ));
#endif /* IS_CXX_HEADER_NEEDED */
#ifdef SKIP_QUOTE_NEEDED
tCC* skip_quote _P_(( char q, char* text ));
#endif
void compile_re _P_(( tCC* pat, regex_t* re, int match,
tCC *e1, tCC *e2 ));
void apply_fix _P_(( tFixDesc* p_fixd, tCC* filname )); #ifdef IS_CXX_HEADER_NEEDED
apply_fix_p_t run_test _P_((tCC* t_name, tCC* f_name, tCC* text )); t_bool is_cxx_header PARAMS(( tCC* filename, tCC* filetext ));
#endif /* IS_CXX_HEADER_NEEDED */
#ifdef SKIP_QUOTE_NEEDED
tCC* skip_quote PARAMS(( char q, char* text ));
#endif
void compile_re PARAMS(( tCC* pat, regex_t* re, int match,
tCC *e1, tCC *e2 ));
void apply_fix PARAMS(( tFixDesc* p_fixd, tCC* filname ));
apply_fix_p_t
run_test PARAMS(( tCC* t_name, tCC* f_name, tCC* text ));
#ifdef __MSDOS__ #ifdef __MSDOS__
char* make_raw_shell_str _P_(( char* pz_d, tCC* pz_s, size_t smax )); char* make_raw_shell_str
PARAMS(( char* pz_d, tCC* pz_s, size_t smax ));
#endif #endif
#ifdef MN_NAME_PAT #ifdef MN_NAME_PAT
void mn_get_regexps _P_(( regex_t** label_re, regex_t** name_re, void mn_get_regexps
tCC *who )); PARAMS(( regex_t** label_re, regex_t** name_re,
tCC *who ));
#endif #endif
#endif /* FIXINCLUDES_FIXLIB_H */ #endif /* FIXINCLUDES_FIXLIB_H */

View File

@ -47,18 +47,20 @@ Boston, MA 02111-1307, USA. */
#include "fixlib.h" #include "fixlib.h"
typedef apply_fix_p_t t_test_proc PARAMS(( tCC* file, tCC* text ));
typedef struct { typedef struct {
tCC* test_name; tCC* test_name;
apply_fix_p_t (*test_proc)(); t_test_proc* test_proc;
} test_entry_t; } test_entry_t;
#define FIX_TEST_TABLE \ #define FIX_TEST_TABLE \
_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 ) \ t_test_proc test; /* avoid warning */ \
static apply_fix_p_t test ( fname, text ) \ static apply_fix_p_t test ( fname, text ) \
tCC* fname; \ tCC* fname; \
tCC* text; tCC* text;

View File

@ -77,6 +77,7 @@ typedef char *t_pchar;
#define NULLPROCESS ((pid_t)0) #define NULLPROCESS ((pid_t)0)
#define EXIT_PANIC 99 #define EXIT_PANIC 99
#endif /* NOPROCESS */
#ifndef HAVE_T_BOOL_ENUM #ifndef HAVE_T_BOOL_ENUM
#define HAVE_T_BOOL_ENUM #define HAVE_T_BOOL_ENUM
@ -86,14 +87,10 @@ typedef enum
} t_bool; } t_bool;
#endif #endif
#define _P_(p) () char *run_shell PARAMS (( const char *pzCmd));
#endif pid_t proc2_fopen PARAMS (( t_pf_pair * p_pair, t_pchar * pp_args));
pid_t proc2_open PARAMS (( t_fd_pair * p_pair, t_pchar * pp_args));
char *run_shell _P_ (( const char *pzCmd)); int chain_open PARAMS (( int in_fd, t_pchar * pp_args,
pid_t proc2_fopen _P_ (( t_pf_pair * p_pair, t_pchar * pp_args)); pid_t * p_child));
pid_t proc2_open _P_ (( t_fd_pair * p_pair, t_pchar * pp_args)); void close_server PARAMS (( void ));
int chain_open _P_ (( int in_fd,
t_pchar * pp_args,
pid_t * p_child));
void close_server _P_ (( void ));
#endif /* FIXINC_SERVER_H */ #endif /* FIXINC_SERVER_H */