Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/test/misra/misra-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cli/filelister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions cmake/compileroptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be enabled and the unused function needs to get the unused/maybe_unused attribute.

add_compile_options(-Wno-disabled-macro-expansion)

# warnings we are not interested in
Expand Down
8 changes: 4 additions & 4 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion lib/calculate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions lib/checkunusedvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions lib/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6975,6 +6975,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;
Expand Down
4 changes: 4 additions & 0 deletions lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 "";
}
Expand Down