Commit d7eb5a45 by Zack Weinberg Committed by Zack Weinberg

fixtests.c (is_cxx_header): New fn, split out of double_slash_test.

1999-12-17 13:21 -0800  Zack Weinberg  <zack@rabi.columbia.edu>

	* fixtests.c (is_cxx_header): New fn, split out of
	double_slash_test.
	(else_endif_label): Allow "#endif // comment" in C++ headers,
	as determined by is_cxx_header.
	* fixfixes.c (else_endif_label_fix): Update comment.
	* fixincl.c: Don't output VERB_PROGRESS lines if stdout is not
	a tty.
	* genfixes: Correct double thinko in commandline parsing.
	* hackshell.tpl: Generate correct sh syntax for bypass
	entries.

	* inclhack.def (all): Whenever an inserted preprocessor
	conditional is split over multiple lines, use double
	backslashes in this file so the fixed header will be readable.

	(AAB_fd_zero_glibc_1_0): Rename to AAB_fd_zero_asm_posix_types_h
	and add bypass entry for correct version of this header.
	(AAB_fd_zero_glibc_1_x): Rename to AAB_fd_zero_gnu_types_h.
	(AAB_fd_zero_glibc_2_0): Rename to AAB_fd_zero_selectbits_h.

	(hpux8_bogus_inlines): New fix, split from...
	(ultrix_atof_param) ... here.
	(math_expression): Add bypass entry keyed to glibc comment
	indicating the problem has been dealt with; disable
	unnecessary sed operations; update commentary.
	(math_gcc_ifndefs): Rename to math_huge_val_from_dbl_max,
	add select and bypass entries, simplify shell operation.
	(math_huge_val_ifndef): Split from math_gcc_ifndefs.

	(ip_missing_semi, rs6000_param, tinfo_cplusplus,
	 ultrix_atof_param): Add select entry.
	(stdio_va_list, sunos_mather_decl): Add bypass entry.
	(systypes_for_aix, sysv86_string, tinfo_cplusplus): Put the
	comments with the fixes they describe.

	* fixincl.x, fixincl.sh, inclhack.sh: Regen.

