# Copyright 2001, 2002, 2003 Dave Abrahams
# Copyright 2006 Rene Rivera
# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus
+# Copyright 2020 Nikita Kniazev
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
{
# Have negative checks
local fail ;
- while $(condition)
+ for local c in $(condition)
{
- local c = $(condition[1]) ;
- local m = [ MATCH ^!(.*) : $(c) ] ;
- if $(m)
- {
- local p = $(m:G=$(c:G)) ;
- if $(p) in $(context)
- {
- fail = true ;
- c = ;
- }
- }
- else
+ local c = [ MATCH ^(!)?(.*) : $(c) ] ;
+ # It is XOR: $(c[1]) = "!" ^ $(c[2]) in $(context)
+ if $(c[1]) = "!" && $(c[2]) in $(context) || $(c[1]) != "!" && ! ( $(c[2]) in $(context) )
{
- if ! $(c) in $(context)
- {
- fail = true ;
- c = ;
- }
+ fail = true ;
+ break ;
}
- condition = $(condition[2-]) ;
}
if ! $(fail)
{
#
rule translate ( properties * : project-id : project-location : context-module )
{
+ local translate-path-rule = [ MATCH "^<translate-path>[@](.*)$" : "$(properties)" ] ;
local result ;
for local p in $(properties)
{
local e ;
for local c in [ regex.split $(condition) "," ]
{
- e += [ feature.expand-subfeatures $(c) : true ] ;
+ # strip negation for expansion and readd after
+ c = [ MATCH "^(!)?(.*)" : $(c) ] ;
+ local expanded = [ feature.expand-subfeatures $(c[2]) : true ] ;
+ e += $(c[1])$(expanded) ;
}
condition = "$(e:J=,):" ;
{
if path in $(attributes)
{
- value = [ translate-path-value $(property:G=) : $(project-location) ] ;
+ if $(translate-path-rule)
+ {
+ value = [ $(translate-path-rule) $(feature) $(property:G=) : $(properties) : $(project-id) : $(project-location) ] ;
+ }
+ if ! $(value)
+ {
+ value = [ translate-path-value $(property:G=) : $(project-location) ] ;
+ }
result += $(condition:E=)$(feature)$(value) ;
}
else if dependency in $(attributes)
: refine <toolset>gcc:<define>foo : <toolset>gcc:<define>bar
: $(test-space) ;
+ assert.result
+ : evaluate-conditionals-in-context
+ <variant>release,<rtti>off:<define>MY_RELEASE
+ : <toolset>gcc <variant>release <rtti>on ;
+
assert.result <define>MY_RELEASE
: evaluate-conditionals-in-context
<variant>release,<rtti>off:<define>MY_RELEASE
: <toolset>gcc <variant>release <rtti>off ;
+ assert.result <define>MY_RELEASE
+ : evaluate-conditionals-in-context
+ <variant>release,!<rtti>off:<define>MY_RELEASE
+ : <toolset>gcc <variant>release <rtti>on ;
+
+ assert.result
+ : evaluate-conditionals-in-context
+ <variant>release,!<rtti>off:<define>MY_RELEASE
+ : <toolset>gcc <variant>release <rtti>off ;
+
assert.result debug
: as-path <optimization>off <variant>debug
: $(test-space) ;
assert.result-set-equal <toolset>gcc,<toolset-gcc:version>3.0 <define>FOO
: split-conditional <toolset>gcc,<toolset-gcc:version>3.0:<define>FOO ;
+ # Test translate does not choke on negations in conditional
+ assert.result <toolset>gcc,!<rtti>off:<define>HELLO
+ : translate <toolset>gcc,!<rtti>off:<define>HELLO
+ : project-id : project-location : context-module ;
+
feature.finish-test property-test-temp ;
}