]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/unused.py
3 # Copyright 2003 Vladimir Prus
4 # Distributed under the Boost Software License, Version 1.0.
5 # (See accompanying file LICENSE_1_0.txt or copy at
6 # http://www.boost.org/LICENSE_1_0.txt)
8 # Test that unused sources are at least reported.
12 t
= BoostBuild
.Tester(["-d+2"], use_test_config
=False)
14 t
.write("a.cpp", "int main() {}\n")
15 t
.write("b.cpp", "\n")
17 t
.write("jamroot.jam", """\
18 import "class" : new ;
23 import virtual-target ;
25 type.register X : xyz ;
27 class test-target-class : basic-target
29 rule construct ( name : source-targets * : property-set )
31 local result = [ property-set.empty ] ;
32 if ! [ modules.peek : GENERATE_NOTHING ]
34 result += [ virtual-target.from-file b.xyz : . : $(self.project) ] ;
35 if ! [ modules.peek : GENERATE_ONLY_UNUSABLE ]
37 result += [ virtual-target.from-file b.cpp : . : $(self.project)
44 rule compute-usage-requirements ( rproperties : targets * )
46 return [ property-set.create <define>FOO ] ;
50 rule make-b-main-target
52 local project = [ project.current ] ;
53 targets.main-target-alternative [ new test-target-class b : $(project) ] ;
58 alias c ; # Expands to nothing, intentionally.
63 # The second invocation should do nothing, and produce no warning. The previous
64 # invocation might have printed executed actions and other things, so it is not
65 # easy to check if a warning was issued or not.
66 t
.run_build_system(stdout
="")
68 t
.run_build_system(["-sGENERATE_ONLY_UNUSABLE=1"], stdout
="")
70 # Check that even if main target generates nothing, its usage requirements are
71 # still propagated to dependants.
74 #error We refuse to compile without FOO being defined!
75 We_refuse_to_compile_without_FOO_being_defined
79 t
.run_build_system(["-sGENERATE_NOTHING=1"])