Remove fall-through pragmas

This commit is contained in:
Krzysiek Egzmont 2023-10-16 16:52:32 +02:00
parent d3a2a7bee9
commit a26c397417
10 changed files with 21 additions and 73 deletions

View File

@ -209,7 +209,7 @@ endif
#CFLAGS += -Wpadded
# catch any and all warnings
#CFLAGS += -Wextra
CFLAGS += -Wextra
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"

View File

@ -650,9 +650,6 @@ static void MR_NextChannel(void)
if (enabled)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gCurrentScanList)
{
case SCAN_NEXT_CHAN_SCANLIST1:
@ -667,7 +664,7 @@ static void MR_NextChannel(void)
break;
}
}
[[fallthrough]];
case SCAN_NEXT_CHAN_SCANLIST2:
if (chan2 >= 0)
{
@ -678,6 +675,7 @@ static void MR_NextChannel(void)
break;
}
}
[[fallthrough]];
// this bit doesn't yet work if the other VFO is a frequency
case SCAN_NEXT_CHAN_DUAL_WATCH:
@ -701,8 +699,6 @@ static void MR_NextChannel(void)
chan = 0xff;
break;
}
#pragma GCC diagnostic pop
}
if (!enabled || chan == 0xff)
@ -2229,7 +2225,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
}
}
if ((Key >= KEY_0 && Key <= KEY_9) || Key == KEY_F)
if (Key <= KEY_9 || Key == KEY_F)
{
if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
{ // FREQ/CTCSS/DCS scanning

View File

@ -356,13 +356,11 @@ void DTMF_HandleRequest(void)
gUpdateDisplay = true;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gEeprom.DTMF_DECODE_RESPONSE)
{
case DTMF_DEC_RESPONSE_BOTH:
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
[[fallthrough]];
case DTMF_DEC_RESPONSE_REPLY:
gDTMF_ReplyState = DTMF_REPLY_AAAAA;
break;
@ -376,8 +374,6 @@ void DTMF_HandleRequest(void)
break;
}
#pragma GCC diagnostic pop
if (gDTMF_IsGroupCall)
gDTMF_ReplyState = DTMF_REPLY_NONE;
}

View File

