From a6b0e3443350b2bf74a394e28659caefb4c3df60 Mon Sep 17 00:00:00 2001 From: "Jack S. Hale" Date: Wed, 8 May 2024 07:55:32 +0200 Subject: [PATCH] Compile in C17 mode. --- ffcx/codegeneration/jit.py | 8 ++++++++ ffcx/codegeneration/ufcx.h | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ffcx/codegeneration/jit.py b/ffcx/codegeneration/jit.py index e9fbea4e6..84f9b173a 100644 --- a/ffcx/codegeneration/jit.py +++ b/ffcx/codegeneration/jit.py @@ -315,6 +315,14 @@ def _compile_objects( ufl_objects, prefix=module_name, options=options, visualise=visualise ) + # Compile in C17 mode + if sys.platform.startswith("win32"): + CFFI_BASE_COMPILE_ARGS = ["/std:c17"] + else: + CFFI_BASE_COMPILE_ARGS = ["-std=c17"] + + cffi_extra_compile_args += CFFI_BASE_COMPILE_ARGS + ffibuilder = cffi.FFI() ffibuilder.set_source( diff --git a/ffcx/codegeneration/ufcx.h b/ffcx/codegeneration/ufcx.h index 323c25092..a3b755a07 100644 --- a/ffcx/codegeneration/ufcx.h +++ b/ffcx/codegeneration/ufcx.h @@ -31,8 +31,8 @@ extern "C" { #if defined(__clang__) -#define restrict -#elif defined(__GNUC__) || defined(__GNUG__) +#define restrict __restrict +#elif defined(__GNUG__) #define restrict __restrict__ #elif defined(_MSC_VER) #define restrict __restrict