[PATCH v1 08/35] Remove __flexarr macro

Alejandro Colomar alx@kernel.org
Sun Nov 9 21:53:05 GMT 2025


It's unconditionally defined as [].

Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
 bits/socket.h                         | 2 +-
 locale/localeinfo.h                   | 2 +-
 misc/sys/cdefs.h                      | 2 --
 sysdeps/generic/unwind-dw2-fde.h      | 6 +++---
 sysdeps/mach/hurd/bits/socket.h       | 2 +-
 sysdeps/unix/sysv/linux/bits/socket.h | 2 +-
 sysdeps/unix/sysv/linux/sys/inotify.h | 2 +-
 7 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/bits/socket.h b/bits/socket.h
index e83ad5bc01..41910dbe65 100644
--- a/bits/socket.h
+++ b/bits/socket.h
@@ -222,7 +222,7 @@ struct cmsghdr
     int cmsg_level;		/* Originating protocol.  */
     int cmsg_type;		/* Protocol specific type.  */
  /* This field is to be aligned with CMSG_ALIGN */
- /* __extension__ unsigned char __cmsg_data __flexarr; */ /* Ancillary data.  */
+ /* __extension__ unsigned char __cmsg_data[]; */ /* Ancillary data.  */
   };
 
 /* Ancillary data object manipulation macros.  */
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index f503792d04..6f225c3647 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -79,7 +79,7 @@ struct __locale_data
     const char *string;
     unsigned int word;		/* Note endian issues vs 64-bit pointers.  */
   }
-  values __flexarr;	/* Items, usually pointers into `filedata'.  */
+  values[];			/* Items, usually pointers into `filedata'.  */
 };
 
 /* This alignment is used for 32-bit integers in locale files, both
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 6a680adcde..87c3581bb7 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -357,12 +357,10 @@
    (e.g. only if they won't affect sizeof()) should test
    #if __glibc_c99_flexarr_available.  */
 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc
-# define __flexarr	[]
 # define __glibc_c99_flexarr_available 1
 #else
 /* GCC and clang support C99 flexible array members as an extension,
    even when in C89 mode or compiling C++ (any version).  */
-# define __flexarr	[]
 # define __glibc_c99_flexarr_available 1
 #endif
 
diff --git a/sysdeps/generic/unwind-dw2-fde.h b/sysdeps/generic/unwind-dw2-fde.h
index 37a5ad3480..8972af47c2 100644
--- a/sysdeps/generic/unwind-dw2-fde.h
+++ b/sysdeps/generic/unwind-dw2-fde.h
@@ -22,7 +22,7 @@ struct fde_vector
 {
   void *orig_data;
   size_t count;
-  struct dwarf_fde *array __flexarr;
+  struct dwarf_fde *array[];
 };
 
 #ifdef _LIBC
@@ -128,7 +128,7 @@ struct dwarf_cie
   uword length;
   sword CIE_id;
   ubyte version;
-  unsigned char augmentation __flexarr;
+  unsigned char augmentation[];
 } __attribute__ ((packed, aligned (__alignof__ (void *))));
 
 /* The first few fields of an FDE.  */
@@ -136,7 +136,7 @@ struct dwarf_fde
 {
   uword length;
   sword CIE_delta;
-  unsigned char pc_begin __flexarr;
+  unsigned char pc_begin[];
 } __attribute__ ((packed, aligned (__alignof__ (void *))));
 
 typedef struct dwarf_fde fde;
diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h
index 8c18cef579..9b51c5c431 100644
--- a/sysdeps/mach/hurd/bits/socket.h
+++ b/sysdeps/mach/hurd/bits/socket.h
@@ -229,7 +229,7 @@ struct cmsghdr
     int cmsg_level;		/* Originating protocol.  */
     int cmsg_type;		/* Protocol specific type.  */
  /* This field is to be aligned with CMSG_ALIGN */
- /* __extension__ unsigned char __cmsg_data __flexarr; */ /* Ancillary data.  */
+ /* __extension__ unsigned char __cmsg_data[]; */ /* Ancillary data.  */
   };
 
 /* Ancillary data object manipulation macros.  */
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index f6eb297998..ac22e11c4d 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -290,7 +290,7 @@ struct cmsghdr
     int cmsg_level;		/* Originating protocol.  */
     int cmsg_type;		/* Protocol specific type.  */
 #if __glibc_c99_flexarr_available
-    __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.  */
+    __extension__ unsigned char __cmsg_data[]; /* Ancillary data.  */
 #endif
   };
 
diff --git a/sysdeps/unix/sysv/linux/sys/inotify.h b/sysdeps/unix/sysv/linux/sys/inotify.h
index 8b234229be..8b8a7c4694 100644
--- a/sysdeps/unix/sysv/linux/sys/inotify.h
+++ b/sysdeps/unix/sysv/linux/sys/inotify.h
@@ -31,7 +31,7 @@ struct inotify_event
   uint32_t mask;	/* Watch mask.  */
   uint32_t cookie;	/* Cookie to synchronize two events.  */
   uint32_t len;		/* Length (including NULs) of name.  */
-  char name __flexarr;	/* Name.  */
+  char name[];		/* Name.  */
 };
 
 
-- 
2.51.0



More information about the Libc-alpha mailing list