Re: [PATCH 1/1] git-compat-util: add a test balloon for C99 support
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Nov 22, 2021, 11:47 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2111221245460.63@tvgsbejvaqbjf.bet>
- In-Reply-To
- <20211114212437.1466695-2-sandals@crustytoothpaste.net>
Hi brian,
On Sun, 14 Nov 2021, brian m. carlson wrote:
Show 13 quoted lines
> 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 behaviourIf 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 <Johannes.Schindelin@gmx.de> 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 <johannes.schindelin@gmx.de>
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)