On Wed, Nov 17 2021, Phillip Wood wrote: > Hi Junio > > On 15/11/2021 06:27, Junio C Hamano wrote: >> There are certain C99 features that might be nice to use in our code >> base, but we've hesitated to do so in order to avoid breaking >> compatibility with older compilers. But we don't actually know if >> people are even using pre-C99 compilers these days. >> One way to figure that out is to introduce a very small use of a >> feature, and see if anybody complains, and we've done so to probe >> the portability for a few features like "trailing comma in enum >> declaration", "designated initializer for struct", and "designated >> initializer for array". A few years ago, we tried to use a handy >> for (int i = 0; i < n; i++) >> use(i); >> to introduce a new variable valid only in the loop, but found that >> some compilers we cared about didn't like it back then. Two years >> is a long-enough time, so let's try it agin. >> If this patch can survive a few releases without complaint, then we >> can feel more confident that variable declaration in for() loop is >> supported by the compilers our user base use. And if we do get >> complaints, then we'll have gained some data and we can easily >> revert this patch. > > I like the idea of using a specific test balloon for the features that > we want to use but wont this one break the build for anyone doing > 'make DEVELOPER=1' because -Wdeclaration-after-statement will error > out. I think we could wrap the loop in gcc's warning pragmas to avoid > that. Good point. Overall something that brings us to the end-state 765dc168882 (git-compat-util: always enable variadic macros, 2021-01-28) brought us to is probably better, i.e. something you can work around by defining or undefining a macro via a Makefile parameter, instead of needing to patch git's sources.