[PATCH] stdint: Use __extension__ on long long constants
Dennis Lambe Jr.
malsyned@malsyned.net
Tue Feb 25 14:27:00 GMT 2020
Quoting Florian Weimer <fweimer@redhat.com>:
>> Quoting Florian Weimer <fweimer@redhat.com>:
>>
>>> I think users who use <stdint.h> in C89 mode expect such warnings
>>> because such usages cannot be made compatible with C89 compilers
>>> without long long support.
>>
>> Existing practice suggests differently. Every usage of 'long long' in
>> the headers under stdlib/ is preceded by an __extention__ keyword to
>> suppress those warnings. This was the only instance I could find of a
>> stdlib header not suppressing that warning.
>
> None of those are in macros. These macros are special in the sense that
> they require the long long extension only on 32-bit targets.
I see your point here. However, the use of __extension__ before the
typedefs for int64 types means that you can get away with a lot of
implicit long long usage via int64 without running into a warning,
though. So if the user expects that, their expectation is only being
met inconsistently: they only get a warning if they use the macros,
not if they use only the typedefs. (this is exactly how I ran into
this).
Technically we're way outside the standard anyway -- there's no reason
to expect stdint.h to exist at all on c89 and any code running with
-pedantic -std=c89 and including stdint.h could be called quirky. I
just thought it'd be nice to standardize on either "warn" or "don't
warn" rather than a mix of the two.
More information about the Libc-alpha
mailing list