http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57881

            Bug ID: 57881
           Summary: Pre-processor pre-includes breaks preprocessing of non
                    C/C++ code
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bardeau at iram dot fr

According to http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Standards.html the C
pre-precessor includes implicitly the file /usr/include/stdc-predef.h to any
pre-processed source.

For non C/C++ code, we are told here http://gcc.gnu.org/gcc-4.8/porting_to.html
to add the option -P. This just won't work in real use cases. People using the
C preprocessor on non C/C++ code combine the following options:
-P: no line markers added,
-C: do not discard comments. In non-C/C++ code, false-positive blocks of /* */
could be deleted out.
-traditional-cpp: preserve blank lines. In non C/C++ code, blank lines may be
relevant. At least, it preserves line numbering.

Obviously, pre-preprocessing of non-C/C++ code with "cpp -P -C -traditional"
adds now C comments and blank lines. Its certainly a feature, not a bug, but:

1) you should modify the comment in http://gcc.gnu.org/gcc-4.8/porting_to.html:
"For non C/C++ code, use the pre-processor flag -ffreestanding" for full
compatibility with possible options.

2) the option "-ffreestanding" has no meaning for non C/C++ code. You should
consider adding an option for preprocessing of non C/C++ sources, which gathers
the options "-P -C -traditional -ffreestanding", plus any future change needed.

Thanks for having a look into this!

Reply via email to