what macros are generated by Mingw?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

what macros are generated by Mingw?

Oleksiy Ch
Hello,

I have a script that tests basic compiler parameters like name, version, standards compliance. I use a simple header file with #ifdef statements.

>From the table at http://sourceforge.net/p/predef/wiki/Compilers/
there is only one macro '__MINGW32__' generated by Mingw that identifies it. Other version descrption macros are included from headers "<stdlib.h>, <stdio.h>, <windows.h>, <windef.h>, and probably more".

Question. Are there version description macros generated by Mingw compiler itself, as other compilers do, without the need to include any headers? And what are other compiler description macros generated by Mingw?

I'm not aware about the reason of including compiler related macros into system headers that have no relation to a compiler itself, as far as I know. I think it may cause problems of identifying the compiler in situation when I want to use different C library and/or don't want to include headers for some reason. If, for example, I want to link with uClibc, I pass '-I/my_home/uClibc/include', Mingw loads different headers that has no '__MINGW32_MAJOR_VERSION' and '__MINGW32_MINOR_VERSION' macros.

Thanks.
Oleksiy

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: what macros are generated by Mingw?

John Brown

On Tue, 14 Jul 2015 21:40:08 -0700, Oleksiy Ch wrote:
>
> Hello,
>
...
> Question. Are there version description macros generated by Mingw compiler
> itself, as other compilers do, without the need to include any headers? And
> what are other compiler description macros generated by Mingw?
>
> Oleksiy
>

The command:
 $ gcc -dM -E - < /dev/null
will show all built-in macros. See the discussion at
http://stackoverflow.com/questions/2224334/gcc-dump-preprocessor-defines

Regards,
John Brown.


     
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: what macros are generated by Mingw?

Oleksiy Ch
Thanks, I know that cmd and read that thread before.

Since Mingw is a customized version of GCC will it be correct to check it's version with macros
__GNUC__
__GNUC_MINOR__
__GNUC_PATCHLEVEL__
__GNUC_VERSION__

?

Is it correct to say that Mingw is not just a compiler but a toolchain?

Thanks

--------------------------------------------
On Wed, 7/15/15, John Brown <[hidden email]> wrote:

 Subject: Re: [Mingw-users] what macros are generated by Mingw?
 To: "MinGW Users List" <[hidden email]>
 Date: Wednesday, July 15, 2015, 9:36 AM
 
 
 On Tue,
 14 Jul 2015 21:40:08 -0700, Oleksiy Ch wrote:
 >
 > Hello,
 >
 ...
 >
 Question. Are there version description macros generated by
 Mingw compiler
 > itself, as other
 compilers do, without the need to include any headers?
 And
 > what are other compiler description
 macros generated by Mingw?
 >
 > Oleksiy
 >
 
 The command:
  $ gcc -dM -E - < /dev/null
 will show all built-in macros. See the
 discussion at
 http://stackoverflow.com/questions/2224334/gcc-dump-preprocessor-defines
 
 Regards,
 John
 Brown.
 
 
     
                      
 ------------------------------------------------------------------------------
 Don't Limit Your Business. Reach for the
 Cloud.
 GigeNET's Cloud Solutions provide
 you with the tools and support that
 you need
 to offload your IT needs and focus on growing your
 business.
 Configured For All Businesses.
 Start Your Cloud Today.
 https://www.gigenetcloud.com/
 _______________________________________________
 MinGW-users mailing list
 [hidden email]
 
 This list observes the
 Etiquette found at
 http://www.mingw.org/Mailing_Lists.
 We ask that you be polite and do the same. 
 Disregard for the list etiquette may cause your account to
 be moderated.
 
 _______________________________________________
 You may change your MinGW Account Options or
 unsubscribe at:
 https://lists.sourceforge.net/lists/listinfo/mingw-users
 Also: mailto:[hidden email]?subject=unsubscribe

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: what macros are generated by Mingw?

Gisle Vanem-2
In reply to this post by John Brown
John Brown wrote:

> The command:
>   $ gcc -dM -E - < /dev/null
> will show all built-in macros.

If one tries something similar with TDM-gcc (the multi-lib version
of MingW), note the difference in 32-bit vs. 64-bit mode.
Especially in C++11, the lists of built-in are long and messy:

   g++ -m32 -dM -E -x c++ -std=c++11 - < NUL | sort > opt32
   g++ -m64 -dM -E -x c++ -std=c++11 - < NUL | sort > opt64

Note the difference in size of math-types. E.g.
   '__SIZEOF_LONG_DOUBLE__' 12 vs 16 bytes.


--
--gv

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: what macros are generated by Mingw?

Oleksiy Ch
Thanks.

--------------------------------------------
On Wed, 7/15/15, Gisle Vanem <[hidden email]> wrote:

 Subject: Re: [Mingw-users] what macros are generated by Mingw?
 To: "MinGW Users List" <[hidden email]>
 Date: Wednesday, July 15, 2015, 1:28 PM
 
 John Brown wrote:
 
 > The command:
 >   $ gcc -dM -E - <
 /dev/null
 > will show all built-in
 macros.
 
 If one tries
 something similar with TDM-gcc (the multi-lib version
 of MingW), note the difference in 32-bit vs.
 64-bit mode.
 Especially in C++11, the lists
 of built-in are long and messy:
 
    g++ -m32 -dM -E -x c++ -std=c++11
 - < NUL | sort > opt32
    g++ -m64 -dM -E -x c++ -std=c++11
 - < NUL | sort > opt64
 
 Note the difference in size of math-types.
 E.g.
    '__SIZEOF_LONG_DOUBLE__'
 12 vs 16 bytes.
 
 
 --
 --gv
 
 ------------------------------------------------------------------------------
 Don't Limit Your Business. Reach for the
 Cloud.
 GigeNET's Cloud Solutions provide
 you with the tools and support that
 you need
 to offload your IT needs and focus on growing your
 business.
 Configured For All Businesses.
 Start Your Cloud Today.
 https://www.gigenetcloud.com/
 _______________________________________________
 MinGW-users mailing list
 [hidden email]
 
 This list observes the
 Etiquette found at
 http://www.mingw.org/Mailing_Lists.
 We ask that you be polite and do the same. 
 Disregard for the list etiquette may cause your account to
 be moderated.
 
 _______________________________________________
 You may change your MinGW Account Options or
 unsubscribe at:
 https://lists.sourceforge.net/lists/listinfo/mingw-users
 Also: mailto:[hidden email]?subject=unsubscribe
 

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: what macros are generated by Mingw?

Keith Marshall-3
In reply to this post by Gisle Vanem-2
On 15/07/15 11:28, Gisle Vanem wrote:
> If one tries something similar with TDM-gcc (the multi-lib version
> of MingW) ...

Please don't call TDM-gcc a "version of MinGW".  John E., of Twilight
Dragon Media, has always been completely open and honest about this:
TDM-gcc is an alternative port of GCC to MS-Windows, but it is neither
MinGW, nor even compatible with current MinGW.

--
Regards,
Keith.

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe