diff --git a/Makefile b/Makefile index 7b64106930..73edfa7824 100644 --- a/Makefile +++ b/Makefile @@ -1198,6 +1198,7 @@ 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. +# Older versions of GCC may require adding "-std=gnu99" at the end. CFLAGS = -g -O2 -Wall LDFLAGS = CC_LD_DYNPATH = -Wl,-rpath, diff --git a/revision.c b/revision.c index 9dff845bed..253a159e69 100644 --- a/revision.c +++ b/revision.c @@ -43,10 +43,15 @@ static inline int want_ancestry(const struct rev_info *revs); void show_object_with_name(FILE *out, struct object *obj, const char *name) { - const char *p; - fprintf(out, "%s ", oid_to_hex(&obj->oid)); - for (p = name; *p && *p != '\n'; p++) + /* + * 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. 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); fputc('\n', out); }