Patch from: https://github.com/bpftrace/bpftrace/pull/3648 From 986acde60552af60c0a28aac234c38a7542d2f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= Date: Tue, 17 Dec 2024 13:27:41 +0100 Subject: [PATCH] Fix ODR violation warning when compiling with LTO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit yy_scan_string is declared to return void* due to a lack of a proper type definition of struct yy_buffer_state, which is only available in lex.yy.cc. Provide a struct forward declaration so that a proper return type can be used. This fixes the LTO complaint. Signed-off-by: Holger Hoffstätte --- src/driver.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/driver.cpp b/src/driver.cpp index 0cd0267323b8..b1d2f91111cd 100644 --- a/src/driver.cpp +++ b/src/driver.cpp @@ -5,7 +5,10 @@ #include "log.h" #include "parser.tab.hh" -extern void *yy_scan_string(const char *yy_str, yyscan_t yyscanner); +struct yy_buffer_state; + +extern struct yy_buffer_state *yy_scan_string(const char *yy_str, + yyscan_t yyscanner); extern int yylex_init(yyscan_t *scanner); extern int yylex_destroy(yyscan_t yyscanner); extern bpftrace::location loc;