You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/09/04 14:01:26 UTC

svn commit: r811358 - /commons/sandbox/runtime/trunk/src/main/native/include/acr.h

Author: mturk
Date: Fri Sep  4 12:01:25 2009
New Revision: 811358

URL: http://svn.apache.org/viewvc?rev=811358&view=rev
Log:
Use gcc 4 visibility feature

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/acr.h

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr.h?rev=811358&r1=811357&r2=811358&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr.h Fri Sep  4 12:01:25 2009
@@ -356,7 +356,65 @@
 #define ACR_MODULE_DECLARE_DATA           __declspec(dllexport)
 #endif
 
-#else /* !_WIN32 */
+#elif defined(__GNUC__) && (__GNUC__ >= 4)
+
+#if defined(ACR_DECLARE_STATIC)
+#define ACR_DECLARE(type)                   type
+#define ACR_DECLARE_NONSTD(type)            type
+#define ACR_DECLARE_DATA
+#elif defined(ACR_DECLARE_EXPORT)
+#define ACR_DECLARE(type)                 __attribute__ ((visibility("default"))) type
+#define ACR_DECLARE_NONSTD(type)          __attribute__ ((visibility("default"))) type
+#define ACR_DECLARE_DATA                  __attribute__ ((visibility("default")))
+#else
+/**
+ * The public ACR functions are declared with ACR_DECLARE(), so they may
+ * use the most appropriate calling convention.  Public ACR functions with
+ * variable arguments must use ACR_DECLARE_NONSTD().
+ *
+ */
+#define ACR_DECLARE(type)                 type
+/**
+ * The public ACR functions using variable arguments are declared with
+ * ACR_DECLARE_NONSTD(), as they must use the C language calling convention.
+ *
+ */
+#define ACR_DECLARE_NONSTD(type)          type
+/**
+ * The public ACR variables are declared with ACR_DECLARE_DATA.
+ * This assures the appropriate indirection is invoked at compile time.
+ *
+ * @remark extern ACR_DECLARE_DATA type apr_variable; syntax is required for
+ * declarations within headers to properly import the variable.
+ */
+#define ACR_DECLARE_DATA
+#endif
+
+#if defined(ACR_MODULE_DECLARE_STATIC)
+/**
+ * Declare a dso module's exported module structure as ACR_MODULE_DECLARE_DATA.
+ *
+ * Unless ACR_MODULE_DECLARE_STATIC is defined at compile time, symbols
+ * declared with ACR_MODULE_DECLARE_DATA are always exported.
+ * @code
+ * module ACR_MODULE_DECLARE_DATA mod_tag
+ * @endcode
+ */
+#define ACR_MODULE_DECLARE(type)            type
+#define ACR_MODULE_DECLARE_NONSTD(type)     type
+#define ACR_MODULE_DECLARE_DATA
+#else
+/**
+ * ACR_MODULE_DECLARE_EXPORT is a no-op.  Unless contradicted by the
+ * ACR_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined.
+ */
+#define ACR_MODULE_DECLARE_EXPORT
+#define ACR_MODULE_DECLARE(type)          __attribute__ ((visibility("default"))) type
+#define ACR_MODULE_DECLARE_NONSTD(type)   __attribute__ ((visibility("default"))) type
+#define ACR_MODULE_DECLARE_DATA           __attribute__ ((visibility("default")))
+#endif
+
+#else /* !_WIN32 && !__GNUC__ >= 4 */
 
 /**
  * The public ACR functions are declared with ACR_DECLARE(), so they may