Boost logo

Boost :

From: Angus Leeming (angus.leeming_at_[hidden])
Date: 2005-10-18 08:31:08


David Abrahams wrote:
>> -#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
>> +#if (BOOST_MSVC < 1300)
>> I believe that the script performs the conversion that you'd like
>> to see. Please confirm that I'm on the right track.

> This transformation won't work. Consider what happens on GCC.
> False in the first case and true in the second.

Bleedin' obvious, now that you point it out :(

I'm going to take this as answering one of my questions: should I
transform the original expression above into one using
BOOST_WORKAROUND? YES!

Running the attached script on the boost/detail directory produces the
changes below (repeated many times).

The script is meant to be very conservative. The only "optimization"
that it makes is removing "(BOOST_MSVC > 0) &&" from
      #if (BOOST_MSVC > 0) && BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
and then only if the command following "(BOOST_MSVC > 0) &&" contains
BOOST_MSVC.

I wrote a second little script to post-process the results for the
entire boost subdirectory and throw away repeated changes so we can
see just what the thing is doing. It transpires the script changes
887 preprocessor commands, but only 187 of those are unique. See
boost_msvc_unique.txt.

The one thing that I have seen so far that hasn't been changed to use
BOOST_WORKAROUND but that perhaps should be is:
    -#if _MSC_VER+0 >= 1000
    +#if BOOST_MSVC+0 >= 1000
I don't think any script could cope with such esoterica :)

Finally, it is interesting to see which commands are processed by the
script but are unchanged. See boost_msvc_unchanged.txt.

It seems to me that the script has done its job. If you're happy with
what it produces then I'll prepare a patch and move onto the next
macro.

Regards,
Angus

-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1020)

-#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
+#elif (BOOST_MSVC > 0) || defined( BOOST_INTEL_WIN )

-#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) ||
defined(BOOST_MSVC) && BOOST_MSVC <= 1300
+#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) ||
BOOST_WORKAROUND(BOOST_MSVC, <= 1300)

-#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)

-# if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01
alpha workaround
+# if (BOOST_MSVC > 0) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha
workaround






Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk