Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: enable clang-cl build #9018

Merged
merged 1 commit into from Apr 11, 2021
Merged

Conversation

WimLeflere
Copy link
Contributor

Problem

Build errors with clang-cl, in Microsoft Visual Studio.

Description

Enable the clang-cl build in Visual Studio by removing some macro redefinitions.
Add final and fallthrough attributes for clang-cl.

Remove macro redefinitions
Add final and fallthrough attributes for clang-cl
Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably remove a few of these defines, now that we're on C++17

Later though :)

@LordAro LordAro merged commit 9aebfca into OpenTTD:master Apr 11, 2021
@LordAro LordAro added the backport requested This PR should be backport to current release (RC / stable) label Apr 11, 2021
@WimLeflere
Copy link
Contributor Author

Can probably remove a few of these defines, now that we're on C++17

I gave it a try in master...WimLeflere:enable-clang-cl-MSVC-cleanup-attribute-macros
But it quickly became a big change as [[noreturn]] is in the wrong place in the function definitions.
And __has_cpp_attribute is C++20, so not sure which compilers support it.

@LordAro
Copy link
Member

LordAro commented Apr 11, 2021

mm, that's always the issue with these __has_* macros, you have to test for support for those macros first :p

We can reasonably assume that any compiler that works with OTTD is "fully" (or close enough) C++17 compliant, so testing for things like attributes is unnecessary

@WimLeflere WimLeflere deleted the fix-clang-cl-build branch April 11, 2021 13:27
LordAro pushed a commit to LordAro/OpenTTD that referenced this pull request Apr 17, 2021
Remove macro redefinitions
Add final and fallthrough attributes for clang-cl
LordAro pushed a commit that referenced this pull request Apr 18, 2021
Remove macro redefinitions
Add final and fallthrough attributes for clang-cl
@LordAro LordAro added backported This PR is backported to a current release (RC / stable) and removed backport requested This PR should be backport to current release (RC / stable) labels Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported This PR is backported to a current release (RC / stable)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants