Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/utilities/compilerWarnings_gcc.hpp
40949 views
1
/*
2
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#ifndef SHARE_UTILITIES_COMPILERWARNINGS_GCC_HPP
26
#define SHARE_UTILITIES_COMPILERWARNINGS_GCC_HPP
27
28
// Macros related to control of compiler warnings.
29
30
#ifndef ATTRIBUTE_PRINTF
31
#define ATTRIBUTE_PRINTF(fmt,vargs) __attribute__((format(printf, fmt, vargs)))
32
#endif
33
#ifndef ATTRIBUTE_SCANF
34
#define ATTRIBUTE_SCANF(fmt,vargs) __attribute__((format(scanf, fmt, vargs)))
35
#endif
36
37
#define PRAGMA_DISABLE_GCC_WARNING_AUX(x) _Pragma(#x)
38
#define PRAGMA_DISABLE_GCC_WARNING(option_string) \
39
PRAGMA_DISABLE_GCC_WARNING_AUX(GCC diagnostic ignored option_string)
40
41
#define PRAGMA_FORMAT_NONLITERAL_IGNORED \
42
PRAGMA_DISABLE_GCC_WARNING("-Wformat-nonliteral") \
43
PRAGMA_DISABLE_GCC_WARNING("-Wformat-security")
44
45
#define PRAGMA_FORMAT_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wformat")
46
47
// Disable -Wstringop-truncation which is introduced in GCC 8.
48
// https://gcc.gnu.org/gcc-8/changes.html
49
#if !defined(__clang_major__) && (__GNUC__ >= 8)
50
#define PRAGMA_STRINGOP_TRUNCATION_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wstringop-truncation")
51
#endif
52
53
#if defined(__clang_major__) && \
54
(__clang_major__ >= 4 || \
55
(__clang_major__ >= 3 && __clang_minor__ >= 1)) || \
56
((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
57
// Tested to work with clang version 3.1 and better.
58
#define PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push")
59
#define PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop")
60
61
#endif // clang/gcc version check
62
63
#endif // SHARE_UTILITIES_COMPILERWARNINGS_GCC_HPP
64
65