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

Re: [PATCH v2 1/1] git-compat-util: add a test balloon for C99 support

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 18, 2021, 19:10 UTC
Message-ID
<xmqqy25lwa86.fsf@gitster.g>
In-Reply-To
<YZWNumAlsek9Gi22@camp.crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 12 quoted lines
> On 2021-11-17 at 03:01:57, Jeff King wrote:
>> Yes, but I'm not at all worried about breaking our CI. That's just a
>> patch away from fixing. I'm much more worried about confused users
>> building from source, because helping them is more difficult to scale.
>
> That's one of the reasons I had proposed the current patch, because it
> pukes in a very noticeable way with directives on where to look to
> continue.  Just using C99 features means that Git breaks in a very
> subtle way where the user compiling may not be familiar with C and may
> not know how to fix it otherwise.  For example, my previous employer
> ships Git, but many of the folks who are doing the package updates are
> not C programmers.
I wonder if this would work, then.
 Makefile   | 3 ++-
 revision.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git c/Makefile w/Makefile
index 201437e9d4..454118d86b 100644
--- c/Makefile
+++ w/Makefile
@@ -1218,7 +1218,8 @@ endif
 # Set CFLAGS, LDFLAGS and other *FLAGS variables. These might be
 # tweaked by config.* below as well as the command-line, both of
 # which'll override these defaults.
-CFLAGS = -g -O2 -Wall -std=gnu99
+# Older versions of GCC may require adding "-std=gnu99" at the end.
+CFLAGS = -g -O2 -Wall
 LDFLAGS =
 CC_LD_DYNPATH = -Wl,-rpath,
 BASIC_CFLAGS = -I.
diff --git c/revision.c w/revision.c
index 78c1ceea7b..5390a479b3 100644
--- c/revision.c
+++ w/revision.c
@@ -49,7 +49,8 @@ void show_object_with_name(FILE *out, struct object *obj, const char *name)
 	 * This "for (const char *p = ..." is made as a first step towards
 	 * making use of such declarations elsewhere in our codebase.  If
 	 * it causes compilation problems on your platform, please report
-	 * it to the Git mailing list at git@vger.kernel.org.
+	 * it to the Git mailing list at git@vger.kernel.org. In the meantime,
+	 * adding -std=gnu99 to CFLAGS may help if you are with older GCC.
 	 */
 	for (const char *p = name; *p && *p != '\n'; p++)
 		fputc(*p, out);
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 23 of 32 in “Add a test balloon for C99”
  1. 0/1 Add a test balloon for C99brian m. carlson, Nov 14, 2021
  2. 1/1 git-compat-util: add a test balloon for C99 supportbrian m. carlson, Nov 14, 2021
  3. Ævar Arnfjörð BjarmasonNov 15, 2021
  4. brian m. carlsonNov 15, 2021
  5. Eric SunshineNov 15, 2021
  6. brian m. carlsonNov 16, 2021
  7. Johannes SchindelinNov 22, 2021
  8. brian m. carlsonNov 14, 2021
  9. Junio C HamanoNov 15, 2021
  10. brian m. carlsonNov 15, 2021
  11. Junio C HamanoNov 16, 2021
  12. brian m. carlsonNov 17, 2021
  13. 0/1 Add a test balloon for C99 supportbrian m. carlson, Nov 16, 2021
  14. 1/1 git-compat-util: add a test balloon for C99 supportbrian m. carlson, Nov 16, 2021
  15. Jeff KingNov 16, 2021
  16. Ævar Arnfjörð BjarmasonNov 16, 2021
  17. Jeff KingNov 16, 2021
  18. brian m. carlsonNov 17, 2021
  19. Jeff KingNov 17, 2021
  20. brian m. carlsonNov 17, 2021
  21. Carlo ArenasNov 17, 2021
  22. Ævar Arnfjörð BjarmasonNov 18, 2021
  23. Junio C HamanoNov 18, 2021
  24. Junio C HamanoNov 17, 2021
  25. Phillip WoodNov 16, 2021
  26. brian m. carlsonNov 17, 2021
  27. Jeff KingNov 17, 2021
  28. Microsoft's C language policy (was: [PATCH 0/1] Add a test balloon for C99)Ævar Arnfjörð Bjarmason, Nov 30, 2021
  29. brian m. carlsonNov 30, 2021
  30. 0/1 Add a test balloon for C99 supportbrian m. carlson, Dec 1, 2021
  31. 1/1 git-compat-util: add a test balloon for C99 supportbrian m. carlson, Dec 1, 2021
  32. Johannes SchindelinDec 2, 2021

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.