tevent: also use portable __has_attribute macro to check for "deprecated" attribute
authorBjörn Jacke <bj@sernet.de>
Thu, 8 Oct 2020 10:21:31 +0000 (12:21 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 16 Oct 2020 04:45:40 +0000 (04:45 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14526

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/tevent/tevent.h

index dc68a1d3f6966598e32dc5c885c8b026937059a7..b8e46feec466a9d2830193629c1377fd265fdbe6 100644 (file)
 #include <sys/time.h>
 #include <stdbool.h>
 
+/* for old gcc releases that don't have the feature test macro __has_attribute */
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
+
 struct tevent_context;
 struct tevent_ops;
 struct tevent_fd;
@@ -2076,7 +2082,7 @@ void _tevent_threaded_schedule_immediate(struct tevent_threaded_context *tctx,
 
 #ifdef TEVENT_DEPRECATED
 #ifndef _DEPRECATED_
-#ifdef HAVE___ATTRIBUTE__
+#if __has_attribute(deprecated) || (__GNUC__ >= 3)
 #define _DEPRECATED_ __attribute__ ((deprecated))
 #else
 #define _DEPRECATED_