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
19 changes: 18 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,24 @@ function(add_compile_options_safe FLAG)
endfunction()

if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options(-Wall -Wextra -pedantic -Wcast-qual -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wredundant-decls -Wshadow -Wundef -Wold-style-cast -Wno-multichar)
add_compile_options(-pedantic)
add_compile_options(-Wall)
add_compile_options(-Wextra)
add_compile_options(-Wcast-qual) # Cast for removing type qualifiers
add_compile_options(-Wfloat-equal) # Floating values used in equality comparisons
add_compile_options(-Wmissing-declarations) # If a global function is defined without a previous declaration
add_compile_options(-Wmissing-format-attribute) #
add_compile_options(-Wno-long-long)
add_compile_options(-Wpacked) #
add_compile_options(-Wredundant-decls) # if anything is declared more than once in the same scope
add_compile_options(-Wundef)
add_compile_options(-Wno-missing-braces)
add_compile_options(-Wno-sign-compare)
add_compile_options(-Wno-multichar)
add_compile_options(-Woverloaded-virtual) # when a function declaration hides virtual functions from a base class

add_compile_options(-Wsuggest-attribute=noreturn)
add_compile_options_safe(-Wuseless-cast)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Expand Down
6 changes: 3 additions & 3 deletions test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ static void characterLiteral()

#ifdef __GNUC__
// BEGIN Implementation-specific results
ASSERT_EQUALS(static_cast<int>('AB'), simplecpp::characterLiteralToLL("'AB'"));
ASSERT_EQUALS(static_cast<int>('ABC'), simplecpp::characterLiteralToLL("'ABC'"));
ASSERT_EQUALS(static_cast<int>('ABCD'), simplecpp::characterLiteralToLL("'ABCD'"));
ASSERT_EQUALS('AB', simplecpp::characterLiteralToLL("'AB'"));
ASSERT_EQUALS('ABC', simplecpp::characterLiteralToLL("'ABC'"));
ASSERT_EQUALS('ABCD', simplecpp::characterLiteralToLL("'ABCD'"));
ASSERT_EQUALS('\134t', simplecpp::characterLiteralToLL("'\\134t'")); // cppcheck ticket #7452
// END Implementation-specific results
#endif
Expand Down
Loading