Skip to content

Fix complilation wth clang in C++17 mode with -Werror -Wundef#1467

Open
cuavas wants to merge 1 commit into
chriskohlhoff:masterfrom
cuavas:clang-cxx17
Open

Fix complilation wth clang in C++17 mode with -Werror -Wundef#1467
cuavas wants to merge 1 commit into
chriskohlhoff:masterfrom
cuavas:clang-cxx17

Conversation

@cuavas

@cuavas cuavas commented Apr 22, 2024

Copy link
Copy Markdown

clang 14 only defines __cpp_coroutines with -std=c++2a, it’s undefined with -std=c++17. This results in an undefined macro warning if you don’t check that it’s defined before comparing it to a literal with the -Wundef warning option:

In file included from asio/include/asio.hpp:18:
In file included from asio/include/asio/any_completion_executor.hpp:18:
asio/include/asio/detail/config.hpp:1317:39: error: '__cpp_coroutines' is not defined, evaluates to 0 [-Werror,-Wundef]
#    elif (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
                                      ^

This pull request adds the check to avoid the warning.

__cpp_coroutines is not defined with -std=c++17 option.
cuavas referenced this pull request in mamedev/mame Apr 22, 2024
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.

1 participant