This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Variadic macros in installed headers


This is about bug 25219, which proposes this patch:

+#if __GNUC_PREREQ (10, 0)
+/* Denotes a function pointer argument can be used to access an array
+   of N elements according to access mode.  */
+#  define __rdonly(...)  \
+  __attribute__ ((__access__ (__read_only__, __VA_ARGS__)))
+#  define __rdwr(...)  \
+  __attribute__ ((__access__ (__read_write__, __VA_ARGS__)))
+#  define __wronly(...) \
+  __attribute__ ((__access__ (__write_only__, __VA_ARGS__)))
+#else
+#  define __rdonly(...)
+#  define __rdwr(...)
+#  define __wronly(...)
+#endif

This makes the relevant headers incompatible with C89.  I think the
attribute definition either needs to be changed to require parenthesis
around the arguments (similar to __atribute__ itself), or we need to
use multiple macro definitions for each access mode.

I also dislike that the attribute does not use symbolic expressions.
It means that it cannot be used to annotate functions like asctime_r
directly.  C++-like pointer-pairs also need auxiliary function
definitions.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]