2
0

950-fix-building-with-gcc6.patch 4.7 KB

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