Skip to content

Commit d67fc4b

Browse files
committed
Merge branch 'bc/require-c99'
Weather balloon to break people with compilers that do not support C99. * bc/require-c99: git-compat-util: add a test balloon for C99 support
2 parents b814837 + 7bc341e commit d67fc4b

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ ARFLAGS = rcs
12121212
PTHREAD_CFLAGS =
12131213

12141214
# For the 'sparse' target
1215-
SPARSE_FLAGS ?=
1215+
SPARSE_FLAGS ?= -std=gnu99
12161216
SP_EXTRA_FLAGS = -Wno-universal-initializer
12171217

12181218
# For informing GIT-BUILD-OPTIONS of the SANITIZE=leak target

contrib/buildsystems/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ endif()
208208
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
209209
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR})
210210
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
211-
add_compile_options(/MP)
211+
add_compile_options(/MP /std:c11)
212212
endif()
213213

214214
#default behaviour

git-compat-util.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
#ifndef GIT_COMPAT_UTIL_H
22
#define GIT_COMPAT_UTIL_H
33

4+
#if __STDC_VERSION__ - 0 < 199901L
5+
/*
6+
* Git is in a testing period for mandatory C99 support in the compiler. If
7+
* your compiler is reasonably recent, you can try to enable C99 support (or,
8+
* for MSVC, C11 support). If you encounter a problem and can't enable C99
9+
* support with your compiler (such as with "-std=gnu99") and don't have access
10+
* to one with this support, such as GCC or Clang, you can remove this #if
11+
* directive, but please report the details of your system to
12+
13+
*/
14+
#error "Required C99 support is in a test phase. Please see git-compat-util.h for more details."
15+
#endif
16+
417
#ifdef USE_MSVC_CRTDBG
518
/*
619
* For these to work they must appear very early in each

0 commit comments

Comments
 (0)