Line | Count | Source |
1 | | // Copyright 2009 The RE2 Authors. All Rights Reserved. |
2 | | // Use of this source code is governed by a BSD-style |
3 | | // license that can be found in the LICENSE file. |
4 | | |
5 | | #ifndef UTIL_UTIL_H_ |
6 | | #define UTIL_UTIL_H_ |
7 | | |
8 | 8.14k | #define arraysize(array) (sizeof(array)/sizeof((array)[0])) |
9 | | |
10 | | #ifndef ATTRIBUTE_NORETURN |
11 | | #if defined(__GNUC__) |
12 | | #define ATTRIBUTE_NORETURN __attribute__((noreturn)) |
13 | | #elif defined(_MSC_VER) |
14 | | #define ATTRIBUTE_NORETURN __declspec(noreturn) |
15 | | #else |
16 | | #define ATTRIBUTE_NORETURN |
17 | | #endif |
18 | | #endif |
19 | | |
20 | | #ifndef ATTRIBUTE_UNUSED |
21 | | #if defined(__GNUC__) |
22 | | #define ATTRIBUTE_UNUSED __attribute__((unused)) |
23 | | #else |
24 | | #define ATTRIBUTE_UNUSED |
25 | | #endif |
26 | | #endif |
27 | | |
28 | | #ifndef FALLTHROUGH_INTENDED |
29 | | #if defined(__clang__) |
30 | 9.86M | #define FALLTHROUGH_INTENDED [[clang::fallthrough]] |
31 | | #elif defined(__GNUC__) && __GNUC__ >= 7 |
32 | | #define FALLTHROUGH_INTENDED [[gnu::fallthrough]] |
33 | | #else |
34 | | #define FALLTHROUGH_INTENDED do {} while (0) |
35 | | #endif |
36 | | #endif |
37 | | |
38 | | #ifndef NO_THREAD_SAFETY_ANALYSIS |
39 | | #define NO_THREAD_SAFETY_ANALYSIS |
40 | | #endif |
41 | | |
42 | | #endif // UTIL_UTIL_H_ |