Skip to content

Commit 547e5f0

Browse files
committed
Fix compiling with debug flag
1 parent cf7998a commit 547e5f0

5 files changed

Lines changed: 12 additions & 11 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ cmake-build-debug/
99
CMakeLists.txt
1010
*.wms
1111
*.zip
12+
docs/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ INCLUDES := source
2828
#-------------------------------------------------------------------------------
2929
# options for code generation
3030
#-------------------------------------------------------------------------------
31-
CFLAGS := -Wall -Wextra -O2 -ffunction-sections\
31+
CFLAGS := -Wall -Wextra -Werror -Os -ffunction-sections\
3232
$(MACHDEP)
3333

3434
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__

source/ButtonComboInfo.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ bool ButtonComboInfoIF::getMetaOptions(const ButtonComboModule_MetaOptionsOut &o
4242

4343
void ButtonComboInfoIF::setMetaOptions(const ButtonComboModule_MetaOptions options) {
4444
mLabel = options.label;
45-
DEBUG_FUNCTION_LINE("Updated label to: \"%s\", for %08X", mLabel.c_str(), getHandle().handle);
45+
DEBUG_FUNCTION_LINE("Updated label to: \"%s\", for %p", mLabel.c_str(), getHandle().handle);
4646
}
4747

4848
ButtonComboModule_CallbackOptions ButtonComboInfoIF::getCallbackOptions() const {
@@ -52,15 +52,15 @@ ButtonComboModule_CallbackOptions ButtonComboInfoIF::getCallbackOptions() const
5252
void ButtonComboInfoIF::setCallbackOptions(const ButtonComboModule_CallbackOptions options) {
5353
mCallback = options.callback;
5454
mContext = options.context;
55-
DEBUG_FUNCTION_LINE("Updated callback to: %08X(%08X), for %s %08X", mCallback, mContext, mLabel.c_str(), getHandle().handle);
55+
DEBUG_FUNCTION_LINE("Updated callback to: %p(%p), for %s handle: %p", mCallback, mContext, mLabel.c_str(), getHandle().handle);
5656
}
5757

5858
uint32_t ButtonComboInfoIF::getCombo() const {
5959
return mCombo;
6060
}
6161
void ButtonComboInfoIF::setCombo(const ButtonComboModule_Buttons combo) {
6262
mCombo = combo;
63-
DEBUG_FUNCTION_LINE("Updated combo to: %08X, for %s %08X", mCombo, mLabel.c_str(), getHandle().handle);
63+
DEBUG_FUNCTION_LINE("Updated combo to: %08X, for %s handle: %p", mCombo, mLabel.c_str(), getHandle().handle);
6464
resetPrevInput();
6565
}
6666

@@ -70,7 +70,7 @@ ButtonComboModule_ComboStatus ButtonComboInfoIF::getStatus() const {
7070

7171
void ButtonComboInfoIF::setStatus(const ButtonComboModule_ComboStatus status) {
7272
mStatus = status;
73-
DEBUG_FUNCTION_LINE("Updated status to: %08X, for %s %08X", mStatus, mLabel.c_str(), getHandle().handle);
73+
DEBUG_FUNCTION_LINE("Updated status to: %08X, for %s handle: %p", mStatus, mLabel.c_str(), getHandle().handle);
7474
}
7575

7676
ButtonComboModule_ControllerTypes ButtonComboInfoIF::getControllerMask() const {
@@ -79,7 +79,7 @@ ButtonComboModule_ControllerTypes ButtonComboInfoIF::getControllerMask() const {
7979

8080
void ButtonComboInfoIF::setControllerMask(const ButtonComboModule_ControllerTypes mask) {
8181
mControllerMask = mask;
82-
DEBUG_FUNCTION_LINE("Updated controllerMask to: %08X, for %s %08X", mControllerMask, mLabel.c_str(), getHandle().handle);
82+
DEBUG_FUNCTION_LINE("Updated controllerMask to: %08X, for %s handle: %p", mControllerMask, mLabel.c_str(), getHandle().handle);
8383
resetPrevInput();
8484
}
8585

source/ButtonComboInfoDown.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void ButtonComboInfoDown::UpdateInput(
3030

3131
auto &[prevButtonCombo] = mHoldInformation[chanIndex];
3232

33-
DEBUG_FUNCTION_LINE_VERBOSE("[PRESS DOWN] Check button combo %08X on controller %08X (lastItem im pressedButtons (size %d) is %08X) for %s [%08X]", mCombo, controller, pressedButtons.size(), pressedButtons.back(), mLabel.c_str(), getHandle().handle);
33+
DEBUG_FUNCTION_LINE_VERBOSE("[PRESS DOWN] Check button combo %08X on controller %08X (lastItem im pressedButtons (size %d) is %08X) for %s [%p]", mCombo, controller, pressedButtons.size(), pressedButtons.back(), mLabel.c_str(), getHandle().handle);
3434

3535
for (const auto &pressedButton : pressedButtons) {
3636
const bool prevButtonsIncludedCombo = (prevButtonCombo & mCombo) == mCombo; // Make sure the combo can't be triggered on releasing
@@ -39,7 +39,7 @@ void ButtonComboInfoDown::UpdateInput(
3939

4040
if (buttonsPressedChanged && buttonsPressedMatchCombo && !prevButtonsIncludedCombo) {
4141
if (mCallback != nullptr) {
42-
DEBUG_FUNCTION_LINE("Calling callback [%08X](controller: %08X, context: %08X) for \"%s\" [handle: %08X], pressed down %08X", mCallback, controller, mContext, mLabel.c_str(), getHandle().handle, mCombo);
42+
DEBUG_FUNCTION_LINE("Calling callback [%p](controller: %08X, context: %p) for \"%s\" [handle: %p], pressed down %08X", mCallback, controller, mContext, mLabel.c_str(), getHandle().handle, mCombo);
4343
mCallback(controller, getHandle(), mContext);
4444
} else {
4545
DEBUG_FUNCTION_LINE_WARN("Callback was null for combo %p", getHandle().handle);

source/ButtonComboInfoHold.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void ButtonComboInfoHold::UpdateInput(const ButtonComboModule_ControllerTypes co
3535
auto &holdInformation = mHoldInformation[chanIndex];
3636
const auto latestButtonPress = pressedButtons.back();
3737

38-
DEBUG_FUNCTION_LINE_VERBOSE("[HOLD ] Check button combo %08X on controller %08X (lastItem im pressedButtons (size %d) is %08X) for %s [%08X]", mCombo, controller, pressedButtons.size(), latestButtonPress, mLabel.c_str(), getHandle().handle);
38+
DEBUG_FUNCTION_LINE_VERBOSE("[HOLD ] Check button combo %08X on controller %08X (lastItem im pressedButtons (size %d) is %08X) for %s [%p]", mCombo, controller, pressedButtons.size(), latestButtonPress, mLabel.c_str(), getHandle().handle);
3939

4040
const bool prevButtonsIncludedCombo = (holdInformation.prevButtonCombo & mCombo) == mCombo; // Make sure the combo can't be triggered on releasing
4141
const bool buttonsPressedChanged = holdInformation.prevButtonCombo != latestButtonPress; // Avoid "holding" the combo
@@ -51,7 +51,7 @@ void ButtonComboInfoHold::UpdateInput(const ButtonComboModule_ControllerTypes co
5151

5252
if (intervalInMs > mTargetDurationInMs && !holdInformation.callbackTriggered) {
5353
if (mCallback != nullptr) {
54-
DEBUG_FUNCTION_LINE("Calling callback [%08X](controller: %08X context: %08X) for \"%s\" [handle: %08X], hold %08X for %d ms", mCallback, controller, mContext, mLabel.c_str(), getHandle().handle, mCombo, intervalInMs);
54+
DEBUG_FUNCTION_LINE("Calling callback [%p](controller: %08X context: %p) for \"%s\" [handle: %p], hold %08X for %d ms", mCallback, controller, mContext, mLabel.c_str(), getHandle().handle, mCombo, intervalInMs);
5555
mCallback(controller, getHandle(), mContext);
5656

5757
} else {
@@ -66,7 +66,7 @@ void ButtonComboInfoHold::UpdateInput(const ButtonComboModule_ControllerTypes co
6666
}
6767

6868
ButtonComboModule_Error ButtonComboInfoHold::setHoldDuration(const uint32_t holdDurationInMs) {
69-
DEBUG_FUNCTION_LINE("Setting holdDurationInMs to %d for %s [%08X]", holdDurationInMs, mLabel.c_str(), getHandle().handle);
69+
DEBUG_FUNCTION_LINE("Setting holdDurationInMs to %d for %s [%p]", holdDurationInMs, mLabel.c_str(), getHandle().handle);
7070
mTargetDurationInMs = holdDurationInMs;
7171
return BUTTON_COMBO_MODULE_ERROR_SUCCESS;
7272
}

0 commit comments

Comments
 (0)