Summary: | fixinclude test failure for complex.h on netbsd | ||
---|---|---|---|
Product: | gcc | Reporter: | Jonathan Wakely <redi> |
Component: | other | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | NEW --- | ||
Severity: | normal | CC: | jakub, korbb |
Priority: | P3 | ||
Version: | 4.7.0 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2014-11-16 00:00:00 | |
Attachments: |
replace 'c' command with 'i' and 'd'
group the i and d functions |
Description
Jonathan Wakely
2012-02-08 09:28:59 UTC
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 |