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

Chandler Carruth chandlerc at google.com
Tue Dec 1 09:19:28 PST 2009


On Mon, Nov 23, 2009 at 6:12 PM, Rafael Espindola <espindola at google.com> wrote:
> 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

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.
-Chandler

>
> # 114 "<built-in>" 2
>
> after
>
> # 113 "<command line>" 1
>
> Cheers,
> --
> Rafael Ávila de Espíndola
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>




More information about the cfe-commits mailing list