From: Hans Kristian Rosbach Date: Sun, 13 Jun 2021 11:38:32 +0000 (+0200) Subject: Change requested compiler standard to C11 X-Git-Tag: 2.1.0-beta1~563 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40a12fe994798b7033373fcee322387c99d238e3;p=thirdparty%2Fzlib-ng.git Change requested compiler standard to C11 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f1c50344..c69b93bbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,11 +8,11 @@ message(STATUS "Using CMake version ${CMAKE_VERSION}") set(CMAKE_MACOSX_RPATH 1) -# If not specified on the command line, enable C99 as the default +# If not specified on the command line, enable C11 as the default # Configuration items that affect the global compiler environment standards # should be issued before the "project" command. if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) # The C standard whose features are requested to build this target + set(CMAKE_C_STANDARD 11) # The C standard whose features are requested to build this target endif() if(NOT CMAKE_C_STANDARD_REQUIRED) set(CMAKE_C_STANDARD_REQUIRED ON) # Boolean describing whether the value of C_STANDARD is a requirement @@ -22,7 +22,7 @@ if(NOT CMAKE_C_EXTENSIONS) endif() set(VALID_C_STANDARDS "99" "11") if(NOT CMAKE_C_STANDARD IN_LIST VALID_C_STANDARDS) - MESSAGE(FATAL_ERROR "CMAKE_C_STANDARD:STRING=${CMAKE_C_STANDARD} not in know standards list\n ${VALID_C_STANDARDS}") + MESSAGE(FATAL_ERROR "CMAKE_C_STANDARD:STRING=${CMAKE_C_STANDARD} not in known standards list\n ${VALID_C_STANDARDS}") endif() # Parse the full version number from zlib.h and include in ZLIB_FULL_VERSION diff --git a/README.md b/README.md index 68d935a42..22b1e4164 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Features * Zlib compatible API with support for dual-linking * Modernized native API based on zlib API for ease of porting -* Modern C99 syntax and a clean code layout +* Modern C11 syntax and a clean code layout * Deflate medium and quick algorithms based on Intels zlib fork * Support for CPU intrinsics when available * Adler32 implementation using SSSE3, AVX2, Neon & VSX diff --git a/configure b/configure index 2bf16198b..5d58e37cd 100755 --- a/configure +++ b/configure @@ -283,7 +283,7 @@ show $cc -c $test.c if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then echo "$cc" | tee -a configure.log CC="$cc" - CFLAGS="${CFLAGS} -std=c99" + CFLAGS="${CFLAGS} -std=c11" # Re-check ARCH if the compiler is a cross-compiler. if $CC -print-multiarch 1> /dev/null 2>&1 && test -n "$($CC -print-multiarch)" 1> /dev/null 2>&1; then diff --git a/zbuild.h b/zbuild.h index 3c5e5fb40..0712b54fd 100644 --- a/zbuild.h +++ b/zbuild.h @@ -1,6 +1,20 @@ #ifndef _ZBUILD_H #define _ZBUILD_H +/* Determine compiler version of C Standard */ +#ifdef __STDC_VERSION__ +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +# if __STDC_VERSION__ >= 201112L +# ifndef STDC11 +# define STDC11 +# endif +# endif +#endif + /* This has to be first include that defines any types */ #if defined(_MSC_VER) # if defined(_WIN64) diff --git a/zconf-ng.h.in b/zconf-ng.h.in index 7d54668d3..66ab4cf66 100644 --- a/zconf-ng.h.in +++ b/zconf-ng.h.in @@ -10,14 +10,6 @@ # define _WIN32 #endif -#ifdef __STDC_VERSION__ -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif - /* Clang macro for detecting declspec support * https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute */ diff --git a/zconf.h.in b/zconf.h.in index ae2a30939..2c6b12dff 100644 --- a/zconf.h.in +++ b/zconf.h.in @@ -10,14 +10,6 @@ # define _WIN32 #endif -#ifdef __STDC_VERSION__ -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif - /* Clang macro for detecting declspec support * https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute */