Brad Smith <b...@comstyle.com> writes: > blowfish-bcrypt.c has a function by the name of swap32(). This conflicts > with a function provided by OpenBSD of the same name. > > blowfish-bcrypt.c:152:33: error: too many arguments provided to > function-like macro invocation > static void swap32(uint32_t *x, int count) > ^ > /usr/include/sys/endian.h:71:9: note: macro 'swap32' defined here > #define swap32(x) __swap32(x)
Do you know why endian.h is included in that compilation unit? Maybe included indirectly via #include <string.h>? I don't think it's quite right that including standard header files defines a macro with that name (only defining __swap32 would be more appropriate), but I guess it's something we'll have to live with. And it seems to just be a compile time collision, as far as I see, not at link time (since nettle's definition is static). > We have a patch in our tree to rename the function. I'd submit it as is > but after doing this enough over the years everyone has their own > preference for naming. The diff we have prefixed the function with > the letter e. What is the preference when this function is renamed? I see two reasonable ways to work around the problem. Either just add an // explaining comment #undef swap32 just before the definition of swap32 in blowfish-bcrypt.c. Or rename nettle's function to something less likely to collide with system headers, e.g., _nettle_swap32. I think I'd prefer the former, if that solves the problem. There are lots of local symbols with short and non-unique names, and we really have to rely on naming hygiene in standard headers to avoid collisions. Regards, /Niels Möller -- Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677. Internet email is subject to wholesale government surveillance. _______________________________________________ nettle-bugs mailing list -- nettle-bugs@lists.lysator.liu.se To unsubscribe send an email to nettle-bugs-le...@lists.lysator.liu.se