[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Build failure with GCC 4.2

From: Evan Miller
Subject: Build failure with GCC 4.2
Date: Mon, 7 Nov 2022 09:20:58 -0500


I am a contributor to the MacPorts package manager, with a special interest in 
legacy system support. Our preferred compiler on Mac OS X 10.4 and 10.5 is GCC 
4.2 – but I noticed that the latest release of sed cannot be compiled with GCC 
4.2, as it does not allow pragma directives inside of functions.

If it's not too much trouble, I suggest the patch below, which allows sed 4.9 
to be built successfully with all of our supported compilers.

Thank you so much.

Evan Miller

--- sed/compile.c.orig  2022-11-07 08:51:51.000000000 -0500
+++ sed/compile.c   2022-11-07 08:52:18.000000000 -0500
@@ -198,17 +198,17 @@
 static struct output *file_write = NULL;

 /* Complain about an unknown command and exit. */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
 static void
 bad_command (char ch)
   const char *msg = _(UNKNOWN_CMD);
   char *unknown_cmd = xmalloc (strlen (msg));
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
   sprintf (unknown_cmd, msg, ch);
-#pragma GCC diagnostic pop
   bad_prog (unknown_cmd);
+#pragma GCC diagnostic pop

 /* Complain about a programming error and exit. */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]