-
-
Notifications
You must be signed in to change notification settings - Fork 114
Generated prototype for function in tab causes #line directive to have the wrong filename #99
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
Comments
I believe the following happens:
In this case, the last prototype generated is from tab2, but no additional #line directive is generated to "switch back" to the original tab1 file whose contents follow next. A fix for this might be tricky, since by the time prototypes are inserted, arduino-builder does not really know into what file it is inserting (it would need to parse #line directives, which seems somewhat fragile, or carry extra information about line numbers and filenames from the merging step). A related problem (or rather, another problem whose fix might also make this problem easier to fix) is that prototypes are inserted before the first line containing a function (or a function pointer, though that check is rough). However, because we've told ctags to follow #line directives, this line number refers to the line number in the original .ino file, not in the merged source. There is some correction for the A fix for this would be to merge sources, generate prototypes and then instead of inserting them directly, just note the file name and line number of the insertion point. Then merge sources again, inserting the prototypes into the right file and line number in the process. This also makes it trivial to insert a #line directive with the correct filename after the inserted prototypes. |
Signed-off-by: Martino Facchin <[email protected]>
Using Arduino IDE 1.6.8 2016/01/19 08:42 with Windows 7 64bit
tab1.ino:
tab2.ino:
Compiler error:
The error highlight is also on the wrong tab.
C:\Users\per\AppData\Local\Temp\buildc2e11d1cafc78478b2a43bb59a48970a.tmp\sketch\tab1.ino.cpp:
The last
#line
directive should specify the tab1.ino filename.This also can cause the
__FILE__
macro to have the wrong value.Originally reported at: http://forum.arduino.cc/index.php?topic=372882.0
The text was updated successfully, but these errors were encountered: