Skip to content

lex files fail compilation under GCC 15 / C23 standard #10471

@nuclearpidgeon

Description

@nuclearpidgeon

In my continuing series of issues building Fluentbit under GCC 15: some errors have come out of the parts of the build that make use of flex and .l lexer definition files - specifically:

  • The SQL parser in processor_sql (make -f CMakeFiles/Makefile2 plugins/processor_sql/parser/all)
  • The record-accessor syntax parser in src/record_accessor (make -f CMakeFiles/Makefile2 src/record_accessor/all)
  • The stream processor syntax parser (make -f CMakeFiles/Makefile2 src/stream_processor/parser/all)

Example build failure:

Building C object plugins/processor_sql/parser/CMakeFiles/processor-sql-parser.dir/processor-sql_parser.c.o
sql-parser.y:22:12: error: conflicting types for ‘yylex’; have ‘int(void)’
In file included from sql-parser.y:16:
/home/stewart/Projects/OSS/fluentbit-4/build/plugins/processor_sql/parser/processor-sql-parser_lex.h:338:12: note: previous declaration of ‘yylex’ with type ‘int(YYSTYPE *, void *)’
  338 | 
      |            ^    
/home/stewart/Projects/OSS/fluentbit-4/build/plugins/processor_sql/parser/processor-sql_parser.c: In function ‘yyparse’:
/home/stewart/Projects/OSS/fluentbit-4/build/plugins/processor_sql/parser/processor-sql_parser.c:1092:16: error: too many arguments to function ‘yylex’; expected 0, have 2
 1092 |       yychar = yylex (&yylval, scanner);
      |                ^~~~~  ~~~~~~~
sql-parser.y:22:12: note: declared here
make[1]: *** [plugins/processor_sql/parser/CMakeFiles/processor-sql-parser.dir/build.make:138: plugins/processor_sql/parser/CMakeFiles/processor-sql-parser.dir/processor-sql_parser.c.o] Error 1
make[1]: Leaving directory '/home/stewart/Projects/OSS/fluentbit-4/build'
make: *** [CMakeFiles/Makefile2:9308: plugins/processor_sql/parser/CMakeFiles/processor-sql-parser.dir/all] Error 2

When looking at the intermediary-generated build/plugins/processor_sql/parser/processor-sql_parser.c file in my IDE I see this declaration with a squiggly line under it:

extern int yylex();

...with this message:

A function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C23, conflicting with a previous declaration clang(-Wdeprecated-non-prototype)
processor-sql-parser_lex.h(339, 12): Conflicting prototype is here

build/plugins/processor_sql/parser/processor-sql-parser_lex.h at that line shows:

extern int yylex \
               (YYSTYPE * yylval_param , yyscan_t yyscanner);

It seems this stems from the extern int yylex(); declarations used in the .y files e.g.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions