Small Warnings Refactor (#4477)

* Disable all warnings, even in release, on the `src` directory.
Resolve math macro duplication warnings.

* Suppress LUS warnings.

* Modify it to utilize a variable that defaults on but can be specified in command line to disable it.
Prevet total compile option overwrite for LUS.

* Remove unnecessary unset and cache parameters.

* Document warnings flag in BUILDING.md
This commit is contained in:
Malkierian 2024-10-28 17:30:11 -07:00 committed by GitHub
commit 108d5061d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 0 deletions

View file

@ -173,6 +173,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/*")

View file

@ -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)

View file

@ -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))