blob: d9190e5bdfe8ff1391945c15d7a1e59cf168147c [file] [log] [blame]
Brad Bishop0f291cc2019-09-01 15:16:57 -04001From dd6ad8ca447457c812809791ab8622da8646104c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 30 Aug 2019 13:07:33 -0700
4Subject: [PATCH] Don't use __GNUC_PREREQ
5
6These are not official GCC predefined macros; they are macros defined
7by GNU libc and some versions of BSD libc for internal use by their
8own headers, and we shouldn't be using them without checking for their
9availability first
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 lib/efi/efi.h | 4 ++--
14 lib/engine/pragma.h | 4 ++--
15 lib/log/log.h | 4 ++--
16 lib/mpb/machine_bytes.h | 4 ++--
17 lib/mpb/mpb.h | 4 ++--
18 lib/orom/orom.h | 4 ++--
19 6 files changed, 12 insertions(+), 12 deletions(-)
20
21diff --git a/lib/efi/efi.h b/lib/efi/efi.h
22index 0620d9c..c8358db 100644
23--- a/lib/efi/efi.h
24+++ b/lib/efi/efi.h
25@@ -33,9 +33,9 @@
26 #include <features.h>
27 #include <ssi.h>
28
29-#if __GNUC_PREREQ(3, 4)
30+#if ((defined __GNUC__ && __GNUC__ >= 3 && __GNUC_MINOR__ >= 4) || defined __clang__)
31 #pragma once
32-#endif /* __GNUC_PREREQ */
33+#endif
34
35 #if defined(__cplusplus)
36 extern "C" {
37diff --git a/lib/engine/pragma.h b/lib/engine/pragma.h
38index 8205ed3..fa0b268 100644
39--- a/lib/engine/pragma.h
40+++ b/lib/engine/pragma.h
41@@ -32,9 +32,9 @@
42
43 #include <features.h>
44
45-#if __GNUC_PREREQ(3, 4)
46+#if ((defined __GNUC__ && __GNUC__ >= 3 && __GNUC_MINOR__ >= 4) || defined __clang__)
47 #define SSI_HAS_PRAGMA_ONCE
48-#endif /* __GNUC_PREREQ */
49+#endif
50
51 #ifdef SSI_HAS_PRAGMA_ONCE
52 #pragma once
53diff --git a/lib/log/log.h b/lib/log/log.h
54index 66a707b..ca5000a 100644
55--- a/lib/log/log.h
56+++ b/lib/log/log.h
57@@ -32,9 +32,9 @@
58
59 #include <features.h>
60
61-#if __GNUC_PREREQ(3, 4)
62+#if ((defined __GNUC__ && __GNUC__ >= 3 && __GNUC_MINOR__ >= 4) || defined __clang__)
63 #pragma once
64-#endif /* __GNUC_PREREQ */
65+#endif
66
67 #if defined(__cplusplus)
68 extern "C" {
69diff --git a/lib/mpb/machine_bytes.h b/lib/mpb/machine_bytes.h
70index 6cb81c9..807461f 100644
71--- a/lib/mpb/machine_bytes.h
72+++ b/lib/mpb/machine_bytes.h
73@@ -27,9 +27,9 @@
74 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
75 */
76
77-#if __GNUC_PREREQ(3, 4)
78+#if ((defined __GNUC__ && __GNUC__ >= 3 && __GNUC_MINOR__ >= 4) || defined __clang__)
79 #pragma once
80-#endif /* __GNUC_PREREQ */
81+#endif
82
83 #ifndef __ENDIAN_H__INCLUDED__
84 #define __ENDIAN_H__INCLUDED__
85diff --git a/lib/mpb/mpb.h b/lib/mpb/mpb.h
86index 32beb21..98f82fe 100644
87--- a/lib/mpb/mpb.h
88+++ b/lib/mpb/mpb.h
89@@ -27,9 +27,9 @@
90 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
91 */
92
93-#if __GNUC_PREREQ(3, 4)
94+#if ((defined __GNUC__ && __GNUC__ >= 3 && __GNUC_MINOR__ >= 4) || defined __clang__)
95 #pragma once
96-#endif /* __GNUC_PREREQ */
97+#endif
98
99 #ifndef __MPB_H__INCLUDED__
100 #define __MPB_H__INCLUDED__
101diff --git a/lib/orom/orom.h b/lib/orom/orom.h
102index 4492066..16b03a6 100644
103--- a/lib/orom/orom.h
104+++ b/lib/orom/orom.h
105@@ -32,9 +32,9 @@
106
107 #include <features.h>
108
109-#if __GNUC_PREREQ(3, 4)
110+#if ((defined __GNUC__ && __GNUC__ >= 3 && __GNUC_MINOR__ >= 4) || defined __clang__)
111 #pragma once
112-#endif /* __GNUC_PREREQ */
113+#endif
114
115 #if defined(__cplusplus)
116 extern "C" {