[PATCH v3 02/29] Prepare for the addition of the <sys/pagesize.h> header

Paul Eggert eggert@cs.ucla.edu
Tue Oct 1 18:38:59 GMT 2024


On 2024-10-01 11:22, Maciej W. Rozycki wrote:
>   And why is it going to be a problem?

It's in a standard as a constraint, which means standard compilers are 
required to issue a diagnostic, unfortunately.


> The ISO C24 clause you 
> refer says:

Oops, I meant to cite paragraph 3 not paragraph 2. Sorry about that. 
Paragraph 3 says, "An inline definition of a function with external 
linkage shall not ... contain, anywhere in the tokens making up the 
function definition, a reference to an identifier with internal 
linkage." This means a user-defined extern inline function cannot call a 
static function.

I suppose we could do something like this:

   #if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__always_inline__)
   static __always_inline long int
   __glibc_sysconf (int __name)
   {
     ... optimizations go here ...
   }
   # define sysconf(name) __glibc_sysconf (name)
   #endif

This would support the C standard rules, so long as GCC is smart enough 
to not issue a diagnostic about this sort of thing (is it?).


More information about the Libc-alpha mailing list