From-SVN: r30999
parent cdfff38e
1999-12-17 13:21 -0800 Zack Weinberg <zack@rabi.columbia.edu> 1999-12-17 13:21 -0800 Zack Weinberg <zack@rabi.columbia.edu>
* fixtests.c (is_cxx_header): New fn, split out of
double_slash_test.
(else_endif_label): Allow "#endif // comment" in C++ headers,
as determined by is_cxx_header.
* fixfixes.c (else_endif_label_fix): Update comment.
* fixincl.c: Don't output VERB_PROGRESS lines if stdout is not
a tty.
* genfixes: Correct double thinko in commandline parsing.
* hackshell.tpl: Generate correct sh syntax for bypass
entries.
* inclhack.def (all): Whenever an inserted preprocessor
conditional is split over multiple lines, use double
backslashes in this file so the fixed header will be readable.
(AAB_fd_zero_glibc_1_0): Rename to AAB_fd_zero_asm_posix_types_h
and add bypass entry for correct version of this header.
(AAB_fd_zero_glibc_1_x): Rename to AAB_fd_zero_gnu_types_h.
(AAB_fd_zero_glibc_2_0): Rename to AAB_fd_zero_selectbits_h.
(hpux8_bogus_inlines): New fix, split from...
(ultrix_atof_param) ... here.
(math_expression): Add bypass entry keyed to glibc comment
indicating the problem has been dealt with; disable
unnecessary sed operations; update commentary.
(math_gcc_ifndefs): Rename to math_huge_val_from_dbl_max,
add select and bypass entries, simplify shell operation.
(math_huge_val_ifndef): Split from math_gcc_ifndefs.
(ip_missing_semi, rs6000_param, tinfo_cplusplus,
ultrix_atof_param): Add select entry.
(stdio_va_list, sunos_mather_decl): Add bypass entry.
(systypes_for_aix, sysv86_string, tinfo_cplusplus): Put the
comments with the fixes they describe.
* c-parse.in (string action): Do not warn about ANSI string * c-parse.in (string action): Do not warn about ANSI string
concatenation in system headers. Affects C parser only. concatenation in system headers. Affects C parser only.
* c-parse.y, c-parse.c, c-parse.h: Rebuild. * c-parse.y, c-parse.c, c-parse.h: Rebuild.
......
...@@ -312,10 +312,6 @@ FIX_PROC_HEAD( else_endif_label_fix ) ...@@ -312,10 +312,6 @@ FIX_PROC_HEAD( else_endif_label_fix )
break; break;
} }
/*
FIXME: if this is a C++ file, then a double slash comment
is allowed to follow the directive. */
/* FALLTHROUGH */ /* FALLTHROUGH */
default: default:
......
...@@ -114,6 +114,7 @@ typedef enum { ...@@ -114,6 +114,7 @@ typedef enum {
} te_verbose; } te_verbose;
te_verbose verbose_level = VERB_PROGRESS; te_verbose verbose_level = VERB_PROGRESS;
int have_tty = 0;
#define VLEVEL(l) (verbose_level >= l) #define VLEVEL(l) (verbose_level >= l)
#define NOT_SILENT VLEVEL(VERB_FIXES) #define NOT_SILENT VLEVEL(VERB_FIXES)
...@@ -192,6 +193,8 @@ main (argc, argv) ...@@ -192,6 +193,8 @@ main (argc, argv)
initialize (); initialize ();
have_tty = isatty (fileno (stderr));
/* Before anything else, ensure we can allocate our file name buffer. */ /* Before anything else, ensure we can allocate our file name buffer. */
file_name_buf = load_file_data (stdin); file_name_buf = load_file_data (stdin);
...@@ -1336,7 +1339,7 @@ process () ...@@ -1336,7 +1339,7 @@ process ()
#ifdef DO_STATS #ifdef DO_STATS
process_ct++; process_ct++;
#endif #endif
if (VLEVEL( VERB_PROGRESS )) if (VLEVEL( VERB_PROGRESS ) && have_tty)
fprintf (stderr, "%6d %-50s \r", data_map_size, pz_curr_file ); fprintf (stderr, "%6d %-50s \r", data_map_size, pz_curr_file );
process_chain_head = NOPROCESS; process_chain_head = NOPROCESS;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# files which are fixed to work correctly with ANSI C and placed in a # files which are fixed to work correctly with ANSI C and placed in a
# directory that GNU C will search. # directory that GNU C will search.
# #
# This script contains 112 fixup scripts. # This script contains 114 fixup scripts.
# #
# See README-fixinc for more information. # See README-fixinc for more information.
# #
......
...@@ -106,8 +106,10 @@ skip_quote( q, text ) ...@@ -106,8 +106,10 @@ skip_quote( q, text )
return text; return text;
} }
static apply_fix_p_t
TEST_FOR_FIX_PROC_HEAD( double_slash_test ) is_cxx_header (fname, text)
const char *fname;
const char *text;
{ {
/* First, check to see if the file is in a C++ directory */ /* First, check to see if the file is in a C++ directory */
if (strstr( fname, "CC/" ) != NULL) if (strstr( fname, "CC/" ) != NULL)
...@@ -116,9 +118,19 @@ TEST_FOR_FIX_PROC_HEAD( double_slash_test ) ...@@ -116,9 +118,19 @@ TEST_FOR_FIX_PROC_HEAD( double_slash_test )
return SKIP_FIX; return SKIP_FIX;
if (strstr( fname, "++" ) != NULL) if (strstr( fname, "++" ) != NULL)
return SKIP_FIX; return SKIP_FIX;
/* Or it might contain the phrase 'extern "C++"' */
if (strstr( text, "extern \"C++\"" ) != NULL) if (strstr( text, "extern \"C++\"" ) != NULL)
return SKIP_FIX; return SKIP_FIX;
return APPLY_FIX;
}
TEST_FOR_FIX_PROC_HEAD( double_slash_test )
{
if (is_cxx_header (fname, text) == SKIP_FIX)
return SKIP_FIX;
/* Now look for the comment markers in the text */ /* Now look for the comment markers in the text */
for (;;) for (;;)
{ {
...@@ -167,6 +179,7 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test ) ...@@ -167,6 +179,7 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test )
char ch; char ch;
const char* pz_next = (char*)NULL; const char* pz_next = (char*)NULL;
regmatch_t match[2]; regmatch_t match[2];
const char *all_text = text;
/* /*
This routine may be run many times within a single execution. This routine may be run many times within a single execution.
...@@ -266,10 +279,15 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test ) ...@@ -266,10 +279,15 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test )
pz_next += 2; pz_next += 2;
break; break;
} }
else if (*pz_next == '/'
/* && is_cxx_header( fname, all_text ) == SKIP_FIX)
FIXME: if this is a C++ file, then a double slash comment {
is allowed to follow the directive. */ pz_next = strchr( pz_next+1, '\n' );
if (pz_next == (char*)NULL)
return SKIP_FIX;
pz_next++;
break;
}
/* FALLTHROUGH */ /* FALLTHROUGH */
......
...@@ -63,9 +63,9 @@ fi ...@@ -63,9 +63,9 @@ fi
set -e set -e
case "$1" in case "$1" in
inclhack.def ) inclhack.sh )
echo AutoGen-ing inclhack.sh echo AutoGen-ing inclhack.sh
$AG inclhack.sh $AG inclhack.def
;; ;;
fixincl.x ) fixincl.x )
......
...@@ -59,8 +59,8 @@ _FOR fix "\n\n" =] ...@@ -59,8 +59,8 @@ _FOR fix "\n\n" =]
_IF bypass _exist =] _IF bypass _exist =]
if ( test [= if ( test [=
_FOR bypass=] -a \ _FOR bypass " -a \\\n "
-z [=bypass _shrstr "#`egrep %s ${file}`" =]-z [=bypass _shrstr "#`egrep %s ${file}`"
_printf _shstr =][= _printf _shstr =][=
/bypass=] /bypass=]
) > /dev/null 2>&1 ; then[= ) > /dev/null 2>&1 ; then[=
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment