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

C++14 #236

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

C++14 #236

wants to merge 7 commits into from

Conversation

jwmelto
Copy link
Member

@jwmelto jwmelto commented Dec 27, 2019

This PR updates our minimum language compliance to C++14, with optional support for C++17.

This commit requires C++14 support, but compiles for C++17 if supported
The Mac compiler accepts a std=c++17 flag, but there are still some
features that don't work (like std::clamp). C++-14 is safe.
@jwmelto jwmelto changed the title C++17 C++14 Dec 27, 2019
README.macOS Outdated Show resolved Hide resolved
Also removed all the linker warnings, as they are almost certainly a local
issue and not a project one.
@atupone
Copy link
Contributor

atupone commented Dec 30, 2019

As for the new commit about gluProject moved to glm:project, I hope you can remove from README.macos the warning about HUDRenderer.cxx

fi

# C++14 is the minimum standard. C++17 isn't widely available
#AX_CXX_COMPILE_STDCXX([11], [noext])
Copy link
Member

Choose a reason for hiding this comment

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

If we're moving to C++14 being the new minimum, do we need C++11 commented out?

Copy link
Member Author

Choose a reason for hiding this comment

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

I left it for comparison but I’m happy to remove it.

Copy link
Member

Choose a reason for hiding this comment

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

I don't feel strongly either way about this, I was more so curious about its purpose

Copy link
Member Author

Choose a reason for hiding this comment

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

It was there in the first place because I wanted to verify that it compiled that way (C++11) vs the old config as a sanity check. As evidenced by the branch name, I intended to go all the way to C++17, but I found the Mac compiler (at least) has insufficient C++17 support). At one time I had flags for all 3 versions. As I tested, I dropped down to just the one. Say the word and this comment is gone.

Copy link
Member

@allejo allejo left a comment

Choose a reason for hiding this comment

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

Looks like it builds correctly with c++14 flags via CLI on macOS.

BZFlag 2.5.3 configured on 2019-12-31 with the following:

             Prefix: /usr/local
           Binaries: /usr/local/bin
            Plugins: /usr/local/lib/bzflag
       Manual pages: /usr/local/share/man

BUILD_DATE    = 2019-12-31
CC            = gcc
CXX           = g++ -std=c++14
...

Also builds fine on Xcode and can confirm the only two remaining deprecation warnings are those listed in the macOS README.

Copy link
Member

@macsforme macsforme left a comment

Choose a reason for hiding this comment

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

Other than the changes to README.macOS, this looks fine to me. As far as whether we actually want to change our C++ standard, that's a decision I'd like to see more discussion about, along with some data on operating system and compiler support. Keep in mind that we haven't even had an official release that fully utilizes C++11, yet.

README.macOS Outdated Show resolved Hide resolved
@atupone
Copy link
Contributor

atupone commented Dec 31, 2019

who fixed all the glu warnings? I fixed only the gluProject

@macsforme
Copy link
Member

who fixed all the glu warnings? I fixed only the gluProject

They were suppressed in 82ced1b. It requires running premake again for this to take effect, though.

@jwmelto
Copy link
Member Author

jwmelto commented Jan 1, 2020

As far as whether we actually want to change our C++ standard, that's a decision I'd like to see more discussion about, along with some data on operating system and compiler support. Keep in mind that we haven't even had an official release that fully utilizes C++11, yet.

I figured this PR would be a forcing function for any discussion, if needed. What form would you like this discussion to take? As to support, clang 10 (MacOS), g++ 4.9, and VS 2017 all support C++14.

@blast007
Copy link
Member

blast007 commented Jan 1, 2020

It looks like some parts of C++14 need gcc 5 (or maybe even a newer version?). Even in 4.9, some features of C++11 were added, such as support for (see under "Runtime Library (libstdc++)"). I imagine the situation is the same with other compilers. So maybe the conversation should be around which features of newer C++ standards we want to use (not just a blanket "C++14" or "C++17") and which platforms we need to compile on (such as Debian Buster, Visual Studio 2017, macOS 10.13 w/ Xcode 10.1, etc).

@jwmelto
Copy link
Member Author

jwmelto commented Jan 1, 2020

So maybe the conversation should be around which features of newer C++ standards we want to use (not just a blanket "C++14" or "C++17") and which platforms we need to compile on (such as Debian Buster, Visual Studio 2017, macOS 10.13 w/ Xcode 10.1, etc).

Exactly. Sort of. Rather than getting into a pick-and-choose feature set (although, for what it's worth CMake makes specifying these features easy), I think it is better to choose a minimum compiler version. I would note that our DEVINFO does say that extensions should not be used, so we should require standards conformance and allow developers to write to the standard.

We specify versions of things required to build this game (SDL2, for example). We require people to install things (like an alpha version of premake5). We can specify minimum supported compiler. gcc is up to version 9.2; the last 4.9 release was over 3 years ago.

Debian Buster has a gcc-7 (7.4) package. Windows VS 2017 supports the C++14 flag (VS 2019 is out). MacOS 10.13 XCode 10.1 clang 10 claims full C++14 compliance. Actually, this page is probably the most useful, with respect to compliance.

I guess the question is, for a development head (master) do we really need to lock into the lowest common denominator at this point? I'm not sure I see any reason to avoid adopting a 5-year old standard, but maybe I'm missing something?

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.

5 participants