Add a FALL_THROUGH macro to compiler.h

Older gcc's don't support `__attribute__ ((fallthrough))`
(see https://sourceforge.net/u/begasus/tuxpaint/ci/e5c3cdfcf5e16a9b0fc3e7766bfea1d9c326b3ae/
"Haiku Fixes" by Luc), so adding a new macro to compiler.h
that is defined as "((void)0)" on older compilers.
This commit is contained in:
Bill Kendrick 2019-09-12 20:27:03 -07:00
parent e5c3cdfcf5
commit df49986fab
2 changed files with 21 additions and 12 deletions

View file

@ -45,7 +45,6 @@
#include "im.h"
/* ***************************************************************************
* I18N GETTEXT
*/
@ -905,12 +904,12 @@ static int im_event_zh_tw(IM_DATA * im, SDL_keysym ks)
case IM_REQ_FREE: /* Free allocated resources */
charmap_free(&cm);
// // __attribute__ ((fallthrough)); /* go onto full reset */
FALL_THROUGH; /* go onto full reset */
case IM_REQ_RESET_FULL: /* Full reset */
cm.section = SEC_ENGLISH;
im->tip_text = im_tip_text[IM_TIP_ENGLISH];
// __attribute__ ((fallthrough)); /* go onto soft reset */
FALL_THROUGH; /* go onto soft reset */
case IM_REQ_RESET_SOFT: /* Soft reset */
im->s[0] = L'\0';
@ -1124,12 +1123,12 @@ static int im_event_th(IM_DATA * im, SDL_keysym ks)
case IM_REQ_FREE: /* Free allocated resources */
charmap_free(&cm);
// __attribute__ ((fallthrough)); /* go onto full reset */
FALL_THROUGH; /* go onto full reset */
case IM_REQ_RESET_FULL: /* Full reset */
cm.section = SEC_ENGLISH;
im->tip_text = im_tip_text[IM_TIP_ENGLISH];
// __attribute__ ((fallthrough)); /* go onto soft reset */
FALL_THROUGH; /* go onto soft reset */
case IM_REQ_RESET_SOFT: /* Soft reset */
im->s[0] = L'\0';
@ -1343,12 +1342,12 @@ static int im_event_ja(IM_DATA * im, SDL_keysym ks)
case IM_REQ_FREE: /* Free allocated resources */
charmap_free(&cm);
// __attribute__ ((fallthrough)); /* go onto full reset */
FALL_THROUGH; /* go onto full reset */
case IM_REQ_RESET_FULL: /* Full reset */
cm.section = SEC_ENGLISH;
im->tip_text = im_tip_text[IM_TIP_ENGLISH];
// __attribute__ ((fallthrough)); /* go onto soft reset */
FALL_THROUGH; /* go onto soft reset */
case IM_REQ_RESET_SOFT: /* Soft reset */
im->s[0] = L'\0';
@ -1590,12 +1589,12 @@ static int im_event_ko(IM_DATA * im, SDL_keysym ks)
case IM_REQ_FREE: /* Free allocated resources */
charmap_free(&cm);
// __attribute__ ((fallthrough)); /* go onto full reset */
FALL_THROUGH; /* go onto full reset */
case IM_REQ_RESET_FULL: /* Full reset */
cm.section = SEC_ENGLISH;
im->tip_text = im_tip_text[IM_TIP_ENGLISH];
// __attribute__ ((fallthrough)); /* go onto soft reset */
FALL_THROUGH; /* go onto soft reset */
case IM_REQ_RESET_SOFT: /* Soft reset */
im->s[0] = L'\0';
@ -1681,7 +1680,7 @@ static int im_event_ko(IM_DATA * im, SDL_keysym ks)
im->redraw--;
ks.unicode = L'\0';
}
// __attribute__ ((fallthrough)); /* continue processing: */
FALL_THROUGH; /* continue processing: */
/* Actual character processing */
default: