Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double escape defines in gnuarmeclipse export #4636

Merged
merged 1 commit into from
Jul 7, 2017

Conversation

theotherjimmy
Copy link
Contributor

Fixes a bug where quoting gets stripped by the shell used in the makefile
and another bug where the lack of escaping would cause parser errors in
eclipse.

Resolves #4622

@JojoS62
Copy link
Contributor

JojoS62 commented Jun 26, 2017

#4637

@JojoS62
Copy link
Contributor

JojoS62 commented Jun 26, 2017

this fix works, but it leaves backslashes that can be removed?

grafik

@theotherjimmy
Copy link
Contributor Author

theotherjimmy commented Jun 26, 2017 via email

@theotherjimmy
Copy link
Contributor Author

Oh joy. A travis bug on master.

@theotherjimmy
Copy link
Contributor Author

theotherjimmy commented Jun 26, 2017

@JojoS62 Let me explain why those extra escapes are required. First, we are using this define in place of an include file. We cannot quote the argument to #include as it will not expand the macro in that instance. Instead, we are left with adding the quotes to the macro. Next, we have to pass this quoted value with the quotes to the compiler on the command line. This reqires a

str.replace("\"", "\\\"")

Which will prevent the shell from expanding the quotes itself. Now we need to pass that value, backslashes, quotes and all, to eclipse. That is done by escaping the value for HTML, a function built into Jinja2.

TL;DR: backslashes are needed to build correctly.

@theotherjimmy theotherjimmy changed the title Double escape defines Double escape defines in gnuarmeclipse export Jun 26, 2017
@JojoS62
Copy link
Contributor

JojoS62 commented Jun 26, 2017

thanks, and you're right, without backslashes the compiler complains.

@JojoS62
Copy link
Contributor

JojoS62 commented Jun 27, 2017

just one more thing for my curiosity:
I've checked it also in SW4STM32 and there the leading backslashes are not necessary. The reason should be the different ways how the different build systems work.
As a side effect, the eclipse C++ indexer gets confused by the backslahes in the macro value. It compiles, but wouldn't it be a cleaner solution when the gnuarmeclipse plugin modifies the symbol value as needed? @ilg : what do you think?

@theotherjimmy
Copy link
Contributor Author

@JojoS62 I agree that It would be cleaner to not escape the macro for the makefile under eclipse.

@theotherjimmy
Copy link
Contributor Author

/morph export-build

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph export-build

Output

mbed Build Number: 75

Exporter Build failed!

@theotherjimmy
Copy link
Contributor Author

sigh these errors are probably on master...

Fixes a bug where quoting gets stripped by the shell used in the makefile
and another bug where the lack of escaping would cause parser errors in
eclipse.
@theotherjimmy
Copy link
Contributor Author

/morph export-build

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph export-build

Output

mbed Build Number: 76

Exporter Build failed!

@studavekar
Copy link
Contributor

/morph export-build

@mbed-bot
Copy link

mbed-bot commented Jul 3, 2017

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph export-build

Output

mbed Build Number: 78

Exporter Build failed!

@studavekar
Copy link
Contributor

/morph export-build

@mbed-bot
Copy link

mbed-bot commented Jul 5, 2017

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph export-build

Output

mbed Build Number: 82

All exports and builds passed!

@theotherjimmy
Copy link
Contributor Author

Wohooo!

LGTM!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants