Re: [PATCH 1/1] git-compat-util: add a test balloon for C99 support
flat view
From: Johannes Schindelin <hidden>
Date: 2021-11-22 11:47:41
Subsystem:
the rest · Maintainer:
Linus Torvalds
Hi brian, On Sun, 14 Nov 2021, brian m. carlson wrote:
quoted hunk ↗ jump to hunk
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index fd1399c440..91e8525fa9 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt@@ -208,7 +208,7 @@ endif() if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}) - add_compile_options(/MP) + add_compile_options(/MP /std:c11) endif() #default behaviour
If we do this, we also need the following patch, to ensure that
`FLEX_ARRAY` is once again defined in a way that is acceptable for MS
Visual C:
-- snipsnap --
commit 9043470c19170643d1f74d6767a0df5d72e6c35c
Author: Johannes Schindelin [off-list ref]
Date: Mon Nov 22 12:39:40 2021 +0100
fixup??? git-compat-util: add a test balloon for C99 support
This seems to be required to define `FLEX_ARRAY` in a manner that MSVC
in C11 mode accepts.
Signed-off-by: Johannes Schindelin [off-list ref]
diff --git a/git-compat-util.h b/git-compat-util.h
index cba8ad260043..fcde3588172f 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h@@ -45,7 +45,7 @@ /* * See if our compiler is known to support flexible array members. */ -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && (!defined(__SUNPRO_C) || (__SUNPRO_C > 0x580)) +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(_MSC_VER) && (!defined(__SUNPRO_C) || (__SUNPRO_C > 0x580)) # define FLEX_ARRAY /* empty */ #elif defined(__GNUC__) # if (__GNUC__ >= 3)