From 5b46a05ce7ede3aa3a5e405f1a64100a64dab5a2 Mon Sep 17 00:00:00 2001 From: fef Date: Thu, 15 Jul 2021 20:59:31 +0200 Subject: [PATCH] "comply" with ISO C11 Except for the bunch of macros prefixed with double underscores, but let's take care of that some time later (read: never). --- CMakeLists.txt | 2 +- include/neo/_stddef.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51db36f..64348be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14.0) project(neo VERSION 0.1.0 LANGUAGES C) set(CMAKE_C_STANDARD 11) -set(CMAKE_C_EXTENSIONS ON) +set(CMAKE_C_EXTENSIONS OFF) if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) set_property(GLOBAL PROPERTY USE_FOLDERS ON) diff --git a/include/neo/_stddef.h b/include/neo/_stddef.h index 8ee59fe..c5114be 100644 --- a/include/neo/_stddef.h +++ b/include/neo/_stddef.h @@ -21,6 +21,10 @@ extern "C" { # define offsetof(type, member) __builtin_offsetof(type, member) #endif +#ifndef typeof +# define typeof(expr) __typeof(expr) +#endif + /** Get the absolute (non negative) value of an integer */ #define nabs(n) ({ \ /* n is an expression, not a variable, evaluate it only once */ \