summaryrefslogtreecommitdiffstats
path: root/include/apr_general.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/apr_general.h')
-rw-r--r--include/apr_general.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/apr_general.h b/include/apr_general.h
index fa073c8..48d8b89 100644
--- a/include/apr_general.h
+++ b/include/apr_general.h
@@ -103,11 +103,18 @@ typedef int apr_signum_t;
* @param field data field within the structure
* @return offset
*/
+#if defined(__has_builtin)
+#if __has_builtin(__builtin_offsetof)
+#define APR_OFFSETOF(s_type,field) __builtin_offsetof(s_type,field)
+#endif
+#endif /* __has_builtin */
+#ifndef APR_OFFSETOF
#if defined(offsetof) && !defined(__cplusplus)
#define APR_OFFSETOF(s_type,field) offsetof(s_type,field)
#else
#define APR_OFFSETOF(s_type,field) APR_OFFSET(s_type*,field)
#endif
+#endif /* ndef APR_OFFSETOF */
#ifndef DOXYGEN