-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing feature
Description
clangd version
[li@ArchLinux-li cpp]$ clangd --version
clangd version 18.1.8
Features: linux
Platform: x86_64-pc-linux-gnu
[li@ArchLinux-li cpp]$ clang-tidy --version
LLVM (http://llvm.org/):
LLVM version 18.1.8
Optimized build.my .clangd file:
Diagnostics:
ClangTidy:
Remove:
- modernize-use-trailing-return-type
- modernize-use-nullptr
- modernize-use-using
- modernize-use-bool-literals
- modernize-use-equals-default
- modernize-avoid-c-arrays
- modernize-redundant-void-arg
- modernize-deprecated-headers
- bugprone-easily-swappable-parameters
Add:
- modernize*
- bugprone-*
- performance-*
CompileFlags:
Add:
- "-ferror-limit=0"
- "-fdelete-null-pointer-checks"
- "-Wall"
- "-Wextra"
- "-Wpedantic"
- "-Wformat=2"
- "-Wnull-dereference"
- "-Wpointer-compare"
- "-Wstring-compare"
- "-Warray-compare"
- "-Wno-unused-but-set-variable"
- "-Wno-unused-but-set-parameter"
- "-Wno-unused-variable"
- "-Wno-unused-parameter"
- "-Wno-unused-label"
- "-Wno-unused-function"
my test code main.cpp:
#include <iostream>
typedef struct {
char str[16];
int id[16];
} MyObj;
bool myobj_equal(const MyObj &obj1, const MyObj &obj2) {
if (obj1.str != obj2.str) // compare array here, expect warning !!!
return false;
if (obj1.id != obj2.id) // compare array here, expect warning !!!
return false;
return true;
}
int main(int argc, char *argv[]) {
//
char str1[16] = "hello";
char str2[16] = "hello";
if (str1 == str2) {
std::cout << "same string";
}
//
MyObj a1 = {.str = "hello"};
MyObj a2 = {.str = "hello"};
if (myobj_equal(a1, a2)) {
std::cout << "same obj";
}
return 0;
}
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing feature
