/work/workdir/UnpackedTarball/cairo/src/cairo-compiler-private.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* cairo - a vector graphics library with display and print output |
2 | | * |
3 | | * Copyright © 2002 University of Southern California |
4 | | * Copyright © 2005 Red Hat, Inc. |
5 | | * |
6 | | * This library is free software; you can redistribute it and/or |
7 | | * modify it either under the terms of the GNU Lesser General Public |
8 | | * License version 2.1 as published by the Free Software Foundation |
9 | | * (the "LGPL") or, at your option, under the terms of the Mozilla |
10 | | * Public License Version 1.1 (the "MPL"). If you do not alter this |
11 | | * notice, a recipient may use your version of this file under either |
12 | | * the MPL or the LGPL. |
13 | | * |
14 | | * You should have received a copy of the LGPL along with this library |
15 | | * in the file COPYING-LGPL-2.1; if not, write to the Free Software |
16 | | * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA |
17 | | * You should have received a copy of the MPL along with this library |
18 | | * in the file COPYING-MPL-1.1 |
19 | | * |
20 | | * The contents of this file are subject to the Mozilla Public License |
21 | | * Version 1.1 (the "License"); you may not use this file except in |
22 | | * compliance with the License. You may obtain a copy of the License at |
23 | | * http://www.mozilla.org/MPL/ |
24 | | * |
25 | | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY |
26 | | * OF ANY KIND, either express or implied. See the LGPL or the MPL for |
27 | | * the specific language governing rights and limitations. |
28 | | * |
29 | | * The Original Code is the cairo graphics library. |
30 | | * |
31 | | * The Initial Developer of the Original Code is University of Southern |
32 | | * California. |
33 | | * |
34 | | * Contributor(s): |
35 | | * Carl D. Worth <cworth@cworth.org> |
36 | | */ |
37 | | |
38 | | #ifndef CAIRO_COMPILER_PRIVATE_H |
39 | | #define CAIRO_COMPILER_PRIVATE_H |
40 | | |
41 | | #include "cairo.h" |
42 | | |
43 | | #include "config.h" |
44 | | |
45 | | #include <stddef.h> /* size_t */ |
46 | | #include <stdint.h> /* SIZE_MAX */ |
47 | | |
48 | | /* Size in bytes of buffer to use off the stack per functions. |
49 | | * Mostly used by text functions. For larger allocations, they'll |
50 | | * malloc(). */ |
51 | | #ifndef CAIRO_STACK_BUFFER_SIZE |
52 | | #define CAIRO_STACK_BUFFER_SIZE (512 * sizeof (int)) |
53 | | #endif |
54 | | |
55 | | #define CAIRO_STACK_ARRAY_LENGTH(T) (CAIRO_STACK_BUFFER_SIZE / sizeof(T)) |
56 | | |
57 | | /* |
58 | | * The goal of this block is to define the following macros for |
59 | | * providing faster linkage to functions in the public API for calls |
60 | | * from within cairo. |
61 | | * |
62 | | * slim_hidden_proto(f) |
63 | | * slim_hidden_proto_no_warn(f) |
64 | | * |
65 | | * Declares `f' as a library internal function and hides the |
66 | | * function from the global symbol table. This macro must be |
67 | | * expanded after `f' has been declared with a prototype but before |
68 | | * any calls to the function are seen by the compiler. The no_warn |
69 | | * variant inhibits warnings about the return value being unused at |
70 | | * call sites. The macro works by renaming `f' to an internal name |
71 | | * in the symbol table and hiding that. As far as cairo internal |
72 | | * calls are concerned they're calling a library internal function |
73 | | * and thus don't need to bounce via the procedure linkage table (PLT). |
74 | | * |
75 | | * slim_hidden_def(f) |
76 | | * |
77 | | * Exports `f' back to the global symbol table. This macro must be |
78 | | * expanded right after the function definition and only for symbols |
79 | | * hidden previously with slim_hidden_proto(). The macro works by |
80 | | * adding a global entry to the symbol table which points at the |
81 | | * internal name of `f' created by slim_hidden_proto(). |
82 | | * |
83 | | * Functions in the public API which aren't called by the library |
84 | | * don't need to be hidden and re-exported using the slim hidden |
85 | | * macros. |
86 | | */ |
87 | | #if __GNUC__ >= 3 && defined(__ELF__) && !defined(__sun) |
88 | | # define slim_hidden_proto(name) slim_hidden_proto1(name, slim_hidden_int_name(name)) cairo_private |
89 | | # define slim_hidden_proto_no_warn(name) slim_hidden_proto1(name, slim_hidden_int_name(name)) cairo_private_no_warn |
90 | | # define slim_hidden_def(name) slim_hidden_def1(name, slim_hidden_int_name(name)) |
91 | | # define slim_hidden_int_name(name) INT_##name |
92 | | # define slim_hidden_proto1(name, internal) \ |
93 | | extern __typeof (name) name \ |
94 | | __asm__ (slim_hidden_asmname (internal)) |
95 | | # define slim_hidden_def1(name, internal) \ |
96 | | extern __typeof (name) EXT_##name __asm__(slim_hidden_asmname(name)) \ |
97 | | __attribute__((__alias__(slim_hidden_asmname(internal)))) |
98 | | # define slim_hidden_ulp slim_hidden_ulp1(__USER_LABEL_PREFIX__) |
99 | | # define slim_hidden_ulp1(x) slim_hidden_ulp2(x) |
100 | | # define slim_hidden_ulp2(x) #x |
101 | | # define slim_hidden_asmname(name) slim_hidden_asmname1(name) |
102 | | # define slim_hidden_asmname1(name) slim_hidden_ulp #name |
103 | | #else |
104 | | # define slim_hidden_proto(name) int _cairo_dummy_prototype(void) |
105 | | # define slim_hidden_proto_no_warn(name) int _cairo_dummy_prototype(void) |
106 | | # define slim_hidden_def(name) int _cairo_dummy_prototype(void) |
107 | | #endif |
108 | | |
109 | | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) |
110 | | #ifdef __MINGW32__ |
111 | | #define CAIRO_PRINTF_FORMAT(fmt_index, va_index) \ |
112 | | __attribute__((__format__(__MINGW_PRINTF_FORMAT, fmt_index, va_index))) |
113 | | #else |
114 | | #define CAIRO_PRINTF_FORMAT(fmt_index, va_index) \ |
115 | | __attribute__((__format__(__printf__, fmt_index, va_index))) |
116 | | #endif |
117 | | #else |
118 | | #define CAIRO_PRINTF_FORMAT(fmt_index, va_index) |
119 | | #endif |
120 | | |
121 | | /* slim_internal.h */ |
122 | | #define CAIRO_HAS_HIDDEN_SYMBOLS 1 |
123 | | #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && \ |
124 | | (defined(__ELF__) || defined(__APPLE__)) && \ |
125 | | !defined(__sun) |
126 | | #define cairo_private_no_warn __attribute__((__visibility__("hidden"))) |
127 | | #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) |
128 | | #define cairo_private_no_warn __hidden |
129 | | #else /* not gcc >= 3.3 and not Sun Studio >= 8 */ |
130 | | #define cairo_private_no_warn |
131 | | #undef CAIRO_HAS_HIDDEN_SYMBOLS |
132 | | #endif |
133 | | |
134 | | #ifndef WARN_UNUSED_RESULT |
135 | | #define WARN_UNUSED_RESULT |
136 | | #endif |
137 | | /* Add attribute(warn_unused_result) if supported */ |
138 | | #define cairo_warn WARN_UNUSED_RESULT |
139 | | #define cairo_private cairo_private_no_warn cairo_warn |
140 | | |
141 | | /* This macro allow us to deprecate a function by providing an alias |
142 | | for the old function name to the new function name. With this |
143 | | macro, binary compatibility is preserved. The macro only works on |
144 | | some platforms --- tough. |
145 | | |
146 | | Meanwhile, new definitions in the public header file break the |
147 | | source code so that it will no longer link against the old |
148 | | symbols. Instead it will give a descriptive error message |
149 | | indicating that the old function has been deprecated by the new |
150 | | function. |
151 | | */ |
152 | | #if __GNUC__ >= 2 && defined(__ELF__) |
153 | | # define CAIRO_FUNCTION_ALIAS(old, new) \ |
154 | | extern __typeof (new) old \ |
155 | | __asm__ ("" #old) \ |
156 | | __attribute__((__alias__("" #new))) |
157 | | #else |
158 | | # define CAIRO_FUNCTION_ALIAS(old, new) |
159 | | #endif |
160 | | |
161 | | /* |
162 | | * Cairo uses the following function attributes in order to improve the |
163 | | * generated code (effectively by manual inter-procedural analysis). |
164 | | * |
165 | | * 'cairo_pure': The function is only allowed to read from its arguments |
166 | | * and global memory (i.e. following a pointer argument or |
167 | | * accessing a shared variable). The return value should |
168 | | * only depend on its arguments, and for an identical set of |
169 | | * arguments should return the same value. |
170 | | * |
171 | | * 'cairo_const': The function is only allowed to read from its arguments. |
172 | | * It is not allowed to access global memory. The return |
173 | | * value should only depend its arguments, and for an |
174 | | * identical set of arguments should return the same value. |
175 | | * This is currently the most strict function attribute. |
176 | | * |
177 | | * Both these function attributes allow gcc to perform CSE and |
178 | | * constant-folding, with 'cairo_const 'also guaranteeing that pointer contents |
179 | | * do not change across the function call. |
180 | | */ |
181 | | #if __GNUC__ >= 3 |
182 | | #define cairo_pure __attribute__((pure)) |
183 | | #define cairo_const __attribute__((const)) |
184 | | #define cairo_always_inline inline __attribute__((always_inline)) |
185 | | #else |
186 | | #define cairo_pure |
187 | | #define cairo_const |
188 | | #define cairo_always_inline inline |
189 | | #endif |
190 | | |
191 | | #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) |
192 | 290M | #define likely(expr) (__builtin_expect (!!(expr), 1)) |
193 | 947M | #define unlikely(expr) (__builtin_expect (!!(expr), 0)) |
194 | | #else |
195 | | #define likely(expr) (expr) |
196 | | #define unlikely(expr) (expr) |
197 | | #endif |
198 | | |
199 | | #ifndef __GNUC__ |
200 | | #undef __attribute__ |
201 | | #define __attribute__(x) |
202 | | #endif |
203 | | |
204 | | #if (defined(__WIN32__) && !defined(__WINE__)) || defined(_MSC_VER) |
205 | | #define access _access |
206 | | #ifndef R_OK |
207 | | #define R_OK 4 |
208 | | #endif |
209 | | #define fdopen _fdopen |
210 | | #define hypot _hypot |
211 | | #define pclose _pclose |
212 | | #define popen _popen |
213 | | #define strdup _strdup |
214 | | #define unlink _unlink |
215 | | #if _MSC_VER < 1900 |
216 | | #define vsnprintf _vsnprintf |
217 | | #define snprintf _snprintf |
218 | | #endif |
219 | | #endif |
220 | | |
221 | | #ifdef _MSC_VER |
222 | | #ifndef __cplusplus |
223 | | #undef inline |
224 | | #define inline __inline |
225 | | #endif |
226 | | #endif |
227 | | |
228 | | #if defined(_MSC_VER) && defined(_M_IX86) |
229 | | /* When compiling with /Gy and /OPT:ICF identical functions will be folded in together. |
230 | | The CAIRO_ENSURE_UNIQUE macro ensures that a function is always unique and |
231 | | will never be folded into another one. Something like this might eventually |
232 | | be needed for GCC but it seems fine for now. */ |
233 | | #define CAIRO_ENSURE_UNIQUE \ |
234 | | do { \ |
235 | | char file[] = __FILE__; \ |
236 | | __asm { \ |
237 | | __asm jmp __internal_skip_line_no \ |
238 | | __asm _emit (__COUNTER__ & 0xff) \ |
239 | | __asm _emit ((__COUNTER__>>8) & 0xff) \ |
240 | | __asm _emit ((__COUNTER__>>16) & 0xff)\ |
241 | | __asm _emit ((__COUNTER__>>24) & 0xff)\ |
242 | | __asm lea eax, dword ptr file \ |
243 | | __asm __internal_skip_line_no: \ |
244 | | }; \ |
245 | | } while (0) |
246 | | #else |
247 | 5.61k | #define CAIRO_ENSURE_UNIQUE do { } while (0) |
248 | | #endif |
249 | | |
250 | | #ifdef __STRICT_ANSI__ |
251 | | #undef inline |
252 | | #define inline __inline__ |
253 | | #endif |
254 | | |
255 | | /* size_t add/multiply with overflow check. |
256 | | * |
257 | | * These _cairo_fallback_*_size_t_overflow() functions are always defined |
258 | | * to allow them to be tested in the test suite. They are used |
259 | | * if no compiler builtin is available. |
260 | | */ |
261 | | static cairo_always_inline cairo_bool_t |
262 | | _cairo_fallback_add_size_t_overflow(size_t a, size_t b, size_t *c) |
263 | 0 | { |
264 | 0 | if (b > SIZE_MAX - a) |
265 | 0 | return 1; |
266 | 0 |
|
267 | 0 | *c = a + b; |
268 | 0 | return 0; |
269 | 0 | } Unexecuted instantiation: cairo-font-face.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-font-options.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-image-surface.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-matrix.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-misc.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-mutex.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-path.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-pattern.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-raster-source-pattern.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-recording-surface.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-rectangle.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-scaled-font.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-spline.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-stroke-style.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-surface-snapshot.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-surface-wrapper.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-surface.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-traps.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-unicode.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-version.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-ft-font.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-pdf-surface.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-pdf-interchange.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-tag-stack.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-analysis-surface.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-array.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-boxes.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-cache.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-clip-boxes.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-clip.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-color.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-composite-rectangles.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-compositor.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-damage.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-debug.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-default-context.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-device.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-error.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-font-face-twin.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-freed-pool.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-gstate.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-hash.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-image-compositor.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-image-info.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-image-source.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-line.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-mask-compositor.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-mesh-pattern-rasterizer.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-mono-scan-converter.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-no-compositor.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-observer.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-output-stream.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-paginated-surface.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-path-bounds.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-path-fill.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-path-fixed.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-path-in-fill.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-path-stroke-boxes.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-path-stroke-polygon.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-path-stroke.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-pen.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-polygon.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-region.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-shape-mask-compositor.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-slope.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-spans-compositor.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-spans.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-stroke-dash.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-surface-clipper.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-surface-offset.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-tor-scan-converter.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-tor22-scan-converter.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-toy-font-face.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-traps-compositor.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-user-font.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-cff-subset.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-scaled-font-subsets.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-truetype-subset.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-type1-fallback.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-type1-glyph-names.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-type1-subset.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-type3-glyph-surface.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-pdf-operators.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-pdf-shading.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-tag-attributes.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-deflate-stream.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-arc.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-bentley-ottmann-rectangular.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-bentley-ottmann-rectilinear.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-bentley-ottmann.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-boxes-intersect.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-clip-polygon.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-clip-region.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-clip-surface.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-contour.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-font-face-twin-data.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-freelist.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-hull.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-path-stroke-traps.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-polygon-intersect.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-polygon-reduce.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-rectangular-scan-converter.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-wideint.c:_cairo_fallback_add_size_t_overflow Unexecuted instantiation: cairo-surface-subsurface.c:_cairo_fallback_add_size_t_overflow |
270 | | |
271 | | static cairo_always_inline cairo_bool_t |
272 | | _cairo_fallback_mul_size_t_overflow(size_t a, size_t b, size_t *c) |
273 | 0 | { |
274 | 0 | if (b != 0 && a > SIZE_MAX / b) |
275 | 0 | return 1; |
276 | 0 |
|
277 | 0 | *c = a * b; |
278 | 0 | return 0; |
279 | 0 | } Unexecuted instantiation: cairo-font-face.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-font-options.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-image-surface.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-matrix.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-misc.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-mutex.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-path.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-pattern.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-raster-source-pattern.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-recording-surface.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-rectangle.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-scaled-font.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-spline.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-stroke-style.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-surface-snapshot.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-surface-wrapper.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-surface.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-traps.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-unicode.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-version.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-ft-font.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-pdf-surface.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-pdf-interchange.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-tag-stack.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-analysis-surface.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-array.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-boxes.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-cache.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-clip-boxes.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-clip.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-color.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-composite-rectangles.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-compositor.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-damage.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-debug.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-default-context.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-device.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-error.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-font-face-twin.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-freed-pool.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-gstate.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-hash.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-image-compositor.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-image-info.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-image-source.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-line.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-mask-compositor.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-mesh-pattern-rasterizer.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-mono-scan-converter.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-no-compositor.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-observer.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-output-stream.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-paginated-surface.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-path-bounds.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-path-fill.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-path-fixed.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-path-in-fill.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-path-stroke-boxes.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-path-stroke-polygon.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-path-stroke.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-pen.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-polygon.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-region.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-shape-mask-compositor.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-slope.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-spans-compositor.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-spans.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-stroke-dash.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-surface-clipper.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-surface-offset.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-tor-scan-converter.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-tor22-scan-converter.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-toy-font-face.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-traps-compositor.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-user-font.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-cff-subset.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-scaled-font-subsets.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-truetype-subset.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-type1-fallback.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-type1-glyph-names.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-type1-subset.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-type3-glyph-surface.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-pdf-operators.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-pdf-shading.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-tag-attributes.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-deflate-stream.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-arc.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-bentley-ottmann-rectangular.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-bentley-ottmann-rectilinear.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-bentley-ottmann.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-boxes-intersect.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-clip-polygon.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-clip-region.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-clip-surface.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-contour.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-font-face-twin-data.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-freelist.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-hull.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-path-stroke-traps.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-polygon-intersect.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-polygon-reduce.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-rectangular-scan-converter.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-wideint.c:_cairo_fallback_mul_size_t_overflow Unexecuted instantiation: cairo-surface-subsurface.c:_cairo_fallback_mul_size_t_overflow |
280 | | |
281 | | /* Clang defines __GNUC__ so check clang builtins before gcc. |
282 | | * MSVC does not support feature macros so hide the __has_builtin inside the #if __clang__ block |
283 | | */ |
284 | | #ifdef __clang__ |
285 | | #if defined(__has_builtin) && __has_builtin(__builtin_add_overflow) |
286 | 425k | #define _cairo_add_size_t_overflow(a, b, c) __builtin_add_overflow((size_t)(a), (size_t)(b), (size_t*)(c)) |
287 | 436k | #define _cairo_mul_size_t_overflow(a, b, c) __builtin_mul_overflow((size_t)(a), (size_t)(b), (size_t*)(c)) |
288 | | #endif |
289 | | #elif __GNUC__ >= 8 || (__GNUC__ >= 5 && (INTPTR_MAX == INT64_MAX)) |
290 | | /* Overflow builtins are available in gcc 5 but the 32-bit version is broken on gcc < 8. |
291 | | * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82274 |
292 | | */ |
293 | | #define _cairo_add_size_t_overflow(a, b, c) __builtin_add_overflow((size_t)(a), (size_t)(b), (size_t*)(c)) |
294 | | #define _cairo_mul_size_t_overflow(a, b, c) __builtin_mul_overflow((size_t)(a), (size_t)(b), (size_t*)(c)) |
295 | | #elif defined(_MSC_VER) && defined(HAVE_INTSAFE_H) |
296 | | #include <intsafe.h> |
297 | | #define _cairo_add_size_t_overflow(a,b,c) (SizeTAdd((size_t)(a), (size_t)(b), (size_t*)(c)) != S_OK) |
298 | | #define _cairo_mul_size_t_overflow(a,b,c) (SizeTMult((size_t)(a), (size_t)(b), (size_t*)(c)) != S_OK) |
299 | | #endif |
300 | | |
301 | | #ifndef _cairo_add_size_t_overflow |
302 | | #define _cairo_add_size_t_overflow _cairo_fallback_add_size_t_overflow |
303 | | #define _cairo_mul_size_t_overflow _cairo_fallback_mul_size_t_overflow |
304 | | #endif |
305 | | |
306 | | #endif |