git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v5 12/18] Allow disabling "inline"

From
GVGary V. Vaughan <git@mlists.thewrittenword.com>
Date
May 14, 2010, 09:31 UTC
Message-ID
<20100514093822.893923000@mlists.thewrittenword.com>
In-Reply-To
<20100514093131.249094000@mlists.thewrittenword.com>

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>
---
 Makefile      |    7 +++++++
 config.mak.in |    1 +
 configure.ac  |    6 ++++++
 3 files changed, 14 insertions(+)
Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,9 @@ all::
 # Define SOCKLEN_T to a suitable type (such as 'size_t') if your
 # system headers do not define a socklen_t type.
 #
+# Define INLINE to a suitable substitute (such as '__inline' or '') if git
+# fails to compile with errors about undefined inline functions or similar.
+#
 # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
 # or vsnprintf() return -1 instead of number of characters which would
 # have been written to the final string if enough space had been available.
@@ -1090,6 +1093,10 @@ else
 BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
 endif
 
+ifneq (,$(INLINE))
+	BASIC_CFLAGS += -Dinline=$(INLINE)
+endif
+
 ifneq (,$(SOCKLEN_T))
 	BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T)
 endif
Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -327,6 +327,12 @@ GIT_PARSE_WITH(tcltk))
 AC_MSG_NOTICE([CHECKS for programs])
 #
 AC_PROG_CC([cc gcc])
+AC_C_INLINE
+case $ac_cv_c_inline in
+  inline | yes | no)	;;
+  *)			AC_SUBST([INLINE], [$ac_cv_c_inline]) ;;
+esac
+
 # which switch to pass runtime path to dynamic libraries to the linker
 AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [
    SAVE_LDFLAGS="${LDFLAGS}"
Index: b/config.mak.in
===================================================================
--- a/config.mak.in
+++ b/config.mak.in
@@ -58,6 +58,7 @@ NO_INET_PTON=@NO_INET_PTON@
 NO_ICONV=@NO_ICONV@
 OLD_ICONV=@OLD_ICONV@
 NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
+INLINE=@INLINE@
 SOCKLEN_T=@SOCKLEN_T@
 FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@
 SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@
-- 
Gary V. Vaughan (gary@thewrittenword.com)
Previous: Gary V. VaughanNext: Gary V. Vaughan
Message 20 of 34 in “Portability patches for git-1.7.1”
  1. 00/18 Portability patches for git-1.7.1Gary V. Vaughan, May 14, 2010
  2. 01/18 Makefile: pass CPPFLAGS through to fllow customizationGary V. Vaughan, May 14, 2010
  3. Robin H. JohnsonMay 14, 2010
  4. Gary V. VaughanMay 14, 2010
  5. Robin H. JohnsonMay 14, 2010
  6. Gary V. VaughanMay 14, 2010
  7. 02/18 Rewrite dynamic structure initializations to runtime assignmentGary V. Vaughan, May 14, 2010
  8. Junio C HamanoJun 2, 2010
  9. 03/18 Makefile: -lpthread may still be necessary when libc has only pthread stubsGary V. Vaughan, May 14, 2010
  10. 04/18 enums: omit trailing comma for portabilityGary V. Vaughan, May 14, 2010
  11. 05/18 Do not use "diff" found on PATH while building and installingGary V. Vaughan, May 14, 2010
  12. Junio C HamanoJun 2, 2010
  13. 06/18 tests: use "test_cmp", not "diff", when verifying the resultGary V. Vaughan, May 14, 2010
  14. Junio C HamanoJun 2, 2010
  15. 07/18 test_cmp: do not use "diff -u" on platforms that lack oneGary V. Vaughan, May 14, 2010
  16. 08/18 git-compat-util.h: some platforms with mmap() lack MAP_FAILED definitionGary V. Vaughan, May 14, 2010
  17. 09/18 Makefile: some platforms do not have hstrerror anywhereGary V. Vaughan, May 14, 2010
  18. 10/18 Make NO_{INET_NTOP,INET_PTON} configured independentlyGary V. Vaughan, May 14, 2010
  19. 11/18 Some platforms lack socklen_t typeGary V. Vaughan, May 14, 2010
  20. 12/18 Allow disabling "inline"Gary V. Vaughan, May 14, 2010
  21. 13/18 inline declaration does not work on AIXGary V. Vaughan, May 14, 2010
  22. 14/18 Makefile: SunOS 5.6 portability fixGary V. Vaughan, May 14, 2010
  23. 15/18 git-compat-util.h: Irix 6.5 defines sgi but not __sgi.Gary V. Vaughan, May 14, 2010
  24. git-compat-util.h: use apparently more common __sgi macro to detect SGI IRIXBrandon Casey, Jun 2, 2010
  25. Gary V. VaughanJun 2, 2010
  26. Tor ArntsenJun 2, 2010
  27. 16/18 Makefile: HPUX11 portability fixes.Gary V. Vaughan, May 14, 2010
  28. 17/18 Makefile: HP-UX 10.20 portability fixes.Gary V. Vaughan, May 14, 2010
  29. 18/18 Makefile: Tru64 portability fixGary V. Vaughan, May 14, 2010
  30. Gary V. VaughanMay 26, 2010
  31. Gary V. VaughanJun 7, 2010
  32. Junio C HamanoJun 7, 2010
  33. Tor ArntsenJun 9, 2010
  34. Junio C HamanoJun 11, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.