Switched to clang and C23
Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
This commit is contained in:
12
README.md
12
README.md
@@ -1,3 +1,11 @@
|
||||
# evol-headers
|
||||
# evol headers
|
||||
|
||||
STILL A WIP
|
||||
Project Initialization
|
||||
```
|
||||
meson setup --native-file=meson-native-clang --wipe build
|
||||
```
|
||||
|
||||
Build:
|
||||
```
|
||||
meson compile -C build
|
||||
```
|
||||
|
||||
@@ -14,7 +14,7 @@ typedef unsigned long long int u64;
|
||||
typedef float f32;
|
||||
typedef double f64;
|
||||
|
||||
#if !defined(__cplusplus)
|
||||
#if !defined(__cplusplus) && __STDC_VERSION__ < 202311L
|
||||
typedef _Bool bool;
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
@@ -82,7 +82,7 @@ typedef struct {
|
||||
#define TYPEDATA_GEN(T, ...) \
|
||||
EV_WARNING_PUSH(); \
|
||||
EV_WARNING_DISABLE_GCC("override-init"); \
|
||||
EV_WARNING_DISABLE_CLANG("override-init"); \
|
||||
EV_WARNING_DISABLE_CLANG("initializer-overrides"); \
|
||||
EV_UNUSED static const EvTypeData TypeData(T) = { \
|
||||
EV_DEBUG(.name = EV_STRINGIZE(T),) \
|
||||
.size = sizeof(T), \
|
||||
@@ -114,6 +114,7 @@ typedef struct {
|
||||
#define __EV_DEFAULT_FN(T, ...) .default_val = (void*)&(T){ __VA_ARGS__ },
|
||||
#define __EV_INVALID_FN(T, ...) .invalid_val = (void*)&(T){ __VA_ARGS__ },
|
||||
|
||||
[[maybe_unused]]
|
||||
static void nop() {}
|
||||
#define METHOD_CHECK(T, ...) (__VA_ARGS__ EV_DEBUG(?__VA_ARGS__:(assert(!EV_STRINGIZE(__VA_ARGS__)"not defined"),(T)nop)))
|
||||
|
||||
|
||||
4
meson-native-clang
Normal file
4
meson-native-clang
Normal file
@@ -0,0 +1,4 @@
|
||||
[binaries]
|
||||
c = 'clang.exe'
|
||||
c_ld = 'lld'
|
||||
cpp = 'clang++.exe'
|
||||
@@ -1,5 +1,5 @@
|
||||
project('evol-headers', 'c',
|
||||
default_options : [ 'c_std=gnu17' ])
|
||||
default_options : [ 'c_std=gnu23' ])
|
||||
|
||||
headers_include = include_directories('.')
|
||||
|
||||
@@ -16,6 +16,8 @@ endif
|
||||
cc = meson.get_compiler('c')
|
||||
if cc.get_id() == 'msvc'
|
||||
evh_c_args += '/Zc:preprocessor'
|
||||
elif cc.get_id() == 'clang'
|
||||
evh_c_args += '-DEV_CC_CLANG=1'
|
||||
endif
|
||||
|
||||
# All other targets should follow the same template
|
||||
@@ -33,7 +35,7 @@ headers_dep = declare_dependency(
|
||||
)
|
||||
|
||||
# Tests
|
||||
str_test = executable('str_test', 'str_test.c', dependencies: [str_dep])
|
||||
str_test = executable('str_test', 'str_test.c', dependencies: [str_dep], c_args: evh_c_args)
|
||||
test('evstr', str_test)
|
||||
|
||||
if meson.version().version_compare('>= 0.54.0')
|
||||
|
||||
Reference in New Issue
Block a user