[binutils-gdb] Allow spaces in the name of the external preprocessor used by windres.

Nick Clifton nickc@sourceware.org
Fri Nov 27 14:20:02 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=21c33bcbe36377abf01614fb1b9be439a3b6de20

commit 21c33bcbe36377abf01614fb1b9be439a3b6de20
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Nov 27 14:18:20 2020 +0000

    Allow spaces in the name of the external preprocessor used by windres.
    
            PR 26865
            * windres.c (main): If the preprocessor name includes spaces,
            ensure that it is quoted.

Diff:
---
 binutils/ChangeLog | 6 ++++++
 binutils/windres.c | 8 +++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 212fd643762..fbd14f19e15 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2020-11-27  Nick Clifton  <nickc@redhat.com>
+
+	PR 26865
+	* windres.c (main): If the preprocessor name includes spaces,
+	ensure that it is quoted.
+
 2020-11-27  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
 
 	* testsuite/lib/binutils-common.exp (supports_noinit_section): New.
diff --git a/binutils/windres.c b/binutils/windres.c
index 5c83dab8fc0..df3e01fd941 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -885,7 +885,13 @@ main (int argc, char **argv)
 	  break;
 
 	case OPTION_PREPROCESSOR:
-	  preprocessor = optarg;
+	  if (strchr (optarg, ' '))
+	    {
+	      if (asprintf (& preprocessor, "\"%s\"", optarg) == -1)
+		preprocessor = optarg;
+	    }
+	  else
+	    preprocessor = optarg;	    
 	  break;
 
 	case OPTION_PREPROCESSOR_ARG:


More information about the Binutils-cvs mailing list