non-prototype function definitions

Paul Eggert eggert@cs.ucla.edu
Sat Mar 9 05:12:00 GMT 2013


On 03/08/2013 05:20 PM, Joseph S. Myers wrote:

> Any ABI issue is at most relevant, I would say, to interfaces
> that were already part of the ABI in releases ... before 2.2

In that case, one way to enforce the promotes-to-self
property (the second property that Roland mentioned)
would be to list the types of all arguments of public
functions in the pre-2.2 ABI, and check that these
types promote to themselves.  (The type 'float' would
be exempt, for the reason Roland gave.)

Something like this, say:

   #include <sys/types.h>
   #pragma GCC diagnostic error "-Wpedantic"
   #define CHECK_PROMOTION(type, line) \
     void __CONCAT (f, line) (type); \
     void __CONCAT (f, line) (x) type x; {}
   #define PROMOTES_TO_SELF(type) CHECK_PROMOTION (type, __LINE__)
   PROMOTES_TO_SELF (gid_t)
   PROMOTES_TO_SELF (mode_t)
   PROMOTES_TO_SELF (pid_t)
   ... and so on, for each such arg type ...

The above code could be put into a .c file somewhere that is
compiled as a regular part of a glibc build.



More information about the Libc-alpha mailing list