From dfcfdda318cdd04ceb266e230357bd3a1f9241b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 7 Jun 2022 17:46:16 +0200
Subject: [PATCH] Enable more compiler warnings for C++

---
 configure.ac            | 2 +-
 mex/build/matlab/mex.am | 4 ++--
 mex/build/octave/mex.am | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5da8099e96..767c36c791 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,7 +49,7 @@ esac
 # Use C++ for testing headers
 AC_LANG([C++])
 
-AM_CXXFLAGS="-std=gnu++20 -Wall -Wno-parentheses -Wold-style-cast"
+AM_CXXFLAGS="-std=gnu++20 -Wall -Wno-dangling-else -Wextra -Wno-unused-parameter -Wold-style-cast"
 AC_SUBST([AM_CXXFLAGS])
 
 # If default 'ar' is not available, try to find one with a host prefix (see ticket #145)
diff --git a/mex/build/matlab/mex.am b/mex/build/matlab/mex.am
index b9f633d938..647bec4cc3 100644
--- a/mex/build/matlab/mex.am
+++ b/mex/build/matlab/mex.am
@@ -7,9 +7,9 @@ DEFS += $(MATLAB_DEFS)
 DEFS += -DMATLAB_MEX_FILE
 DEFS += -DMEXEXT=\"$(MEXEXT)\"
 
-AM_CFLAGS = $(MATLAB_CFLAGS) -Wall -Wno-parentheses
+AM_CFLAGS = $(MATLAB_CFLAGS) -Wall -Wno-parentheses # TODO: use same warnings as C++
 AM_FCFLAGS = $(MATLAB_FCFLAGS) -Wall -Wimplicit-interface
-AM_CXXFLAGS = -std=gnu++20 $(MATLAB_CXXFLAGS) -Wall -Wno-parentheses -Wold-style-cast
+AM_CXXFLAGS = -std=gnu++20 $(MATLAB_CXXFLAGS) -Wall -Wno-dangling-else -Wextra -Wno-unused-parameter -Wold-style-cast
 AM_LDFLAGS = $(MATLAB_LDFLAGS)
 LIBS += $(MATLAB_LIBS)
 
diff --git a/mex/build/octave/mex.am b/mex/build/octave/mex.am
index b1b5fe86bb..a5e126b9a2 100644
--- a/mex/build/octave/mex.am
+++ b/mex/build/octave/mex.am
@@ -5,9 +5,9 @@ AM_CPPFLAGS += -I$(top_srcdir)/../../sources
 DEFS += -DOCTAVE_MEX_FILE
 DEFS += -DMEXEXT=\".mex\"
 
-AM_CFLAGS = $(shell $(MKOCTFILE) -p CPICFLAG) -Wall -Wno-parentheses
+AM_CFLAGS = $(shell $(MKOCTFILE) -p CPICFLAG) -Wall -Wno-parentheses # TODO: use same warnings as C++
 AM_FCFLAGS = $(shell $(MKOCTFILE) -p FPICFLAG) -Wall -Wimplicit-interface
-AM_CXXFLAGS = -std=gnu++20 $(shell $(MKOCTFILE) -p CXXPICFLAG) -Wall -Wno-parentheses -Wold-style-cast
+AM_CXXFLAGS = -std=gnu++20 $(shell $(MKOCTFILE) -p CXXPICFLAG) -Wall -Wno-dangling-else -Wextra -Wno-unused-parameter -Wold-style-cast
 AM_LDFLAGS = $(shell $(MKOCTFILE) -p DL_LDFLAGS)
 
 # See the comments in configure.ac
-- 
GitLab