Re: System/ Compiler specific macros



Robert Gamble wrote:
> vsnadagouda@xxxxxxxxx wrote:
>>
>> For one of my applications I need to know what are all the
>> predefined system/ compiler specific macros are. All these days
>> I used to use "-v" or "-#" as a compiler option to figure out
>> the required information. But recently GCC 3.4.* compilers have
>> stopped throwing out this piece of information.
>>
>> Is there any way I can write a piece of C program (or may be
>> any way) and figure out all the system and compiler specific
>> macros?
>
> This cannot portably be done, why do you think you need to do this?
>
> As far as gcc goes, from the documentation:
>
> "Assuming you have no file foo.h, the command
> touch foo.h; cpp -dM foo.h
> will show all the predefined macros."

The options used will affect that result. For ex. on my system:

[1] c:\c\junk>cpp -dM -W -Wall -ansi -pedantic empty.c
#define __HAVE_BUILTIN_SETJMP__ 1
#define __unix__ 1
#define __i386__ 1
#define __SIZE_TYPE__ long unsigned int
#define __DJGPP 2
#define __USER_LABEL_PREFIX__ _
#define __tune_pentium__ 1
#define __STDC_HOSTED__ 1
#define __MSDOS__ 1
#define DJGPP 2
#define __WCHAR_TYPE__ short unsigned int
#define __DJGPP__ 2
#define __WINT_TYPE__ int
#define __tune_i586__ 1
#define __DJGPP_MINOR__ 3
#define __STRICT_ANSI__ 1
#define __GO32__ 1
#define DJGPP_MINOR 3
#define __STDC__ 1
#define __PTRDIFF_TYPE__ int
#define __DJGPP_MINOR 3
#define __REGISTER_PREFIX__
#define __NO_INLINE__ 1
#define __i386 1
#define __VERSION__ "3.2.1"

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson


.



Relevant Pages

  • Re: [lm-sensors] [PATCH 1/2] Create a DIV_ROUND_CLOSEST macro to do division with rounding
    ... cases where it cases gcc to generate worse code. ... Is it worth generating worse code for these simple macros? ... Perhaps it is only certain compiler versions. ... movzwl %ax, %eax ...
    (Linux-Kernel)
  • Re: Reflections on a classic Lisp Paper
    ... lisp dialects. ... user-defined special forms - Macros, Fexprs, and Nlambda. ... compilable because the compiler just couldn't do it. ...
    (comp.lang.lisp)
  • Re: Cpp Considered Harmful
    ... > However, in either case, assertions are invaluable in making certain ... because we now have our own cpp ... > macros, we can use several different compilers and have our system ... > built into the compiler. ...
    (comp.lang.cpp)
  • Re: Doing mini-languages in CL
    ... > Thats it in a nutshell. ... I think the detail to note is that the Macro facility is a Compiler ... simply put you may well be able to leverage CL macros in building your ...
    (comp.lang.lisp)
  • Re: Why doesnt Lisp automatically differentiate functions and macros?
    ... what stops a Lisp machine from figuring automatically which ... small subset of things macros can do that you are thinking is all they can ... This requires the compiler to know how to do things. ... things that the compiler writer didn't think to, ...
    (comp.lang.lisp)

Loading