From 725da6307e33b612b3f1bb7bca15fe154f8ffc35 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Wed, 17 Oct 2018 16:42:54 +0200 Subject: [PATCH] Remove warnings with GCC 7 GCC 7 introduced a new warning in switch() statements : warning: this statement may fall through [-Wimplicit-fallthrough=] --- src/buttons_effects.c | 2 +- src/fileformats.c | 3 +++ src/help.c | 1 + src/main.c | 3 +++ src/transform.c | 3 +++ src/windows.c | 6 ++++++ 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/buttons_effects.c b/src/buttons_effects.c index d8c8e895..c6b045e0 100644 --- a/src/buttons_effects.c +++ b/src/buttons_effects.c @@ -538,7 +538,7 @@ void Button_Grid_menu(void) Window_input_content(input_dy_button,str); Display_cursor(); - + break; case 7: snapgrid = !snapgrid; Hide_cursor(); diff --git a/src/fileformats.c b/src/fileformats.c index c69eb373..71be70a1 100644 --- a/src/fileformats.c +++ b/src/fileformats.c @@ -2222,6 +2222,9 @@ void Save_IFF(T_IO_Context * context) break; case PIXEL_TALL3: // 3:4 header.X_aspect = (header.X_aspect * 15) / 10; // *1.5 +#if defined(__GNUC__) && (__GNUC__ >= 7) + __attribute__ ((fallthrough)); +#endif case PIXEL_TALL: case PIXEL_TALL2: header.Y_aspect *= 2; // 1:2 diff --git a/src/help.c b/src/help.c index 8291aa12..a96edc36 100644 --- a/src/help.c +++ b/src/help.c @@ -235,6 +235,7 @@ void Window_set_shortcut(int action_id) case 1: // Cancel shortcut_ptr[0]=backup_shortcut[0]; shortcut_ptr[1]=backup_shortcut[1]; + break; case 2: // OK // Replace twice by single if (shortcut_ptr[0]==shortcut_ptr[1]) diff --git a/src/main.c b/src/main.c index e72844c3..b805c857 100644 --- a/src/main.c +++ b/src/main.c @@ -1146,6 +1146,9 @@ int Init_program(int argc,char * argv[]) Button_Page(BUTTON_PAGE); // no break ! proceed with the other file now +#if defined(__GNUC__) && (__GNUC__ >= 7) + __attribute__ ((fallthrough)); +#endif case 1: Init_context_layered_image(&context, main_filename, main_directory); if (Get_Unicode_Filename(filename_unicode, main_filename, main_directory)) diff --git a/src/transform.c b/src/transform.c index 97297840..4963a2e8 100644 --- a/src/transform.c +++ b/src/transform.c @@ -267,6 +267,9 @@ void Button_Transform_menu(int btn) // "Old" values are not editable, unless the unit is "ratio" if (unit_index!=UNIT_RATIO) break; +#if defined(__GNUC__) && (__GNUC__ >= 7) + __attribute__ ((fallthrough)); +#endif case 10: // input new width case 12: // input new height Num2str(*( input_value[clicked_button-10]),buffer,4); diff --git a/src/windows.c b/src/windows.c index 2846b48b..9eae98d4 100644 --- a/src/windows.c +++ b/src/windows.c @@ -2418,6 +2418,9 @@ void Display_cursor(void) case CURSOR_SHAPE_BUCKET : if (Cursor_hidden) break; +#if defined(__GNUC__) && (__GNUC__ >= 7) + __attribute__ ((fallthrough)); +#endif case CURSOR_SHAPE_ARROW : case CURSOR_SHAPE_HOURGLASS : @@ -2717,6 +2720,9 @@ void Hide_cursor(void) case CURSOR_SHAPE_BUCKET : if (Cursor_hidden) break; +#if defined(__GNUC__) && (__GNUC__ >= 7) + __attribute__ ((fallthrough)); +#endif case CURSOR_SHAPE_ARROW : case CURSOR_SHAPE_HOURGLASS :