[Boost-bugs] [Boost C++ Libraries] #7344: Free properties not available in conditional rule

Subject: [Boost-bugs] [Boost C++ Libraries] #7344: Free properties not available in conditional rule
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-09-07 18:37:05


#7344: Free properties not available in conditional rule
------------------------------+---------------------------------------------
 Reporter: anonymous | Owner: vladimir_prus
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: build
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 Free properties are not propagated to common-properties2 rule in
 targets.jam file. Rationale behind this is to optimise caching of already
 created property-set objects (exactly as stated in rule common-properties,
 which contains the call).

 However, this optimisation causes that free features are not passed e.g.
 to user-defined rules used for evaluation of <conditional> properties (see
 example below in the second code listing).

 Therefore I would propose to drop this optimisation and propagate also
 free properties (see code listing below). The other possible solution
 would be to just pass free properties to the common-properties2 rule and
 thus make them available to the algorithm, but this will introduce another
 bug (property-set object from cache will be used even though it contains
 values created from different free properties).


 == SOLUTION PROPOSAL ==


 {{{
 rule common-properties ( build-request requirements )
 {
     local props = [ property-set.create
         [ $(requirements).base ]
         [ $(requirements).incidental ]
         [ $(requirements).free ]
     ] ;

     local key = .rp.$(build-request)-$(props) ;
     if ! $($(key))
     {
         $(key) = [ common-properties2 $(build-request) $(props) ] ;
     }
     return $($(key)) ;
 }
 }}}


 == BUG REPRODUCTION ==


 {{{
 import feature ;


 feature.feature define-prefix : : free ;

 rule define-target-os ( properties * )
 {
   local define-prefix = [ feature.get-values define-prefix : $(properties)
 ] ;
   define-prefix ?= "" ;
   local target-os = [ feature.get-values target-os : $(properties) ] ;
   return <define>$(define-prefix)TARGET_OS_$(target-os:U) ;
 }


 project /root
   : requirements
       <define-prefix>FOOBAR_
       <conditional>@define-target-os
 ;


 exe hello
  : #sources
      hello.cpp
  : #requirements
 ;
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7344>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC