http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52168

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-09 
12:19:38 UTC ---
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)

Reply via email to