mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-04 05:21:21 +02:00
In 3.0 the MIN/MAX macros were converted to compound expressions with commit 0999e3d959 ("CLEANUP: compat: make the MIN/MAX macros more reliable"). However with older compilers these are not supported out of code blocks (e.g. to initialize variables or struct members). This is the case on Solaris 10 with gcc-5.5 when QUIC doesn't compile anymore with the future pool registration: In file included from include/haproxy/quic_tx.h:26:0, from src/quic_tx.c:15: include/haproxy/compat.h:106:19: error: braced-group within expression allowed only inside a function #define MAX(a, b) ({ \ ^ include/haproxy/pool.h:41:11: note: in definition of macro '__REGISTER_POOL' .size = _size, \ ^ ... include/haproxy/quic_tx-t.h:6:29: note: in expansion of macro 'MAX' #define QUIC_MAX_CC_BUFSIZE MAX(QUIC_INITIAL_IPV6_MTU, QUIC_INITIAL_IPV4_MTU) Let's provide the old relaxed versions as _MIN/_MAX for use with constants like such cases where it's certain that there is no risk. A previous attempt using __builtin_constant_p() to switch between the variants did not work, and it's really not worth the hassle of going this far.