From 89ca492439f4fcd61b159b33ec613d3b16c063af Mon Sep 17 00:00:00 2001 From: guwirth Date: Fri, 29 Oct 2021 16:31:03 +0200 Subject: [PATCH] update rules from LLVM tools * tag: llvmorg-14-init-8123-ga875e6e1225a * new clang tidy rules: * altera-id-dependent-backward-branch * bugprone-easily-swappable-parameters * bugprone-implicit-widening-of-multiplication-result * bugprone-suspicious-memory-comparison * bugprone-unhandled-exception-at-new * cert-exp42-c * cert-flp37-c * cppcoreguidelines-virtual-class-destructor * readability-data-pointer * readability-identifier-length * readability-suspicious-call-argument * new clang diagnostic rules: * clang-diagnostic-aix-compat * clang-diagnostic-argument-undefined-behaviour * clang-diagnostic-attribute-warning * clang-diagnostic-bitwise-instead-of-logical * clang-diagnostic-cast-function-type * clang-diagnostic-cxx-attribute-extension * clang-diagnostic-delimited-escape-sequence-extension * clang-diagnostic-deprecated-altivec-src-compat * clang-diagnostic-deprecated-copy-with-dtor * clang-diagnostic-deprecated-copy-with-user-provided-copy * clang-diagnostic-deprecated-copy-with-user-provided-dtor * clang-diagnostic-deprecated-pragma * clang-diagnostic-final-macro * clang-diagnostic-frame-larger-than * clang-diagnostic-gpu-maybe-wrong-side * clang-diagnostic-ignored-availability-without-sdk-settings * clang-diagnostic-ignored-reference-qualifiers * clang-diagnostic-interrupt-service-routine * clang-diagnostic-linker-warnings * clang-diagnostic-microsoft-abstract * clang-diagnostic-module-lock * clang-diagnostic-null-pointer-subtraction * clang-diagnostic-openmp-51-extensions * clang-diagnostic-pedantic-macros * clang-diagnostic-pre-openmp-51-compat * clang-diagnostic-redundant-consteval-if * clang-diagnostic-reserved-identifier * clang-diagnostic-reserved-macro-identifier * clang-diagnostic-restrict-expansion * clang-diagnostic-search-path-usage * clang-diagnostic-tautological-unsigned-char-zero-compare * clang-diagnostic-unreachable-code-fallthrough * clang-diagnostic-unused-but-set-parameter * clang-diagnostic-unused-but-set-variable * new clang-sa rules: * cplusplus.StringChecker --- cxx-sensors/src/main/resources/clangsa.xml | 15 + cxx-sensors/src/main/resources/clangtidy.xml | 2974 +++++++++++++---- .../clangsa/CxxClangSARuleRepositoryTest.java | 2 +- .../CxxClangTidyRuleRepositoryTest.java | 2 +- .../src/tools/clangtidy_createrules.py | 8 +- .../tools/generate_clangtidy_resources.cmd | 68 + 6 files changed, 2418 insertions(+), 651 deletions(-) create mode 100644 cxx-sensors/src/tools/generate_clangtidy_resources.cmd diff --git a/cxx-sensors/src/main/resources/clangsa.xml b/cxx-sensors/src/main/resources/clangsa.xml index 00aa6f6ee9..3077284051 100644 --- a/cxx-sensors/src/main/resources/clangsa.xml +++ b/cxx-sensors/src/main/resources/clangsa.xml @@ -282,6 +282,21 @@ Rules list was generated based on clang version 11.0.1 --> Check pure virtual function calls during construction/destruction +

+

References

clang-analyzer.llvm.org

+]]>
+ MAJOR + BUG + LINEAR + 5min + cplusplus + + + cplusplus.StringChecker + cplusplus.StringChecker + +Checks C++ std::string bugs

References

clang-analyzer.llvm.org

]]>
diff --git a/cxx-sensors/src/main/resources/clangtidy.xml b/cxx-sensors/src/main/resources/clangtidy.xml index cc1b56adf8..0e364e1dba 100644 --- a/cxx-sensors/src/main/resources/clangtidy.xml +++ b/cxx-sensors/src/main/resources/clangtidy.xml @@ -3,7 +3,7 @@ C and C++ rules from * https://clang.llvm.org/extra/clang-tidy/checks/list.html * https://clang-analyzer.llvm.org/available_checks.html - * last update: llvmorg-13-init-4898-g270a336ff462 + * last update: llvmorg-14-init-8123-ga875e6e1225a (git describe) --> @@ -362,7 +362,7 @@ for (auto piece : absl::StrSplit(str, absl::MaxSplits('B', 1))) { subl.. title:: clang-tidy - abseil-no-internal-dependencies

abseil-no-internal-dependencies

-

Warns if code using Abseil depends on internal details. If something is in a namespace that includes the word 'internal', code is not allowed to depend upon it beaucse it's an implementation detail. They cannot friend it, include it, you mention it or refer to it in any way. Doing so violates Abseil's compatibility guidelines and may result in breakage. See https://abseil.io/about/compatibility for more information.

+

Warns if code using Abseil depends on internal details. If something is in a namespace that includes the word "internal", code is not allowed to depend upon it because it's an implementation detail. They cannot friend it, include it, you mention it or refer to it in any way. Doing so violates Abseil's compatibility guidelines and may result in breakage. See https://abseil.io/about/compatibility for more information.

The following cases will result in warnings:

absl::strings_internal::foo();
 // warning triggered on this line
@@ -392,7 +392,7 @@ absl::memory_internal::MakeUniqueResult();
  ...
 }

will be prompted with a warning.

-

See the full Abseil compatibility guidelines <https://abseil.io/about/compatibility> for more information.

+

See the full Abseil compatibility guidelines <https:// abseil.io/about/compatibility> for more information.

References

clang.llvm.org

]]>
@@ -568,7 +568,7 @@ if (absl::FromUnixSeconds(x) < t) ...
int x;
 absl::Time t;
 
-// Original - absl::Duration result and first operand is a absl::Time.
+// Original - absl::Duration result and first operand is an absl::Time.
 absl::Duration d = absl::Seconds(absl::ToUnixSeconds(t) - x);
 
 // Suggestion - Perform subtraction in the Time domain instead.
@@ -613,6 +613,35 @@ d *= static_cast<int64_t>(a);
INFO CODE_SMELL
+ + altera-id-dependent-backward-branch + altera-id-dependent-backward-branch + + +

clang-tidy - altera-id-dependent-backward-branch

+ +

altera-id-dependent-backward-branch

+

Finds ID-dependent variables and fields that are used within loops. This causes branches to occur inside the loops, and thus leads to performance degradation.

+
// The following code will produce a warning because this ID-dependent
+// variable is used in a loop condition statement.
+int ThreadID = get_local_id(0);
+// The following loop will produce a warning because the loop condition
+// statement depends on an ID-dependent variable.
+for (int i = 0; i < ThreadID; ++i) {
+  std::cout << i << std::endl;
+}
+// The following loop will not produce a warning, because the ID-dependent
+// variable is not used in the loop condition statement.
+for (int i = 0; i < 100; ++i) {
+  std::cout << ThreadID << std::endl;
+}
+

Based on the Altera SDK for OpenCL: Best Practices Guide.

+

References

+

clang.llvm.org

]]> +
+ INFO + CODE_SMELL +
altera-kernel-name-restriction altera-kernel-name-restriction @@ -1105,7 +1134,7 @@ openat(0, "filename", O_RDWR | O_CLOEXEC);

clang-tidy - android-cloexec-pipe2

android-cloexec-pipe2

-

This checks ensures that pipe2() is called with the O_CLOEXEC flag. The check also adds the O_CLOEXEC flag that marks the file descriptor to be closed in child processes. Without this flag a sensitive file descriptor can be leaked to a child process, potentially into a lower-privileged SELinux domain.

+

This check ensures that pipe2() is called with the O_CLOEXEC flag. The check also adds the O_CLOEXEC flag that marks the file descriptor to be closed in child processes. Without this flag a sensitive file descriptor can be leaked to a child process, potentially into a lower-privileged SELinux domain.

Examples:

pipe2(pipefd, O_NONBLOCK);

Suggested replacement:

@@ -1180,7 +1209,7 @@ while (TEMP_FAILURE_RETRY(read(STDIN_FILENO, cs, sizeof(cs))) != 0) {

boost-use-to-string

This check finds conversion from integer type like int to std::string or std::wstring using boost::lexical_cast, and replace it with calls to std::to_string and std::to_wstring.

-

It doesn't replace conversion from floating points despite the to_string overloads, because it would change the behaviour.

+

It doesn't replace conversion from floating points despite the to_string overloads, because it would change the behavior.

auto str = boost::lexical_cast<std::string>(42);
 auto wstr = boost::lexical_cast<std::wstring>(2137LL);
 
@@ -1439,7 +1468,7 @@ default:
 

Finally, the check also examines conditional operators and reports code like:

return test_value(x) ? x : x;

Unlike if statements, the check does not detect chains of conditional operators.

-

Note: This check also reports situations where branches become identical only after preprocession.

+

Note: This check also reports situations where branches become identical only after preprocessing.

References

clang.llvm.org

]]> @@ -1484,7 +1513,7 @@ class X2 : public Copyable {

clang-tidy - bugprone-dangling-handle

bugprone-dangling-handle

-

Detect dangling references in value handles like std::experimental::string_view. These dangling references can be a result of constructing handles from temporary values, where the temporary is destroyed soon after the handle is created.

+

Detect dangling references in value handles like std::string_view. These dangling references can be a result of constructing handles from temporary values, where the temporary is destroyed soon after the handle is created.

Examples:

string_view View = string();  // View will dangle.
 string A;
@@ -1505,7 +1534,7 @@ string_view f() {
 

Options

HandleClasses

-

A semicolon-separated list of class names that should be treated as handles. By default only std::experimental::basic_string_view is considered.

+

A semicolon-separated list of class names that should be treated as handles. By default only std::basic_string_view and std::experimental::basic_string_view are considered.

References

clang.llvm.org

]]> @@ -1537,6 +1566,136 @@ string_view f() { INFO CODE_SMELL + + bugprone-easily-swappable-parameters + bugprone-easily-swappable-parameters + + +

clang-tidy - bugprone-easily-swappable-parameters

+ +

bugprone-easily-swappable-parameters

+

Finds function definitions where parameters of convertible types follow each other directly, making call sites prone to calling the function with swapped (or badly ordered) arguments.

+
void drawPoint(int X, int Y) { /* ... */ }
+FILE *open(const char *Dir, const char *Name, Flags Mode) { /* ... */ }
+

A potential call like drawPoint(-2, 5) or openPath("a.txt", "tmp", Read) is perfectly legal from the language's perspective, but might not be what the developer of the function intended.

+

More elaborate and type-safe constructs, such as opaque typedefs or strong types should be used instead, to prevent a mistaken order of arguments.

+
struct Coord2D { int X; int Y; };
+void drawPoint(const Coord2D Pos) { /* ... */ }
+FILE *open(const Path &Dir, const Filename &Name, Flags Mode) { /* ... */ }
+

Due to the potentially elaborate refactoring and API-breaking that is necessary to strengthen the type safety of a project, no automatic fix-its are offered.

+

Options

+

Extension/relaxation options

+

Relaxation (or extension) options can be used to broaden the scope of the analysis and fine-tune the enabling of more mixes between types. Some mixes may depend on coding style or preference specific to a project, however, it should be noted that enabling all of these relaxations model the way of mixing at call sites the most. These options are expected to make the check report for more functions, and report longer mixable ranges.

+
+

QualifiersMix

+

Whether to consider parameters of some cvr-qualified T and a differently cvr-qualified T (i.e. T and const T, const T and volatile T, etc.) mixable between one another. If false, the check will consider differently qualified types unmixable. True turns the warnings on. Defaults to false.

+

The following example produces a diagnostic only if QualifiersMix is enabled:

+
void *memcpy(const void *Destination, void *Source, std::size_t N) { /* ... */ }
+
+
+

ModelImplicitConversions

+

Whether to consider parameters of type T and U mixable if there exists an implicit conversion from T to U and U to T. If false, the check will not consider implicitly convertible types for mixability. True turns warnings for implicit conversions on. Defaults to true.

+

The following examples produce a diagnostic only if ModelImplicitConversions is enabled:

+
void fun(int Int, double Double) { /* ... */ }
+void compare(const char *CharBuf, std::string String) { /* ... */ }
+
+
+

Note

+
+

Changing the qualifiers of an expression's type (e.g. from int to const int) is defined as an implicit conversion in the C++ Standard. However, the check separates this decision-making on the mixability of differently qualified types based on whether QualifiersMix was enabled.

+

For example, the following code snippet will only produce a diagnostic if both QualifiersMix and ModelImplicitConversions are enabled:

+
void fun2(int Int, const double Double) { /* ... */ }
+
+
+

Filtering options

+

Filtering options can be used to lessen the size of the diagnostics emitted by the checker, whether the aim is to ignore certain constructs or dampen the noisiness.

+
+

MinimumLength

+

The minimum length required from an adjacent parameter sequence to be diagnosed. Defaults to 2. Might be any positive integer greater or equal to 2. If 0 or 1 is given, the default value 2 will be used instead.

+

For example, if 3 is specified, the examples above will not be matched.

+
+
+

IgnoredParameterNames

+

The list of parameter names that should never be considered part of a swappable adjacent parameter sequence. The value is a ;-separated list of names. To ignore unnamed parameters, add "" to the list verbatim (not the empty string, but the two quotes, potentially escaped!). This option is case-sensitive!

+

By default, the following parameter names, and their Uppercase-initial variants are ignored: "" (unnamed parameters), iterator, begin, end, first, last, lhs, rhs.

+
+
+

IgnoredParameterTypeSuffixes

+

The list of parameter type name suffixes that should never be considered part of a swappable adjacent parameter sequence. Parameters which type, as written in the source code, end with an element of this option will be ignored. The value is a ;-separated list of names. This option is case-sensitive!

+

By default, the following, and their lowercase-initial variants are ignored: bool, It, Iterator, InputIt, ForwardIt, BidirIt, RandomIt, random_iterator, ReverseIt, reverse_iterator, reverse_const_iterator, RandomIt, random_iterator, ReverseIt, reverse_iterator, reverse_const_iterator, Const_Iterator, ConstIterator, const_reverse_iterator, ConstReverseIterator. In addition, _Bool (but not _bool) is also part of the default value.

+
+
+

SuppressParametersUsedTogether

+

Suppresses diagnostics about parameters that are used together or in a similar fashion inside the function's body. Defaults to true. Specifying false will turn off the heuristics.

+

Currently, the following heuristics are implemented which will suppress the warning about the parameter pair involved:

+
    +
  • The parameters are used in the same expression, e.g. f(a, b) or a < b.

  • +
  • The parameters are further passed to the same function to the same parameter of that function, of the same overload. e.g. f(a, 1) and f(b, 2) to some f(T, int).

    +
    +
    +

    Note

    +
    +

    The check does not perform path-sensitive analysis, and as such, "same function" in this context means the same function declaration. If the same member function of a type on two distinct instances are called with the parameters, it will still be regarded as "same function".

    +
  • +
  • The same member field is accessed, or member method is called of the two parameters, e.g. a.foo() and b.foo().

  • +
  • Separate return statements return either of the parameters on different code paths.

  • +
+
+
+

NamePrefixSuffixSilenceDissimilarityTreshold

+

The number of characters two parameter names might be different on either the head or the tail end with the rest of the name the same so that the warning about the two parameters are silenced. Defaults to 1. Might be any positive integer. If 0, the filtering heuristic based on the parameters' names is turned off.

+

This option can be used to silence warnings about parameters where the naming scheme indicates that the order of those parameters do not matter.

+

For example, the parameters LHS and RHS are 1-dissimilar suffixes of each other: L and R is the different character, while HS is the common suffix. Similarly, parameters text1, text2, text3 are 1-dissimilar prefixes of each other, with the numbers at the end being the dissimilar part. If the value is at least 1, such cases will not be reported.

+
+

Limitations

+

This check is designed to check function signatures!

+

The check does not investigate functions that are generated by the compiler in a context that is only determined from a call site. These cases include variadic functions, functions in C code that do not have an argument list, and C++ template instantiations. Most of these cases, which are otherwise swappable from a caller's standpoint, have no way of getting "fixed" at the definition point. In the case of C++ templates, only primary template definitions and explicit specializations are matched and analyzed.

+

None of the following cases produce a diagnostic:

+
int printf(const char *Format, ...) { /* ... */ }
+int someOldCFunction() { /* ... */ }
+template <typename T, typename U>
+int add(T X, U Y) { return X + Y };
+void theseAreNotWarnedAbout() {
+    printf("%d %d\n", 1, 2);   // Two ints passed, they could be swapped.
+    someOldCFunction(1, 2, 3); // Similarly, multiple ints passed.
+    add(1, 2); // Instantiates 'add<int, int>', but that's not a user-defined function.
+}
+

Due to the limitation above, parameters which type are further dependent upon template instantiations to prove that they mix with another parameter's is not diagnosed.

+
template <typename T>
+struct Vector {
+  typedef T element_type;
+};
+// Diagnosed: Explicit instantiation was done by the user, we can prove it
+// is the same type.
+void instantiated(int A, Vector<int>::element_type B) { /* ... */ }
+// Diagnosed: The two parameter types are exactly the same.
+template <typename T>
+void exact(typename Vector<T>::element_type A,
+           typename Vector<T>::element_type B) { /* ... */ }
+// Skipped: The two parameters are both 'T' but we cannot prove this
+// without actually instantiating.
+template <typename T>
+void falseNegative(T A, typename Vector<T>::element_type B) { /* ... */ }
+

In the context of implicit conversions (when ModelImplicitConversions is enabled), the modelling performed by the check warns if the parameters are swappable and the swapped order matches implicit conversions. It does not model whether there exists an unrelated third type from which both parameters can be given in a function call. This means that in the following example, even while strs() clearly carries the possibility to be called with swapped arguments (as long as the arguments are string literals), will not be warned about.

+
struct String {
+    String(const char *Buf);
+};
+struct StringView {
+    StringView(const char *Buf);
+    operator const char *() const;
+};
+// Skipped: Directly swapping expressions of the two type cannot mix.
+// (Note: StringView -> const char * -> String would be **two**
+// user-defined conversions, which is disallowed by the language.)
+void strs(String Str, StringView SV) { /* ... */ }
+// Diagnosed: StringView implicitly converts to and from a buffer.
+void cStr(StringView SV, const char *Buf() { /* ... */ }
+

References

+

clang.llvm.org

]]> +
+ INFO + CODE_SMELL +
bugprone-exception-escape bugprone-exception-escape @@ -1584,7 +1743,7 @@ string_view f() {

bugprone-fold-init-type

The check flags type mismatches in folds like std::accumulate that might result in loss of precision. std::accumulate folds an input range into an initial value using the type of the latter, with operator+ by default. This can cause loss of precision through:

    -
  • Truncation: The following code uses a floating point range and an int initial value, so trucation will happen at every application of operator+ and the result will be 0, which might not be what the user expected.
  • +
  • Truncation: The following code uses a floating point range and an int initial value, so truncation will happen at every application of operator+ and the result will be 0, which might not be what the user expected.
auto a = {0.5f, 0.5f, 0.5f, 0.5f};
 return std::accumulate(std::begin(a), std::end(a), 0);
@@ -1649,12 +1808,16 @@ public: template<typename T, typename X = enable_if_t<is_special<T>,void>> explicit Person(T&& n) {} + // C4: variadic perfect forwarding ctor guarded with enable_if + template<typename... A, + enable_if_t<is_constructible_v<tuple<string, int>, A&&...>, int> = 0> + explicit Person(A&&... a) {} // (possibly compiler generated) copy ctor Person(const Person& rhs); };
-

The check warns for constructors C1 and C2, because those can hide copy and move constructors. We suppress warnings if the copy and the move constructors are both disabled (deleted or private), because there is nothing the perfect forwarding constructor could hide in this case. We also suppress warnings for constructors like C3 that are guarded with an enable_if, assuming the programmer was aware of the possible hiding.

+

The check warns for constructors C1 and C2, because those can hide copy and move constructors. We suppress warnings if the copy and the move constructors are both disabled (deleted or private), because there is nothing the perfect forwarding constructor could hide in this case. We also suppress warnings for constructors like C3 and C4 that are guarded with an enable_if, assuming the programmer was aware of the possible hiding.

Background

-

For deciding whether a constructor is guarded with enable_if, we consider the default values of the type parameters and the types of the constructor parameters. If any part of these types is std::enable_if or std::enable_if_t, we assume the constructor is guarded.

+

For deciding whether a constructor is guarded with enable_if, we consider the types of the constructor parameters, the default values of template type parameters and the types of non-type template parameters with a default literal value. If any part of these types is std::enable_if or std::enable_if_t, we assume the constructor is guarded.

References

clang.llvm.org

]]> @@ -1663,6 +1826,51 @@ public: LINEAR 5min + + bugprone-implicit-widening-of-multiplication-result + bugprone-implicit-widening-of-multiplication-result + + +

clang-tidy - bugprone-implicit-widening-of-multiplication-result

+ +

bugprone-implicit-widening-of-multiplication-result

+

The check diagnoses instances where a result of a multiplication is implicitly widened, and suggests (with fix-it) to either silence the code by making widening explicit, or to perform the multiplication in a wider type, to avoid the widening afterwards.

+

This is mainly useful when operating on very large buffers. For example, consider:

+
void zeroinit(char* base, unsigned width, unsigned height) {
+  for(unsigned row = 0; row != height; ++row) {
+    for(unsigned col = 0; col != width; ++col) {
+      char* ptr = base + row * width + col;
+      *ptr = 0;
+    }
+  }
+}
+

This is fine in general, but if width * height overflows, you end up wrapping back to the beginning of base instead of processing the entire requested buffer.

+

Indeed, this only matters for pretty large buffers (4GB+), but that can happen very easily for example in image processing, where for that to happen you "only" need a ~269MPix image.

+

Options

+
+

UseCXXStaticCastsInCppSources

+

When suggesting fix-its for C++ code, should C++-style static_cast<>()'s be suggested, or C-style casts. Defaults to true.

+
+
+

UseCXXHeadersInCppSources

+

When suggesting to include the appropriate header in C++ code, should <cstddef> header be suggested, or <stddef.h>. Defaults to true.

+
+

Examples:

+
long mul(int a, int b) {
+  return a * b; // warning: performing an implicit widening conversion to type 'long' of a multiplication performed in type 'int'
+}
+char* ptr_add(char *base, int a, int b) {
+  return base + a * b; // warning: result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ssize_t'
+}
+char ptr_subscript(char *base, int a, int b) {
+  return base[a * b]; // warning: result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ssize_t'
+}
+

References

+

clang.llvm.org

]]> +
+ INFO + CODE_SMELL +
bugprone-inaccurate-erase bugprone-inaccurate-erase @@ -1821,8 +2029,8 @@ Now called from FancyFunction

clang-tidy - bugprone-macro-parentheses

bugprone-macro-parentheses

-

Finds macros that can have unexpected behaviour due to missing parentheses.

-

Macros are expanded by the preprocessor as-is. As a result, there can be unexpected behaviour; operators may be evaluated in unexpected order and unary operators may become binary operators, etc.

+

Finds macros that can have unexpected behavior due to missing parentheses.

+

Macros are expanded by the preprocessor as-is. As a result, there can be unexpected behavior; operators may be evaluated in unexpected order and unary operators may become binary operators, etc.

When the replacement list has an expression, it is recommended to surround it with parentheses. This ensures that the macro result is evaluated completely before it is used.

It is also recommended to surround macro arguments in the replacement list with parentheses. This ensures that the argument value is calculated properly.

References

@@ -1938,7 +2146,7 @@ Now called from FancyFunction

Options

CheckImplicitCasts

-

If true, enables detection of implicit casts. Default is true.

+

If true, enables detection of implicit casts. Default is false.

References

clang.llvm.org

]]> @@ -2033,7 +2241,7 @@ if (do_increment)

clang-tidy - bugprone-not-null-terminated-result

bugprone-not-null-terminated-result

-

Finds function calls where it is possible to cause a not null-terminated result. Usually the proper length of a string is strlen(src) + 1 or equal length of this expression, because the null terminator needs an extra space. Without the null terminator it can result in undefined behaviour when the string is read.

+

Finds function calls where it is possible to cause a not null-terminated result. Usually the proper length of a string is strlen(src) + 1 or equal length of this expression, because the null terminator needs an extra space. Without the null terminator it can result in undefined behavior when the string is read.

The following and their respective wchar_t based functions are checked:

memcpy, memcpy_s, memchr, memmove, memmove_s, strerror_s, strncmp, strxfrm

The following is a real-world example where the programmer forgot to increase the passed third argument, which is size_t length. That is why the length of the allocated memory is not enough to hold the null terminator.

@@ -2055,7 +2263,7 @@ if (do_increment)
@@ -2173,7 +2381,7 @@ if (onFire) { if (onFire || isCollapsing()) scream(); } -

In the first case (logical "and") the suggested fix is to remove the redundant condition variable and keep the other side of the &&. In the second case (logical "or") the whole if is removed similarily to the simple case on the top.

+

In the first case (logical "and") the suggested fix is to remove the redundant condition variable and keep the other side of the &&. In the second case (logical "or") the whole if is removed similarly to the simple case on the top.

The condition of the outer if statement may also be a logical "and" (&&) expression:

bool onFire = isBurning();
 if (onFire && fireFighters < 10) {
@@ -2238,7 +2446,7 @@ if (onFire) {
   #define cool__macro // also this
 }
 int _g(); // disallowed in global namespace only
-

The check can also be inverted, i.e. it can be configured to flag any identifier that is not a reserved identifier. This mode is for use by e.g. standard library implementors, to ensure they don't infringe on the user namespace.

+

The check can also be inverted, i.e. it can be configured to flag any identifier that is _not a reserved identifier. This mode is for use by e.g. standard library implementors, to ensure they don't infringe on the user namespace.

This check does not (yet) check for other reserved names, e.g. macro names identical to language keywords, and names specifically reserved by language standards, e.g. C++ 'zombie names' and C future library directions.

This check corresponds to CERT C Coding Standard rule DCL37-C. Do not declare or define a reserved identifier as well as its C++ counterpart, DCL51-CPP. Do not declare or define a reserved identifier.

Options

@@ -2270,7 +2478,7 @@ int _g(); // disallowed in global namespace only

This check corresponds to the CERT C Coding Standard rule SIG30-C. Call only asynchronous-safe functions within signal handlers and has an alias name cert-sig30-c.

AsyncSafeFunctionSet

-

Selects wich set of functions is considered as asynchronous-safe (and therefore allowed in signal handlers). Value minimal selects a minimal set that is defined in the CERT SIG30-C rule and includes functions abort(), _Exit(), quick_exit() and signal(). Value POSIX selects a larger set of functions that is listed in POSIX.1-2017 (see this link for more information). The function quick_exit is not included in the shown list. It is assumable that the reason is that the list was not updated for C11. The checker includes quick_exit in the set of safe functions. Functions registered as exit handlers are not checked.

+

Selects which set of functions is considered as asynchronous-safe (and therefore allowed in signal handlers). Value minimal selects a minimal set that is defined in the CERT SIG30-C rule and includes functions abort(), _Exit(), quick_exit() and signal(). Value POSIX selects a larger set of functions that is listed in POSIX.1-2017 (see this link for more information). The function quick_exit is not included in the shown list. It is assumable that the reason is that the list was not updated for C11. The checker includes quick_exit in the set of safe functions. Functions registered as exit handlers are not checked.

Default is POSIX.

References

@@ -2477,7 +2685,7 @@ void getInt(int* dst) {

WarnOnSizeOfCompareToConstant

-

When true, the check will warn on an expression like sizeof(epxr) <= k for a suspicious constant k while k is 0 or greater than 0x8000. Default is true.

+

When true, the check will warn on an expression like sizeof(expr) <= k for a suspicious constant k while k is 0 or greater than 0x8000. Default is true.

References

clang.llvm.org

]]> @@ -2723,6 +2931,27 @@ flag |= LINEAR 5min + + bugprone-suspicious-memory-comparison + bugprone-suspicious-memory-comparison + + +

clang-tidy - bugprone-suspicious-memory-comparison

+ +

bugprone-suspicious-memory-comparison

+

Finds potentially incorrect calls to memcmp() based on properties of the arguments. The following cases are covered:

+

Case 1: Non-standard-layout type

+

Comparing the object representations of non-standard-layout objects may not properly compare the value representations.

+

Case 2: Types with no unique object representation

+

Objects with the same value may not have the same object representation. This may be caused by padding or floating-point types.

+

See also: EXP42-C. Do not compare padding data and FLP37-C. Do not use object representations to compare floating-point values

+

This check is also related to and partially overlaps the CERT C++ Coding Standard rules OOP57-CPP. Prefer special member functions and overloaded operators to C Standard Library functions and EXP62-CPP. Do not access the bits of an object representation that are not part of the object's value representation

+

References

+

clang.llvm.org

]]> +
+ INFO + CODE_SMELL +
bugprone-suspicious-memset-usage bugprone-suspicious-memset-usage @@ -2869,7 +3098,7 @@ Token t = readNextToken();
if (strcmp(...))       // Implicitly compare to zero
 if (!strcmp(...))      // Won't warn
 if (strcmp(...) != 0)  // Won't warn
-

Checks that compare function results (i,e, strcmp) are compared to valid constant. The resulting value is

+

Checks that compare function results (i.e., strcmp) are compared to valid constant. The resulting value is

<  0    when lower than,
 >  0    when greater than,
 == 0    when equals.
