Boost logo

Boost :

Subject: Re: [boost] [predef] Using predef-check on 'develop' problem
From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2015-06-09 22:40:31


On Fri, Jun 5, 2015 at 9:42 PM, Edward Diener <eldiener_at_[hidden]>
wrote:

> I think I know what is wrong in the predef-check functionality. In my VMD
> jamfile the use of predef-check, for any given compile or run rule, looks
> like:
>
> [ predef-check "BOOST_COMP_GNUC >= 4.3" "BOOST_OS_QNX == 0" : :
> <cxxflags>-std=c++0x ]
>

Yes..

What I am seeing is that except on QNX, where "BOOST_OS_QNX != 0", the
> '-std=c++0x' is always being added as a C++ compiler flag to the command
> line.
>
> This initially suggests to me that you are treating more than one quoted
> predef definition as an OR gate rather than an AND gate. But note that on
> QNX, where where "BOOST_OS_QNX != 0" and "BOOST_COMP_GNUC >= 4.3" is true,
> the '-std=c++0x' is not being added. So your logic seems to be that as you
> go through multiple predef definitions once you hit a 'true' condition you
> choose the 'true' path as long as no 'false' conditions follow it, else you
> choose the 'false' path.
>
> Please see if you can fix this given this clue about how predef-check is
> working for the VMD regression tests on various platforms/compilers.

I don't know if it helped but I did a change to one of the tests I do to
completely cover all the Venn variations of the binary and expression. I
changed my test to this:

    [ run check_value.cpp : : : <test-info>always_show_run_output
        [ predef-check "BOOST_COMP_CLANG > 0" "BOOST_OS_LINUX == 0" : :
<cxxflags>-DCHECK_VALUE=true : <cxxflags>-DCHECK_VALUE=false ] ]

And then observed the results on Travis-CI [1], Appveyor [2], and my OSX
dev laptop. The results are as follows:

===
Performing configuration checks
    - BOOST_OS_MACOS : no
    - BOOST_COMP_CLANG > 0 : yes
    - BOOST_OS_LINUX == 0 : no
...found 53 targets...
[...]
** Detected **
BOOST_ARCH_X86 = 1 (0,0,1) | Intel x86
BOOST_ARCH_X86_64 = 1 (0,0,1) | Intel x86-64
BOOST_COMP_CLANG = 30400002 (3,4,2) | Clang
BOOST_COMP_GNUC_EMULATED = 40200001 (4,2,1) | Gnu GCC C/C++
BOOST_COMP_LLVM_EMULATED = 1 (0,0,1) | LLVM
BOOST_ENDIAN_LITTLE_BYTE = 1 (0,0,1) | Byte-Swapped Little-Endian
BOOST_LANG_STDC = 1 (0,0,1) | Standard C
BOOST_LANG_STDCPP = 271100001 (27,11,1) | Standard C++
BOOST_LIB_C_GNU = 21500000 (2,15,0) | GNU
BOOST_LIB_STD_GNU = 420300001 (42,3,1) | GNU
BOOST_OS_LINUX = 1 (0,0,1) | Linux
BOOST_OS_UNIX = 1 (0,0,1) | Unix Environment
[...]
testing.capture-output
../../bin/predef/test/check_value.test/clang-linux-3.4.2/debug/check_value.run
====== BEGIN OUTPUT ======
CHECK_VALUE == 0
[...]
===

===
Performing configuration checks
    - BOOST_OS_MACOS : no
    - BOOST_COMP_CLANG > 0 : no
    - BOOST_OS_LINUX == 0 : no
