Skip to content

Commit d46f9a5

Browse files
firewaveglankk
andcommitted
mitigated some compiler warnings
Co-authored-by: glankk <glankk@users.noreply.github.com>
1 parent a81f879 commit d46f9a5

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
3434
add_compile_options(-Woverloaded-virtual) # when a function declaration hides virtual functions from a base class
3535

3636
add_compile_options(-Wsuggest-attribute=noreturn)
37-
add_compile_options_safe(-Wuseless-cast)
37+
if (NOT MINGW)
38+
add_compile_options_safe(-Wuseless-cast)
39+
endif()
3840

3941
# we are not interested in these
4042
set_source_files_properties(test.cpp PROPERTIES COMPILE_FLAGS -Wno-multichar)
@@ -62,6 +64,14 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
6264

6365
# contradicts -Wcovered-switch-default
6466
add_compile_options(-Wno-switch-default)
67+
if (MINGW)
68+
add_compile_options(-Wno-reserved-macro-identifier)
69+
add_compile_options(-Wno-unused-macros)
70+
endif()
71+
72+
# these are experimental warnings which might produce false positives
73+
add_compile_options_safe(-Wno-thread-safety-negative)
74+
add_compile_options_safe(-Wno-thread-safety-beta)
6575

6676
# TODO: fix these?
6777
add_compile_options(-Wno-padded)

simplecpp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3120,7 +3120,7 @@ std::pair<simplecpp::FileData *, bool> simplecpp::FileDataCache::get(const std::
31203120
bool simplecpp::FileDataCache::getFileId(const std::string &path, FileID &id)
31213121
{
31223122
#ifdef _WIN32
3123-
HANDLE hFile = CreateFileA(path.c_str(), 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
3123+
HANDLE hFile = CreateFileA(path.c_str(), 0, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
31243124

31253125
if (hFile == INVALID_HANDLE_VALUE)
31263126
return false;

0 commit comments

Comments
 (0)