@@ -2980,10 +3209,10 @@ do {
int doSomething(const std::vector& items) {
   for (short i = 0; i < items.size(); ++i) {}
 }
-

This algorithm works for small amount of objects, but will lead to freeze for a a larger user input.

+

This algorithm works for a small amount of objects, but will lead to freeze for a larger user input.

MagnitudeBitsUpperLimit

-

Upper limit for the magnitude bits of the loop variable. If it's set the check filters out those catches in which the loop variable's type has more magnitude bits as the specified upper limit. The default value is 16. For example, if the user sets this option to 31 (bits), then a 32-bit unsigend int is ignored by the check, however a 32-bit int is not (A 32-bit signed int has 31 magnitude bits).

+

Upper limit for the magnitude bits of the loop variable. If it's set the check filters out those catches in which the loop variable's type has more magnitude bits as the specified upper limit. The default value is 16. For example, if the user sets this option to 31 (bits), then a 32-bit unsigned int is ignored by the check, however a 32-bit int is not (A 32-bit signed int has 31 magnitude bits).

int main() {
   long size = 294967296l;
@@ -3033,6 +3262,27 @@ do {
     LINEAR
     5min
     
+  
+    bugprone-unhandled-exception-at-new
+    bugprone-unhandled-exception-at-new
+    
+      
+

clang-tidy - bugprone-unhandled-exception-at-new

+ +

bugprone-unhandled-exception-at-new

+

Finds calls to new with missing exception handler for std::bad_alloc.

+
int *f() noexcept {
+  int *p = new int[1000];
+  // ...
+  return p;
+}
+

Calls to new can throw exceptions of type std::bad_alloc that should be handled by the code. Alternatively, the nonthrowing form of new can be used. The check verifies that the exception is handled in the function that calls new, unless a nonthrowing version is used or the exception is allowed to propagate out of the function (exception handler is checked for types std::bad_alloc, std::exception, and catch-all handler). The check assumes that any user-defined operator new is either noexcept or may throw an exception of type std::bad_alloc (or derived from it). Other exception types or exceptions occurring in the object's constructor are not taken into account.

+

References

+

clang.llvm.org

]]> +
+ INFO + CODE_SMELL +
bugprone-unhandled-self-assignment bugprone-unhandled-self-assignment @@ -3176,7 +3426,7 @@ public:

Options

CheckedFunctions

-

Semicolon-separated list of functions to check. Defaults to ::std::async;::std::launder;::std::remove;::std::remove_if;::std::unique;::std::unique_ptr::release;::std::basic_string::empty;::std::vector::empty. This means that the calls to following functions are checked by default:

+

Semicolon-separated list of functions to check. The function is checked if the name and scope matches, with any arguments. By default the following functions are checked: std::async, std::launder, std::remove, std::remove_if, std::unique, std::unique_ptr::release, std::basic_string::empty, std::vector::empty, std::back_inserter, std::distance, std::find, std::find_if, std::inserter, std::lower_bound, std::make_pair, std::map::count, std::map::find, std::map::lower_bound, std::multimap::equal_range, std::multimap::upper_bound, std::set::count, std::set::find, std::setfill, std::setprecision, std::setw, std::upper_bound, std::vector::at, bsearch, ferror, feof, isalnum, isalpha, isblank, iscntrl, isdigit, isgraph, islower, isprint, ispunct, isspace, isupper, iswalnum, iswprint, iswspace, isxdigit, memchr, memcmp, strcmp, strcoll, strncmp, strpbrk, strrchr, strspn, strstr, wcscmp, access, bind, connect, difftime, dlsym, fnmatch, getaddrinfo, getopt, htonl, htons, iconv_open, inet_addr, isascii, isatty, mmap, newlocale, openat, pathconf, pthread_equal, pthread_getspecific, pthread_mutex_trylock, readdir, readlink, recvmsg, regexec, scandir, semget, setjmp, shm_open, shmget, sigismember, strcasecmp, strsignal, ttyname

  • std::async(). Not using the return value makes the call synchronous.
  • std::launder(). Not using the return value usually means that the function interface was misunderstood by the programmer. Only the returned pointer is "laundered", not the argument.
  • @@ -3318,14 +3568,14 @@ s.i = 99;

clang-tidy - bugprone-virtual-near-miss

bugprone-virtual-near-miss

-

Warn if a function is a near miss (ie. the name is very similar and the function signature is the same) to a virtual function from a base class.

+

Warn if a function is a near miss (i.e. the name is very similar and the function signature is the same) to a virtual function from a base class.

Example:

struct Base {
   virtual void func();
 };
 
 struct Derived : Base {
-  virtual funk();
+  virtual void funk();
   // warning: 'Derived::funk' has a similar name and the same signature as virtual method 'Base::func'; did you mean to override it?
 };

References

@@ -3680,6 +3930,20 @@ void func(const char *buff) { LINEAR 5min
+ + cert-exp42-c + cert-exp42-c + + + +

cert-exp42-c

+

The cert-exp42-c check is an alias, please see bugprone-suspicious-memory-comparison for more information.

+

References

+

clang.llvm.org

]]> +
+ INFO + CODE_SMELL +
cert-fio38-c cert-fio38-c @@ -3718,6 +3982,20 @@ void func(const char *buff) { LINEAR 5min + + cert-flp37-c + cert-flp37-c + + + +

cert-flp37-c

+

The cert-flp37-c check is an alias, please see bugprone-suspicious-memory-comparison for more information.

+

References

+

clang.llvm.org

]]> +
+ INFO + CODE_SMELL +
cert-mem57-cpp cert-mem57-cpp @@ -3873,15 +4151,15 @@ void func(const char *buff) {

Options

MemSetNames

-

Specify extra functions to flag that act similarily to memset. Specify names in a semicolon delimited list. Default is an empty string. The check will detect the following functions: memset, std::memset.

+

Specify extra functions to flag that act similarly to memset. Specify names in a semicolon delimited list. Default is an empty string. The check will detect the following functions: memset, std::memset.

MemCpyNames

-

Specify extra functions to flag that act similarily to memcpy. Specify names in a semicolon delimited list. Default is an empty string. The check will detect the following functions: std::memcpy, memcpy, std::memmove, memmove, std::strcpy, strcpy, memccpy, stpncpy, strncpy.

+

Specify extra functions to flag that act similarly to memcpy. Specify names in a semicolon delimited list. Default is an empty string. The check will detect the following functions: std::memcpy, memcpy, std::memmove, memmove, std::strcpy, strcpy, memccpy, stpncpy, strncpy.

MemCmpNames

-

Specify extra functions to flag that act similarily to memcmp. Specify names in a semicolon delimited list. Default is an empty string. The check will detect the following functions: std::memcmp, memcmp, std::strcmp, strcmp, strncmp.

+

Specify extra functions to flag that act similarly to memcmp. Specify names in a semicolon delimited list. Default is an empty string. The check will detect the following functions: std::memcmp, memcmp, std::strcmp, strcmp, strncmp.

This check corresponds to the CERT C++ Coding Standard rule OOP57-CPP. Prefer special member functions and overloaded operators to C Standard Library functions.

References

@@ -5651,7 +5929,7 @@ private:

clang-tidy - cppcoreguidelines-init-variables

cppcoreguidelines-init-variables

-

Checks whether there are local variables that are declared without an initial value. These may lead to unexpected behaviour if there is a code path that reads the variable before assigning to it.

+

Checks whether there are local variables that are declared without an initial value. These may lead to unexpected behavior if there is a code path that reads the variable before assigning to it.

Only integers, booleans, floats, doubles and pointers are checked. The fix option initializes all detected values with the value of zero. An exception is float and double types, which are initialized to NaN.

As an example a function that looks like this:

void function() {
@@ -5671,6 +5949,17 @@ void function() {
 
   // Rest of the function.
 }
+

It warns for the uninitialized enum case, but without a FixIt:

+
enum A {A1, A2, A3};
+enum A_c : char { A_c1, A_c2, A_c3 };
+enum class B { B1, B2, B3 };
+enum class B_i : int { B_i1, B_i2, B_i3 };
+void function() {
+  A a;     // Warning: variable 'a' is not initialized
+  A_c a_c; // Warning: variable 'a_c' is not initialized
+  B b;     // Warning: variable 'b' is not initialized
+  B_i b_i; // Warning: variable 'b_i' is not initialized
+}

Options

IncludeStyle

@@ -5750,7 +6039,7 @@ void function() {
We enforce only part of the guideline, more specifically, we flag narrowing conversions from:
    -
  • an integer to a narrower integer (e.g. char to unsigned char),
  • +
  • an integer to a narrower integer (e.g. char to unsigned char) if WarnOnIntegerNarrowingConversion Option is set,
  • an integer to a narrower floating-point (e.g. uint64_t to float),
  • a floating-point to an integer (e.g. double to int),
  • a floating-point to a narrower floating-point (e.g. double to float) if WarnOnFloatingPointNarrowingConversion Option is set.
  • @@ -5765,10 +6054,26 @@ void function() {

Options

+

WarnOnIntegerNarrowingConversion

+

When true, the check will warn on narrowing integer conversion (e.g. int to size_t). true by default.

+
+

WarnOnFloatingPointNarrowingConversion

When true, the check will warn on narrowing floating point conversion (e.g. double to float). true by default.

+

WarnWithinTemplateInstantiation

+

When true, the check will warn on narrowing conversions within template instantiations. false by default.

+
+
+

WarnOnEquivalentBitWidth

+

When true, the check will warn on narrowing conversions that arise from casting between types of equivalent bit width. (e.g. int n = uint(0); or long long n = double(0);) true by default.

+
+
+

IgnoreConversionFromTypes

+

Narrowing conversions from any type in this semicolon-separated list will be ignored. This may be useful to weed out commonly occurring, but less commonly problematic assignments such as int n = std::vector<char>().size(); or int n = std::difference(it1, it2);. The default list is empty, but one suggested list for a legacy codebase would be size_t;ptrdiff_t;size_type;difference_type.

+
+

PedanticMode

When true, the check will warn on assigning a floating point constant to an integer value even if the floating point value is exactly representable in the destination type (e.g. int i = 1.0;). false by default.

@@ -6305,7 +6610,7 @@ use(d); // Slice.

AllowMissingMoveFunctionsWhenCopyIsDeleted

-

When set to true (default is false), this check doesn't flag classes which define deleted copy operations but don't define move operations. This flags is related to Google C++ Style Guide https://google.github.io/styleguide/cppguide.html#Copyable_Movable_Types. With this option enabled, the following class won't be flagged:

+

When set to true (default is false), this check doesn't flag classes which define deleted copy operations but don't define move operations. This flag is related to Google C++ Style Guide https://google.github.io/styleguide/cppguide.html#Copyable_Movable_Types. With this option enabled, the following class won't be flagged:

struct A {
   A(const A&) = delete;
   A& operator=(const A&) = delete;
@@ -6320,6 +6625,47 @@ use(d);  // Slice.
LINEAR 5min + + cppcoreguidelines-virtual-class-destructor + cppcoreguidelines-virtual-class-destructor + + +

clang-tidy - cppcoreguidelines-virtual-class-destructor

+
+

cppcoreguidelines-virtual-class-destructor

+

Finds virtual classes whose destructor is neither public and virtual nor protected and non-virtual. A virtual class's destructor should be specified in one of these ways to prevent undefined behavior.

+

This check implements C.35 from the CppCoreGuidelines.

+

Note that this check will diagnose a class with a virtual method regardless of whether the class is used as a base class or not.

+

Fixes are available for user-declared and implicit destructors that are either public and non-virtual or protected and virtual. No fixes are offered for private destructors. There, the decision whether to make them private and virtual or protected and non-virtual depends on the use case and is thus left to the user.

+

Example

+

For example, the following classes/structs get flagged by the check since they violate guideline C.35:

+
struct Foo {        // NOK, protected destructor should not be virtual
+  virtual void f();
+protected:
+  virtual ~Foo(){}
+};
+class Bar {         // NOK, public destructor should be virtual
+  virtual void f();
+public:
+  ~Bar(){}
+};
+

This would be rewritten to look like this:

+
struct Foo {        // OK, destructor is not virtual anymore
+  virtual void f();
+protected:
+  ~Foo(){}
+};
+class Bar {         // OK, destructor is now virtual
+  virtual void f();
+public:
+  virtual ~Bar(){}
+};
+

References

+

clang.llvm.org

]]> + + INFO + CODE_SMELL +
darwin-avoid-spinlock darwin-avoid-spinlock @@ -7027,7 +7373,7 @@ public: }; TYPED_TEST_SUITE(BarTest, BarTypes); -

For better consistency of user code, the check renames both virtual and non-virtual member functions with matching names in derived types. The check tries to provide a only warning when a fix cannot be made safely, as is the case with some template and macro uses.

+

For better consistency of user code, the check renames both virtual and non-virtual member functions with matching names in derived types. The check tries to provide only a warning when a fix cannot be made safely, as is the case with some template and macro uses.

References

clang.llvm.org

]]> @@ -7297,7 +7643,7 @@ void f3(enum Color c) { int i = 42; switch(i) { case 1: // do something here - default: // do somethe else here + default: // do something else here } // Should rather be the following: @@ -7385,7 +7731,7 @@ switch(i) {}

hicpp-no-assembler

Check for assembler statements. No fix is offered.

-

Inline assembler is forbidden by the High Intergrity C++ Coding Standard as it restricts the portability of code.

+

Inline assembler is forbidden by the High Integrity C++ Coding Standard as it restricts the portability of code.

References

clang.llvm.org

]]> @@ -7438,7 +7784,7 @@ switch(i) {}

clang-tidy - hicpp-signed-bitwise

hicpp-signed-bitwise

-

Finds uses of bitwise operations on signed integer types, which may lead to undefined or implementation defined behaviour.

+

Finds uses of bitwise operations on signed integer types, which may lead to undefined or implementation defined behavior.

The according rule is defined in the High Integrity C++ Standard, Section 5.6.1.

Options

@@ -8241,7 +8587,7 @@ void f(const int_ptr ptr) {

misc-static-assert

cert-dcl03-c redirects here as an alias for this check.

-

Replaces assert() with static_assert() if the condition is evaluatable at compile time.

+

Replaces assert() with static_assert() if the condition is evaluable at compile time.

The condition of static_assert() is evaluated at compile time which is safer and more efficient.

References

clang.llvm.org

]]> @@ -8262,11 +8608,11 @@ void f(const int_ptr ptr) {
Exceptions:
    -
  • Throwing string literals will not be flagged despite being a pointer. They are not susceptible to slicing and the usage of string literals is idomatic.
  • +
  • Throwing string literals will not be flagged despite being a pointer. They are not susceptible to slicing and the usage of string literals is idiomatic.
  • Catching character pointers (char, wchar_t, unicode character types) will not be flagged to allow catching sting literals.
  • Moved named values will not be flagged as not throwing an anonymous temporary. In this case we can be sure that the user knows that the object can't be accessed outside catch blocks handling the error.
  • Throwing function parameters will not be flagged as not throwing an anonymous temporary. This allows helper functions for throwing.
  • -
  • Re-throwing caught exception variables will not be flragged as not throwing an anonymous temporary. Although this can usually be done by just writing throw; it happens often enough in real code.
  • +
  • Re-throwing caught exception variables will not be flagged as not throwing an anonymous temporary. Although this can usually be done by just writing throw; it happens often enough in real code.
@@ -8329,6 +8675,11 @@ void f(const int_ptr ptr) {
std::unique_ptr<Foo> x, y;
 x.reset(y.release()); -> x = std::move(y);

If y is already rvalue, std::move() is not added. x and y can also be std::unique_ptr<Foo>*.

+

Options

+
+

IncludeStyle

+

A string specifying which include-style is used, llvm or google. Default is llvm.

+

References

clang.llvm.org

]]> @@ -8446,7 +8797,7 @@ int foo() { std::function<int(int,int)> ignore_args = [] { return add(2, 2); } return ignore_args(3, 3); } -

which will not compile, since the lambda does not contain an operator() that that accepts 2 arguments. With permissive parameter list, it instead generates

+

which will not compile, since the lambda does not contain an operator() that accepts 2 arguments. With permissive parameter list, it instead generates

int add(int x, int y) { return x + y; }
 int foo() {
   std::function<int(int,int)> ignore_args = [](auto&&...) { return add(2, 2); }
@@ -8732,7 +9083,7 @@ for (auto & elem : v)
 
 

MakeReverseRangeFunction

-

Specify the function used to reverse an iterator pair, the function should accept a class with rbegin and rend methods and return a class with begin and end methods methods that call the rbegin and rend methods respectively. Common examples are ranges::reverse_view and llvm::reverse. Default value is an empty string.

+

Specify the function used to reverse an iterator pair, the function should accept a class with rbegin and rend methods and return a class with begin and end methods that call the rbegin and rend methods respectively. Common examples are ranges::reverse_view and llvm::reverse. Default value is an empty string.

MakeReverseRangeHeader

@@ -8743,7 +9094,7 @@ for (auto & elem : v)

A string specifying which include-style is used, llvm or google. Default is llvm.

Limitations

-

There are certain situations where the tool may erroneously perform transformations that remove information and change semantics. Users of the tool should be aware of the behaviour and limitations of the check outlined by the cases below.

+

There are certain situations where the tool may erroneously perform transformations that remove information and change semantics. Users of the tool should be aware of the behavior and limitations of the check outlined by the cases below.

Comments inside loop headers

Comments inside the original loop header are ignored and deleted when transformed.

for (int i = 0; i < N; /* This will be deleted */ ++i) { }
@@ -8813,7 +9164,7 @@ for (vector<int>::iterator it = vec.begin(), e = vec.end(); it != e; ++it) } }

OpenMP

-

As range-based for loops are only available since OpenMP 5, this check should not been used on code with a compatibility requirements of OpenMP prior to version 5. It is intentional that this check does not make any attempts to exclude incorrect diagnostics on OpenMP for loops prior to OpenMP 5.

+

As range-based for loops are only available since OpenMP 5, this check should not be used on code with a compatibility requirement of OpenMP prior to version 5. It is intentional that this check does not make any attempts to exclude incorrect diagnostics on OpenMP for loops prior to OpenMP 5.

To prevent this check to be applied (and to break) OpenMP for loops but still be applied to non-OpenMP for loops the usage of NOLINT (see clang-tidy-nolint) on the specific for loops is recommended.

References

clang.llvm.org

]]> @@ -9016,7 +9367,7 @@ public: + C(std::string S) : S(std::move(S)) {} };
-

For more information about the pass-by-value idiom, read: Want Speed? Pass by Value.

+

For more information about the pass-by-value idiom, read: Want Speed? Pass by Value.

Options

