]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'bc/require-c99'
authorJunio C Hamano <gitster@pobox.com>
Fri, 10 Dec 2021 22:35:14 +0000 (14:35 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Dec 2021 22:35:14 +0000 (14:35 -0800)
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

1  2 
Makefile
contrib/buildsystems/CMakeLists.txt
git-compat-util.h

diff --combined Makefile
index d56c0e4aadcfe15075db40a48dbab0688cf7cc4e,07902eb592cd94881d7b3cd8cd5dbfd817620145..ed75ed422b506ab201f646248e03ad4026a3a10f
+++ b/Makefile
@@@ -305,6 -305,9 +305,6 @@@ all:
  #
  # Define NO_TCLTK if you do not want Tcl/Tk GUI.
  #
 -# Define SANE_TEXT_GREP to "-a" if you use recent versions of GNU grep
 -# and egrep that are pickier when their input contains non-ASCII data.
 -#
  # The TCL_PATH variable governs the location of the Tcl interpreter
  # used to optimize git-gui for your system.  Only used if NO_TCLTK
  # is not set.  Defaults to the bare 'tclsh'.
  # Define NEEDS_LIBRT if your platform requires linking with librt (glibc version
  # before 2.17) for clock_gettime and CLOCK_MONOTONIC.
  #
 -# Define USE_PARENS_AROUND_GETTEXT_N to "yes" if your compiler happily
 -# compiles the following initialization:
 -#
 -#   static const char s[] = ("FOO");
 -#
 -# and define it to "no" if you need to remove the parentheses () around the
 -# constant.  The default is "auto", which means to use parentheses if your
 -# compiler is detected to support it.
 -#
  # Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
  #
  # Define HAVE_GETDELIM if your system has the getdelim() function.
  # the global variable _wpgmptr containing the absolute path of the current
  # executable (this is the case on Windows).
  #
 +# INSTALL_STRIP can be set to "-s" to strip binaries during installation,
 +# if your $(INSTALL) command supports the option.
 +#
  # Define GENERATE_COMPILATION_DATABASE to "yes" to generate JSON compilation
  # database entries during compilation if your compiler supports it, using the
  # `-MJ` flag. The JSON entries will be placed in the `compile_commands/`
  #        setting this flag the exceptions are removed, and all of
  #        -Wextra is used.
  #
 -#    pedantic:
 +#    no-pedantic:
  #
 -#        Enable -pedantic compilation. This also disables
 -#        USE_PARENS_AROUND_GETTEXT_N to produce only relevant warnings.
 +#        Disable -pedantic compilation.
  
  GIT-VERSION-FILE: FORCE
        @$(SHELL_PATH) ./GIT-VERSION-GEN
@@@ -606,6 -616,7 +606,6 @@@ SCRIPT_SH += git-submodule.s
  SCRIPT_SH += git-web--browse.sh
  
  SCRIPT_LIB += git-mergetool--lib
 -SCRIPT_LIB += git-rebase--preserve-merges
  SCRIPT_LIB += git-sh-i18n
  SCRIPT_LIB += git-sh-setup
  
@@@ -813,10 -824,6 +813,10 @@@ XDIFF_LIB = xdiff/lib.
  
  GENERATED_H += command-list.h
  GENERATED_H += config-list.h
 +GENERATED_H += hook-list.h
 +
 +.PHONY: generated-hdrs
 +generated-hdrs: $(GENERATED_H)
  
  LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
        $(FIND) . \
@@@ -902,7 -909,6 +902,7 @@@ LIB_OBJS += hash-lookup.
  LIB_OBJS += hashmap.o
  LIB_OBJS += help.o
  LIB_OBJS += hex.o
 +LIB_OBJS += hook.o
  LIB_OBJS += ident.o
  LIB_OBJS += json-writer.o
  LIB_OBJS += kwset.o
@@@ -1212,12 -1218,9 +1212,12 @@@ ARFLAGS = rc
  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
 +SANITIZE_LEAK =
 +
  # For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
  # usually result in less CPU usage at the cost of higher peak memory.
  # Setting it to 0 will feed all files in a single spatch invocation.
@@@ -1262,7 -1265,6 +1262,7 @@@ BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_
  endif
  ifneq ($(filter leak,$(SANITIZERS)),)
  BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS
 +SANITIZE_LEAK = YesCompiledWithIt
  endif
  ifneq ($(filter address,$(SANITIZERS)),)
  NO_REGEX = NeededForASAN
@@@ -1283,7 -1285,6 +1283,7 @@@ endi
  
  ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)
  dep_check = $(shell $(CC) $(ALL_CFLAGS) \
 +      -Wno-pedantic \
        -c -MF /dev/null -MQ /dev/null -MMD -MP \
        -x c /dev/null -o /dev/null 2>&1; \
        echo $$?)
