"no input files" error when specifying language?

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 like this:

  cpp -x assembler-with-cpp 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?

Thanks!

Rick Mann via cfe-dev <cfe-dev@lists.llvm.org> writes:

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 like this:

  cpp -x assembler-with-cpp 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?

Does it work if you invoke `clang -E` instead of `cpp`? ie,

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