This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Feeding back fixincludes changes
Richard Henderson wrote:
>
> On Wed, Nov 29, 2000 at 12:17:08PM -0800, Bruce Korb wrote:
> > It was just too hard to figure out
> > that this construct was inside of a comment.
>
> I have another amusing idea -- preprocess the header before and
> after the change, and if there is no non-whitespace change, then
> the header must have been safe beforehand.
That might have worked for the rpc issue, but I think it would have
been more work than implementing a special purpose sed that skips
C comments. Anyone is welcome to play this game. Just write a
fix application test or fixup routine that follows the appropriate
prototype:
typedef apply_fix_p_t t_test_proc PARAMS(( tCC* file, tCC* text ));
typedef void t_fix_proc PARAMS ((const char *, const char *, tFixDesc
*));
plug it into the appropriate fixup/test table:
#define FIXUP_TABLE \
_FT_( "char_macro_def", char_macro_def_fix ) \
_FT_( "char_macro_use", char_macro_use_fix ) \
_FT_( "format", format_fix ) \
_FT_( "machine_name", machine_name_fix ) \
_FT_( "wrap", wrap_fix ) \
_FT_( "gnu_type", gnu_type_fix )
#define FIX_TEST_TABLE \
_FT_( "machine_name", machine_name_test )
and modify an entry in the hack table, specifying the new
``c_fix'' or ``c_test'', as appropriate:
/*
* Fix non-ansi machine name defines
*/
fix = {
hackname = machine_name;
c_test = machine_name;
c_fix = machine_name;
test_text = "/* MACH_DIFF: */\n"
"#if defined( i386 ) || defined( sparc ) || defined( vax )"
"\n/* no uniform test, so be careful :-) */";
};
voila.