From bd74a916258912dcf313185e617627580daa3ede Mon Sep 17 00:00:00 2001 From: Vitor Sessak Date: Wed, 2 Oct 2024 09:22:01 +0000 Subject: [PATCH] Add include headers in files using symbols defined by them. Those still compile in most environments since the symbols get imported transitively, but relying on that is considered a bad practice. It is also necessary to compile MiniZinc with Bazel. --- include/minizinc/htmlprinter.hh | 2 ++ include/minizinc/statistics.hh | 3 +++ include/minizinc/support/regex.hh | 5 +++-- lib/parser.yxx | 6 ++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/minizinc/htmlprinter.hh b/include/minizinc/htmlprinter.hh index c92b0e63a..05d3980b4 100644 --- a/include/minizinc/htmlprinter.hh +++ b/include/minizinc/htmlprinter.hh @@ -15,6 +15,8 @@ #include #include +#include + namespace MiniZinc { class Model; diff --git a/include/minizinc/statistics.hh b/include/minizinc/statistics.hh index bfb28dbd5..5b296cf67 100644 --- a/include/minizinc/statistics.hh +++ b/include/minizinc/statistics.hh @@ -11,8 +11,11 @@ #pragma once +#include +#include #include +#include #include #include diff --git a/include/minizinc/support/regex.hh b/include/minizinc/support/regex.hh index c0e7e6352..bf7810f9c 100644 --- a/include/minizinc/support/regex.hh +++ b/include/minizinc/support/regex.hh @@ -11,16 +11,17 @@ #pragma once -#ifdef HAS_GECODE - // Regex Parser Requirements #include #include +#include #include #include #include +#ifdef HAS_GECODE + #include #undef ERROR diff --git a/lib/parser.yxx b/lib/parser.yxx index 2f60f56a5..e8db3d055 100644 --- a/lib/parser.yxx +++ b/lib/parser.yxx @@ -9,6 +9,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +%code requires { +#include +} + %define api.pure %parse-param {void *parm} @@ -32,6 +36,8 @@ namespace MiniZinc{ class ParserLocation; } #define YYMAXDEPTH 10000 #define YYINITDEPTH 10000 +#include + #include #include