From 6aa0f72ae9e47c81441a2cecef18b7f90671ec6d Mon Sep 17 00:00:00 2001 From: Rupert Swarbrick Date: Fri, 22 May 2020 14:29:42 +0100 Subject: [PATCH] Silence spurious warning in Verilog lexer when compiling with GCC The chosen value shouldn't have any effect. I considered something clearly wrong like -1, but there's no checking inside the generated lexer, and I suspect this will cause even weirder bugs if triggered than just setting it to INITIAL. --- frontends/verilog/verilog_lexer.l | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontends/verilog/verilog_lexer.l b/frontends/verilog/verilog_lexer.l index f6a3ac4db..65a2e9a78 100644 --- a/frontends/verilog/verilog_lexer.l +++ b/frontends/verilog/verilog_lexer.l @@ -128,7 +128,9 @@ static bool isUserType(std::string &s) %x BASED_CONST %% - int comment_caller; + // Initialise comment_caller to something to avoid a "maybe undefined" + // warning from GCC. + int comment_caller = INITIAL; "`file_push "[^\n]* { fn_stack.push_back(current_filename); -- 2.30.2