From 33fb866d5fc84128d2b925bb6a317776e52ecb4c Mon Sep 17 00:00:00 2001 From: guwirth Date: Fri, 25 Feb 2022 16:40:11 +0100 Subject: [PATCH] support Clang-Tidy v15 - llvmorg-15-init-2831-geb3e09c9bf1d --- cxx-sensors/src/main/resources/clangtidy.xml | 1568 ++++++++++++----- .../CxxClangTidyRuleRepositoryTest.java | 2 +- .../src/tools/clangtidy_createrules.py | 39 +- .../tools/generate_clangtidy_resources.cmd | 22 +- cxx-sensors/src/tools/utils_createrules.py | 25 +- 5 files changed, 1221 insertions(+), 435 deletions(-) diff --git a/cxx-sensors/src/main/resources/clangtidy.xml b/cxx-sensors/src/main/resources/clangtidy.xml index 88ab82453d..5e416ee6ed 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-14-init-8123-ga875e6e1225a (git describe) + * last update: llvmorg-15-init-2831-geb3e09c9bf1d (git describe) --> @@ -457,11 +457,13 @@ absl::StrAppend(&s, "E", "F", "G");

clang-tidy - abseil-string-find-startswith

abseil-string-find-startswith

-

Checks whether a std::string::find() result is compared with 0, and suggests replacing with absl::StartsWith(). This is both a readability and performance issue.

+

Checks whether a std::string::find() or std::string::rfind() result is compared with 0, and suggests replacing with absl::StartsWith(). This is both a readability and performance issue.

string s = "...";
-if (s.find("Hello World") == 0) { /* do something */ }
+if (s.find("Hello World") == 0) { /* do something */ } +if (s.rfind("Hello World", 0) == 0) { /* do something */ }

becomes

string s = "...";
+if (absl::StartsWith(s, "Hello World")) { /* do something */ }
 if (absl::StartsWith(s, "Hello World")) { /* do something */ }

Options

@@ -1367,6 +1369,10 @@ foo(/*Value=*/nullptr);

CheckFunctionCalls

Whether to treat non-const member and non-member functions as they produce side effects. Disabled by default because it can increase the number of false positive warnings.

+
+

IgnoredFunctions

+

A semicolon-separated list of the names of functions or methods to be considered as not having side-effects. 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

]]> @@ -2466,6 +2472,33 @@ int _g(); // disallowed in global namespace only LINEAR 5min + + bugprone-shared-ptr-array-mismatch + bugprone-shared-ptr-array-mismatch + + +

clang-tidy - bugprone-shared-ptr-array-mismatch

+ +

bugprone-shared-ptr-array-mismatch

+

Finds initializations of C++ shared pointers to non-array type that are initialized with an array.

+

If a shared pointer std::shared_ptr<T> is initialized with a new-expression new T[] the memory is not deallocated correctly. The pointer uses plain delete in this case to deallocate the target memory. Instead a delete[] call is needed. A std::shared_ptr<T[]> calls the correct delete operator.

+

The check offers replacement of shared_ptr<T> to shared_ptr<T[]> if it is used at a single variable declaration (one variable in one statement).

+

Example:

+
std::shared_ptr<Foo> x(new Foo[10]); // -> std::shared_ptr<Foo[]> x(new Foo[10]);
+//                     ^ warning: shared pointer to non-array is initialized with array [bugprone-shared-ptr-array-mismatch]
+std::shared_ptr<Foo> x1(new Foo), x2(new Foo[10]); // no replacement
+//                                   ^ warning: shared pointer to non-array is initialized with array [bugprone-shared-ptr-array-mismatch]
+std::shared_ptr<Foo> x3(new Foo[10], [](const Foo *ptr) { delete[] ptr; }); // no warning
+struct S {
+  std::shared_ptr<Foo> x(new Foo[10]); // no replacement in this case
+  //                     ^ warning: shared pointer to non-array is initialized with array [bugprone-shared-ptr-array-mismatch]
+};
+

References

+

clang.llvm.org

]]> +
+ INFO + CODE_SMELL +
bugprone-signal-handler bugprone-signal-handler @@ -2829,6 +2862,60 @@ if (str == "\0abc") return; // This expression is always true LINEAR 5min + + bugprone-stringview-nullptr + bugprone-stringview-nullptr + + +

clang-tidy - bugprone-stringview-nullptr

+ +

bugprone-stringview-nullptr

+

Checks for various ways that the const CharT* constructor of std::basic_string_view can be passed a null argument and replaces them with the default constructor in most cases. For the comparison operators, braced initializer list does not compile so instead a call to .empty() or the empty string literal are used, where appropriate.

+

This prevents code from invoking behavior which is unconditionally undefined. The single-argument const CharT* constructor does not check for the null case before dereferencing its input. The standard is slated to add an explicitly-deleted overload to catch some of these cases: wg21.link/p2166

+

To catch the additional cases of NULL (which expands to __null) and 0, first run the modernize-use-nullptr check to convert the callers to nullptr.

+
std::string_view sv = nullptr;
+
+sv = nullptr;
+
+bool is_empty = sv == nullptr;
+bool isnt_empty = sv != nullptr;
+
+accepts_sv(nullptr);
+
+accepts_sv({{}});  // A
+
+accepts_sv({nullptr, 0});  // B
+

is translated into...

+
std::string_view sv = {};
+
+sv = {};
+
+bool is_empty = sv.empty();
+bool isnt_empty = !sv.empty();
+
+accepts_sv("");
+
+accepts_sv("");  // A
+
+accepts_sv({nullptr, 0});  // B
+
+
+

Note

+
+

The source pattern with trailing comment "A" selects the (const CharT*) constructor overload and then value-initializes the pointer, causing a null dereference. It happens to not include the nullptr literal, but it is still within the scope of this ClangTidy check.

+
+
+
+

Note

+
+

The source pattern with trailing comment "B" selects the (const CharT*, size_type) constructor which is perfectly valid, since the length argument is 0. It is not changed by this ClangTidy check.

+
+

References

+

