s6-ps fails to compile under clang due to using a variable
length array in a structure. This is gcc-specific behavior.

This patch instead creates variable-length arrays, then a
structure with references to those variable-length arrays.
---
 src/minutils/s6-ps.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/minutils/s6-ps.c b/src/minutils/s6-ps.c
index bba973b..28a7898 100644
--- a/src/minutils/s6-ps.c
+++ b/src/minutils/s6-ps.c
@@ -286,7 +286,15 @@ int main (int argc, char const *const *argv)
     /* Order the processes for display */
 
     {
-      AVLTREEB_TYPE(n+1) pidtree ;
+      avlnode storage[n+1] ;
+      uint32_t freelist[n+1] ;
+
+      struct {
+        avlnode *storage ;
+        uint32_t *freelist ;
+        avltreen info ;
+      } pidtree = { .storage = storage, .freelist = freelist } ;
+
       avltreeb_init(&pidtree, n+1, &pid_dtok, &uint32_cmp, p) ;
       for (i = 0 ; i < n ; i++)
       {
-- 
1.8.3.1

Reply via email to