Skip to content

Commit 9b49a33

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

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
3737
add_compile_options(-Woverloaded-virtual) # when a function declaration hides virtual functions from a base class
3838

3939
add_compile_options(-Wsuggest-attribute=noreturn)
40-
add_compile_options_safe(-Wuseless-cast)
40+
if (NOT MINGW)
41+
add_compile_options_safe(-Wuseless-cast) # triggered by _WIN32 code
42+
endif()
4143
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
4244
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
4345
# TODO: bump warning level
@@ -62,6 +64,13 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
6264
add_compile_options(-Wno-suggest-destructor-override)
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+
# these are experimental warning which might produce false positives
72+
add_compile_options_safe(-Wno-thread-safety-negative)
73+
add_compile_options_safe(-Wno-thread-safety-beta)
6574
# TODO: fix these?
6675
add_compile_options(-Wno-padded)
6776
add_compile_options(-Wno-sign-conversion)

simplecpp.cpp

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

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

0 commit comments

Comments
 (0)