Fix warnings in switch statements on clang (#3943)
This commit is contained in:
parent
34a11c1673
commit
32ded1602b
|
@ -1610,7 +1610,7 @@ static void misra_16_7(void) {
|
|||
}
|
||||
|
||||
static void misra_17_1(void) {
|
||||
va_list(); // 17.1
|
||||
va_list(); // 17.1 17.7
|
||||
va_arg(); // 17.1
|
||||
va_start(); // 17.1
|
||||
va_end(); // 17.1
|
||||
|
|
|
@ -222,8 +222,8 @@ static std::string addFiles2(std::map<std::string, std::size_t> &files,
|
|||
std::string new_path;
|
||||
new_path.reserve(path.length() + 100);// prealloc some memory to avoid constant new/deletes in loop
|
||||
|
||||
while ((readdir_r(dir, &dir_result_buffer.entry, &dir_result) == 0) && (dir_result != nullptr)) {
|
||||
|
||||
while ((SUPPRESS_DEPRECATED_WARNING(readdir_r(dir, &dir_result_buffer.entry, &dir_result)) == 0) && (dir_result != nullptr)) {
|
||||
if ((std::strcmp(dir_result->d_name, ".") == 0) ||
|
||||
(std::strcmp(dir_result->d_name, "..") == 0))
|
||||
continue;
|
||||
|
|
|
@ -82,6 +82,9 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|||
add_compile_options_safe(-Wno-suggest-override) # TODO: enable when warnings are fixed in in tinyxml2
|
||||
add_compile_options_safe(-Wno-suggest-destructor-override) # TODO: enable when warnings are fixed in in tinyxml2
|
||||
add_compile_options_safe(-Wno-extra-semi-stmt) # TODO: enable when warnings are fixed in in tinyxml2
|
||||
add_compile_options_safe(-Wno-implicitly-unsigned-literal)
|
||||
add_compile_options_safe(-Wno-tautological-type-limit-compare)
|
||||
add_compile_options_safe(-Wno-unused-member-function)
|
||||
add_compile_options(-Wno-disabled-macro-expansion)
|
||||
|
||||
# warnings we are not interested in
|
||||
|
|
|
@ -33,12 +33,12 @@ else()
|
|||
endif()
|
||||
|
||||
add_library(lib_objs OBJECT ${srcs_lib} ${hdrs})
|
||||
target_include_directories(lib_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/)
|
||||
target_include_directories(lib_objs SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/externals/)
|
||||
if(USE_BUNDLED_TINYXML2)
|
||||
target_include_directories(lib_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/tinyxml2/)
|
||||
target_include_directories(lib_objs SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/externals/tinyxml2/)
|
||||
endif()
|
||||
target_include_directories(lib_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/picojson/)
|
||||
target_include_directories(lib_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
||||
target_include_directories(lib_objs SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/externals/picojson/)
|
||||
target_include_directories(lib_objs SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
||||
if (HAVE_RULES)
|
||||
target_include_directories(lib_objs SYSTEM PRIVATE ${PCRE_INCLUDE})
|
||||
endif()
|
||||
|
|
|
@ -42,7 +42,7 @@ inline bool isEqual(float x, float y)
|
|||
template<class T>
|
||||
bool isZero(T x)
|
||||
{
|
||||
return isEqual<T>(x, T(0));
|
||||
return isEqual(x, T(0));
|
||||
}
|
||||
|
||||
template<class R, class T>
|
||||
|
|
|
@ -75,6 +75,7 @@ static bool isRaiiClass(const ValueType *valueType, bool cpp, bool defaultReturn
|
|||
return true;
|
||||
return defaultReturn;
|
||||
|
||||
case ValueType::Type::POD:
|
||||
case ValueType::Type::SMART_POINTER:
|
||||
case ValueType::Type::CONTAINER:
|
||||
case ValueType::Type::ITERATOR:
|
||||
|
|
12
lib/config.h
12
lib/config.h
|
@ -107,4 +107,16 @@ static const std::string emptyString;
|
|||
#error "No threading model defined"
|
||||
#endif
|
||||
|
||||
#define STRINGISIZE(...) #__VA_ARGS__
|
||||
|
||||
#ifdef __clang__
|
||||
#define SUPPRESS_WARNING(warning, ...)_Pragma("clang diagnostic push") _Pragma(STRINGISIZE(clang diagnostic ignored warning)) __VA_ARGS__ _Pragma("clang diagnostic pop")
|
||||
#define SUPPRESS_DEPRECATED_WARNING(...) SUPPRESS_WARNING("-Wdeprecated", __VA_ARGS__)
|
||||
#define SUPPRESS_FLOAT_EQUAL_WARNING(...) SUPPRESS_WARNING("-Wfloat-equal", __VA_ARGS__)
|
||||
#else
|
||||
#define SUPPRESS_DEPRECATED_WARNING(...) __VA_ARGS__
|
||||
#define SUPPRESS_FLOAT_EQUAL_WARNING(...) __VA_ARGS__
|
||||
#endif
|
||||
|
||||
|
||||
#endif // configH
|
||||
|
|
|
@ -6976,6 +6976,9 @@ std::string ValueType::dump() const
|
|||
case NONSTD:
|
||||
ret << "valueType-type=\"nonstd\"";
|
||||
break;
|
||||
case POD:
|
||||
ret << "valueType-type=\"pod\"";
|
||||
break;
|
||||
case RECORD:
|
||||
ret << "valueType-type=\"record\"";
|
||||
break;
|
||||
|
|
|
@ -8248,6 +8248,10 @@ const char* ValueFlow::Value::toString(LifetimeScope lifetimeScope)
|
|||
return "Argument";
|
||||
case ValueFlow::Value::LifetimeScope::SubFunction:
|
||||
return "SubFunction";
|
||||
case ValueFlow::Value::LifetimeScope::ThisPointer:
|
||||
return "ThisPointer";
|
||||
case ValueFlow::Value::LifetimeScope::ThisValue:
|
||||
return "ThisValue";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue