Skip to content

Commit f9f33cd

Browse files
Gary V. Vaughangitster
authored andcommitted
Allow disabling "inline"
Compiler support for inline is sometimes buggy, and occasionally missing entirely. This patch adds a test for inline support, and redefines the keyword with the preprocessor if necessary at compile time. Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent e88a135 commit f9f33cd

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ all::
1111
# Define SOCKLEN_T to a suitable type (such as 'size_t') if your
1212
# system headers do not define a socklen_t type.
1313
#
14+
# Define INLINE to a suitable substitute (such as '__inline' or '') if git
15+
# fails to compile with errors about undefined inline functions or similar.
16+
#
1417
# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
1518
# or vsnprintf() return -1 instead of number of characters which would
1619
# have been written to the final string if enough space had been available.
@@ -1090,6 +1093,10 @@ else
10901093
BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
10911094
endif
10921095

1096+
ifneq (,$(INLINE))
1097+
BASIC_CFLAGS += -Dinline=$(INLINE)
1098+
endif
1099+
10931100
ifneq (,$(SOCKLEN_T))
10941101
BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
10951102
endif

config.mak.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ NO_INET_PTON=@NO_INET_PTON@
5858
NO_ICONV=@NO_ICONV@
5959
OLD_ICONV=@OLD_ICONV@
6060
NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
61+
INLINE=@INLINE@
6162
SOCKLEN_T=@SOCKLEN_T@
6263
FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@
6364
SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@

configure.ac

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,12 @@ GIT_PARSE_WITH(tcltk))
327327
AC_MSG_NOTICE([CHECKS for programs])
328328
#
329329
AC_PROG_CC([cc gcc])
330+
AC_C_INLINE
331+
case $ac_cv_c_inline in
332+
inline | yes | no) ;;
333+
*) AC_SUBST([INLINE], [$ac_cv_c_inline]) ;;
334+
esac
335+
330336
# which switch to pass runtime path to dynamic libraries to the linker
331337
AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [
332338
SAVE_LDFLAGS="${LDFLAGS}"

0 commit comments

Comments
 (0)