Skip to content

AIX headers define hz, shadowing variable name #114

@NattyNarwhal

Description

@NattyNarwhal

Classic stupid define from AIX. Ran into this dealing with muon, which vendors samurai.

In file included from /usr/include/sys/context.h:32,
                 from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/10/include-fixed/sys/signal.h:372,
                 from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/10/include-fixed/sys/wait.h:59,
                 from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/10/include-fixed/stdlib.h:386,
                 from /QOpenSys/pkgs/include/stdlib.h:6,
                 from src/cmd_install.c:9,
                 from src/amalgam.c:24:
src/external/samurai/tree.c: In function 'samu_rot':
src/external/samurai/tree.c:35:6: error: expected identifier or '(' before numeric constant
   35 |  int hz = samu_height(z);
      |      ^~

Naive patch looks something like:

--- a/tree.c
+++ b/tree.c
@@ -18,6 +18,11 @@
 
 #include "external/samurai/ctx.h"
 
+#ifdef _AIX
+/* AIX defines hz... */
+#undef hz
+#endif
+
 #define MAXH (sizeof(void *) * 8 * 3 / 2)
 
 static inline int

...but it may be better to rename hz.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions