This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug testsuite/48402] autogen fixincludes in GCC 4.6.0 testsuite fails on OS X 10.6.7
- From: "jeru.sheng at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 3 Aug 2011 09:43:10 +0000
- Subject: [Bug testsuite/48402] autogen fixincludes in GCC 4.6.0 testsuite fails on OS X 10.6.7
- Auto-submitted: auto-generated
- References: <bug-48402-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48402
Cheng Sheng <jeru.sheng at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jeru.sheng at gmail dot com
--- Comment #1 from Cheng Sheng <jeru.sheng at gmail dot com> 2011-08-03 09:43:08 UTC ---
I encountered this problem as well in gcc-4.6.1, on Mac OS X 10.7. After some
checking, I found that the source of this error is that "sed" in Linux is
slightly different from "sed" in the POSIX spec (see
http://pubs.opengroup.org/onlinepubs/009695399/utilities/sed.html).
In Linux, the c-command of "sed" can be followed by the text directly, while in
the spec, the c-command should be followed immediately by a backslash, then a
newline, then the text. Therefore, one hack instruction in
gcc-4.6.0/fixinclude/inclhack.def doesn't work:
*****************************************
***** Part of "inclhack.def" Begins *****
*****************************************
/*
* Solaris 10+ <complex.h> is wrapped in #ifndef __cplusplus. Wrap in
* extern "C" instead so libstdc++ can use it.
*/
fix = {
hackname = solaris_complex_cxx;
mach = "*-*-solaris2.*";
files = complex.h;
sed = "/#if[ \t]*!defined(__cplusplus)/c"
"#ifdef\t__cplusplus\\\nextern \"C\" {\\\n#endif";
sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c"
"#ifdef\t__cplusplus\\\n}\\\n#endif";
test_text = "#if !defined(__cplusplus)\n"
"#endif /* !defined(__cplusplus) */";
};
***************************************
***** Part of "inclhack.def" Ends *****
***************************************
A fix would be to replace the "/c" commands of the two "sed"s to "/c\\\n",
i.e.:
--- inclhack.def.bak 2011-08-03 17:40:44.000000000 +0800
+++ inclhack.def 2011-08-03 17:40:52.000000000 +0800
@@ -3315,9 +3315,9 @@
hackname = solaris_complex_cxx;
mach = "*-*-solaris2.*";
files = complex.h;
- sed = "/#if[ \t]*!defined(__cplusplus)/c"
+ sed = "/#if[ \t]*!defined(__cplusplus)/c\\\n"
"#ifdef\t__cplusplus\\\nextern \"C\" {\\\n#endif";
- sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c"
+ sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c\\\n"
"#ifdef\t__cplusplus\\\n}\\\n#endif";
test_text = "#if !defined(__cplusplus)\n"
"#endif /* !defined(__cplusplus) */";