[preprocessor] Popping "" file names
Nathan Sidwell
nathan@acm.org
Fri Aug 30 13:55:00 GMT 2019
On the modules branch, I needed a bunch of tests checking the
interaction of #include nesting and the declarations therein. Doing
this with the current testsuite infrastructure is quite awkward.
Using
# <digits> "name" [12]
directives works just fine, /except/ in the unnesting case. There we
need "name" to match the name of the main file. But we don't know that,
because it's /some/directory/src/gcc/..../mytest.C
Hence this change to the directive. when unnesting, if the given
filename is "", we simply use the filename we already expect to be
popped to.
I've wanted this occasionally in the past, but my current requirements
pushed me to implement this.
1) if the popped-to filename is actually "", the right thing happens
anyway. So existing sources using this form of line control continue to
be accepted.
2) the IS_MAIN_FILE test about mismatches isn't needed -- if we're in
the main file, we'll have a NULL 'from' linemap pointer.
3) We do not document this form of the line control. Only the
standard-mandated '#line' form, and that doesn't permit the trailing
push/pop/system-header flags.
I intend to commit this next week, to allow for comments.
nathan
--
Nathan Sidwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lines.diff
Type: text/x-patch
Size: 2026 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190830/2e4fdc5a/attachment.bin>
More information about the Gcc-patches
mailing list