diff options
| author | Raymaekers Luca <luca@spacehb.net> | 2025-11-15 15:45:16 +0100 |
|---|---|---|
| committer | Raymaekers Luca <luca@spacehb.net> | 2025-11-15 15:52:55 +0100 |
| commit | 87746741590ba49daaf400961778e4cbee38a2e3 (patch) | |
| tree | 2952544b8117808eb02db8425209cc1fe675340e /handmade_platform.h | |
| parent | c7cc8bfc22fa34f44e3db61f136bf75ae4dd6aa5 (diff) | |
checkpoint
Diffstat (limited to 'handmade_platform.h')
| -rw-r--r-- | handmade_platform.h | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/handmade_platform.h b/handmade_platform.h index bc3f84a..4e7dc60 100644 --- a/handmade_platform.h +++ b/handmade_platform.h @@ -22,29 +22,52 @@ extern "C" { #include <stdint.h> #include <stddef.h> + // Zero #if !defined(COMPILER_MSVC) -#define COMPILER_MSVC 0 +# define COMPILER_MSVC 0 #endif - #if !defined(COMPILER_LLVM) -#define COMPILER_LLVM 0 +# define COMPILER_LLVM 0 #endif - #if !defined(COMPILER_GNU) -#define COMPILER_GNU 0 +# define COMPILER_GNU 0 #endif -#if !COMPILER_MSVC && !COMPILER_LLVM && !COMPILER_GNU -#if _MSC_VER -#undef COMPILER_MSVC -#define COMPILER_MSVC 1 + // Detect compiler +#if __clang__ +# undef COMPILER_CLANG +# define COMPILER_CLANG 1 +#elif _MSC_VER +# undef COMPILER_MSVC +# define COMPILER_MSVC 1 #elif __GNUC__ -#undef COMPILER_GNU -#define COMPILER_GNU 1 +# undef COMPILER_GNU +# define COMPILER_GNU 1 +#else +# error "Could not detect compiler." +#endif + +#if __MINGW32__ +# define COMPILER_MINGW 1 +#endif + + // Push/Pop warnings +#if defined(COMPILER_GNU) +# define PUSH_WARNINGS \ +_Pragma("GCC diagnostic push") \ +_Pragma("GCC diagnostic ignored \"-Weverything\"") \ +_Pragma("GCC diagnostic ignored \"-Wconversion\"") +# define POP_WARNINGS _Pragma("GCC diagnostic pop") + +#elif defined(COMPILER_CLANG) +# define PUSH_WARNINGS \ +_Pragma("clang diagnostic push") \ +_Pragma("clang diagnostic ignored \"-Weverything\"") +# define POP_WARNINGS _Pragma("clang diagnostic pop") + #else - // TODO(casey): More compilerz!!! +# error "No compatible compiler found" #endif -#endif #define internal static #define local_persist static |
