Bootstrapped using the default BSD sed, awk etc. complex.h /home/jwakely/src/full/gcc/fixincludes/tests/base/complex.h differ: char 839, line 41 *** complex.h Wed Feb 8 10:21:00 2012 --- /home/jwakely/src/full/gcc/fixincludes/tests/base/complex.h Mon Nov 7 09:52:51 2011 *************** *** 38,43 **** #if defined( SOLARIS_COMPLEX_CXX_CHECK ) #ifdef __cplusplus extern "C" { ! #endif#ifdef __cplusplus } ! #endif#endif /* SOLARIS_COMPLEX_CXX_CHECK */ --- 38,45 ---- #if defined( SOLARIS_COMPLEX_CXX_CHECK ) #ifdef __cplusplus extern "C" { ! #endif ! #ifdef __cplusplus } ! #endif ! #endif /* SOLARIS_COMPLEX_CXX_CHECK */ There were fixinclude test FAILURES
Weird original formatting in complex.h
The problem is that netbsd's sed doesn't put a newline after a 'c' command, so the two 'endif' here (from fixincl.x) don't get newlines after them: /* * Fix Command Arguments for Solaris_Complex_Cxx */ static const char* apzSolaris_Complex_CxxPatch[] = { sed_cmd_z, "-e", "/#if[ \t]*!defined(__cplusplus)/c\\\n\ #ifdef\t__cplusplus\\\n\ extern \"C\" {\\\n\ #endif", "-e", "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c\\\n\ #ifdef\t__cplusplus\\\n\ }\\\n\ #endif", (char*)NULL }; With GNU sed: $ { echo foo ; echo bar ; } | sed '/foo/c\ baz' baz bar But with netbsd sed: $ { echo foo ; echo bar ; } | sed '/foo/c\ baz' bazbar
This isn't the only issue we had with sed c command, see http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01110.html And this is the only spot in fixincl that uses it. Can't it be rewritten with without sed somehow (c_test/c_fix* ?)?
NetBSD PR http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=45955 My analysis of the problem was incorrect and it looks as though a fix would be to put an *unescaped* \n at the end of each -e script: /* * Fix Command Arguments for Solaris_Complex_Cxx */ static const char* apzSolaris_Complex_CxxPatch[] = { sed_cmd_z, "-e", "/#if[ \t]*!defined(__cplusplus)/c\\\n\ #ifdef\t__cplusplus\\\n\ extern \"C\" {\\\n\ -#endif", +#endif\n", "-e", "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c\\\n\ #ifdef\t__cplusplus\\\n\ }\\\n\ -#endif", +#endif\n", (char*)NULL }; POSIX requires that a newline in the replacement text be escaped with \ so an unescaped newline is not part of the replacement text. GNU and Solaris both correctly ignore an unescaped newline at the end of the script, apparently netbsd does too (but I can't test that until later today)
(In reply to comment #4) > netbsd does too (but I can't test that until later today) or rather, it doesn't ignore the newline, but it does produce the expected result
Created attachment 26633 [details] replace 'c' command with 'i' and 'd' this passes the tests on gnu/linux and netbsd
Created attachment 26634 [details] group the i and d functions equivalent, but avoids repeating the context address by grouping the functions in braces also passes all tests on both gnu/linux and netbsd
priority -> minor because it doesn't really matter if a fixinclude for Solaris doesn't work on netbsd, except for causing a test faulre
(In reply to Jonathan Wakely from comment #8) > priority -> minor because it doesn't really matter if a fixinclude for > Solaris doesn't work on netbsd, except for causing a test faulre Except that this issue is also present for solaris pkgsrc developers. +1 for the patch