diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-01-29 11:26:22 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-01-29 11:26:22 +0100 |
| commit | 92b1fcdd4bed1c3ee1bdbac5dccbb4f4baa447b7 (patch) | |
| tree | 30549884c96c40b7ab960e152fe0ce70c8e8f96e | |
| parent | e930c140b424e4f72c6317bedef4ab45079270c9 (diff) | |
Move sym.ranges check to end of _check_sym_sanity()
More important stuff up front.
| -rw-r--r-- | kconfiglib.py | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 621e6c3..80f13ff 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -4201,23 +4201,6 @@ def _check_sym_sanity(sym): Checks various symbol properties that are handiest to check after parsing. Only generates errors and warnings. """ - if sym.ranges: - if not sym.orig_type in (INT, HEX): - sym.kconfig._warn( - "the {} symbol {} has ranges, but is not int or hex" - .format(TYPE_TO_STR[sym.orig_type], _name_and_loc_str(sym))) - else: - for low, high, _ in sym.ranges: - if not _int_hex_value_is_sane(low, sym.orig_type) or \ - not _int_hex_value_is_sane(high, sym.orig_type): - - sym.kconfig._warn("the {0} symbol {1} has a non-{0} range " - "[{2}, {3}]" - .format(TYPE_TO_STR[sym.orig_type], - _name_and_loc_str(sym), - _name_and_loc_str(low), - _name_and_loc_str(high))) - _check_select_imply_sanity(sym, sym.selects, "selects") _check_select_imply_sanity(sym, sym.implies, "implies") @@ -4242,6 +4225,25 @@ def _check_sym_sanity(sym): sym.kconfig._warn("{} defined without a type" .format(_name_and_loc_str(sym))) + + if sym.ranges: + if not sym.orig_type in (INT, HEX): + sym.kconfig._warn( + "the {} symbol {} has ranges, but is not int or hex" + .format(TYPE_TO_STR[sym.orig_type], _name_and_loc_str(sym))) + else: + for low, high, _ in sym.ranges: + if not _int_hex_value_is_sane(low, sym.orig_type) or \ + not _int_hex_value_is_sane(high, sym.orig_type): + + sym.kconfig._warn("the {0} symbol {1} has a non-{0} range " + "[{2}, {3}]" + .format(TYPE_TO_STR[sym.orig_type], + _name_and_loc_str(sym), + _name_and_loc_str(low), + _name_and_loc_str(high))) + + def _int_hex_value_is_sane(sym, type_): # 'not sym.nodes' implies a constant or undefined symbol, e.g. a plain # "123" |
