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 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 gcc9-warningfix branch 2 times, most recently from c9d285d to ec4c4ac Jun 29, 2019
@LordAro
Copy link
Member Author

@LordAro LordAro commented Jun 29, 2019

clang build now relies on OpenTTD/CompileFarm#37

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

@nikolas nikolas commented Aug 29, 2019

👍 looks good on my gcc 9.2.1 on Debian.

src/vehicle_cmd.cpp Show resolved Hide resolved
Copy link
Contributor

@glx22 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 {
Copy link
Contributor

@glx22 glx22 Sep 28, 2019

Choose a reason for hiding this comment

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

doesn't work :(

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

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

@glx22 glx22 Sep 28, 2019

Choose a reason for hiding this comment

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

doesn't work :(

@LordAro
Copy link
Member Author

@LordAro 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 gcc9-warningfix branch from 5912d47 to d82a512 Sep 29, 2019
@LordAro LordAro merged commit 3cc6b7f into OpenTTD:master Sep 30, 2019
8 checks passed
@LordAro LordAro deleted the gcc9-warningfix branch Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants