User forums > Using Code::Blocks
Arduino - incorrect parsing
zdena:
--- Quote from: stahta01 on June 12, 2019, 03:42:19 pm ---4. Write a small program the prepends the #line to the start of each temp file created by arduino-builder.
--- End quote ---
Good hint. And even no program needed. Just to put the #line directive at the begin of each project source file. For example:
--- Code: ---#line 2 "D:\\KomplexCB\\_Vysilani_100\\Komplex00\\Adafruit_HDC1000.cpp"
--- End code ---
And it works 8) But with complete absolute path only. :(
I wanted to use builtin variable:
--- Code: ---#line 2 "$(PROJECT_DIR)Adafruit_HDC1000.cpp"
--- End code ---
or somehow to make it universal but it doesn't work.
Is it possible to do it? Or the prepocessor doesn't accept C::B variables?
For completeness: If I use
--- Code: ---#line 2 __FILE__
--- End code ---
it refers to the temp again
--- Code: ---C:\Users\zdena\AppData\Local\Temp\Komplex00\build\sketch\Adafruit_HDC1000.cpp
--- End code ---
BlueHazzard:
Variable expansion does not happen in the code, only in command lines....
If you are hardcore you could probably create a squirrel pre build step http://wiki.codeblocks.org/index.php/Scripting_commands
In the attached archive you will find an example project:
Basically it replaces all occurrences of
--- Code: ---#line $(CURRENTFILENAME)
--- End code ---
to
--- Code: ---#line 1 CURRENT_ABSOLUTE_FILENAME
--- End code ---
the problem is, this is a onetime shot... It literally replaces the line, so it wont work a second time.
It would probably be possible to create a script that creates temporary files and copy it to somewhere, but this is really out of scope...
The easiest thing would be to modify the arduino builder... i mean, they make the bullshit by copying files around...
oBFusCATed:
zdena: Sorry but you're solving the wrong problem. Fixing it in arduino-builder would be the most robust and probably easiest solution. Have you talked to arduino devs?
zdena:
oBFusCATed: You are right. I was afraid to come in the next community and to find how to report an issue, but I agree it will be the most proper way to push the modification of arduino-builder. As also BlueHazzard suggests.
I found just now that the arduino-builder already puts the line with #line direction with absolute path at the beginning of file before copying it to the temporary. But only into the .ino file. So It should be enough to do the same with all source files. If I think correct.
So for sure I will check the behavior of the last arduino-builder versions (including nightlies) and then I ask the developers.
Thank you all for your patience for now.
zdena:
So, my fabulous friend created issue for the matter, then analysed the sources of the arduino-builder, created pull request for change and finally wrote the patch.
If we are lucky the patch will go to the master branch in this century.
Meanwhile, anybody can build the patched arduino-builder from https://github.com/arduino/arduino-builder/pull/325. It really works. :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version