After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 752272 - _CLUTTER_DEPRECATED_MACRO_FOR is not defined when not compiling with gcc
_CLUTTER_DEPRECATED_MACRO_FOR is not defined when not compiling with gcc
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: general
git master
Other FreeBSD
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2015-07-11 18:17 UTC by Ting-Wei Lan
Modified: 2015-07-13 18:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
macros: Add fallback defines for non-GCC compilers (1.05 KB, patch)
2015-07-11 22:59 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review
macros: Clang 3.4 and later versions can use deprecation macros for GCC (1.01 KB, patch)
2015-07-12 06:38 UTC, Ting-Wei Lan
committed Details | Review

Description Ting-Wei Lan 2015-07-11 18:17:41 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.
Comment 1 Emmanuele Bassi (:ebassi) 2015-07-11 22:59:56 UTC
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 2 Emmanuele Bassi (:ebassi) 2015-07-11 23:04:51 UTC
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.
Comment 3 Ting-Wei Lan 2015-07-12 06:38:31 UTC
Created attachment 307304 [details] [review]
macros: Clang 3.4 and later versions can use deprecation macros for GCC
Comment 4 Emmanuele Bassi (:ebassi) 2015-07-13 12:19:29 UTC
Review of attachment 307304 [details] [review]:

Looks good.
Comment 5 Ting-Wei Lan 2015-07-13 18:43:45 UTC
Attachment 307304 [details] pushed as ad690c6 - macros: Clang 3.4 and later versions can use deprecation macros for GCC