D Grammar in BNF Text Form?

Tom Browder via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 8 03:48:40 PDT 2014


On Sun, Jun 8, 2014 at 4:11 AM, Jacob Carlborg via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 2014-06-08 10:33, Dicebot wrote:
>
>> AFAIR `gcc- E` output is not a valid C on its own, no wonder libclang
>> chokes on it. Using llvm/clang toolchain with dstep results in much more
>> pleasant experience (not surprisingly as dstep is implemented on top of
>> it)
>
>
> Hmm, it adds a bunch of lines looking like this:
>
> # 1 "foo.c"

I eliminate those lines by passing the '-P' option to gcc.  My actual
command is:

  gcc -E -P -undef -x c infile   > outfile

The "-E" option indicates stop after the pre-processing step.
The "-P" option is for inhibiting generation of line markers ('#' comments).
The "-undef" option is for not pre-defining system-specific or
gcc-specific macros.
The "-x c" option tells gcc the input file is in the C language.
otherwise, the input file suffix is used.

Best,

-Tom


More information about the Digitalmars-d mailing list