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 warnings from GCC9 #7630

Merged
merged 10 commits into from Sep 30, 2019
Merged

Fix warnings from GCC9 #7630

merged 10 commits into from Sep 30, 2019

Conversation

@LordAro
Copy link
Member

LordAro commented Jun 29, 2019

Noisest one is https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/C_002b_002b-Dialect-Options.html#index-Wdeprecated-copy

Mostly fixed by removing explicit copy constructors in favour of implicit compiler, or removing the need for one (switching an array out with std::array)

Closes #7748
Closes #7751

@LordAro LordAro force-pushed the LordAro:gcc9-warningfix branch 2 times, most recently from c9d285d to ec4c4ac Jun 29, 2019
@LordAro

This comment has been minimized.

Copy link
Member Author

LordAro commented Jun 29, 2019

clang build now relies on OpenTTD/CompileFarm#37

@LordAro LordAro force-pushed the LordAro:gcc9-warningfix branch 2 times, most recently from 8cc3633 to 3bbcdb8 Jul 18, 2019
@LordAro LordAro force-pushed the LordAro:gcc9-warningfix branch from 3bbcdb8 to 4cc611c Aug 3, 2019
@nikolas

This comment has been minimized.

Copy link
Contributor

nikolas commented Aug 29, 2019

👍 looks good on my gcc 9.2.1 on Debian.

@LordAro LordAro force-pushed the LordAro:gcc9-warningfix branch from 4cc611c to e476f2b Sep 7, 2019
Copy link
Contributor

glx22 left a comment

I really don't see how to fix

/home/vsts/work/1/s/src/script/api/script_goal.cpp:141:36: warning: comparison of constant 65536 with expression of type 'ScriptClient::ClientID' is always true [-Wtautological-constant-out-of-range-compare]
        EnforcePrecondition(false, client < (1 << 16));
                                   ~~~~~~ ^ ~~~~~~~~~
/home/vsts/work/1/s/src/script/api/script_error.hpp:24:8: note: expanded from macro 'EnforcePrecondition'
        if (!(condition)) {                                           \
              ^~~~~~~~~
@@ -38,7 +38,7 @@ enum NetworkVehicleType {
};

/** 'Unique' identifier to be given to clients */
enum ClientID {
enum ClientID : uint32 {

This comment has been minimized.

Copy link
@glx22

glx22 Sep 28, 2019

Contributor

doesn't work :(

@@ -26,7 +26,7 @@ class ScriptClient : public ScriptObject {
public:

/** Different constants related to ClientID. */
enum ClientID {
enum ClientID : uint32 {

This comment has been minimized.

Copy link
@glx22

glx22 Sep 28, 2019

Contributor

doesn't work :(

@LordAro

This comment has been minimized.

Copy link
Member Author

LordAro commented Sep 29, 2019

I'd suggest that it does actually work, but the warning is invalid. Newer versions of clang (8, at least) don't display this warning. Would need to check the generated code to be sure, but none of our official binaries built using clang, and gcc doesn't use these "short" enums by default

src/error_gui.cpp Outdated Show resolved Hide resolved
@LordAro LordAro force-pushed the LordAro:gcc9-warningfix branch from 5912d47 to d82a512 Sep 29, 2019
@LordAro LordAro merged commit 3cc6b7f into OpenTTD:master Sep 30, 2019
8 checks passed
8 checks passed
OpenTTD CI Build #20190929.4 succeeded
Details
OpenTTD CI (Linux commit-checker) Linux commit-checker succeeded
Details
OpenTTD CI (Linux linux-amd64-clang-3.9) Linux linux-amd64-clang-3.9 succeeded
Details
OpenTTD CI (Linux linux-amd64-gcc-6) Linux linux-amd64-gcc-6 succeeded
Details
OpenTTD CI (Linux linux-i386-gcc-6) Linux linux-i386-gcc-6 succeeded
Details
OpenTTD CI (MacOS) MacOS succeeded
Details
OpenTTD CI (Windows Win32) Windows Win32 succeeded
Details
OpenTTD CI (Windows Win64) Windows Win64 succeeded
Details
@LordAro LordAro deleted the LordAro:gcc9-warningfix branch Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.