Skip to content

Commit bc6ce1d

Browse files
firewaveglankk
andcommitted
mitigated some compiler warnings
Co-authored-by: glankk <[email protected]>
1 parent 54a868a commit bc6ce1d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CMakeLists.txt

Lines changed: 7 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,10 @@ 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()
6571
# TODO: fix these?
6672
add_compile_options(-Wno-padded)
6773
add_compile_options(-Wno-sign-conversion)

simplecpp.cpp

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

31183118
if (hFile == INVALID_HANDLE_VALUE)
31193119
return false;

0 commit comments

Comments
 (0)