Skip to content

Commit d8e3213

Browse files
nehebhauke
authored andcommitted
tools/elftosb: fix compilation with C++17
Newer GCC and Clang default to C++17, which does not support register. Just remove it. Signed-off-by: Rosen Penev <[email protected]> Link: openwrt/openwrt#18859 Signed-off-by: Hauke Mehrtens <[email protected]>
1 parent 6229a19 commit d8e3213

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
--- a/elftosb2/elftosb_lexer.cpp
2+
+++ b/elftosb2/elftosb_lexer.cpp
3+
@@ -722,9 +722,9 @@ static int yy_flex_strlen (yyconst char
4+
*/
5+
YY_DECL
6+
{
7+
- register yy_state_type yy_current_state;
8+
- register char *yy_cp, *yy_bp;
9+
- register int yy_act;
10+
+ yy_state_type yy_current_state;
11+
+ char *yy_cp, *yy_bp;
12+
+ int yy_act;
13+
14+
#line 38 "/Users/creed/projects/fsl/fromsvr/elftosb/elftosb2/elftosb_lexer.l"
15+
16+
@@ -773,7 +773,7 @@ YY_DECL
17+
yy_match:
18+
do
19+
{
20+
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
21+
+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
22+
if ( yy_accept[yy_current_state] )
23+
{
24+
(yy_last_accepting_state) = yy_current_state;
25+
@@ -1555,9 +1555,9 @@ void yyFlexLexer::LexerOutput( const cha
26+
*/
27+
int yyFlexLexer::yy_get_next_buffer()
28+
{
29+
- register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
30+
- register char *source = (yytext_ptr);
31+
- register int number_to_move, i;
32+
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
33+
+ char *source = (yytext_ptr);
34+
+ int number_to_move, i;
35+
int ret_val;
36+
37+
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
38+
@@ -1689,14 +1689,14 @@ int yyFlexLexer::yy_get_next_buffer()
39+
40+
yy_state_type yyFlexLexer::yy_get_previous_state()
41+
{
42+
- register yy_state_type yy_current_state;
43+
- register char *yy_cp;
44+
+ yy_state_type yy_current_state;
45+
+ char *yy_cp;
46+
47+
yy_current_state = (yy_start);
48+
49+
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
50+
{
51+
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
52+
+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
53+
if ( yy_accept[yy_current_state] )
54+
{
55+
(yy_last_accepting_state) = yy_current_state;
56+
@@ -1721,10 +1721,10 @@ int yyFlexLexer::yy_get_next_buffer()
57+
*/
58+
yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
59+
{
60+
- register int yy_is_jam;
61+
- register char *yy_cp = (yy_c_buf_p);
62+
+ int yy_is_jam;
63+
+ char *yy_cp = (yy_c_buf_p);
64+
65+
- register YY_CHAR yy_c = 1;
66+
+ YY_CHAR yy_c = 1;
67+
if ( yy_accept[yy_current_state] )
68+
{
69+
(yy_last_accepting_state) = yy_current_state;
70+
@@ -1742,9 +1742,9 @@ int yyFlexLexer::yy_get_next_buffer()
71+
return yy_is_jam ? 0 : yy_current_state;
72+
}
73+
74+
- void yyFlexLexer::yyunput( int c, register char* yy_bp)
75+
+ void yyFlexLexer::yyunput( int c, char* yy_bp)
76+
{
77+
- register char *yy_cp;
78+
+ char *yy_cp;
79+
80+
yy_cp = (yy_c_buf_p);
81+
82+
@@ -1754,10 +1754,10 @@ int yyFlexLexer::yy_get_next_buffer()
83+
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
84+
{ /* need to shift things up to make room */
85+
/* +2 for EOB chars. */
86+
- register yy_size_t number_to_move = (yy_n_chars) + 2;
87+
- register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
88+
+ yy_size_t number_to_move = (yy_n_chars) + 2;
89+
+ char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
90+
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
91+
- register char *source =
92+
+ char *source =
93+
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
94+
95+
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
96+
@@ -2190,7 +2190,7 @@ void yyFlexLexer::LexerError( yyconst ch
97+
#ifndef yytext_ptr
98+
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
99+
{
100+
- register int i;
101+
+ int i;
102+
for ( i = 0; i < n; ++i )
103+
s1[i] = s2[i];
104+
}
105+
@@ -2199,7 +2199,7 @@ static void yy_flex_strncpy (char* s1, y
106+
#ifdef YY_NEED_STRLEN
107+
static int yy_flex_strlen (yyconst char * s )
108+
{
109+
- register int n;
110+
+ int n;
111+
for ( n = 0; s[n]; ++n )
112+
;
113+

0 commit comments

Comments
 (0)