RE: [PATCH 6/6] git-compat-util.h: add __attribute__((printf)) to git_*printf*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On July 12, 2021 4:13 PM, Jeff King wrote:
>On Sat, Jul 10, 2021 at 10:47:32AM +0200, Ævar Arnfjörð Bjarmason wrote:
>
>> Add __attribute__((printf)) to the compatibility functions we use
>> under SNPRINTF_RETURNS_BOGUS=Y.
>>
>> In practice this is redundant to the compiler's default printf format
>> checking, since we mostly (entirely?)  develop and test on platforms
>> where SNPRINTF_RETURNS_BOGUS is not set. I'm doing this mainly for
>> consistency with other code, now we don't need to think about why this
>> particular case is different.
>>
>> See c4582f93a26 (Add compat/snprintf.c for systems that return bogus,
>> 2008-03-05) for the commit that added these functions.
>
>I'm slightly lukewarm on general on adding this to a compat function.
>Those are meant to be a lowest-common-denominator fallback, and we usually avoid fancy features or our usual styles there in favor of
>simplicity.
>
>I guess this probably isn't _hurting_ anything, but it makes me wonder how many systems have a broken snprintf _and_ support the
>attribute.

NonStop does not support __attribute__ on any compiler I know of. This appears to be a gcc extension, so compat.c would create a gcc dependency, which is also not on the platform. snprintf is in place.

-Randall




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux