chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.81k stars 1.2k forks source link

`ASIO_ASSUME` definition is broken on older compilers #1268

Open Lastique opened 1 year ago

Lastique commented 1 year ago

https://github.com/chriskohlhoff/asio/blob/f693a3eb7fe72a5f19b975289afc4f437d373d9c/asio/include/asio/detail/config.hpp#L2146-L2157

  1. gcc 4.4 does not support __builtin_unreachable, which makes the __GNUC__ branch definition to fail.

  2. clang 3.5 doesn't support __builtin_assume and uses the last fallback option. There, ASIO_ASSUME is defined without arguments, meaning it expands to incorrect code like (void)0(base != 0). This also affects any other compilers that are not handled by prior branches.

This also affects Boost version, including Boost 1.82 beta1. In particular, it prevents Boost.Log compilation with the compilers mentioned above. Please, fix before the Boost 1.82 release.