GNOME Bugzilla – Bug 752272
_CLUTTER_DEPRECATED_MACRO_FOR is not defined when not compiling with gcc
Last modified: 2015-07-13 18:43:49 UTC
An implicit declaration warning is showed when compiling mutter with clang. This also causes other error because clang thinks _CLUTTER_DEPRECATED_MACRO_FOR is a function. default.c:692:7: warning: implicit declaration of function '_CLUTTER_DEPRECATED_MACRO_FOR' is invalid in C99 [-Wimplicit-function-declaration] if (CLUTTER_ACTOR_IS_VISIBLE (preview->actor) ^ /home/lantw44/gnome/devinstall/include/clutter-1.0/clutter/clutter-actor.h:91:3: note: expanded from macro 'CLUTTER_ACTOR_IS_VISIBLE' CLUTTER_MACRO_DEPRECATED_IN_1_24_FOR ("Deprecated macro. Use clutter_actor_is_visible instead") \ ^ /home/lantw44/gnome/devinstall/include/clutter-1.0/clutter/clutter-macros.h:355:50: note: expanded from macro 'CLUTTER_MACRO_DEPRECATED_IN_1_24_FOR' # define CLUTTER_MACRO_DEPRECATED_IN_1_24_FOR(f) CLUTTER_DEPRECATED_MACRO_FOR(f) ^ /home/lantw44/gnome/devinstall/include/clutter-1.0/clutter/clutter-macros.h:122:41: note: expanded from macro 'CLUTTER_DEPRECATED_MACRO_FOR' #define CLUTTER_DEPRECATED_MACRO_FOR(f) _CLUTTER_DEPRECATED_MACRO_FOR(f) ^ A simple fix for clang may be -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __clang__ because clang supports GCC warning pragma, but I think we still need to add some code to prevent error when using a compiler that is not gcc or clang.
Created attachment 307302 [details] [review] macros: Add fallback defines for non-GCC compilers I forgot to add the fallback definitions in case we're not using GCC; without them, anybody using non-GCC compilers will get a build error.
Comment on attachment 307302 [details] [review] macros: Add fallback defines for non-GCC compilers Attachment 307302 [details] pushed as 332aa3c - macros: Add fallback defines for non-GCC compilers I pushed the patch to fix the compilation on non-GCC compilers, but I'll keep open the bug for a (tested) clang version. Adding __clang__ is fine by me.
Created attachment 307304 [details] [review] macros: Clang 3.4 and later versions can use deprecation macros for GCC
Review of attachment 307304 [details] [review]: Looks good.
Attachment 307304 [details] pushed as ad690c6 - macros: Clang 3.4 and later versions can use deprecation macros for GCC