On Tue, Dec 1, 2009 at 9:43 AM, Rafael Espindola <[email protected]> wrote: >> Perhaps its just my ignorance of how preprocessors work, but I don't >> see why this is needed. GCC doesn't introduce such a line: >> >> % gcc -E test.c >> # 1 "test.c" >> # 1 "<built-in>" >> # 1 "<command-line>" >> # 1 "test.c" >> int main(int argc, char *argv[]) { >> return 0; >> } >> >> It's entirely likely I just don't understand the directives being >> produced here, as there are other differences. > > The difference is how gcc changes from one "file" to another. Note > that it never prints a number after the file name. According to > libcpp/directives.c:do_linemarker that gets mapped to > "LC_RENAME_VERBATIM" which, if I understand correctly, doesn't affect > the stack of files being processed. > > If a number is present, they have the following meaning: 1 in > LC_ENTER, 2 is LC_LEAVE and everything else is also > LC_RENAME_VERBATIM. > > So, from the gcc output everything is a LC_RENAME_VERBATIM. OK. > From the current clang output we have > > # 1 "test.c" LC_RENAME_VERBATIM > # 1 "test.c" 1 LC_ENTER > # 1 "<built-in>" 1 LC_ENTER > # 1 "<built-in>" 3 LC_RENAME_VERBATIM > # 113 "<built-in>" 3 LC_RENAME_VERBATIM > # 113 "<command line>" 1 LC_ENTER > # 1 "test.c" 2 LC_LEAVE > > > Notice that we leave from "<command line>" into "test.c" without > passing by "<built-in>" that we passed on the way in.
And now I am properly educated! =D LGTM. Maybe a comment that this is closing the command line section? "1" and "2" are far less clear that LC_ENTER and LC_LEAVE. -Chandler > >> -Chandler >> > > Cheers, > -- > Rafael Ávila de Espíndola > _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
