[config] How to test for GCC <= 4.0

Hi, I have a workaround which I want to apply to all known versions of GCC but not to future versions unless I later determine that it is necessary. Currently I have something like this: #if !defined(BOOST_INTEL) && ( BOOST_WORKAROUND(__GNUC__, <= 3) || \ BOOST_WORKAROUND(__GNUC__, == 4) && \ BOOST_WORKAROUND(__GNUC_MINOR__, BOOST_TESTED_AT(0)) ) \ /**/ ... #endif but I can see from the regression reports that GCC 4.0 is not picking up the workaround code. What am I doing wrong? Jonathan .

On Sat, Feb 12, 2005 at 01:29:55PM -0700, Jonathan Turkanis wrote:
Hi,
I have a workaround which I want to apply to all known versions of GCC but not to future versions unless I later determine that it is necessary. Currently I have something like this:
#if !defined(BOOST_INTEL) && ( BOOST_WORKAROUND(__GNUC__, <= 3) || \ BOOST_WORKAROUND(__GNUC__, == 4) && \ BOOST_WORKAROUND(__GNUC_MINOR__, BOOST_TESTED_AT(0)) ) \ /**/ ... #endif
but I can see from the regression reports that GCC 4.0 is not picking up the workaround code.
What am I doing wrong?
I've wondered about BOOST_TESTED_AT before - I don't think it does the right thing unless BOOST_DETECT_OUTDATED_WORKAROUNDS is defined: # ifdef BOOST_DETECT_OUTDATED_WORKAROUNDS # define BOOST_OPEN_PAREN ( # define BOOST_TESTED_AT(value) > value) ?(-1): BOOST_OPEN_PAREN 1 # else # define BOOST_TESTED_AT(value) != ((value)-(value)) # endif Now forgive me if I'm being stupid, but unless you're compiling with BOOST_DETECT_OUTDATED_WORKAROUNDS, then BOOST_WORKAROUND( __GNUC_MINOR__, BOOST_TESTED_AT(0) ) tests __GNUC_MINOR__ != 0, which is exactly the opposite of what you are trying to test. Should BOOST_TESTED_AT be defined like this? # define BOOST_TESTED_AT(value) <= (value) Am I being stupid? jon -- "There are basically two types of people. People who accomplish things, and people who claim to have accomplished things. The first group is less crowded." - Mark Twain

On Sat, Feb 12, 2005 at 10:29:57PM +0000, Jonathan Wakely wrote:
Should BOOST_TESTED_AT be defined like this?
# define BOOST_TESTED_AT(value) <= (value)
Am I being stupid?
Yes. Since the intention of BOOST_TESTED_AT is to pass all versions, but allow the check to be located later and the bug checked, the current definition is right, except for the fact it fails when used with 0. Would this work? # define BOOST_TESTED_AT(value) != ((value)-(value)) || (value)==0 jon -- "It is absurd to divide people into good and bad. People are either charming or tedious." - Oscar Wilde

Jonathan Wakely wrote:
On Sat, Feb 12, 2005 at 10:29:57PM +0000, Jonathan Wakely wrote:
Should BOOST_TESTED_AT be defined like this?
# define BOOST_TESTED_AT(value) <= (value)
Am I being stupid?
Yes. Since the intention of BOOST_TESTED_AT is to pass all versions, but allow the check to be located later and the bug checked, the current definition is right, except for the fact it fails when used with 0.
Your comments made me realize that I misdescribed what I was trying to do. I want the workaround to apply to all versions of GCC by default, but allow the test to disabled for future versions. Otherwise I wouldn't need to use BOOST_WORKAROUND at all. Furthermore, I see now that BOOST_WORKAROUND will never work with a value of zero, since it is defined as ((symbol != 0) && (...)) I guess I could do: #if defined(__GNUC__) && !defined(BOOST_INTEL) # define BOOST_IOSTREAMS_GCC(__GNUC__ * 100 + __GNUC_MINOR__) #endif #if BOOST_WORKAROUND(BOOST_IOSTREAMS_GCC, <= 400) .... #endif Jonathan
participants (2)
-
Jonathan Turkanis
-
Jonathan Wakely