From a0ff361e4c7a200d0a31e460a44228b861d130a6 Mon Sep 17 00:00:00 2001 From: guwirth Date: Mon, 9 Dec 2024 15:52:37 +0100 Subject: [PATCH] add deprecated rule key for gcc - fix/complete #2815 --- .../gcc/CxxCompilerGccRuleRepository.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cxx-sensors/src/main/java/org/sonar/cxx/sensors/compiler/gcc/CxxCompilerGccRuleRepository.java b/cxx-sensors/src/main/java/org/sonar/cxx/sensors/compiler/gcc/CxxCompilerGccRuleRepository.java index 4fa5251b23..9ab2de0158 100644 --- a/cxx-sensors/src/main/java/org/sonar/cxx/sensors/compiler/gcc/CxxCompilerGccRuleRepository.java +++ b/cxx-sensors/src/main/java/org/sonar/cxx/sensors/compiler/gcc/CxxCompilerGccRuleRepository.java @@ -40,4 +40,24 @@ public CxxCompilerGccRuleRepository(ServerFileSystem fileSystem, RulesDefinition super(fileSystem, xmlRuleLoader, LANGUAGE, KEY, NAME, FILE); } + @Override + public void prepareRule(NewRule rule) { + switch (rule.key()) { + case "-Wc++11-compat": + rule.addDeprecatedRuleKey(KEY, "-Wc++0x-compat"); + break; + case "-Wc++17-compat": + rule.addDeprecatedRuleKey(KEY, "-Wc++1z-compat"); + break; + case "-Wc11-c23-compat": + rule.addDeprecatedRuleKey(KEY, "-Wc11-c2x-compat"); + break; + case "-Wsuggest-attribute=format": + rule.addDeprecatedRuleKey(KEY, "-Wmissing-format-attribute"); + break; + case "-Wsuggest-attribute=noreturn": + rule.addDeprecatedRuleKey(KEY, "-Wmissing-noreturn"); + break; + } + } }