xref: /aosp_15_r20/external/libxml2/libxml.h (revision 7c5688314b92172186c154356a6374bf7684c3ca)
1 /*
2  * libxml.h: internal header only used during the compilation of libxml
3  *
4  * See COPYRIGHT for the status of this software
5  *
6  * Author: [email protected]
7  */
8 
9 #ifndef __XML_LIBXML_H__
10 #define __XML_LIBXML_H__
11 
12 /*
13  * These macros must be defined before including system headers.
14  * Do not add any #include directives above this block.
15  */
16 #ifndef NO_LARGEFILE_SOURCE
17   #ifndef _LARGEFILE_SOURCE
18     #define _LARGEFILE_SOURCE
19   #endif
20   #ifndef _FILE_OFFSET_BITS
21     #define _FILE_OFFSET_BITS 64
22   #endif
23 #endif
24 
25 /*
26  * These files are generated by the build system and contain private
27  * and public build configuration.
28  */
29 #include "config.h"
30 #include <libxml/xmlversion.h>
31 
32 /*
33  * Due to some Autotools limitations, this variable must be passed as
34  * compiler flag. Define a default value if the macro wasn't set by the
35  * build system.
36  */
37 #ifndef SYSCONFDIR
38   #define SYSCONFDIR "/etc"
39 #endif
40 
41 #if !defined(_WIN32) && \
42     !defined(__CYGWIN__) && \
43     (defined(__clang__) || \
44      (defined(__GNUC__) && (__GNUC__ >= 4)))
45   #define XML_HIDDEN __attribute__((visibility("hidden")))
46 #else
47   #define XML_HIDDEN
48 #endif
49 
50 #if __GNUC__ * 100 + __GNUC_MINOR__ >= 207 || defined(__clang__)
51   #define ATTRIBUTE_UNUSED __attribute__((unused))
52 #else
53   #define ATTRIBUTE_UNUSED
54 #endif
55 
56 #ifdef HAVE_FUNC_ATTRIBUTE_DESTRUCTOR
57   #define ATTRIBUTE_DESTRUCTOR __attribute__((destructor))
58 #endif
59 
60 #if defined(__clang__) || \
61     (defined(__GNUC__) && (__GNUC__ >= 8) && !defined(__EDG__))
62   #define ATTRIBUTE_NO_SANITIZE(arg) __attribute__((no_sanitize(arg)))
63 #else
64   #define ATTRIBUTE_NO_SANITIZE(arg)
65 #endif
66 
67 #ifdef __clang__
68   #if __clang_major__ >= 12
69     #define ATTRIBUTE_NO_SANITIZE_INTEGER \
70       ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow") \
71       ATTRIBUTE_NO_SANITIZE("unsigned-shift-base")
72   #else
73     #define ATTRIBUTE_NO_SANITIZE_INTEGER \
74       ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
75   #endif
76 #else
77   #define ATTRIBUTE_NO_SANITIZE_INTEGER
78 #endif
79 
80 #endif /* ! __XML_LIBXML_H__ */
81