[C2hs] more problems with c2hs

Ruben Zilibowitz rubenz at cse.unsw.edu.au
Thu Apr 12 22:42:56 EDT 2007

I tried all the cpp commands you gave me with -x c instead of -x -c  
and none of them worked except for the one which had no -x c. It  
seems like a bug with cpp on Mac OS X. The man page also has the bit  
you quoted on my system too.

Might ask about it on one of the apple mailing lists.


On 13/04/2007, at 12:01 PM, Duncan Coutts wrote:

> 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