@@@ -1309,7 -1310,6 +1309,7 @@@ endi
  
  ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
  compdb_check = $(shell $(CC) $(ALL_CFLAGS) \
 +      -Wno-pedantic \
        -c -MJ /dev/null \
        -x c /dev/null -o /dev/null 2>&1; \
        echo $$?)
@@@ -1347,6 -1347,14 +1347,6 @@@ ifneq (,$(SOCKLEN_T)
        BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
  endif
  
 -ifeq (yes,$(USE_PARENS_AROUND_GETTEXT_N))
 -      BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=1
 -else
 -ifeq (no,$(USE_PARENS_AROUND_GETTEXT_N))
 -      BASIC_CFLAGS += -DUSE_PARENS_AROUND_GETTEXT_N=0
 -endif
 -endif
 -
  ifeq ($(uname_S),Darwin)
        ifndef NO_FINK
                ifeq ($(shell test -d /sw/lib && echo y),y)
@@@ -1428,8 -1436,15 +1428,8 @@@ els
        REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
        PROGRAM_OBJS += http-fetch.o
        PROGRAMS += $(REMOTE_CURL_NAMES)
 -      curl_check := $(shell (echo 070908; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
 -      ifeq "$(curl_check)" "070908"
 -              ifndef NO_EXPAT
 -                      PROGRAM_OBJS += http-push.o
 -              else
 -                      EXCLUDED_PROGRAMS += git-http-push
 -              endif
 -      else
 -              EXCLUDED_PROGRAMS += git-http-push
 +      ifndef NO_EXPAT
 +              PROGRAM_OBJS += http-push.o
        endif
        curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
        ifeq "$(curl_check)" "072200"
@@@ -1902,10 -1917,6 +1902,10 @@@ ifneq ($(PROCFS_EXECUTABLE_PATH),
        BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(procfs_executable_path_SQ)"'
  endif
  
 +ifndef HAVE_PLATFORM_PROCINFO
 +      COMPAT_OBJS += compat/stub/procinfo.o
 +endif
 +
  ifdef HAVE_NS_GET_EXECUTABLE_PATH
        BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH
  endif
@@@ -2212,9 -2223,8 +2212,9 @@@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS
                $(filter %.o,$^) $(LIBS)
  
  help.sp help.s help.o: command-list.h
 +hook.sp hook.s hook.o: hook-list.h
  
 -builtin/help.sp builtin/help.s builtin/help.o: config-list.h GIT-PREFIX
 +builtin/help.sp builtin/help.s builtin/help.o: config-list.h hook-list.h GIT-PREFIX
  builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
        '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
        '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
@@@ -2237,42 -2247,43 +2237,42 @@@ $(BUILT_INS): git$
  config-list.h: generate-configlist.sh
  
  config-list.h: Documentation/*config.txt Documentation/config/*.txt
 -      $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh \
 -              >$@+ && mv $@+ $@
 +      $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
  
  command-list.h: generate-cmdlist.sh command-list.txt
  
  command-list.h: $(wildcard Documentation/git*.txt)
        $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
                $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
 -              command-list.txt >$@+ && mv $@+ $@
 +              command-list.txt >$@
 +
 +hook-list.h: generate-hooklist.sh Documentation/githooks.txt
 +      $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
  
 -SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
 -      $(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
 -      $(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP):$(PAGER_ENV):\
 +SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
 +      $(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
 +      $(gitwebdir_SQ):$(PERL_PATH_SQ):$(PAGER_ENV):\
        $(perllibdir_SQ)
 +GIT-SCRIPT-DEFINES: FORCE
 +      @FLAGS='$(SCRIPT_DEFINES)'; \
 +          if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
 +              echo >&2 "    * new script parameters"; \
 +              echo "$$FLAGS" >$@; \
 +            fi
 +
  define cmd_munge_script
  sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
      -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
      -e 's|@@DIFF@@|$(DIFF_SQ)|' \
      -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
 -    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
      -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
      -e $(BROKEN_PATH_FIX) \
      -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
      -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
 -    -e 's|@@SANE_TEXT_GREP@@|$(SANE_TEXT_GREP)|g' \
      -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
      $@.sh >$@+
  endef
  
 -GIT-SCRIPT-DEFINES: FORCE
 -      @FLAGS='$(SCRIPT_DEFINES)'; \
 -          if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
 -              echo >&2 "    * new script parameters"; \
 -              echo "$$FLAGS" >$@; \
 -            fi
 -
 -
  $(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
        $(QUIET_GEN)$(cmd_munge_script) && \
        chmod +x $@+ && \
@@@ -2506,6 -2517,13 +2506,6 @@@ ifneq ($(dep_files_present),
  include $(dep_files_present)
  endif
  else
 -# Dependencies on header files, for platforms that do not support
 -# the gcc -MMD option.
 -#
 -# Dependencies on automatically generated headers such as command-list.h
 -# should _not_ be included here, since they are necessary even when
 -# building an object for the first time.
 -
  $(OBJECTS): $(LIB_H) $(GENERATED_H)
  endif
  
@@@ -2630,6 -2648,7 +2630,6 @@@ XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS
        --keyword=__ --keyword=N__ --keyword="__n:1,2"
  LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
  LOCALIZED_SH = $(SCRIPT_SH)
 -LOCALIZED_SH += git-rebase--preserve-merges.sh
  LOCALIZED_SH += git-sh-setup.sh
  LOCALIZED_PERL = $(SCRIPT_PERL)
  
@@@ -2726,25 -2745,19 +2726,25 @@@ FIND_SOURCE_FILES = ( 
                | sed -e 's|^\./||' \
        )
  
 -$(ETAGS_TARGET): FORCE
 -      $(QUIET_GEN)$(RM) "$(ETAGS_TARGET)+" && \
 -      $(FIND_SOURCE_FILES) | xargs etags -a -o "$(ETAGS_TARGET)+" && \
 -      mv "$(ETAGS_TARGET)+" "$(ETAGS_TARGET)"
 +FOUND_SOURCE_FILES = $(shell $(FIND_SOURCE_FILES))
 +
 +$(ETAGS_TARGET): $(FOUND_SOURCE_FILES)
 +      $(QUIET_GEN)$(RM) $@+ && \
 +      echo $(FOUND_SOURCE_FILES) | xargs etags -a -o $@+ && \
 +      mv $@+ $@
 +
 +tags: $(FOUND_SOURCE_FILES)
 +      $(QUIET_GEN)$(RM) $@+ && \
 +      echo $(FOUND_SOURCE_FILES) | xargs ctags -a -o $@+ && \
 +      mv $@+ $@
  
 -tags: FORCE
 -      $(QUIET_GEN)$(RM) tags+ && \
 -      $(FIND_SOURCE_FILES) | xargs ctags -a -o tags+ && \
 -      mv tags+ tags
 +cscope.out: $(FOUND_SOURCE_FILES)
 +      $(QUIET_GEN)$(RM) $@+ && \
 +      echo $(FOUND_SOURCE_FILES) | xargs cscope -f$@+ -b && \
 +      mv $@+ $@
  
 -cscope:
 -      $(RM) cscope*
 -      $(FIND_SOURCE_FILES) | xargs cscope -b
 +.PHONY: cscope
 +cscope: cscope.out
  
  ### Detect prefix changes
  TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
@@@ -2794,7 -2807,6 +2794,7 @@@ GIT-BUILD-OPTIONS: FORC
        @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
        @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
        @echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
 +      @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
        @echo X=\'$(X)\' >>$@+
  ifdef TEST_OUTPUT_DIRECTORY
        @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
@@@ -2835,11 -2847,6 +2835,11 @@@ ifdef GIT_TEST_INDEX_VERSIO
  endif
  ifdef GIT_TEST_PERL_FATAL_WARNINGS
        @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
 +endif
 +ifdef RUNTIME_PREFIX
 +      @echo RUNTIME_PREFIX=\'true\' >>$@+
 +else
 +      @echo RUNTIME_PREFIX=\'false\' >>$@+
  endif
        @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
  
@@@ -2895,16 -2902,14 +2895,16 @@@ check-sha1:: t/helper/test-tool$
  
  SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
  
 -$(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
 +$(SP_OBJ): %.sp: %.c %.o
        $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
 -              $(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $<
 +              -Wsparse-error \
 +              $(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $< && \
 +      >$@
  
 -.PHONY: sparse $(SP_OBJ)
 +.PHONY: sparse
  sparse: $(SP_OBJ)
  
 -EXCEPT_HDRS := command-list.h config-list.h unicode-width.h compat/% xdiff/%
 +EXCEPT_HDRS := $(GENERATED_H) unicode-width.h compat/% xdiff/%
  ifndef GCRYPT_SHA256
        EXCEPT_HDRS += sha256/gcrypt.h
  endif
@@@ -2926,8 -2931,7 +2926,8 @@@ hdr-check: $(HCO
  style:
        git clang-format --style file --diff --extensions c,h
  
 -check: config-list.h command-list.h
 +.PHONY: check
 +check: $(GENERATED_H)
        @if sparse; \
        then \
                echo >&2 "Use 'make sparse' instead"; \
                exit 1; \
        fi
  
 -FOUND_C_SOURCES = $(filter %.c,$(shell $(FIND_SOURCE_FILES)))
 +FOUND_C_SOURCES = $(filter %.c,$(FOUND_SOURCE_FILES))
  COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FOUND_C_SOURCES))
  
  %.cocci.patch: %.cocci $(COCCI_SOURCES)
@@@ -2990,8 -2994,7 +2990,8 @@@ mergetools_instdir = $(prefix)/$(merget
  endif
  mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
  
 -install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
 +install_bindir_xprograms := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X))
 +install_bindir_programs := $(install_bindir_xprograms) $(BINDIR_PROGRAMS_NO_X)
  
  .PHONY: profile-install profile-fast-install
  profile-install: profile
  profile-fast-install: profile-fast
        $(MAKE) install
  
 +INSTALL_STRIP =
 +
  install: all
        $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
        $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
 -      $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
 +      $(INSTALL) $(INSTALL_STRIP) $(PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
 +      $(INSTALL) $(SCRIPTS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
        $(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
 -      $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
 +      $(INSTALL) $(INSTALL_STRIP) $(install_bindir_xprograms) '$(DESTDIR_SQ)$(bindir_SQ)'
 +      $(INSTALL) $(BINDIR_PROGRAMS_NO_X) '$(DESTDIR_SQ)$(bindir_SQ)'
 +
  ifdef MSVC
        # We DO NOT install the individual foo.o.pdb files because they
        # have already been rolled up into the exe's pdb file.
@@@ -3229,7 -3227,6 +3229,7 @@@ clean: profile-clean coverage-clean coc
        $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
        $(RM) $(TEST_PROGRAMS)
        $(RM) $(FUZZ_PROGRAMS)
 +      $(RM) $(SP_OBJ)
        $(RM) $(HCC)
        $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
        $(RM) -r po/build/
@@@ -3268,7 -3265,7 +3268,7 @@@ endi
  
  .PHONY: all install profile-clean cocciclean clean strip
  .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
 -.PHONY: FORCE cscope
 +.PHONY: FORCE
  
  ### Check documentation
  #
index 86b46114464dcbcd386ba079cc71b191e1ca7376,0945a8322368421a33de0b2cd792bacbaa0d0458..be67b4dab0c753372061b6f5e2a7f59c7c23409a
@@@ -208,7 -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
@@@ -624,13 -624,6 +624,13 @@@ if(NOT EXISTS ${CMAKE_BINARY_DIR}/confi
                        OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
  endif()
  
 +if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
 +      message("Generating hook-list.h")
 +      execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
 +                      WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
 +                      OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
 +endif()
 +
  include_directories(${CMAKE_BINARY_DIR})
  
  #build
@@@ -781,6 -774,7 +781,6 @@@ foreach(script ${git_shell_scripts}
        string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
        string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
        string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
 -      string(REPLACE "@@SANE_TEXT_GREP@@" "-a" content "${content}")
        string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
        file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
  endforeach()
diff --combined git-compat-util.h
index c6bd2a84e55363d282f56296d81dd0a3d56b5762,19943e214ba7689b27aa2a0046c8b7d41b76167e..98c4f2c81e7aa99e7b85c9e252f90bcabdf8ed16
@@@ -1,6 -1,19 +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
  #define unsigned_mult_overflows(a, b) \
      ((a) && (b) > maximum_unsigned_value_of_type(a) / (a))
  
 +/*
 + * Returns true if the left shift of "a" by "shift" bits will
 + * overflow. The type of "a" must be unsigned.
 + */
 +#define unsigned_left_shift_overflows(a, shift) \
 +    ((shift) < bitsizeof(a) && \
 +     (a) > maximum_unsigned_value_of_type(a) >> (shift))
 +
  #ifdef __GNUC__
  #define TYPEOF(x) (__typeof__(x))
  #else
  # endif
  #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
  #include <winsock2.h>
 +#ifndef NO_UNIX_SOCKETS
 +#include <afunix.h>
 +#endif
  #include <windows.h>
  #define GIT_WINDOWS_NATIVE
  #endif
@@@ -737,7 -739,7 +750,7 @@@ char *gitmkdtemp(char *)
  
  #ifdef NO_UNSETENV
  #define unsetenv gitunsetenv
 -void gitunsetenv(const char *);
 +int gitunsetenv(const char *);
  #endif
  
  #ifdef NO_STRCASESTR
@@@ -870,23 -872,6 +883,23 @@@ static inline size_t st_sub(size_t a, s
        return a - b;
  }
  
 +static inline size_t st_left_shift(size_t a, unsigned shift)
 +{
 +      if (unsigned_left_shift_overflows(a, shift))
 +              die("size_t overflow: %"PRIuMAX" << %u",
 +                  (uintmax_t)a, shift);
 +      return a << shift;
 +}
 +
 +static inline unsigned long cast_size_t_to_ulong(size_t a)
 +{
 +      if (a != (unsigned long)a)
 +              die("object too large to read on this platform: %"
 +                  PRIuMAX" is cut off to %lu",
 +                  (uintmax_t)a, (unsigned long)a);
 +      return (unsigned long)a;
 +}
 +
  #ifdef HAVE_ALLOCA_H
  # include <alloca.h>
  # define xalloca(size)      (alloca(size))
@@@ -903,7 -888,6 +916,7 @@@ void *xmemdupz(const void *data, size_
  char *xstrndup(const char *str, size_t len);
  void *xrealloc(void *ptr, size_t size);
  void *xcalloc(size_t nmemb, size_t size);
 +void xsetenv(const char *name, const char *value, int overwrite);
  void *xmmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
  const char *mmap_os_err(void);
  void *xmmap_gently(void *start, size_t length, int prot, int flags, int fd, off_t offset);
@@@ -1282,6 -1266,10 +1295,6 @@@ int warn_on_fopen_errors(const char *pa
   */
  int open_nofollow(const char *path, int flags);
  
 -#if !defined(USE_PARENS_AROUND_GETTEXT_N) && defined(__GNUC__)
 -#define USE_PARENS_AROUND_GETTEXT_N 1
 -#endif
 -
  #ifndef SHELL_PATH
  # define SHELL_PATH "/bin/sh"
  #endif