summaryrefslogtreecommitdiffstats
path: root/omni
diff options
context:
space:
mode:
authorFabrice <fabrice@schaub-dev.xyz>2026-04-16 16:31:25 +0200
committerFabrice <fabrice@schaub-dev.xyz>2026-04-16 16:31:25 +0200
commit70dfff41ce5d50264ca419724c038e8acc8df753 (patch)
tree6856c7acc33b9f480091051589cdd9e645706531 /omni
parentec38da55fdbe561f6f180b959cb59b6f3643817b (diff)
adding compiler check
Diffstat (limited to 'omni')
-rw-r--r--omni/platform.h148
-rw-r--r--omni/stdint.h20
2 files changed, 99 insertions, 69 deletions
diff --git a/omni/platform.h b/omni/platform.h
index 593b79c..5410f6d 100644
--- a/omni/platform.h
+++ b/omni/platform.h
@@ -1,5 +1,5 @@
#ifndef OMNI_PLATFORM_H
-#define OMNI_PLATFORM_H
+# define OMNI_PLATFORM_H
/*
*
@@ -7,21 +7,20 @@
*
*/
-#undef OMNI_CC_MSVC
-#undef OMNI_CC_GNU
+# undef OMNI_CC_MSVC
+# undef OMNI_CC_GNU
-#if defined(_MSC_VER)
-#define OMNI_CC_MSVC
-#endif
+# if defined(_MSC_VER)
+# define OMNI_CC_MSVC
+# endif
-#if defined(__GNUC__) || defined(__clang__)
-#define OMNI_CC_GNU
-#endif
+# if defined(__GNUC__) || defined(__clang__)
+# define OMNI_CC_GNU
+# endif
-
-#if !defined(OMNI_CC_GNU) && !defined(OMNI_CC_MSVC)
-#error "compiler not supported"
-#endif
+# if !defined(OMNI_CC_GNU) && !defined(OMNI_CC_MSVC)
+# error "compiler not supported"
+# endif
/*
*
@@ -29,34 +28,34 @@
*
*/
-#undef OMNI_ARCH_X86
-#undef OMNI_ARCH_ARM
-#undef OMNI_ARCH_64BIT
-#undef OMNI_ARCH_32BIT
+# undef OMNI_ARCH_X86
+# undef OMNI_ARCH_ARM
+# undef OMNI_ARCH_64BIT
+# undef OMNI_ARCH_32BIT
-#if defined(__i386__) || defined(_M_IX86)
-#define OMNI_ARCH_X86
-#define OMNI_ARCH_32BIT
-#endif
+# if defined(__i386__) || defined(_M_IX86)
+# define OMNI_ARCH_X86
+# define OMNI_ARCH_32BIT
+# endif
-#if defined(__x86_64__) || defined(_M_X64)
-#define OMNI_ARCH_X86
-#define OMNI_ARCH_64BIT
-#endif
+# if defined(__x86_64__) || defined(_M_X64)
+# define OMNI_ARCH_X86
+# define OMNI_ARCH_64BIT
+# endif
-#if defined(__arm__) || defined(_M_ARM)
-#define OMNI_ARCH_ARM
-#define OMNI_ARCH_32BIT
-#endif
+# if defined(__arm__) || defined(_M_ARM)
+# define OMNI_ARCH_ARM
+# define OMNI_ARCH_32BIT
+# endif
-#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm64__)
-#define OMNI_ARCH_ARM
-#define OMNI_ARCH_64BIT
-#endif
+# if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm64__)
+# define OMNI_ARCH_ARM
+# define OMNI_ARCH_64BIT
+# endif
-#if !defined(OMNI_ARCH_X86) && !defined(OMNI_ARCH_ARM)
-#error "target architecture is not supported"
-#endif
+# if !defined(OMNI_ARCH_X86) && !defined(OMNI_ARCH_ARM)
+# error "target architecture is not supported"
+# endif
/*
*
@@ -64,33 +63,64 @@
*
*/
-#undef OMNI_OS_WIN
-#undef OMNI_OS_LINUX
-#undef OMNI_OS_FREEBSD
-#undef OMNI_OS_OSX
+# undef OMNI_OS_WIN
+# undef OMNI_OS_LINUX
+# undef OMNI_OS_FREEBSD
+# undef OMNI_OS_OSX
-#if defined(_WIN32) || defined(_WIN64)
-#define OMNI_OS_WIN
-#endif
+# if defined(_WIN32) || defined(_WIN64)
+# define OMNI_OS_WIN
+# endif
-#if defined(__linux__)
-#define OMNI_OS_LINUX
-#define OMNI_OS_UNIX
-#endif
+# if defined(__linux__)
+# define OMNI_OS_LINUX
+# define OMNI_OS_UNIX
+# endif
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-#define OMNI_OS_FREEBSD
-#define OMNI_OS_UNIX
-#endif
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+# define OMNI_OS_FREEBSD
+# define OMNI_OS_UNIX
+# endif
-#if defined(__APPLE__) && defined(__MACH__)
-#define OMNI_OS_OSX
-#define OMNI_OS_UNIX
-#endif
+# if defined(__APPLE__) && defined(__MACH__)
+# define OMNI_OS_OSX
+# define OMNI_OS_UNIX
+# endif
-#if !defined(OMNI_OS_UNIX) && !defined(OMNI_OS_WIN)
-#error "target os not supported"
-#endif
+# if !defined(OMNI_OS_UNIX) && !defined(OMNI_OS_WIN)
+# error "target os not supported"
+# endif
-#endif
+/*
+ *
+ *
+ * CHECK COMPILER STANDARD
+ *
+ */
+# undef OMNI_CXX_VER_MIN
+# undef OMNI_CXX_VER
+# undef OMNI_CC_VER
+
+# define OMNI_CC_VER __STDC_VERSION__
+
+# if defined(OMNI_CC_MSVC)
+# if defined(_MSVC_LANG)
+# define OMNI_CXX_VER _MSVC_LANG
+# else
+# define OMNI_CXX_VER 0
+# endif
+# endif
+
+# if defined(OMNI_CC_GNU)
+# if defined(__cplusplus)
+# define OMNI_CXX_VER __cplusplus
+# else
+# define OMNI_CXX_VER 0
+# endif
+# endif
+
+# define OMNI_CXX_VER_MIN 201103L
+# if OMNI_CXX_VER_MIN > OMNI_CXX_VER
+# error "atleast C++11 is required"
+# endif
diff --git a/omni/stdint.h b/omni/stdint.h
index 088b584..aa953e8 100644
--- a/omni/stdint.h
+++ b/omni/stdint.h
@@ -18,17 +18,17 @@ typedef int64_t i64;
typedef float f32;
typedef double f64;
-#define U8_MAX UINT8_MAX
+#define U8_MAX UINT8_MAX
#define U16_MAX UINT16_MAX
#define U32_MAX UINT32_MAX
#define U64_MAX UINT64_MAX
-#define I8_MIN INT8_MIN
+#define I8_MIN INT8_MIN
#define I16_MIN INT16_MIN
#define I32_MIN INT32_MIN
#define I64_MIN INT64_MIN
-#define I8_MAX INT8_MAX
+#define I8_MAX INT8_MAX
#define I16_MAX INT16_MAX
#define I32_MAX INT32_MAX
#define I64_MAX INT64_MAX
@@ -37,22 +37,22 @@ typedef double f64;
typedef u64 usize;
typedef i64 isize;
-#define USIZE_MAX UINT64_MAX
+# define USIZE_MAX UINT64_MAX
-#define ISIZE_MIN INT64_MIN
-#define ISIZE_MAX INT64_MAX
+# define ISIZE_MIN INT64_MIN
+# define ISIZE_MAX INT64_MAX
#elif OMNI_ARCH_32BIT
typedef u32 usize;
typedef i32 isize;
-#define USIZE_MAX UINT32_MAX
+# define USIZE_MAX UINT32_MAX
-#define ISIZE_MIN INT32_MIN
-#define ISIZE_MAX INT32_MAX
+# define ISIZE_MIN INT32_MIN
+# define ISIZE_MAX INT32_MAX
#else
-#error "target is not supported"
+# error "target is not supported"
#endif
#endif