summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/contract/build/boost_contract_no.jam-gen.py
blob: 2c574273a3b3c69f350f491488ba27f905913d11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
print '''
# Generated file `python boost_contract_no.jam-gen.py > boost_contract_no.jam`.

# Copyright (C) 2008-2018 Lorenzo Caminiti
# Distributed under the Boost Software License, Version 1.0 (see accompanying
# file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
# See: https://lcaminiti.github.io/boost-contract
'''

import collections
import itertools

defs = collections.OrderedDict([
    # Short keys (1-2 chars) as MSVC gives linker errors on long file names.
    ('y', 'BOOST_CONTRACT_NO_ENTRY_INVARIANTS'),
    ('r', 'BOOST_CONTRACT_NO_PRECONDITIONS'),
    ('x', 'BOOST_CONTRACT_NO_EXIT_INVARIANTS'),
    ('s', 'BOOST_CONTRACT_NO_POSTCONDITIONS'),
    ('e', 'BOOST_CONTRACT_NO_EXCEPTS'),
    ('k', 'BOOST_CONTRACT_NO_CHECKS')
    # Add more macros here.
])
separator = '' # Might want to set to '_' if keys longer than 1 char.

print 'module boost_contract_no {\n'
s = ''
exit
for r in range(len(defs.keys())):
    for comb in itertools.combinations(defs.keys(), r + 1):
        c = ''
        d = ''
        sep = ''
        for cond in comb:
            c += sep + cond
            sep = separator
            d += " <define>" + defs[cond]
        s += ' ' + c
        print 'rule defs_{0} {{ return {1} ; }}\n'.format(c, d[1:])

print '''rule combinations {{ return {0} ; }}

}} # module

# All combinations: {1}
'''.format(s[1:], s.replace(" ", ",")[1:])