OSDN Git Service

implement "wrap" c_fix
authorkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 14 May 2000 19:29:02 +0000 (19:29 +0000)
committerkorbb <korbb@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 14 May 2000 19:29:02 +0000 (19:29 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33892 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/fixinc/check.diff
gcc/fixinc/fixfixes.c
gcc/fixinc/fixincl.x
gcc/fixinc/fixlib.c
gcc/fixinc/fixlib.h
gcc/fixinc/inclhack.def

index 706e51d..0acd8db 100644 (file)
@@ -1,3 +1,14 @@
+2000-05-14  Bruce Korb  <bkorb@gnu.org>
+
+       * fixinc/fixfixes.c(wrap_fix): new fix - inserts text before
+       and/or after current text of file
+       * fixinc/fixlib.c(must_malloc):
+       * fixinc/fixlib.h(must_malloc): + reformatting
+       * fixinc/inclhack.def: replace the "1i" and "$a" sed commands
+       with usages of ``c_fix = wrap;''
+       * fixinc/fixincl.x: regen
+       * fixinc/check.diff: regen
+
 Sun May 14 17:58:59 2000  Hans-Peter Nilsson  <hp@axis.com>
 
        * mklibgcc.in (building libgcc1) [Xlibgcc1.a]: Do not use unset
index da0496e..6b3493a 100644 (file)
 --- res/assert.h
 ***************
 *** 1,3 ****
---- 1,7 ----
+--- 1,13 ----
++ #ifndef FIXINC_BROKEN_ASSERT_STDLIB_CHECK
++ #define FIXINC_BROKEN_ASSERT_STDLIB_CHECK 1
++ 
 + #ifdef __cplusplus
 + #include <stdlib.h>
-+ #endif /* BROKEN_ASSERT_STDLIB_CHECK fix stamp */
++ #endif
++ #ifndef FIXINC_BROKEN_ASSERT_STDIO_CHECK
++ #define FIXINC_BROKEN_ASSERT_STDIO_CHECK 1
++ 
 + #include <stdio.h>
   
   
   #ifndef BROKEN_ASSERT_STDIO_CHECK
+***************
+*** 8,10 ****
+--- 18,24 ----
+  #ifndef BROKEN_ASSERT_STDLIB_CHECK
+  extern void exit ( int );
+  #endif  /* BROKEN_ASSERT_STDLIB_CHECK */
++ 
++ #endif  /* FIXINC_BROKEN_ASSERT_STDIO_CHECK */
++ 
++ #endif  /* FIXINC_BROKEN_ASSERT_STDLIB_CHECK */
 *** inc/c_asm.h
 --- res/c_asm.h
 ***************
   #ifndef BAD_STRUCT_TERM_CHECK
 ! struct term;
   #endif  /* BAD_STRUCT_TERM_CHECK */
+*** inc/libgen.h
+--- res/libgen.h
+***************
+*** 2,7 ****
+  
+  #ifndef BAD_LVAL_CHECK
+  #pragma extern_prefix "_FOO"
+! #define something(x,y,z) _FOOsomething(x,y,z)
+  #define mumble _FOOmumble
+  #endif  /* BAD_LVAL_CHECK */
+--- 2,7 ----
+  
+  #ifndef BAD_LVAL_CHECK
+  #pragma extern_prefix "_FOO"
+! #define something _FOOsomething
+  #define mumble _FOOmumble
+  #endif  /* BAD_LVAL_CHECK */
 *** inc/math.h
 --- res/math.h
 ***************
-*** 2,9 ****
+*** 1,10 ****
+  
   
   #ifndef BROKEN_CABS_CHECK
   #ifdef __STDC__
 - extern double cabs();
   #endif
   #endif  /* BROKEN_CABS_CHECK */
---- 2,7 ----
+  
+--- 1,14 ----
++ #ifndef FIXINC_MATH_EXCEPTION_CHECK
++ #define FIXINC_MATH_EXCEPTION_CHECK 1
++ 
++ #ifdef __cplusplus
++ #define exception __math_exception
++ #endif
+  
+  
+  #ifndef BROKEN_CABS_CHECK
+  #ifdef __STDC__
+  #else
+  #endif
+  #endif  /* BROKEN_CABS_CHECK */
+  
+***************
+*** 12,14 ****
+--- 16,23 ----
+  #ifndef MATH_EXCEPTION_CHECK
+  typedef struct exception t_math_exception;
+  #endif  /* MATH_EXCEPTION_CHECK */
++ #ifdef __cplusplus
++ #undef exception
++ #endif
++ 
++ #endif  /* FIXINC_MATH_EXCEPTION_CHECK */
 *** inc/stdio.h
 --- res/stdio.h
 ***************
   int foo;
   #endif
   #endif  /* ISC_OMITS_WITH_STDC_CHECK */
---- 1,14 ----
+--- 1,17 ----
++ #ifndef FIXINC_STDIO_STDARG_H_CHECK
++ #define FIXINC_STDIO_STDARG_H_CHECK 1
++ 
 + #define __need___va_list
 + #include <stdarg.h>
   
   int foo;
   #endif
   #endif  /* ISC_OMITS_WITH_STDC_CHECK */
+***************
+*** 15,17 ****
+--- 20,24 ----
+  #ifndef STDIO_STDARG_H_CHECK
+  
+  #endif  /* STDIO_STDARG_H_CHECK */
++ 
++ #endif  /* FIXINC_STDIO_STDARG_H_CHECK */
 *** inc/stdlib.h
 --- res/stdlib.h
 ***************
 --- res/sys/mman.h
 ***************
 *** 1,5 ****
---- 1,12 ----
+--- 1,16 ----
++ #ifndef FIXINC_CXX_UNREADY_CHECK
++ #define FIXINC_CXX_UNREADY_CHECK 1
++ 
 + #ifdef __cplusplus
 + extern "C" {
-+ #endif /* CXX_UNREADY_CHECK */
-+ 
++ #endif
   
   
   #ifndef CXX_UNREADY_CHECK
   #endif  /* CXX_UNREADY_CHECK */
 + #ifdef __cplusplus
 + }
-+ #endif /* CXX_UNREADY_CHECK */
++ #endif
++ 
++ #endif  /* FIXINC_CXX_UNREADY_CHECK */
 *** inc/sys/param.h
 --- res/sys/param.h
 ***************
index d254a70..8afa5b7 100644 (file)
@@ -19,7 +19,7 @@ Here are the rules:
 2.  Use the "FIX_PROC_HEAD()" macro _with_ the "_fix" suffix
     (I cannot use the ## magic from ANSI C) for defining your entry point.
 
-3.  Put your test name into the FIXUP_TABLE
+3.  Put your test name into the FIXUP_TABLE.
 
 4.  Do not read anything from stdin.  It is closed.
 
@@ -27,17 +27,16 @@ Here are the rules:
     In such an event, call "exit(1)".
 
 6.  You have access to the fixDescList entry for the fix in question.
-    This may be useful, for example, if there are pre-compiled
-    selection expressions stored there.
+    This may be useful, for example, if there are interesting strings
+    or pre-compiled regular expressions stored there.
 
-    For example, you may do this if you know that the first 
-    test contains a useful regex.  This is okay because, remember,
-    this code perforce works closely with the inclhack.def fixes!!
+    It is also possible to access fix descriptions by using the
+    index of a known fix, "my_fix_name" for example:
 
-    tFixDesc*  pMyDesc = fixDescList + MY_FIX_NAME_FIXIDX;
-    tTestDesc* pTestList = pMyDesc->p_test_desc;
+        tFixDesc*  p_desc  = fixDescList + MY_FIX_NAME_FIXIDX;
+        tTestDesc* p_tlist = p_desc->p_test_desc;
 
-    regexec (pTestList->p_test_regex, ...)
+        regexec (p_tlist->p_test_regex, ...)
 
 = = = = = = = = = = = = = = = = = = = = = = = = =
 
@@ -66,10 +65,11 @@ typedef struct {
 } fix_entry_t;
 
 #define FIXUP_TABLE \
-  _FT_( "format",           format_fix ) \
-  _FT_( "char_macro_use",   char_macro_use_fix ) \
   _FT_( "char_macro_def",   char_macro_def_fix ) \
-  _FT_( "machine_name",     machine_name_fix )
+  _FT_( "char_macro_use",   char_macro_use_fix ) \
+  _FT_( "format",           format_fix )         \
+  _FT_( "machine_name",     machine_name_fix )   \
+  _FT_( "wrap",             wrap_fix )
 
 
 #define FIX_PROC_HEAD( fix ) \
@@ -234,6 +234,7 @@ FIX_PROC_HEAD( format_fix )
     fputs (text, stdout);
 }
 
+
 /* Scan the input file for all occurrences of text like this:
 
    #define TIOCCONS _IO(T, 12)
@@ -332,7 +333,7 @@ FIX_PROC_HEAD( char_macro_use_fix )
    you provide in the STR argument.  */
 FIX_PROC_HEAD( char_macro_def_fix )
 {
-  /* This regexp looks for any traditional-syntax #define (# in column 1).  */
+  /* This regexp looks for any traditional-syntax #define (# in col 1). */
   static const char pat[] =
     "^#[ \t]*define[ \t]+";
   static regex_t re;
@@ -518,6 +519,57 @@ FIX_PROC_HEAD( machine_name_fix )
 }
 
 
+FIX_PROC_HEAD( wrap_fix )
+{
+  char   z_fixname[ 64 ];
+  tCC*   pz_src  = p_fixd->fix_name;
+  tCC*   pz_name = z_fixname;
+  char*  pz_dst  = z_fixname;
+  size_t len     = 0;
+
+  for (;;) {
+    char ch = *(pz_src++);
+
+    if (islower(ch))
+      *(pz_dst++) = toupper( ch );
+
+    else if (isalnum( ch ))
+      *(pz_dst++) = ch;
+
+    else if (ch == NUL) {
+      *(pz_dst++) = ch;
+      break;
+    }
+    else
+      *(pz_dst++) = '_';
+
+    if (++len >= sizeof( z_fixname )) {
+      void* p = must_malloc( len + strlen( pz_src ) + 1 );
+      memcpy( p, (void*)z_fixname, len );
+      pz_name = (tCC*)p;
+      pz_dst  = (char*)pz_name + len;
+    }
+  }
+
+  printf( "#ifndef FIXINC_%s_CHECK\n", pz_name );
+  printf( "#define FIXINC_%s_CHECK 1\n\n", pz_name );
+
+  if (p_fixd->patch_args[1] == (tCC*)NULL)
+    fputs( text, stdout );
+
+  else {
+    fputs( p_fixd->patch_args[1], stdout );
+    fputs( text, stdout );
+    if (p_fixd->patch_args[2] != (tCC*)NULL)
+      fputs( p_fixd->patch_args[2], stdout );
+  }
+
+  printf( "\n#endif  /* FIXINC_%s_CHECK */\n", pz_name );
+  if (pz_name != z_fixname)
+    free( (void*)pz_name );
+}
+
+
 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
 
      test for fix selector
index 719fab4..582d686 100644 (file)
@@ -1173,7 +1173,7 @@ tTestDesc aBad_LvalTests[] = {
  *  Fix Command Arguments for Bad_Lval
  */
 const char* apzBad_LvalPatch[] = { "sed",
-    "-e", "s/^[ \t]*#[ \t]*define[ \t]+\\([^(]*\\)\\(([^)]*)\\)[ \t]*\\(_.\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/",
+    "-e", "s/^[ \t]*#[ \t]*define[ \t][ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*\\(_.*\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/",
     (char*)NULL };
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -1214,9 +1214,9 @@ tTestDesc aBroken_Assert_StdioTests[] = {
 /*
  *  Fix Command Arguments for Broken_Assert_Stdio
  */
-const char* apzBroken_Assert_StdioPatch[] = { "sed",
-    "-e", "1i\\\n\
-#include <stdio.h>\n",
+const char* apzBroken_Assert_StdioPatch[] = {
+    "wrap",
+    "#include <stdio.h>\n",
     (char*)NULL };
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -1257,11 +1257,11 @@ tTestDesc aBroken_Assert_StdlibTests[] = {
 /*
  *  Fix Command Arguments for Broken_Assert_Stdlib
  */
-const char* apzBroken_Assert_StdlibPatch[] = { "sed",
-    "-e", "1i\\\n\
-#ifdef __cplusplus\\\n\
-#include <stdlib.h>\\\n\
-#endif /* BROKEN_ASSERT_STDLIB_CHECK fix stamp */\n",
+const char* apzBroken_Assert_StdlibPatch[] = {
+    "wrap",
+    "#ifdef __cplusplus\n\
+#include <stdlib.h>\n\
+#endif\n",
     (char*)NULL };
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -1466,16 +1466,14 @@ tTestDesc aCxx_UnreadyTests[] = {
 /*
  *  Fix Command Arguments for Cxx_Unready
  */
-const char* apzCxx_UnreadyPatch[] = { "sed",
-    "-e", "1i\\\n\
-#ifdef __cplusplus\\\n\
-extern \"C\" {\\\n\
-#endif /* CXX_UNREADY_CHECK */\\\n\
-\n",
-    "-e", "$a\\\n\
-#ifdef __cplusplus\\\n\
-}\\\n\
-#endif /* CXX_UNREADY_CHECK */\n",
+const char* apzCxx_UnreadyPatch[] = {
+    "wrap",
+    "#ifdef __cplusplus\n\
+extern \"C\" {\n\
+#endif\n",
+    "#ifdef __cplusplus\n\
+}\n\
+#endif\n",
     (char*)NULL };
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -2468,14 +2466,13 @@ tTestDesc aMath_ExceptionTests[] = {
 /*
  *  Fix Command Arguments for Math_Exception
  */
-const char* apzMath_ExceptionPatch[] = { "sed",
-    "-e", "1i\\\n\
-#ifdef __cplusplus\\\n\
-#define exception __math_exception\\\n\
+const char* apzMath_ExceptionPatch[] = {
+    "wrap",
+    "#ifdef __cplusplus\n\
+#define exception __math_exception\n\
 #endif\n",
-    "-e", "$a\\\n\
-#ifdef __cplusplus\\\n\
-#undef exception\\\n\
+    "#ifdef __cplusplus\n\
+#undef exception\n\
 #endif\n",
     (char*)NULL };
 
@@ -3292,9 +3289,9 @@ tTestDesc aStdio_Stdarg_HTests[] = {
 /*
  *  Fix Command Arguments for Stdio_Stdarg_H
  */
-const char* apzStdio_Stdarg_HPatch[] = { "sed",
-    "-e", "1i\\\n\
-#define __need___va_list\\\n\
+const char* apzStdio_Stdarg_HPatch[] = {
+    "wrap",
+    "#define __need___va_list\n\
 #include <stdarg.h>\n",
     (char*)NULL };
 
@@ -4821,12 +4818,12 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
 
   {  zBroken_Assert_StdioName,    zBroken_Assert_StdioList,
      apzBroken_Assert_StdioMachs,
-     BROKEN_ASSERT_STDIO_TEST_CT, FD_MACH_ONLY,
+     BROKEN_ASSERT_STDIO_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aBroken_Assert_StdioTests,   apzBroken_Assert_StdioPatch },
 
   {  zBroken_Assert_StdlibName,    zBroken_Assert_StdlibList,
      apzBroken_Assert_StdlibMachs,
-     BROKEN_ASSERT_STDLIB_TEST_CT, FD_MACH_ONLY,
+     BROKEN_ASSERT_STDLIB_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aBroken_Assert_StdlibTests,   apzBroken_Assert_StdlibPatch },
 
   {  zBroken_CabsName,    zBroken_CabsList,
@@ -4856,7 +4853,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
 
   {  zCxx_UnreadyName,    zCxx_UnreadyList,
      apzCxx_UnreadyMachs,
-     CXX_UNREADY_TEST_CT, FD_MACH_ONLY,
+     CXX_UNREADY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aCxx_UnreadyTests,   apzCxx_UnreadyPatch },
 
   {  zHpux_MaxintName,    zHpux_MaxintList,
@@ -4991,7 +4988,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
 
   {  zMath_ExceptionName,    zMath_ExceptionList,
      apzMath_ExceptionMachs,
-     MATH_EXCEPTION_TEST_CT, FD_MACH_ONLY,
+     MATH_EXCEPTION_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aMath_ExceptionTests,   apzMath_ExceptionPatch },
 
   {  zMath_Huge_Val_From_Dbl_MaxName,    zMath_Huge_Val_From_Dbl_MaxList,
@@ -5101,7 +5098,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
 
   {  zStdio_Stdarg_HName,    zStdio_Stdarg_HList,
      apzStdio_Stdarg_HMachs,
-     STDIO_STDARG_H_TEST_CT, FD_MACH_ONLY,
+     STDIO_STDARG_H_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aStdio_Stdarg_HTests,   apzStdio_Stdarg_HPatch },
 
   {  zStdio_Va_ListName,    zStdio_Va_ListList,
index 133aa8e..bafe261 100644 (file)
@@ -24,6 +24,20 @@ Boston, MA 02111-1307, USA.  */
 
 #include "fixlib.h"
 
+void *
+must_malloc( siz )
+    size_t  siz;
+{
+  void*  res = malloc( siz );
+
+  if (res == (void*)NULL) {
+    fprintf( stderr, "fixincl failed to malloc %d bytes\n", siz );
+    exit( 3 );
+  }
+
+  return res;
+}
+
 /* * * * * * * * * * * * *
  
    load_file_data loads all the contents of a file into malloc-ed memory.
index d28aed6..5cbf412 100644 (file)
@@ -138,14 +138,14 @@ typedef struct patch_desc tPatchDesc;
 typedef struct fix_desc tFixDesc;
 struct fix_desc
 {
-  const char*   fix_name;       /* Name of the fix */
-  const char*   file_list;      /* List of files it applies to */
-  const char**  papz_machs;     /* List of machine/os-es it applies to */
-  int           test_ct;
-  int           fd_flags;
-  tTestDesc*    p_test_desc;
-  const char**  patch_args;
-  long          unused;
+  tCC*        fix_name;       /* Name of the fix */
+  tCC*        file_list;      /* List of files it applies to */
+  tCC**       papz_machs;     /* List of machine/os-es it applies to */
+  int         test_ct;
+  int         fd_flags;
+  tTestDesc*  p_test_desc;
+  tCC**       patch_args;
+  long        unused;
 };
 
 /*
@@ -155,6 +155,7 @@ char * load_file_data _P_(( FILE* fp ));
 t_bool is_cxx_header  _P_(( tCC* filename, tCC* filetext ));
 void   compile_re     _P_(( tCC* pat, regex_t* re, int match,
                            tCC *e1, tCC *e2 ));
+void*  must_malloc    _P_(( size_t ));
 
 void apply_fix _P_(( tFixDesc* p_fixd, tCC* filname ));
 apply_fix_p_t run_test _P_((tCC* t_name, tCC* f_name, tCC* text ));
index 58b0b01..a6ceec2 100644 (file)
@@ -733,13 +733,13 @@ fix = {
     files    = stropts.h;
     files    = time.h;
     files    = unistd.h;
+
     sed      =
-        "s/^[ \t]*#[ \t]*define[ \t]+\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
-               "\\(_.\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
+        "s/^[ \t]*#[ \t]*define[ \t][ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
+               "\\(_.*\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
 
     test_text = '#pragma extern_prefix "_FOO"'"\n"
                 "#define something(x,y,z) _FOOsomething(x,y,z)\n"
-                "#define otherwise(x,y,z) BAR_Something(x,y,z)\n"
                 "#define mumble _FOOmumble";
 };
 
@@ -748,12 +748,12 @@ fix = {
  *  check for broken assert.h that needs stdio.h
  */
 fix = {
-    hackname = broken_assert_stdio;
-    files    = assert.h;
-    select   = stderr;
-    bypass   = "include.*stdio\\.h";
-    sed      = "1i\\\n"
-               "#include <stdio.h>\n";
+    hackname  = broken_assert_stdio;
+    files     = assert.h;
+    select    = stderr;
+    bypass    = "include.*stdio\\.h";
+    c_fix     = wrap;
+    c_fix_arg = "#include <stdio.h>\n";
     test_text = "extern FILE* stderr;";
 };
 
@@ -762,14 +762,14 @@ fix = {
  *  check for broken assert.h that needs stdlib.h
  */
 fix = {
-    hackname = broken_assert_stdlib;
-    files    = assert.h;
-    select   = 'exit *\(|abort *\(';
-    bypass   = "include.*stdlib\\.h";
-    sed      = "1i\\\n"
-               "#ifdef __cplusplus\\\n"
-               "#include <stdlib.h>\\\n"
-               "#endif /* BROKEN_ASSERT_STDLIB_CHECK fix stamp */\n";
+    hackname  = broken_assert_stdlib;
+    files     = assert.h;
+    select    = 'exit *\(|abort *\(';
+    bypass    = "include.*stdlib\\.h";
+    c_fix     = wrap;
+    c_fix_arg = "#ifdef __cplusplus\n"
+                "#include <stdlib.h>\n"
+                "#endif\n";
     test_text = "extern void exit ( int );";
 };
 
@@ -861,18 +861,17 @@ fix = {
     hackname = cxx_unready;
     files    = sys/mman.h;
     files    = rpc/types.h;
-    select   = '[^#]+malloc.*;';  /* Should catch any form of a declaration
-                                    but not mention within a macro.  */
+    select   = '[^#]+malloc.*;';  /* Catch any form of declaration
+                                    not within a macro.  */
     bypass   = '"C"|__BEGIN_DECLS';
 
-    sed      = "1i\\\n"
-               "#ifdef __cplusplus\\\n"
-               "extern \"C\" {\\\n"
-               "#endif /* CXX_UNREADY_CHECK */\\\n\n";
-    sed      = "$a\\\n"
-               "#ifdef __cplusplus\\\n"
-               "}\\\n"
-               "#endif /* CXX_UNREADY_CHECK */\n";
+    c_fix     = wrap;
+    c_fix_arg = "#ifdef __cplusplus\n"
+                "extern \"C\" {\n"
+                "#endif\n";
+    c_fix_arg = "#ifdef __cplusplus\n"
+                "}\n"
+                "#endif\n";
     test_text = "extern void* malloc( size_t );";
 };
 
@@ -1310,18 +1309,21 @@ fix = {
  *  additional references to struct exception.
  */
 fix = {
-    hackname = math_exception;
-    files    = math.h;
-    select   = "struct exception";
-    bypass   = "We have a problem when using C\\+\\+";
-    sed      = "1i\\\n"
-               "#ifdef __cplusplus\\\n"
-               "#define exception __math_exception\\\n"
-               "#endif\n";
-    sed      = "$a\\\n"
-               "#ifdef __cplusplus\\\n"
-               "#undef exception\\\n"
-               "#endif\n";
+    hackname  = math_exception;
+    files     = math.h;
+    select    = "struct exception";
+    bypass    = "We have a problem when using C\\+\\+";
+    c_fix     = wrap;
+
+    c_fix_arg = "#ifdef __cplusplus\n"
+                "#define exception __math_exception\n"
+                "#endif\n";
+
+    c_fix_arg = "#ifdef __cplusplus\n"
+                "#undef exception\n"
+                "#endif\n";
+
+    test_text = "typedef struct exception t_math_exception;";
 };
 
 fix = {
@@ -1687,11 +1689,11 @@ fix = {
     files    = stdio.h;
     bypass   = "include.*(stdarg\.h|machine/ansi\.h)";
 
-    sed      = '1i\\
-\#define __need___va_list\\
-\#include <stdarg.h>
-';
+    c_fix     = wrap;
 
+    c_fix_arg = "#define __need___va_list\n#include <stdarg.h>\n";
+
+    test_text = "";
 };
 
 
@@ -2038,8 +2040,11 @@ fix = {
     files    = sys/cmn_err.h;
     files    = sys/kdebugger.h;
     bypass   = '_KERNEL';
-    sed      = "1i\\\n#ifdef _KERNEL";
-    sed      = "$a\\\n#endif /* _KERNEL */";
+    c_fix     = wrap;
+
+    c_fix_arg = "#ifdef _KERNEL\n";
+    c_fix_arg = "#endif /* _KERNEL */\n";
+    test_text = "";
 };
 #endif