[git commit] wrapper: Fix handling arguments with spaces

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Sat Apr 6 08:46:19 UTC 2019


commit: https://git.uclibc.org/uClibc++/commit/?id=a52285d2f1084e85f5eac7053f5cfd35c39d6834
branch: https://git.uclibc.org/uClibc++/commit/?id=refs/heads/master

g++-uc -DFOO="BAR BAZ" was not working properly.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 ChangeLog       |  1 +
 bin/Makefile.in | 20 +++++++-------------
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 35934ff..16c42ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 0.2.5
+-   wrapper: Fix handling arguments with spaces
 -   stream: Add support for 64-bit integers
 -   buildsys: allow to pass in LDFLAGS
 -   __base_associative: fix erase(iter,iter), e.g. multimap
diff --git a/bin/Makefile.in b/bin/Makefile.in
index 8d11316..9ea2f06 100644
--- a/bin/Makefile.in
+++ b/bin/Makefile.in
@@ -32,26 +32,20 @@ define do_wrapper
 	$(Q)echo 'WRAPPER_LIBS="$(strip $(LIBS))"' >> $@.tmp
 	$(Q)echo '' >> $@.tmp
 	$(Q)echo 'WRAPPER_INCLIB="Y"' >> $@.tmp
-	$(Q)echo 'while [ -n "$$1" ]' >> $@.tmp
+	$(Q)echo 'for arg' >> $@.tmp
 	$(Q)echo 'do' >> $@.tmp
-	$(Q)echo '	WRAPPER_OPTIONS="$$WRAPPER_OPTIONS $$1"' >> $@.tmp
-	$(Q)echo '	if [ "$$1" = "-c" -o "$$1" = "-E" -o "$$1" = "-S" ]' >> $@.tmp
-	$(Q)echo '	then' >> $@.tmp
-	$(Q)echo '		WRAPPER_INCLIB="N"' >> $@.tmp
-	$(Q)echo '	fi' >> $@.tmp
-	$(Q)echo '	if [ "$$1" = "-static" -a "$$WRAPPER_LIBS" != "$(strip $(STATIC_LIBS))" ]' >> $@.tmp
-	$(Q)echo '	then' >> $@.tmp
-	$(Q)echo '		WRAPPER_LIBS="$(strip $(STATIC_LIBS))"' >> $@.tmp
-	$(Q)echo '	fi' >> $@.tmp
-	$(Q)echo '	shift' >> $@.tmp
+	$(Q)echo '	case "$$arg" in' >> $@.tmp
+	$(Q)echo '	-c|-E|-S) WRAPPER_INCLIB="N" ;;' >> $@.tmp
+	$(Q)echo '	-static) [ "$$WRAPPER_LIBS" != "$(strip $(STATIC_LIBS))" ] && WRAPPER_LIBS="$(strip $(STATIC_LIBS))" ;;' >> $@.tmp
+	$(Q)echo '	esac' >> $@.tmp
 	$(Q)echo 'done' >> $@.tmp
 	$(Q)echo 'if [ "$$WRAPPER_INCLIB" = "Y" ]' >> $@.tmp
 	$(Q)echo 'then' >> $@.tmp
 	$(Q)echo '	WRAPPER_OPTIONS="$$WRAPPER_OPTIONS -nodefaultlibs $$WRAPPER_LIBDIR -l$(LNAME) $$WRAPPER_LIBS"' >> $@.tmp
 	$(Q)echo 'fi' >> $@.tmp
 	$(Q)echo '' >> $@.tmp
-	$(Q)echo '[ -n "$$V" ] && [ $$V -gt 1 ] && echo $(CXX) $(GEN_CFLAGS) $(GEN_CXXFLAGS) $(EH_CXXFLAGS) $$WRAPPER_INCLUDEDIR $$WRAPPER_OPTIONS' >> $@.tmp
-	$(Q)echo 'exec $(CXX) $(GEN_CFLAGS) $(GEN_CXXFLAGS) $(EH_CXXFLAGS) $$WRAPPER_INCLUDEDIR $$WRAPPER_OPTIONS' >> $@.tmp
+	$(Q)echo '[ -n "$$V" ] && [ $$V -gt 1 ] && echo $(CXX) $(GEN_CFLAGS) $(GEN_CXXFLAGS) $(EH_CXXFLAGS) $$WRAPPER_INCLUDEDIR "$$@" $$WRAPPER_OPTIONS' >> $@.tmp
+	$(Q)echo 'exec $(CXX) $(GEN_CFLAGS) $(GEN_CXXFLAGS) $(EH_CXXFLAGS) $$WRAPPER_INCLUDEDIR "$$@" $$WRAPPER_OPTIONS' >> $@.tmp
 	$(Q)echo '' >> $@.tmp
 	$(Q)chmod 0755 $@.tmp
 	$(Q)mv $@.tmp $@


More information about the uClibc-cvs mailing list