1diff -rNU3 dist.orig/gcc/cp/cfns.gperf dist/gcc/cp/cfns.gperf
2--- dist.orig/gcc/cp/cfns.gperf	2018-08-24 00:40:38.917847976 +0200
3+++ dist/gcc/cp/cfns.gperf	2018-08-24 00:43:45.613142399 +0200
4@@ -1,3 +1,5 @@
5+%language=C++
6+%define class-name libc_name
7 %{
8 /* Copyright (C) 2000-2013 Free Software Foundation, Inc.
9
10@@ -16,14 +18,6 @@
11 You should have received a copy of the GNU General Public License
12 along with GCC; see the file COPYING3.  If not see
13 <http://www.gnu.org/licenses/>.  */
14-#ifdef __GNUC__
15-__inline
16-#endif
17-static unsigned int hash (const char *, unsigned int);
18-#ifdef __GNUC__
19-__inline
20-#endif
21-const char * libc_name_p (const char *, unsigned int);
22 %}
23 %%
24 # The standard C library functions, for feeding to gperf; the result is used
25diff -rNU3 dist.orig/gcc/cp/cfns.h dist/gcc/cp/cfns.h
26--- dist.orig/gcc/cp/cfns.h	2018-08-24 00:40:38.913848077 +0200
27+++ dist/gcc/cp/cfns.h	2018-08-24 00:49:31.228441865 +0200
28@@ -1,5 +1,5 @@
29-/* ANSI-C code produced by gperf version 3.0.3 */
30-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf  */
31+/* C++ code produced by gperf version 3.0.3 */
32+/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ cfns.gperf  */
33
34 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
35       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
36@@ -28,7 +28,7 @@
37 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
38 #endif
39
40-#line 1 "cfns.gperf"
41+#line 3 "cfns.gperf"
42
43 /* Copyright (C) 2000-2013 Free Software Foundation, Inc.
44
45@@ -47,25 +47,18 @@
46 You should have received a copy of the GNU General Public License
47 along with GCC; see the file COPYING3.  If not see
48 <http://www.gnu.org/licenses/>.  */
49-#ifdef __GNUC__
50-__inline
51-#endif
52-static unsigned int hash (const char *, unsigned int);
53-#ifdef __GNUC__
54-__inline
55-#endif
56-const char * libc_name_p (const char *, unsigned int);
57 /* maximum key range = 391, duplicates = 0 */
58
59-#ifdef __GNUC__
60-__inline
61-#else
62-#ifdef __cplusplus
63-inline
64-#endif
65-#endif
66-static unsigned int
67-hash (register const char *str, register unsigned int len)
68+class libc_name
69+{
70+private:
71+  static inline unsigned int hash (const char *str, unsigned int len);
72+public:
73+  static const char *libc_name_p (const char *str, unsigned int len);
74+};
75+
76+inline unsigned int
77+libc_name::hash (register const char *str, register unsigned int len)
78 {
79   static const unsigned short asso_values[] =
80     {
81@@ -122,14 +115,8 @@
82   return hval + asso_values[(unsigned char)str[len - 1]];
83 }
84
85-#ifdef __GNUC__
86-__inline
87-#ifdef __GNUC_STDC_INLINE__
88-__attribute__ ((__gnu_inline__))
89-#endif
90-#endif
91 const char *
92-libc_name_p (register const char *str, register unsigned int len)
93+libc_name::libc_name_p (register const char *str, register unsigned int len)
94 {
95   enum
96     {
97diff -rNU3 dist.orig/gcc/cp/except.c dist/gcc/cp/except.c
98--- dist.orig/gcc/cp/except.c	2018-08-24 00:40:38.917847976 +0200
99+++ dist/gcc/cp/except.c	2018-08-24 00:49:19.820728889 +0200
100@@ -1025,7 +1025,8 @@
101      unless the system headers are playing rename tricks, and if
102      they are, we don't want to be confused by them.  */
103   id = DECL_NAME (fn);
104-  return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
105+  return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id),
106+		  		  IDENTIFIER_LENGTH (id));
107 }
108
109 /* Returns nonzero if an exception of type FROM will be caught by a
110diff -rNU3 dist.orig/gcc/cp/Make-lang.in dist/gcc/cp/Make-lang.in
111--- dist.orig/gcc/cp/Make-lang.in	2018-08-24 00:40:38.913848077 +0200
112+++ dist/gcc/cp/Make-lang.in	2018-08-24 00:41:40.240301781 +0200
113@@ -117,7 +117,7 @@
114 # deleting the $(srcdir)/cp/cfns.h file.
115 $(srcdir)/cp/cfns.h:
116 endif
117-	gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
118+	gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \
119 		$(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
120
121 #
122