mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-22 08:58:54 +02:00
macros: Add G_GNUC_FALLTHROUGH
Expands to the GNU C fallthrough statement attribute if the compiler is gcc. This allows declaring case statement to explicitly fall through in switch statements. To enable this feature, use -Wimplicit-fallthrough during compilation.
This commit is contained in:
@@ -438,6 +438,7 @@ G_GNUC_DEPRECATED_FOR
|
|||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
G_GNUC_NORETURN
|
G_GNUC_NORETURN
|
||||||
|
G_GNUC_FALLTHROUGH
|
||||||
G_GNUC_UNUSED
|
G_GNUC_UNUSED
|
||||||
G_GNUC_PRINTF
|
G_GNUC_PRINTF
|
||||||
G_GNUC_SCANF
|
G_GNUC_SCANF
|
||||||
|
16
glib/docs.c
16
glib/docs.c
@@ -2280,6 +2280,22 @@
|
|||||||
* See the GNU C documentation for more details.
|
* See the GNU C documentation for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* G_GNUC_FALLTHROUGH:
|
||||||
|
*
|
||||||
|
* Expands to the GNU C fallthrough statement attribute if the compiler is gcc.
|
||||||
|
* This allows declaring case statement to explicitly fall through in switch
|
||||||
|
* statements. To enable this feature, use -Wimplicit-fallthrough during
|
||||||
|
* compilation.
|
||||||
|
*
|
||||||
|
* Put the attribute right before the case statement you want to fall through
|
||||||
|
* to.
|
||||||
|
*
|
||||||
|
* See the GNU C documentation for more details.
|
||||||
|
*
|
||||||
|
* Since: 2.60
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* G_GNUC_UNUSED:
|
* G_GNUC_UNUSED:
|
||||||
*
|
*
|
||||||
|
@@ -191,6 +191,12 @@
|
|||||||
#define G_GNUC_NO_INSTRUMENT
|
#define G_GNUC_NO_INSTRUMENT
|
||||||
#endif /* !__GNUC__ */
|
#endif /* !__GNUC__ */
|
||||||
|
|
||||||
|
#if __GNUC__ > 6
|
||||||
|
#define G_GNUC_FALLTHROUGH __attribute__((fallthrough))
|
||||||
|
#else
|
||||||
|
#define G_GNUC_FALLTHROUGH
|
||||||
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||||
#define G_GNUC_DEPRECATED __attribute__((__deprecated__))
|
#define G_GNUC_DEPRECATED __attribute__((__deprecated__))
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user