Skip to content

Conversation

@templateU
Copy link

it will cause compilation failure if use g++<5.0.
The detailed information of the bug can be found: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57350
is that possible to use macro to determine that when the compiler is gcc and the version is less than 5.0, use the source code (g++>=5.0) directly in the call to std::align to obtain asio library support for compilers before gcc 5.0?

@hdu-sdlzx
Copy link

This is the only error generated by gcc-4.x.
operator "" in buffer.hpp introduces another compatibility issue:

09:57:59 /home/api/artifact/gcc-4.8.5/boost-1.89.0/include/boost/asio/buffer.hpp:2872:21: error: missing space between ‘""’ and suffix identifier
09:57:59 inline const_buffer operator ""_buf()
09:57:59 ^

The code is introduced in d48d95d since boost-1.84

@hdu-sdlzx
Copy link

There was a check about std::align in boost-1.83:
https://github.com/boostorg/asio/blame/boost-1.83.0/include/boost/asio/detail/memory.hpp

inline void* align(std::size_t alignment,
    std::size_t size, void*& ptr, std::size_t& space)
{
#if defined(BOOST_ASIO_HAS_STD_ALIGN)
  return std::align(alignment, size, ptr, space);
#else // defined(BOOST_ASIO_HAS_STD_ALIGN)
	const uintptr_t intptr = reinterpret_cast<uintptr_t>(ptr);
	const uintptr_t aligned = (intptr - 1u + alignment) & -alignment;
	const std::size_t padding = aligned - intptr;
	if (size + padding > space)
    return 0;
	space -= padding;
	ptr = reinterpret_cast<void*>(aligned);
  return ptr;
#endif // defined(BOOST_ASIO_HAS_STD_ALIGN)
}

which is dropped in commit 5c19f29 ("Require C++11 as the minimum c++ standard.")

@hdu-sdlzx
Copy link

Since boost.asio is NOT gtested with gcc-4.x (The minimal version in test summary is gcc-6, https://regression.boost.org/develop/developer/summary.html), I suggest we fix the doc and officially stop support for gcc-4.x.
@chriskohlhoff

@hdu-sdlzx
Copy link

I've made a PR to the maintainer's repo:
chriskohlhoff/asio#1694

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants