toolchain/gcc/arc-2016.03: Fix building on hosts with gcc 6.x
[openwrt/staging/lynxis/omap.git] / toolchain / gcc / patches / arc-2016.03 / 950-fix-building-with-gcc6.patch
1 From 5dce741e00f86a08a4c174fb3605d896f210ab52 Mon Sep 17 00:00:00 2001
2 From: Bernd Edlinger <bernd.edlinger@hotmail.de>
3 Date: Wed, 27 Jul 2016 13:30:03 +0300
4 Subject: [PATCH] 2016-02-19 Jakub Jelinek <jakub@redhat.com> Bernd Edlinger
5 <bernd.edlinger@hotmail.de>
6
7 * Make-lang.in: Invoke gperf with -L C++.
8 * cfns.gperf: Remove prototypes for hash and libc_name_p
9 inlines.
10 * cfns.h: Regenerated.
11 * except.c (nothrow_libfn_p): Adjust.
12
13 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233572138bc75d-0d04-0410-961f-82ee72b054a4
14
15 This patch fixes building of gcc-4.x by gcc-6.x, for more details see
16 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69959
17
18 Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
19 ---
20 gcc/cp/Make-lang.in | 2 +-
21 gcc/cp/cfns.gperf | 10 ++--------
22 gcc/cp/cfns.h | 41 ++++++++++++++---------------------------
23 gcc/cp/except.c | 3 ++-
24 4 files changed, 19 insertions(+), 37 deletions(-)
25
26 diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
27 index dce523a..36a1a97 100644
28 --- a/gcc/cp/Make-lang.in
29 +++ b/gcc/cp/Make-lang.in
30 @@ -115,7 +115,7 @@ else
31 # deleting the $(srcdir)/cp/cfns.h file.
32 $(srcdir)/cp/cfns.h:
33 endif
34 - gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
35 + gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \
36 $(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
37
38 #\f
39 diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf
40 index c4c4e2a..5c40933 100644
41 --- a/gcc/cp/cfns.gperf
42 +++ b/gcc/cp/cfns.gperf
43 @@ -1,3 +1,5 @@
44 +%language=C++
45 +%define class-name libc_name
46 %{
47 /* Copyright (C) 2000-2013 Free Software Foundation, Inc.
48
49 @@ -16,14 +18,6 @@ for more details.
50 You should have received a copy of the GNU General Public License
51 along with GCC; see the file COPYING3. If not see
52 <http://www.gnu.org/licenses/>. */
53 -#ifdef __GNUC__
54 -__inline
55 -#endif
56 -static unsigned int hash (const char *, unsigned int);
57 -#ifdef __GNUC__
58 -__inline
59 -#endif
60 -const char * libc_name_p (const char *, unsigned int);
61 %}
62 %%
63 # The standard C library functions, for feeding to gperf; the result is used
64 diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h
65 index 42dd3cf..6c79864 100644
66 --- a/gcc/cp/cfns.h
67 +++ b/gcc/cp/cfns.h
68 @@ -1,5 +1,5 @@
69 -/* ANSI-C code produced by gperf version 3.0.3 */
70 -/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf */
71 +/* C++ code produced by gperf version 3.0.4 */
72 +/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf */
73
74 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
75 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
76 @@ -28,7 +28,7 @@
77 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
78 #endif
79
80 -#line 1 "cfns.gperf"
81 +#line 3 "cfns.gperf"
82
83 /* Copyright (C) 2000-2013 Free Software Foundation, Inc.
84
85 @@ -47,25 +47,18 @@ for more details.
86 You should have received a copy of the GNU General Public License
87 along with GCC; see the file COPYING3. If not see
88 <http://www.gnu.org/licenses/>. */
89 -#ifdef __GNUC__
90 -__inline
91 -#endif
92 -static unsigned int hash (const char *, unsigned int);
93 -#ifdef __GNUC__
94 -__inline
95 -#endif
96 -const char * libc_name_p (const char *, unsigned int);
97 /* maximum key range = 391, duplicates = 0 */
98
99 -#ifdef __GNUC__
100 -__inline
101 -#else
102 -#ifdef __cplusplus
103 -inline
104 -#endif
105 -#endif
106 -static unsigned int
107 -hash (register const char *str, register unsigned int len)
108 +class libc_name
109 +{
110 +private:
111 + static inline unsigned int hash (const char *str, unsigned int len);
112 +public:
113 + static const char *libc_name_p (const char *str, unsigned int len);
114 +};
115 +
116 +inline unsigned int
117 +libc_name::hash (register const char *str, register unsigned int len)
118 {
119 static const unsigned short asso_values[] =
120 {
121 @@ -122,14 +115,8 @@ hash (register const char *str, register unsigned int len)
122 return hval + asso_values[(unsigned char)str[len - 1]];
123 }
124
125 -#ifdef __GNUC__
126 -__inline
127 -#ifdef __GNUC_STDC_INLINE__
128 -__attribute__ ((__gnu_inline__))
129 -#endif
130 -#endif
131 const char *
132 -libc_name_p (register const char *str, register unsigned int len)
133 +libc_name::libc_name_p (register const char *str, register unsigned int len)
134 {
135 enum
136 {
137 diff --git a/gcc/cp/except.c b/gcc/cp/except.c
138 index 604f274..c3298cb 100644
139 --- a/gcc/cp/except.c
140 +++ b/gcc/cp/except.c
141 @@ -1025,7 +1025,8 @@ nothrow_libfn_p (const_tree fn)
142 unless the system headers are playing rename tricks, and if
143 they are, we don't want to be confused by them. */
144 id = DECL_NAME (fn);
145 - return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
146 + return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id),
147 + IDENTIFIER_LENGTH (id));
148 }
149
150 /* Returns nonzero if an exception of type FROM will be caught by a
151 --
152 2.7.4
153