clang.llvm.org

]]> +
+ INFO + CODE_SMELL +
bugprone-suspicious-enum-usage bugprone-suspicious-enum-usage @@ -3271,12 +3358,36 @@ do {

bugprone-unhandled-exception-at-new

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

+

Calls to new may throw exceptions of type std::bad_alloc that should be handled. Alternatively, the nonthrowing form of new can be used. The check verifies that the exception is handled in the function that calls new.

+

If a nonthrowing version is used or the exception is allowed to propagate out of the function no warning is generated.

+

The exception handler is checked if it catches a std::bad_alloc or std::exception exception type, or all exceptions (catch-all). The check assumes that any user-defined operator new is either noexcept or may throw an exception of type std::bad_alloc (or one derived from it). Other exception class types are not taken into account.

int *f() noexcept {
-  int *p = new int[1000];
+  int *p = new int[1000]; // warning: missing exception handler for allocation failure at 'new'
+  // ...
+  return p;
+}
+
int *f1() { // not 'noexcept'
+  int *p = new int[1000]; // no warning: exception can be handled outside
+                          // of this function
+  // ...
+  return p;
+}
+
+int *f2() noexcept {
+  try {
+    int *p = new int[1000]; // no warning: exception is handled
+    // ...
+    return p;
+  } catch (std::bad_alloc &) {
+    // ...
+  }
+  // ...
+}
+int *f3() noexcept {
+  int *p = new (std::nothrow) int[1000]; // no warning: "nothrow" is used
   // ...
   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

]]> @@ -3435,6 +3546,7 @@ public:
  • std::basic_string::empty() and std::vector::empty(). Not using the return value often indicates that the programmer confused the function with clear().
  • +

    cert-err33-c is an alias of this check that checks a fixed and large set of standard library functions.

    References

    clang.llvm.org

    ]]> @@ -3830,6 +3942,205 @@ struct Derived : Base { LINEAR 5min
    + + cert-err33-c + cert-err33-c + + +

    clang-tidy - cert-err33-c

    + +

    cert-err33-c

    +

    Warns on unused function return values. Many of the standard library functions return a value that indicates if the call was successful. Ignoring the returned value can cause unexpected behavior if an error has occured. The following functions are checked:

    +
      +
    • aligned_alloc()
    • +
    • asctime_s()
    • +
    • at_quick_exit()
    • +
    • atexit()
    • +
    • bsearch()
    • +
    • bsearch_s()
    • +
    • btowc()
    • +
    • c16rtomb()
    • +
    • c32rtomb()
    • +
    • calloc()
    • +
    • clock()
    • +
    • cnd_broadcast()
    • +
    • cnd_init()
    • +
    • cnd_signal()
    • +
    • cnd_timedwait()
    • +
    • cnd_wait()
    • +
    • ctime_s()
    • +
    • fclose()
    • +
    • fflush()
    • +
    • fgetc()
    • +
    • fgetpos()
    • +
    • fgets()
    • +
    • fgetwc()
    • +
    • fopen()
    • +
    • fopen_s()
    • +
    • fprintf()
    • +
    • fprintf_s()
    • +
    • fputc()
    • +
    • fputs()
    • +
    • fputwc()
    • +
    • fputws()
    • +
    • fread()
    • +
    • freopen()
    • +
    • freopen_s()
    • +
    • fscanf()
    • +
    • fscanf_s()
    • +
    • fseek()
    • +
    • fsetpos()
    • +
    • ftell()
    • +
    • fwprintf()
    • +
    • fwprintf_s()
    • +
    • fwrite()
    • +
    • fwscanf()
    • +
    • fwscanf_s()
    • +
    • getc()
    • +
    • getchar()
    • +
    • getenv()
    • +
    • getenv_s()
    • +
    • gets_s()
    • +
    • getwc()
    • +
    • getwchar()
    • +
    • gmtime()
    • +
    • gmtime_s()
    • +
    • localtime()
    • +
    • localtime_s()
    • +
    • malloc()
    • +
    • mbrtoc16()
    • +
    • mbrtoc32()
    • +
    • mbsrtowcs()
    • +
    • mbsrtowcs_s()
    • +
    • mbstowcs()
    • +
    • mbstowcs_s()
    • +
    • memchr()
    • +
    • mktime()
    • +
    • mtx_init()
    • +
    • mtx_lock()
    • +
    • mtx_timedlock()
    • +
    • mtx_trylock()
    • +
    • mtx_unlock()
    • +
    • printf_s()
    • +
    • putc()
    • +
    • putwc()
    • +
    • raise()
    • +
    • realloc()
    • +
    • remove()
    • +
    • rename()
    • +
    • setlocale()
    • +
    • setvbuf()
    • +
    • scanf()
    • +
    • scanf_s()
    • +
    • signal()
    • +
    • snprintf()
    • +
    • snprintf_s()
    • +
    • sprintf()
    • +
    • sprintf_s()
    • +
    • sscanf()
    • +
    • sscanf_s()
    • +
    • strchr()
    • +
    • strerror_s()
    • +
    • strftime()
    • +
    • strpbrk()
    • +
    • strrchr()
    • +
    • strstr()
    • +
    • strtod()
    • +
    • strtof()
    • +
    • strtoimax()
    • +
    • strtok()
    • +
    • strtok_s()
    • +
    • strtol()
    • +
    • strtold()
    • +
    • strtoll()
    • +
    • strtoumax()
    • +
    • strtoul()
    • +
    • strtoull()
    • +
    • strxfrm()
    • +
    • swprintf()
    • +
    • swprintf_s()
    • +
    • swscanf()
    • +
    • swscanf_s()
    • +
    • thrd_create()
    • +
    • thrd_detach()
    • +
    • thrd_join()
    • +
    • thrd_sleep()
    • +
    • time()
    • +
    • timespec_get()
    • +
    • tmpfile()
    • +
    • tmpfile_s()
    • +
    • tmpnam()
    • +
    • tmpnam_s()
    • +
    • tss_create()
    • +
    • tss_get()
    • +
    • tss_set()
    • +
    • ungetc()
    • +
    • ungetwc()
    • +
    • vfprintf()
    • +
    • vfprintf_s()
    • +
    • vfscanf()
    • +
    • vfscanf_s()
    • +
    • vfwprintf()
    • +
    • vfwprintf_s()
    • +
    • vfwscanf()
    • +
    • vfwscanf_s()
    • +
    • vprintf_s()
    • +
    • vscanf()
    • +
    • vscanf_s()
    • +
    • vsnprintf()
    • +
    • vsnprintf_s()
    • +
    • vsprintf()
    • +
    • vsprintf_s()
    • +
    • vsscanf()
    • +
    • vsscanf_s()
    • +
    • vswprintf()
    • +
    • vswprintf_s()
    • +
    • vswscanf()
    • +
    • vswscanf_s()
    • +
    • vwprintf_s()
    • +
    • vwscanf()
    • +
    • vwscanf_s()
    • +
    • wcrtomb()
    • +
    • wcschr()
    • +
    • wcsftime()
    • +
    • wcspbrk()
    • +
    • wcsrchr()
    • +
    • wcsrtombs()
    • +
    • wcsrtombs_s()
    • +
    • wcsstr()
    • +
    • wcstod()
    • +
    • wcstof()
    • +
    • wcstoimax()
    • +
    • wcstok()
    • +
    • wcstok_s()
    • +
    • wcstol()
    • +
    • wcstold()
    • +
    • wcstoll()
    • +
    • wcstombs()
    • +
    • wcstombs_s()
    • +
    • wcstoumax()
    • +
    • wcstoul()
    • +
    • wcstoull()
    • +
    • wcsxfrm()
    • +
    • wctob()
    • +
    • wctrans()
    • +
    • wctype()
    • +
    • wmemchr()
    • +
    • wprintf_s()
    • +
    • wscanf()
    • +
    • wscanf_s()
    • +
    +

    This check is an alias of check bugprone-unused-return-value with a fixed set of functions.

    +

    The check corresponds to a part of CERT C Coding Standard rule ERR33-C. Detect and handle standard library errors. The list of checked functions is taken from the rule, with following exception:

    +
      +
    • The check can not differentiate if a function is called with NULL argument. Therefore the following functions are not checked: mblen, mbrlen, mbrtowc, mbtowc, wctomb, wctomb_s
    • +
    +

    References

    +

    clang.llvm.org

    ]]> +
    + INFO + CODE_SMELL +
    cert-err34-c cert-err34-c @@ -6005,7 +6316,30 @@ void function() {

    cppcoreguidelines-macro-usage

    Finds macro usage that is considered problematic because better language constructs exist for the task.

    -

    The relevant sections in the C++ Core Guidelines are Enum.1, ES.30, ES.31 and ES.33.

    +

    The relevant sections in the C++ Core Guidelines are ES.31, and ES.32.

    +

    Examples:

    +
    #define C 0
    +#define F1(x, y) ((a) > (b) ? (a) : (b))
    +#define F2(...) (__VA_ARGS__)
    +#define COMMA ,
    +#define NORETURN [[noreturn]]
    +#define DEPRECATED attribute((deprecated))
    +#if LIB_EXPORTS
    +#define DLLEXPORTS __declspec(dllexport)
    +#else
    +#define DLLEXPORTS __declspec(dllimport)
    +#endif
    +

    results in the following warnings:

    +
    4 warnings generated.
    +test.cpp:1:9: warning: macro 'C' used to declare a constant; consider using a 'constexpr' constant [cppcoreguidelines-macro-usage]
    +#define C 0
    +        ^
    +test.cpp:2:9: warning: function-like macro 'F1' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage]
    +#define F1(x, y) ((a) > (b) ? (a) : (b))
    +        ^
    +test.cpp:3:9: warning: variadic macro 'F2' used; consider using a 'constexpr' variadic template function [cppcoreguidelines-macro-usage]
    +#define F2(...) (__VA_ARGS__)
    +        ^

    Options

    AllowedRegexp

    @@ -6040,7 +6374,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) if WarnOnIntegerNarrowingConversion Option is set,
    • -
    • an integer to a narrower floating-point (e.g. uint64_t to float),
    • +
    • an integer to a narrower floating-point (e.g. uint64_t to float) if WarnOnIntegerToFloatingPointNarrowingConversion Option is set,
    • 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.
    @@ -6058,6 +6392,10 @@ void function() {

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

    +

    WarnOnIntegerToFloatingPointNarrowingConversion

    +

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

    +
    +

    WarnOnFloatingPointNarrowingConversion

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

    @@ -6386,6 +6724,7 @@ public:

    cppcoreguidelines-pro-bounds-constant-array-index

    This check flags all array subscript expressions on static arrays and std::arrays that either do not have a constant integer expression index or are out of bounds (for std::array). For out-of-bounds checking of static arrays, see the -Warray-bounds Clang diagnostic.

    This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-bounds-arrayindex.

    +

    Optionally, this check can generate fixes using gsl::at for indexing.

    Options

    GslHeader

    @@ -8439,6 +8778,57 @@ constexpr T pi = T(3.1415926L); LINEAR 5min + + misc-misleading-bidirectional + misc-misleading-bidirectional + + +

    clang-tidy - misc-misleading-bidirectional

    +
    +

    misc-misleading-bidirectional

    +

    Warn about unterminated bidirectional unicode sequence, detecting potential attack as described in the Trojan Source attack.

    +

    Example:

    +
    #include <iostream>
    +
    +int main() {
    +    bool isAdmin = false;
    +    /* } if (isAdmin)  begin admins only */
    +        std::cout << "You are an admin.\n";
    +    /* end admins only  { */
    +    return 0;
    +}
    +

    References

    +

    clang.llvm.org

    ]]> + + INFO + CODE_SMELL +
    + + misc-misleading-identifier + misc-misleading-identifier + + +

    clang-tidy - misc-misleading-identifier

    + +

    misc-misleading-identifier

    +

    Finds identifiers that contain Unicode characters with right-to-left direction, which can be confusing as they may change the understanding of a whole statement line, as described in Trojan Source.

    +

    An example of such misleading code follows:

    +
    #include <stdio.h>
    +
    +short int  = (short int)0;
    +short int  = (short int)12345;
    +
    +int main() {
    +  int  = ; // a local variable, set to zero?
    +  printf(" is %d\n", );
    +  printf(" is %d\n", );
    +}
    +

    References

    +

    clang.llvm.org

    ]]> +
    + INFO + CODE_SMELL +
    misc-misplaced-const misc-misplaced-const @@ -8649,7 +9039,7 @@ void f(const int_ptr ptr) {
    • The return type must be Class&.
    • -
    • Works with move-assign and assign by value.
    • +
    • The assignment may be from the class type by value, const lvalue reference, non-const rvalue reference, or from a completely different type (e.g. int).
    • Private and deleted operators are ignored.
    • The operator must always return *this.
    @@ -9878,7 +10268,7 @@ bool x = p ? true : false;

    clang-tidy - modernize-use-default-member-init

    modernize-use-default-member-init

    -

    This check converts a default constructor's member initializers into the new default member initializers in C++11. Other member initializers that match the default member initializer are removed. This can reduce repeated code or allow use of '= default'.

    +

    This check converts constructors' member initializers into the new default member initializers in C++11. Other member initializers that match the default member initializer are removed. This can reduce repeated code or allow use of '= default'.

    struct A {
       A() : i(5), j(10.0) {}
       A(int i) : i(i), j(10.0) {}
    @@ -10553,6 +10943,22 @@ MPI_Send(&buf, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
    LINEAR 5min + + objc-assert-equals + objc-assert-equals + + +

    clang-tidy - objc-assert-equals

    + +

    objc-assert-equals

    +

    Finds improper usages of XCTAssertEqual and XCTAssertNotEqual and replaces them with XCTAssertEqualObjects or XCTAssertNotEqualObjects.

    +

    This makes tests less fragile, as many improperly rely on pointer equality for strings that have equal values. This assumption is not guarantted by the language.

    +

    References

    +

    clang.llvm.org

    ]]> +
    + INFO + CODE_SMELL +
    objc-avoid-nserror-init objc-avoid-nserror-init @@ -11061,6 +11467,10 @@ f(std::move(s)); // Warning: passing result of std::move as a const reference a

    CheckTriviallyCopyableMove

    If true, enables detection of trivially copyable types that do not have a move constructor. Default is true.

    +
    +

    CheckMoveToConstRef

    +

    If true, enables detection of std::move() passed as a const reference argument. Default is true.

    +

    References

    clang.llvm.org

    ]]> @@ -11474,6 +11884,78 @@ const Clazz* foo(); LINEAR 5min
    + + readability-container-contains + readability-container-contains + + +

    clang-tidy - readability-container-contains

    + +

    readability-container-contains

    +

    Finds usages of container.count() and container.find() == container.end() which should be replaced by a call to the container.contains() method introduced in C++ 20.

    +

    Whether an element is contained inside a container should be checked with contains instead of count/find because contains conveys the intent more clearly. Furthermore, for containers which permit multiple entries per key (multimap, multiset, ...), contains is more efficient than count because count has to do unnecessary additional work.

    +

    Examples:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Initial expressionResult
    myMap.find(x) == myMap.end()!myMap.contains(x)
    myMap.find(x) != myMap.end()myMap.contains(x)
    if (myMap.count(x))if (myMap.contains(x))
    bool exists = myMap.count(x)bool exists = myMap.contains(x)
    bool exists = myMap.count(x) > 0bool exists = myMap.contains(x)
    bool exists = myMap.count(x) >= 1bool exists = myMap.contains(x)
    bool missing = myMap.count(x) == 0bool missing = !myMap.contains(x)
    +

    This check applies to std::set, std::unordered_set, std::map, std::unordered_map and the corresponding multi-key variants. It is only active for C++20 and later, as the contains method was only added in C++20.

    +

    References

    +

    clang.llvm.org

    ]]> +
    + INFO + CODE_SMELL +
    + + readability-container-data-pointer + readability-container-data-pointer + + +

    clang-tidy - readability-container-data-pointer

    + +

    readability-container-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-container-size-empty readability-container-size-empty @@ -11547,6 +12029,35 @@ if (p) INFO CODE_SMELL + + readability-duplicate-include + readability-duplicate-include + + +

    clang-tidy - readability-duplicate-include

    + +

    readability-duplicate-include

    +

    Looks for duplicate includes and removes them. The check maintains a list of included files and looks for duplicates. If a macro is defined or undefined then the list of included files is cleared.

    +

    Examples:

    +
    #include <memory>
    +#include <vector>
    +#include <memory>
    +

    becomes

    +
    #include <memory>
    +#include <vector>
    +

    Because of the intervening macro definitions, this code remains unchanged:

    +
    #undef NDEBUG
    +#include "assertion.h"
    +// ...code with assertions enabled
    +#define NDEBUG
    +#include "assertion.h"
    +// ...code with assertions disabled
    +

    References

    +

    clang.llvm.org

    ]]> +
    + INFO + CODE_SMELL +
    readability-else-after-return readability-else-after-return @@ -14563,6 +15074,11 @@ int f3(int x) { struct S { int *a; int *b; }; int f3(struct S *p) { *(p->a) = 0; +} + +// no warning; p is referenced by an lvalue. +void f4(int *p) { + int &x = *p; }

    References

    clang.llvm.org

    ]]> @@ -15153,7 +15669,10 @@ C::x;

    In this case, static is redundant, because anonymous namespace limits the visibility of definitions to a single translation unit.

    namespace {
       static int a = 1; // Warning.
    -  static const b = 1; // Warning.
    +  static const int b = 1; // Warning.
    +  namespace inner {
    +    static int c = 1; // Warning.
    +  }
     }

    The check will apply a fix by removing the redundant static qualifier.

    References

    @@ -15477,7 +15996,7 @@ Derived(); // and so temporary construction is okay LINEAR 5min
    - + @@ -15487,7 +16006,7 @@ Derived(); // and so temporary construction is okay 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
    • +
    • warning: requesting an alignment of 16 bytes or greater for struct members is not binary compatible with IBM XL C/C++ for AIX 16.1.0 and older

    References

    Diagnostic flags in Clang

    ]]> @@ -15694,6 +16213,7 @@ Derived(); // and so temporary construction is okay
  • warning: %select{values of type|enum values with underlying type}2 '%0' should not be used as format arguments; add an explicit cast to %1 instead
  • warning: %select{void function|void method|constructor|destructor}1 %0 should not return a value
  • warning: %select{|empty }0%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++
  • +
  • warning: '%%n' specifier not supported on this platform
  • warning: '%0' is not a valid object format flag
  • warning: '%0' within '%1'
  • warning: '%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument
  • @@ -15862,6 +16382,20 @@ Derived(); // and so temporary construction is okay LINEAR 5min
    + + clang-diagnostic-always-inline-coroutine + clang-diagnostic-always-inline-coroutine + + Diagnostic text:

    +
      +
    • warning: this coroutine may be split into pieces; not every piece is guaranteed to be inlined
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-ambiguous-member-template clang-diagnostic-ambiguous-member-template @@ -16000,7 +16534,7 @@ Derived(); // and so temporary construction is okay
  • warning: %select{alias|ifunc}1 will not be in section '%0' but in the same section as the %select{aliasee|resolver}2
  • warning: %select{alias|ifunc}2 will always resolve to %0 even if weak definition of %1 is overridden
  • warning: %select{alignment|size}0 of field %1 (%2 bits) does not match the %select{alignment|size}0 of the first field in transparent union; transparent_union attribute ignored
  • -
  • warning: %select{unsupported|duplicate|unknown}0%select{| architecture| tune CPU}1 '%2' in the 'target' attribute string; 'target' attribute ignored
  • +
  • warning: %select{unsupported|duplicate|unknown}0%select{| architecture| tune CPU}1 '%2' in the '%select{target|target_clones}3' attribute string; '%select{target|target_clones}3' attribute ignored
  • warning: '%0' attribute cannot be specified on a definition
  • warning: '%0' only applies to %select{function|pointer|Objective-C object or block pointer}1 types; type here is %2
  • warning: '__clang__' is a predefined macro name, not an attribute scope specifier; did you mean '_Clang' instead?
  • @@ -16439,6 +16973,23 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-branch-protection + clang-diagnostic-branch-protection + + Diagnostic text:

    +
      +
    • warning: '-mbranch-protection=' option is incompatible with the '%0' architecture
    • +
    • warning: ignoring the 'branch-protection' attribute because the '%0' architecture does not support it
    • +
    • warning: invalid branch protection option '%0' in '%1'
    • +
    • warning: unsupported branch protection specification '%0'
    • +
    +

    References

    +

    Diagnostic flags in Clang

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

      +
    • warning: '_BitInt' is incompatible with C standards before C2x
    • warning: '_Static_assert' with no message is incompatible with C standards before C2x
    • warning: digit separators are incompatible with C standards before C2x
    @@ -16585,6 +17137,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

      +
    • warning: '_BitInt' is incompatible with C standards before C2x
    • warning: '_Static_assert' with no message is incompatible with C standards before C2x
    • warning: digit separators are incompatible with C standards before C2x
    @@ -16711,6 +17264,7 @@ Derived(); // and so temporary construction is okay
  • warning: non-constant-expression cannot be narrowed from type %0 to %1 in initializer list in C++11
  • 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: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • 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
  • @@ -16862,6 +17416,8 @@ Derived(); // and so temporary construction is okay
  • 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: non-type template parameters declared with %0 are incompatible with C++ standards before C++17
  • +
  • warning: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • +
  • warning: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • warning: pack expansion using declaration is 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
  • @@ -17066,6 +17622,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-c++14-attribute-extensions + clang-diagnostic-c++14-attribute-extensions + + Diagnostic text:

    +
      +
    • warning: use of the %0 attribute is a C++14 extension
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-c++14-binary-literal clang-diagnostic-c++14-binary-literal @@ -17120,6 +17690,7 @@ Derived(); // and so temporary construction is okay
  • 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: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • 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
  • @@ -17218,6 +17789,8 @@ Derived(); // and so temporary construction is okay
  • 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: non-type template parameters declared with %0 are incompatible with C++ standards before C++17
  • +
  • warning: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • +
  • warning: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • warning: pack expansion using declaration is 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
  • @@ -17282,6 +17855,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-c++17-attribute-extensions + clang-diagnostic-c++17-attribute-extensions + + Diagnostic text:

    +
      +
    • warning: use of the %0 attribute is a C++17 extension
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-c++17-compat clang-diagnostic-c++17-compat @@ -17313,6 +17900,7 @@ Derived(); // and so temporary construction is okay
  • 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: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • 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
  • @@ -17397,6 +17985,8 @@ Derived(); // and so temporary construction is okay
  • 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: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • +
  • warning: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • 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
  • @@ -17439,7 +18029,6 @@ 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
  • @@ -17454,6 +18043,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-c++20-attribute-extensions + clang-diagnostic-c++20-attribute-extensions + + Diagnostic text:

    +
      +
    • warning: use of the %0 attribute is a C++20 extension
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-c++20-compat clang-diagnostic-c++20-compat @@ -17469,6 +18072,7 @@ Derived(); // and so temporary construction is okay
  • 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: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • 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
  • @@ -17497,6 +18101,8 @@ Derived(); // and so temporary construction is okay
  • 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: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • +
  • warning: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • 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
  • @@ -17623,6 +18229,7 @@ Derived(); // and so temporary construction is okay
  • warning: non-type template argument referring to %select{function|object}0 %1 with internal linkage is incompatible with C++98
  • 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: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • 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
  • @@ -17852,6 +18459,8 @@ Derived(); // and so temporary construction is okay
  • 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: non-type template parameters declared with %0 are incompatible with C++ standards before C++17
  • +
  • warning: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • +
  • warning: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • warning: pack expansion using declaration is 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
  • @@ -18161,6 +18770,7 @@ Derived(); // and so temporary construction is okay
  • 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: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • References

    Diagnostic flags in Clang

    ]]> @@ -18178,6 +18788,7 @@ Derived(); // and so temporary construction is okay
  • 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: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
  • References

    Diagnostic flags in Clang

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

    • warning: %0 is required to declare the member 'unhandled_exception()' when exceptions are enabled
    • +
    • warning: 'for co_await' belongs to CoroutineTS instead of C++20, which is deprecated
    • warning: return type of 'coroutine_handle<>::address should be 'void*' (have %0) in order to get capability with existing async C API.
    • +
    • warning: support for std::experimental::%0 will be removed in LLVM 15; use std::%0 instead
    • +
    • warning: this coroutine may be split into pieces; not every piece is guaranteed to be inlined

    References

    Diagnostic flags in Clang

    ]]> @@ -18720,6 +19334,21 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-declaration-after-statement + clang-diagnostic-declaration-after-statement + + Diagnostic text:

    +
      +
    • warning: mixing declarations and code is a C99 extension
    • +
    • warning: mixing declarations and code is incompatible with standards before C99
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-defaulted-function-deleted clang-diagnostic-defaulted-function-deleted @@ -18825,12 +19454,13 @@ Derived(); // and so temporary construction is okay
  • warning: %sub{select_arith_conv_kind}0 different enumeration types%diff{ ($ and $)|}1,2 is deprecated
  • warning: %sub{select_arith_conv_kind}0 different enumeration types%diff{ ($ and $)|}1,2 is deprecated
  • warning: %sub{select_arith_conv_kind}0 different enumeration types%diff{ ($ and $)|}1,2 is deprecated
  • +
  • warning: '_ExtInt' is deprecated; use '_BitInt' instead
  • 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: Use of 'long' with '__vector' is deprecated
  • warning: access declarations are deprecated; use using declarations instead
  • -
  • warning: argument '%0' is deprecated%select{|, use '%2' instead}1
  • +
  • warning: argument '%0' is deprecated, use '%1' instead
  • 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
  • @@ -18846,7 +19476,8 @@ Derived(); // and so temporary construction is okay
  • warning: property access is using %0 method which is deprecated
  • warning: specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead
  • warning: specifying vector types with the 'mode' attribute is deprecated; use the 'vector_size' attribute instead
  • -
  • warning: top-level comma expression in array subscript is deprecated
  • +
  • warning: the '[[_Noreturn]]' attribute spelling is deprecated in C2x; use '[[noreturn]]' instead
  • +
  • warning: top-level comma expression in array subscript is deprecated in C++20 and unsupported in C++2b
  • warning: treating '%0' input as '%1' when in C++ mode, this behavior is deprecated
  • warning: use of C-style parameters in Objective-C method declarations is deprecated
  • warning: use of result of assignment to object of volatile-qualified type %0 is deprecated
  • @@ -18895,6 +19526,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

    • warning: specifying vector types with the 'mode' attribute is deprecated; use the 'vector_size' attribute instead
    • +
    • warning: the '[[_Noreturn]]' attribute spelling is deprecated in C2x; use '[[noreturn]]' instead

    References

    Diagnostic flags in Clang

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

      -
    • warning: top-level comma expression in array subscript is deprecated
    • +
    • warning: top-level comma expression in array subscript is deprecated in C++20 and unsupported in C++2b

    References

    Diagnostic flags in Clang

    ]]> @@ -18974,6 +19606,21 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
    + + clang-diagnostic-deprecated-coroutine + clang-diagnostic-deprecated-coroutine + + Diagnostic text:

    +
      +
    • warning: 'for co_await' belongs to CoroutineTS instead of C++20, which is deprecated
    • +
    • warning: support for std::experimental::%0 will be removed in LLVM 15; use std::%0 instead
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-deprecated-declarations clang-diagnostic-deprecated-declarations @@ -19063,6 +19710,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-deprecated-experimental-coroutine + clang-diagnostic-deprecated-experimental-coroutine + + Diagnostic text:

    +
      +
    • warning: support for std::experimental::%0 will be removed in LLVM 15; use std::%0 instead
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    clang-diagnostic-deprecated-implementations clang-diagnostic-deprecated-implementations @@ -19150,17 +19811,31 @@ Derived(); // and so temporary construction is okay CODE_SMELL - clang-diagnostic-deprecated-volatile - clang-diagnostic-deprecated-volatile + clang-diagnostic-deprecated-type + clang-diagnostic-deprecated-type Diagnostic text:

      -
    • warning: %select{decrement|increment}0 of object of volatile-qualified type %1 is deprecated
    • -
    • warning: compound assignment to object of volatile-qualified type %0 is deprecated
    • -
    • warning: use of result of assignment to object of volatile-qualified type %0 is deprecated
    • -
    • warning: volatile qualifier in structured binding declaration is deprecated
    • -
    • warning: volatile-qualified parameter type %0 is deprecated
    • -
    • warning: volatile-qualified return type %0 is deprecated
    • +
    • warning: '_ExtInt' is deprecated; use '_BitInt' instead
    • +
    +

    References

    +

    Diagnostic flags in Clang

    ]]> +
    + INFO + CODE_SMELL +
    + + clang-diagnostic-deprecated-volatile + clang-diagnostic-deprecated-volatile + + Diagnostic text:

    +
      +
    • warning: %select{decrement|increment}0 of object of volatile-qualified type %1 is deprecated
    • +
    • warning: compound assignment to object of volatile-qualified type %0 is deprecated
    • +
    • warning: use of result of assignment to object of volatile-qualified type %0 is deprecated
    • +
    • warning: volatile qualifier in structured binding declaration is deprecated
    • +
    • warning: volatile-qualified parameter type %0 is deprecated
    • +
    • warning: volatile-qualified return type %0 is deprecated

    References

    Diagnostic flags in Clang

    ]]> @@ -19886,6 +20561,7 @@ Derived(); // and so temporary construction is okay
    • warning: %select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior
    • warning: %select{values of type|enum values with underlying type}2 '%0' should not be used as format arguments; add an explicit cast to %1 instead
    • +
    • warning: '%%n' specifier not supported on this platform
    • warning: '%0' is not a valid object format flag
    • warning: '%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument
    • warning: cannot mix positional and non-positional arguments in format string
    • @@ -20073,6 +20749,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

        +
      • warning: '%0' may overflow; destination buffer in argument %1 has size %2, but the corresponding specifier may require size %3
      • 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
      • @@ -20205,6 +20882,8 @@ Derived(); // and so temporary construction is okay
        • warning: CPU list contains duplicate entries; attribute ignored
        • warning: body of cpu_dispatch function will be ignored
        • +
        • warning: mixing 'target_clones' specifier mechanisms is permitted for GCC compatibility; use a comma separated sequence of string literals, or a string literal containing a comma-separated list of versions
        • +
        • warning: version list contains duplicate entries

        References

        Diagnostic flags in Clang

        ]]> @@ -20212,6 +20891,22 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-future-attribute-extensions + clang-diagnostic-future-attribute-extensions + + Diagnostic text:

        +
          +
        • warning: use of the %0 attribute is a C++14 extension
        • +
        • warning: use of the %0 attribute is a C++17 extension
        • +
        • warning: use of the %0 attribute is a C++20 extension
        • +
        +

        References

        +

        Diagnostic flags in Clang

        ]]> +
        + INFO + CODE_SMELL +
        clang-diagnostic-write-strings clang-diagnostic-write-strings @@ -20746,7 +21441,7 @@ Derived(); // and so temporary construction is okay
      • warning: %select{alias|ifunc}1 will not be in section '%0' but in the same section as the %select{aliasee|resolver}2
      • warning: %select{alias|ifunc}2 will always resolve to %0 even if weak definition of %1 is overridden
      • warning: %select{alignment|size}0 of field %1 (%2 bits) does not match the %select{alignment|size}0 of the first field in transparent union; transparent_union attribute ignored
      • -
      • warning: %select{unsupported|duplicate|unknown}0%select{| architecture| tune CPU}1 '%2' in the 'target' attribute string; 'target' attribute ignored
      • +
      • warning: %select{unsupported|duplicate|unknown}0%select{| architecture| tune CPU}1 '%2' in the '%select{target|target_clones}3' attribute string; '%select{target|target_clones}3' attribute ignored
      • warning: '%0' attribute cannot be specified on a definition
      • warning: '%0' only applies to %select{function|pointer|Objective-C object or block pointer}1 types; type here is %2
      • warning: '__clang__' is a predefined macro name, not an attribute scope specifier; did you mean '_Clang' instead?
      • @@ -21413,6 +22108,8 @@ Derived(); // and so temporary construction is okay Diagnostic text:

        • warning: ignoring extension '%0' because the '%1' architecture does not support it
        • +
        • warning: missing plugin argument for plugin %0 in %1
        • +
        • warning: missing plugin name in %0
        • 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'
        • @@ -21856,7 +22553,6 @@ Derived(); // and so temporary construction is okay
          • warning: #include resolved using non-portable Microsoft search rules as: %0
          • warning: #pragma %0(".drectve") has undefined behavior, use #pragma comment(linker, ...) instead
          • -
          • warning: %0 is missing exception specification '%1'
          • warning: %q0 redeclared without %1 attribute: previous %1 ignored
          • 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
          • @@ -22085,7 +22781,6 @@ Derived(); // and so temporary construction is okay Diagnostic text:

              -
            • warning: %0 is missing exception specification '%1'
            • warning: %select{|pointer to |reference to }0incomplete type %1 is not allowed in exception specification
            • warning: exception specification in declaration does not match previous declaration
            • warning: exception specification in explicit instantiation does not match instantiated one
            • @@ -22638,6 +23333,7 @@ Derived(); // and so temporary construction is okay
            • warning: %select{values of type|enum values with underlying type}2 '%0' should not be used as format arguments; add an explicit cast to %1 instead
            • warning: %select{void function|void method|constructor|destructor}1 %0 should not return a value
            • warning: %select{|empty }0%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++
            • +
            • warning: '%%n' specifier not supported on this platform
            • warning: '%0' is not a valid object format flag
            • warning: '%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument
            • warning: '/*' within block comment
            • @@ -23856,7 +24552,6 @@ Derived(); // and so temporary construction is okay
            • warning: initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')
            • warning: interop type '%0' cannot be specified more than once
            • 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: 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
            • @@ -24001,10 +24696,13 @@ Derived(); // and so temporary construction is okay Diagnostic text:

                +
              • warning: %0 requires HVX, use -mhvx/-mhvx= to enable it
              • +
              • warning: '%0' does not support '-%1'; 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: /JMC requires debug info. Use '/Zi', '/Z7' or other debug options; option ignored
              • warning: ignoring '%0' option as it cannot be used with %select{implicit usage of|}1 -mabicalls and the N64 ABI
              • +
              • warning: ignoring '%0' option as it is not currently supported for offload arch '%1'. Use it with an offload arch containing '%2' instead
              • +
              • warning: ignoring '%0' option as it is not currently supported for target '%1'
              • warning: ignoring '-mlong-calls' option as it is not currently supported with %select{|the implicit usage of }0-mabicalls
              • warning: ignoring '-msmall-data-limit=' with -mcmodel=large for -fpic or RV64
              • warning: option '%0' was ignored by the PS4 toolchain, using '-fPIC'
              • @@ -24399,6 +25097,7 @@ 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: Setting the floating point evaluation method to `source` on a target without SSE is not supported.
              • 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'
              • @@ -24940,7 +25639,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

                • remark: -fsanitize-address-field-padding applied to %0
                • -
                • remark: -fsanitize-address-field-padding ignored for %0 because it %select{is not C++|is packed|is a union|is trivially copyable|has trivial destructor|is standard layout|is in a blacklisted file|is blacklisted}1
                • +
                • remark: -fsanitize-address-field-padding ignored for %0 because it %select{is not C++|is packed|is a union|is trivially copyable|has trivial destructor|is standard layout|is in a ignorelisted file|is ignorelisted}1

                References

                Diagnostic flags in Clang

                ]]> @@ -25342,7 +26041,6 @@ Derived(); // and so temporary construction is okay
              • warning: '#pragma omp declare variant' cannot be applied to the function that was defined already; the original function might be used
              • warning: OpenMP only allows an ordered construct with the simd clause nested in a simd construct
              • 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: 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: score expressions in the OpenMP context selector need to be constant; %0 is not and will be ignored
              • warning: unexpected '#pragma omp ...' in program
              • warning: variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'
              • @@ -25630,6 +26328,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-target-clones-mixed-specifiers + clang-diagnostic-target-clones-mixed-specifiers + + Diagnostic text:

                +
                  +
                • warning: mixing 'target_clones' specifier mechanisms is permitted for GCC compatibility; use a comma separated sequence of string literals, or a string literal containing a comma-separated list of versions
                • +
                +

                References

                +

                Diagnostic flags in Clang

                ]]> +
                + INFO + CODE_SMELL +
                clang-diagnostic-tautological-bitwise-compare clang-diagnostic-tautological-bitwise-compare @@ -26064,6 +26776,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-unaligned-access + clang-diagnostic-unaligned-access + + Diagnostic text:

                +
                  +
                • warning: field %1 within %0 is less aligned than %2 and is usually due to %0 being packed, which can lead to unaligned accesses
                • +
                +

                References

                +

                Diagnostic flags in Clang

                ]]> +
                + INFO + CODE_SMELL +
                clang-diagnostic-unavailable-declarations clang-diagnostic-unavailable-declarations @@ -27269,6 +27995,34 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-nonportable-include-path + clang-diagnostic-nonportable-include-path + + Diagnostic text:

                +
                  +
                • warning: non-portable path to file '%0'; specified path differs in case from file name on disk
                • +
                +

                References

                +

                Diagnostic flags in Clang

                ]]> +
                + INFO + CODE_SMELL +
                + + clang-diagnostic-nonportable-system-include-path + clang-diagnostic-nonportable-system-include-path + + Diagnostic text:

                +
                  +
                • warning: non-portable path to file '%0'; specified path differs in case from file name on disk
                • +
                +

                References

                +

                Diagnostic flags in Clang

                ]]> +
                + INFO + CODE_SMELL +
                clang-diagnostic-pragma-once-outside-header clang-diagnostic-pragma-once-outside-header @@ -27381,6 +28135,31 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + 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-embedded-directive clang-diagnostic-embedded-directive @@ -27411,31 +28190,6 @@ 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 @@ -27725,43 +28479,15 @@ Derived(); // and so temporary construction is okay CODE_SMELL - clang-diagnostic-concepts-ts-compat - clang-diagnostic-concepts-ts-compat - - Diagnostic text:

                -
                  -
                • warning: ISO C++20 does not permit the 'bool' keyword after 'concept'
                • -
                -

                References

                -

                Diagnostic flags in Clang

                ]]> -
                - INFO - CODE_SMELL -
                - - clang-diagnostic-duplicate-enum - clang-diagnostic-duplicate-enum - - Diagnostic text:

                -
                  -
                • warning: element %0 has been implicitly assigned %1 which another element has been assigned
                • -
                -

                References

                -

                Diagnostic flags in Clang

                ]]> -
                - INFO - CODE_SMELL -
                - - clang-diagnostic-comma - clang-diagnostic-comma + clang-diagnostic-bit-int-extension + clang-diagnostic-bit-int-extension Diagnostic text:

                  -
                • warning: possible misuse of comma operator here
                • +
                • warning: '_BitInt' in %select{C17 and earlier|C++}0 is a Clang extension

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL @@ -27799,141 +28525,141 @@ Derived(); // and so temporary construction is okay CODE_SMELL
                - clang-diagnostic-predefined-identifier-outside-function - clang-diagnostic-predefined-identifier-outside-function + clang-diagnostic-concepts-ts-compat + clang-diagnostic-concepts-ts-compat Diagnostic text:

                  -
                • warning: predefined identifier is only valid inside function
                • +
                • warning: ISO C++20 does not permit the 'bool' keyword after 'concept'

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-interrupt-service-routine - clang-diagnostic-interrupt-service-routine + clang-diagnostic-duplicate-enum + clang-diagnostic-duplicate-enum Diagnostic text:

                  -
                • warning: interrupt service routine should only call a function with attribute 'no_caller_saved_registers'
                • +
                • warning: element %0 has been implicitly assigned %1 which another element has been assigned

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-redundant-parens - clang-diagnostic-redundant-parens + clang-diagnostic-comma + clang-diagnostic-comma Diagnostic text:

                  -
                • warning: redundant parentheses surrounding declarator
                • +
                • warning: possible misuse of comma operator here

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-out-of-scope-function - clang-diagnostic-out-of-scope-function + clang-diagnostic-predefined-identifier-outside-function + clang-diagnostic-predefined-identifier-outside-function Diagnostic text:

                  -
                • warning: use of out-of-scope declaration of %0%select{| whose type is not compatible with that of an implicit declaration}1
                • +
                • warning: predefined identifier is only valid inside function

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-binding-in-condition - clang-diagnostic-binding-in-condition + clang-diagnostic-interrupt-service-routine + clang-diagnostic-interrupt-service-routine Diagnostic text:

                  -
                • warning: ISO C++17 does not permit structured binding declaration in a condition
                • +
                • 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-incomplete-setjmp-declaration - clang-diagnostic-incomplete-setjmp-declaration + clang-diagnostic-redundant-parens + clang-diagnostic-redundant-parens Diagnostic text:

                  -
                • warning: declaration of built-in function '%0' requires the declaration of the 'jmp_buf' type, commonly provided in the header <setjmp.h>.
                • +
                • warning: redundant parentheses surrounding declarator

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-incompatible-library-redeclaration - clang-diagnostic-incompatible-library-redeclaration + clang-diagnostic-out-of-scope-function + clang-diagnostic-out-of-scope-function Diagnostic text:

                  -
                • warning: incompatible redeclaration of library function %0
                • +
                • warning: use of out-of-scope declaration of %0%select{| whose type is not compatible with that of an implicit declaration}1

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-strlcpy-strlcat-size - clang-diagnostic-strlcpy-strlcat-size + clang-diagnostic-binding-in-condition + clang-diagnostic-binding-in-condition Diagnostic text:

                  -
                • warning: size argument in %0 call appears to be size of the source; expected the size of the destination
                • +
                • warning: ISO C++17 does not permit structured binding declaration in a condition

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-memsize-comparison - clang-diagnostic-memsize-comparison + clang-diagnostic-incomplete-setjmp-declaration + clang-diagnostic-incomplete-setjmp-declaration Diagnostic text:

                  -
                • warning: size argument in %0 call is a comparison
                • +
                • warning: declaration of built-in function '%0' requires the declaration of the 'jmp_buf' type, commonly provided in the header <setjmp.h>.

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-assume - clang-diagnostic-assume + clang-diagnostic-incompatible-library-redeclaration + clang-diagnostic-incompatible-library-redeclaration Diagnostic text:

                  -
                • warning: the argument to %0 has side effects that will be discarded
                • +
                • warning: incompatible redeclaration of library function %0

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL @@ -27978,141 +28704,141 @@ Derived(); // and so temporary construction is okay CODE_SMELL
                - clang-diagnostic-builtin-memcpy-chk-size - clang-diagnostic-builtin-memcpy-chk-size + clang-diagnostic-strlcpy-strlcat-size + clang-diagnostic-strlcpy-strlcat-size Diagnostic text:

                  -
                • warning: '%0' will always overflow; destination buffer has size %1, but size argument is %2
                • +
                • warning: size argument in %0 call appears to be size of the source; expected the size of the destination

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-non-c-typedef-for-linkage - clang-diagnostic-non-c-typedef-for-linkage - + clang-diagnostic-memsize-comparison + clang-diagnostic-memsize-comparison + 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: size argument in %0 call is a comparison

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-duplicate-protocol - clang-diagnostic-duplicate-protocol + clang-diagnostic-assume + clang-diagnostic-assume Diagnostic text:

                  -
                • warning: duplicate protocol definition of %0 is ignored
                • +
                • warning: the argument to %0 has side effects that will be discarded

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-incompatible-property-type - clang-diagnostic-incompatible-property-type + clang-diagnostic-builtin-memcpy-chk-size + clang-diagnostic-builtin-memcpy-chk-size Diagnostic text:

                  -
                • warning: property type %0 is incompatible with type %1 inherited from %2
                • +
                • 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-protocol-property-synthesis-ambiguity - clang-diagnostic-protocol-property-synthesis-ambiguity + clang-diagnostic-non-c-typedef-for-linkage + clang-diagnostic-non-c-typedef-for-linkage Diagnostic text:

                  -
                • warning: property %select{of type %1|with attribute '%1'|without attribute '%1'|with getter %1|with setter %1}0 was selected for synthesis
                • +
                • 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-incomplete-implementation - clang-diagnostic-incomplete-implementation + clang-diagnostic-duplicate-protocol + clang-diagnostic-duplicate-protocol Diagnostic text:

                  -
                • warning: method definition for %0 not found
                • +
                • warning: duplicate protocol definition of %0 is ignored

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-objc-property-implicit-mismatch - clang-diagnostic-objc-property-implicit-mismatch + clang-diagnostic-incompatible-property-type + clang-diagnostic-incompatible-property-type Diagnostic text:

                  -
                • warning: primary property declaration is implicitly strong while redeclaration in class extension is weak
                • +
                • warning: property type %0 is incompatible with type %1 inherited from %2

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-atomic-property-with-user-defined-accessor - clang-diagnostic-atomic-property-with-user-defined-accessor + clang-diagnostic-protocol-property-synthesis-ambiguity + clang-diagnostic-protocol-property-synthesis-ambiguity Diagnostic text:

                  -
                • warning: writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 with a user defined %select{getter|setter}2
                • +
                • warning: property %select{of type %1|with attribute '%1'|without attribute '%1'|with getter %1|with setter %1}0 was selected for synthesis

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-objc-property-matches-cocoa-ownership-rule - clang-diagnostic-objc-property-matches-cocoa-ownership-rule + clang-diagnostic-incomplete-implementation + clang-diagnostic-incomplete-implementation Diagnostic text:

                  -
                • warning: property follows Cocoa naming convention for returning 'owned' objects
                • +
                • warning: method definition for %0 not found

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-objc-protocol-property-synthesis - clang-diagnostic-objc-protocol-property-synthesis + clang-diagnostic-objc-property-implicit-mismatch + clang-diagnostic-objc-property-implicit-mismatch Diagnostic text:

                  -
                • warning: auto property synthesis will not synthesize property %0 declared in protocol %1
                • +
                • warning: primary property declaration is implicitly strong while redeclaration in class extension is weak

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL @@ -28158,6 +28884,48 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
                + + clang-diagnostic-atomic-property-with-user-defined-accessor + clang-diagnostic-atomic-property-with-user-defined-accessor + + Diagnostic text:

                +
                  +
                • warning: writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 with a user defined %select{getter|setter}2
                • +
                +

                References

                +

                Diagnostic flags in Clang

                ]]> +
                + INFO + CODE_SMELL +
                + + clang-diagnostic-objc-property-matches-cocoa-ownership-rule + clang-diagnostic-objc-property-matches-cocoa-ownership-rule + + Diagnostic text:

                +
                  +
                • warning: property follows Cocoa naming convention for returning 'owned' objects
                • +
                +

                References

                +

                Diagnostic flags in Clang

                ]]> +
                + INFO + CODE_SMELL +
                + + clang-diagnostic-objc-protocol-property-synthesis + clang-diagnostic-objc-protocol-property-synthesis + + Diagnostic text:

                +
                  +
                • warning: auto property synthesis will not synthesize property %0 declared in protocol %1
                • +
                +

                References

                +

                Diagnostic flags in Clang

                ]]> +
                + INFO + CODE_SMELL +
                clang-diagnostic-objc-autosynthesis-property-ivar-name-match clang-diagnostic-objc-autosynthesis-property-ivar-name-match @@ -28256,6 +29024,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-weak-vtables clang-diagnostic-weak-vtables @@ -28298,28 +29088,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|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 @@ -28424,6 +29192,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-alloca clang-diagnostic-alloca @@ -28466,28 +29256,6 @@ 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 @@ -28600,20 +29368,6 @@ Derived(); // and so temporary construction is okay 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 @@ -28690,6 +29444,7 @@ Derived(); // and so temporary construction is okay
              • warning: non-constant-expression cannot be narrowed from type %0 to %1 in initializer list in C++11
              • 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: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
              • 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
              • @@ -28720,6 +29475,20 @@ Derived(); // and so temporary construction is okay LINEAR 5min
                + + 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-ignored-availability-without-sdk-settings clang-diagnostic-ignored-availability-without-sdk-settings @@ -28819,89 +29588,104 @@ Derived(); // and so temporary construction is okay CODE_SMELL - clang-diagnostic-requires-super-attribute - clang-diagnostic-requires-super-attribute + clang-diagnostic-c++1z-compat + clang-diagnostic-c++1z-compat Diagnostic text:

                  -
                • warning: %0 attribute cannot be applied to %select{methods in protocols|dealloc}1
                • +
                • 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: '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
                • +
                • 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: incrementing expression of type bool is deprecated and incompatible with C++17
                • +
                • 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: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
                • +
                • 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

                ]]> +

                Diagnostic flags in Clang

                ]]> +
                + INFO + CODE_SMELL +
                + + clang-diagnostic-unqualified-std-cast-call + clang-diagnostic-unqualified-std-cast-call + + Diagnostic text:

                +
                  +
                • warning: unqualified call to %0
                • +
                +

                References

                +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-ambiguous-reversed-operator - clang-diagnostic-ambiguous-reversed-operator + clang-diagnostic-requires-super-attribute + clang-diagnostic-requires-super-attribute 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
                • +
                • 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-rewrite-not-bool - clang-diagnostic-rewrite-not-bool + clang-diagnostic-ambiguous-reversed-operator + clang-diagnostic-ambiguous-reversed-operator Diagnostic text:

                  -
                • warning: ISO C++20 requires return type of selected 'operator==' function for rewritten '%1' comparison to be 'bool', not %0
                • +
                • 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-c++1z-compat - clang-diagnostic-c++1z-compat + clang-diagnostic-rewrite-not-bool + clang-diagnostic-rewrite-not-bool 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: '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
                • -
                • 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: incrementing expression of type bool is deprecated and incompatible with C++17
                • -
                • 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
                • +
                • 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 @@ -28994,6 +29778,31 @@ 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: '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: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
                • +
                • 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-variable-declarations clang-diagnostic-missing-variable-declarations @@ -29050,30 +29859,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: '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

                ]]> -
                - INFO - CODE_SMELL -
                clang-diagnostic-typedef-redefinition clang-diagnostic-typedef-redefinition @@ -29158,6 +29943,36 @@ 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: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
                • +
                • warning: overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension
                • +
                • 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-many-braces-around-scalar-init clang-diagnostic-many-braces-around-scalar-init @@ -29214,34 +30029,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: '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 @@ -29418,7 +30205,7 @@ Derived(); // and so temporary construction is okay Diagnostic text:

                  -
                • warning: passing %0-byte aligned argument to %1-byte aligned parameter %2 of %3 may result in an unaligned pointer access
                • +
                • warning: passing %0-byte aligned argument to %1-byte aligned parameter %2%select{| of %4}3 may result in an unaligned pointer access

                References

                Diagnostic flags in Clang

                ]]> @@ -29834,20 +30621,6 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
                - - clang-diagnostic-declaration-after-statement - clang-diagnostic-declaration-after-statement - - Diagnostic text:

                -
                  -
                • warning: ISO C90 forbids mixing declarations and code
                • -
                -

                References

                -

                Diagnostic flags in Clang

                ]]> -
                - INFO - CODE_SMELL -
                clang-diagnostic-sync-fetch-and-nand-semantics-changed clang-diagnostic-sync-fetch-and-nand-semantics-changed @@ -30118,6 +30891,7 @@ Derived(); // and so temporary construction is okay
              • warning: %select{values of type|enum values with underlying type}2 '%0' should not be used as format arguments; add an explicit cast to %1 instead
              • warning: %select{void function|void method|constructor|destructor}1 %0 should not return a value
              • warning: %select{|empty }0%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++
              • +
              • warning: '%%n' specifier not supported on this platform
              • warning: '%0' is not a valid object format flag
              • warning: '%0' qualifier on function type %1 has no effect
              • warning: '%0' qualifier on omitted return type %1 has no effect
              • @@ -30586,6 +31360,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
                + + clang-diagnostic-spirv-compat + clang-diagnostic-spirv-compat + + Diagnostic text:

                +
                  +
                • warning: sampler initializer has invalid %0 bits
                • +
                +

                References

                +

                Diagnostic flags in Clang

                ]]> +
                + INFO + CODE_SMELL +
                clang-diagnostic-integer-overflow clang-diagnostic-integer-overflow @@ -30684,6 +31472,20 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL + + clang-diagnostic-unsupported-abi + clang-diagnostic-unsupported-abi + + Diagnostic text:

                +
                  +
                • warning: float ABI '%0' is not supported by current library
                • +
                +

                References

                +

                Diagnostic flags in Clang

                ]]> +
                + INFO + CODE_SMELL +
                clang-diagnostic-overriding-t-option clang-diagnostic-overriding-t-option @@ -30727,43 +31529,43 @@ Derived(); // and so temporary construction is okay CODE_SMELL - clang-diagnostic-debug-compression-unavailable - clang-diagnostic-debug-compression-unavailable + clang-diagnostic-div-by-zero + clang-diagnostic-div-by-zero Diagnostic text:

                  -
                • warning: cannot compress debug sections (zlib not installed)
                • +
                • warning: %select{remainder|division}0 by zero is undefined

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-slash-u-filename - clang-diagnostic-slash-u-filename + clang-diagnostic-debug-compression-unavailable + clang-diagnostic-debug-compression-unavailable Diagnostic text:

                  -
                • warning: '/U%0' treated as the '/U' option
                • +
                • warning: cannot compress debug sections (zlib not installed)

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL
                - clang-diagnostic-div-by-zero - clang-diagnostic-div-by-zero + clang-diagnostic-slash-u-filename + clang-diagnostic-slash-u-filename Diagnostic text:

                  -
                • warning: %select{remainder|division}0 by zero is undefined
                • +
                • warning: '/U%0' treated as the '/U' option

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL @@ -30883,43 +31685,43 @@ Derived(); // and so temporary construction is okay CODE_SMELL
                - clang-diagnostic-backslash-newline-escape - clang-diagnostic-backslash-newline-escape + clang-diagnostic-c++1z-compat-mangling + clang-diagnostic-c++1z-compat-mangling Diagnostic text:

                  -
                • warning: backslash and newline separated by space
                • +
                • 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-dollar-in-identifier-extension - clang-diagnostic-dollar-in-identifier-extension + clang-diagnostic-backslash-newline-escape + clang-diagnostic-backslash-newline-escape Diagnostic text:

                  -
                • warning: '$' in identifier
                • +
                • warning: backslash and newline separated by space

                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-dollar-in-identifier-extension + clang-diagnostic-dollar-in-identifier-extension Diagnostic text:

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

                References

                -

                Diagnostic flags in Clang

                ]]> +

                Diagnostic flags in Clang

                ]]>
                INFO CODE_SMELL @@ -31036,33 +31838,5 @@ Derived(); // and so temporary construction is okay INFO CODE_SMELL
                - - clang-diagnostic-nonportable-include-path - clang-diagnostic-nonportable-include-path - - Diagnostic text:

                -
                  -
                • warning: non-portable path to file '%0'; specified path differs in case from file name on disk
                • -
                -

                References

                -

                Diagnostic flags in Clang

                ]]> -
                - INFO - CODE_SMELL -
                - - clang-diagnostic-nonportable-system-include-path - clang-diagnostic-nonportable-system-include-path - - Diagnostic text:

                -
                  -
                • warning: non-portable path to file '%0'; specified path differs in case from file name on disk
                • -
                -

                References

                -

                Diagnostic flags in Clang

                ]]> -
                - INFO - CODE_SMELL -
                - + 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 2085b60730..ad7b45b56f 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(1316, repo.rules().size()); + assertEquals(1340, repo.rules().size()); } } diff --git a/cxx-sensors/src/tools/clangtidy_createrules.py b/cxx-sensors/src/tools/clangtidy_createrules.py index 427976e8fb..82cf2690db 100644 --- a/cxx-sensors/src/tools/clangtidy_createrules.py +++ b/cxx-sensors/src/tools/clangtidy_createrules.py @@ -33,7 +33,7 @@ # last update: llvmorg-14-init-8123-ga875e6e1225a (git describe) # rule keys are in alphabetical order - "abseil-no-namespace": {"type": "CODE_SMELL", "severity": "INFO"}, + "abseil-no-namespace": {"type": "CODE_SMELL", "severity": "INFO"}, "abseil-redundant-strcat-calls": {"type": "CODE_SMELL", "severity": "MINOR"}, "abseil-str-cat-append": {"type": "CODE_SMELL", "severity": "MINOR"}, "abseil-string-find-startswith": {"type": "CODE_SMELL", "severity": "MINOR"}, @@ -307,11 +307,12 @@ def rstfile_to_description(path, filename, fix_urls): if fix_urls: html = fix_local_urls(html, filename) - html = html.decode('utf-8').replace('\r\n', '\n') + html = html.decode('utf-8').replace('\r\n', '\n') return html + footer def rstfile_to_rule(path, fix_urls): + sys.stderr.write("[INFO] convert: '{}'\n".format(path)) rule = et.Element('rule') filename_with_extension = os.path.basename(path) @@ -334,17 +335,18 @@ def rstfile_to_rule(path, fix_urls): if custom_severity: default_issue_severity = custom_severity["severity"] default_issue_type = custom_severity["type"] - + et.SubElement(rule, 'severity').text = default_issue_severity - et.SubElement(rule, 'type').text = default_issue_type + et.SubElement(rule, 'type').text = default_issue_type if default_issue_severity != 'INFO': et.SubElement(rule, 'remediationFunction').text = 'LINEAR' et.SubElement(rule, 'remediationFunctionGapMultiplier').text = '5min' - + return rule def rstfiles_to_rules_xml(directory, fix_urls): + sys.stderr.write("[INFO] read .rst files '{}'\n".format(directory)) rules = et.Element('rules') for subdir, _, files in os.walk(directory): for f in files: @@ -352,6 +354,7 @@ def rstfiles_to_rules_xml(directory, fix_urls): if ext == ".rst" and f != "list.rst": rst_file_path = os.path.join(subdir, f) rules.append(rstfile_to_rule(rst_file_path, fix_urls)) + sys.stderr.write("[INFO] write .xml file ...\n") write_rules_xml(rules, sys.stdout) @@ -366,7 +369,7 @@ def contains_required_fields(entry_value): def create_template_rules(rules): rule_key = "CustomRuleTemplate" rule_name = "Template for custom Custom rules" - rule_severity = SEVERITY["SEV_Warning"]["sonarqube_severity"] + rule_severity = SEVERITY["SEV_Warning"]["sonarqube_severity"] rule_description = """

                Follow these steps to make your custom Custom rules available in SonarQube:

                    @@ -375,7 +378,7 @@ def create_template_rules(rules):
                1. Relaunch an analysis on your projects, et voila, your custom rules are executed!
                """ - + rule = et.Element('rule') et.SubElement(rule, 'key').text = rule_key et.SubElement(rule, 'cardinality').text = "MULTIPLE" @@ -389,7 +392,7 @@ def create_clang_default_rules(rules): rule_key = "clang-diagnostic-error" rule_name = "clang-diagnostic-error" rule_type = DIAG_CLASS["CLASS_ERROR"]["sonarqube_type"] - rule_severity = SEVERITY["SEV_Remark"]["sonarqube_severity"] + rule_severity = SEVERITY["SEV_Remark"]["sonarqube_severity"] rule_description = "

                Default compiler diagnostic for errors without an explicit check name. Compiler error, e.g header file not found.

                " rule = et.Element('rule') @@ -399,12 +402,12 @@ def create_clang_default_rules(rules): et.SubElement(rule, 'severity').text = rule_severity et.SubElement(rule, 'type').text = rule_type rules.append(rule) - + # defaults clang warning (not associated with any activation switch): warning rule_key = "clang-diagnostic-warning" rule_name = "clang-diagnostic-warning" rule_type = DIAG_CLASS["CLASS_WARNING"]["sonarqube_type"] - rule_severity = SEVERITY["SEV_Warning"]["sonarqube_severity"] + rule_severity = SEVERITY["SEV_Warning"]["sonarqube_severity"] rule_description = "

                Default compiler diagnostic for warnings without an explicit check name.

                " rule = et.Element('rule') @@ -419,7 +422,7 @@ def create_clang_default_rules(rules): rule_key = "clang-diagnostic-unknown" rule_name = "clang-diagnostic-unknown" rule_type = DIAG_CLASS["CLASS_REMARK"]["sonarqube_type"] - rule_severity = SEVERITY["SEV_Remark"]["sonarqube_severity"] + rule_severity = SEVERITY["SEV_Remark"]["sonarqube_severity"] rule_description = "

                (Unkown) compiler diagnostic without an explicit check name.

                " rule = et.Element('rule') @@ -429,7 +432,7 @@ def create_clang_default_rules(rules): et.SubElement(rule, 'severity').text = rule_severity et.SubElement(rule, 'type').text = rule_type rules.append(rule) - + def collect_warnings(data, diag_group_id, warnings_in_group): diag_group = data[diag_group_id] @@ -465,7 +468,7 @@ def collect_warnings(data, diag_group_id, warnings_in_group): "CLASS_REMARK": {"weight": 0, "sonarqube_type": "CODE_SMELL", "printable": "remark"}, "CLASS_WARNING": {"weight": 0, "sonarqube_type": "CODE_SMELL", "printable": "warning"}, "CLASS_ERROR": {"weight": 1, "sonarqube_type": "BUG", "printable": "error"}, - "CLASS_FATAL_ERROR": {"weight": 1, "sonarqube_type": "BUG", "printable": "fatal error"} + "CLASS_FATAL_ERROR": {"weight": 1, "sonarqube_type": "BUG", "printable": "fatal error"} } # see Severity in JSON @@ -517,12 +520,12 @@ def generate_description(diag_group_name, diagnostics): def diagnostics_to_rules_xml(json_file): rules = et.Element('rules') - + # add a template rule create_template_rules(rules) - # add clang default warnings + # add clang default warnings create_clang_default_rules(rules) - + with open(json_file) as f: data = json.load(f) diag_groups = data["!instanceof"]["DiagGroup"] @@ -553,11 +556,11 @@ def diagnostics_to_rules_xml(json_file): et.SubElement(rule, 'name').text = rule_name et.SubElement(rule, 'description').append(CDATA(rule_description)) et.SubElement(rule, 'severity').text = rule_severity - et.SubElement(rule, 'type').text = rule_type + et.SubElement(rule, 'type').text = rule_type if rule_severity != 'INFO': et.SubElement(rule, 'remediationFunction').text = 'LINEAR' et.SubElement(rule, 'remediationFunctionGapMultiplier').text = '5min' - + rules.append(rule) write_rules_xml(rules, sys.stdout) diff --git a/cxx-sensors/src/tools/generate_clangtidy_resources.cmd b/cxx-sensors/src/tools/generate_clangtidy_resources.cmd index 1e9c503285..4c3439cb19 100644 --- a/cxx-sensors/src/tools/generate_clangtidy_resources.cmd +++ b/cxx-sensors/src/tools/generate_clangtidy_resources.cmd @@ -9,22 +9,22 @@ SET LLVM_DIR=C:\Development\git\llvm-project\ REM verify paths IF NOT EXIST "%PANDOC_DIR%" ( - ECHO Invalid PANDOC_DIR setting + ECHO [ERROR] Invalid PANDOC_DIR setting GOTO ERROR ) IF NOT EXIST "%PYTHON_DIR%" ( - ECHO Invalid PYTHON_DIR setting + ECHO [ERROR] Invalid PYTHON_DIR setting GOTO ERROR ) IF NOT EXIST "%LLVM_DIR%" ( - ECHO Invalid LLVM_DIR setting + ECHO [ERROR] Invalid LLVM_DIR setting GOTO ERROR ) IF NOT EXIST "%LLVM_DIR%build\Release\bin" ( - ECHO You have to build LLVM first + ECHO [ERROR] You have to build LLVM first GOTO ERROR ) @@ -40,29 +40,29 @@ POPD ECHO. REM GENERATION OF RULES FROM CLANG-TIDY DOCUMENTATION (RST FILES) -ECHO generate the new version of the rules file... +ECHO [INFO] 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... +ECHO [INFO] 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... +ECHO [INFO] 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... +ECHO [INFO] 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... +ECHO [INFO] 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 +ECHO [ERROR] execution failed EXIT /B 1 :END ECHO. -ECHO finished succesfully +ECHO [INFO] finished succesfully EXIT /B 0 diff --git a/cxx-sensors/src/tools/utils_createrules.py b/cxx-sensors/src/tools/utils_createrules.py index 818110b513..497c57ce2c 100644 --- a/cxx-sensors/src/tools/utils_createrules.py +++ b/cxx-sensors/src/tools/utils_createrules.py @@ -57,8 +57,10 @@ def _serialize_xml_2(write, elem, encoding, qnames, namespaces): tail = "" if elem.tail is None else elem.tail try: write("<%s%s]]>%s" % (elem.tag, elem.text, tail)) - except UnicodeEncodeError: - write(("<%s%s]]>%s" % (elem.tag, elem.text, tail)).encode('utf-8')) + except UnicodeEncodeError as e: + sys.stderr.write("[WARNING] {}\n".format(e)) + sys.stderr.write("{}\n{}\n{}\n".format(elem.tag, elem.text, tail)) + write(("<%s%s]]>%s" % (elem.tag, elem.text.encode('ascii', 'ignore').decode('utf-8'), tail))) else: et._original_serialize_xml(write, elem, encoding, qnames, namespaces) @@ -69,8 +71,10 @@ def _serialize_xml_3(write, elem, qnames, namespaces, short_empty_elements): tail = "" if elem.tail is None else elem.tail try: write("<%s%s]]>%s" % (elem.tag, elem.text, tail)) - except UnicodeEncodeError: - write(("<%s%s]]>%s" % (elem.tag, elem.text, tail)).encode('utf-8')) + except UnicodeEncodeError as e: + sys.stderr.write("[WARNING] {}\n".format(e)) + sys.stderr.write("{}\n{}\n{}\n".format(elem.tag, elem.text, tail)) + write(("<%s%s]]>%s" % (elem.tag, elem.text.encode('ascii', 'ignore').decode('utf-8'), tail))) else: et._original_serialize_xml(write, elem, qnames, namespaces, short_empty_elements) @@ -98,11 +102,16 @@ def write_rules_xml(root, f): def parse_rules_xml(path): - tree = et.parse(path) - root = tree.getroot() + sys.stderr.write("[INFO] parse .xml file {}\n".format(path)) keys = [] - keys_to_ruleelement = {} - + keys_to_ruleelement = {} + try : + tree = et.parse(path) + except et.ParseError as e: + sys.stderr.write("[ERROR] {}: {}\n".format(path, e)) + return keys, keys_to_ruleelement + + root = tree.getroot() for rules_tag in root.iter('rules'): for rule_tag in rules_tag.iter('rule'): for key_tag in rule_tag.iter('key'):