Skip to content

Commit

Permalink
Revert the flex changes to avoid the warnings
Browse files Browse the repository at this point in the history
It looks like they were unnecessary anyways, but that's kinda annoying

----
Signed-off-by: Lydia Duncan <[email protected]>
  • Loading branch information
lydia-duncan committed Nov 20, 2024
1 parent 9752416 commit 7751743
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
39 changes: 19 additions & 20 deletions frontend/lib/parsing/flex-chpl-lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
typedef uint64_t flex_uint64_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
Expand Down Expand Up @@ -446,7 +445,7 @@ struct yy_buffer_state
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
yy_size_t yy_n_chars;
int yy_n_chars;

/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
Expand Down Expand Up @@ -523,7 +522,7 @@ static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner

YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, yy_size_t len , yyscan_t yyscanner );
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );

void *yyalloc ( yy_size_t , yyscan_t yyscanner );
void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
Expand Down Expand Up @@ -570,7 +569,7 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
*/
#define YY_DO_BEFORE_ACTION \
yyg->yytext_ptr = yy_bp; \
yyleng = (yy_size_t) (yy_cp - yy_bp); \
yyleng = (int) (yy_cp - yy_bp); \
yyg->yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
Expand Down Expand Up @@ -1080,10 +1079,10 @@ static void processInvalidToken(yyscan_t scanner);
static bool yy_has_state(yyscan_t scanner);
}

#line 1083 "flex-chpl-lib.cpp"
#line 1082 "flex-chpl-lib.cpp"
/* hex float literals, have decimal exponents indicating the power of 2 */

#line 1086 "flex-chpl-lib.cpp"
#line 1085 "flex-chpl-lib.cpp"

#define INITIAL 0
#define externmode 1
Expand Down Expand Up @@ -1111,8 +1110,8 @@ struct yyguts_t
size_t yy_buffer_stack_max; /**< capacity of stack. */
YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
char yy_hold_char;
yy_size_t yy_n_chars;
yy_size_t yyleng_r;
int yy_n_chars;
int yyleng_r;
char *yy_c_buf_p;
int yy_init;
int yy_start;
Expand Down Expand Up @@ -1169,7 +1168,7 @@ FILE *yyget_out ( yyscan_t yyscanner );

void yyset_out ( FILE * _out_str , yyscan_t yyscanner );

yy_size_t yyget_leng ( yyscan_t yyscanner );
int yyget_leng ( yyscan_t yyscanner );

char *yyget_text ( yyscan_t yyscanner );

Expand Down Expand Up @@ -1254,7 +1253,7 @@ static int input ( yyscan_t yyscanner );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
yy_size_t n; \
int n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
Expand Down Expand Up @@ -1373,7 +1372,7 @@ YY_DECL
#line 114 "chpl.lex"


#line 1376 "flex-chpl-lib.cpp"
#line 1375 "flex-chpl-lib.cpp"

while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
Expand Down Expand Up @@ -2378,7 +2377,7 @@ YY_RULE_SETUP
#line 330 "chpl.lex"
ECHO;
YY_BREAK
#line 2381 "flex-chpl-lib.cpp"
#line 2380 "flex-chpl-lib.cpp"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(externmode):
yyterminate();
Expand Down Expand Up @@ -2567,7 +2566,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)

else
{
yy_size_t num_to_read =
int num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;

while ( num_to_read <= 0 )
Expand All @@ -2581,7 +2580,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)

if ( b->yy_is_our_buffer )
{
yy_size_t new_size = b->yy_buf_size * 2;
int new_size = b->yy_buf_size * 2;

if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
Expand Down Expand Up @@ -2639,7 +2638,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)

if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
Expand Down Expand Up @@ -2746,7 +2745,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)

else
{ /* need more input */
yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
++yyg->yy_c_buf_p;

switch ( yy_get_next_buffer( yyscanner ) )
Expand Down Expand Up @@ -3124,12 +3123,12 @@ YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
yy_size_t i;
int i;

/* Get memory for full buffer, including space for trailing EOB's. */
n = (yy_size_t) (_yybytes_len + 2);
Expand Down Expand Up @@ -3214,7 +3213,7 @@ static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
do \
{ \
/* Undo effects of setting up yytext. */ \
yy_size_t yyless_macro_arg = (n); \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
yytext[yyleng] = yyg->yy_hold_char; \
yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
Expand Down Expand Up @@ -3282,7 +3281,7 @@ FILE *yyget_out (yyscan_t yyscanner)
/** Get the length of the current token.
* @param yyscanner The scanner object.
*/
yy_size_t yyget_leng (yyscan_t yyscanner)
int yyget_leng (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yyleng;
Expand Down
9 changes: 4 additions & 5 deletions frontend/lib/parsing/flex-chpl-lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
typedef uint64_t flex_uint64_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
Expand Down Expand Up @@ -399,7 +398,7 @@ struct yy_buffer_state
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
yy_size_t yy_n_chars;
int yy_n_chars;

/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
Expand Down Expand Up @@ -443,7 +442,7 @@ void yypop_buffer_state ( yyscan_t yyscanner );

YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, yy_size_t len , yyscan_t yyscanner );
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );

void *yyalloc ( yy_size_t , yyscan_t yyscanner );
void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
Expand Down Expand Up @@ -497,7 +496,7 @@ FILE *yyget_out ( yyscan_t yyscanner );

void yyset_out ( FILE * _out_str , yyscan_t yyscanner );

yy_size_t yyget_leng ( yyscan_t yyscanner );
int yyget_leng ( yyscan_t yyscanner );

char *yyget_text ( yyscan_t yyscanner );

Expand Down Expand Up @@ -731,6 +730,6 @@ extern int yylex \
#line 330 "chpl.lex"


#line 734 "flex-chpl-lib.h"
#line 733 "flex-chpl-lib.h"
#undef yychpl_IN_HEADER
#endif /* yychpl_HEADER_H */

0 comments on commit 7751743

Please sign in to comment.