...found 53 targets...
[...]
** Detected **
BOOST_ARCH_X86 = 1 (0,0,1) | Intel x86
BOOST_ARCH_X86_64 = 1 (0,0,1) | Intel x86-64
BOOST_COMP_GNUC = 40700003 (4,7,3) | Gnu GCC C/C++
BOOST_ENDIAN_LITTLE_BYTE = 1 (0,0,1) | Byte-Swapped Little-Endian
BOOST_LANG_STDC = 1 (0,0,1) | Standard C
BOOST_LANG_STDCPP = 271100001 (27,11,1) | Standard C++
BOOST_LIB_C_GNU = 21500000 (2,15,0) | GNU
BOOST_LIB_STD_GNU = 430400021 (43,4,21) | GNU
BOOST_OS_LINUX = 1 (0,0,1) | Linux
BOOST_OS_UNIX = 1 (0,0,1) | Unix Environment
[...]
testing.capture-output
../../bin/predef/test/check_value.test/gcc-4.7/debug/check_value.run
====== BEGIN OUTPUT ======
CHECK_VALUE == 0
[...]
===

===
Performing configuration checks

    - BOOST_OS_MACOS : no
    - BOOST_COMP_CLANG > 0 : no
    - BOOST_OS_LINUX == 0 : yes
...found 63 targets...
[...]
** Detected **
BOOST_ARCH_X86 = 1 (0,0,1) | Intel x86
BOOST_ARCH_X86_32 = 60000000 (6,0,0) | Intel x86-32
BOOST_COMP_MSVC = 90030729 (9,0,30729) | Microsoft Visual C/C++
BOOST_ENDIAN_LITTLE_BYTE = 1 (0,0,1) | Byte-Swapped Little-Endian
BOOST_LANG_STDCPP = 271100001 (27,11,1) | Standard C++
BOOST_LIB_STD_DINKUMWARE = 50500000 (5,5,0) | Dinkumware
BOOST_OS_WINDOWS = 1 (0,0,1) | Microsoft Windows
BOOST_PLAT_WINDOWS_DESKTOP = 1 (0,0,1) | Windows Desktop
[...]
testing.capture-output
..\..\bin\predef\test\check_value.test\msvc-9.0\debug\threading-multi\check_value.run
        1 file(s) copied.
====== BEGIN OUTPUT ======
CHECK_VALUE == 0
[...]
===

===
Performing configuration checks

    - BOOST_OS_MACOS : yes (cached)
    - BOOST_COMP_CLANG > 0 : yes (cached)
    - BOOST_OS_LINUX == 0 : yes
...found 83 targets...
[...]
** Detected **
BOOST_ARCH_X86 = 1 (0,0,1) | Intel x86
BOOST_ARCH_X86_64 = 1 (0,0,1) | Intel x86-64
BOOST_COMP_CLANG = 60000000 (6,0,0) | Clang
BOOST_COMP_GNUC_EMULATED = 40200001 (4,2,1) | Gnu GCC C/C++
BOOST_COMP_LLVM_EMULATED = 1 (0,0,1) | LLVM
BOOST_ENDIAN_LITTLE_BYTE = 1 (0,0,1) | Byte-Swapped Little-Endian
BOOST_LANG_STDC = 1 (0,0,1) | Standard C
BOOST_LANG_STDCPP = 271100001 (27,11,1) | Standard C++
BOOST_LIB_STD_CXX = 10000101 (1,0,101) | libc++
BOOST_OS_MACOS = 100000000 (10,0,0) | Mac OS
[...]
testing.capture-output
../../bin/predef/test/check_value.test/clang-darwin-4.2.1/debug/check_value.run
====== BEGIN OUTPUT ======
CHECK_VALUE == 1
[...]
===

Which summarized means that all the and expression evaluate correctly...
"yes" and "no" == 0, "no" and "no" == 0, "no" and "yes == 0, and "yes" and
"yes" == 1.

Hence the Predef check is working as intended. Some something else must be
going on in the case of VMD.

[1] <https://travis-ci.org/boostorg/predef>
[2] <https://ci.appveyor.com/project/boostorg/predef>

-- 
-- Rene Rivera
-- Grafik - Don't Assume Anything
-- Robot Dreams - http://robot-dreams.net
-- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail

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