From patchwork Tue Oct 2 18:17:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: fix up fixincludes for VxWorks and fix testing Date: Tue, 02 Oct 2012 08:17:28 -0000 From: rbmj X-Patchwork-Id: 188598 Message-Id: <506B2FB8.3070202@verizon.net> To: Bruce Korb Cc: GCC Patches Forgot to attach... On 10/2/2012 2:11 PM, rbmj wrote: > Patch 2: [fixincludes] Clean up fixincludes test machinery > > TODO Prior to commit: > > * fixincl.x: Regenerate > > ChangeLog > > 2012-09-23 Bruce Korb > > * check.tpl: export TEST_MODE=true for testing > * fixincl.c (te_verbose): extract to fixlib.h > (run_compiles): in test mode, if the fix is a replacement, > then skip the test. The fix will not be applied. > * fixlib.h (fixinc_mode): new global variable that defaults to > TESTING_OFF but is set to TESTING_ON when TEST_MODE is true. > * fixopts.c: define this global variable > (initialize_opts): set it to TESTING_ON under proper conditions > * inclhack.def (AAB_darwin7_9_long_double_funcs_2): this is *NOT* > a replacement fix. Rename it and move it where it belongs as > (darwin_9_long_double_funcs_2): renamed fix > (broken_nan): this had a broken selection regex. Could never work. > * tests/base/architecture/ppc/math.h: replacement fixes are not > tested, > so remove all the replacement text. Add in the "broken_nan" test > that used to never, ever fire. > > >From 56861b9c45b43c1443f88e56e6fa46fde590a70f Mon Sep 17 00:00:00 2001 From: rbmj Date: Tue, 2 Oct 2012 13:52:27 -0400 Subject: [PATCH 2/4] [fixincludes] Clean up fixincludes test machinery --- fixincludes/README | 3 +++ fixincludes/check.tpl | 1 + fixincludes/fixincl.c | 27 +++++++++++---------------- fixincludes/fixlib.h | 26 +++++++++++++++++++++++++- fixincludes/fixopts.c | 42 +++++++++++++++++++++++++++--------------- fixincludes/fixtests.c | 2 +- fixincludes/inclhack.def | 42 +++++++++++++++++++++--------------------- fixincludes/tests/base/architecture/ppc/math.h | 84 +------- 7 files changed, 89 insertions(+), 54 deletions(-) diff --git a/fixincludes/README b/fixincludes/README index c7144a0..9b48210 100644 --- a/fixincludes/README +++ b/fixincludes/README @@ -44,6 +44,9 @@ To make your fix, you will need to do several things: Make sure it is now properly handled. Add tests to the "test_text" entry(ies) that validate your fix. This will help ensure that future fixes won't negate your work. + Do *NOT* specify test text for "wrap" or "replacement" fixes. + There is no real possibility that these fixes will fail. + If they do, you will surely know straight away. 5. Go into the fixincludes build directory and type, "make check". You are guaranteed to have issues printed out as a result. diff --git a/fixincludes/check.tpl b/fixincludes/check.tpl index a9810e2..0d1f444 100644 --- a/fixincludes/check.tpl +++ b/fixincludes/check.tpl @@ -99,6 +99,7 @@ ENDFOR fix =] +export TEST_MODE=true find . -type f | sed 's;^\./;;' | sort | ../../fixincl cd ${DESTDIR} diff --git a/fixincludes/fixincl.c b/fixincludes/fixincl.c index 1133534..fecfb19 100644 --- a/fixincludes/fixincl.c +++ b/fixincludes/fixincl.c @@ -53,22 +53,8 @@ static const char z_std_preamble[] = original, manufacturer supplied header file. */\n\n"; int find_base_len = 0; - -typedef enum { - VERB_SILENT = 0, - VERB_FIXES, - VERB_APPLIES, - VERB_PROGRESS, - VERB_TESTS, - VERB_EVERYTHING -} te_verbose; - -te_verbose verbose_level = VERB_PROGRESS; int have_tty = 0; -#define VLEVEL(l) ((unsigned int) verbose_level >= (unsigned int) l) -#define NOT_SILENT VLEVEL(VERB_FIXES) - pid_t process_chain_head = (pid_t) -1; char* pz_curr_file; /* name of the current file under test/fix */ @@ -412,8 +398,17 @@ run_compiles (void) /* FOR every fixup, ... */ do { - tTestDesc *p_test = p_fixd->p_test_desc; - int test_ct = p_fixd->test_ct; + tTestDesc *p_test; + int test_ct; + + if (fixinc_mode && (p_fixd->fd_flags & FD_REPLACEMENT)) + { + p_fixd->fd_flags |= FD_SKIP_TEST; + continue; + } + + p_test = p_fixd->p_test_desc; + test_ct = p_fixd->test_ct; /* IF the machine type pointer is not NULL (we are not in test mode) AND this test is for or not done on particular machines diff --git a/fixincludes/fixlib.h b/fixincludes/fixlib.h index 42d98b2..19df48a 100644 --- a/fixincludes/fixlib.h +++ b/fixincludes/fixlib.h @@ -140,7 +140,10 @@ typedef int apply_fix_p_t; /* Apply Fix Predicate Type */ "amount of user entertainment" ) \ \ _ENV_( pz_find_base, BOOL_TRUE, "FIND_BASE", \ - "leader to trim from file names" ) + "leader to trim from file names" ) \ + \ + _ENV_( pz_test_mode, BOOL_FALSE, "TEST_MODE", \ + "run fixincludes in test mode" ) #define _ENV_(v,m,n,t) extern tCC* v; ENV_TABLE @@ -211,6 +214,27 @@ typedef struct { extern int gnu_type_map_ct; +typedef enum { + VERB_SILENT = 0, + VERB_FIXES, + VERB_APPLIES, + VERB_PROGRESS, + VERB_TESTS, + VERB_EVERYTHING +} te_verbose; + +te_verbose verbose_level; + +#define VLEVEL(l) ((unsigned int) verbose_level >= (unsigned int) l) +#define NOT_SILENT VLEVEL(VERB_FIXES) + +typedef enum { + TESTING_OFF = 0, + TESTING_ON = 1 +} fixinc_mode_t; + +fixinc_mode_t fixinc_mode; + #ifdef HAVE_MMAP_FILE #define UNLOAD_DATA() do { if (curr_data_mapped) { \ munmap ((void*)pz_curr_data, data_map_size); close (data_map_fd); } \ diff --git a/fixincludes/fixopts.c b/fixincludes/fixopts.c index d305cd7..4be3693 100644 --- a/fixincludes/fixopts.c +++ b/fixincludes/fixopts.c @@ -20,31 +20,43 @@ along with GCC; see the file COPYING3. If not see #include "fixlib.h" -#define _ENV_(v,m,n,t) tCC* v = NULL; +te_verbose verbose_level = VERB_PROGRESS; + +fixinc_mode_t fixinc_mode = TESTING_OFF; + +#define _ENV_(v,m,n,t) char const * v = NULL; ENV_TABLE #undef _ENV_ -void -initialize_opts (void) +static void +show_not_def (char const * vname) { static const char var_not_found[] = -#ifndef __STDC__ - "fixincl ERROR: %s environment variable not defined\n" -#else "fixincl ERROR: %s environment variable not defined\n" - "each of these must be defined:\n" -# define _ENV_(vv,mm,nn,tt) "\t" nn " - " tt "\n" + "each of these must be defined:\n"; + static char const not_found_var[] = "\t%s\n"; + + fprintf (stderr, var_not_found, vname); +# define _ENV_(vv,mm,nn,tt) \ + if (mm) fprintf (stderr, not_found_var, nn); ENV_TABLE # undef _ENV_ -#endif - ; -#define _ENV_(v,m,n,t) { tSCC var[] = n; \ - v = getenv (var); if (m && (v == NULL)) { \ - fprintf (stderr, var_not_found, var); \ - exit (EXIT_FAILURE); } } + exit (EXIT_FAILURE); +} -ENV_TABLE +void +initialize_opts (void) +{ +#define _ENV_(v,m,n,t) { \ + static char const var[] = n; \ + v = getenv (var); \ + if (m && (v == NULL)) show_not_def (var); \ + } + ENV_TABLE; #undef _ENV_ + + if ((pz_test_mode != NULL) && (strcmp (pz_test_mode, "true") == 0)) + fixinc_mode = TESTING_ON; } diff --git a/fixincludes/fixtests.c b/fixincludes/fixtests.c index d668b92..f95dd73 100644 --- a/fixincludes/fixtests.c +++ b/fixincludes/fixtests.c @@ -46,7 +46,7 @@ along with GCC; see the file COPYING3. If not see #include "fixlib.h" -#define _ENV_(v,m,n,t) extern tCC* v; +#define _ENV_(v,m,n,t) extern char const * v; ENV_TABLE #undef _ENV_ diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index c5ae854..6c568d0 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -157,25 +157,6 @@ fix = { _EndOfHeader_; }; - -/* - * ... and for the previous fix to be useful, you have to not use "" - * includes. - */ -fix = { - hackname = AAB_darwin7_9_long_double_funcs_2; - mach = "*-*-darwin7.9*"; - files = math.h; - select = '#include[ \t]+\"'; - c_fix = format; - c_fix_arg = "%1<%2.h>"; - - c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"'; - - test_text = '#include "architecture/ppc/math.h"'; -}; - - /* * This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n) */ @@ -1030,7 +1011,6 @@ fix = { test_text = "extern void exit ( int );"; }; - /* * Remove `extern double cabs' declarations from math.h. * This conflicts with C99. Discovered on AIX. @@ -1066,7 +1046,7 @@ fix = { */ files = "architecture/ppc/math.h"; files = "architecture/*/math.h"; - select = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)"; + select = '#if defined\(__APPLE_CC__\) && \(__APPLE_CC__ >= 1345\)'; bypass = "powl"; c_fix = format; c_fix_arg = "#if 1"; @@ -1140,6 +1120,9 @@ fix = { test_text = "#define _CTRL(c) ('c'&037)"; }; +/* + * Fix various macros used to define ioctl numbers. + */ fix = { hackname = ctrl_quotes_use; select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']"; @@ -1176,6 +1159,23 @@ fix = { test_text = "extern void* malloc( size_t );"; }; +/* + * For the AAB_darwin7_9_long_double_funcs fix to be useful, + * you have to not use "" includes. + */ +fix = { + hackname = darwin_9_long_double_funcs_2; + mach = "*-*-darwin7.9*"; + files = math.h; + select = '#include[ \t]+\"'; + c_fix = format; + c_fix_arg = "%1<%2.h>"; + + c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"'; + + test_text = '#include "architecture/ppc/math.h"'; +}; + /* * On darwin8 and earlier, mach-o/swap.h isn't properly guarded diff --git a/fixincludes/tests/base/architecture/ppc/math.h b/fixincludes/tests/base/architecture/ppc/math.h index dcd0423..4af7808 100644 --- a/fixincludes/tests/base/architecture/ppc/math.h +++ b/fixincludes/tests/base/architecture/ppc/math.h @@ -7,82 +7,8 @@ This had to be done to correct non-standard usages in the original, manufacturer supplied header file. */ -/* This file prototypes the long double functions available on Mac OS - 10.3.9. */ -#ifndef __MATH__ -# undef __APPLE_CC__ -# define __APPLE_CC__ 1345 -# include_next -# undef __APPLE_CC__ -# define __APPLE_CC__ 1 -# ifndef __LIBMLDBL_COMPAT -# ifdef __LONG_DOUBLE_128__ -# define __LIBMLDBL_COMPAT(sym) __asm("_" #sym "$LDBL128") -# else -# define __LIBMLDBL_COMPAT(sym) -# endif /* __LONG_DOUBLE_128__ */ -# endif /* __LIBMLDBL_COMPAT */ -# ifdef __cplusplus - extern "C" { -# endif - extern long double acosl( long double ) __LIBMLDBL_COMPAT(acosl); - extern long double asinl( long double ) __LIBMLDBL_COMPAT(asinl); - extern long double atanl( long double ) __LIBMLDBL_COMPAT(atanl); - extern long double atan2l( long double, long double ) __LIBMLDBL_COMPAT(atan2l); - extern long double cosl( long double ) __LIBMLDBL_COMPAT(cosl); - extern long double sinl( long double ) __LIBMLDBL_COMPAT(sinl); - extern long double tanl( long double ) __LIBMLDBL_COMPAT(tanl); - extern long double acoshl( long double ) __LIBMLDBL_COMPAT(acoshl); - extern long double asinhl( long double ) __LIBMLDBL_COMPAT(asinhl); - extern long double atanhl( long double ) __LIBMLDBL_COMPAT(atanhl); - extern long double coshl( long double ) __LIBMLDBL_COMPAT(coshl); - extern long double sinhl( long double ) __LIBMLDBL_COMPAT(sinhl); - extern long double tanhl( long double ) __LIBMLDBL_COMPAT(tanhl); - extern long double expl( long double ) __LIBMLDBL_COMPAT(expl); - extern long double exp2l( long double ) __LIBMLDBL_COMPAT(exp2l); - extern long double expm1l( long double ) __LIBMLDBL_COMPAT(expm1l); - extern long double logl( long double ) __LIBMLDBL_COMPAT(logl); - extern long double log10l( long double ) __LIBMLDBL_COMPAT(log10l); - extern long double log2l( long double ) __LIBMLDBL_COMPAT(log2l); - extern long double log1pl( long double ) __LIBMLDBL_COMPAT(log1pl); - extern long double logbl( long double ) __LIBMLDBL_COMPAT(logbl); - extern long double modfl( long double, long double * ) __LIBMLDBL_COMPAT(modfl); - extern long double ldexpl( long double, int ) __LIBMLDBL_COMPAT(ldexpl); - extern long double frexpl( long double, int * ) __LIBMLDBL_COMPAT(frexpl); - extern int ilogbl( long double ) __LIBMLDBL_COMPAT(ilogbl); - extern long double scalbnl( long double, int ) __LIBMLDBL_COMPAT(scalbnl); - extern long double scalblnl( long double, long int ) __LIBMLDBL_COMPAT(scalblnl); - extern long double fabsl( long double ) __LIBMLDBL_COMPAT(fabsl); - extern long double cbrtl( long double ) __LIBMLDBL_COMPAT(cbrtl); - extern long double hypotl( long double, long double ) __LIBMLDBL_COMPAT(hypotl); - extern long double powl( long double, long double ) __LIBMLDBL_COMPAT(powl); - extern long double sqrtl( long double ) __LIBMLDBL_COMPAT(sqrtl); - extern long double erfl( long double ) __LIBMLDBL_COMPAT(erfl); - extern long double erfcl( long double ) __LIBMLDBL_COMPAT(erfcl); - extern long double lgammal( long double ) __LIBMLDBL_COMPAT(lgammal); - extern long double tgammal( long double ) __LIBMLDBL_COMPAT(tgammal); - extern long double ceill( long double ) __LIBMLDBL_COMPAT(ceill); - extern long double floorl( long double ) __LIBMLDBL_COMPAT(floorl); - extern long double nearbyintl( long double ) __LIBMLDBL_COMPAT(nearbyintl); - extern long double rintl( long double ) __LIBMLDBL_COMPAT(rintl); - extern long int lrintl( long double ) __LIBMLDBL_COMPAT(lrintl); - extern long long int llrintl( long double ) __LIBMLDBL_COMPAT(llrintl); - extern long double roundl( long double ) __LIBMLDBL_COMPAT(roundl); - extern long int lroundl( long double ) __LIBMLDBL_COMPAT(lroundl); - extern long long int llroundl( long double ) __LIBMLDBL_COMPAT(llroundl); - extern long double truncl( long double ) __LIBMLDBL_COMPAT(truncl); - extern long double fmodl( long double, long double) __LIBMLDBL_COMPAT(fmodl); - extern long double remainderl( long double, long double ) __LIBMLDBL_COMPAT(remainderl); - extern long double remquol( long double, long double, int * ) __LIBMLDBL_COMPAT(remquol); - extern long double copysignl( long double, long double ) __LIBMLDBL_COMPAT(copysignl); - extern long double nanl( const char * ) __LIBMLDBL_COMPAT(nanl); - extern long double nextafterl( long double, long double ) __LIBMLDBL_COMPAT(nextafterl); - extern long double nexttowardl( long double, long double ) __LIBMLDBL_COMPAT(nexttowardl); - extern long double fdiml( long double, long double ) __LIBMLDBL_COMPAT(fdiml); - extern long double fmaxl( long double, long double ) __LIBMLDBL_COMPAT(fmaxl); - extern long double fminl( long double, long double ) __LIBMLDBL_COMPAT(fminl); - extern long double fmal( long double, long double, long double ) __LIBMLDBL_COMPAT(fmal); -# ifdef __cplusplus - } -# endif -#endif /* __MATH__ */ + + +#if defined( BROKEN_NAN_CHECK ) +#if 1 +#endif /* BROKEN_NAN_CHECK */ -- 1.7.10.4