
Angus Leeming wrote:
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.
Looking through the output really carefully led me to squash a couple of bugs and make one test more explicit. Revised script attached. A. $ diff -u boost_msvc_orig.sh boost_msvc.sh --- boost_msvc_orig.sh 2005-10-18 16:04:24.000000000 +0100 +++ boost_msvc.sh 2005-10-18 15:55:22.000000000 +0100 @@ -34,6 +34,10 @@ # of BOOST_MSVC itself! /^ *# *define \{1,\}BOOST_MSVC \{1,\}/b +# Nor are we interested in changing the definition of _MSC_VER +/^ *# *define \{1,\}_MSC_VER \{1,\}/b +/^ *# *undef \{1,\}_MSC_VER *$/b + # Save the preprocessor command in the hold space. # We will use it to pretty-print the output in "diff -u" style. s/$/ANGUS_SEPARATOR/ @@ -45,6 +49,11 @@ s/_MSC_VER\([^_]\)/BOOST_MSVC\1/g s/_MSC_VER$/BOOST_MSVC/ +# Be explicit! +# "#if BOOST_MSVC" -> "#if (BOOST_MSVC > 0)" +s/\(if \{1,\}\)BOOST_MSVC *$/\1(BOOST_MSVC > 0)/ +s/\(if \{1,\}! *\)BOOST_MSVC *$/\1(BOOST_MSVC == 0)/ + # We are interested in the BOOST_MSVC macro; # no false positives please. s/BOOST_MSVC_/ANGUS_MSVC_/g @@ -137,7 +146,7 @@ # Do not transform "BOOST_MSVC == 0" or "BOOST_MSVC > 0" /BOOST_MSVC \{1,\}\(==\|>\) \{1,\}0[ )]/ !{ - s/\(BOOST_MSVC\) *\(<=\|<\|==\|!=\|>=\|>\) * \([0-9]\{1 \}\)/BOOST_WORKAROUND(\1, \2 \3)/g + s/\(BOOST_MSVC\) *\(<=\|<\|==\|!=\|>=\|>\) *\([0-9]\{1 \}\)/BOOST_WORKAROUND(\1, \2 \3)/g } #================================================================