Skip to content

Commit

Permalink
Merge branch 'bc/require-c99'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gitster committed Dec 10, 2021
2 parents b814837 + 7bc341e commit d67fc4b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ ARFLAGS = rcs
PTHREAD_CFLAGS =

# For the 'sparse' target
SPARSE_FLAGS ?=
SPARSE_FLAGS ?= -std=gnu99
SP_EXTRA_FLAGS = -Wno-universal-initializer

# For informing GIT-BUILD-OPTIONS of the SANITIZE=leak target
Expand Down
2 changes: 1 addition & 1 deletion contrib/buildsystems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions git-compat-util.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#ifndef GIT_COMPAT_UTIL_H
#define GIT_COMPAT_UTIL_H

#if __STDC_VERSION__ - 0 < 199901L
/*
* Git is in a testing period for mandatory C99 support in the compiler. If
* your compiler is reasonably recent, you can try to enable C99 support (or,
* for MSVC, C11 support). If you encounter a problem and can't enable C99
* support with your compiler (such as with "-std=gnu99") and don't have access
* to one with this support, such as GCC or Clang, you can remove this #if
* directive, but please report the details of your system to
* git@vger.kernel.org.
*/
#error "Required C99 support is in a test phase. Please see git-compat-util.h for more details."
#endif

#ifdef USE_MSVC_CRTDBG
/*
* For these to work they must appear very early in each
Expand Down

0 comments on commit d67fc4b

Please sign in to comment.