gmacros: Use __typeof__ when compiling with Clang

Just like gcc, clang has supported `__typeof__` for a long time, so
allow it to be used. This fixes compilation of `gio/gcredentials.c` on
macOS (which uses clang by default).

I don’t know which version clang started supporting `__typeof__` in, so
there’s no version check. One can be added in future if there are
problems.

This fixes commit 5b2bee3f53.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2020-10-21 11:32:32 +01:00
parent b67185cd92
commit dce24dc449

View File

@ -232,7 +232,9 @@
* This symbol is private.
*/
#undef glib_typeof
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) && !defined(__cplusplus)
#if !defined(__cplusplus) && \
((defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) || \
defined(__clang__))
#define glib_typeof(t) __typeof__ (t)
#endif