mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
macros: add G_GNUC_CHECK_VERSION() for compiler checks.
https://bugzilla.gnome.org/show_bug.cgi?id=728099
This commit is contained in:
parent
21b1c390a3
commit
3272267b99
@ -407,6 +407,7 @@ G_STATIC_ASSERT
|
||||
G_STATIC_ASSERT_EXPR
|
||||
|
||||
<SUBSECTION>
|
||||
G_GNUC_CHECK_VERSION
|
||||
G_GNUC_EXTENSION
|
||||
G_GNUC_CONST
|
||||
G_GNUC_PURE
|
||||
|
15
glib/docs.c
15
glib/docs.c
@ -1995,6 +1995,21 @@
|
||||
* with the `-pedantic` option.
|
||||
*/
|
||||
|
||||
/**
|
||||
* G_GNUC_CHECK_VERSION:
|
||||
*
|
||||
* Expands to a a check for a compiler with __GNUC__ defined and a version
|
||||
* greater than or equal to the major and minor numbers provided. For example,
|
||||
* the following would only match on compilers such as GCC 4.8 or newer.
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* #if G_GNUC_CHECK_VERSION(4, 8)
|
||||
* #endif
|
||||
* ]|
|
||||
*
|
||||
* Since: 2.42
|
||||
*/
|
||||
|
||||
/**
|
||||
* G_GNUC_CONST:
|
||||
*
|
||||
|
@ -37,6 +37,12 @@
|
||||
*/
|
||||
#include <stddef.h>
|
||||
|
||||
#define G_GNUC_CHECK_VERSION(major, minor) \
|
||||
(defined(__GNUC__) && \
|
||||
((__GNUC__ > (major)) || \
|
||||
((__GNUC__ == (major)) && \
|
||||
(__GNUC_MINOR__ >= (minor)))))
|
||||
|
||||
/* Here we provide G_GNUC_EXTENSION as an alias for __extension__,
|
||||
* where this is valid. This allows for warningless compilation of
|
||||
* "long long" types even in the presence of '-ansi -pedantic'.
|
||||
|
Loading…
Reference in New Issue
Block a user