Wed Apr 24 16:48:30 2024 UTC (16d)
Fix gcc build on FreeBSD 14 (and possibly other systems using clang >= 16).

Pointed out by Eirik ��verby.

OK mrg@


(hgutch)
diff -r1.11 -r1.12 src/external/gpl3/gcc.old/dist/gcc/cp/cfns.h

cvs diff -r1.11 -r1.12 src/external/gpl3/gcc.old/dist/gcc/cp/cfns.h (expand / switch to unified diff)

--- src/external/gpl3/gcc.old/dist/gcc/cp/cfns.h 2023/02/20 02:11:23 1.11
+++ src/external/gpl3/gcc.old/dist/gcc/cp/cfns.h 2024/04/24 16:48:29 1.12
@@ -50,27 +50,27 @@ along with GCC; see the file COPYING3.  @@ -50,27 +50,27 @@ along with GCC; see the file COPYING3.
50#line 23 "cfns.gperf" 50#line 23 "cfns.gperf"
51struct libc_name_struct { const char *name; int c_ver; }; 51struct libc_name_struct { const char *name; int c_ver; };
52/* maximum key range = 1478, duplicates = 0 */ 52/* maximum key range = 1478, duplicates = 0 */
53 53
54class libc_name 54class libc_name
55{ 55{
56private: 56private:
57 static inline unsigned int hash (const char *str, unsigned int len); 57 static inline unsigned int hash (const char *str, unsigned int len);
58public: 58public:
59 static const struct libc_name_struct *libc_name_p (const char *str, unsigned int len); 59 static const struct libc_name_struct *libc_name_p (const char *str, unsigned int len);
60}; 60};
61 61
62inline unsigned int 62inline unsigned int
63libc_name::hash (register const char *str, register unsigned int len) 63libc_name::hash (const char *str, unsigned int len)
64{ 64{
65 static const unsigned short asso_values[] = 65 static const unsigned short asso_values[] =
66 { 66 {
67 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 67 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
68 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 68 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
69 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 69 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
70 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 70 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
71 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 0, 1, 71 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 0, 1,
72 82, 1488, 4, 1488, 1, 1488, 1488, 1488, 1488, 1488, 72 82, 1488, 4, 1488, 1, 1488, 1488, 1488, 1488, 1488,
73 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 73 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
74 0, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 74 0, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
75 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 75 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
76 1488, 1488, 1488, 1488, 1488, 0, 0, 29, 7, 6, 76 1488, 1488, 1488, 1488, 1488, 0, 0, 29, 7, 6,
@@ -81,54 +81,54 @@ libc_name::hash (register const char *st @@ -81,54 +81,54 @@ libc_name::hash (register const char *st
81 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 81 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
82 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 82 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
83 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 83 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
84 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 84 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
85 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 85 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
86 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 86 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
87 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 87 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
88 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 88 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
89 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 89 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
90 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 90 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
91 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 91 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488, 1488,
92 1488, 1488, 1488, 1488, 1488, 1488, 1488 92 1488, 1488, 1488, 1488, 1488, 1488, 1488
93 }; 93 };
94 register int hval = len; 94 int hval = len;
95 95
96 switch (hval) 96 switch (hval)
97 { 97 {
98 default: 98 default:
99 hval += asso_values[(unsigned char)str[5]+1]; 99 hval += asso_values[(unsigned char)str[5]+1];
100 /*FALLTHROUGH*/ 100 /*FALLTHROUGH*/
101 case 5: 101 case 5:
102 hval += asso_values[(unsigned char)str[4]]; 102 hval += asso_values[(unsigned char)str[4]];
103 /*FALLTHROUGH*/ 103 /*FALLTHROUGH*/
104 case 4: 104 case 4:
105 hval += asso_values[(unsigned char)str[3]]; 105 hval += asso_values[(unsigned char)str[3]];
106 /*FALLTHROUGH*/ 106 /*FALLTHROUGH*/
107 case 3: 107 case 3:
108 hval += asso_values[(unsigned char)str[2]]; 108 hval += asso_values[(unsigned char)str[2]];
109 /*FALLTHROUGH*/ 109 /*FALLTHROUGH*/
110 case 2: 110 case 2:
111 hval += asso_values[(unsigned char)str[1]+1]; 111 hval += asso_values[(unsigned char)str[1]+1];
112 /*FALLTHROUGH*/ 112 /*FALLTHROUGH*/
113 case 1: 113 case 1:
114 hval += asso_values[(unsigned char)str[0]]; 114 hval += asso_values[(unsigned char)str[0]];
115 break; 115 break;
116 } 116 }
117 return hval + asso_values[(unsigned char)str[len - 1]]; 117 return hval + asso_values[(unsigned char)str[len - 1]];
118} 118}
119 119
120const struct libc_name_struct * 120const struct libc_name_struct *
121libc_name::libc_name_p (register const char *str, register unsigned int len) 121libc_name::libc_name_p (const char *str, unsigned int len)
122{ 122{
123 enum 123 enum
124 { 124 {
125 TOTAL_KEYWORDS = 414, 125 TOTAL_KEYWORDS = 414,
126 MIN_WORD_LENGTH = 3, 126 MIN_WORD_LENGTH = 3,
127 MAX_WORD_LENGTH = 15, 127 MAX_WORD_LENGTH = 15,
128 MIN_HASH_VALUE = 10, 128 MIN_HASH_VALUE = 10,
129 MAX_HASH_VALUE = 1487 129 MAX_HASH_VALUE = 1487
130 }; 130 };
131 131
132 static const struct libc_name_struct wordlist[] = 132 static const struct libc_name_struct wordlist[] =
133 { 133 {
134#line 456 "cfns.gperf" 134#line 456 "cfns.gperf"
@@ -1106,30 +1106,30 @@ libc_name::libc_name_p (register const c @@ -1106,30 +1106,30 @@ libc_name::libc_name_p (register const c
1106 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1106 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1107 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1107 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1108 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1108 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1109 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1109 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1110 -1, -1, -1, -1, -1, -1, -1, 409, 410, -1, 1110 -1, -1, -1, -1, -1, -1, -1, 409, 410, -1,
1111 -1, -1, -1, -1, -1, -1, 411, -1, -1, -1, 1111 -1, -1, -1, -1, -1, -1, 411, -1, -1, -1,
1112 -1, 412, -1, -1, -1, -1, -1, -1, -1, -1, 1112 -1, 412, -1, -1, -1, -1, -1, -1, -1, -1,
1113 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1113 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1114 -1, -1, -1, -1, -1, -1, -1, 413 1114 -1, -1, -1, -1, -1, -1, -1, 413
1115 }; 1115 };
1116 1116
1117 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) 1117 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
1118 { 1118 {
1119 register int key = hash (str, len); 1119 int key = hash (str, len);
1120 1120
1121 if (key <= MAX_HASH_VALUE && key >= 0) 1121 if (key <= MAX_HASH_VALUE && key >= 0)
1122 { 1122 {
1123 register int index = lookup[key]; 1123 int index = lookup[key];
1124 1124
1125 if (index >= 0) 1125 if (index >= 0)
1126 { 1126 {
1127 register const char *s = wordlist[index].name; 1127 const char *s = wordlist[index].name;
1128 1128
1129 if (*str == *s && !strcmp (str + 1, s + 1)) 1129 if (*str == *s && !strcmp (str + 1, s + 1))
1130 return &wordlist[index]; 1130 return &wordlist[index];
1131 } 1131 }
1132 } 1132 }
1133 } 1133 }
1134 return 0; 1134 return 0;
1135} 1135}