mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-25 08:36:52 +02:00
macros: make G_GNUC_CHECK_VERSION() portable
This removes the use of defined() in a macro expansion, which may not be portable to some pre-processors. Instead, we hoist the defined check outside the macro expansion. https://bugzilla.gnome.org/show_bug.cgi?id=790877
This commit is contained in:
parent
f5dba7d43c
commit
d44afbadda
@ -37,11 +37,14 @@
|
|||||||
*/
|
*/
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
#define G_GNUC_CHECK_VERSION(major, minor) \
|
#define G_GNUC_CHECK_VERSION(major, minor) \
|
||||||
(defined(__GNUC__) && \
|
|
||||||
((__GNUC__ > (major)) || \
|
((__GNUC__ > (major)) || \
|
||||||
((__GNUC__ == (major)) && \
|
((__GNUC__ == (major)) && \
|
||||||
(__GNUC_MINOR__ >= (minor)))))
|
(__GNUC_MINOR__ >= (minor))))
|
||||||
|
#else
|
||||||
|
#define G_GNUC_CHECK_VERSION(major, minor) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Here we provide G_GNUC_EXTENSION as an alias for __extension__,
|
/* Here we provide G_GNUC_EXTENSION as an alias for __extension__,
|
||||||
* where this is valid. This allows for warningless compilation of
|
* where this is valid. This allows for warningless compilation of
|
||||||
|
Loading…
x
Reference in New Issue
Block a user