tdb: Fix invalid syntax in tdb.h
authorGünther Deschner <gd@samba.org>
Fri, 16 Jul 2021 15:29:40 +0000 (17:29 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 20 Jul 2021 10:57:35 +0000 (10:57 +0000)
Defining _PUBLIC_ in the same way as in talloc.h resolves an issue with
a previous fix for Solaris Studio compiler 12.4 that prefixed all calls
in tdb.h with _PUBLIC_.  Thanks to Lukas Slebodnik
<lslebodn@redhat.com>.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=14762

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/tdb/include/tdb.h

index 696547c8cd9e87552e455e5e3c6b7d084572e7e7..884171c73d9aa92f26a20a8d4d4d4ebb97123139 100644 (file)
@@ -33,6 +33,19 @@ extern "C" {
 #include <signal.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
+
+#ifndef _PUBLIC_
+#if __has_attribute(visibility)
+#define _PUBLIC_ __attribute__((visibility("default")))
+#else
+#define _PUBLIC_
+#endif
+#endif
+
 /**
  * @defgroup tdb The tdb API
  *