[PATCH] inet: Increase htontest coverage to run-time evaluation, library

Florian Weimer fweimer@redhat.com
Fri Jun 14 10:29:12 GMT 2024


* Andreas Schwab:

> On Jun 14 2024, Florian Weimer wrote:
>
>> +/* Use a volatile function pointer as a compiler barrier, to test the
>> +   library implementation, not the compiler intrinsic.  */
>> +uint32_t (*volatile htonl_ptr) (uint32_t) = htonl;
>> +uint32_t (*volatile ntohl_ptr) (uint32_t) = ntohl;
>> +uint16_t (*volatile htons_ptr) (uint16_t) = htons;
>> +uint16_t (*volatile ntohs_ptr) (uint16_t) = ntohs;
>
> Perhaps -fno-builtin is already sufficient?

Hmm.  There is no compiler builtin yet, which means that (htonl)
etc. are currently sufficient for ensuring that the implementation is
called.  I'd still like to make this change in case one gets added.

Thanks,
Florian



More information about the Libc-alpha mailing list