summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymaekers Luca <luca@spacehb.net>2025-11-13 19:22:29 +0100
committerRaymaekers Luca <luca@spacehb.net>2025-11-13 19:22:29 +0100
commit8e68043a8c1ae877e2f0cee2ece338b1cde71c01 (patch)
treead5653ed012a49f2fc207146455ce37694d41f59
parent4eb0e6ca3adea9f6139299316b0fac1f1369bd8e (diff)
checkpoint
-rw-r--r--lr_macros.h47
-rw-r--r--lr_types.h4
2 files changed, 28 insertions, 23 deletions
diff --git a/lr_macros.h b/lr_macros.h
index a503ad5..836ee52 100644
--- a/lr_macros.h
+++ b/lr_macros.h
@@ -1,19 +1,9 @@
#ifndef LR_MACROS_H
#define LR_MACROS_H
-// Zero
-#if !defined(COMPILER_MSVC)
-#define COMPILER_MSVC 0
-#endif
-#if !defined(COMPILER_LLVM)
-#define COMPILER_LLVM 0
-#endif
-#if !defined(COMPILER_GNU)
-#define COMPILER_GNU 0
-#endif
-
// Detect compiler
#if __clang__
+
# define COMPILER_CLANG 1
#elif _MSC_VER
# define COMPILER_MSVC 1
@@ -21,23 +11,34 @@
# define COMPILER_GNU 1
#endif
+// Zero undefined
+#if !defined(COMPILER_MSVC)
+# define COMPILER_MSVC 0
+#endif
+#if !defined(COMPILER_LLVM)
+# define COMPILER_LLVM 0
+#endif
+#if !defined(COMPILER_GNU)
+# define COMPILER_GNU 0
+#endif
+
// Push/Pop warnings
-#if defined(COMPILER_GNU)
+#if COMPILER_GNU
# define PUSH_WARNINGS \
_Pragma("GCC diagnostic push") \
-_Pragma("GCC diagnostic ignored \"-Weverything\"")
-# define POP_WARNINGS \
-_Pragma("GCC diagnostic pop")
-#elif defined(COMPILER_CLANG)
+_Pragma("GCC diagnostic ignored \"-Wall\"") \
+_Pragma("GCC diagnostic ignored \"-Wextra\"") \
+_Pragma("GCC diagnostic ignored \"-Wconversion\"")
+# define POP_WARNINGS _Pragma("GCC diagnostic pop")
+
+#elif COMPILER_CLANG
# define PUSH_WARNINGS \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Weverything\"")
-# define POP_WARNINGS \
-_Pragma("clang diagnostic pop")
+# define POP_WARNINGS _Pragma("clang diagnostic pop")
+
#else
-# define PUSH_WARNINGS \
-_Pragma("message \"No compatible compiler found\"")
-# define POP_WARNINGS
+# error "No compatible compiler found"
#endif
#define ArrayCount(Array) (sizeof(Array) / sizeof((Array)[0]))
@@ -46,7 +47,7 @@ _Pragma("message \"No compatible compiler found\"")
#define DebugBreakOnce do { local_persist b32 X = false; Assert(X); X = true; } while(0)
#define NullExpression { int X = 0; }
-#define Min(A, B) (((A) < (B)) ? (A) : (B))
-#define Max(A, B) (((A) > (B)) ? (A) : (B))
+#define Minimum(A, B) (((A) < (B)) ? (A) : (B))
+#define Maximum(A, B) (((A) > (B)) ? (A) : (B))
#endif // LR_MACROS_H \ No newline at end of file
diff --git a/lr_types.h b/lr_types.h
index 6bb3527..b7e97d4 100644
--- a/lr_types.h
+++ b/lr_types.h
@@ -3,6 +3,7 @@
#include <stdint.h>
#include <stddef.h>
+#include <sys/types.h>
#define internal static
#define local_persist static
@@ -41,4 +42,7 @@ typedef double f64;
#define U32Max ((u32)-1)
#define U64Max ((u64)-1)
+#define false 0
+#define true 1
+
#endif //LR_TYPES_H