]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Change requested compiler standard to C11
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Sun, 13 Jun 2021 11:38:32 +0000 (13:38 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 18 Jun 2021 07:24:35 +0000 (09:24 +0200)
CMakeLists.txt
README.md
configure
zbuild.h
zconf-ng.h.in
zconf.h.in

index 5f1c50344ebbf30c06eb8f5e631a7cfee76bb8cd..c69b93bbe2bfe5c9f4c21357d6612db02f3aacf9 100644 (file)
@@ -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
index 68d935a42ac0fc54a6f64ee3a8b9fd70793f87b0..22b1e41647bd287937f28cd792f03fd5be1b20bf 100644 (file)
--- 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
index 2bf16198b874ce6ab8782546b9f8948a597b2be4..5d58e37cd3bfe07b64003b5e57792ac041a49106 100755 (executable)
--- 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
index 3c5e5fb407c33ec8832240ef22b3969f4be419d4..0712b54fd62bb4e4001ba96e59466e10033edd32 100644 (file)
--- 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)
index 7d54668d36516f8288bf97c7d804e0c14b201366..66ab4cf6626dd8e8f87041cc8be8dcce29895d03 100644 (file)
 #  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
  */
index ae2a30939825d67de1502e9bc5e20cbc89fde74e..2c6b12dff179086179ebbb9a9bfdb8acd511c926 100644 (file)
 #  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
  */