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: clang and MSVC warnings #7681

Closed
wants to merge 1 commit into from

Conversation

@glx22
Copy link
Contributor

commented Aug 5, 2019

Fixes these clang warnings

/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)) {                                           \
              ^~~~~~~~~
/home/vsts/work/1/s/src/town_gui.cpp:951:15: warning: 'OnEditboxChanged' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void OnEditboxChanged(int wid)
                     ^
/home/vsts/work/1/s/src/widgets/../window_gui.h:733:15: note: overridden virtual function is here
        virtual void OnEditboxChanged(int widget) {}

and this MSVC 64bit warning

     2>d:\a\1\s\src\town_gui.cpp(996): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data [d:\a\1\s\projects\openttd_vs141.vcxproj]
src/script/api/script_goal.cpp Outdated Show resolved Hide resolved
src/town_gui.cpp Show resolved Hide resolved
@LordAro LordAro force-pushed the glx22:warnings branch 2 times, most recently from 692efdc to 2b1055b Sep 7, 2019
@LordAro LordAro force-pushed the glx22:warnings branch from 2b1055b to ec664c6 Sep 7, 2019
@glx22

This comment has been minimized.

Copy link
Contributor Author

commented Sep 7, 2019

clang warning is back :(

@LordAro

This comment has been minimized.

Copy link
Member

commented Sep 7, 2019

That's disappointing. No such warning for me locally with clang-8. Assume it's a clang-3.8 issue and it'll all go away when moving to 3.9 in #7630 ?

@LordAro

This comment has been minimized.

Copy link
Member

commented Sep 19, 2019

Still no luck with removing the warning with the enum size with clang-3.9. I've merged this commit into my PR now, so I'll close this one in favour of it regardless

@LordAro LordAro closed this Sep 19, 2019
@glx22 glx22 deleted the glx22:warnings branch Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.