diff options
author | Robert Swiecki <robert@swiecki.net> | 2023-09-21 08:29:36 +0200 |
---|---|---|
committer | Robert Swiecki <robert@swiecki.net> | 2023-09-21 08:29:36 +0200 |
commit | 557633c1de6e58c0791f349d4f0968899f97bdac (patch) | |
tree | 0ef3d47f3eb85dc3915cc0ed99e0f3d4a59c8824 | |
parent | 439606be70e2f9d8732636c88ba4cff690ec5e0f (diff) | |
download | nsjail-557633c1de6e58c0791f349d4f0968899f97bdac.tar.gz |
Makefile: move to c++17 to use [[maybe_unused]] and remove DEFER (actually not used) from macros.h
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | macros.h | 26 | ||||
-rw-r--r-- | subproc.cc | 2 |
3 files changed, 2 insertions, 28 deletions
@@ -32,7 +32,7 @@ COMMON_FLAGS += -O2 -c \ -Ikafel/include CXXFLAGS += $(USER_DEFINES) $(COMMON_FLAGS) $(shell pkg-config --cflags protobuf) \ - -std=c++14 -fno-exceptions -Wno-unused -Wno-unused-parameter + -std=c++17 -fno-exceptions -Wno-unused -Wno-unused-parameter LDFLAGS += -pie -Wl,-z,noexecstack -lpthread $(shell pkg-config --libs protobuf) BIN = nsjail @@ -37,32 +37,6 @@ #if !defined(ARR_SZ) #define ARR_SZ(array) (sizeof(array) / sizeof(*array)) #endif /* !defined(ARR_SZ) */ -#define UNUSED __attribute__((unused)) - -#if 0 /* Works, but needs -fblocks and libBlocksRuntime with clang */ -/* Go-style defer implementation */ -#define __STRMERGE(a, b) a##b -#define _STRMERGE(a, b) __STRMERGE(a, b) - -#ifdef __clang__ -static void __attribute__ ((unused)) __clang_cleanup_func(void (^*dfunc) (void)) -{ - (*dfunc) (); -} - -#define defer \ - void (^_STRMERGE(__defer_f_, __COUNTER__))(void) \ - __attribute__((cleanup(__clang_cleanup_func))) __attribute__((unused)) = ^ -#else -#define __block -#define _DEFER(a, count) \ - auto void _STRMERGE(__defer_f_, count)(void* _defer_arg __attribute__((unused))); \ - int _STRMERGE(__defer_var_, count) __attribute__((cleanup(_STRMERGE(__defer_f_, count)))) \ - __attribute__((unused)); \ - void _STRMERGE(__defer_f_, count)(void* _defer_arg __attribute__((unused))) -#define defer _DEFER(a, __COUNTER__) -#endif -#endif #define NS_VALSTR_STRUCT(x) \ { (uint64_t) x, #x } @@ -520,7 +520,7 @@ static uint8_t cloneStack[128 * 1024] __attribute__((aligned(__BIGGEST_ALIGNMENT /* Cannot be on the stack, as the child's stack pointer will change after clone() */ static __thread jmp_buf env; -[[noreturn]] static int cloneFunc(void* arg __attribute__((unused))) { +[[noreturn]] static int cloneFunc([[maybe_unused]] void* arg ) { longjmp(env, 1); LOG_F("Execution past longjmp"); } |