From c3fa0262262cc936d3a23bc849aa6b8625094d19 Mon Sep 17 00:00:00 2001 From: chrysn Date: Thu, 27 Jan 2022 08:51:07 +0100 Subject: [PATCH 1/2] tools/compile_commands: Filter out -msmall-data-limit=8 It is not available in the libclang version currently shipped with riotdocker. --- dist/tools/compile_commands/compile_commands.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dist/tools/compile_commands/compile_commands.py b/dist/tools/compile_commands/compile_commands.py index bbb0ca89e1..61461e8aba 100755 --- a/dist/tools/compile_commands/compile_commands.py +++ b/dist/tools/compile_commands/compile_commands.py @@ -288,8 +288,7 @@ if __name__ == '__main__': help='Drop the given flag, if present (repeatable)') parser.add_argument('--clangd', default=False, action='store_const', const=True, help='Shorthand for --add-built-in-includes --add-libstdxx-includes ' + - '--filter-out=-Wformat-truncation --filter-out=-Wformat-overflow ' + - '--filter-out=-mno-thumb-interwork') + 'and some CFLAG adjustments throughy --filter-out') _args = parser.parse_args() if _args.clangd: _args.add_built_in_includes = True @@ -297,5 +296,7 @@ if __name__ == '__main__': _args.filter_out = ['-Wformat-truncation', '-Wformat-overflow', '-mno-thumb-interwork', # Only even included for versions of GCC that support it '-malign-data=natural', + # Only supported starting with clang 11 + '-msmall-data-limit=8', ] generate_compile_commands(_args) From 4fb9f46e62f62bc87a6f2250c7c3d834849757f2 Mon Sep 17 00:00:00 2001 From: chrysn Date: Thu, 27 Jan 2022 08:54:39 +0100 Subject: [PATCH 2/2] tools/compile_commands: use -Wno-unknown-warning-option ... instead of manual filtering Some -Wwarning-type flags were removed because in combination with -Werror they caused clang to fail when the warning type was unknown. Rather than enumerating them (a manual process with the extra risk of leaving warnings disabled longer than necessary), this adds `-Wno-unknown-arning-option` which disables the warnings (that are becoming erors through -Werror) raised when a warning's name is unknown. --- dist/tools/compile_commands/compile_commands.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/tools/compile_commands/compile_commands.py b/dist/tools/compile_commands/compile_commands.py index 61461e8aba..bc46006ff4 100755 --- a/dist/tools/compile_commands/compile_commands.py +++ b/dist/tools/compile_commands/compile_commands.py @@ -228,6 +228,9 @@ def generate_module_compile_commands(path, state, args): except ValueError: pass + if args.clangd: + cdetails.cflags.append('-Wno-unknown-warning-option') + c_extra_includes = [] cxx_extra_includes = [] @@ -288,12 +291,13 @@ if __name__ == '__main__': help='Drop the given flag, if present (repeatable)') parser.add_argument('--clangd', default=False, action='store_const', const=True, help='Shorthand for --add-built-in-includes --add-libstdxx-includes ' + - 'and some CFLAG adjustments throughy --filter-out') + 'and some CFLAG adjustments throughy --filter-out, and ignores ' + + 'unknown warning flags') _args = parser.parse_args() if _args.clangd: _args.add_built_in_includes = True _args.add_libstdcxx_includes = True - _args.filter_out = ['-Wformat-truncation', '-Wformat-overflow', '-mno-thumb-interwork', + _args.filter_out = ['-mno-thumb-interwork', # Only even included for versions of GCC that support it '-malign-data=natural', # Only supported starting with clang 11