mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 06:33:35 +00:00
improving vulkan error messages
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/10 08:49:17 by maldavid #+# #+# */
|
||||
/* Updated: 2023/12/16 20:20:35 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/03 14:39:23 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -93,6 +93,32 @@
|
||||
#define MLX_FUNC_SIG "Unknown function"
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus // if we compile in C
|
||||
#ifdef __STDC__
|
||||
#ifdef __STDC_VERSION__
|
||||
#if __STDC_VERSION__ == 199409L
|
||||
#define MLX_C_VERSION 1994
|
||||
#elif __STDC_VERSION__ == 199901L
|
||||
#define MLX_C_VERSION 1999
|
||||
#elif __STDC_VERSION__ == 201112L
|
||||
#define MLX_C_VERSION 2011
|
||||
#elif __STDC_VERSION__ == 201710L
|
||||
#define MLX_C_VERSION 2017
|
||||
#elif __STDC_VERSION__ == 202311L
|
||||
#define MLX_C_VERSION 2023
|
||||
#else
|
||||
#define MLX_C_VERSION 0
|
||||
#endif
|
||||
#else
|
||||
#define MLX_C_VERSION 0
|
||||
#endif
|
||||
#else
|
||||
#define MLX_C_VERSION 0
|
||||
#endif
|
||||
#else
|
||||
#define MLX_C_VERSION 0
|
||||
#endif
|
||||
|
||||
// Checking common assumptions
|
||||
#ifdef __cplusplus
|
||||
#include <climits>
|
||||
@@ -109,8 +135,48 @@
|
||||
static_assert(sizeof(uint16_t) == 2, "uint16_t is not of the correct size");
|
||||
static_assert(sizeof(uint32_t) == 4, "uint32_t is not of the correct size");
|
||||
static_assert(sizeof(uint64_t) == 8, "uint64_t is not of the correct size");
|
||||
#elif MLX_C_VERSION >= 2011
|
||||
#if MLX_C_VERSION < 2023
|
||||
#include <assert.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static_assert(CHAR_BIT == 8, "CHAR_BIT is expected to be 8");
|
||||
|
||||
static_assert(sizeof(int8_t) == 1, "int8_t is not of the correct size" );
|
||||
static_assert(sizeof(int16_t) == 2, "int16_t is not of the correct size");
|
||||
static_assert(sizeof(int32_t) == 4, "int32_t is not of the correct size");
|
||||
static_assert(sizeof(int64_t) == 8, "int64_t is not of the correct size");
|
||||
|
||||
static_assert(sizeof(uint8_t) == 1, "uint8_t is not of the correct size" );
|
||||
static_assert(sizeof(uint16_t) == 2, "uint16_t is not of the correct size");
|
||||
static_assert(sizeof(uint32_t) == 4, "uint32_t is not of the correct size");
|
||||
static_assert(sizeof(uint64_t) == 8, "uint64_t is not of the correct size");
|
||||
#elif defined(MLX_COMPILER_GCC)
|
||||
#define STATIC_ASSERT(cnd, descr) \
|
||||
({ \
|
||||
extern int __attribute__((error("static assert failed: (" #cnd ") (" #descr ")"))) compile_time_check(void); \
|
||||
((cnd) ? 0 : compile_time_check()), 0; \
|
||||
})
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
STATIC_ASSERT(CHAR_BIT == 8, "CHAR_BIT is expected to be 8");
|
||||
|
||||
STATIC_ASSERT(sizeof(int8_t) == 1, "int8_t is not of the correct size" );
|
||||
STATIC_ASSERT(sizeof(int16_t) == 2, "int16_t is not of the correct size");
|
||||
STATIC_ASSERT(sizeof(int32_t) == 4, "int32_t is not of the correct size");
|
||||
STATIC_ASSERT(sizeof(int64_t) == 8, "int64_t is not of the correct size");
|
||||
|
||||
STATIC_ASSERT(sizeof(uint8_t) == 1, "uint8_t is not of the correct size" );
|
||||
STATIC_ASSERT(sizeof(uint16_t) == 2, "uint16_t is not of the correct size");
|
||||
STATIC_ASSERT(sizeof(uint32_t) == 4, "uint32_t is not of the correct size");
|
||||
STATIC_ASSERT(sizeof(uint64_t) == 8, "uint64_t is not of the correct size");
|
||||
#else
|
||||
#define STATIC_ASSERT(COND, MSG) typedef char static_assertion___##MSG[(COND)?1:-1]
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user