@@ -232,18 +232,12 @@ For C programs:
. since early 2021 with 765dc168882, we have been using variadic
macros, mostly for printf-like trace and debug macros.
- These used to be forbidden, but we have not heard any breakage
- report, and they are assumed to be safe.
+ . since late 2021 with 44ba10d6, we have had variables declared in
+ the for loop "for (int i = 0; i < 10; i++)".
- Variables have to be declared at the beginning of the block, before
the first statement (i.e. -Wdeclaration-after-statement).
- - Declaring a variable in the for loop "for (int i = 0; i < 10; i++)"
- is still not allowed in this codebase. We are in the process of
- allowing it by waiting to see that 44ba10d6 (revision: use C99
- declaration of variable in for() loop, 2021-11-14) does not get
- complaints. Let's revisit this around November 2022.
-
- NULL pointers shall be written as NULL, not as 0.
- When declaring pointers, the star sides with the variable
@@ -47,13 +47,6 @@ static inline int want_ancestry(const struct rev_info *revs);
void show_object_with_name(FILE *out, struct object *obj, const char *name)
{
fprintf(out, "%s ", oid_to_hex(&obj->oid));
- /*
- * 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);