[C2hs] more problems with c2hs

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu Apr 12 22:01:56 EDT 2007


On Fri, 2007-04-13 at 11:09 +1000, Ruben Zilibowitz wrote:
> All these seemed to work except for 2. In the c2hs output it says:
> cpp -x c ...
> not:
> cpp -x -c ...
> I think that might be a key issue.

Doh! That was my mistake. :-) It really should be "-x c" not "-x -c".
The latter means something totally different :-)

Sorry, could you try again with my mistake corrected.

Here's an excerpt from the cpp man page on my system:

        -x c
        -x c++
        -x objective-c
        -x assembler-with-cpp
                Specify the source language: C, C++, Objective-C, or
                assembly. This has nothing to do with standards
                conformance or extensions; it merely selects which base
                syntax to expect.  If you give none of these options,
                cpp will deduce the language from the extension of the
                source file: .c, .cc, .m, or .S.  Some other common
                extensions for C++ and assembly are also recognized.  If
                cpp does not recognize the extension, it will treat the
                file as C; this is the most generic mode.

I thought this -x c feature was portable, where as relying on cpp to
default to C mode for a .h file seems much less so. Perhaps we should
just spit out a .c file instead of a .h file. It wouldn't make much
difference to c2hs as far as I can see.

Duncan



More information about the C2hs mailing list