]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/tools/build/src/build/property.jam
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / tools / build / src / build / property.jam
index 35bf96281890040e046cd6b582396ceaaf110ffd..ec9d8498583130a0df42d6a837ebb004097bdb26 100644 (file)
@@ -1,6 +1,7 @@
 # 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)
@@ -104,28 +105,15 @@ rule evaluate-conditionals-in-context ( properties * : context * )
         {
             # 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)
             {
@@ -560,6 +548,7 @@ rule translate-indirect-value ( rulename : context-module )
 #
 rule translate ( properties * : project-id : project-location : context-module )
 {
+    local translate-path-rule = [ MATCH "^<translate-path>[@](.*)$" : "$(properties)" ] ;
     local result ;
     for local p in $(properties)
     {
@@ -574,7 +563,10 @@ rule translate ( properties * : project-id : project-location : context-module )
             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=,):" ;
@@ -605,7 +597,14 @@ rule translate ( properties * : project-id : project-location : context-module )
             {
                 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)
@@ -901,11 +900,26 @@ rule __test__ ( )
         : 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) ;
@@ -973,5 +987,10 @@ rule __test__ ( )
     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 ;
 }