Bug 259781 - [Internal Builder] Quotes removed when defining a string
Summary: [Internal Builder] Quotes removed when defining a string
Status: ASSIGNED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build-managed (show other bugs)
Version: 5.0.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: cdt-build-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-30 04:40 EST by Jonas Flodén CLA
Modified: 2020-09-04 15:20 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonas Flodén CLA 2008-12-30 04:40:18 EST
Build ID: M20080911-1700

Steps To Reproduce:
When defining a string under C/C++ Build->Settings->Symbols in the form:
MESSAGE="\"Hello World\""
it works when using the External Builder but with the Internal Builder all the quotes are removed which results in syntax errors:

**** Internal Builder is used for build               ****
gcc -DMESSAGE=\Hello World\ -O0 -g3 -Wall -c -fmessage-length=0 -osrc/hello-linux.o ../src/hello-linux.c
gcc: World\: No such file or directory
../src/hello-linux.c: In function ‘main’:
../src/hello-linux.c:15: error: stray ‘\’ in program
../src/hello-linux.c:15: error: ‘Hello’ undeclared (first use in this function)
../src/hello-linux.c:15: error: (Each undeclared identifier is reported only once
../src/hello-linux.c:15: error: for each function it appears in.)
Build error occurred, build is stopped
Time consumed: 218  ms.  

It seems the internal builder removes all quotes?
The same escaping can be used from the commandline successfully.

More information:
Comment 1 Jonas Flodén CLA 2008-12-30 04:44:47 EST
The same command when using the External builder:
gcc -DMESSAGE="\"Hello World\"" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/hello-linux.d" -MT"src/hello-linux.d" -o"src/hello-linux.o" "../src/hello-linux.c"

A lot more quotes in there...
Comment 2 Dmitry Kozlov CLA 2009-04-02 04:27:46 EDT
This bug is related with two other existing bugs: 186069 and 236227. 
I think this patch to 186069 will help.
https://bugs.eclipse.org/bugs/attachment.cgi?id=130657
Comment 3 Vladimir Prus CLA 2009-06-17 06:15:44 EDT
In CDT6.0RC2, the command line looks like:

g++ -DFOO=bar biz 

with no attempt at quoting. Anyway, this is essentially the same issue as
https://bugs.eclipse.org/bugs/show_bug.cgi?id=186069
Can somebody close this one as duplicate?