mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
add gcc version checks for attribute macros
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36257 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
10d0553bd5
commit
c787ce0957
1 changed files with 34 additions and 16 deletions
|
@ -196,27 +196,30 @@
|
||||||
|
|
||||||
/* Attribute definitions for attributes which may or may not be supported
|
/* Attribute definitions for attributes which may or may not be supported
|
||||||
* depending on the compiler being used.
|
* depending on the compiler being used.
|
||||||
|
* NB we currently expect gcc to be version 4 or later.
|
||||||
|
*
|
||||||
* The definition should be of the form GS_XXX_CONTEXT where XXX is the
|
* The definition should be of the form GS_XXX_CONTEXT where XXX is the
|
||||||
* name of the attribute and CONTEXT is one of FUNC, METH, or IVAR
|
* name of the attribute and CONTEXT is one of FUNC, METH, or IVAR
|
||||||
* depending on where the attribute can be applied.
|
* depending on where the attribute can be applied.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
|
#if __GNUC__*10+__GNUC_MINOR__ >= 31
|
||||||
# define GS_DEPRECATED_FUNC __attribute__ ((deprecated))
|
# define GS_DEPRECATED_FUNC __attribute__ ((deprecated))
|
||||||
#else
|
#else
|
||||||
# define GS_DEPRECATED_FUNC
|
# define GS_DEPRECATED_FUNC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __clang__ /* FIXME .... not clang specific */
|
#define GS_UNUSED_ARG __attribute__((unused))
|
||||||
|
|
||||||
|
#define GS_UNUSED_FUNC __attribute__((unused))
|
||||||
|
|
||||||
|
// FIXME ... what version of gcc?
|
||||||
|
#if __clang__
|
||||||
# define GS_UNUSED_IVAR __attribute__((unused))
|
# define GS_UNUSED_IVAR __attribute__((unused))
|
||||||
#else
|
#else
|
||||||
# define GS_UNUSED_IVAR
|
# define GS_UNUSED_IVAR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GS_UNUSED_ARG __attribute__((unused))
|
|
||||||
#define GS_UNUSED_FUNC __attribute__((unused))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __has_feature
|
#ifndef __has_feature
|
||||||
|
@ -320,6 +323,17 @@ static inline void gs_consumed(id NS_CONSUMED GS_UNUSED_ARG o) { return; }
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Attribute definition for root classes, annotates the interface declaration
|
||||||
|
* of the class.
|
||||||
|
*/
|
||||||
|
#ifndef GS_ROOT_CLASS
|
||||||
|
# if GS_HAVE_OBJC_ROOT_CLASS_ATTR || __has_feature(attribute_objc_root_class)
|
||||||
|
# define GS_ROOT_CLASS __attribute__((objc_root_class))
|
||||||
|
# else
|
||||||
|
# define GS_ROOT_CLASS
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(GNUSTEP_WITH_DLL)
|
#if defined(GNUSTEP_WITH_DLL)
|
||||||
|
@ -349,18 +363,22 @@ static inline void gs_consumed(id NS_CONSUMED GS_UNUSED_ARG o) { return; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Attribute macros compatible with Apple.
|
||||||
* Attribute definition for root classes, annotates the interface declaration of
|
|
||||||
* the class.
|
|
||||||
*/
|
*/
|
||||||
#ifndef GS_ROOT_CLASS
|
|
||||||
# if GS_HAVE_OBJC_ROOT_CLASS_ATTR || __has_feature(attribute_objc_root_class)
|
#if __GNUC__*10+__GNUC_MINOR__ >= 42
|
||||||
# define GS_ROOT_CLASS __attribute__((objc_root_class))
|
# define NS_FORMAT_ARGUMENT(A) __attribute__((format_arg(A)))
|
||||||
# else
|
#else
|
||||||
# define GS_ROOT_CLASS
|
# define NS_FORMAT_ARGUMENT(F,A)
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
|
#if __GNUC__*10+__GNUC_MINOR__ >= 42
|
||||||
|
# define NS_FORMAT_FUNCTION(F,A) __attribute__((format(__NSString__, F, A)))
|
||||||
|
#else
|
||||||
|
# define NS_FORMAT_FUNCTION(F,A)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NS_REQUIRES_NIL_TERMINATION __attribute__((sentinel))
|
#define NS_REQUIRES_NIL_TERMINATION __attribute__((sentinel))
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GNUSTEP_GSVERSIONMACROS_H_INCLUDED_ */
|
#endif /* __GNUSTEP_GSVERSIONMACROS_H_INCLUDED_ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue