diff --git a/tools/extract_build_defines.py b/tools/extract_build_defines.py index bd4dc88b3..0fa9ea10b 100755 --- a/tools/extract_build_defines.py +++ b/tools/extract_build_defines.py @@ -99,7 +99,7 @@ def ValidateAttrs(config_name, config_attrs, file_path, linenum): _default = config_attrs.get('default', None) if _default is not None: if '/' not in _default: - if (_default.lower() != '0') and (config_attrs['default'].lower() != '1') and ( _default not in all_configs): + if (_default.lower() != '0') and (config_attrs['default'].lower() != '1') and ( _default not in all_config_names): logger.info('{} at {}:{} has non-integer default value "{}"'.format(config_name, file_path, linenum, config_attrs['default'])) elif _type == 'string': @@ -185,6 +185,10 @@ def ValidateAttrs(config_name, config_attrs, file_path, linenum): all_configs[config_name] = {'attrs': config_attrs, 'filename': os.path.relpath(file_path, scandir), 'line_number': linenum, 'description': config_description} +all_config_names = set() +for applicable, all_configs in chips_all_configs.items(): + all_config_names.update(all_configs.keys()) + for applicable, all_configs in chips_all_configs.items(): for config_name, config_obj in all_configs.items(): file_path = os.path.join(scandir, config_obj['filename']) diff --git a/tools/extract_cmake_configs.py b/tools/extract_cmake_configs.py index a782ea8ee..b33999d6a 100755 --- a/tools/extract_cmake_configs.py +++ b/tools/extract_cmake_configs.py @@ -99,7 +99,7 @@ def ValidateAttrs(config_name, config_attrs, file_path, linenum): _default = config_attrs.get('default', None) if _default is not None: if '/' not in _default: - if (_default.lower() != '0') and (config_attrs['default'].lower() != '1') and (_default not in all_configs): + if (_default.lower() != '0') and (config_attrs['default'].lower() != '1') and (_default not in all_config_names): logger.info('{} at {}:{} has non-integer default value "{}"'.format(config_name, file_path, linenum, config_attrs['default'])) elif _type == 'string': @@ -185,6 +185,10 @@ def ValidateAttrs(config_name, config_attrs, file_path, linenum): all_configs[config_name] = {'attrs': config_attrs, 'filename': os.path.relpath(file_path, scandir), 'line_number': linenum, 'description': config_description} +all_config_names = set() +for applicable, all_configs in chips_all_configs.items(): + all_config_names.update(all_configs.keys()) + for applicable, all_configs in chips_all_configs.items(): for config_name, config_obj in all_configs.items(): file_path = os.path.join(scandir, config_obj['filename']) diff --git a/tools/extract_configs.py b/tools/extract_configs.py index 35ebe8438..7d9f49197 100755 --- a/tools/extract_configs.py +++ b/tools/extract_configs.py @@ -50,7 +50,6 @@ chips_all_defines = defaultdict(dict) - def ValidateAttrs(config_name, config_attrs, file_path, linenum): _type = config_attrs.get('type', 'int') @@ -105,7 +104,7 @@ def ValidateAttrs(config_name, config_attrs, file_path, linenum): _default = config_attrs.get('default', None) if _default is not None: if '/' not in _default: - if (_default.lower() != '0') and (config_attrs['default'].lower() != '1') and ( _default not in all_configs): + if (_default.lower() != '0') and (config_attrs['default'].lower() != '1') and ( _default not in all_config_names): logger.info('{} at {}:{} has non-integer default value "{}"'.format(config_name, file_path, linenum, config_attrs['default'])) elif _type == 'enum': @@ -221,7 +220,7 @@ def ValidateAttrs(config_name, config_attrs, file_path, linenum): chips_resolved_defines = defaultdict(dict) for applicable, all_defines in chips_all_defines.items(): for d in all_defines: - if d not in all_configs and d.startswith("PICO_"): + if d not in chips_all_configs[applicable] and d.startswith("PICO_"): logger.warning("Potential unmarked PICO define {}".format(d)) resolved_defines = chips_resolved_defines[applicable] # resolve "nested defines" - this allows e.g. USB_DPRAM_MAX to resolve to USB_DPRAM_SIZE which is set to 4096 (which then matches the relevant PICO_CONFIG entry) @@ -229,6 +228,10 @@ def ValidateAttrs(config_name, config_attrs, file_path, linenum): if val in all_defines: resolved_defines[d] = all_defines[val] +all_config_names = set() +for applicable, all_configs in chips_all_configs.items(): + all_config_names.update(all_configs.keys()) + for applicable, all_configs in chips_all_configs.items(): all_defines = chips_all_defines[applicable] for config_name, config_obj in all_configs.items():