Skip to content

Commit

Permalink
Disable all warnings, even in release, on the src directory.
Browse files Browse the repository at this point in the history
Resolve math macro duplication warnings.
  • Loading branch information
Malkierian committed Oct 25, 2024
1 parent 75a0979 commit dc1b3ae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions soh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ endif()
set (BUILD_UTILS OFF CACHE STRING "no utilities")
set (BUILD_SHARED_LIBS OFF CACHE STRING "install/link shared instead of static libs")

if(MSVC)
set(WARNING_OVERRIDE "/W0" CACHE STRING "" FORCE)
else()
set(WARNING_OVERRIDE "-w" CACHE STRING "" FORCE)
endif()

################################################################################
# Set target arch type if empty. Visual studio solution generator provides it.
################################################################################
Expand Down Expand Up @@ -173,6 +179,7 @@ endif()

# src (decomp) {{{
file(GLOB_RECURSE src__ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.c" "src/*.h")
set_source_files_properties(${src__} PROPERTIES COMPILE_OPTIONS ${WARNING_OVERRIDE})

list(APPEND src__ ${CMAKE_CURRENT_SOURCE_DIR}/Resource.rc)
list(FILTER src__ EXCLUDE REGEX "src/dmadata/*")
Expand Down
6 changes: 6 additions & 0 deletions soh/include/libc/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@

#include <libultraship/libultra.h>

#ifndef M_PI
#define M_PI 3.14159265358979323846f
#endif
#ifndef M_SQRT2
#define M_SQRT2 1.41421356237309504880f
#endif
#ifndef FLT_MAX
#define FLT_MAX 340282346638528859811704183484516925440.0f
#endif
#define SHT_MAX 32767.0f
#define SHT_MINV (1.0f / SHT_MAX)
#define DEGTORAD(x) (x * M_PI / 180.0f)
Expand Down
4 changes: 4 additions & 0 deletions soh/include/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@
//#define SEGMENTED_TO_VIRTUAL(addr) PHYSICAL_TO_VIRTUAL(gSegments[SEGMENT_NUMBER(addr)] + SEGMENT_OFFSET(addr))
#define SEGMENTED_TO_VIRTUAL(addr) addr

#ifndef SQ
#define SQ(x) ((x)*(x))
#endif
#ifndef ABS
#define ABS(x) ((x) >= 0 ? (x) : -(x))
#endif
#define DECR(x) ((x) == 0 ? 0 : --(x))
#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x))
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
Expand Down

0 comments on commit dc1b3ae

Please sign in to comment.