-minstd: Require a minimum std version, without being specific

Alejandro Colomar alx.manpages@gmail.com
Wed Dec 21 19:08:07 GMT 2022



On 12/21/22 19:53, Alejandro Colomar wrote:
> Hi Alexander,
> 
> On 12/21/22 19:51, Alexander Monakov wrote:
>>
>>
>> On Wed, 21 Dec 2022, Alejandro Colomar via Gcc wrote:
>>
>>> Hi,
>>>
>>> I've long had this wish: an option similar to -std, but which would not
>>> specify the standard.  Rather, mark a requirement that the standard be at
>>> least a version.
>>>
>>> This would be especially useful for libraries, which might for example require
>>> C99 or C11 to work.  They would be able to specify -minstd=c11 in their pc(5)
>>> file (for use with pkgconf(1)).
>>
>> There's already a standard, portable way to check:
>>
>> #if __STDC_VERSION__ < 201710
>> #error C17 required
>> #endif
> 
> Hmm, not my favourite to stick that in every public header file, but yes, it's 
> portable.

But yes, I could provide a <project/__compiler.h> "hidden" header that does all 
this stuff, then include it everywhere.  :)


> 
> Thanks,
> 
> Alex
> 
>>
>> Alexander
> 

-- 
<http://www.alejandro-colomar.es/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20221221/1e6d9e15/attachment.sig>


More information about the Gcc mailing list