[PATCH:xrdb] Call C preprocessor with -P option due to changed behaviour in GCC 4.5

Alan Coopersmith alan.coopersmith at oracle.com
Wed Jan 5 13:39:02 PST 2011


From: Ulrich Mueller <ulm at gentoo.org>

http://bugs.freedesktop.org/show_bug.cgi?id=32701
http://bugs.gentoo.org/show_bug.cgi?id=347758

Signed-off-by: Ulrich Mueller <ulm at gentoo.org>
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---

Rebased Ulrich's patch to apply after asprintfication simplified the changes.

 xrdb.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xrdb.c b/xrdb.c
index 9358bf8..4a40beb 100644
--- a/xrdb.c
+++ b/xrdb.c
@@ -1173,7 +1173,7 @@ Process(int scrno, Bool doScreen, Bool execute)
 	    fprintf(input, "\n#include \"%s\"\n", filename);
 	    fclose(input);
 	    (void) mktemp(tmpname3);
-	    if (asprintf(&cmd, "%s%s %s > %s", cpp_program, includes.val,
+	    if (asprintf(&cmd, "%s -P%s %s > %s", cpp_program, includes.val,
 			 tmpname2, tmpname3) == -1)
 		fatal("%s: Out of memory\n", ProgramName);
 	    if (system(cmd) < 0)
@@ -1188,7 +1188,7 @@ Process(int scrno, Bool doScreen, Bool execute)
 	    fprintf(stdin, "\n#include \"%s\"\n", filename);
 	    fflush(stdin);
 	    fseek(stdin, 0, 0);
-	    if (asprintf(&cmd, "%s%s", cpp_program, includes.val) == -1)
+	    if (asprintf(&cmd, "%s -P%s", cpp_program, includes.val) == -1)
 		fatal("%s: Out of memory\n", ProgramName);
 	    if (!(input = popen(cmd, "r")))
 		fatal("%s: cannot run '%s'\n", ProgramName, cmd);
@@ -1203,7 +1203,7 @@ Process(int scrno, Bool doScreen, Bool execute)
 	if (cpp_program) {
 #ifdef WIN32
 	    (void) mktemp(tmpname3);
-	    if (asprintf(&cmd, "%s%s %s %s > %s", cpp_program,
+	    if (asprintf(&cmd, "%s -P%s %s %s > %s", cpp_program,
 			 includes.val, defines.val,
 			 filename ? filename : "", tmpname3) == -1)
 		fatal("%s: Out of memory\n", ProgramName);
@@ -1213,7 +1213,7 @@ Process(int scrno, Bool doScreen, Bool execute)
 	    if (!(input = fopen(tmpname3, "r")))
 		fatal("%s: can't open file '%s'\n", ProgramName, tmpname3);
 #else
-	    if (asprintf(&cmd, "%s%s %s %s", cpp_program,
+	    if (asprintf(&cmd, "%s -P%s %s %s", cpp_program,
 			 includes.val, defines.val,
 			 filename ? filename : "") == -1)
 		fatal("%s: Out of memory\n", ProgramName);
-- 
1.7.3.2



More information about the xorg-devel mailing list