@@ -9193,7 +9544,7 @@ void f() {

modernize-replace-disallow-copy-and-assign-macro

Finds macro expansions of DISALLOW_COPY_AND_ASSIGN(Type) and replaces them with a deleted copy constructor and a deleted assignment operator.

-

Before the delete keyword was introduced in C++11 it was common practice to declare a copy constructor and an assignment operator as a private members. This effectively makes them unusable to the public API of a class.

+

Before the delete keyword was introduced in C++11 it was common practice to declare a copy constructor and an assignment operator as private members. This effectively makes them unusable to the public API of a class.

With the advent of the delete keyword in C++11 we can abandon the private access of the copy constructor and the assignment operator and delete the methods entirely.

When running this check on a code like this:

class Foo {
@@ -9360,7 +9711,7 @@ for (auto I = my_container.begin(), E = my_container.end(); I != E; ++I) {
 }

The check will only replace iterator type-specifiers when all of the following conditions are satisfied:

    -
  • The iterator is for one of the standard container in std namespace: +
  • The iterator is for one of the standard containers in std namespace:
    • array
    • deque
    • @@ -9407,7 +9758,7 @@ __gnu_cxx::__normal_iterator<int*, std::vector> K = MyVec.begin();<
    • The initializer for the variable being declared is not a braced initializer list. Otherwise, use of auto would cause the type of the variable to be deduced as std::initializer_list.

    New expressions

    -

    Frequently, when a pointer is declared and initialized with new, the pointee type is written twice: in the declaration type and in the new expression. In this cases, the declaration type can be replaced with auto improving readability and maintainability.

    +

    Frequently, when a pointer is declared and initialized with new, the pointee type is written twice: in the declaration type and in the new expression. In this case, the declaration type can be replaced with auto improving readability and maintainability.

    TypeName *my_pointer = new TypeName(my_param);
     
     // becomes
    @@ -9425,7 +9776,7 @@ auto *my_pointer = new TypeName(my_param);
    auto *my_first_pointer = new TypeName, *my_second_pointer = new TypeName;

    Cast expressions

    -

    Frequently, when a variable is declared and initialized with a cast, the variable type is written twice: in the declaration type and in the cast expression. In this cases, the declaration type can be replaced with auto improving readability and maintainability.

    +

    Frequently, when a variable is declared and initialized with a cast, the variable type is written twice: in the declaration type and in the cast expression. In this case, the declaration type can be replaced with auto improving readability and maintainability.

    TypeName *my_pointer = static_cast<TypeName>(my_param);
     
     // becomes
    @@ -9552,7 +9903,7 @@ struct A {
     

    Options

    UseAssignment

    -

    If this option is set to true (default is false), the check will initialise members with an assignment. For example:

    +

    If this option is set to true (default is false), the check will initialize members with an assignment. For example:

    struct A {
       A() {}
    @@ -9782,8 +10133,8 @@ private:
     
    bool empty() const;
     bool empty(int i) const;

    transforms to:

    -
    [[nodiscard] bool empty() const;
    -[[nodiscard] bool empty(int i) const;
    +
    [[nodiscard]] bool empty() const;
    +[[nodiscard]] bool empty(int i) const;

    Options

    ReplacementString

    @@ -9878,7 +10229,7 @@ struct bar {

    clang-tidy - modernize-use-nullptr

    modernize-use-nullptr

    -

    The check converts the usage of null pointer constants (eg. NULL, 0) to use the new C++11 nullptr keyword.

    +

    The check converts the usage of null pointer constants (e.g. NULL, 0) to use the new C++11 nullptr keyword.

    Example

    void assignment() {
       char *a = NULL;
    @@ -10292,7 +10643,7 @@ MPI_Send(&buf, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);

    clang-tidy - objc-nsinvocation-argument-lifetime

    objc-nsinvocation-argument-lifetime

    -

    Finds calls to NSInvocation methods under ARC that don't have proper argument object lifetimes. When passing Objective-C objects as parameters to the NSInvocation methods getArgument:atIndex: and getReturnValue:, the values are copied by value into the argument pointer, which leads to to incorrect releasing behavior if the object pointers are not declared __unsafe_unretained.

    +

    Finds calls to NSInvocation methods under ARC that don't have proper argument object lifetimes. When passing Objective-C objects as parameters to the NSInvocation methods getArgument:atIndex: and getReturnValue:, the values are copied by value into the argument pointer, which leads to incorrect releasing behavior if the object pointers are not declared __unsafe_unretained.

    For code:

    id arg;
     [invocation getArgument:&arg atIndex:2];
    @@ -10365,7 +10716,7 @@ __unsafe_unretained id returnValue;
     
     

    openmp-exception-escape

    Analyzes OpenMP Structured Blocks and checks that no exception escapes out of the Structured Block it was thrown in.

    -

    As per the OpenMP specification, a structured block is an executable statement, possibly compound, with a single entry at the top and a single exit at the bottom. Which means, throw may not be used to to 'exit' out of the structured block. If an exception is not caught in the same structured block it was thrown in, the behaviour is undefined.

    +

    As per the OpenMP specification, a structured block is an executable statement, possibly compound, with a single entry at the top and a single exit at the bottom. Which means, throw may not be used to 'exit' out of the structured block. If an exception is not caught in the same structured block it was thrown in, the behavior is undefined.

    FIXME: this check does not model SEH, setjmp/longjmp.

    WARNING! This check may be expensive on large source files.

    Options

    @@ -10488,7 +10839,7 @@ str.find('A');

    AllowedTypes

    -

    A semicolon-separated list of names of types allowed to be copied in each iteration. Regular expressions are accepted, e.g. [Rr]ef(erence)?$ matches every type with suffix Ref, ref, Reference and reference. The default is empty.

    +

    A semicolon-separated list of names of types allowed to be copied in each iteration. Regular expressions are accepted, e.g. [Rr]ef(erence)?$ matches every type with suffix Ref, ref, Reference and reference. The default is empty. If a name in the list contains the sequence :: it is matched against the qualified typename (i.e. namespace::Type, otherwise it is matched against only the type name (i.e. Type).

    References

    clang.llvm.org

    ]]> @@ -10555,7 +10906,7 @@ for (const pair<int, vector<string>>& p : my_map) {}

    performance-inefficient-algorithm

    Warns on inefficient use of STL algorithms on associative containers.

    -

    Associative containers implements some of the algorithms as methods which should be preferred to the algorithms in the algorithm header. The methods can take advantage of the order of the elements.

    +

    Associative containers implement some of the algorithms as methods which should be preferred to the algorithms in the algorithm header. The methods can take advantage of the order of the elements.

    std::set<int> s;
     auto it = std::find(s.begin(), s.end(), 43);
     
    @@ -10859,7 +11210,7 @@ A::~A() = default;

    performance-type-promotion-in-math-fn

    Finds calls to C math library functions (from math.h or, in C++, cmath) with implicit float to double promotions.

    -

    For example, warns on ::sin(0.f), because this funciton's parameter is a double. You probably meant to call std::sin(0.f) (in C++), or sinf(0.f) (in C).

    +

    For example, warns on ::sin(0.f), because this function's parameter is a double. You probably meant to call std::sin(0.f) (in C++), or sinf(0.f) (in C).

    float a;
     asin(a);
     
    @@ -10907,7 +11258,11 @@ void Function(const Foo& foo) {
     

    Options

    AllowedTypes

    -

    A semicolon-separated list of names of types allowed to be initialized by copying. Regular expressions are accepted, e.g. [Rr]ef(erence)?$ matches every type with suffix Ref, ref, Reference and reference. The default is empty.

    +

    A semicolon-separated list of names of types allowed to be initialized by copying. Regular expressions are accepted, e.g. [Rr]ef(erence)?$ matches every type with suffix Ref, ref, Reference and reference. The default is empty. If a name in the list contains the sequence :: it is matched against the qualified typename (i.e. namespace::Type, otherwise it is matched against only the type name (i.e. Type).

    +
    +
    +

    ExcludedContainerTypes

    +

    A semicolon-separated list of names of types whose methods are allowed to return the const reference the variable is copied from. When an expensive to copy variable is copy initialized by the return value from a type on this list the check does not trigger. This can be used to exclude types known to be const incorrect or where the lifetime or immutability of returned references is not tied to mutations of the container. An example are view types that don't own the underlying data. Like for AllowedTypes above, regular expressions are accepted and the inclusion of :: determines whether the qualified typename is matched or not.

    References

    clang.llvm.org

    ]]> @@ -10960,7 +11315,7 @@ void setValue(string Value) {

    AllowedTypes

    -

    A semicolon-separated list of names of types allowed to be passed by value. Regular expressions are accepted, e.g. [Rr]ef(erence)?$ matches every type with suffix Ref, ref, Reference and reference. The default is empty.

    +

    A semicolon-separated list of names of types allowed to be passed by value. Regular expressions are accepted, e.g. [Rr]ef(erence)?$ matches every type with suffix Ref, ref, Reference and reference. The default is empty. If a name in the list contains the sequence :: it is matched against the qualified typename (i.e. namespace::Type, otherwise it is matched against only the type name (i.e. Type).

    References

    clang.llvm.org

    ]]> @@ -11158,6 +11513,22 @@ bool empty() const;
    INFO CODE_SMELL + + readability-data-pointer + readability-data-pointer + + +

    clang-tidy - readability-data-pointer

    + +

    readability-data-pointer

    +

    Finds cases where code could use data() rather than the address of the element at index 0 in a container. This pattern is commonly used to materialize a pointer to the backing data of a container. std::vector and std::string provide a data() accessor to retrieve the data pointer which should be preferred.

    +

    This also ensures that in the case that the container is empty, the data pointer access does not perform an errant memory access.

    +

    References

    +

    clang.llvm.org

    ]]> +
    + INFO + CODE_SMELL +
    readability-delete-null-pointer readability-delete-null-pointer @@ -11233,7 +11604,7 @@ if (p)

    WarnOnConditionVariables

    -

    When true, the check will attempt to refactor a variable defined inside the condition of the if statement that is used in the else branch defining them just before the if statement. This can only be done if the if statement is the last statement in its parents scope. Default value is true.

    +

    When true, the check will attempt to refactor a variable defined inside the condition of the if statement that is used in the else branch defining them just before the if statement. This can only be done if the if statement is the last statement in its parent's scope. Default value is true.

    LLVM alias

    There is an alias of this check called llvm-else-after-return. In that version the options WarnOnUnfixable and WarnOnConditionVariables are both set to false by default.

    @@ -11263,6 +11634,10 @@ if (p)

    DescribeBasicIncrements

    If set to true, then for each function exceeding the complexity threshold the check will issue additional diagnostics on every piece of code (loop, if statement, etc.) which contributes to that complexity. See also the examples below. Default is true.

    +
    +

    IgnoreMacros

    +

    If set to true, the check will ignore code inside macros. Note, that also any macro arguments are ignored, even if they should count to the complexity. As this might change in the future, this option isn't guaranteed to be forward-compatible. Default is false.

    +

    Building blocks

    There are three basic building blocks of a Cognitive Complexity metric:

    Increment

    @@ -11298,7 +11673,7 @@ if (p)

Nesting level

-

While by itself the nesting level not change the function's Cognitive Complexity metric, it is tracked, and is used by the next, third building block. The following structures increase the nesting level (by 1):

+

While by itself the nesting level does not change the function's Cognitive Complexity metric, it is tracked, and is used by the next, third building block. The following structures increase the nesting level (by 1):

  • Conditional operators:

    @@ -11432,6 +11807,93 @@ if (p) LINEAR 5min + + readability-identifier-length + readability-identifier-length + + +

    clang-tidy - readability-identifier-length

    + +

    readability-identifier-length

    +

    This check finds variables and function parameters whose length are too short. The desired name length is configurable.

    +

    Special cases are supported for loop counters and for exception variable names.

    +

    Options

    +

    The following options are described below:

    +
    +
      +
    • MinimumVariableNameLength, IgnoredVariableNames
    • +
    • MinimumParameterNameLength, IgnoredParameterNames
    • +
    • MinimumLoopCounterNameLength, IgnoredLoopCounterNames
    • +
    • MinimumExceptionNameLength, IgnoredExceptionVariableNames
    • +
    +
    +
    +

    MinimumVariableNameLength

    +

    All variables (other than loop counter, exception names and function parameters) are expected to have at least a length of MinimumVariableNameLength (default is 3). Setting it to 0 or 1 disables the check entirely.

    +
    int doubler(int x)   // warns that x is too short
    +{
    +   return 2 * x;
    +}
    +

    This check does not have any fix suggestions in the general case since variable names have semantic value.

    +
    +
    +

    IgnoredVariableNames

    +

    Specifies a regular expression for variable names that are to be ignored. The default value is empty, thus no names are ignored.

    +
    +
    +

    MinimumParameterNameLength

    +

    All function parameter names are expected to have a length of at least MinimumParameterNameLength (default is 3). Setting it to 0 or 1 disables the check entirely.

    +
    int i = 42;    // warns that 'i' is too short
    +

    This check does not have any fix suggestions in the general case since variable names have semantic value.

    +
    +
    +

    IgnoredParameterNames

    +

    Specifies a regular expression for parameters that are to be ignored. The default value is ^[n]$ for historical reasons.

    +
    +
    +

    MinimumLoopCounterNameLength

    +

    Loop counter variables are expected to have a length of at least MinimumLoopCounterNameLength characters (default is 2). Setting it to 0 or 1 disables the check entirely.

    +
    // This warns that 'q' is too short.
    +for (int q = 0; q < size; ++ q) {
    +   // ...
    +}
    +
    +
    +

    IgnoredLoopCounterNames

    +

    Specifies a regular expression for counter names that are to be ignored. The default value is ^[ijk_]$; the first three symbols for historical reasons and the last one since it is frequently used as a "don't care" value, specifically in tools such as Google Benchmark.

    +
    // This does not warn by default, for historical reasons.
    +for (int i = 0; i < size; ++ i) {
    +    // ...
    +}
    +
    +
    +

    MinimumExceptionNameLength

    +

    Exception clause variables are expected to have a length of at least MinimumExceptionNameLength (default is 2). Setting it to 0 or 1 disables the check entirely.

    +
    try {
    +    // ...
    +}
    +// This warns that 'e' is too short.
    +catch (const std::exception& x) {
    +    // ...
    +}
    +
    +
    +

    IgnoredExceptionVariableNames

    +

    Specifies a regular expression for exception variable names that are to be ignored. The default value is ^[e]$ mainly for historical reasons.

    +
    try {
    +    // ...
    +}
    +// This does not warn by default, for historical reasons.
    +catch (const std::exception& e) {
    +    // ...
    +}
    +
    +

    References

    +

    clang.llvm.org

    ]]> +
    + INFO + CODE_SMELL +
    readability-identifier-naming readability-identifier-naming @@ -11458,53 +11920,53 @@ if (p)

    Many configuration options are available, in order to be able to create different rules for different kinds of identifiers. In general, the rules are falling back to a more generic rule if the specific case is not configured.

    The naming of virtual methods is reported where they occur in the base class, but not where they are overridden, as it can't be fixed locally there. This also applies for pseudo-override patterns like CRTP.

    Options

    -

    The following options are describe below:

    +

    The following options are described below:

      -
    • AbstractClassCase, AbstractClassPrefix, AbstractClassSuffix, AbstractClassIgnoredRegexp
    • +
    • AbstractClassCase, AbstractClassPrefix, AbstractClassSuffix, AbstractClassIgnoredRegexp, AbstractClassHungarianPrefix
    • AggressiveDependentMemberLookup
    • -
    • ClassCase, ClassPrefix, ClassSuffix, ClassIgnoredRegexp
    • -
    • ClassConstantCase, ClassConstantPrefix, ClassConstantSuffix, ClassConstantIgnoredRegexp
    • -
    • ClassMemberCase, ClassMemberPrefix, ClassMemberSuffix, ClassMemberIgnoredRegexp
    • +
    • ClassCase, ClassPrefix, ClassSuffix, ClassIgnoredRegexp, ClassHungarianPrefix
    • +
    • ClassConstantCase, ClassConstantPrefix, ClassConstantSuffix, ClassConstantIgnoredRegexp, ClassConstantHungarianPrefix
    • +
    • ClassMemberCase, ClassMemberPrefix, ClassMemberSuffix, ClassMemberIgnoredRegexp, ClassMemberHungarianPrefix
    • ClassMethodCase, ClassMethodPrefix, ClassMethodSuffix, ClassMethodIgnoredRegexp
    • -
    • ConstantCase, ConstantPrefix, ConstantSuffix, ConstantIgnoredRegexp
    • -
    • ConstantMemberCase, ConstantMemberPrefix, ConstantMemberSuffix, ConstantMemberIgnoredRegexp
    • -
    • ConstantParameterCase, ConstantParameterPrefix, ConstantParameterSuffix, ConstantParameterIgnoredRegexp
    • -
    • ConstantPointerParameterCase, ConstantPointerParameterPrefix, ConstantPointerParameterSuffix, ConstantPointerParameterIgnoredRegexp
    • +
    • ConstantCase, ConstantPrefix, ConstantSuffix, ConstantIgnoredRegexp, ConstantHungarianPrefix
    • +
    • ConstantMemberCase, ConstantMemberPrefix, ConstantMemberSuffix, ConstantMemberIgnoredRegexp, ConstantMemberHungarianPrefix
    • +
    • ConstantParameterCase, ConstantParameterPrefix, ConstantParameterSuffix, ConstantParameterIgnoredRegexp, ConstantParameterHungarianPrefix
    • +
    • ConstantPointerParameterCase, ConstantPointerParameterPrefix, ConstantPointerParameterSuffix, ConstantPointerParameterIgnoredRegexp, ConstantPointerParameterHungarianPrefix
    • ConstexprFunctionCase, ConstexprFunctionPrefix, ConstexprFunctionSuffix, ConstexprFunctionIgnoredRegexp
    • ConstexprMethodCase, ConstexprMethodPrefix, ConstexprMethodSuffix, ConstexprMethodIgnoredRegexp
    • -
    • ConstexprVariableCase, ConstexprVariablePrefix, ConstexprVariableSuffix, ConstexprVariableIgnoredRegexp
    • +
    • ConstexprVariableCase, ConstexprVariablePrefix, ConstexprVariableSuffix, ConstexprVariableIgnoredRegexp, ConstexprVariableHungarianPrefix
    • EnumCase, EnumPrefix, EnumSuffix, EnumIgnoredRegexp
    • -
    • EnumConstantCase, EnumConstantPrefix, EnumConstantSuffix, EnumConstantIgnoredRegexp
    • +
    • EnumConstantCase, EnumConstantPrefix, EnumConstantSuffix, EnumConstantIgnoredRegexp, EnumConstantHungarianPrefix
    • FunctionCase, FunctionPrefix, FunctionSuffix, FunctionIgnoredRegexp
    • GetConfigPerFile
    • -
    • GlobalConstantCase, GlobalConstantPrefix, GlobalConstantSuffix, GlobalConstantIgnoredRegexp
    • -
    • GlobalConstantPointerCase, GlobalConstantPointerPrefix, GlobalConstantPointerSuffix, GlobalConstantPointerIgnoredRegexp
    • +
    • GlobalConstantCase, GlobalConstantPrefix, GlobalConstantSuffix, GlobalConstantIgnoredRegexp, GlobalConstantHungarianPrefix
    • +
    • GlobalConstantPointerCase, GlobalConstantPointerPrefix, GlobalConstantPointerSuffix, GlobalConstantPointerIgnoredRegexp, GlobalConstantPointerHungarianPrefix
    • GlobalFunctionCase, GlobalFunctionPrefix, GlobalFunctionSuffix, GlobalFunctionIgnoredRegexp
    • -
    • GlobalPointerCase, GlobalPointerPrefix, GlobalPointerSuffix, GlobalPointerIgnoredRegexp
    • -
    • GlobalVariableCase, GlobalVariablePrefix, GlobalVariableSuffix, GlobalVariableIgnoredRegexp
    • +
    • GlobalPointerCase, GlobalPointerPrefix, GlobalPointerSuffix, GlobalPointerIgnoredRegexp, GlobalPointerHungarianPrefix
    • +
    • GlobalVariableCase, GlobalVariablePrefix, GlobalVariableSuffix, GlobalVariableIgnoredRegexp, GlobalVariableHungarianPrefix
    • IgnoreMainLikeFunctions
    • InlineNamespaceCase, InlineNamespacePrefix, InlineNamespaceSuffix, InlineNamespaceIgnoredRegexp
    • -
    • LocalConstantCase, LocalConstantPrefix, LocalConstantSuffix, LocalConstantIgnoredRegexp
    • -
    • LocalConstantPointerCase, LocalConstantPointerPrefix, LocalConstantPointerSuffix, LocalConstantPointerIgnoredRegexp
    • -
    • LocalPointerCase, LocalPointerPrefix, LocalPointerSuffix, LocalPointerIgnoredRegexp
    • -
    • LocalVariableCase, LocalVariablePrefix, LocalVariableSuffix, LocalVariableIgnoredRegexp
    • +
    • LocalConstantCase, LocalConstantPrefix, LocalConstantSuffix, LocalConstantIgnoredRegexp, LocalConstantHungarianPrefix
    • +
    • LocalConstantPointerCase, LocalConstantPointerPrefix, LocalConstantPointerSuffix, LocalConstantPointerIgnoredRegexp, LocalConstantPointerHungarianPrefix
    • +
    • LocalPointerCase, LocalPointerPrefix, LocalPointerSuffix, LocalPointerIgnoredRegexp, LocalPointerHungarianPrefix
    • +
    • LocalVariableCase, LocalVariablePrefix, LocalVariableSuffix, LocalVariableIgnoredRegexp, LocalVariableHungarianPrefix
    • MacroDefinitionCase, MacroDefinitionPrefix, MacroDefinitionSuffix, MacroDefinitionIgnoredRegexp
    • -
    • MemberCase, MemberPrefix, MemberSuffix, MemberIgnoredRegexp
    • +
    • MemberCase, MemberPrefix, MemberSuffix, MemberIgnoredRegexp, MemberHungarianPrefix
    • MethodCase, MethodPrefix, MethodSuffix, MethodIgnoredRegexp
    • NamespaceCase, NamespacePrefix, NamespaceSuffix, NamespaceIgnoredRegexp
    • -
    • ParameterCase, ParameterPrefix, ParameterSuffix, ParameterIgnoredRegexp
    • +
    • ParameterCase, ParameterPrefix, ParameterSuffix, ParameterIgnoredRegexp, ParameterHungarianPrefix
    • ParameterPackCase, ParameterPackPrefix, ParameterPackSuffix, ParameterPackIgnoredRegexp
    • -
    • PointerParameterCase, PointerParameterPrefix, PointerParameterSuffix, PointerParameterIgnoredRegexp
    • -
    • PrivateMemberCase, PrivateMemberPrefix, PrivateMemberSuffix, PrivateMemberIgnoredRegexp
    • +
    • PointerParameterCase, PointerParameterPrefix, PointerParameterSuffix, PointerParameterIgnoredRegexp, PointerParameterHungarianPrefix
    • +
    • PrivateMemberCase, PrivateMemberPrefix, PrivateMemberSuffix, PrivateMemberIgnoredRegexp, PrivateMemberHungarianPrefix
    • PrivateMethodCase, PrivateMethodPrefix, PrivateMethodSuffix, PrivateMethodIgnoredRegexp
    • -
    • ProtectedMemberCase, ProtectedMemberPrefix, ProtectedMemberSuffix, ProtectedMemberIgnoredRegexp
    • +
    • ProtectedMemberCase, ProtectedMemberPrefix, ProtectedMemberSuffix, ProtectedMemberIgnoredRegexp, ProtectedMemberHungarianPrefix
    • ProtectedMethodCase, ProtectedMethodPrefix, ProtectedMethodSuffix, ProtectedMethodIgnoredRegexp
    • -
    • PublicMemberCase, PublicMemberPrefix, PublicMemberSuffix, PublicMemberIgnoredRegexp
    • +
    • PublicMemberCase, PublicMemberPrefix, PublicMemberSuffix, PublicMemberIgnoredRegexp, PublicMemberHungarianPrefix
    • PublicMethodCase, PublicMethodPrefix, PublicMethodSuffix, PublicMethodIgnoredRegexp
    • ScopedEnumConstantCase, ScopedEnumConstantPrefix, ScopedEnumConstantSuffix, ScopedEnumConstantIgnoredRegexp
    • -
    • StaticConstantCase, StaticConstantPrefix, StaticConstantSuffix, StaticConstantIgnoredRegexp
    • -
    • StaticVariableCase, StaticVariablePrefix, StaticVariableSuffix, StaticVariableIgnoredRegexp
    • +
    • StaticConstantCase, StaticConstantPrefix, StaticConstantSuffix, StaticConstantIgnoredRegexp, StaticConstantHungarianPrefix
    • +
    • StaticVariableCase, StaticVariablePrefix, StaticVariableSuffix, StaticVariableIgnoredRegexp, StaticVariableHungarianPrefix
    • StructCase, StructPrefix, StructSuffix, StructIgnoredRegexp
    • TemplateParameterCase, TemplateParameterPrefix, TemplateParameterSuffix, TemplateParameterIgnoredRegexp
    • TemplateTemplateParameterCase, TemplateTemplateParameterPrefix, TemplateTemplateParameterSuffix, TemplateTemplateParameterIgnoredRegexp
    • @@ -11513,7 +11975,7 @@ if (p)
    • TypeTemplateParameterCase, TypeTemplateParameterPrefix, TypeTemplateParameterSuffix, TypeTemplateParameterIgnoredRegexp
    • UnionCase, UnionPrefix, UnionSuffix, UnionIgnoredRegexp
    • ValueTemplateParameterCase, ValueTemplateParameterPrefix, ValueTemplateParameterSuffix, ValueTemplateParameterIgnoredRegexp
    • -
    • VariableCase, VariablePrefix, VariableSuffix, VariableIgnoredRegexp
    • +
    • VariableCase, VariablePrefix, VariableSuffix, VariableIgnoredRegexp, VariableHungarianPrefix
    • VirtualMethodCase, VirtualMethodPrefix, VirtualMethodSuffix, VirtualMethodIgnoredRegexp
    @@ -11533,12 +11995,17 @@ if (p)

    AbstractClassSuffix

    When defined, the check will ensure abstract class names will add the suffix with the given value (regardless of casing).

    +
    +

    AbstractClassHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • AbstractClassCase of lower_case
    • AbstractClassPrefix of pre_
    • AbstractClassSuffix of _post
    • +
    • AbstractClassHungarianPrefix of On

    Identifies and/or transforms abstract class names as follows:

    @@ -11614,12 +12081,17 @@ struct Derived : Base<T> {

    ClassSuffix

    When defined, the check will ensure class names will add the suffix with the given value (regardless of casing).

    +
    +

    ClassHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • ClassCase of lower_case
    • ClassPrefix of pre_
    • ClassSuffix of _post
    • +
    • ClassHungarianPrefix of On

    Identifies and/or transforms class names as follows:

    @@ -11651,12 +12123,17 @@ public:

    ClassConstantSuffix

    When defined, the check will ensure class constant names will add the suffix with the given value (regardless of casing).

    +
    +

    ClassConstantHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • ClassConstantCase of lower_case
    • ClassConstantPrefix of pre_
    • ClassConstantSuffix of _post
    • +
    • ClassConstantHungarianPrefix of On

    Identifies and/or transforms class constant names as follows:

    @@ -11686,12 +12163,17 @@ public:

    ClassMemberSuffix

    When defined, the check will ensure class member names will add the suffix with the given value (regardless of casing).

    +
    +

    ClassMemberHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • ClassMemberCase of lower_case
    • ClassMemberPrefix of pre_
    • ClassMemberSuffix of _post
    • +
    • ClassMemberHungarianPrefix of On

    Identifies and/or transforms class member names as follows:

    @@ -11756,12 +12238,17 @@ public:

    ConstantSuffix

    When defined, the check will ensure constant names will add the suffix with the given value (regardless of casing).

    +
    +

    ConstantHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • ConstantCase of lower_case
    • ConstantPrefix of pre_
    • ConstantSuffix of _post
    • +
    • ConstantHungarianPrefix of On

    Identifies and/or transforms constant names as follows:

    @@ -11785,12 +12272,17 @@ public:

    ConstantMemberSuffix

    When defined, the check will ensure constant member names will add the suffix with the given value (regardless of casing).

    +
    +

    ConstantMemberHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • ConstantMemberCase of lower_case
    • ConstantMemberPrefix of pre_
    • ConstantMemberSuffix of _post
    • +
    • ConstantMemberHungarianPrefix of On

    Identifies and/or transforms constant member names as follows:

    @@ -11818,12 +12310,17 @@ public:

    ConstantParameterSuffix

    When defined, the check will ensure constant parameter names will add the suffix with the given value (regardless of casing).

    +
    +

    ConstantParameterHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • ConstantParameterCase of lower_case
    • ConstantParameterPrefix of pre_
    • ConstantParameterSuffix of _post
    • +
    • ConstantParameterHungarianPrefix of On

    Identifies and/or transforms constant parameter names as follows:

    @@ -11847,12 +12344,17 @@ public:

    ConstantPointerParameterSuffix

    When defined, the check will ensure constant pointer parameter names will add the suffix with the given value (regardless of casing).

    +
    +

    ConstantPointerParameterHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • ConstantPointerParameterCase of lower_case
    • ConstantPointerParameterPrefix of pre_
    • ConstantPointerParameterSuffix of _post
    • +
    • ConstantPointerParameterHungarianPrefix of On

    Identifies and/or transforms constant pointer parameter names as follows:

    @@ -11940,12 +12442,17 @@ public:

    ConstexprVariableSuffix

    When defined, the check will ensure constexpr variable names will add the suffix with the given value (regardless of casing).

    +
    +

    ConstexprVariableHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • ConstexprVariableCase of lower_case
    • ConstexprVariablePrefix of pre_
    • ConstexprVariableSuffix of _post
    • +
    • ConstexprVariableHungarianPrefix of On

    Identifies and/or transforms constexpr variable names as follows:

    @@ -11998,12 +12505,17 @@ public:

    EnumConstantSuffix

    When defined, the check will ensure enumeration constant names will add the suffix with the given value (regardless of casing).

    +
    +

    EnumConstantHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • EnumConstantCase of lower_case
    • EnumConstantPrefix of pre_
    • EnumConstantSuffix of _post
    • +
    • EnumConstantHungarianPrefix of On

    Identifies and/or transforms enumeration constant names as follows:

    @@ -12060,12 +12572,17 @@ public:

    GlobalConstantSuffix

    When defined, the check will ensure global constant names will add the suffix with the given value (regardless of casing).

    +
    +

    GlobalConstantHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • GlobalConstantCase of lower_case
    • GlobalConstantPrefix of pre_
    • GlobalConstantSuffix of _post
    • +
    • GlobalConstantHungarianPrefix of On

    Identifies and/or transforms global constant names as follows:

    @@ -12089,12 +12606,17 @@ public:

    GlobalConstantPointerSuffix

    When defined, the check will ensure global constant pointer names will add the suffix with the given value (regardless of casing).

    +
    +

    GlobalConstantPointerHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • GlobalConstantPointerCase of lower_case
    • GlobalConstantPointerPrefix of pre_
    • GlobalConstantPointerSuffix of _post
    • +
    • GlobalConstantPointerHungarianPrefix of On

    Identifies and/or transforms global constant pointer names as follows:

    @@ -12147,12 +12669,17 @@ public:

    GlobalPointerSuffix

    When defined, the check will ensure global pointer names will add the suffix with the given value (regardless of casing).

    +
    +

    GlobalPointerHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • GlobalPointerCase of lower_case
    • GlobalPointerPrefix of pre_
    • GlobalPointerSuffix of _post
    • +
    • GlobalPointerHungarianPrefix of On

    Identifies and/or transforms global pointer names as follows:

    @@ -12176,12 +12703,17 @@ public:

    GlobalVariableSuffix

    When defined, the check will ensure global variable names will add the suffix with the given value (regardless of casing).

    +
    +

    GlobalVariableHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • GlobalVariableCase of lower_case
    • GlobalVariablePrefix of pre_
    • GlobalVariableSuffix of _post
    • +
    • GlobalVariableHungarianPrefix of On

    Identifies and/or transforms global variable names as follows:

    @@ -12246,12 +12778,17 @@ inline namespace pre_inlinenamespace_post {

    LocalConstantSuffix

    When defined, the check will ensure local constant names will add the suffix with the given value (regardless of casing).

    +
    +

    LocalConstantHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • LocalConstantCase of lower_case
    • LocalConstantPrefix of pre_
    • LocalConstantSuffix of _post
    • +
    • LocalConstantHungarianPrefix of On

    Identifies and/or transforms local constant names as follows:

    @@ -12275,12 +12812,17 @@ inline namespace pre_inlinenamespace_post {

    LocalConstantPointerSuffix

    When defined, the check will ensure local constant pointer names will add the suffix with the given value (regardless of casing).

    +
    +

    LocalConstantPointerHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • LocalConstantPointerCase of lower_case
    • LocalConstantPointerPrefix of pre_
    • LocalConstantPointerSuffix of _post
    • +
    • LocalConstantPointerHungarianPrefix of On

    Identifies and/or transforms local constant pointer names as follows:

    @@ -12304,12 +12846,17 @@ inline namespace pre_inlinenamespace_post {

    LocalPointerSuffix

    When defined, the check will ensure local pointer names will add the suffix with the given value (regardless of casing).

    +
    +

    LocalPointerHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • LocalPointerCase of lower_case
    • LocalPointerPrefix of pre_
    • LocalPointerSuffix of _post
    • +
    • LocalPointerHungarianPrefix of On

    Identifies and/or transforms local pointer names as follows:

    @@ -12341,12 +12888,17 @@ inline namespace pre_inlinenamespace_post {

    LocalVariableSuffix

    When defined, the check will ensure local variable names will add the suffix with the given value (regardless of casing).

    +
    +

    LocalVariableHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • LocalVariableCase of lower_case
    • LocalVariablePrefix of pre_
    • LocalVariableSuffix of _post
    • +
    • LocalVariableHungarianPrefix of On

    Identifies and/or transforms local variable names as follows:

    @@ -12400,12 +12952,17 @@ inline namespace pre_inlinenamespace_post {

    MemberSuffix

    When defined, the check will ensure member names will add the suffix with the given value (regardless of casing).

    +
    +

    MemberHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • MemberCase of lower_case
    • MemberPrefix of pre_
    • MemberSuffix of _post
    • +
    • MemberHungarianPrefix of On

    Identifies and/or transforms member names as follows:

    @@ -12499,12 +13056,17 @@ inline namespace pre_inlinenamespace_post {

    ParameterSuffix

    When defined, the check will ensure parameter names will add the suffix with the given value (regardless of casing).

    +
    +

    ParameterHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • ParameterCase of lower_case
    • ParameterPrefix of pre_
    • ParameterSuffix of _post
    • +
    • ParameterHungarianPrefix of On

    Identifies and/or transforms parameter names as follows:

    @@ -12561,12 +13123,17 @@ inline namespace pre_inlinenamespace_post {

    PointerParameterSuffix

    When defined, the check will ensure pointer parameter names will add the suffix with the given value (regardless of casing).

    +
    +

    PointerParameterHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • PointerParameterCase of lower_case
    • PointerParameterPrefix of pre_
    • PointerParameterSuffix of _post
    • +
    • PointerParameterHungarianPrefix of On

    Identifies and/or transforms pointer parameter names as follows:

    @@ -12590,12 +13157,17 @@ inline namespace pre_inlinenamespace_post {

    PrivateMemberSuffix

    When defined, the check will ensure private member names will add the suffix with the given value (regardless of casing).

    +
    +

    PrivateMemberHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • PrivateMemberCase of lower_case
    • PrivateMemberPrefix of pre_
    • PrivateMemberSuffix of _post
    • +
    • PrivateMemberHungarianPrefix of On

    Identifies and/or transforms private member names as follows:

    @@ -12660,12 +13232,17 @@ private:

    ProtectedMemberSuffix

    When defined, the check will ensure protected member names will add the suffix with the given value (regardless of casing).

    +
    +

    ProtectedMemberHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • ProtectedMemberCase of lower_case
    • ProtectedMemberPrefix of pre_
    • ProtectedMemberSuffix of _post
    • +
    • ProtectedMemberHungarianPrefix of On

    Identifies and/or transforms protected member names as follows:

    @@ -12730,12 +13307,17 @@ protected:

    PublicMemberSuffix

    When defined, the check will ensure public member names will add the suffix with the given value (regardless of casing).

    +
    +

    PublicMemberHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • PublicMemberCase of lower_case
    • PublicMemberPrefix of pre_
    • PublicMemberSuffix of _post
    • +
    • PublicMemberHungarianPrefix of On

    Identifies and/or transforms public member names as follows:

    @@ -12800,12 +13382,17 @@ public:

    ScopedEnumConstantSuffix

    When defined, the check will ensure scoped enum constant names will add the suffix with the given value (regardless of casing).

    +
    +

    ScopedEnumConstantHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • ScopedEnumConstantCase of lower_case
    • ScopedEnumConstantPrefix of pre_
    • ScopedEnumConstantSuffix of _post
    • +
    • ScopedEnumConstantHungarianPrefix of On

    Identifies and/or transforms enumeration constant names as follows:

    @@ -12829,12 +13416,17 @@ public:

    StaticConstantSuffix

    When defined, the check will ensure static constant names will add the suffix with the given value (regardless of casing).

    +
    +

    StaticConstantHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • StaticConstantCase of lower_case
    • StaticConstantPrefix of pre_
    • StaticConstantSuffix of _post
    • +
    • StaticConstantHungarianPrefix of On

    Identifies and/or transforms static constant names as follows:

    @@ -12858,12 +13450,17 @@ public:

    StaticVariableSuffix

    When defined, the check will ensure static variable names will add the suffix with the given value (regardless of casing).

    +
    +

    StaticVariableHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • StaticVariableCase of lower_case
    • StaticVariablePrefix of pre_
    • StaticVariableSuffix of _post
    • +
    • StaticVariableHungarianPrefix of On

    Identifies and/or transforms static variable names as follows:

    @@ -13137,12 +13734,17 @@ public:

    VariableSuffix

    When defined, the check will ensure variable names will add the suffix with the given value (regardless of casing).

    +
    +

    VariableHungarianPrefix

    +

    When enabled, the check ensures that the declared identifier will have a Hungarian notation prefix based on the declared type.

    +

    For example using values of:

    • VariableCase of lower_case
    • VariablePrefix of pre_
    • VariableSuffix of _post
    • +
    • VariableHungarianPrefix of On

    Identifies and/or transforms variable names as follows:

    @@ -13185,8 +13787,274 @@ public: public: virtual int pre_member_function_post(); }
    -

    References

    -

    clang.llvm.org

    ]]> +

    The default mapping table of Hungarian Notation

    +

    In Hungarian notation, a variable name starts with a group of lower-case letters which are mnemonics for the type or purpose of that variable, followed by whatever name the programmer has chosen; this last part is sometimes distinguished as the given name. The first character of the given name can be capitalized to separate it from the type indicators (see also CamelCase). Otherwise the case of this character denotes scope.

    +

    The following table is the default mapping table of Hungarian Notation which maps Decl to its prefix string. You can also have your own style in config file.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Primitive TypesMicrosoft data types
    +

    Type Prefix Type Prefix

    +
    Type Prefix
    ================= ============== ====================== ========================= ==============
    int8_t i8 signed int siBOOL b
    int16_t i16 signed short ssBOOLEAN b
    int32_t i32 signed short int ssiBYTE by
    int64_t i64 signed long long int slliCHAR c
    uint8_t u8 signed long long sllUCHAR uc
    uint16_t u16 signed long int sliSHORT s
    uint32_t u32 signed long slUSHORT us
    uint64_t u64 signed sWORD w
    char8_t c8 unsigned long long int ulliDWORD dw
    char16_t c16 unsigned long long ullDWORD32 dw32
    char32_t c32 unsigned long int uliDWORD64 dw64
    float f unsigned long ulLONG l
    double d unsigned short int usiULONG ul
    char c unsigned short usULONG32 ul32
    bool b unsigned int uiULONG64 ul64
    _Bool b unsigned uULONGLONG ull
    int i long long int lliHANDLE h
    size_t n long double ldINT i
    short s long long llINT8 i8
    signed i long int liINT16 i16
    unsigned u long lINT32 i32
    long l ptrdiff_t pINT64 i64
    long long llUINT ui
    unsigned long ulUINT8 u8
    long double ldUINT16 u16
    ptrdiff_t pUINT32 u32
    wchar_t wcUINT64 u64

    short int si short s

    PVOID p

    +

    There are more trivial options for Hungarian Notation:

    +
    +
    HungarianNotation.General.*
    +

    Options are not belonging to any specific Decl.

    +
    +
    HungarianNotation.CString.*
    +

    Options for NULL-terminated string.

    +
    +
    HungarianNotation.DerivedType.*
    +

    Options for derived types.

    +
    +
    HungarianNotation.PrimitiveType.*
    +

    Options for primitive types.

    +
    +
    HungarianNotation.UserDefinedType.*
    +

    Options for user-defined types.

    +
    +
    +

    Options for Hungarian Notation

    +
      +
    • HungarianNotation.General.TreatStructAsClass
    • +
    • HungarianNotation.DerivedType.Array
    • +
    • HungarianNotation.DerivedType.Pointer
    • +
    • HungarianNotation.DerivedType.FunctionPointer
    • +
    • HungarianNotation.CString.CharPrinter
    • +
    • HungarianNotation.CString.CharArray
    • +
    • HungarianNotation.CString.WideCharPrinter
    • +
    • HungarianNotation.CString.WideCharArray
    • +
    • HungarianNotation.PrimitiveType.*
    • +
    • HungarianNotation.UserDefinedType.*
    • +
    +
    +

    HungarianNotation.General.TreatStructAsClass

    +

    When defined, the check will treat naming of struct as a class. The default value is false.

    +
    +
    +

    HungarianNotation.DerivedType.Array

    +

    When defined, the check will ensure variable name will add the prefix with the given string. The default prefix is a.

    +
    +
    +

    HungarianNotation.DerivedType.Pointer

    +

    When defined, the check will ensure variable name will add the prefix with the given string. The default prefix is p.

    +
    +
    +

    HungarianNotation.DerivedType.FunctionPointer

    +

    When defined, the check will ensure variable name will add the prefix with the given string. The default prefix is fn.

    +
    +

    Before:

    +
    // Array
    +int DataArray[2] = {0};
    +// Pointer
    +void *DataBuffer = NULL;
    +// FunctionPointer
    +typedef void (*FUNC_PTR)();
    +FUNC_PTR FuncPtr = NULL;
    +

    After:

    +
    // Array
    +int aDataArray[2] = {0};
    +// Pointer
    +void *pDataBuffer = NULL;
    +// FunctionPointer
    +typedef void (*FUNC_PTR)();
    +FUNC_PTR fnFuncPtr = NULL;
    +
    +

    HungarianNotation.CString.CharPrinter

    +

    When defined, the check will ensure variable name will add the prefix with the given string. The default prefix is sz.

    +
    +
    +

    HungarianNotation.CString.CharArray

    +

    When defined, the check will ensure variable name will add the prefix with the given string. The default prefix is sz.

    +
    +
    +

    HungarianNotation.CString.WideCharPrinter

    +

    When defined, the check will ensure variable name will add the prefix with the given string. The default prefix is wsz.

    +
    +
    +

    HungarianNotation.CString.WideCharArray

    +

    When defined, the check will ensure variable name will add the prefix with the given string. The default prefix is wsz.

    +
    +

    Before:

    +
    // CharPrinter
    +const char *NamePtr = "Name";
    +// CharArray
    +const char NameArray[] = "Name";
    +// WideCharPrinter
    +const wchar_t *WideNamePtr = L"Name";
    +// WideCharArray
    +const wchar_t WideNameArray[] = L"Name";
    +

    After:

    +
    // CharPrinter
    +const char *szNamePtr = "Name";
    +// CharArray
    +const char szNameArray[] = "Name";
    +// WideCharPrinter
    +const wchar_t *wszWideNamePtr = L"Name";
    +// WideCharArray
    +const wchar_t wszWideNameArray[] = L"Name";
    +
    +

    HungarianNotation.PrimitiveType.*

    +

    When defined, the check will ensure variable name of involved primitive types will add the prefix with the given string. The default prefixes are defined in the default mapping table.

    +
    +
    +

    HungarianNotation.UserDefinedType.*

    +

    When defined, the check will ensure variable name of involved primitive types will add the prefix with the given string. The default prefixes are defined in the default mapping table.

    +
    +

    Before:

    +
    int8_t   ValueI8      = 0;
    +int16_t  ValueI16     = 0;
    +int32_t  ValueI32     = 0;
    +int64_t  ValueI64     = 0;
    +uint8_t  ValueU8      = 0;
    +uint16_t ValueU16     = 0;
    +uint32_t ValueU32     = 0;
    +uint64_t ValueU64     = 0;
    +float    ValueFloat   = 0.0;
    +double   ValueDouble  = 0.0;
    +ULONG    ValueUlong   = 0;
    +DWORD    ValueDword   = 0;
    +

    After:

    +
    int8_t   i8ValueI8    = 0;
    +int16_t  i16ValueI16  = 0;
    +int32_t  i32ValueI32  = 0;
    +int64_t  i64ValueI64  = 0;
    +uint8_t  u8ValueU8    = 0;
    +uint16_t u16ValueU16  = 0;
    +uint32_t u32ValueU32  = 0;
    +uint64_t u64ValueU64  = 0;
    +float    fValueFloat  = 0.0;
    +double   dValueDouble = 0.0;
    +ULONG    ulValueUlong = 0;
    +DWORD    dwValueDword = 0;
    +

    References

    +

    clang.llvm.org

    ]]> MINOR CODE_SMELL @@ -13452,7 +14320,7 @@ void macros() {

    Many coding guidelines advise replacing the magic values with symbolic constants to improve readability. Here are a few references:

      -
    • Rule ES.45: Avoid 'magic constants'; use symbolic constants in C++ Core Guidelines
    • +
    • Rule ES.45: Avoid "magic constants"; use symbolic constants in C++ Core Guidelines
    • Rule 5.1.1 Use symbolic names instead of literal values in code in High Integrity C++
    • Item 17 in "C++ Coding Standards: 101 Rules, Guidelines and Best Practices" by Herb Sutter and Andrei Alexandrescu
    • Chapter 17 in "Clean Code - A handbook of agile software craftsmanship." by Robert C. Martin
    • @@ -13849,7 +14717,7 @@ void f() { extern int X;

      becomes

      extern int X;
      -

      Such redundant declarations can be removed without changing program behaviour. They can for instance be unintentional left overs from previous refactorings when code has been moved around. Having redundant declarations could in worst case mean that there are typos in the code that cause bugs.

      +

      Such redundant declarations can be removed without changing program behavior. They can for instance be unintentional left overs from previous refactorings when code has been moved around. Having redundant declarations could in worst case mean that there are typos in the code that cause bugs.

      Normally the code can be automatically fixed, clang-tidy can remove the second declaration. However there are 2 cases when you need to fix the code manually:

      • When the declarations are in different header files;
      • @@ -13913,7 +14781,7 @@ private:

        IgnoreBaseInCopyConstructors

        Default is false.

        -

        When true, the check will ignore unnecessary base class initializations within copy constructors, since some compilers issue warnings/errors when base classes are not explicitly intialized in copy constructors. For example, gcc with -Wextra or -Werror=extra issues warning or error base class 'Bar' should be explicitly initialized in the copy constructor if Bar() were removed in the following example:

        +

        When true, the check will ignore unnecessary base class initializations within copy constructors, since some compilers issue warnings/errors when base classes are not explicitly initialized in copy constructors. For example, gcc with -Wextra or -Werror=extra issues warning or error base class 'Bar' should be explicitly initialized in the copy constructor if Bar() were removed in the following example:

        // Explicitly initializing member s and base class Bar is unnecessary.
         struct Foo : public Bar {
        @@ -14335,13 +15203,132 @@ if (0 != str1.compare(str2)) {
         // Use str1 == "foo" instead.
         if (str1.compare("foo") == 0) {
         }
        -

        The above code examples shows the list of if-statements that this check will give a warning for. All of them uses compare to check if equality or inequality of two strings instead of using the correct operators.

        +

        The above code examples show the list of if-statements that this check will give a warning for. All of them uses compare to check if equality or inequality of two strings instead of using the correct operators.

        References

        clang.llvm.org

        ]]> INFO CODE_SMELL + + readability-suspicious-call-argument + readability-suspicious-call-argument + + +

        clang-tidy - readability-suspicious-call-argument

        + +

        readability-suspicious-call-argument

        +

        Finds function calls where the arguments passed are provided out of order, based on the difference between the argument name and the parameter names of the function.

        +

        Given a function call f(foo, bar); and a function signature void f(T tvar, U uvar), the arguments foo and bar are swapped if foo (the argument name) is more similar to uvar (the other parameter) than tvar (the parameter it is currently passed to) and bar is more similar to tvar than uvar.

        +

        Warnings might indicate either that the arguments are swapped, or that the names' cross-similarity might hinder code comprehension.

        +

        Heuristics

        +

        The following heuristics are implemented in the check. If any of the enabled heuristics deem the arguments to be provided out of order, a warning will be issued.

        +

        The heuristics themselves are implemented by considering pairs of strings, and are symmetric, so in the following there is no distinction on which string is the argument name and which string is the parameter name.

        +

        Equality

        +

        The most trivial heuristic, which compares the two strings for case-insensitive equality.

        +

        Abbreviation

        +

        Common abbreviations can be specified which will deem the strings similar if the abbreviated and the abbreviation stand together. For example, if src is registered as an abbreviation for source, then the following code example will be warned about.

        +
        void foo(int source, int x);
        +foo(b, src);
        +

        The abbreviations to recognise can be configured with the Abbreviations<opt_Abbreviations> check option. This heuristic is case-insensitive.

        +

        Prefix

        +

        The prefix heuristic reports if one of the strings is a sufficiently long prefix of the other string, e.g. target to targetPtr. The similarity percentage is the length ratio of the prefix to the longer string, in the previous example, it would be 6 / 9 = 66.66...%.

        +

        This heuristic can be configured with bounds<opt_Bounds>. The default bounds are: below 25% dissimilar and above 30% similar. This heuristic is case-insensitive.

        +

        Suffix

        +

        Analogous to the Prefix heuristic. In the case of oldValue and value compared, the similarity percentage is 8 / 5 = 62.5%.

        +

        This heuristic can be configured with bounds<opt_Bounds>. The default bounds are: below 25% dissimilar and above 30% similar. This heuristic is case-insensitive.

        +

        Substring

        +

        The substring heuristic combines the prefix and the suffix heuristic, and tries to find the longest common substring in the two strings provided. The similarity percentage is the ratio of the found longest common substring against the longer of the two input strings. For example, given val and rvalue, the similarity is 3 / 6 = 50%. If no characters are common in the two string, 0%.

        +

        This heuristic can be configured with bounds<opt_Bounds>. The default bounds are: below 40% dissimilar and above 50% similar. This heuristic is case-insensitive.

        +

        Levenshtein distance (as Levenshtein)

        +

        The Levenshtein distance describes how many single-character changes (additions, changes, or removals) must be applied to transform one string into another.

        +

        The Levenshtein distance is translated into a similarity percentage by dividing it with the length of the longer string, and taking its complement with regards to 100%. For example, given something and anything, the distance is 4 edits, and the similarity percentage is 100% - 4 / 9 = 55.55...%.

        +

        This heuristic can be configured with bounds<opt_Bounds>. The default bounds are: below 50% dissimilar and above 66% similar. This heuristic is case-sensitive.

        +

        Jaro-Winkler distance (as JaroWinkler)

        +

        The Jaro-Winkler distance is an edit distance like the Levenshtein distance. It is calculated from the amount of common characters that are sufficiently close to each other in position, and to-be-changed characters. The original definition of Jaro has been extended by Winkler to weigh prefix similarities more. The similarity percentage is expressed as an average of the common and non-common characters against the length of both strings.

        +

        This heuristic can be configured with bounds<opt_Bounds>. The default bounds are: below 75% dissimilar and above 85% similar. This heuristic is case-insensitive.

        +

        Sorensen-Dice coefficient (as Dice)

        +

        The Sorensen-Dice coefficient was originally defined to measure the similarity of two sets. Formally, the coefficient is calculated by dividing 2 * #(intersection) with #(set1) + #(set2), where #() is the cardinality function of sets. This metric is applied to strings by creating bigrams (substring sequences of length 2) of the two strings and using the set of bigrams for the two strings as the two sets.

        +

        This heuristic can be configured with bounds<opt_Bounds>. The default bounds are: below 60% dissimilar and above 70% similar. This heuristic is case-insensitive.

        +

        Options

        +
        +

        MinimumIdentifierNameLength

        +

        Sets the minimum required length the argument and parameter names need to have. Names shorter than this length will be ignored. Defaults to 3.

        +
        +
        +
        +

        Abbreviations

        +

        For the Abbreviation heuristic (see here<abbreviation_heuristic>), this option configures the abbreviations in the "abbreviation=abbreviated_value" format. The option is a string, with each value joined by ";".

        +

        By default, the following abbreviations are set:

        +
        +
          +
        • addr=address
        • +
        • arr=array
        • +
        • attr=attribute
        • +
        • buf=buffer
        • +
        • cl=client
        • +
        • cnt=count
        • +
        • col=column
        • +
        • cpy=copy
        • +
        • dest=destination
        • +
        • dist=distance
        • +
        • dst=distance
        • +
        • elem=element
        • +
        • hght=height
        • +
        • i=index
        • +
        • idx=index
        • +
        • len=length
        • +
        • ln=line
        • +
        • lst=list
        • +
        • nr=number
        • +
        • num=number
        • +
        • pos=position
        • +
        • ptr=pointer
        • +
        • ref=reference
        • +
        • src=source
        • +
        • srv=server
        • +
        • stmt=statement
        • +
        • str=string
        • +
        • val=value
        • +
        • var=variable
        • +
        • vec=vector
        • +
        • wdth=width
        • +
        +
        +
        +
        +

        The configuration options for each implemented heuristic (see above) is constructed dynamically. In the following, <HeuristicName> refers to one of the keys from the heuristics implemented.

        +
        +

        <HeuristicName>

        +

        True or False, whether a particular heuristic, such as Equality or Levenshtein is enabled.

        +

        Defaults to True for every heuristic.

        +
        +
        +
        +

        <HeuristicName>DissimilarBelow, <HeuristicName>SimilarAbove

        +

        A value between 0 and 100, expressing a percentage. The bounds set what percentage of similarity the heuristic must deduce for the two identifiers to be considered similar or dissimilar by the check.

        +

        Given arguments arg1 and arg2 passed to param1 and param2, respectively, the bounds check is performed in the following way: If the similarity of the currently passed argument order (arg1 to param1) is below the DissimilarBelow threshold, and the similarity of the suggested swapped order (arg1 to param2) is above the SimilarAbove threshold, the swap is reported.

        +

        For the defaults of each heuristic, see above<heuristics>.

        +
        +
        +

        Name synthesis

        +

        When comparing the argument names and parameter names, the following logic is used to gather the names for comparison:

        +

        Parameter names are the identifiers as written in the source code.

        +

        Argument names are:

        +
        +
          +
        • If a variable is passed, the variable's name.
        • +
        • If a subsequent function call's return value is used as argument, the called function's name.
        • +
        • Otherwise, empty string.
        • +
        +
        +

        Empty argument or parameter names are ignored by the heuristics.

        +

        References

        +

        clang.llvm.org

        ]]> +
        + INFO + CODE_SMELL +
        readability-uniqueptr-delete-release readability-uniqueptr-delete-release @@ -14493,7 +15480,22 @@ Derived(); // and so temporary construction is okay - + + clang-diagnostic-aix-compat + clang-diagnostic-aix-compat + + Diagnostic text:

        +
          +
        • warning: #pragma align(packed) may not be compatible with objects generated with AIX XL C/C++
        • +
        • warning: requesting an alignment of 16 bytes or greater for struct members is not binary compatible with AIX XL 16.1 and older
        • +
        +

        References

        +

        Diagnostic flags in Clang

        ]]> +
        + INFO + CODE_SMELL +
        + clang-diagnostic-arc-non-pod-memaccess clang-diagnostic-arc-non-pod-memaccess @@ -14710,6 +15712,7 @@ Derived(); // and so temporary construction is okay
      • warning: assigning %select{field|instance variable}0 to itself
      • warning: base class %0 is uninitialized when used here to access %q1
      • warning: bitwise comparison always evaluates to %select{false|true}0
      • +
      • warning: bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 did you mean logical negation?
      • warning: bitwise or with non-zero value always evaluates to true
      • warning: block pointer variable %0 is %select{uninitialized|null}1 when captured by block
      • warning: calling '%0' with a nonzero argument is unsafe
      • @@ -14766,12 +15769,13 @@ Derived(); // and so temporary construction is okay
      • warning: implicit declaration of function %0 is invalid in C99
      • warning: implicitly declaring library function '%0' with type %1
      • warning: incomplete format specifier
      • +
      • warning: initializer order does not match the declaration order
      • warning: invalid conversion specifier '%0'
      • warning: invalid position specified for %select{field width|field precision}0
      • warning: ivar %0 which backs the property is not referenced in this property's accessor
      • warning: lambda capture %0 is not %select{used|required to be captured for this use}1
      • +
      • warning: left operand of comma operator has no effect
      • warning: length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier
      • -
      • warning: local variable %0 will be copied despite being %select{returned|thrown}1 by name
      • warning: logical not is only applied to the left hand side of this %select{comparison|bitwise operator}0
      • warning: loop variable %0 %diff{of type $ binds to a temporary constructed from type $|binds to a temporary constructed from a different type}1,2
      • warning: loop variable %0 creates a copy from type %1
      • @@ -14835,6 +15839,7 @@ Derived(); // and so temporary construction is okay
      • warning: unused variable %0
      • warning: unused variable %0
      • warning: use of __private_extern__ on a declaration may not produce external symbol private to the linkage unit and is deprecated
      • +
      • warning: use of bitwise '%0' with boolean operands
      • warning: use of unknown builtin %0
      • warning: using '%%P' format specifier without precision
      • warning: using '%0' format specifier annotation outside of os_log()/os_trace()
      • @@ -14845,6 +15850,7 @@ Derived(); // and so temporary construction is okay
      • warning: variable %0 is uninitialized when %select{used here|captured by block}1
      • warning: variable %0 is uninitialized when passed as a const reference argument here
      • warning: variable %0 is uninitialized when used within its own initialization
      • +
      • warning: variable %0 set but not used
      • warning: variable%select{s| %1|s %1 and %2|s %1, %2, and %3|s %1, %2, %3, and %4}0 used in loop condition not modified in loop body
      • warning: zero field width in scanf format string is unused
      @@ -14908,6 +15914,8 @@ Derived(); // and so temporary construction is okay
    • warning: array argument is too small; %select{contains %0 elements|is of size %0}2, callee requires at least %1
    • warning: array index %0 is before the beginning of the array
    • warning: array index %0 is past the end of the array (which contains %1 element%s2)
    • +
    • warning: array index %0 refers past the last possible element for an array in %1-bit address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)
    • +
    • warning: the pointer incremented by %0 refers past the last possible element for an array in %1-bit address space containing %2-bit (%3-byte) elements (max possible %4 element%s5)

    References

    Diagnostic flags in Clang

    ]]> @@ -14974,7 +15982,7 @@ Derived(); // and so temporary construction is okay
  • warning: %0 attribute ignored on a non-definition declaration
  • warning: %0 attribute ignored on inline function
  • warning: %0 attribute ignored when parsing type
  • -
  • warning: %0 attribute is deprecated and ignored in OpenCL version %1
  • +
  • warning: %0 attribute is deprecated and ignored in %1
  • warning: %0 attribute is ignored because there exists no call expression inside the statement
  • warning: %0 attribute isn't implemented by this Objective-C runtime
  • warning: %0 attribute only applies to %1
  • @@ -14986,6 +15994,7 @@ Derived(); // and so temporary construction is okay
  • warning: %0 attribute only applies to return values that are pointers or references
  • warning: %0 attribute only applies to%select{| constant}1 pointer arguments
  • warning: %0 calling convention is not supported %select{for this target|on variadic function|on constructor/destructor|on builtin function}1
  • +
  • warning: %0 currently has no effect on a using declaration
  • warning: %q0 redeclared inline; %1 attribute ignored
  • warning: %select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to functions that have %select{no parameters|a 'void' return type}1
  • warning: %select{alias|ifunc}1 will not be in section '%0' but in the same section as the %select{aliasee|resolver}2
  • @@ -15019,7 +16028,7 @@ Derived(); // and so temporary construction is okay
  • warning: __weak attribute cannot be specified on an automatic variable when ARC is not enabled
  • warning: attribute %0 after definition is ignored
  • warning: attribute %0 cannot be applied to %select{functions|Objective-C method}1 without return value
  • -
  • warning: attribute %0 has no effect when annotating an 'if constexpr' statement
  • +
  • warning: attribute %0 has no effect when annotating an 'if %select{constexpr|consteval}1' statement
  • warning: attribute %0 has no effect when annotating an infinite loop
  • warning: attribute %0 ignored, because it cannot be applied to a type
  • warning: attribute %0 ignored, because it cannot be applied to omitted return type
  • @@ -15039,6 +16048,7 @@ Derived(); // and so temporary construction is okay
  • warning: inheritance model ignored on %select{primary template|partial specialization}0
  • warning: qualifiers after comma in declarator list are ignored
  • warning: repeated RISC-V 'interrupt' attribute
  • +
  • warning: requested alignment is less than minimum alignment of %1 for type %0
  • warning: template parameter of a function template with the 'sycl_kernel' attribute cannot be a non-type template parameter
  • warning: transparent union definition must contain at least one field; transparent_union attribute ignored
  • warning: transparent_union attribute can only be applied to a union definition; attribute ignored
  • @@ -15107,6 +16117,7 @@ Derived(); // and so temporary construction is okay
  • warning: %select{|overriding }1method cannot be unavailable on %0 when %select{the protocol method it implements|its overridden method}1 is available
  • warning: %select{|overriding }4method %select{introduced after|deprecated before|obsoleted before}0 %select{the protocol method it implements|overridden method}4 on %1 (%2 vs. %3)
  • warning: 'unavailable' availability overrides all other availability information
  • +
  • warning: Fuchsia API Level prohibits specifying a minor or sub-minor version
  • warning: availability does not match previous declaration
  • warning: feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version %2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; attribute ignored
  • warning: ignoring availability attribute %select{on '+load' method|with constructor attribute|with destructor attribute}0
  • @@ -15121,16 +16132,16 @@ Derived(); // and so temporary construction is okay CODE_SMELL - clang-diagnostic-frame-larger-than= - clang-diagnostic-frame-larger-than= + clang-diagnostic-frame-larger-than + clang-diagnostic-frame-larger-than Diagnostic text:

    • warning: %0
    • -
    • warning: stack frame size of %0 bytes in %q1
    • +
    • warning: stack frame size (%0) exceeds limit (%1) in '%2'

    References

    -

    Diagnostic flags in Clang

    ]]> +

    Diagnostic flags in Clang

    ]]>
    INFO CODE_SMELL @@ -15235,6 +16246,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-attribute-warning + clang-diagnostic-attribute-warning + + Diagnostic text:

    +
      +
    • warning: call to %0 declared with 'warning' attribute: %1
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-bad-function-cast clang-diagnostic-bad-function-cast @@ -15339,6 +16364,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-bitwise-instead-of-logical + clang-diagnostic-bitwise-instead-of-logical + + Diagnostic text:

    +
      +
    • warning: use of bitwise '%0' with boolean operands
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-bitwise-op-parentheses clang-diagnostic-bitwise-op-parentheses @@ -15385,6 +16424,21 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-bool-operation + clang-diagnostic-bool-operation + + Diagnostic text:

    +
      +
    • warning: bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 did you mean logical negation?
    • +
    • warning: use of bitwise '%0' with boolean operands
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-builtin-macro-redefined clang-diagnostic-builtin-macro-redefined @@ -15601,7 +16655,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

      -
    • warning: %select{case value|enumerator value|non-type template argument|array size|constexpr if condition|explicit specifier argument}0 %select{cannot be narrowed from type %2 to %3|evaluates to %2, which cannot be narrowed to type %3}1
    • +
    • warning: %select{case value|enumerator value|non-type template argument|array size|explicit specifier argument|noexcept specifier argument}0 %select{cannot be narrowed from type %2 to %3|evaluates to %2, which cannot be narrowed to type %3}1
    • warning: %select{default construction|assignment}0 of lambda is incompatible with C++ standards before C++20
    • warning: %select{if|switch}0 initialization statements are incompatible with C++ standards before C++17
    • warning: '%0' is a keyword in C++11
    • @@ -15610,12 +16664,15 @@ Derived(); // and so temporary construction is okay
    • warning: 'begin' and 'end' returning different types (%0 and %1) is incompatible with C++ standards before C++17
    • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
    • warning: 'decltype(auto)' type specifier is incompatible with C++ standards before C++14
    • +
    • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
    • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
    • +
    • warning: alias declaration in this context is incompatible with C++ standards before C++2b
    • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
    • warning: by value capture of '*this' is incompatible with C++ standards before C++17
    • warning: class template argument deduction is incompatible with C++ standards before C++17%select{|; for compatibility, use explicit type name %1}0
    • warning: constant expression evaluates to %0 which cannot be narrowed to type %1
    • warning: constant expression evaluates to %0 which cannot be narrowed to type %1 in C++11
    • +
    • warning: consteval if is incompatible with C++ standards before C++2b
    • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
    • warning: constexpr function with no return statements is incompatible with C++ standards before C++14
    • warning: constexpr if is incompatible with C++ standards before C++17
    • @@ -15646,6 +16703,8 @@ Derived(); // and so temporary construction is okay
    • warning: inline variables are incompatible with C++ standards before C++17
    • warning: integer literal is too large to be represented in type 'long' and is subject to undefined behavior under C++98, interpreting as 'unsigned long'; this literal will %select{have type 'long long'|be ill-formed}0 in C++11 onwards
    • warning: integer literal is too large to be represented in type 'long', interpreting as 'unsigned long' per C++98; this literal will %select{have type 'long long'|be ill-formed}0 in C++11 onwards
    • +
    • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
    • +
    • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
    • warning: multiple return statements in constexpr function is incompatible with C++ standards before C++14
    • warning: nested namespace definition is incompatible with C++ standards before C++17
    • warning: non-constant-expression cannot be narrowed from type %0 to %1 in initializer list
    • @@ -15654,6 +16713,7 @@ Derived(); // and so temporary construction is okay
    • warning: non-type template parameters declared with %0 are incompatible with C++ standards before C++17
    • warning: pack expansion using declaration is incompatible with C++ standards before C++17
    • warning: pack fold expression is incompatible with C++ standards before C++17
    • +
    • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
    • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
    • warning: return type deduction is incompatible with C++ standards before C++14
    • warning: template template parameter using 'typename' is incompatible with C++ standards before C++17
    • @@ -15667,6 +16727,8 @@ Derived(); // and so temporary construction is okay
    • warning: use of right-shift operator ('>>') in template argument will require parentheses in C++11
    • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
    • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • +
    • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
    • +
    • warning: using enum declaration is incompatible with C++ standards before C++20
    • warning: variable declaration in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
    • warning: variable templates are incompatible with C++ standards before C++14
    • warning: virtual constexpr functions are incompatible with C++ standards before C++20
    • @@ -15699,7 +16761,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

        -
      • warning: %select{case value|enumerator value|non-type template argument|array size|constexpr if condition|explicit specifier argument}0 %select{cannot be narrowed from type %2 to %3|evaluates to %2, which cannot be narrowed to type %3}1
      • +
      • warning: %select{case value|enumerator value|non-type template argument|array size|explicit specifier argument|noexcept specifier argument}0 %select{cannot be narrowed from type %2 to %3|evaluates to %2, which cannot be narrowed to type %3}1
      • warning: %select{default construction|assignment}0 of lambda is incompatible with C++ standards before C++20
      • warning: %select{default construction|assignment}0 of lambda is incompatible with C++ standards before C++20
      • warning: %select{if|switch}0 initialization statements are incompatible with C++ standards before C++17
      • @@ -15714,8 +16776,12 @@ Derived(); // and so temporary construction is okay
      • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
      • warning: 'decltype(auto)' type specifier is incompatible with C++ standards before C++14
      • warning: 'decltype(auto)' type specifier is incompatible with C++ standards before C++14
      • +
      • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
      • +
      • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
      • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
      • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
      • +
      • warning: alias declaration in this context is incompatible with C++ standards before C++2b
      • +
      • warning: alias declaration in this context is incompatible with C++ standards before C++2b
      • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
      • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
      • warning: attributes on %select{a namespace|an enumerator}0 declaration are incompatible with C++ standards before C++17
      • @@ -15726,6 +16792,8 @@ Derived(); // and so temporary construction is okay
      • warning: class template argument deduction is incompatible with C++ standards before C++17%select{|; for compatibility, use explicit type name %1}0
      • warning: constant expression evaluates to %0 which cannot be narrowed to type %1
      • warning: constant expression evaluates to %0 which cannot be narrowed to type %1 in C++11
      • +
      • warning: consteval if is incompatible with C++ standards before C++2b
      • +
      • warning: consteval if is incompatible with C++ standards before C++2b
      • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
      • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
      • warning: constexpr function with no return statements is incompatible with C++ standards before C++14
      • @@ -15780,6 +16848,10 @@ Derived(); // and so temporary construction is okay
      • warning: integer literal is too large to be represented in type 'long' and is subject to undefined behavior under C++98, interpreting as 'unsigned long'; this literal will %select{have type 'long long'|be ill-formed}0 in C++11 onwards
      • warning: integer literal is too large to be represented in type 'long', interpreting as 'unsigned long' per C++98; this literal will %select{have type 'long long'|be ill-formed}0 in C++11 onwards
      • warning: invoking a pointer to a 'const &' member function on an rvalue is incompatible with C++ standards before C++20
      • +
      • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
      • +
      • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
      • +
      • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
      • +
      • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
      • warning: multiple return statements in constexpr function is incompatible with C++ standards before C++14
      • warning: multiple return statements in constexpr function is incompatible with C++ standards before C++14
      • warning: nested namespace definition is incompatible with C++ standards before C++17
      • @@ -15794,6 +16866,8 @@ Derived(); // and so temporary construction is okay
      • warning: pack expansion using declaration is incompatible with C++ standards before C++17
      • warning: pack fold expression is incompatible with C++ standards before C++17
      • warning: pack fold expression is incompatible with C++ standards before C++17
      • +
      • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
      • +
      • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
      • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
      • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
      • warning: return type deduction is incompatible with C++ standards before C++14
      • @@ -15817,6 +16891,10 @@ Derived(); // and so temporary construction is okay
      • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
      • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
      • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
      • +
      • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
      • +
      • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
      • +
      • warning: using enum declaration is incompatible with C++ standards before C++20
      • +
      • warning: using enum declaration is incompatible with C++ standards before C++20
      • warning: variable declaration in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
      • warning: variable declaration in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
      • warning: variable templates are incompatible with C++ standards before C++14
      • @@ -15894,7 +16972,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

          -
        • warning: %select{case value|enumerator value|non-type template argument|array size|constexpr if condition|explicit specifier argument}0 %select{cannot be narrowed from type %2 to %3|evaluates to %2, which cannot be narrowed to type %3}1
        • +
        • warning: %select{case value|enumerator value|non-type template argument|array size|explicit specifier argument|noexcept specifier argument}0 %select{cannot be narrowed from type %2 to %3|evaluates to %2, which cannot be narrowed to type %3}1
        • warning: constant expression evaluates to %0 which cannot be narrowed to type %1
        • warning: constant expression evaluates to %0 which cannot be narrowed to type %1 in C++11
        • warning: non-constant-expression cannot be narrowed from type %0 to %1 in initializer list
        • @@ -16013,10 +17091,13 @@ Derived(); // and so temporary construction is okay
        • warning: '<=>' operator is incompatible with C++ standards before C++20
        • warning: 'begin' and 'end' returning different types (%0 and %1) is incompatible with C++ standards before C++17
        • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
        • +
        • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
        • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
        • +
        • warning: alias declaration in this context is incompatible with C++ standards before C++2b
        • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
        • warning: by value capture of '*this' is incompatible with C++ standards before C++17
        • warning: class template argument deduction is incompatible with C++ standards before C++17%select{|; for compatibility, use explicit type name %1}0
        • +
        • warning: consteval if is incompatible with C++ standards before C++2b
        • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
        • warning: constexpr if is incompatible with C++ standards before C++17
        • warning: constexpr on lambda expressions is incompatible with C++ standards before C++17
        • @@ -16034,11 +17115,14 @@ Derived(); // and so temporary construction is okay
        • warning: initialized lambda capture packs are incompatible with C++ standards before C++20
        • warning: inline nested namespace definition is incompatible with C++ standards before C++20
        • warning: inline variables are incompatible with C++ standards before C++17
        • +
        • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
        • +
        • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
        • warning: nested namespace definition is incompatible with C++ standards before C++17
        • warning: non-type template parameter of type %0 is incompatible with C++ standards before C++20
        • warning: non-type template parameters declared with %0 are incompatible with C++ standards before C++17
        • warning: pack expansion using declaration is incompatible with C++ standards before C++17
        • warning: pack fold expression is incompatible with C++ standards before C++17
        • +
        • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
        • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
        • warning: template template parameter using 'typename' is incompatible with C++ standards before C++17
        • warning: unicode literals are incompatible with C++ standards before C++17
        • @@ -16046,6 +17130,8 @@ Derived(); // and so temporary construction is okay
        • warning: use of function template name with no prior function template declaration in function call with explicit template arguments is incompatible with C++ standards before C++20
        • warning: use of multiple declarators in a single using declaration is incompatible with C++ standards before C++17
        • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
        • +
        • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
        • +
        • warning: using enum declaration is incompatible with C++ standards before C++20
        • warning: virtual constexpr functions are incompatible with C++ standards before C++20

        References

        @@ -16070,8 +17156,12 @@ Derived(); // and so temporary construction is okay
      • warning: 'begin' and 'end' returning different types (%0 and %1) is incompatible with C++ standards before C++17
      • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
      • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
      • +
      • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
      • +
      • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
      • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
      • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
      • +
      • warning: alias declaration in this context is incompatible with C++ standards before C++2b
      • +
      • warning: alias declaration in this context is incompatible with C++ standards before C++2b
      • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
      • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
      • warning: attributes on %select{a namespace|an enumerator}0 declaration are incompatible with C++ standards before C++17
      • @@ -16079,6 +17169,8 @@ Derived(); // and so temporary construction is okay
      • warning: by value capture of '*this' is incompatible with C++ standards before C++17
      • warning: class template argument deduction is incompatible with C++ standards before C++17%select{|; for compatibility, use explicit type name %1}0
      • warning: class template argument deduction is incompatible with C++ standards before C++17%select{|; for compatibility, use explicit type name %1}0
      • +
      • warning: consteval if is incompatible with C++ standards before C++2b
      • +
      • warning: consteval if is incompatible with C++ standards before C++2b
      • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
      • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
      • warning: constexpr if is incompatible with C++ standards before C++17
      • @@ -16116,6 +17208,10 @@ Derived(); // and so temporary construction is okay
      • warning: inline variables are incompatible with C++ standards before C++17
      • warning: inline variables are incompatible with C++ standards before C++17
      • warning: invoking a pointer to a 'const &' member function on an rvalue is incompatible with C++ standards before C++20
      • +
      • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
      • +
      • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
      • +
      • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
      • +
      • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
      • warning: nested namespace definition is incompatible with C++ standards before C++17
      • warning: nested namespace definition is incompatible with C++ standards before C++17
      • warning: non-type template parameter of type %0 is incompatible with C++ standards before C++20
      • @@ -16126,6 +17222,8 @@ Derived(); // and so temporary construction is okay
      • warning: pack expansion using declaration is incompatible with C++ standards before C++17
      • warning: pack fold expression is incompatible with C++ standards before C++17
      • warning: pack fold expression is incompatible with C++ standards before C++17
      • +
      • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
      • +
      • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
      • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
      • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
      • warning: template template parameter using 'typename' is incompatible with C++ standards before C++17
      • @@ -16140,6 +17238,10 @@ Derived(); // and so temporary construction is okay
      • warning: use of multiple declarators in a single using declaration is incompatible with C++ standards before C++17
      • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
      • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
      • +
      • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
      • +
      • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
      • +
      • warning: using enum declaration is incompatible with C++ standards before C++20
      • +
      • warning: using enum declaration is incompatible with C++ standards before C++20
      • warning: virtual constexpr functions are incompatible with C++ standards before C++20
      • warning: virtual constexpr functions are incompatible with C++ standards before C++20
      @@ -16190,7 +17292,10 @@ Derived(); // and so temporary construction is okay
    • warning: '<=>' operator is incompatible with C++ standards before C++20
    • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
    • warning: 'register' storage class specifier is deprecated and incompatible with C++17
    • +
    • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
    • +
    • warning: alias declaration in this context is incompatible with C++ standards before C++2b
    • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
    • +
    • warning: consteval if is incompatible with C++ standards before C++2b
    • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
    • warning: constexpr union constructor that does not initialize any member is incompatible with C++ standards before C++20
    • warning: decomposition declaration declared %plural{1:'%1'|:with '%1' specifiers}0 is incompatible with C++ standards before C++20
    • @@ -16205,11 +17310,16 @@ Derived(); // and so temporary construction is okay
    • warning: initialized lambda capture packs are incompatible with C++ standards before C++20
    • warning: inline nested namespace definition is incompatible with C++ standards before C++20
    • warning: mangled name of %0 will change in C++17 due to non-throwing exception specification in function signature
    • +
    • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
    • +
    • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
    • warning: non-type template parameter of type %0 is incompatible with C++ standards before C++20
    • +
    • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
    • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
    • warning: uninitialized variable in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • warning: use of function template name with no prior function template declaration in function call with explicit template arguments is incompatible with C++ standards before C++20
    • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • +
    • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
    • +
    • warning: using enum declaration is incompatible with C++ standards before C++20
    • warning: virtual constexpr functions are incompatible with C++ standards before C++20

    References

    @@ -16245,8 +17355,14 @@ Derived(); // and so temporary construction is okay
  • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
  • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
  • warning: 'register' storage class specifier is deprecated and incompatible with C++17
  • +
  • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
  • +
  • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
  • +
  • warning: alias declaration in this context is incompatible with C++ standards before C++2b
  • +
  • warning: alias declaration in this context is incompatible with C++ standards before C++2b
  • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
  • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
  • +
  • warning: consteval if is incompatible with C++ standards before C++2b
  • +
  • warning: consteval if is incompatible with C++ standards before C++2b
  • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
  • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
  • warning: constexpr union constructor that does not initialize any member is incompatible with C++ standards before C++20
  • @@ -16275,8 +17391,14 @@ Derived(); // and so temporary construction is okay
  • warning: inline nested namespace definition is incompatible with C++ standards before C++20
  • warning: invoking a pointer to a 'const &' member function on an rvalue is incompatible with C++ standards before C++20
  • warning: mangled name of %0 will change in C++17 due to non-throwing exception specification in function signature
  • +
  • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
  • +
  • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
  • +
  • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
  • +
  • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
  • warning: non-type template parameter of type %0 is incompatible with C++ standards before C++20
  • warning: non-type template parameter of type %0 is incompatible with C++ standards before C++20
  • +
  • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
  • +
  • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
  • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
  • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
  • warning: uninitialized variable in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
  • @@ -16285,6 +17407,10 @@ Derived(); // and so temporary construction is okay
  • warning: use of function template name with no prior function template declaration in function call with explicit template arguments is incompatible with C++ standards before C++20
  • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
  • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
  • +
  • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
  • +
  • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
  • +
  • warning: using enum declaration is incompatible with C++ standards before C++20
  • +
  • warning: using enum declaration is incompatible with C++ standards before C++20
  • warning: virtual constexpr functions are incompatible with C++ standards before C++20
  • warning: virtual constexpr functions are incompatible with C++ standards before C++20
