"no input files" error when specifying language?

EDIT: I forgot to add: the same thing happens if I specify -o <outputfilename>.

In the ARM Linux development world, it's common to use gcc to pre-process "Device Tree" files to take advantage of #include and #define directives. Unfortunately, the DT syntax also includes the use of the '#', so they specify -x assembler-with-cpp, and it processes nicely. The typical invocation (with gcc) looks like this:

cpp -Wp,-MD,src/arm/.am335x-arduino-tre.dtb.d.pre.tmp -nostdinc -Iinclude -Isrc/arm -Itestcase-data -undef -D__DTS__ -x assembler-with-cpp -o src/arm/.am335x-arduino-tre.dtb.dts.tmp src/arm/am335x-arduino-tre.dts

A simplified invocation is:

  cpp -x assembler-with-cpp -o FILE.temp.dts FILE.dts

clang doesn't like this. It's okay with this:

  cpp FILE.dts

But of course it complains about the invalid preprocessing directive it finds (e.g. "#address-cells = <1>;"). The cure for this is "-x assembler-with-cpp", but if I invoke it with either option above:

  cpp -x assembler-with-cpp FILE.dts
  cpp -o FILE.temp.dts FILE.dts

It says "clang: error: no input files". If I place the filename FILE.dts before any of the options, they don't get applied to that file.

The clang I'm trying this with is:

$ clang --version
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

Is there any way to do what I want to do here?


Not sure what the apple version does but I tried it on my cubox and this appears to work

clang -E -x assembler-with-cpp src/arm/am335x-boneblack.dts -Iinclude -Isrc

Cubox has clang 3.6.2.

Beaglebone has 3.7 so would expect to work there as well.

Comparing with gcc 5.2 and the output is not the same but comparable with no invalid preprocessing directive errors.