-
-
Notifications
You must be signed in to change notification settings - Fork 928
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
Fix warnings from GCC9 #7630
Conversation
c9d285d
to
ec4c4ac
Compare
clang build now relies on OpenTTD/CompileFarm#37 |
8cc3633
to
3bbcdb8
Compare
3bbcdb8
to
4cc611c
Compare
👍 looks good on my gcc 9.2.1 on Debian. |
4cc611c
to
e476f2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't work :(
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 |
…or (fixes warning from clang)
5912d47
to
d82a512
Compare
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