mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-28 22:34:03 +08:00
improve the debug displays, ignore SIGPIPE, and fix char_macro_def regex
From-SVN: r33956
This commit is contained in:
parent
558fe506b5
commit
e9099386ae
@ -1,3 +1,10 @@
|
||||
|
||||
2000-05-16 Bruce Korb <bkorb@gnu.org>
|
||||
|
||||
* fixinc/fixincl.c: improve the debug displays, ignore SIGPIPE
|
||||
* fixinc/server.c: likewise
|
||||
* fixinc/fixfixes.c( char_macro_def_fix ): fix regex
|
||||
|
||||
2000-05-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* fixinc/fixfixes.c (char_macro_use_fix, char_macro_def_fix):
|
||||
|
@ -339,11 +339,11 @@ FIX_PROC_HEAD( char_macro_use_fix )
|
||||
|
||||
/* Scan the input file for all occurrences of text like this:
|
||||
|
||||
#define xxxIOxx(x, y) ('x'<<16+y)
|
||||
#define xxxIOxx(x, y) (....'x'<<16....)
|
||||
|
||||
and change them to read like this:
|
||||
|
||||
#define xxxIOxx(x, y) (x<<16+y)
|
||||
#define xxxIOxx(x, y) (....x<<16....)
|
||||
|
||||
which is the required syntax per the C standard. (The uses of _IO
|
||||
also has to be tweaked - see above.) 'IO' is actually whatever
|
||||
@ -357,15 +357,14 @@ FIX_PROC_HEAD( char_macro_def_fix )
|
||||
*/
|
||||
"^#[ \t]*define[ \t]+[_A-Z][A-Z0-9_]*%s[A-Z]*\\("
|
||||
/*
|
||||
* The next character must be alphabetic without a name-type
|
||||
* character following it
|
||||
* The next character must match a later one
|
||||
*/
|
||||
"([a-zA-Z])[^a-zA-Z0-9_]" /* rm[1] */
|
||||
"([a-zA-Z])" /* rm[1] */
|
||||
/*
|
||||
* now match over the argument list, intervening white space
|
||||
* and opening parentheses, and on through a single quote character
|
||||
* now match over a comma, the argument list, intervening white space
|
||||
* an opening parenthesis, and on through a single quote character
|
||||
*/
|
||||
"[^)]*\\)[ \t]+\\([ \t(]*'"
|
||||
"[ \t]*,[^)]*\\)[ \t]+\\([^']*'"
|
||||
/*
|
||||
* Match the character that must match the remembered char above
|
||||
*/
|
||||
@ -375,8 +374,8 @@ FIX_PROC_HEAD( char_macro_def_fix )
|
||||
* Indecipherable gobbeldygook:
|
||||
*/
|
||||
|
||||
"^#[ \t]*define[ \t]+[_A-Z][A-Z0-9_]*%s[A-Z]*\\(([a-zA-Z])[^a-zA-Z0-9_]\
|
||||
[^)]*\\)[ \t]+\\([ \t(]*'([a-zA-Z])'"
|
||||
"^#[ \t]*define[ \t]+[_A-Z][A-Z0-9_]*%s[A-Z]*\\(\
|
||||
([a-zA-Z])[ \t]*,[^)]*\\)[ \t]+\\([^']*'([a-zA-Z])'"
|
||||
#endif
|
||||
;
|
||||
|
||||
|
@ -618,14 +618,27 @@ else echo FALSE\n\
|
||||
fi";
|
||||
|
||||
char *pz_res;
|
||||
int res = SKIP_FIX;
|
||||
int res;
|
||||
|
||||
static char cmd_buf[4096];
|
||||
|
||||
sprintf (cmd_buf, cmd_fmt, pz_test_file, p_test->pz_test_text);
|
||||
pz_res = run_shell (cmd_buf);
|
||||
if (*pz_res == 'T')
|
||||
|
||||
switch (*pz_res) {
|
||||
case 'T':
|
||||
res = APPLY_FIX;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
res = SKIP_FIX;
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf (stderr, "Script yielded bogus result of `%s':\n%s\n\n",
|
||||
pz_res, cmd_buf );
|
||||
}
|
||||
|
||||
free ((void *) pz_res);
|
||||
return res;
|
||||
}
|
||||
@ -938,7 +951,8 @@ fix_applies (p_fixd)
|
||||
tFixDesc *p_fixd;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
static const char z_failed[] = "not applying %s to %s - test %d failed\n";
|
||||
static const char z_failed[] = "not applying %s %s to %s - "
|
||||
"test %d failed\n";
|
||||
#endif
|
||||
const char *pz_fname = pz_curr_file;
|
||||
const char *pz_scan = p_fixd->file_list;
|
||||
@ -994,8 +1008,8 @@ fix_applies (p_fixd)
|
||||
if (test_test (p_test, pz_curr_file) != APPLY_FIX) {
|
||||
#ifdef DEBUG
|
||||
if (VLEVEL( VERB_EVERYTHING ))
|
||||
fprintf (stderr, z_failed, p_fixd->fix_name, pz_fname,
|
||||
p_fixd->test_ct - test_ct);
|
||||
fprintf (stderr, z_failed, "TEST", p_fixd->fix_name,
|
||||
pz_fname, p_fixd->test_ct - test_ct);
|
||||
#endif
|
||||
return BOOL_FALSE;
|
||||
}
|
||||
@ -1005,8 +1019,8 @@ fix_applies (p_fixd)
|
||||
if (egrep_test (pz_curr_data, p_test) != APPLY_FIX) {
|
||||
#ifdef DEBUG
|
||||
if (VLEVEL( VERB_EVERYTHING ))
|
||||
fprintf (stderr, z_failed, p_fixd->fix_name, pz_fname,
|
||||
p_fixd->test_ct - test_ct);
|
||||
fprintf (stderr, z_failed, "EGREP", p_fixd->fix_name,
|
||||
pz_fname, p_fixd->test_ct - test_ct);
|
||||
#endif
|
||||
return BOOL_FALSE;
|
||||
}
|
||||
@ -1016,8 +1030,8 @@ fix_applies (p_fixd)
|
||||
if (egrep_test (pz_curr_data, p_test) == APPLY_FIX) {
|
||||
#ifdef DEBUG
|
||||
if (VLEVEL( VERB_EVERYTHING ))
|
||||
fprintf (stderr, z_failed, p_fixd->fix_name, pz_fname,
|
||||
p_fixd->test_ct - test_ct);
|
||||
fprintf (stderr, z_failed, "NEGREP", p_fixd->fix_name,
|
||||
pz_fname, p_fixd->test_ct - test_ct);
|
||||
#endif
|
||||
/* Negated sense */
|
||||
return BOOL_FALSE;
|
||||
@ -1029,8 +1043,8 @@ fix_applies (p_fixd)
|
||||
!= APPLY_FIX) {
|
||||
#ifdef DEBUG
|
||||
if (VLEVEL( VERB_EVERYTHING ))
|
||||
fprintf (stderr, z_failed, p_fixd->fix_name, pz_fname,
|
||||
p_fixd->test_ct - test_ct);
|
||||
fprintf (stderr, z_failed, "FTEST", p_fixd->fix_name,
|
||||
pz_fname, p_fixd->test_ct - test_ct);
|
||||
#endif
|
||||
return BOOL_FALSE;
|
||||
}
|
||||
|
@ -209,6 +209,8 @@ sig_handler (signo)
|
||||
"fixincl ERROR: sig_handler: killed pid %ld due to %s\n",
|
||||
(long) server_id, signo == SIGPIPE ? "SIGPIPE" : "SIGALRM");
|
||||
#endif
|
||||
if (signo == SIGPIPE)
|
||||
return;
|
||||
close_server ();
|
||||
read_pipe_timeout = BOOL_TRUE;
|
||||
}
|
||||
@ -226,6 +228,8 @@ server_setup ()
|
||||
|
||||
if (atexit_done++ == 0)
|
||||
atexit (close_server);
|
||||
else
|
||||
fputs ("NOTE: server restarted\n", stderr);
|
||||
|
||||
signal (SIGPIPE, sig_handler);
|
||||
signal (SIGALRM, sig_handler);
|
||||
@ -281,6 +285,7 @@ char *
|
||||
run_shell (pz_cmd)
|
||||
const char *pz_cmd;
|
||||
{
|
||||
tSCC zNoServer[] = "Server not running, cannot run:\n%s\n\n";
|
||||
t_bool retry = BOOL_TRUE;
|
||||
|
||||
do_retry:
|
||||
@ -299,7 +304,7 @@ run_shell (pz_cmd)
|
||||
if (server_id <= 0)
|
||||
{
|
||||
char *pz = (char *) malloc (1);
|
||||
|
||||
fprintf (stderr, zNoServer, pz_cmd);
|
||||
if (pz != (char *) NULL)
|
||||
*pz = '\0';
|
||||
return pz;
|
||||
@ -317,7 +322,7 @@ run_shell (pz_cmd)
|
||||
if (server_id == NULLPROCESS)
|
||||
{
|
||||
char *pz = (char *) malloc (1);
|
||||
|
||||
fprintf (stderr, zNoServer, pz_cmd);
|
||||
if (pz != (char *) NULL)
|
||||
*pz = '\0';
|
||||
return pz;
|
||||
@ -344,6 +349,9 @@ run_shell (pz_cmd)
|
||||
if (pz != (char *) NULL)
|
||||
*pz = '\0';
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf( stderr, "run_shell command success: %s\n", pz );
|
||||
#endif
|
||||
return pz;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user