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

Get rid of compiler warnings #4

Open
CeRiAl opened this issue Jun 25, 2020 · 3 comments
Open

Get rid of compiler warnings #4

CeRiAl opened this issue Jun 25, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@CeRiAl
Copy link
Owner

CeRiAl commented Jun 25, 2020

Improve code to get rid of compiler warnings.

@CeRiAl CeRiAl added the enhancement New feature or request label Jun 25, 2020
@CeRiAl CeRiAl self-assigned this Jun 25, 2020
@CeRiAl
Copy link
Owner Author

CeRiAl commented Jun 25, 2020

Added commits:
4d3217f
c5e6299
4b5cc17
70ef5e1
6b497ab
e10b2a3
9cc93f4

These fix most of the warnings.

Still we have these:

/home/runner/work/freesynd/freesynd/src/sound/xmidi.cpp: In member function ‘uint32 XMidi::convertListToMTrk(unsigned char*, const XMidi::midi_event*)’:
/home/runner/work/freesynd/freesynd/src/sound/xmidi.cpp:516:9: warning: variable ‘i_start’ set but not used [-Wunused-but-set-variable]
     int i_start;
         ^~~~~~~
/home/runner/work/freesynd/freesynd/src/sound/xmidi.cpp: In static member function ‘static bool XMidi::handleChunkXMID(XMidi::XMidiFile*, const unsigned char*, uint32)’:
/home/runner/work/freesynd/freesynd/src/sound/xmidi.cpp:728:7: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
     } else
       ^~~~
/home/runner/work/freesynd/freesynd/src/sound/xmidi.cpp:737:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         if (!result) {
         ^~

and

/home/runner/work/freesynd/freesynd/src/system_sdl.cpp: In member function ‘virtual bool SystemSDL::pumpEvents(FS_Event*)’:
/home/runner/work/freesynd/freesynd/src/system_sdl.cpp:292:52: warning: enum constant in boolean context [-Wint-in-bool-context]
                     keyModState_ = keyModState_ & !KMD_RSHIFT;
                                                    ^~~~~~~~~~
/home/runner/work/freesynd/freesynd/src/system_sdl.cpp:298:52: warning: enum constant in boolean context [-Wint-in-bool-context]
                     keyModState_ = keyModState_ & !KMD_RCTRL;
                                                    ^~~~~~~~~
/home/runner/work/freesynd/freesynd/src/system_sdl.cpp:301:52: warning: enum constant in boolean context [-Wint-in-bool-context]
                     keyModState_ = keyModState_ & !KMD_LCTRL;
                                                    ^~~~~~~~~
/home/runner/work/freesynd/freesynd/src/system_sdl.cpp:304:52: warning: enum constant in boolean context [-Wint-in-bool-context]
                     keyModState_ = keyModState_ & !KMD_RALT;
                                                    ^~~~~~~~
/home/runner/work/freesynd/freesynd/src/system_sdl.cpp:307:52: warning: enum constant in boolean context [-Wint-in-bool-context]
                     keyModState_ = keyModState_ & !KMD_LALT;
                                                    ^~~~~~~~

@CeRiAl
Copy link
Owner Author

CeRiAl commented Jun 25, 2020

Added commits:
8d56e39
fb2d32a

These commits fix these warnings:

/home/runner/work/freesynd/freesynd/src/sound/xmidi.cpp: In member function ‘uint32 XMidi::convertListToMTrk(unsigned char*, const XMidi::midi_event*)’:
/home/runner/work/freesynd/freesynd/src/sound/xmidi.cpp:516:9: warning: variable ‘i_start’ set but not used [-Wunused-but-set-variable]
     int i_start;
         ^~~~~~~
/home/runner/work/freesynd/freesynd/src/sound/xmidi.cpp: In static member function ‘static bool XMidi::handleChunkXMID(XMidi::XMidiFile*, const unsigned char*, uint32)’:
/home/runner/work/freesynd/freesynd/src/sound/xmidi.cpp:728:7: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
     } else
       ^~~~
/home/runner/work/freesynd/freesynd/src/sound/xmidi.cpp:737:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
         if (!result) {
         ^~

Still, we have these few left:

/home/runner/work/freesynd/freesynd/src/system_sdl.cpp: In member function ‘virtual bool SystemSDL::pumpEvents(FS_Event*)’:
/home/runner/work/freesynd/freesynd/src/system_sdl.cpp:292:52: warning: enum constant in boolean context [-Wint-in-bool-context]
                     keyModState_ = keyModState_ & !KMD_RSHIFT;
                                                    ^~~~~~~~~~
/home/runner/work/freesynd/freesynd/src/system_sdl.cpp:298:52: warning: enum constant in boolean context [-Wint-in-bool-context]
                     keyModState_ = keyModState_ & !KMD_RCTRL;
                                                    ^~~~~~~~~
/home/runner/work/freesynd/freesynd/src/system_sdl.cpp:301:52: warning: enum constant in boolean context [-Wint-in-bool-context]
                     keyModState_ = keyModState_ & !KMD_LCTRL;
                                                    ^~~~~~~~~
/home/runner/work/freesynd/freesynd/src/system_sdl.cpp:304:52: warning: enum constant in boolean context [-Wint-in-bool-context]
                     keyModState_ = keyModState_ & !KMD_RALT;
                                                    ^~~~~~~~
/home/runner/work/freesynd/freesynd/src/system_sdl.cpp:307:52: warning: enum constant in boolean context [-Wint-in-bool-context]
                     keyModState_ = keyModState_ & !KMD_LALT;
                                                    ^~~~~~~~

@misutoneko
Copy link

The remaining warnings can be eliminated by adding parenthesis, like so:

keyModState_ = keyModState_ & !(KMD_RSHIFT);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants