From 38042226677c9c9397ca0c38a623a7a005958810 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 22 Sep 2023 14:29:22 +0200
Subject: [PATCH] Ignore -Wold-style-cast in Flex-generated files

---
 src/DynareFlex.ll      | 5 +++++
 src/macro/Tokenizer.ll | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/DynareFlex.ll b/src/DynareFlex.ll
index c18feca8..a1476cc2 100644
--- a/src/DynareFlex.ll
+++ b/src/DynareFlex.ll
@@ -42,6 +42,9 @@ using token = Dynare::parser::token;
 
 int comment_caller, line_caller;
 string eofbuff;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 %}
 
 %option c++
@@ -1208,6 +1211,8 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4])
 <*>.      { driver.error(*yylloc, "character unrecognized by lexer"); }
 %%
 
+#pragma GCC diagnostic pop
+
 DynareFlex::DynareFlex(istream* in, ostream* out)
   : DynareFlexLexer{in, out}
 {
diff --git a/src/macro/Tokenizer.ll b/src/macro/Tokenizer.ll
index c930cc54..a3ef9d1b 100644
--- a/src/macro/Tokenizer.ll
+++ b/src/macro/Tokenizer.ll
@@ -1,6 +1,6 @@
 /* -*- C++ -*- */
 /*
- * Copyright © 2019-2021 Dynare Team
+ * Copyright © 2019-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -35,6 +35,9 @@ using token = Tokenizer::parser::token;
    Unfortunately yyterminate by default returns 0, which is
    not of token_type.  */
 #define yyterminate() return Tokenizer::parser::token_type (0);
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 %}
 
 %option c++
@@ -193,6 +196,8 @@ CONT \\\\{SPC}*
 
 %%
 
+#pragma GCC diagnostic pop
+
 void
 TokenizerFlex::location_increment(Tokenizer::parser::location_type *yylloc, const char *yytext)
 {
-- 
GitLab