Open robertkb opened 3 years ago
Redefining typedefs is legal in C11, but not in C99. XLC enforces this by default, but can be switched to C11 with compiler flags.
Unfortunately, adding #ifndef KVTREE_H
to axl.h won't fix the problem. Sometimes, kvtree.h gets loaded before axl.h, in which case wrapping the axl definition avoids the redefinition. But other times, kvtree.h is loaded after axl.h, in which case kvtree.h sees the axl.h definition and also produces the error.
If we added a kvtree_def.h to kvtree.h which only included the typedef line, wrapped with a standard #ifndef, then always include that file in kvtree.h, axl.h, and anywhere else the typedef is needed, the conflict would be resolved, but that requires changes to KVTree.
I'm also seeing the error with some other component libraries. I don't have the comprehensive list yet.
@rhaas80, @adammoody, I'm moving the discussion here from email.
I get warning messages in redset, shuffile, and er, but not errors. Perhaps they have more permissive flags set in their cmake setup.
The CI test for the cmake build on Lassen is failing now. It looks like some typedef issue between KVTree and AXL, or possibly some changed defaults on the IBM compiler. I'm pretty sure I can fix this with some tweaks to the .h file (wrapping the typedef in a #ifdef would probably do it), or by adjusting some compiler flags on Lassen.