@ -403,11 +403,9 @@ void MENU_AcceptSetting(void)
gRequestSaveChannel = 1;
return;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
case MENU_T_CTCS:
pConfig = &gTxVfo->freq_config_TX;
[[fallthrough]];
case MENU_R_CTCS:
if (gSubMenuSelection == 0)
{
@ -434,8 +432,6 @@ void MENU_AcceptSetting(void)
gRequestSaveChannel = 1;
return;
#pragma GCC diagnostic pop
case MENU_SFT_D:
gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION = gSubMenuSelection;
gRequestSaveChannel = 1;
@ -1154,7 +1150,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (edit_index < 10)
{
if (Key >= KEY_0 && Key <= KEY_9)
if (Key <= KEY_9)
{
edit[edit_index] = '0' + Key - KEY_0;
@ -1177,9 +1173,6 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (!gIsInSubMenu)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gInputBoxIndex)
{
case 2:
@ -1199,7 +1192,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gInputBox[0] = gInputBox[1];
gInputBoxIndex = 1;
[[fallthrough]];
case 1:
Value = gInputBox[0];
if (Value > 0 && Value <= gMenuListCount)
@ -1211,8 +1204,6 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
break;
}
#pragma GCC diagnostic pop
gInputBoxIndex = 0;
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
@ -1653,9 +1644,6 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
VFO = 0;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (GetCurrentMenuId())
{
case MENU_DEL_CH:
@ -1666,6 +1654,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
case MENU_SLIST2:
VFO = 1;
[[fallthrough]];
case MENU_SLIST1:
bCheckScanList = true;
break;
@ -1676,8 +1665,6 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
return;
}
#pragma GCC diagnostic pop
Channel = RADIO_FindNextChannel(gSubMenuSelection + Direction, Direction, bCheckScanList, VFO);
if (Channel != 0xFF)
gSubMenuSelection = Channel;

View File

@ -142,9 +142,6 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
SYSTEM_DelayMs(60);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (Beep)
{
case BEEP_880HZ_60MS_TRIPLE_BEEP:
@ -152,14 +149,14 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
SYSTEM_DelayMs(60);
BK4819_EnterTxMute();
SYSTEM_DelayMs(20);
[[fallthrough]];
case BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL:
case BEEP_500HZ_60MS_DOUBLE_BEEP:
BK4819_ExitTxMute();
SYSTEM_DelayMs(60);
BK4819_EnterTxMute();
SYSTEM_DelayMs(20);
[[fallthrough]];
case BEEP_1KHZ_60MS_OPTIONAL:
BK4819_ExitTxMute();
Duration = 60;
@ -184,8 +181,6 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
break;
}
#pragma GCC diagnostic pop
SYSTEM_DelayMs(Duration);
BK4819_EnterTxMute();
SYSTEM_DelayMs(20);

12
radio.c
View File

@ -581,13 +581,11 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (Bandwidth)
{
default:
Bandwidth = BK4819_FILTER_BW_WIDE;
[[fallthrough]];
case BK4819_FILTER_BW_WIDE:
case BK4819_FILTER_BW_NARROW:
#ifdef ENABLE_AM_FIX
@ -599,8 +597,6 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
break;
}
#pragma GCC diagnostic pop
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
BK4819_SetupPowerAmplifier(0, 0);
@ -835,13 +831,11 @@ void RADIO_SetTxParameters(void)
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (Bandwidth)
{
default:
Bandwidth = BK4819_FILTER_BW_WIDE;
[[fallthrough]];
case BK4819_FILTER_BW_WIDE:
case BK4819_FILTER_BW_NARROW:
#ifdef ENABLE_AM_FIX
@ -853,8 +847,6 @@ void RADIO_SetTxParameters(void)
break;
}
#pragma GCC diagnostic pop
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
// TX compressor

View File

@ -29,7 +29,7 @@ void INPUTBOX_Append(const KEY_Code_t Digit)
if (gInputBoxIndex == 0)
memset(gInputBox, 10, sizeof(gInputBox));
if (Digit >= KEY_0 && Digit != KEY_INVALID)
if (Digit != KEY_INVALID)
gInputBox[gInputBoxIndex++] = (char)(Digit - KEY_0);
}

View File

@ -14,10 +14,6 @@
* limitations under the License.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
#pragma GCC diagnostic pop
#include <string.h>
#include <stdlib.h> // abs()
@ -46,23 +42,18 @@ center_line_t center_line = CENTER_LINE_NONE;
void UI_drawBars(uint8_t *p, const unsigned int level)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (level)
{
default:
case 7: memmove(p + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
case 6: memmove(p + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
case 5: memmove(p + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
case 4: memmove(p + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
case 3: memmove(p + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
case 2: memmove(p + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
case 7: memmove(p + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6)); [[fallthrough]];
case 6: memmove(p + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5)); [[fallthrough]];
case 5: memmove(p + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4)); [[fallthrough]];
case 4: memmove(p + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3)); [[fallthrough]];
case 3: memmove(p + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2)); [[fallthrough]];
case 2: memmove(p + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1)); [[fallthrough]];
case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna)); break;
case 0: memset( p + 0, 0, sizeof(BITMAP_Antenna)); break;
}
#pragma GCC diagnostic pop
}
#ifdef ENABLE_AUDIO_BAR
@ -501,8 +492,6 @@ void UI_DisplayMain(void)
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gEeprom.CHANNEL_DISPLAY_MODE)
{
@ -553,8 +542,6 @@ void UI_DisplayMain(void)
break;
}
#pragma GCC diagnostic pop
}
else
{ // frequency mode

View File

@ -434,9 +434,6 @@ void UI_DisplayMenu(void)
bool already_printed = false;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (GetCurrentMenuId())
{
case MENU_SQL:
@ -803,8 +800,6 @@ void UI_DisplayMenu(void)
}
}
#pragma GCC diagnostic pop
if (!already_printed)
{ // we now do multi-line text in a single string

View File

@ -142,7 +142,7 @@ void UI_DisplayStatus(const bool test_display)
x += sizeof(BITMAP_VOX) + 2;
#endif
x = MAX(x, 61);
x = MAX(x, 61u);
x1 = x;
// KEY-LOCK indicator