Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MSVC warnings #758

Merged
merged 1 commit into from
Dec 20, 2024
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
20 changes: 14 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,20 @@ endif()

if (MSVC)

# These are needed for MSVC to play ball as much as possible
# with the /EHs- flag
add_definitions("-D_HAS_EXCEPTIONS=0 -D_STATIC_CPPLIB")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:fast /EHs- /GR-")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast /EHs- /GR-")
# Disable RTTI
string(FIND "${CMAKE_CXX_FLAGS}" "/GR" MSVC_HAS_GR)
if(MSVC_HAS_GR)
string(REGEX REPLACE "/GR" "/GR-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
add_compile_options(/GR-)
endif()

# Disable C++ Exceptions
string(REGEX REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_compile_options(/D_HAS_EXCEPTIONS=0)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:fast")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast")

if (NOT CLANG)
# get the number of logical cores for parallel build
Expand Down
13 changes: 13 additions & 0 deletions libraries/stb/stb_vorbis.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@
#ifndef STB_VORBIS_INCLUDE_STB_VORBIS_H
#define STB_VORBIS_INCLUDE_STB_VORBIS_H

// EDGE - Disable some finicky warnings from MSVC
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4456)
#pragma warning(disable: 4457)
#pragma warning(disable: 4701)
#endif

#if defined(STB_VORBIS_NO_CRT) && !defined(STB_VORBIS_NO_STDIO)
#define STB_VORBIS_NO_STDIO 1
#endif
Expand Down Expand Up @@ -5652,6 +5660,11 @@ int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, in
0.90 - first public release
*/


#ifdef _MSC_VER
#pragma warning(pop)
#endif

#endif // STB_VORBIS_HEADER_ONLY


Expand Down
2 changes: 1 addition & 1 deletion source_files/edge/f_finale.cc
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void FinaleTicker(void)
finale_count = (int)(strlen(finale_text) * finale->text_speed_);
skip_finale = false;
}
else if (skip_finale || finale_count > finale->text_wait_ + (int)(strlen(finale_text) * finale->text_speed_))
else if (skip_finale || finale_count > (int) finale->text_wait_ + (int)(strlen(finale_text) * finale->text_speed_))
{
DoBumpFinale();
skip_finale = false;
Expand Down
1 change: 0 additions & 1 deletion source_files/edge/p_action.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4723,7 +4723,6 @@ void A_SeekTracer(MapObject *mo)

int *args = (int *)mo->state_->action_par;

BAMAngle threshold = epi::BAMFromDegrees((float)args[0] / 65536.0f);
BAMAngle maxturn = epi::BAMFromDegrees((float)args[1] / 65536.0f);

// change angle
Expand Down
2 changes: 1 addition & 1 deletion source_files/edge/w_epk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ class VWADFile : public epi::File
return 0;

// never read more than what GetLength() reports
if (count > length_ - position_)
if (count > (unsigned int) length_ - position_)
count = length_ - position_;

int got = vwad_read(pack_->vwad_archive_, vwad_file_descriptor_, dest, count);
Expand Down
Loading