2.4.0 build fails on OpenBSD, inttypes/stdint doesn't get pulled in to lexers causing a problem for boost::multiprecision
Building Kea 2.4.0 to update the port on OpenBSD (amd64 -current, using clang 13.0.0 and Boost 1.80.0), but it fails with some problems in the various *lexer.cc files:
In file included from /usr/local/include/boost/multiprecision/detail/precision.hpp:11:
/usr/local/include/boost/multiprecision/detail/digits.hpp:22:18: error: token is not a valid binary operator in a preprocessor subexpression
#if ULONG_MAX != SIZE_MAX
^~~~~~~~ lexer.cc:368:42: note: expanded from macro 'SIZE_MAX'
#define SIZE_MAX (~(size_t)0)
~~~~~~~~~^
1 error generated.
This isn't the OS's definition of SIZE_MAX but instead a fallback one in kea. The lexer.cc files have this (from flex) which appears to be supposed to pull in inttypes:
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types. */
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif
#include <inttypes.h>
but it's compiled with c++ not cc, so STDC_VERSION is not defined and the header doesn't get included.
I can hack around it, but any suggestions for a proper fix?