
Why don't we have single BOOST_GCC macro which defines version of gcc compiler. In numerous places around boost we need to check for specific versions on gcc and required to use complex expressions involving up to 3 gcc variables. Gennadiy

"Gennadiy Rozental" <gennadiy.rozental@thomson.com> writes:
Why don't we have single BOOST_GCC macro which defines version of gcc compiler. In numerous places around boost we need to check for specific versions on gcc and required to use complex expressions involving up to 3 gcc variables.
Because nobody has introduced it. The usual answer applies: since you care enough to ask, maybe you should just go ahead and do it. It's a good idea that's been discussed before. -- Dave Abrahams Boost Consulting www.boost-consulting.com

"David Abrahams" <dave@boost-consulting.com> wrote in message news:ud5t18xf2.fsf@boost-consulting.com...
"Gennadiy Rozental" <gennadiy.rozental@thomson.com> writes:
Why don't we have single BOOST_GCC macro which defines version of gcc compiler. In numerous places around boost we need to check for specific versions on gcc and required to use complex expressions involving up to 3 gcc variables.
Because nobody has introduced it. The usual answer applies: since you care enough to ask, maybe you should just go ahead and do it. It's a good idea that's been discussed before.
I did not find this discussion. I added following into gcc.hpp: #if __GNUC__ < 3 # define BOOST_GCC BOOST_JOIN(__GNUC__,__GNUC_MINOR__) #else # define BOOST_GCC BOOST_JOIN( BOOST_JOIN(__GNUC__,__GNUC_MINOR__),__GNUC_PATCHLEVEL__) #endif This should work until second or third component is < 10. Also appropriate print added into confg_info. Anybody mind? Gennadiy

#if __GNUC__ < 3 # define BOOST_GCC BOOST_JOIN(__GNUC__,__GNUC_MINOR__) #else # define BOOST_GCC BOOST_JOIN( BOOST_JOIN(__GNUC__,__GNUC_MINOR__),__GNUC_PATCHLEVEL__) #endif
This should work until second or third component is < 10.
What about gcc-2.95 ?
Also appropriate print added into confg_info.
Anybody mind?
I think I would have preferred a more consistent numbering system - a bit like BOOST_VERSION maybe: #define BOOST_GCC (__GNUC__*10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) Of course even that can in theory go wrong, but it does make checks easier to read (because of greater consistency between gcc 2 and 3): #if BOOST_WORKAROUND(BOOST_GCC, <= 29500) #else BOOST_WORKAROUND(BOOST_GCC <= 30400) // etc.... Any other thoughts? John.

"John Maddock" <john@johnmaddock.co.uk> wrote in message news:015c01c53f47$af97b470$b3560252@fuji...
#if __GNUC__ < 3 # define BOOST_GCC BOOST_JOIN(__GNUC__,__GNUC_MINOR__) #else # define BOOST_GCC BOOST_JOIN( BOOST_JOIN(__GNUC__,__GNUC_MINOR__),__GNUC_PATCHLEVEL__) #endif
This should work until second or third component is < 10.
What about gcc-2.95 ?
As above suggest it would produce 295
Also appropriate print added into confg_info.
Anybody mind?
I think I would have preferred a more consistent numbering system - a bit like BOOST_VERSION maybe:
#define BOOST_GCC (__GNUC__*10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
Look reasonable
Of course even that can in theory go wrong, but it does make checks easier to read (because of greater consistency between gcc 2 and 3):
#if BOOST_WORKAROUND(BOOST_GCC, <= 29500) #else BOOST_WORKAROUND(BOOST_GCC <= 30400) // etc....
Any other thoughts?
Do you want me to check this in?
John.
Gennadiy P.S. While we are at it shouldn't we make sure we have single recognizable macro for each compiler we support (using above convention or the natural one supplied by compiler): BOOST_BORLAND BOOST_CAMEAU ... BOOST_VACPP BOOST_MSVC

Gennadiy Rozental wrote:
P.S. While we are at it shouldn't we make sure we have single recognizable macro for each compiler we support (using above convention or the natural one supplied by compiler):
BOOST_BORLAND BOOST_CAMEAU ... BOOST_VACPP BOOST_MSVC
Before adding these, you should check out this thread, in which possible names were discussed: http://lists.boost.org/MailArchives/boost/msg62308.php Jonathan

I think I would have preferred a more consistent numbering system - a bit like BOOST_VERSION maybe:
#define BOOST_GCC (__GNUC__*10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
Look reasonable
Of course even that can in theory go wrong, but it does make checks easier to read (because of greater consistency between gcc 2 and 3):
#if BOOST_WORKAROUND(BOOST_GCC, <= 29500) #else BOOST_WORKAROUND(BOOST_GCC <= 30400) // etc....
Any other thoughts?
Do you want me to check this in?
If you're happy with it, then yes please do go ahead, I think it's a little better than the original scheme.
P.S. While we are at it shouldn't we make sure we have single recognizable macro for each compiler we support (using above convention or the natural one supplied by compiler):
BOOST_BORLAND BOOST_CAMEAU ... BOOST_VACPP BOOST_MSVC
Provided the compiler uses just one macro to identify itself I don't think we need to go that far just yet. Here's hoping anyway... John.
participants (4)
-
David Abrahams
-
Gennadiy Rozental
-
John Maddock
-
Jonathan Turkanis