aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/verilog/verilog_lexer.l
diff options
context:
space:
mode:
authorRupert Swarbrick <rswarbrick@gmail.com>2020-05-22 14:29:42 +0100
committerRupert Swarbrick <rswarbrick@gmail.com>2020-05-26 17:54:57 +0100
commit6aa0f72ae9e47c81441a2cecef18b7f90671ec6d (patch)
tree378b3f3d368ace3a26eeb8d56bad7188017aba51 /frontends/verilog/verilog_lexer.l
parenta7f2ef6d34c4b336a910b3c6f3d2cc11da8a82b4 (diff)
downloadyosys-6aa0f72ae9e47c81441a2cecef18b7f90671ec6d.tar.gz
yosys-6aa0f72ae9e47c81441a2cecef18b7f90671ec6d.tar.bz2
yosys-6aa0f72ae9e47c81441a2cecef18b7f90671ec6d.zip
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.
Diffstat (limited to 'frontends/verilog/verilog_lexer.l')
-rw-r--r--frontends/verilog/verilog_lexer.l4
1 files changed, 3 insertions, 1 deletions
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;
<INITIAL,SYNOPSYS_TRANSLATE_OFF>"`file_push "[^\n]* {
fn_stack.push_back(current_filename);