[cfe-commits] [patch][preprocessor] Remember to exit <command line>

Rafael Espindola espindola at google.com
Mon Nov 23 18:12:02 PST 2009


This is an updated version of an old patch.

clang's preprocessor output for
-------------------------------------------
int main(int argc, char*argv[]) {
  return 0;
}
------------------------------------------
is
------------------------------------------
# 1 "test.c"
# 1 "test.c" 1
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 113 "<built-in>" 3
# 113 "<command line>" 1
# 1 "test.c" 2
int main(int argc, char*argv[]) {
  return 0;
}
-----------------------------------

Compiling this with gcc produces the warning 'line-map.c: file
"test.c" left but not entered'.  The wording is a bit confusing, but
it looks like what gcc is complaining about is that we have the
transitions

test.c -> <built-in> -> <command line> -> test.c

Adding a <command line> -> <built-in> transition avoids the warning.
This is done with the line

# 114 "<built-in>" 2

after

# 113 "<command line>" 1

Cheers,
-- 
Rafael Ávila de Espíndola
-------------- next part --------------
A non-text attachment was scrubbed...
Name: built-in.patch
Type: text/x-diff
Size: 678 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20091123/f5e02b53/attachment.patch>


More information about the cfe-commits mailing list