@@ -16313,11 +17439,14 @@ Derived(); // and so temporary construction is okay
  • warning: initialized lambda pack captures are a C++20 extension
  • warning: inline nested namespace definition is a C++20 extension
  • warning: invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension
  • +
  • warning: member using declaration naming a non-member enumerator is a C++20 extension
  • warning: range-based for loop initialization statements are a C++20 extension
  • warning: uninitialized variable in a constexpr %select{function|constructor}0 is a C++20 extension
  • warning: use of function template name with no prior declaration in function call with explicit template arguments is a C++20 extension
  • warning: use of the %0 attribute is a C++20 extension
  • warning: use of this statement in a constexpr %select{function|constructor}0 is a C++20 extension
  • +
  • warning: using declaration naming a scoped enumerator is a C++20 extension
  • +
  • warning: using enum declaration is a C++20 extension
  • References

    Diagnostic flags in Clang

    ]]> @@ -16335,8 +17464,11 @@ Derived(); // and so temporary construction is okay
  • warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior
  • warning: 'consteval' specifier is incompatible with C++ standards before C++20
  • warning: 'constinit' specifier is incompatible with C++ standards before C++20
  • +
  • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
  • warning: aggregate initialization of type %0 with user-declared constructors is incompatible with C++20
  • +
  • warning: alias declaration in this context is incompatible with C++ standards before C++2b
  • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
  • +
  • warning: consteval if is incompatible with C++ standards before C++2b
  • warning: this expression will be parsed as explicit(bool) in C++20
  • warning: type of UTF-8 string literal will change from array of const char to array of const char8_t in C++20
  • @@ -16356,9 +17488,15 @@ Derived(); // and so temporary construction is okay
  • warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior
  • warning: 'consteval' specifier is incompatible with C++ standards before C++20
  • warning: 'constinit' specifier is incompatible with C++ standards before C++20
  • +
  • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
  • +
  • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
  • warning: aggregate initialization of type %0 with user-declared constructors is incompatible with C++20
  • +
  • warning: alias declaration in this context is incompatible with C++ standards before C++2b
  • +
  • warning: alias declaration in this context is incompatible with C++ standards before C++2b
  • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
  • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
  • +
  • warning: consteval if is incompatible with C++ standards before C++2b
  • +
  • warning: consteval if is incompatible with C++ standards before C++2b
  • warning: this expression will be parsed as explicit(bool) in C++20
  • warning: type of UTF-8 string literal will change from array of const char to array of const char8_t in C++20
  • @@ -16388,7 +17526,11 @@ Derived(); // and so temporary construction is okay Diagnostic text:

      +
    • warning: 'size_t' suffix for literals is a C++2b extension
    • +
    • warning: alias declaration in this context is a C++2b extension
    • warning: an attribute specifier sequence in this position is a C++2b extension
    • +
    • warning: consteval if is a C++2b extension
    • +
    • warning: lambda without a parameter clause is a C++2b extension

    References

    Diagnostic flags in Clang

    ]]> @@ -16418,8 +17560,10 @@ Derived(); // and so temporary construction is okay
  • warning: 'decltype' type specifier is incompatible with C++98
  • warning: 'decltype(auto)' type specifier is incompatible with C++ standards before C++14
  • warning: 'nullptr' is incompatible with C++98
  • +
  • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
  • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
  • warning: C++11 attribute syntax is incompatible with C++98
  • +
  • warning: alias declaration in this context is incompatible with C++ standards before C++2b
  • warning: alias declarations are incompatible with C++98
  • warning: alignof expressions are incompatible with C++98
  • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
  • @@ -16428,6 +17572,7 @@ Derived(); // and so temporary construction is okay
  • warning: by value capture of '*this' is incompatible with C++ standards before C++17
  • warning: class template argument deduction is incompatible with C++ standards before C++17%select{|; for compatibility, use explicit type name %1}0
  • warning: consecutive right angle brackets are incompatible with C++98 (use '> >')
  • +
  • warning: consteval if is incompatible with C++ standards before C++2b
  • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
  • warning: constexpr function with no return statements is incompatible with C++ standards before C++14
  • warning: constexpr if is incompatible with C++ standards before C++17
  • @@ -16468,6 +17613,8 @@ Derived(); // and so temporary construction is okay
  • warning: lambda expressions are incompatible with C++98
  • warning: literal operators are incompatible with C++98
  • warning: local type %0 as template argument is incompatible with C++98
  • +
  • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
  • +
  • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
  • warning: multiple return statements in constexpr function is incompatible with C++ standards before C++14
  • warning: nested namespace definition is incompatible with C++ standards before C++17
  • warning: noexcept expressions are incompatible with C++98
  • @@ -16478,6 +17625,7 @@ Derived(); // and so temporary construction is okay
  • warning: non-type template parameters declared with %0 are incompatible with C++ standards before C++17
  • warning: pack expansion using declaration is incompatible with C++ standards before C++17
  • warning: pack fold expression is incompatible with C++ standards before C++17
  • +
  • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
  • warning: passing object of trivial but non-POD type %0 through variadic %select{function|block|method|constructor}1 is incompatible with C++98
  • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
  • warning: range-based for loop is incompatible with C++98
  • @@ -16509,7 +17657,8 @@ Derived(); // and so temporary construction is okay
  • warning: use of null pointer as non-type template argument is incompatible with C++98
  • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
  • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
  • -
  • warning: using this character in an identifier is incompatible with C++98
  • +
  • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
  • +
  • warning: using enum declaration is incompatible with C++ standards before C++20
  • warning: variable declaration in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
  • warning: variable templates are incompatible with C++ standards before C++14
  • warning: variadic templates are incompatible with C++98
  • @@ -16594,10 +17743,14 @@ Derived(); // and so temporary construction is okay
  • warning: 'decltype(auto)' type specifier is incompatible with C++ standards before C++14
  • warning: 'long long' is incompatible with C++98
  • warning: 'nullptr' is incompatible with C++98
  • +
  • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
  • +
  • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
  • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
  • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
  • warning: C++11 attribute syntax is incompatible with C++98
  • warning: C++98 requires newline at end of file
  • +
  • warning: alias declaration in this context is incompatible with C++ standards before C++2b
  • +
  • warning: alias declaration in this context is incompatible with C++ standards before C++2b
  • warning: alias declarations are incompatible with C++98
  • warning: alignof expressions are incompatible with C++98
  • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
  • @@ -16613,6 +17766,8 @@ Derived(); // and so temporary construction is okay
  • warning: class template argument deduction is incompatible with C++ standards before C++17%select{|; for compatibility, use explicit type name %1}0
  • warning: commas at the end of enumerator lists are incompatible with C++98
  • warning: consecutive right angle brackets are incompatible with C++98 (use '> >')
  • +
  • warning: consteval if is incompatible with C++ standards before C++2b
  • +
  • warning: consteval if is incompatible with C++ standards before C++2b
  • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
  • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
  • warning: constexpr function with no return statements is incompatible with C++ standards before C++14
  • @@ -16681,6 +17836,10 @@ Derived(); // and so temporary construction is okay
  • warning: lambda expressions are incompatible with C++98
  • warning: literal operators are incompatible with C++98
  • warning: local type %0 as template argument is incompatible with C++98
  • +
  • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
  • +
  • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
  • +
  • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
  • +
  • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
  • warning: multiple return statements in constexpr function is incompatible with C++ standards before C++14
  • warning: multiple return statements in constexpr function is incompatible with C++ standards before C++14
  • warning: nested namespace definition is incompatible with C++ standards before C++17
  • @@ -16697,6 +17856,8 @@ Derived(); // and so temporary construction is okay
  • warning: pack expansion using declaration is incompatible with C++ standards before C++17
  • warning: pack fold expression is incompatible with C++ standards before C++17
  • warning: pack fold expression is incompatible with C++ standards before C++17
  • +
  • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
  • +
  • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
  • warning: passing object of trivial but non-POD type %0 through variadic %select{function|block|method|constructor}1 is incompatible with C++98
  • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
  • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
  • @@ -16738,7 +17899,10 @@ Derived(); // and so temporary construction is okay
  • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
  • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
  • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
  • -
  • warning: using this character in an identifier is incompatible with C++98
  • +
  • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
  • +
  • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
  • +
  • warning: using enum declaration is incompatible with C++ standards before C++20
  • +
  • warning: using enum declaration is incompatible with C++ standards before C++20
  • warning: variable declaration in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
  • warning: variable declaration in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
  • warning: variable templates are incompatible with C++ standards before C++14
  • @@ -16928,11 +18092,16 @@ Derived(); // and so temporary construction is okay
  • warning: function try block in constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
  • warning: initialized lambda capture packs are incompatible with C++ standards before C++20
  • warning: inline nested namespace definition is incompatible with C++ standards before C++20
  • +
  • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
  • +
  • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
  • warning: non-type template parameter of type %0 is incompatible with C++ standards before C++20
  • +
  • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
  • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
  • warning: uninitialized variable in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
  • warning: use of function template name with no prior function template declaration in function call with explicit template arguments is incompatible with C++ standards before C++20
  • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
  • +
  • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
  • +
  • warning: using enum declaration is incompatible with C++ standards before C++20
  • warning: virtual constexpr functions are incompatible with C++ standards before C++20
  • References

    @@ -16964,11 +18133,16 @@ Derived(); // and so temporary construction is okay
  • warning: initialized lambda capture packs are incompatible with C++ standards before C++20
  • warning: inline nested namespace definition is incompatible with C++ standards before C++20
  • warning: invoking a pointer to a 'const &' member function on an rvalue is incompatible with C++ standards before C++20
  • +
  • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
  • +
  • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
  • warning: non-type template parameter of type %0 is incompatible with C++ standards before C++20
  • +
  • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
  • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
  • warning: uninitialized variable in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
  • warning: use of function template name with no prior function template declaration in function call with explicit template arguments is incompatible with C++ standards before C++20
  • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
  • +
  • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
  • +
  • warning: using enum declaration is incompatible with C++ standards before C++20
  • warning: virtual constexpr functions are incompatible with C++ standards before C++20
  • References

    @@ -16983,7 +18157,10 @@ Derived(); // and so temporary construction is okay Diagnostic text:

      +
    • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
    • +
    • warning: alias declaration in this context is incompatible with C++ standards before C++2b
    • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
    • +
    • warning: consteval if is incompatible with C++ standards before C++2b

    References

    Diagnostic flags in Clang

    ]]> @@ -16997,7 +18174,10 @@ Derived(); // and so temporary construction is okay Diagnostic text:

      +
    • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
    • +
    • warning: alias declaration in this context is incompatible with C++ standards before C++2b
    • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
    • +
    • warning: consteval if is incompatible with C++ standards before C++2b

    References

    Diagnostic flags in Clang

    ]]> @@ -17038,6 +18218,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-cast-function-type + clang-diagnostic-cast-function-type + + Diagnostic text:

    +
      +
    • warning: cast %diff{from $ to $ |}0,1converts to incompatible function type
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-cast-qual clang-diagnostic-cast-qual @@ -17390,7 +18584,7 @@ Derived(); // and so temporary construction is okay
  • warning: argument to '#pragma unroll' should not be in parentheses in CUDA C/C++
  • warning: ignored 'inline' attribute on kernel function %0
  • warning: kernel function %0 is a member function; this may not be accepted by nvcc
  • -
  • warning: nvcc does not allow '__%0__' to appear after '()' in lambdas
  • +
  • warning: nvcc does not allow '__%0__' to appear after the parameter list in lambdas
  • References

    Diagnostic flags in Clang

    ]]> @@ -17404,7 +18598,8 @@ Derived(); // and so temporary construction is okay Diagnostic text:

      -
    • warning: Unknown CUDA version. %0 Assuming the latest supported version %1
    • +
    • warning: CUDA version %0 is only partially supported
    • +
    • warning: CUDA version%0 is newer than the latest%select{| partially}1 supported version %2

    References

    Diagnostic flags in Clang

    ]]> @@ -17620,6 +18815,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

      +
    • warning: %0 does not support the option '%1'
    • warning: %0 is deprecated
    • warning: %0 is deprecated: %1
    • warning: %0 may be deprecated because the receiver type is unknown
    • @@ -17632,18 +18828,20 @@ Derived(); // and so temporary construction is okay
    • warning: 'register' storage class specifier is deprecated and incompatible with C++17
    • warning: -O4 is equivalent to -O3
    • warning: -fconcepts-ts is deprecated - use '-std=c++20' for Concepts support
    • -
    • warning: OpenCL version %0 does not support the option '%1'
    • warning: Use of 'long' with '__vector' is deprecated
    • warning: access declarations are deprecated; use using declarations instead
    • -
    • warning: argument '%0' is deprecated, use '%1' instead
    • +
    • warning: argument '%0' is deprecated%select{|, use '%2' instead}1
    • warning: comparison between two arrays is deprecated; to compare array addresses, use unary '+' to decay operands to pointers
    • warning: compound assignment to object of volatile-qualified type %0 is deprecated
    • warning: conversion from string literal to %0 is deprecated
    • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-declared copy %select{assignment operator|constructor}1
    • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-declared destructor
    • +
    • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-provided copy %select{assignment operator|constructor}1
    • +
    • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-provided destructor
    • warning: dynamic exception specifications are deprecated
    • warning: implicit capture of 'this' with a capture default of '=' is deprecated
    • warning: incrementing expression of type bool is deprecated and incompatible with C++17
    • +
    • warning: macro %0 has been marked as deprecated%select{|: %2}1
    • warning: out-of-line definition of constexpr static data member is redundant in C++17 and is deprecated
    • warning: property access is using %0 method which is deprecated
    • warning: specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead
    • @@ -17725,6 +18923,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

      • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-declared copy %select{assignment operator|constructor}1
      • +
      • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-provided copy %select{assignment operator|constructor}1

      References

      Diagnostic flags in Clang

      ]]> @@ -17733,15 +18932,44 @@ Derived(); // and so temporary construction is okay CODE_SMELL - clang-diagnostic-deprecated-copy-dtor - clang-diagnostic-deprecated-copy-dtor + clang-diagnostic-deprecated-copy-with-dtor + clang-diagnostic-deprecated-copy-with-dtor Diagnostic text:

      • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-declared destructor
      • +
      • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-provided destructor

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      + + clang-diagnostic-deprecated-copy-with-user-provided-copy + clang-diagnostic-deprecated-copy-with-user-provided-copy + + Diagnostic text:

      +
        +
      • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-provided copy %select{assignment operator|constructor}1
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      + + clang-diagnostic-deprecated-copy-with-user-provided-dtor + clang-diagnostic-deprecated-copy-with-user-provided-dtor + + Diagnostic text:

      +
        +
      • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-provided destructor
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL @@ -17879,6 +19107,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
      + + clang-diagnostic-deprecated-pragma + clang-diagnostic-deprecated-pragma + + Diagnostic text:

      +
        +
      • warning: macro %0 has been marked as deprecated%select{|: %2}1
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      clang-diagnostic-deprecated-register clang-diagnostic-deprecated-register @@ -17969,6 +19211,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-dllexport-explicit-instantiation-decl + clang-diagnostic-dllexport-explicit-instantiation-decl + + Diagnostic text:

      +
        +
      • warning: explicit instantiation declaration should not be 'dllexport'
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      clang-diagnostic-documentation clang-diagnostic-documentation @@ -18418,18 +19674,21 @@ Derived(); // and so temporary construction is okay
    • warning: '%0' qualifier on omitted return type %1 has no effect
    • warning: '%0' qualifier on reference type %1 has no effect
    • warning: '%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect
    • -
    • warning: '-fuse-ld=' taking a path is deprecated. Use '--ld-path=' instead
    • +
    • warning: '-fuse-ld=' taking a path is deprecated; use '--ld-path=' instead
    • warning: ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 lifetime qualifier on return type is ignored
    • warning: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension
    • warning: call to function without interrupt attribute could clobber interruptee's VFP registers
    • warning: comparison of integers of different signs: %0 and %1
    • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-declared copy %select{assignment operator|constructor}1
    • +
    • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-provided copy %select{assignment operator|constructor}1
    • warning: empty initialization statement of '%select{if|switch|range-based for}0' has no effect
    • warning: initializer %select{partially |}0overrides prior initialization of this subobject
    • warning: initializer %select{partially |}0overrides prior initialization of this subobject
    • warning: method has no return type specified; defaults to 'id'
    • warning: missing field %0 initializer
    • +
    • warning: parameter %0 set but not used
    • warning: performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0
    • +
    • warning: performing pointer subtraction with a null pointer %select{has|may have}0 undefined behavior
    • warning: semicolon before method body is ignored
    • warning: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma?
    • warning: unused parameter %0
    • @@ -18493,7 +19752,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

        -
      • warning: '-fuse-ld=' taking a path is deprecated. Use '--ld-path=' instead
      • +
      • warning: '-fuse-ld=' taking a path is deprecated; use '--ld-path=' instead

      References

      Diagnostic flags in Clang

      ]]> @@ -18515,6 +19774,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
      + + clang-diagnostic-final-macro + clang-diagnostic-final-macro + + Diagnostic text:

      +
        +
      • warning: macro %0 has been marked as final and should not be %select{undefined|redefined}1
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      clang-diagnostic-flag-enum clang-diagnostic-flag-enum @@ -18803,6 +20076,7 @@ Derived(); // and so temporary construction is okay
    • warning: '%0' size argument is too large; destination buffer has size %1, but size argument is %2
    • warning: '%0' will always overflow; destination buffer has size %1, but format string expands to at least %2
    • warning: '%0' will always overflow; destination buffer has size %1, but size argument is %2
    • +
    • warning: '%0' will always overflow; destination buffer has size %1, but the source string has length %2 (including NUL byte)

    References

    Diagnostic flags in Clang

    ]]> @@ -19454,7 +20728,7 @@ Derived(); // and so temporary construction is okay
  • warning: %0 attribute ignored on a non-definition declaration
  • warning: %0 attribute ignored on inline function
  • warning: %0 attribute ignored when parsing type
  • -
  • warning: %0 attribute is deprecated and ignored in OpenCL version %1
  • +
  • warning: %0 attribute is deprecated and ignored in %1
  • warning: %0 attribute is ignored because there exists no call expression inside the statement
  • warning: %0 attribute isn't implemented by this Objective-C runtime
  • warning: %0 attribute only applies to %1
  • @@ -19466,6 +20740,7 @@ Derived(); // and so temporary construction is okay
  • warning: %0 attribute only applies to return values that are pointers or references
  • warning: %0 attribute only applies to%select{| constant}1 pointer arguments
  • warning: %0 calling convention is not supported %select{for this target|on variadic function|on constructor/destructor|on builtin function}1
  • +
  • warning: %0 currently has no effect on a using declaration
  • warning: %q0 redeclared inline; %1 attribute ignored
  • warning: %select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to functions that have %select{no parameters|a 'void' return type}1
  • warning: %select{alias|ifunc}1 will not be in section '%0' but in the same section as the %select{aliasee|resolver}2
  • @@ -19499,7 +20774,7 @@ Derived(); // and so temporary construction is okay
  • warning: __weak attribute cannot be specified on an automatic variable when ARC is not enabled
  • warning: attribute %0 after definition is ignored
  • warning: attribute %0 cannot be applied to %select{functions|Objective-C method}1 without return value
  • -
  • warning: attribute %0 has no effect when annotating an 'if constexpr' statement
  • +
  • warning: attribute %0 has no effect when annotating an 'if %select{constexpr|consteval}1' statement
  • warning: attribute %0 has no effect when annotating an infinite loop
  • warning: attribute %0 ignored, because it cannot be applied to a type
  • warning: attribute %0 ignored, because it cannot be applied to omitted return type
  • @@ -19519,6 +20794,7 @@ Derived(); // and so temporary construction is okay
  • warning: inheritance model ignored on %select{primary template|partial specialization}0
  • warning: qualifiers after comma in declarator list are ignored
  • warning: repeated RISC-V 'interrupt' attribute
  • +
  • warning: requested alignment is less than minimum alignment of %1 for type %0
  • warning: template parameter of a function template with the 'sycl_kernel' attribute cannot be a non-type template parameter
  • warning: transparent union definition must contain at least one field; transparent_union attribute ignored
  • warning: transparent_union attribute can only be applied to a union definition; attribute ignored
  • @@ -19587,7 +20863,6 @@ Derived(); // and so temporary construction is okay
  • warning: '#pragma comment %0' ignored
  • warning: '#pragma init_seg' is only supported when targeting a Microsoft environment
  • warning: '#pragma optimize' is not supported
  • -
  • warning: OpenCL extension end directive mismatches begin directive - ignoring
  • warning: expected #pragma pack parameter to be '1', '2', '4', '8', or '16'
  • warning: expected %select{'enable', 'disable', 'begin' or 'end'|'disable'}0 - ignoring
  • warning: expected '#pragma unused' argument to be a variable name
  • @@ -19607,6 +20882,7 @@ Derived(); // and so temporary construction is okay
  • warning: expected string literal in '#pragma %0' - ignoring
  • warning: extra tokens at end of '#pragma %0' - ignored
  • warning: incorrect use of #pragma clang force_cuda_host_device begin|end
  • +
  • warning: incorrect use of '#pragma fenv_access (on|off)' - ignored
  • warning: incorrect use of '#pragma ms_struct on|off' - ignored
  • warning: invalid alignment option in '#pragma %select{align|options align}0' - ignored
  • warning: invalid or unsupported rounding mode in '#pragma STDC FENV_ROUND' - ignored
  • @@ -19653,16 +20929,30 @@ Derived(); // and so temporary construction is okay CODE_SMELL
    - clang-diagnostic-implicit - clang-diagnostic-implicit + clang-diagnostic-ignored-reference-qualifiers + clang-diagnostic-ignored-reference-qualifiers Diagnostic text:

      -
    • warning: implicit declaration of function %0
    • -
    • warning: implicit declaration of function %0 is invalid in C99
    • -
    • warning: implicitly declaring library function '%0' with type %1
    • -
    • warning: type specifier missing, defaults to 'int'
    • -
    • warning: use of unknown builtin %0
    • +
    • warning: '%0' qualifier on reference type %1 has no effect
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    + + clang-diagnostic-implicit + clang-diagnostic-implicit + + Diagnostic text:

    +
      +
    • warning: implicit declaration of function %0
    • +
    • warning: implicit declaration of function %0 is invalid in C99
    • +
    • warning: implicitly declaring library function '%0' with type %1
    • +
    • warning: type specifier missing, defaults to 'int'
    • +
    • warning: use of unknown builtin %0

    References

    Diagnostic flags in Clang

    ]]> @@ -19721,7 +21011,6 @@ Derived(); // and so temporary construction is okay Diagnostic text:

      -
    • warning: fallthrough annotation in unreachable code
    • warning: unannotated fall-through between switch labels
    • warning: unannotated fall-through between switch labels in partly-annotated function
    @@ -20124,12 +21413,12 @@ Derived(); // and so temporary construction is okay Diagnostic text:

    • warning: ignoring extension '%0' because the '%1' architecture does not support it
    • -
    • warning: no MCU device specified, but '-mhwmult' is set to 'auto', assuming no hardware multiply. Use -mmcu to specify a MSP430 device, or -mhwmult to set hardware multiply type explicitly.
    • +
    • warning: no MCU device specified, but '-mhwmult' is set to 'auto', assuming no hardware multiply; use '-mmcu' to specify an MSP430 device, or '-mhwmult' to set the hardware multiply type explicitly
    • warning: optimization flag '%0' is not supported
    • warning: optimization flag '%0' is not supported for target '%1'
    • warning: optimization level '%0' is not supported; using '%1%2' instead
    • -
    • warning: the given MCU does not support hardware multiply, but -mhwmult is set to %0.
    • -
    • warning: the given MCU supports %0 hardware multiply, but -mhwmult is set to %1.
    • +
    • warning: the given MCU does not support hardware multiply, but '-mhwmult' is set to %0
    • +
    • warning: the given MCU supports %0 hardware multiply, but '-mhwmult' is set to %1
    • warning: the object size sanitizer has no effect at -O0, but is explicitly enabled: %0

    References

    @@ -20286,6 +21575,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-linker-warnings + clang-diagnostic-linker-warnings + + Diagnostic text:

    +
      +
    • warning: linking module '%0': %1
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-literal-conversion clang-diagnostic-literal-conversion @@ -20558,6 +21861,7 @@ Derived(); // and so temporary construction is okay
  • warning: %q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added
  • warning: %select{class template|class template partial|variable template|variable template partial|function template|member function|static data member|member class|member enumeration}0 specialization of %1 not in %select{a namespace enclosing %2|class %2 or an enclosing namespace}3 is a Microsoft extension
  • warning: %select{|pointer to |reference to }0incomplete type %1 is not allowed in exception specification
  • +
  • warning: 'abstract' keyword is a Microsoft extension
  • warning: 'mutable' on a reference type is a Microsoft extension
  • warning: 'sealed' keyword is a Microsoft extension
  • warning: 'static' can only be specified inside the class definition
  • @@ -20605,6 +21909,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-microsoft-abstract + clang-diagnostic-microsoft-abstract + + Diagnostic text:

    +
      +
    • warning: 'abstract' keyword is a Microsoft extension
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-microsoft-anon-tag clang-diagnostic-microsoft-anon-tag @@ -21276,6 +22594,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-module-lock + clang-diagnostic-module-lock + + Diagnostic text:

    +
      +
    • remark: locking '%0' to build module '%1'
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-most clang-diagnostic-most @@ -21321,6 +22653,7 @@ Derived(); // and so temporary construction is okay
  • warning: assigning %select{field|instance variable}0 to itself
  • warning: base class %0 is uninitialized when used here to access %q1
  • warning: bitwise comparison always evaluates to %select{false|true}0
  • +
  • warning: bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 did you mean logical negation?
  • warning: bitwise or with non-zero value always evaluates to true
  • warning: block pointer variable %0 is %select{uninitialized|null}1 when captured by block
  • warning: calling '%0' with a nonzero argument is unsafe
  • @@ -21375,12 +22708,13 @@ Derived(); // and so temporary construction is okay
  • warning: implicit declaration of function %0 is invalid in C99
  • warning: implicitly declaring library function '%0' with type %1
  • warning: incomplete format specifier
  • +
  • warning: initializer order does not match the declaration order
  • warning: invalid conversion specifier '%0'
  • warning: invalid position specified for %select{field width|field precision}0
  • warning: ivar %0 which backs the property is not referenced in this property's accessor
  • warning: lambda capture %0 is not %select{used|required to be captured for this use}1
  • +
  • warning: left operand of comma operator has no effect
  • warning: length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier
  • -
  • warning: local variable %0 will be copied despite being %select{returned|thrown}1 by name
  • warning: loop variable %0 %diff{of type $ binds to a temporary constructed from type $|binds to a temporary constructed from a different type}1,2
  • warning: loop variable %0 creates a copy from type %1
  • warning: method override for the designated initializer of the superclass %objcinstance0 not found
  • @@ -21436,6 +22770,7 @@ Derived(); // and so temporary construction is okay
  • warning: unused variable %0
  • warning: unused variable %0
  • warning: use of __private_extern__ on a declaration may not produce external symbol private to the linkage unit and is deprecated
  • +
  • warning: use of bitwise '%0' with boolean operands
  • warning: use of unknown builtin %0
  • warning: using '%%P' format specifier without precision
  • warning: using '%0' format specifier annotation outside of os_log()/os_trace()
  • @@ -21445,6 +22780,7 @@ Derived(); // and so temporary construction is okay
  • warning: variable %0 is uninitialized when %select{used here|captured by block}1
  • warning: variable %0 is uninitialized when passed as a const reference argument here
  • warning: variable %0 is uninitialized when used within its own initialization
  • +
  • warning: variable %0 set but not used
  • warning: variable%select{s| %1|s %1 and %2|s %1, %2, and %3|s %1, %2, %3, and %4}0 used in loop condition not modified in loop body
  • warning: zero field width in scanf format string is unused
  • @@ -21463,7 +22799,6 @@ Derived(); // and so temporary construction is okay Diagnostic text:

    • warning: explicitly moving variable of type %0 to itself
    • -
    • warning: local variable %0 will be copied despite being %select{returned|thrown}1 by name
    • warning: moving a local object in a return statement prevents copy elision
    • warning: moving a temporary object prevents copy elision
    • warning: redundant move in return statement
    • @@ -21818,6 +23153,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-null-pointer-subtraction + clang-diagnostic-null-pointer-subtraction + + Diagnostic text:

      +
        +
      • warning: performing pointer subtraction with a null pointer %select{has|may have}0 undefined behavior
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      clang-diagnostic-nullability clang-diagnostic-nullability @@ -22451,13 +23800,28 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-pedantic-core-features + clang-diagnostic-pedantic-core-features + + Diagnostic text:

      +
        +
      • warning: %0 is a core feature in %select{OpenCL C|C++ for OpenCL}1 version %2 but not supported on this target
      • +
      • warning: OpenCL extension %0 is core feature or supported optional core feature - ignoring
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      clang-diagnostic-opencl-unsupported-rgba clang-diagnostic-opencl-unsupported-rgba Diagnostic text:

        -
      • warning: vector component name '%0' is an OpenCL version 2.2 feature
      • +
      • warning: vector component name '%0' is a feature from OpenCL version 3.0 onwards

      References

      Diagnostic flags in Clang

      ]]> @@ -22478,8 +23842,8 @@ Derived(); // and so temporary construction is okay
    • warning: '%0' is not a valid context selector for the context set '%1'; selector ignored
    • warning: '%0' is not a valid context set in a `declare variant`; set ignored
    • warning: OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed
    • +
    • warning: OpenMP offloading target '%0' is similar to target '%1' already specified; will be ignored
    • warning: OpenMP only allows an ordered construct with the simd clause nested in a simd construct
    • -
    • warning: The OpenMP offloading target '%0' is similar to target '%1' already specified - will be ignored.
    • warning: Type %0 is not trivially copyable and not guaranteed to be mapped correctly
    • warning: Type %0 is not trivially copyable and not guaranteed to be mapped correctly
    • warning: aligned clause will be ignored because the requested alignment is not a power of 2
    • @@ -22495,6 +23859,7 @@ Derived(); // and so temporary construction is okay
    • warning: isa trait '%0' is not known to the current target; verify the spelling or consider restricting the context selector with the 'arch' selector further
    • warning: more than one 'device_type' clause is specified
    • warning: score expressions in the OpenMP context selector need to be constant; %0 is not and will be ignored
    • +
    • warning: specifying OpenMP directives with [[]] is an OpenMP 5.1 extension
    • warning: the context %select{set|selector|property}0 '%1' was used already in the same 'omp declare variant' directive; %select{set|selector|property}0 ignored
    • warning: the context property '%0' is not valid for the context selector '%1' and the context set '%2'; property ignored
    • warning: the context selector '%0' in context set '%1' requires a context property defined in parentheses; selector ignored
    • @@ -22511,6 +23876,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
      + + clang-diagnostic-openmp-51-extensions + clang-diagnostic-openmp-51-extensions + + Diagnostic text:

      +
        +
      • warning: specifying OpenMP directives with [[]] is an OpenMP 5.1 extension
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      clang-diagnostic-openmp-clauses clang-diagnostic-openmp-clauses @@ -22571,13 +23950,27 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-pre-openmp-51-compat + clang-diagnostic-pre-openmp-51-compat + + Diagnostic text:

      +
        +
      • warning: specifying OpenMP directives with [[]] is incompatible with OpenMP standards before OpenMP 5.1
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      clang-diagnostic-openmp-target clang-diagnostic-openmp-target Diagnostic text:

        -
      • warning: The OpenMP offloading target '%0' is similar to target '%1' already specified - will be ignored.
      • +
      • warning: OpenMP offloading target '%0' is similar to target '%1' already specified; will be ignored
      • warning: Type %0 is not trivially copyable and not guaranteed to be mapped correctly
      • warning: declaration is not declared in any declare target region
      • warning: declaration marked as declare target after first use, it may lead to incorrect results
      • @@ -22608,8 +24001,8 @@ Derived(); // and so temporary construction is okay Diagnostic text:

          -
        • warning: The '%0' architecture does not support -moutline-atomics; flag ignored
        • -
        • warning: The '%0' architecture does not support -moutline; flag ignored
        • +
        • warning: '%0' does not support '-moutline'; flag ignored
        • +
        • warning: '%0' does not support '-moutline-atomics'; flag ignored
        • warning: auto-vectorization requires HVX, use -mhvx to enable it
        • warning: ignoring '%0' option as it cannot be used with %select{implicit usage of|}1 -mabicalls and the N64 ABI
        • warning: ignoring '-mlong-calls' option as it is not currently supported with %select{|the implicit usage of }0-mabicalls
        • @@ -22623,6 +24016,21 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-ordered-compare-function-pointers + clang-diagnostic-ordered-compare-function-pointers + + Diagnostic text:

          +
            +
          • warning: ordered comparison of function pointers (%0 and %1)
          • +
          • warning: ordered comparison of function pointers (%0 and %1)
          • +
          +

          References

          +

          Diagnostic flags in Clang

          ]]> +
          + INFO + CODE_SMELL +
          clang-diagnostic-out-of-line-declaration clang-diagnostic-out-of-line-declaration @@ -22783,6 +24191,25 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-pedantic-macros + clang-diagnostic-pedantic-macros + + Diagnostic text:

          +
            +
          • warning: %0 macro redefined
          • +
          • warning: macro %0 has been marked as deprecated%select{|: %2}1
          • +
          • warning: macro %0 has been marked as final and should not be %select{undefined|redefined}1
          • +
          • warning: macro %0 has been marked as unsafe for use in headers%select{|: %2}1
          • +
          • warning: redefining builtin macro
          • +
          • warning: undefining builtin macro
          • +
          +

          References

          +

          Diagnostic flags in Clang

          ]]> +
          + INFO + CODE_SMELL +
          clang-diagnostic-pessimizing-move clang-diagnostic-pessimizing-move @@ -22972,7 +24399,6 @@ Derived(); // and so temporary construction is okay
        • warning: '#pragma comment %0' ignored
        • warning: '#pragma init_seg' is only supported when targeting a Microsoft environment
        • warning: '#pragma optimize' is not supported
        • -
        • warning: OpenCL extension end directive mismatches begin directive - ignoring
        • warning: angle-bracketed include <%0> cannot be aliased to double-quoted include "%1"
        • warning: double-quoted include "%0" cannot be aliased to angle-bracketed include <%1>
        • warning: expected #pragma pack parameter to be '1', '2', '4', '8', or '16'
        • @@ -22996,6 +24422,7 @@ Derived(); // and so temporary construction is okay
        • warning: expected string literal in '#pragma %0' - ignoring
        • warning: extra tokens at end of '#pragma %0' - ignored
        • warning: incorrect use of #pragma clang force_cuda_host_device begin|end
        • +
        • warning: incorrect use of '#pragma fenv_access (on|off)' - ignored
        • warning: incorrect use of '#pragma ms_struct on|off' - ignored
        • warning: invalid alignment option in '#pragma %select{align|options align}0' - ignored
        • warning: invalid or unsupported rounding mode in '#pragma STDC FENV_ROUND' - ignored
        • @@ -23309,6 +24736,7 @@ Derived(); // and so temporary construction is okay
          • warning: %select{field|base class}0 %1 will be initialized after %select{field|base}2 %3
          • warning: ISO C++ requires field designators to be specified in declaration order; field %1 will be initialized after field %0
          • +
          • warning: initializer order does not match the declaration order

          References

          Diagnostic flags in Clang

          ]]> @@ -23323,6 +24751,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

          • warning: %select{field|base class}0 %1 will be initialized after %select{field|base}2 %3
          • +
          • warning: initializer order does not match the declaration order

          References

          Diagnostic flags in Clang

          ]]> @@ -23344,6 +24773,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
          + + clang-diagnostic-reserved-macro-identifier + clang-diagnostic-reserved-macro-identifier + + Diagnostic text:

          +
            +
          • warning: macro name is a reserved identifier
          • +
          +

          References

          +

          Diagnostic flags in Clang

          ]]> +
          + INFO + CODE_SMELL +
          clang-diagnostic-reserved-id-macro clang-diagnostic-reserved-id-macro @@ -23358,6 +24801,21 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-reserved-identifier + clang-diagnostic-reserved-identifier + + Diagnostic text:

          +
            +
          • warning: identifier %0 is reserved because %select{<ERROR>|it starts with '_' at global scope|it starts with '_' and has C language linkage|it starts with '__'|it starts with '_' followed by a capital letter|it contains '__'}1
          • +
          • warning: macro name is a reserved identifier
          • +
          +

          References

          +

          Diagnostic flags in Clang

          ]]> +
          + INFO + CODE_SMELL +
          clang-diagnostic-reserved-user-defined-literal clang-diagnostic-reserved-user-defined-literal @@ -23376,6 +24834,20 @@ Derived(); // and so temporary construction is okay LINEAR 5min + + clang-diagnostic-restrict-expansion + clang-diagnostic-restrict-expansion + + Diagnostic text:

          +
            +
          • warning: macro %0 has been marked as unsafe for use in headers%select{|: %2}1
          • +
          +

          References

          +

          Diagnostic flags in Clang

          ]]> +
          + INFO + CODE_SMELL +
          clang-diagnostic-return-stack-address clang-diagnostic-return-stack-address @@ -23453,7 +24925,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

            -
          • remark: Generated arguments #%0 in round-trip: %1
          • +
          • remark: generated arguments #%0 in round-trip: %1

          References

          Diagnostic flags in Clang

          ]]> @@ -24224,6 +25696,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

          • warning: result of comparison %select{%3|%1}0 %2 %select{%1|%3}0 is always %4
          • +
          • warning: result of comparison of %select{%3|char expression}0 %2 %select{char expression|%3}0 is always %4, since char is interpreted as unsigned
          • warning: result of comparison of %select{%3|unsigned enum expression}0 %2 %select{unsigned enum expression|%3}0 is always %4
          • warning: result of comparison of %select{%3|unsigned expression}0 %2 %select{unsigned expression|%3}0 is always %4
          • warning: result of comparison of %select{%4|%sub{subst_int_range}1,2}0 %3 %select{%sub{subst_int_range}1,2|%4}0 is always %5
          • @@ -24320,6 +25793,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-tautological-unsigned-char-zero-compare + clang-diagnostic-tautological-unsigned-char-zero-compare + + Diagnostic text:

            +
              +
            • warning: result of comparison of %select{%3|char expression}0 %2 %select{char expression|%3}0 is always %4, since char is interpreted as unsigned
            • +
            +

            References

            +

            Diagnostic flags in Clang

            ]]> +
            + INFO + CODE_SMELL +
            clang-diagnostic-tautological-unsigned-enum-zero-compare clang-diagnostic-tautological-unsigned-enum-zero-compare @@ -24460,7 +25947,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

              -
            • warning: Thread safety beta warning.
            • +
            • warning: thread safety beta warning

            References

            Diagnostic flags in Clang

            ]]> @@ -24519,7 +26006,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

              -
            • warning: Thread safety verbose warning.
            • +
            • warning: thread safety verbose warning

            References

            Diagnostic flags in Clang

            ]]> @@ -24551,6 +26038,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

            • warning: result of comparison %select{%3|%1}0 %2 %select{%1|%3}0 is always %4
            • +
            • warning: result of comparison of %select{%3|char expression}0 %2 %select{char expression|%3}0 is always %4, since char is interpreted as unsigned
            • warning: result of comparison of %select{%3|unsigned enum expression}0 %2 %select{unsigned enum expression|%3}0 is always %4
            • warning: result of comparison of %select{%3|unsigned expression}0 %2 %select{unsigned expression|%3}0 is always %4
            @@ -24728,6 +26216,8 @@ Derived(); // and so temporary construction is okay Diagnostic text:

            • warning: \%0 used with no following hex digits; treating as '\' followed by identifier
            • +
            • warning: empty delimited universal character name; treating as '\' 'u' '{' '}'
            • +
            • warning: incomplete delimited universal character name; treating as '\' 'u' '{' identifier
            • warning: incomplete universal character name; treating as '\' followed by identifier
            • warning: universal character name refers to a surrogate character
            • warning: universal character names are only valid in C99 or C++
            • @@ -24975,6 +26465,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

              • warning: code will never be executed
              • +
              • warning: fallthrough annotation in unreachable code
              • warning: loop will run at most once (loop increment never executed)

              References

              @@ -24992,6 +26483,7 @@ Derived(); // and so temporary construction is okay
            • warning: 'break' will never be executed
            • warning: 'return' will never be executed
            • warning: code will never be executed
            • +
            • warning: fallthrough annotation in unreachable code
            • warning: loop will run at most once (loop increment never executed)

            References

            @@ -25014,6 +26506,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
            + + clang-diagnostic-unreachable-code-fallthrough + clang-diagnostic-unreachable-code-fallthrough + + Diagnostic text:

            +
              +
            • warning: fallthrough annotation in unreachable code
            • +
            +

            References

            +

            Diagnostic flags in Clang

            ]]> +
            + INFO + CODE_SMELL +
            clang-diagnostic-unreachable-code-loop-increment clang-diagnostic-unreachable-code-loop-increment @@ -25152,7 +26658,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

            • warning: debug information option '%0' is not supported for target '%1'
            • -
            • warning: debug information option '%0' is not supported. It needs DWARF-%2 but target '%1' only provides DWARF-%3.
            • +
            • warning: debug information option '%0' is not supported; requires DWARF-%2 but target '%1' only provides DWARF-%3

            References

            Diagnostic flags in Clang

            ]]> @@ -25181,12 +26687,14 @@ Derived(); // and so temporary construction is okay
          • warning: ignoring temporary created by a constructor declared with %0 attribute: %1
          • warning: ivar %0 which backs the property is not referenced in this property's accessor
          • warning: lambda capture %0 is not %select{used|required to be captured for this use}1
          • +
          • warning: left operand of comma operator has no effect
          • warning: private field %0 is not used
          • warning: unused %select{typedef|type alias}0 %1
          • warning: unused function %0
          • warning: unused label %0
          • warning: unused variable %0
          • warning: unused variable %0
          • +
          • warning: variable %0 set but not used

          References

          Diagnostic flags in Clang

          ]]> @@ -25194,6 +26702,34 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
          + + clang-diagnostic-unused-but-set-parameter + clang-diagnostic-unused-but-set-parameter + + Diagnostic text:

          +
            +
          • warning: parameter %0 set but not used
          • +
          +

          References

          +

          Diagnostic flags in Clang

          ]]> +
          + INFO + CODE_SMELL +
          + + clang-diagnostic-unused-but-set-variable + clang-diagnostic-unused-but-set-variable + + Diagnostic text:

          +
            +
          • warning: variable %0 set but not used
          • +
          +

          References

          +

          Diagnostic flags in Clang

          ]]> +
          + INFO + CODE_SMELL +
          clang-diagnostic-unused-command-line-argument clang-diagnostic-unused-command-line-argument @@ -25206,6 +26742,8 @@ Derived(); // and so temporary construction is okay
        • warning: argument '%0' requires profile-guided optimization information
        • warning: argument unused during compilation: '%0'
        • warning: ignoring -fdiscard-value-names for LLVM Bitcode
        • +
        • warning: ignoring -fverify-debuginfo-preserve-export=%0 because -fverify-debuginfo-preserve wasn't enabled
        • +
        • warning: ignoring invalid /arch: argument '%0'; for %select{64|32}1-bit expected one of %2
        • warning: joined argument expects additional value: '%0'
        • warning: the flag '%0' has been deprecated and will be ignored
        @@ -25434,6 +26972,7 @@ Derived(); // and so temporary construction is okay
      • warning: ignoring return value of function declared with %0 attribute: %1
      • warning: ignoring temporary created by a constructor declared with %0 attribute
      • warning: ignoring temporary created by a constructor declared with %0 attribute: %1
      • +
      • warning: left operand of comma operator has no effect

      References

      Diagnostic flags in Clang

      ]]> @@ -25470,6 +27009,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
      + + clang-diagnostic-search-path-usage + clang-diagnostic-search-path-usage + + Diagnostic text:

      +
        +
      • remark: search path used: '%0'
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      clang-diagnostic-user-defined-literals clang-diagnostic-user-defined-literals @@ -25693,13 +27246,12 @@ Derived(); // and so temporary construction is okay CODE_SMELL - clang-diagnostic-c++98-c++11-compat-pedantic - clang-diagnostic-c++98-c++11-compat-pedantic + clang-diagnostic-c++98-c++11-compat + clang-diagnostic-c++98-c++11-compat Diagnostic text:

      • warning: 'decltype(auto)' type specifier is incompatible with C++ standards before C++14
      • -
      • warning: binary integer literals are incompatible with C++ standards before C++14
      • warning: constexpr function with no return statements is incompatible with C++ standards before C++14
      • warning: digit separators are incompatible with C++ standards before C++14
      • warning: generic lambdas are incompatible with C++11
      • @@ -25712,83 +27264,125 @@ Derived(); // and so temporary construction is okay
      • warning: variable templates are incompatible with C++ standards before C++14

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-unused-macros - clang-diagnostic-unused-macros + clang-diagnostic-pragma-once-outside-header + clang-diagnostic-pragma-once-outside-header Diagnostic text:

        -
      • warning: macro is not used
      • +
      • warning: #pragma once in main file

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-undef - clang-diagnostic-undef + clang-diagnostic-pragma-system-header-outside-header + clang-diagnostic-pragma-system-header-outside-header Diagnostic text:

        -
      • warning: %0 is not defined, evaluates to 0
      • +
      • warning: #pragma system_header ignored in main file

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-undef-prefix - clang-diagnostic-undef-prefix + clang-diagnostic-disabled-macro-expansion + clang-diagnostic-disabled-macro-expansion Diagnostic text:

        -
      • warning: %0 is not defined, evaluates to 0
      • +
      • warning: disabled expansion of recursive macro

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-objc-macro-redefinition - clang-diagnostic-objc-macro-redefinition + clang-diagnostic-unused-macros + clang-diagnostic-unused-macros Diagnostic text:

        -
      • warning: ignoring redefinition of Objective-C qualifier macro
      • +
      • warning: macro is not used

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-import-preprocessor-directive-pedantic - clang-diagnostic-import-preprocessor-directive-pedantic + clang-diagnostic-undef + clang-diagnostic-undef Diagnostic text:

        -
      • warning: #import is a language extension
      • +
      • warning: %0 is not defined, evaluates to 0

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-embedded-directive + clang-diagnostic-undef-prefix + clang-diagnostic-undef-prefix + + Diagnostic text:

      +
        +
      • warning: %0 is not defined, evaluates to 0
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      + + clang-diagnostic-objc-macro-redefinition + clang-diagnostic-objc-macro-redefinition + + Diagnostic text:

      +
        +
      • warning: ignoring redefinition of Objective-C qualifier macro
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      + + clang-diagnostic-import-preprocessor-directive-pedantic + clang-diagnostic-import-preprocessor-directive-pedantic + + Diagnostic text:

      +
        +
      • warning: #import is a language extension
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      + + clang-diagnostic-embedded-directive clang-diagnostic-embedded-directive Diagnostic text:

      @@ -25817,6 +27411,31 @@ Derived(); // and so temporary construction is okay LINEAR 5min
      + + clang-diagnostic-c++98-c++11-compat-pedantic + clang-diagnostic-c++98-c++11-compat-pedantic + + Diagnostic text:

      +
        +
      • warning: 'decltype(auto)' type specifier is incompatible with C++ standards before C++14
      • +
      • warning: binary integer literals are incompatible with C++ standards before C++14
      • +
      • warning: constexpr function with no return statements is incompatible with C++ standards before C++14
      • +
      • warning: digit separators are incompatible with C++ standards before C++14
      • +
      • warning: generic lambdas are incompatible with C++11
      • +
      • warning: initialized lambda captures are incompatible with C++ standards before C++14
      • +
      • warning: multiple return statements in constexpr function is incompatible with C++ standards before C++14
      • +
      • warning: return type deduction is incompatible with C++ standards before C++14
      • +
      • warning: type definition in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
      • +
      • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
      • +
      • warning: variable declaration in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
      • +
      • warning: variable templates are incompatible with C++ standards before C++14
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      clang-diagnostic-date-time clang-diagnostic-date-time @@ -25861,36 +27480,6 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL - - clang-diagnostic-c++98-c++11-c++14-compat - clang-diagnostic-c++98-c++11-c++14-compat - - Diagnostic text:

      -
        -
      • warning: %select{if|switch}0 initialization statements are incompatible with C++ standards before C++17
      • -
      • warning: 'begin' and 'end' returning different types (%0 and %1) is incompatible with C++ standards before C++17
      • -
      • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
      • -
      • warning: by value capture of '*this' is incompatible with C++ standards before C++17
      • -
      • warning: class template argument deduction is incompatible with C++ standards before C++17%select{|; for compatibility, use explicit type name %1}0
      • -
      • warning: constexpr if is incompatible with C++ standards before C++17
      • -
      • warning: constexpr on lambda expressions is incompatible with C++ standards before C++17
      • -
      • warning: decomposition declarations are incompatible with C++ standards before C++17
      • -
      • warning: default scope specifier for attributes is incompatible with C++ standards before C++17
      • -
      • warning: inline variables are incompatible with C++ standards before C++17
      • -
      • warning: nested namespace definition is incompatible with C++ standards before C++17
      • -
      • warning: non-type template parameters declared with %0 are incompatible with C++ standards before C++17
      • -
      • warning: pack expansion using declaration is incompatible with C++ standards before C++17
      • -
      • warning: pack fold expression is incompatible with C++ standards before C++17
      • -
      • warning: template template parameter using 'typename' is incompatible with C++ standards before C++17
      • -
      • warning: unicode literals are incompatible with C++ standards before C++17
      • -
      • warning: use of multiple declarators in a single using declaration is incompatible with C++ standards before C++17
      • -
      -

      References

      -

      Diagnostic flags in Clang

      ]]> -
      - INFO - CODE_SMELL -
      clang-diagnostic-empty-translation-unit clang-diagnostic-empty-translation-unit @@ -25993,6 +27582,36 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-c++98-c++11-c++14-compat + clang-diagnostic-c++98-c++11-c++14-compat + + Diagnostic text:

      +
        +
      • warning: %select{if|switch}0 initialization statements are incompatible with C++ standards before C++17
      • +
      • warning: 'begin' and 'end' returning different types (%0 and %1) is incompatible with C++ standards before C++17
      • +
      • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
      • +
      • warning: by value capture of '*this' is incompatible with C++ standards before C++17
      • +
      • warning: class template argument deduction is incompatible with C++ standards before C++17%select{|; for compatibility, use explicit type name %1}0
      • +
      • warning: constexpr if is incompatible with C++ standards before C++17
      • +
      • warning: constexpr on lambda expressions is incompatible with C++ standards before C++17
      • +
      • warning: decomposition declarations are incompatible with C++ standards before C++17
      • +
      • warning: default scope specifier for attributes is incompatible with C++ standards before C++17
      • +
      • warning: inline variables are incompatible with C++ standards before C++17
      • +
      • warning: nested namespace definition is incompatible with C++ standards before C++17
      • +
      • warning: non-type template parameters declared with %0 are incompatible with C++ standards before C++17
      • +
      • warning: pack expansion using declaration is incompatible with C++ standards before C++17
      • +
      • warning: pack fold expression is incompatible with C++ standards before C++17
      • +
      • warning: template template parameter using 'typename' is incompatible with C++ standards before C++17
      • +
      • warning: unicode literals are incompatible with C++ standards before C++17
      • +
      • warning: use of multiple declarators in a single using declaration is incompatible with C++ standards before C++17
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      clang-diagnostic-auto-storage-class clang-diagnostic-auto-storage-class @@ -26035,38 +27654,6 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL - - clang-diagnostic-c++98-c++11-c++14-compat-pedantic - clang-diagnostic-c++98-c++11-c++14-compat-pedantic - - Diagnostic text:

      -
        -
      • warning: %select{if|switch}0 initialization statements are incompatible with C++ standards before C++17
      • -
      • warning: 'begin' and 'end' returning different types (%0 and %1) is incompatible with C++ standards before C++17
      • -
      • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
      • -
      • warning: attributes on %select{a namespace|an enumerator}0 declaration are incompatible with C++ standards before C++17
      • -
      • warning: by value capture of '*this' is incompatible with C++ standards before C++17
      • -
      • warning: class template argument deduction is incompatible with C++ standards before C++17%select{|; for compatibility, use explicit type name %1}0
      • -
      • warning: constexpr if is incompatible with C++ standards before C++17
      • -
      • warning: constexpr on lambda expressions is incompatible with C++ standards before C++17
      • -
      • warning: decomposition declarations are incompatible with C++ standards before C++17
      • -
      • warning: default scope specifier for attributes is incompatible with C++ standards before C++17
      • -
      • warning: hexadecimal floating literals are incompatible with C++ standards before C++17
      • -
      • warning: inline variables are incompatible with C++ standards before C++17
      • -
      • warning: nested namespace definition is incompatible with C++ standards before C++17
      • -
      • warning: non-type template parameters declared with %0 are incompatible with C++ standards before C++17
      • -
      • warning: pack expansion using declaration is incompatible with C++ standards before C++17
      • -
      • warning: pack fold expression is incompatible with C++ standards before C++17
      • -
      • warning: template template parameter using 'typename' is incompatible with C++ standards before C++17
      • -
      • warning: unicode literals are incompatible with C++ standards before C++17
      • -
      • warning: use of multiple declarators in a single using declaration is incompatible with C++ standards before C++17
      • -
      -

      References

      -

      Diagnostic flags in Clang

      ]]> -
      - INFO - CODE_SMELL -
      clang-diagnostic-ambiguous-ellipsis clang-diagnostic-ambiguous-ellipsis @@ -26096,43 +27683,43 @@ Derived(); // and so temporary construction is okay CODE_SMELL - clang-diagnostic-requires-expression - clang-diagnostic-requires-expression + clang-diagnostic-cxx-attribute-extension + clang-diagnostic-cxx-attribute-extension Diagnostic text:

        -
      • warning: this requires expression will only be checked for syntactic validity; did you intend to place it in a nested requirement? (add another 'requires' before the expression)
      • +
      • warning: ISO C++ does not allow an attribute list to appear here

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-static-inline-explicit-instantiation - clang-diagnostic-static-inline-explicit-instantiation + clang-diagnostic-requires-expression + clang-diagnostic-requires-expression Diagnostic text:

        -
      • warning: ignoring '%select{static|inline}0' keyword on explicit template instantiation
      • +
      • warning: this requires expression will only be checked for syntactic validity; did you intend to place it in a nested requirement? (add another 'requires' before the expression)

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-pedantic-core-features - clang-diagnostic-pedantic-core-features + clang-diagnostic-static-inline-explicit-instantiation + clang-diagnostic-static-inline-explicit-instantiation Diagnostic text:

        -
      • warning: OpenCL extension %0 is core feature or supported optional core feature - ignoring
      • +
      • warning: ignoring '%select{static|inline}0' keyword on explicit template instantiation

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL @@ -26179,6 +27766,38 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
      + + clang-diagnostic-c++98-c++11-c++14-compat-pedantic + clang-diagnostic-c++98-c++11-c++14-compat-pedantic + + Diagnostic text:

      +
        +
      • warning: %select{if|switch}0 initialization statements are incompatible with C++ standards before C++17
      • +
      • warning: 'begin' and 'end' returning different types (%0 and %1) is incompatible with C++ standards before C++17
      • +
      • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
      • +
      • warning: attributes on %select{a namespace|an enumerator}0 declaration are incompatible with C++ standards before C++17
      • +
      • warning: by value capture of '*this' is incompatible with C++ standards before C++17
      • +
      • warning: class template argument deduction is incompatible with C++ standards before C++17%select{|; for compatibility, use explicit type name %1}0
      • +
      • warning: constexpr if is incompatible with C++ standards before C++17
      • +
      • warning: constexpr on lambda expressions is incompatible with C++ standards before C++17
      • +
      • warning: decomposition declarations are incompatible with C++ standards before C++17
      • +
      • warning: default scope specifier for attributes is incompatible with C++ standards before C++17
      • +
      • warning: hexadecimal floating literals are incompatible with C++ standards before C++17
      • +
      • warning: inline variables are incompatible with C++ standards before C++17
      • +
      • warning: nested namespace definition is incompatible with C++ standards before C++17
      • +
      • warning: non-type template parameters declared with %0 are incompatible with C++ standards before C++17
      • +
      • warning: pack expansion using declaration is incompatible with C++ standards before C++17
      • +
      • warning: pack fold expression is incompatible with C++ standards before C++17
      • +
      • warning: template template parameter using 'typename' is incompatible with C++ standards before C++17
      • +
      • warning: unicode literals are incompatible with C++ standards before C++17
      • +
      • warning: use of multiple declarators in a single using declaration is incompatible with C++ standards before C++17
      • +
      +

      References

      +

      Diagnostic flags in Clang

      ]]> +
      + INFO + CODE_SMELL +
      clang-diagnostic-predefined-identifier-outside-function clang-diagnostic-predefined-identifier-outside-function @@ -26194,49 +27813,29 @@ Derived(); // and so temporary construction is okay CODE_SMELL - clang-diagnostic-redundant-parens - clang-diagnostic-redundant-parens + clang-diagnostic-interrupt-service-routine + clang-diagnostic-interrupt-service-routine Diagnostic text:

        -
      • warning: redundant parentheses surrounding declarator
      • +
      • warning: interrupt service routine should only call a function with attribute 'no_caller_saved_registers'

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-c++98-c++11-c++14-c++17-compat - clang-diagnostic-c++98-c++11-c++14-c++17-compat + clang-diagnostic-redundant-parens + clang-diagnostic-redundant-parens Diagnostic text:

        -
      • warning: %select{default construction|assignment}0 of lambda is incompatible with C++ standards before C++20
      • -
      • warning: '<=>' operator is incompatible with C++ standards before C++20
      • -
      • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
      • -
      • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
      • -
      • warning: constexpr union constructor that does not initialize any member is incompatible with C++ standards before C++20
      • -
      • warning: decomposition declaration declared %plural{1:'%1'|:with '%1' specifiers}0 is incompatible with C++ standards before C++20
      • -
      • warning: default member initializer for bit-field is incompatible with C++ standards before C++20
      • -
      • warning: defaulted comparison operators are incompatible with C++ standards before C++20
      • -
      • warning: explicit capture of 'this' with a capture default of '=' is incompatible with C++ standards before C++20
      • -
      • warning: explicit template parameter list for lambdas is incompatible with C++ standards before C++20
      • -
      • warning: explicit(bool) is incompatible with C++ standards before C++20
      • -
      • warning: explicitly defaulting this %sub{select_special_member_kind}0 with a type different from the implicit type is incompatible with C++ standards before C++20
      • -
      • warning: function try block in constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
      • -
      • warning: initialized lambda capture packs are incompatible with C++ standards before C++20
      • -
      • warning: inline nested namespace definition is incompatible with C++ standards before C++20
      • -
      • warning: non-type template parameter of type %0 is incompatible with C++ standards before C++20
      • -
      • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
      • -
      • warning: uninitialized variable in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
      • -
      • warning: use of function template name with no prior function template declaration in function call with explicit template arguments is incompatible with C++ standards before C++20
      • -
      • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
      • -
      • warning: virtual constexpr functions are incompatible with C++ standards before C++20
      • +
      • warning: redundant parentheses surrounding declarator

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL @@ -26340,79 +27939,82 @@ Derived(); // and so temporary construction is okay CODE_SMELL
      - clang-diagnostic-builtin-memcpy-chk-size - clang-diagnostic-builtin-memcpy-chk-size + clang-diagnostic-c++98-c++11-c++14-c++17-compat + clang-diagnostic-c++98-c++11-c++14-c++17-compat Diagnostic text:

        -
      • warning: '%0' will always overflow; destination buffer has size %1, but size argument is %2
      • -
      -

      References

      -

      Diagnostic flags in Clang

      ]]> -
      - INFO - CODE_SMELL -
      +
    • warning: %select{default construction|assignment}0 of lambda is incompatible with C++ standards before C++20
    • +
    • warning: '<=>' operator is incompatible with C++ standards before C++20
    • +
    • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
    • +
    • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
    • +
    • warning: constexpr union constructor that does not initialize any member is incompatible with C++ standards before C++20
    • +
    • warning: decomposition declaration declared %plural{1:'%1'|:with '%1' specifiers}0 is incompatible with C++ standards before C++20
    • +
    • warning: default member initializer for bit-field is incompatible with C++ standards before C++20
    • +
    • warning: defaulted comparison operators are incompatible with C++ standards before C++20
    • +
    • warning: explicit capture of 'this' with a capture default of '=' is incompatible with C++ standards before C++20
    • +
    • warning: explicit template parameter list for lambdas is incompatible with C++ standards before C++20
    • +
    • warning: explicit(bool) is incompatible with C++ standards before C++20
    • +
    • warning: explicitly defaulting this %sub{select_special_member_kind}0 with a type different from the implicit type is incompatible with C++ standards before C++20
    • +
    • warning: function try block in constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • +
    • warning: initialized lambda capture packs are incompatible with C++ standards before C++20
    • +
    • warning: inline nested namespace definition is incompatible with C++ standards before C++20
    • +
    • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
    • +
    • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
    • +
    • warning: non-type template parameter of type %0 is incompatible with C++ standards before C++20
    • +
    • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
    • +
    • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
    • +
    • warning: uninitialized variable in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • +
    • warning: use of function template name with no prior function template declaration in function call with explicit template arguments is incompatible with C++ standards before C++20
    • +
    • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • +
    • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
    • +
    • warning: using enum declaration is incompatible with C++ standards before C++20
    • +
    • warning: virtual constexpr functions are incompatible with C++ standards before C++20
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> + + INFO + CODE_SMELL +
    - clang-diagnostic-non-c-typedef-for-linkage - clang-diagnostic-non-c-typedef-for-linkage + clang-diagnostic-builtin-memcpy-chk-size + clang-diagnostic-builtin-memcpy-chk-size Diagnostic text:

      -
    • warning: anonymous non-C-compatible type given name for linkage purposes by %select{typedef|alias}0 declaration; add a tag name here
    • +
    • warning: '%0' will always overflow; destination buffer has size %1, but size argument is %2

    References

    -

    Diagnostic flags in Clang

    ]]> +

    Diagnostic flags in Clang

    ]]>
    INFO CODE_SMELL
    - clang-diagnostic-duplicate-protocol - clang-diagnostic-duplicate-protocol + clang-diagnostic-non-c-typedef-for-linkage + clang-diagnostic-non-c-typedef-for-linkage Diagnostic text:

      -
    • warning: duplicate protocol definition of %0 is ignored
    • +
    • warning: anonymous non-C-compatible type given name for linkage purposes by %select{typedef|alias}0 declaration; add a tag name here

    References

    -

    Diagnostic flags in Clang

    ]]> +

    Diagnostic flags in Clang

    ]]>
    INFO CODE_SMELL
    - clang-diagnostic-c++98-c++11-c++14-c++17-compat-pedantic - clang-diagnostic-c++98-c++11-c++14-c++17-compat-pedantic + clang-diagnostic-duplicate-protocol + clang-diagnostic-duplicate-protocol Diagnostic text:

      -
    • warning: %select{default construction|assignment}0 of lambda is incompatible with C++ standards before C++20
    • -
    • warning: '<=>' operator is incompatible with C++ standards before C++20
    • -
    • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
    • -
    • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
    • -
    • warning: constexpr union constructor that does not initialize any member is incompatible with C++ standards before C++20
    • -
    • warning: decomposition declaration declared %plural{1:'%1'|:with '%1' specifiers}0 is incompatible with C++ standards before C++20
    • -
    • warning: default member initializer for bit-field is incompatible with C++ standards before C++20
    • -
    • warning: defaulted comparison operators are incompatible with C++ standards before C++20
    • -
    • warning: designated initializers are incompatible with C++ standards before C++20
    • -
    • warning: explicit capture of 'this' with a capture default of '=' is incompatible with C++ standards before C++20
    • -
    • warning: explicit template parameter list for lambdas is incompatible with C++ standards before C++20
    • -
    • warning: explicit(bool) is incompatible with C++ standards before C++20
    • -
    • warning: explicitly defaulting this %sub{select_special_member_kind}0 with a type different from the implicit type is incompatible with C++ standards before C++20
    • -
    • warning: function try block in constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • -
    • warning: initialized lambda capture packs are incompatible with C++ standards before C++20
    • -
    • warning: inline nested namespace definition is incompatible with C++ standards before C++20
    • -
    • warning: invoking a pointer to a 'const &' member function on an rvalue is incompatible with C++ standards before C++20
    • -
    • warning: non-type template parameter of type %0 is incompatible with C++ standards before C++20
    • -
    • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
    • -
    • warning: uninitialized variable in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • -
    • warning: use of function template name with no prior function template declaration in function call with explicit template arguments is incompatible with C++ standards before C++20
    • -
    • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • -
    • warning: virtual constexpr functions are incompatible with C++ standards before C++20
    • +
    • warning: duplicate protocol definition of %0 is ignored

    References

    -

    Diagnostic flags in Clang

    ]]> +

    Diagnostic flags in Clang

    ]]>
    INFO CODE_SMELL @@ -26515,6 +28117,47 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-c++98-c++11-c++14-c++17-compat-pedantic + clang-diagnostic-c++98-c++11-c++14-c++17-compat-pedantic + + Diagnostic text:

    +
      +
    • warning: %select{default construction|assignment}0 of lambda is incompatible with C++ standards before C++20
    • +
    • warning: '<=>' operator is incompatible with C++ standards before C++20
    • +
    • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
    • +
    • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
    • +
    • warning: constexpr union constructor that does not initialize any member is incompatible with C++ standards before C++20
    • +
    • warning: decomposition declaration declared %plural{1:'%1'|:with '%1' specifiers}0 is incompatible with C++ standards before C++20
    • +
    • warning: default member initializer for bit-field is incompatible with C++ standards before C++20
    • +
    • warning: defaulted comparison operators are incompatible with C++ standards before C++20
    • +
    • warning: designated initializers are incompatible with C++ standards before C++20
    • +
    • warning: explicit capture of 'this' with a capture default of '=' is incompatible with C++ standards before C++20
    • +
    • warning: explicit template parameter list for lambdas is incompatible with C++ standards before C++20
    • +
    • warning: explicit(bool) is incompatible with C++ standards before C++20
    • +
    • warning: explicitly defaulting this %sub{select_special_member_kind}0 with a type different from the implicit type is incompatible with C++ standards before C++20
    • +
    • warning: function try block in constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • +
    • warning: initialized lambda capture packs are incompatible with C++ standards before C++20
    • +
    • warning: inline nested namespace definition is incompatible with C++ standards before C++20
    • +
    • warning: invoking a pointer to a 'const &' member function on an rvalue is incompatible with C++ standards before C++20
    • +
    • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
    • +
    • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
    • +
    • warning: non-type template parameter of type %0 is incompatible with C++ standards before C++20
    • +
    • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
    • +
    • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
    • +
    • warning: uninitialized variable in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • +
    • warning: use of function template name with no prior function template declaration in function call with explicit template arguments is incompatible with C++ standards before C++20
    • +
    • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • +
    • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
    • +
    • warning: using enum declaration is incompatible with C++ standards before C++20
    • +
    • warning: virtual constexpr functions are incompatible with C++ standards before C++20
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-objc-autosynthesis-property-ivar-name-match clang-diagnostic-objc-autosynthesis-property-ivar-name-match @@ -26557,28 +28200,6 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL - - clang-diagnostic-c++0x-narrowing - clang-diagnostic-c++0x-narrowing - - Diagnostic text:

    -
      -
    • warning: %select{case value|enumerator value|non-type template argument|array size|constexpr if condition|explicit specifier argument}0 %select{cannot be narrowed from type %2 to %3|evaluates to %2, which cannot be narrowed to type %3}1
    • -
    • warning: constant expression evaluates to %0 which cannot be narrowed to type %1
    • -
    • warning: constant expression evaluates to %0 which cannot be narrowed to type %1 in C++11
    • -
    • warning: non-constant-expression cannot be narrowed from type %0 to %1 in initializer list
    • -
    • warning: non-constant-expression cannot be narrowed from type %0 to %1 in initializer list in C++11
    • -
    • warning: type %0 cannot be narrowed to %1 in initializer list
    • -
    • warning: type %0 cannot be narrowed to %1 in initializer list in C++11
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - CRITICAL - CODE_SMELL - LINEAR - 5min -
    clang-diagnostic-implicit-retain-self clang-diagnostic-implicit-retain-self @@ -26621,6 +28242,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-redundant-consteval-if + clang-diagnostic-redundant-consteval-if + + Diagnostic text:

    +
      +
    • warning: consteval if is always true in an %select{unevaluated|immediate}0 context
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-weak-vtables clang-diagnostic-weak-vtables @@ -26641,7 +28276,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

      -
    • warning: explicit template instantiation %0 will emit a vtable in every translation unit
    • +
    • warning: this warning is no longer in use and will be removed in the next release

    References

    Diagnostic flags in Clang

    ]]> @@ -26663,6 +28298,28 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-c++0x-narrowing + clang-diagnostic-c++0x-narrowing + + Diagnostic text:

    +
      +
    • warning: %select{case value|enumerator value|non-type template argument|array size|explicit specifier argument|noexcept specifier argument}0 %select{cannot be narrowed from type %2 to %3|evaluates to %2, which cannot be narrowed to type %3}1
    • +
    • warning: constant expression evaluates to %0 which cannot be narrowed to type %1
    • +
    • warning: constant expression evaluates to %0 which cannot be narrowed to type %1 in C++11
    • +
    • warning: non-constant-expression cannot be narrowed from type %0 to %1 in initializer list
    • +
    • warning: non-constant-expression cannot be narrowed from type %0 to %1 in initializer list in C++11
    • +
    • warning: type %0 cannot be narrowed to %1 in initializer list
    • +
    • warning: type %0 cannot be narrowed to %1 in initializer list in C++11
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + CRITICAL + CODE_SMELL + LINEAR + 5min +
    clang-diagnostic-injected-class-name clang-diagnostic-injected-class-name @@ -26723,28 +28380,6 @@ Derived(); // and so temporary construction is okay LINEAR 5min - - clang-diagnostic-narrowing - clang-diagnostic-narrowing - - Diagnostic text:

    -
      -
    • warning: %select{case value|enumerator value|non-type template argument|array size|constexpr if condition|explicit specifier argument}0 %select{cannot be narrowed from type %2 to %3|evaluates to %2, which cannot be narrowed to type %3}1
    • -
    • warning: constant expression evaluates to %0 which cannot be narrowed to type %1
    • -
    • warning: constant expression evaluates to %0 which cannot be narrowed to type %1 in C++11
    • -
    • warning: non-constant-expression cannot be narrowed from type %0 to %1 in initializer list
    • -
    • warning: non-constant-expression cannot be narrowed from type %0 to %1 in initializer list in C++11
    • -
    • warning: type %0 cannot be narrowed to %1 in initializer list
    • -
    • warning: type %0 cannot be narrowed to %1 in initializer list in C++11
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - CRITICAL - CODE_SMELL - LINEAR - 5min -
    clang-diagnostic-auto-var-id clang-diagnostic-auto-var-id @@ -26831,6 +28466,28 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-narrowing + clang-diagnostic-narrowing + + Diagnostic text:

    +
      +
    • warning: %select{case value|enumerator value|non-type template argument|array size|explicit specifier argument|noexcept specifier argument}0 %select{cannot be narrowed from type %2 to %3|evaluates to %2, which cannot be narrowed to type %3}1
    • +
    • warning: constant expression evaluates to %0 which cannot be narrowed to type %1
    • +
    • warning: constant expression evaluates to %0 which cannot be narrowed to type %1 in C++11
    • +
    • warning: non-constant-expression cannot be narrowed from type %0 to %1 in initializer list
    • +
    • warning: non-constant-expression cannot be narrowed from type %0 to %1 in initializer list in C++11
    • +
    • warning: type %0 cannot be narrowed to %1 in initializer list
    • +
    • warning: type %0 cannot be narrowed to %1 in initializer list in C++11
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + CRITICAL + CODE_SMELL + LINEAR + 5min +
    clang-diagnostic-builtin-assume-aligned-alignment clang-diagnostic-builtin-assume-aligned-alignment @@ -26887,13 +28544,97 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-invalid-initializer-from-system-header + clang-diagnostic-invalid-initializer-from-system-header + + Diagnostic text:

    +
      +
    • warning: invalid constructor from class in system header, should not be explicit
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    + + clang-diagnostic-unsupported-dll-base-class-template + clang-diagnostic-unsupported-dll-base-class-template + + Diagnostic text:

    +
      +
    • warning: propagating dll attribute to %select{already instantiated|explicitly specialized}0 base class template without dll attribute is not supported
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    + + clang-diagnostic-encode-type + clang-diagnostic-encode-type + + Diagnostic text:

    +
      +
    • warning: encoding of %0 type is incomplete because %1 component has unknown encoding
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    + + clang-diagnostic-gnu-inline-cpp-without-extern + clang-diagnostic-gnu-inline-cpp-without-extern + + Diagnostic text:

    +
      +
    • warning: 'gnu_inline' attribute without 'extern' in C++ treated as externally available, this changed in Clang 10
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    + + clang-diagnostic-missing-prototype-for-cc + clang-diagnostic-missing-prototype-for-cc + + Diagnostic text:

    +
      +
    • warning: function with no prototype cannot use the %0 calling convention
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    + + clang-diagnostic-unsupported-availability-guard + clang-diagnostic-unsupported-availability-guard + + Diagnostic text:

    +
      +
    • warning: %select{@available|__builtin_available}0 does not guard availability here; use if (%select{@available|__builtin_available}0) instead
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-c++0x-compat clang-diagnostic-c++0x-compat Diagnostic text:

      -
    • warning: %select{case value|enumerator value|non-type template argument|array size|constexpr if condition|explicit specifier argument}0 %select{cannot be narrowed from type %2 to %3|evaluates to %2, which cannot be narrowed to type %3}1
    • +
    • warning: %select{case value|enumerator value|non-type template argument|array size|explicit specifier argument|noexcept specifier argument}0 %select{cannot be narrowed from type %2 to %3|evaluates to %2, which cannot be narrowed to type %3}1
    • warning: %select{default construction|assignment}0 of lambda is incompatible with C++ standards before C++20
    • warning: %select{if|switch}0 initialization statements are incompatible with C++ standards before C++17
    • warning: '%0' is a keyword in C++11
    • @@ -26902,12 +28643,15 @@ Derived(); // and so temporary construction is okay
    • warning: 'begin' and 'end' returning different types (%0 and %1) is incompatible with C++ standards before C++17
    • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
    • warning: 'decltype(auto)' type specifier is incompatible with C++ standards before C++14
    • +
    • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
    • warning: 'static_assert' with no message is incompatible with C++ standards before C++17
    • +
    • warning: alias declaration in this context is incompatible with C++ standards before C++2b
    • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
    • warning: by value capture of '*this' is incompatible with C++ standards before C++17
    • warning: class template argument deduction is incompatible with C++ standards before C++17%select{|; for compatibility, use explicit type name %1}0
    • warning: constant expression evaluates to %0 which cannot be narrowed to type %1
    • warning: constant expression evaluates to %0 which cannot be narrowed to type %1 in C++11
    • +
    • warning: consteval if is incompatible with C++ standards before C++2b
    • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
    • warning: constexpr function with no return statements is incompatible with C++ standards before C++14
    • warning: constexpr if is incompatible with C++ standards before C++17
    • @@ -26938,6 +28682,8 @@ Derived(); // and so temporary construction is okay
    • warning: inline variables are incompatible with C++ standards before C++17
    • warning: integer literal is too large to be represented in type 'long' and is subject to undefined behavior under C++98, interpreting as 'unsigned long'; this literal will %select{have type 'long long'|be ill-formed}0 in C++11 onwards
    • warning: integer literal is too large to be represented in type 'long', interpreting as 'unsigned long' per C++98; this literal will %select{have type 'long long'|be ill-formed}0 in C++11 onwards
    • +
    • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
    • +
    • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
    • warning: multiple return statements in constexpr function is incompatible with C++ standards before C++14
    • warning: nested namespace definition is incompatible with C++ standards before C++17
    • warning: non-constant-expression cannot be narrowed from type %0 to %1 in initializer list
    • @@ -26946,6 +28692,7 @@ Derived(); // and so temporary construction is okay
    • warning: non-type template parameters declared with %0 are incompatible with C++ standards before C++17
    • warning: pack expansion using declaration is incompatible with C++ standards before C++17
    • warning: pack fold expression is incompatible with C++ standards before C++17
    • +
    • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
    • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
    • warning: return type deduction is incompatible with C++ standards before C++14
    • warning: template template parameter using 'typename' is incompatible with C++ standards before C++17
    • @@ -26959,6 +28706,8 @@ Derived(); // and so temporary construction is okay
    • warning: use of right-shift operator ('>>') in template argument will require parentheses in C++11
    • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
    • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • +
    • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
    • +
    • warning: using enum declaration is incompatible with C++ standards before C++20
    • warning: variable declaration in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
    • warning: variable templates are incompatible with C++ standards before C++14
    • warning: virtual constexpr functions are incompatible with C++ standards before C++20
    • @@ -26972,141 +28721,141 @@ Derived(); // and so temporary construction is okay 5min - clang-diagnostic-dllexport-explicit-instantiation-decl - clang-diagnostic-dllexport-explicit-instantiation-decl + clang-diagnostic-ignored-availability-without-sdk-settings + clang-diagnostic-ignored-availability-without-sdk-settings Diagnostic text:

        -
      • warning: explicit instantiation declaration should not be 'dllexport'
      • +
      • warning: %0 availability is ignored without a valid 'SDKSettings.json' in the SDK

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-invalid-initializer-from-system-header - clang-diagnostic-invalid-initializer-from-system-header + clang-diagnostic-pointer-compare + clang-diagnostic-pointer-compare Diagnostic text:

        -
      • warning: invalid constructor from class in system header, should not be explicit
      • +
      • warning: comparing a pointer to a null character constant; did you mean to compare to %select{NULL|(void *)0}0?

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-unsupported-dll-base-class-template - clang-diagnostic-unsupported-dll-base-class-template + clang-diagnostic-sizeof-pointer-div + clang-diagnostic-sizeof-pointer-div Diagnostic text:

        -
      • warning: propagating dll attribute to %select{already instantiated|explicitly specialized}0 base class template without dll attribute is not supported
      • +
      • warning: '%0' will return the size of the pointer, not the array itself

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-encode-type - clang-diagnostic-encode-type + clang-diagnostic-sizeof-array-div + clang-diagnostic-sizeof-array-div Diagnostic text:

        -
      • warning: encoding of %0 type is incomplete because %1 component has unknown encoding
      • +
      • warning: expression does not compute the number of elements in this array; element type is %0, not %1

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-gnu-inline-cpp-without-extern - clang-diagnostic-gnu-inline-cpp-without-extern + clang-diagnostic-attribute-packed-for-bitfield + clang-diagnostic-attribute-packed-for-bitfield Diagnostic text:

        -
      • warning: 'gnu_inline' attribute without 'extern' in C++ treated as externally available, this changed in Clang 10
      • +
      • warning: 'packed' attribute was ignored on bit-fields with single-byte alignment in older versions of GCC and Clang

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-missing-prototype-for-cc - clang-diagnostic-missing-prototype-for-cc + clang-diagnostic-unsupported-visibility + clang-diagnostic-unsupported-visibility Diagnostic text:

        -
      • warning: function with no prototype cannot use the %0 calling convention
      • +
      • warning: target does not support 'protected' visibility; using 'default'

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-unsupported-availability-guard - clang-diagnostic-unsupported-availability-guard + clang-diagnostic-invalid-no-builtin-names + clang-diagnostic-invalid-no-builtin-names Diagnostic text:

        -
      • warning: %select{@available|__builtin_available}0 does not guard availability here; use if (%select{@available|__builtin_available}0) instead
      • +
      • warning: '%0' is not a valid builtin name for %1

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-pointer-compare - clang-diagnostic-pointer-compare + clang-diagnostic-requires-super-attribute + clang-diagnostic-requires-super-attribute Diagnostic text:

        -
      • warning: comparing a pointer to a null character constant; did you mean to compare to %select{NULL|(void *)0}0?
      • +
      • warning: %0 attribute cannot be applied to %select{methods in protocols|dealloc}1

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-sizeof-pointer-div - clang-diagnostic-sizeof-pointer-div + clang-diagnostic-ambiguous-reversed-operator + clang-diagnostic-ambiguous-reversed-operator Diagnostic text:

        -
      • warning: '%0' will return the size of the pointer, not the array itself
      • +
      • warning: ISO C++20 considers use of overloaded operator '%0' (with operand types %1 and %2) to be ambiguous despite there being a unique best viable function%select{ with non-reversed arguments|}3

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL
      - clang-diagnostic-sizeof-array-div - clang-diagnostic-sizeof-array-div + clang-diagnostic-rewrite-not-bool + clang-diagnostic-rewrite-not-bool Diagnostic text:

        -
      • warning: expression does not compute the number of elements in this array; element type is %0, not %1
      • +
      • warning: ISO C++20 requires return type of selected 'operator==' function for rewritten '%1' comparison to be 'bool', not %0

      References

      -

      Diagnostic flags in Clang

      ]]> +

      Diagnostic flags in Clang

      ]]>
      INFO CODE_SMELL @@ -27121,7 +28870,10 @@ Derived(); // and so temporary construction is okay
    • warning: '<=>' operator is incompatible with C++ standards before C++20
    • warning: 'char8_t' type specifier is incompatible with C++ standards before C++20
    • warning: 'register' storage class specifier is deprecated and incompatible with C++17
    • +
    • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
    • +
    • warning: alias declaration in this context is incompatible with C++ standards before C++2b
    • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
    • +
    • warning: consteval if is incompatible with C++ standards before C++2b
    • warning: constexpr constructor that does not initialize all members is incompatible with C++ standards before C++20
    • warning: constexpr union constructor that does not initialize any member is incompatible with C++ standards before C++20
    • warning: decomposition declaration declared %plural{1:'%1'|:with '%1' specifiers}0 is incompatible with C++ standards before C++20
    • @@ -27136,11 +28888,16 @@ Derived(); // and so temporary construction is okay
    • warning: initialized lambda capture packs are incompatible with C++ standards before C++20
    • warning: inline nested namespace definition is incompatible with C++ standards before C++20
    • warning: mangled name of %0 will change in C++17 due to non-throwing exception specification in function signature
    • +
    • warning: member using declaration naming a non-member enumerator is incompatible with C++ standards before C++20
    • +
    • warning: member using declaration naming non-class '%0' enumerator is incompatible with C++ standards before C++20
    • warning: non-type template parameter of type %0 is incompatible with C++ standards before C++20
    • +
    • warning: passing no argument for the '...' parameter of a variadic macro is incompatible with C++ standards before C++20
    • warning: range-based for loop initialization statements are incompatible with C++ standards before C++20
    • warning: uninitialized variable in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • warning: use of function template name with no prior function template declaration in function call with explicit template arguments is incompatible with C++ standards before C++20
    • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++20
    • +
    • warning: using declaration naming a scoped enumerator is incompatible with C++ standards before C++20
    • +
    • warning: using enum declaration is incompatible with C++ standards before C++20
    • warning: virtual constexpr functions are incompatible with C++ standards before C++20

    References

    @@ -27149,90 +28906,6 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    - - clang-diagnostic-attribute-packed-for-bitfield - clang-diagnostic-attribute-packed-for-bitfield - - Diagnostic text:

    -
      -
    • warning: 'packed' attribute was ignored on bit-fields with single-byte alignment in older versions of GCC and Clang
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - INFO - CODE_SMELL -
    - - clang-diagnostic-unsupported-visibility - clang-diagnostic-unsupported-visibility - - Diagnostic text:

    -
      -
    • warning: target does not support 'protected' visibility; using 'default'
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - INFO - CODE_SMELL -
    - - clang-diagnostic-invalid-no-builtin-names - clang-diagnostic-invalid-no-builtin-names - - Diagnostic text:

    -
      -
    • warning: '%0' is not a valid builtin name for %1
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - INFO - CODE_SMELL -
    - - clang-diagnostic-requires-super-attribute - clang-diagnostic-requires-super-attribute - - Diagnostic text:

    -
      -
    • warning: %0 attribute cannot be applied to %select{methods in protocols|dealloc}1
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - INFO - CODE_SMELL -
    - - clang-diagnostic-ambiguous-reversed-operator - clang-diagnostic-ambiguous-reversed-operator - - Diagnostic text:

    -
      -
    • warning: ISO C++20 considers use of overloaded operator '%0' (with operand types %1 and %2) to be ambiguous despite there being a unique best viable function%select{ with non-reversed arguments|}3
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - INFO - CODE_SMELL -
    - - clang-diagnostic-rewrite-not-bool - clang-diagnostic-rewrite-not-bool - - Diagnostic text:

    -
      -
    • warning: ISO C++20 requires return type of selected 'operator==' function for rewritten '%1' comparison to be 'bool', not %0
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - INFO - CODE_SMELL -
    clang-diagnostic-invalid-partial-specialization clang-diagnostic-invalid-partial-specialization @@ -27293,27 +28966,6 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL - - clang-diagnostic-c++2a-compat - clang-diagnostic-c++2a-compat - - Diagnostic text:

    -
      -
    • warning: '%0' is a keyword in C++20
    • -
    • warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior
    • -
    • warning: 'consteval' specifier is incompatible with C++ standards before C++20
    • -
    • warning: 'constinit' specifier is incompatible with C++ standards before C++20
    • -
    • warning: aggregate initialization of type %0 with user-declared constructors is incompatible with C++20
    • -
    • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
    • -
    • warning: this expression will be parsed as explicit(bool) in C++20
    • -
    • warning: type of UTF-8 string literal will change from array of const char to array of const char8_t in C++20
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - INFO - CODE_SMELL -
    clang-diagnostic-missing-prototypes clang-diagnostic-missing-prototypes @@ -27376,24 +29028,48 @@ Derived(); // and so temporary construction is okay Diagnostic text:

      -
    • warning: ISO C++ requires a definition in this translation unit for %select{function|variable}0 %q1 because its type does not have linkage
    • +
    • warning: ISO C++ requires a definition in this translation unit for %select{function|variable}0 %q1 because its type does not have linkage
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    + + clang-diagnostic-undefined-inline + clang-diagnostic-undefined-inline + + Diagnostic text:

    +
      +
    • warning: inline function %q0 is not defined

    References

    -

    Diagnostic flags in Clang

    ]]> +

    Diagnostic flags in Clang

    ]]>
    INFO CODE_SMELL
    - clang-diagnostic-undefined-inline - clang-diagnostic-undefined-inline + clang-diagnostic-c++2a-compat + clang-diagnostic-c++2a-compat Diagnostic text:

      -
    • warning: inline function %q0 is not defined
    • +
    • warning: '%0' is a keyword in C++20
    • +
    • warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior
    • +
    • warning: 'consteval' specifier is incompatible with C++ standards before C++20
    • +
    • warning: 'constinit' specifier is incompatible with C++ standards before C++20
    • +
    • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
    • +
    • warning: aggregate initialization of type %0 with user-declared constructors is incompatible with C++20
    • +
    • warning: alias declaration in this context is incompatible with C++ standards before C++2b
    • +
    • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
    • +
    • warning: consteval if is incompatible with C++ standards before C++2b
    • +
    • warning: this expression will be parsed as explicit(bool) in C++20
    • +
    • warning: type of UTF-8 string literal will change from array of const char to array of const char8_t in C++20

    References

    -

    Diagnostic flags in Clang

    ]]> +

    Diagnostic flags in Clang

    ]]>
    INFO CODE_SMELL @@ -27454,28 +29130,6 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    - - clang-diagnostic-c++2a-compat-pedantic - clang-diagnostic-c++2a-compat-pedantic - - Diagnostic text:

    -
      -
    • warning: '%0' is a keyword in C++20
    • -
    • warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior
    • -
    • warning: 'consteval' specifier is incompatible with C++ standards before C++20
    • -
    • warning: 'constinit' specifier is incompatible with C++ standards before C++20
    • -
    • warning: aggregate initialization of type %0 with user-declared constructors is incompatible with C++20
    • -
    • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
    • -
    • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
    • -
    • warning: this expression will be parsed as explicit(bool) in C++20
    • -
    • warning: type of UTF-8 string literal will change from array of const char to array of const char8_t in C++20
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - INFO - CODE_SMELL -
    clang-diagnostic-extern-initializer clang-diagnostic-extern-initializer @@ -27560,6 +29214,34 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-c++2a-compat-pedantic + clang-diagnostic-c++2a-compat-pedantic + + Diagnostic text:

    +
      +
    • warning: '%0' is a keyword in C++20
    • +
    • warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior
    • +
    • warning: 'consteval' specifier is incompatible with C++ standards before C++20
    • +
    • warning: 'constinit' specifier is incompatible with C++ standards before C++20
    • +
    • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
    • +
    • warning: 'size_t' suffix for literals is incompatible with C++ standards before C++2b
    • +
    • warning: aggregate initialization of type %0 with user-declared constructors is incompatible with C++20
    • +
    • warning: alias declaration in this context is incompatible with C++ standards before C++2b
    • +
    • warning: alias declaration in this context is incompatible with C++ standards before C++2b
    • +
    • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
    • +
    • warning: an attribute specifier sequence in this position is incompatible with C++ standards before C++2b
    • +
    • warning: consteval if is incompatible with C++ standards before C++2b
    • +
    • warning: consteval if is incompatible with C++ standards before C++2b
    • +
    • warning: this expression will be parsed as explicit(bool) in C++20
    • +
    • warning: type of UTF-8 string literal will change from array of const char to array of const char8_t in C++20
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-float-equal clang-diagnostic-float-equal @@ -27744,20 +29426,6 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL - - clang-diagnostic-ordered-compare-function-pointers - clang-diagnostic-ordered-compare-function-pointers - - Diagnostic text:

    -
      -
    • warning: ordered comparison of function pointers (%0 and %1)
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - INFO - CODE_SMELL -
    clang-diagnostic-pointer-integer-compare clang-diagnostic-pointer-integer-compare @@ -27843,15 +29511,15 @@ Derived(); // and so temporary construction is okay CODE_SMELL - clang-diagnostic-bool-operation - clang-diagnostic-bool-operation + clang-diagnostic-deprecated-altivec-src-compat + clang-diagnostic-deprecated-altivec-src-compat Diagnostic text:

      -
    • warning: bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 did you mean logical negation?
    • +
    • warning: Current handling of vector bool and vector pixel types in this context are deprecated. The default behaviour will soon change to that implied by the '-altivec-compat=xl' option

    References

    -

    Diagnostic flags in Clang

    ]]> +

    Diagnostic flags in Clang

    ]]>
    INFO CODE_SMELL @@ -27926,6 +29594,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-gpu-maybe-wrong-side + clang-diagnostic-gpu-maybe-wrong-side + + Diagnostic text:

    +
      +
    • warning: capture host side class data member by this pointer in device or host device lambda function may result in invalid memory access if this pointer is not accessible on device side
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-cast-calling-convention clang-diagnostic-cast-calling-convention @@ -28124,6 +29806,20 @@ Derived(); // and so temporary construction is okay LINEAR 5min + + clang-diagnostic-argument-undefined-behaviour + clang-diagnostic-argument-undefined-behaviour + + Diagnostic text:

    +
      +
    • warning: argument value %0 will result in undefined behaviour
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-nonportable-vector-initialization clang-diagnostic-nonportable-vector-initialization @@ -28342,6 +30038,21 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-deprecated-copy-dtor + clang-diagnostic-deprecated-copy-dtor + + Diagnostic text:

    +
      +
    • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-declared destructor
    • +
    • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-provided destructor
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-partial-availability clang-diagnostic-partial-availability @@ -28415,7 +30126,7 @@ Derived(); // and so temporary construction is okay
  • warning: '%0' within '%1'
  • warning: '%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument
  • warning: '&&' within '||'
  • -
  • warning: '-fuse-ld=' taking a path is deprecated. Use '--ld-path=' instead
  • +
  • warning: '-fuse-ld=' taking a path is deprecated; use '--ld-path=' instead
  • warning: '/*' within block comment
  • warning: 'static' function %0 declared in header file should be declared 'static inline'
  • warning: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to %select{true|false}0
  • @@ -28432,6 +30143,7 @@ Derived(); // and so temporary construction is okay
  • warning: assigning %select{field|instance variable}0 to itself
  • warning: base class %0 is uninitialized when used here to access %q1
  • warning: bitwise comparison always evaluates to %select{false|true}0
  • +
  • warning: bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 did you mean logical negation?
  • warning: bitwise or with non-zero value always evaluates to true
  • warning: block pointer variable %0 is %select{uninitialized|null}1 when captured by block
  • warning: call to function without interrupt attribute could clobber interruptee's VFP registers
  • @@ -28452,6 +30164,7 @@ Derived(); // and so temporary construction is okay
  • warning: data argument not used by format string
  • warning: data argument position '%0' exceeds the number of data arguments (%1)
  • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-declared copy %select{assignment operator|constructor}1
  • +
  • warning: definition of implicit copy %select{constructor|assignment operator}1 for %0 is deprecated because it has a user-provided copy %select{assignment operator|constructor}1
  • warning: designated initializer invoked a non-designated initializer
  • warning: designated initializer missing a 'super' call to a designated initializer of the super class
  • warning: designated initializer should only invoke a designated initializer on 'super'
  • @@ -28494,12 +30207,13 @@ Derived(); // and so temporary construction is okay
  • warning: incomplete format specifier
  • warning: initializer %select{partially |}0overrides prior initialization of this subobject
  • warning: initializer %select{partially |}0overrides prior initialization of this subobject
  • +
  • warning: initializer order does not match the declaration order
  • warning: invalid conversion specifier '%0'
  • warning: invalid position specified for %select{field width|field precision}0
  • warning: ivar %0 which backs the property is not referenced in this property's accessor
  • warning: lambda capture %0 is not %select{used|required to be captured for this use}1
  • +
  • warning: left operand of comma operator has no effect
  • warning: length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier
  • -
  • warning: local variable %0 will be copied despite being %select{returned|thrown}1 by name
  • warning: logical not is only applied to the left hand side of this %select{comparison|bitwise operator}0
  • warning: loop variable %0 %diff{of type $ binds to a temporary constructed from type $|binds to a temporary constructed from a different type}1,2
  • warning: loop variable %0 creates a copy from type %1
  • @@ -28532,7 +30246,9 @@ Derived(); // and so temporary construction is okay
  • warning: overflow converting case value to switch condition type (%0 to %1)
  • warning: overlapping comparisons always evaluate to %select{false|true}0
  • warning: overloaded operator %select{>>|<<}0 has higher precedence than comparison operator
  • +
  • warning: parameter %0 set but not used
  • warning: performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0
  • +
  • warning: performing pointer subtraction with a null pointer %select{has|may have}0 undefined behavior
  • warning: position arguments in format strings start counting at 1 (not 0)
  • warning: pragma STDC FENV_ROUND is not supported
  • warning: pragma diagnostic expected 'error', 'warning', 'ignored', 'fatal', 'push', or 'pop'
  • @@ -28569,6 +30285,7 @@ Derived(); // and so temporary construction is okay
  • warning: unused variable %0
  • warning: unused variable %0
  • warning: use of __private_extern__ on a declaration may not produce external symbol private to the linkage unit and is deprecated
  • +
  • warning: use of bitwise '%0' with boolean operands
  • warning: use of unknown builtin %0
  • warning: using '%%P' format specifier without precision
  • warning: using '%0' format specifier annotation outside of os_log()/os_trace()
  • @@ -28579,6 +30296,7 @@ Derived(); // and so temporary construction is okay
  • warning: variable %0 is uninitialized when %select{used here|captured by block}1
  • warning: variable %0 is uninitialized when passed as a const reference argument here
  • warning: variable %0 is uninitialized when used within its own initialization
  • +
  • warning: variable %0 set but not used
  • warning: variable%select{s| %1|s %1 and %2|s %1, %2, and %3|s %1, %2, %3, and %4}0 used in loop condition not modified in loop body
  • warning: zero field width in scanf format string is unused
  • @@ -28824,11 +30542,14 @@ Derived(); // and so temporary construction is okay
  • warning: initialized lambda pack captures are a C++20 extension
  • warning: inline nested namespace definition is a C++20 extension
  • warning: invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension
  • +
  • warning: member using declaration naming a non-member enumerator is a C++20 extension
  • warning: range-based for loop initialization statements are a C++20 extension
  • warning: uninitialized variable in a constexpr %select{function|constructor}0 is a C++20 extension
  • warning: use of function template name with no prior declaration in function call with explicit template arguments is a C++20 extension
  • warning: use of the %0 attribute is a C++20 extension
  • warning: use of this statement in a constexpr %select{function|constructor}0 is a C++20 extension
  • +
  • warning: using declaration naming a scoped enumerator is a C++20 extension
  • +
  • warning: using enum declaration is a C++20 extension
  • References

    Diagnostic flags in Clang

    ]]> @@ -28850,6 +30571,21 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-frame-larger-than= + clang-diagnostic-frame-larger-than= + + Diagnostic text:

    +
      +
    • warning: %0
    • +
    • warning: stack frame size (%0) exceeds limit (%1) in '%2'
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-integer-overflow clang-diagnostic-integer-overflow @@ -28906,20 +30642,6 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL - - clang-diagnostic-div-by-zero - clang-diagnostic-div-by-zero - - Diagnostic text:

    -
      -
    • warning: %select{remainder|division}0 by zero is undefined
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - INFO - CODE_SMELL -
    clang-diagnostic-stack-protector clang-diagnostic-stack-protector @@ -29033,43 +30755,43 @@ Derived(); // and so temporary construction is okay CODE_SMELL - clang-diagnostic-msvc-not-found - clang-diagnostic-msvc-not-found + clang-diagnostic-div-by-zero + clang-diagnostic-div-by-zero Diagnostic text:

      -
    • warning: unable to find a Visual Studio installation; try running Clang from a developer command prompt
    • +
    • warning: %select{remainder|division}0 by zero is undefined

    References

    -

    Diagnostic flags in Clang

    ]]> +

    Diagnostic flags in Clang

    ]]>
    INFO CODE_SMELL
    - clang-diagnostic-darwin-sdk-settings - clang-diagnostic-darwin-sdk-settings + clang-diagnostic-msvc-not-found + clang-diagnostic-msvc-not-found Diagnostic text:

      -
    • warning: SDK settings were ignored as 'SDKSettings.json' could not be parsed
    • +
    • warning: unable to find a Visual Studio installation; try running Clang from a developer command prompt

    References

    -

    Diagnostic flags in Clang

    ]]> +

    Diagnostic flags in Clang

    ]]>
    INFO CODE_SMELL
    - clang-diagnostic-c++1z-compat-mangling - clang-diagnostic-c++1z-compat-mangling + clang-diagnostic-darwin-sdk-settings + clang-diagnostic-darwin-sdk-settings Diagnostic text:

      -
    • warning: mangled name of %0 will change in C++17 due to non-throwing exception specification in function signature
    • +
    • warning: SDK settings were ignored as 'SDKSettings.json' could not be parsed

    References

    -

    Diagnostic flags in Clang

    ]]> +

    Diagnostic flags in Clang

    ]]>
    INFO CODE_SMELL @@ -29189,53 +30911,43 @@ Derived(); // and so temporary construction is okay CODE_SMELL
    - clang-diagnostic-language-extension-token - clang-diagnostic-language-extension-token + clang-diagnostic-c++1z-compat-mangling + clang-diagnostic-c++1z-compat-mangling Diagnostic text:

      -
    • warning: extension used
    • +
    • warning: mangled name of %0 will change in C++17 due to non-throwing exception specification in function signature

    References

    -

    Diagnostic flags in Clang

    ]]> +

    Diagnostic flags in Clang

    ]]>
    INFO CODE_SMELL
    - clang-diagnostic-unicode-whitespace - clang-diagnostic-unicode-whitespace + clang-diagnostic-language-extension-token + clang-diagnostic-language-extension-token Diagnostic text:

      -
    • warning: treating Unicode character as whitespace
    • +
    • warning: extension used

    References

    -

    Diagnostic flags in Clang

    ]]> +

    Diagnostic flags in Clang

    ]]>
    INFO CODE_SMELL
    - clang-diagnostic-c++98-c++11-compat - clang-diagnostic-c++98-c++11-compat + clang-diagnostic-unicode-whitespace + clang-diagnostic-unicode-whitespace Diagnostic text:

      -
    • warning: 'decltype(auto)' type specifier is incompatible with C++ standards before C++14
    • -
    • warning: constexpr function with no return statements is incompatible with C++ standards before C++14
    • -
    • warning: digit separators are incompatible with C++ standards before C++14
    • -
    • warning: generic lambdas are incompatible with C++11
    • -
    • warning: initialized lambda captures are incompatible with C++ standards before C++14
    • -
    • warning: multiple return statements in constexpr function is incompatible with C++ standards before C++14
    • -
    • warning: return type deduction is incompatible with C++ standards before C++14
    • -
    • warning: type definition in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
    • -
    • warning: use of this statement in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
    • -
    • warning: variable declaration in a constexpr %select{function|constructor}0 is incompatible with C++ standards before C++14
    • -
    • warning: variable templates are incompatible with C++ standards before C++14
    • +
    • warning: treating Unicode character as whitespace

    References

    -

    Diagnostic flags in Clang

    ]]> +

    Diagnostic flags in Clang

    ]]>
    INFO CODE_SMELL @@ -29268,6 +30980,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-delimited-escape-sequence-extension + clang-diagnostic-delimited-escape-sequence-extension + + Diagnostic text:

    +
      +
    • warning: delimited escape sequences are a Clang extension
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-unknown-escape-sequence clang-diagnostic-unknown-escape-sequence @@ -29338,47 +31064,5 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL - - clang-diagnostic-pragma-once-outside-header - clang-diagnostic-pragma-once-outside-header - - Diagnostic text:

    -
      -
    • warning: #pragma once in main file
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - INFO - CODE_SMELL -
    - - clang-diagnostic-pragma-system-header-outside-header - clang-diagnostic-pragma-system-header-outside-header - - Diagnostic text:

    -
      -
    • warning: #pragma system_header ignored in main file
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - INFO - CODE_SMELL -
    - - clang-diagnostic-disabled-macro-expansion - clang-diagnostic-disabled-macro-expansion - - Diagnostic text:

    -
      -
    • warning: disabled expansion of recursive macro
    • -
    -

    References

    -

    Diagnostic flags in Clang

    ]]> -
    - INFO - CODE_SMELL -
    - + diff --git a/cxx-sensors/src/test/java/org/sonar/cxx/sensors/clangsa/CxxClangSARuleRepositoryTest.java b/cxx-sensors/src/test/java/org/sonar/cxx/sensors/clangsa/CxxClangSARuleRepositoryTest.java index 52eb929337..c8a87e4978 100644 --- a/cxx-sensors/src/test/java/org/sonar/cxx/sensors/clangsa/CxxClangSARuleRepositoryTest.java +++ b/cxx-sensors/src/test/java/org/sonar/cxx/sensors/clangsa/CxxClangSARuleRepositoryTest.java @@ -37,7 +37,7 @@ public void createRulesTest() { def.define(context); RulesDefinition.Repository repo = context.repository(CxxClangSARuleRepository.KEY); - assertEquals(91, repo.rules().size()); + assertEquals(92, repo.rules().size()); } } diff --git a/cxx-sensors/src/test/java/org/sonar/cxx/sensors/clangtidy/CxxClangTidyRuleRepositoryTest.java b/cxx-sensors/src/test/java/org/sonar/cxx/sensors/clangtidy/CxxClangTidyRuleRepositoryTest.java index e89c013f52..2085b60730 100644 --- a/cxx-sensors/src/test/java/org/sonar/cxx/sensors/clangtidy/CxxClangTidyRuleRepositoryTest.java +++ b/cxx-sensors/src/test/java/org/sonar/cxx/sensors/clangtidy/CxxClangTidyRuleRepositoryTest.java @@ -36,7 +36,7 @@ public void createRulesTest() { def.define(context); RulesDefinition.Repository repo = context.repository(CxxClangTidyRuleRepository.KEY); - assertEquals(1271, repo.rules().size()); + assertEquals(1316, repo.rules().size()); } } diff --git a/cxx-sensors/src/tools/clangtidy_createrules.py b/cxx-sensors/src/tools/clangtidy_createrules.py index 5bafc791ea..427976e8fb 100644 --- a/cxx-sensors/src/tools/clangtidy_createrules.py +++ b/cxx-sensors/src/tools/clangtidy_createrules.py @@ -17,7 +17,7 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -import cgi +import html import json import os import re @@ -30,7 +30,7 @@ SEVERITY_MAP = { - # last update: llvmorg-13-init-4898-g270a336ff462 + # last update: llvmorg-14-init-8123-ga875e6e1225a (git describe) # rule keys are in alphabetical order "abseil-no-namespace": {"type": "CODE_SMELL", "severity": "INFO"}, @@ -373,7 +373,7 @@ def create_template_rules(rules):
  • Create a new rule in SonarQube by "copying" this rule template and specify the CheckId of your custom rule, a title, a description, and a default severity.
  • Enable the newly created rule in your quality profile
  • -
  • Relaunch an analysis on your projects, et voilĂ , your custom rules are executed!
  • +
  • Relaunch an analysis on your projects, et voila, your custom rules are executed!
  • """ rule = et.Element('rule') @@ -504,7 +504,7 @@ def generate_description(diag_group_name, diagnostics): diag_class == "CLASS_REMARK") diag_text = diagnostic["Text"] diag_class_printable = DIAG_CLASS[diag_class]["printable"] - diag_text_escaped = cgi.escape(diag_text) + diag_text_escaped = html.escape(diag_text, quote=False) html_lines.append("
  • %s: %s
  • " % (diag_class_printable, diag_text_escaped)) html_lines.append("") diff --git a/cxx-sensors/src/tools/generate_clangtidy_resources.cmd b/cxx-sensors/src/tools/generate_clangtidy_resources.cmd new file mode 100644 index 0000000000..1e9c503285 --- /dev/null +++ b/cxx-sensors/src/tools/generate_clangtidy_resources.cmd @@ -0,0 +1,68 @@ +@ECHO OFF +CLS + +REM customize paths for your local system +SET SCRIPT_DIR=%~dp0 +SET PANDOC_DIR=C:\Program Files\Pandoc\ +SET PYTHON_DIR=C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\ +SET LLVM_DIR=C:\Development\git\llvm-project\ + +REM verify paths +IF NOT EXIST "%PANDOC_DIR%" ( + ECHO Invalid PANDOC_DIR setting + GOTO ERROR +) + +IF NOT EXIST "%PYTHON_DIR%" ( + ECHO Invalid PYTHON_DIR setting + GOTO ERROR +) + +IF NOT EXIST "%LLVM_DIR%" ( + ECHO Invalid LLVM_DIR setting + GOTO ERROR +) + +IF NOT EXIST "%LLVM_DIR%build\Release\bin" ( + ECHO You have to build LLVM first + GOTO ERROR +) + +REM tool versions +"%PANDOC_DIR%pandoc.exe" -v +"%PYTHON_DIR%python.exe" -V +"%LLVM_DIR%build\Release\bin\llvm-tblgen.exe" --version +git --version +ECHO LLVM recent tag: +PUSHD "%LLVM_DIR%" +git describe +POPD +ECHO. + +REM GENERATION OF RULES FROM CLANG-TIDY DOCUMENTATION (RST FILES) +ECHO generate the new version of the rules file... +"%PYTHON_DIR%python.exe" "%SCRIPT_DIR%clangtidy_createrules.py" rules "%LLVM_DIR%clang-tools-extra\docs\clang-tidy\checks" > "%SCRIPT_DIR%clangtidy_new.xml" +ECHO compare the new version with the old one, extend the old XML... +"%PYTHON_DIR%python.exe" "%SCRIPT_DIR%utils_createrules.py" comparerules "%SCRIPT_DIR%\..\main\resources\clangtidy.xml" "%SCRIPT_DIR%clangtidy_new.xml" > "%SCRIPT_DIR%clangtidy-comparison.md" + +REM GENERATION OF RULES FROM CLANG DIAGNOSTICS +ECHO generate the list of diagnostics... +PUSHD "%LLVM_DIR%clang\include\clang\Basic" +"%LLVM_DIR%build\Release\bin\llvm-tblgen.exe" -dump-json "%LLVM_DIR%clang\include\clang\Basic\Diagnostic.td" > "%SCRIPT_DIR%diagnostic.json" +POPD +ECHO generate the new version of the diagnostics file... +"%PYTHON_DIR%python.exe" "%SCRIPT_DIR%clangtidy_createrules.py" diagnostics "%SCRIPT_DIR%diagnostic.json" > "%SCRIPT_DIR%diagnostic_new.xml" +ECHO compare the new version with the old one, extend the old XML... +"%PYTHON_DIR%python.exe" "%SCRIPT_DIR%utils_createrules.py" comparerules "%SCRIPT_DIR%\..\main\resources\clangtidy.xml" "%SCRIPT_DIR%diagnostic_new.xml" > "%SCRIPT_DIR%diagnostic-comparison.md" + +REM exit +GOTO END +:ERROR +ECHO. +ECHO execution failed +EXIT /B 1 + +:END +ECHO. +ECHO finished succesfully +EXIT /B 0