headers: define GS_HAS_DECLARED_PROPERTIES macro

To keep compatibility with compilers prior to Objective-C 2.0 support
(added in the GCC 4.6 series), we are unable to always declare @property
attributes in classes. However, compatibility with dot-syntax
applications require us to define properties if we can.

We already had some checks for the GS_HAS_DECLARED_PROPERTIES macro to
see whether we could or could not declare properties (or whether we
should fall back to manual getter/setter defining). However, it seems
this macro never got defined.

This commit adds this macro, checking whether we possess either GCC >=
4.6 or Clang.
This commit is contained in:
Daniel Ferreira 2017-06-29 00:19:04 +10:00 committed by Ivan Vučica
parent ef4929b2c2
commit 1e8c1d3855

View file

@ -446,4 +446,12 @@ static inline void gs_consumed(id NS_CONSUMED GS_UNUSED_ARG o) { return; }
# define GS_PROTOCOLS_HAVE_OPTIONAL 0
#endif
/* Check if compiler supports declared properties
*/
#if defined(__clang__) || GS_GCC_MINREQ(4,6)
# define GS_HAS_DECLARED_PROPERTIES 1
#else
# define GS_HAS_DECLARED_PROPERTIES 0
#endif
#endif /* __GNUSTEP_GSVERSIONMACROS_H_INCLUDED_ */