[PATCH cygport] Add -Werror=return-type to CXXFLAGS/OBJCXXFLAGS

Christian Franke Christian.Franke@t-online.de
Thu Sep 2 17:01:44 GMT 2021


Ignoring -Wreturn-type for C++ programs may lead to crashes. C language 
is not affected.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96181
https://sourceware.org/pipermail/cygwin/2021-August/249153.html

Regards,
Christian

-------------- next part --------------
From 2bd92abdf273e2bc3a899afffe0245b232150992 Mon Sep 17 00:00:00 2001
From: Christian Franke <christian.franke@t-online.de>
Date: Thu, 2 Sep 2021 18:52:39 +0200
Subject: [PATCH] Add -Werror=return-type to CXXFLAGS/OBJCXXFLAGS.

G++ >= 8.0 assumes that control never reaches the end of a
non-void function (GCC Bugzilla 96181).
---
 lib/compilers.cygpart | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/compilers.cygpart b/lib/compilers.cygpart
index b775489..129e115 100644
--- a/lib/compilers.cygpart
+++ b/lib/compilers.cygpart
@@ -56,9 +56,9 @@ declare -x CXX="g++";
 #  Flags passed to CXX when compiling C++ code.  Individual packages may append
 #  or override this value if they will not build correctly without it.
 #  DEFAULT VALUE
-#  CFLAGS
+#  CFLAGS -Werror=return-type
 #****
-declare -x CXXFLAGS=${CFLAGS};
+declare -x CXXFLAGS="${CFLAGS} -Werror=return-type";
 
 #****d* Compiling/F77
 #  DESCRIPTION
-- 
2.33.0



More information about the Cygwin-apps mailing list