On 28/11/2019 20:43, Gert Doering wrote:
> hi,
> 
> On Thu, Nov 28, 2019 at 11:56:34AM -0500, Selva Nair wrote:
>> I think the correct fix here is to remove -Werror from travis build.
>> I have tried and failed to lobby for this earlier, but one more try
>> can't hurt, I suppose :)
> 
> Can we restrict -Werror to gcc builds, for the time being?
> 
> If not, I agree with you, and it needs to go...
> 
> Valid (and unambiguous) C statements shouldn't cause warnings, and we
> shouldn't add patches just because an old version of a certain compiler
> is silly.


With GCC-4.3.8, I see this warning:

crypto.c: In function ‘write_pem_key_file’:
crypto.c:1860:12: warning: missing braces around initializer [-Wmissing-braces]
     struct key server_key = { 0 };

Perhaps we should just add -Wno-missing-braces?  A quick patch is attached,
this silences this warning with GCC-4.3.8 at least.  That said, I'm not
sure this is the best approach; it may hide other missing braces warnings
we should see.


-- 
kind regards,

David Sommerseth
OpenVPN Inc



From 1166081219e8623e32aeea93ddabd2937df36ef8 Mon Sep 17 00:00:00 2001
From: David Sommerseth <dav...@openvpn.net>
Date: Fri, 29 Nov 2019 11:43:34 +0100
Subject: [PATCH] build: Add -Wno-missing-braces to CFLAGS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Some older GCC and clang compilers complains about missing braces when
initaling structs.

crypto.c: In function ‘write_pem_key_file’:
crypto.c:1860:12: warning: missing braces around initializer
[-Wmissing-braces]
     struct key server_key = { 0 };

Use of the ACL_CHECK_ADD_COMPILE_FLAGS() macro to check if the compiler
support -Wno-missing-braces flag, which ends up in CFLAGS if the
compiler accepts it.

Signed-off-by: David Sommerseth <dav...@openvpn.net>
---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index a47e0a06..0e98dfaa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1289,6 +1289,7 @@ AC_DEFUN([ACL_CHECK_ADD_COMPILE_FLAGS], [
 ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-stringop-truncation])
 ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-unused-function])
 ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-unused-parameter])
+ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-missing-braces])
 ACL_CHECK_ADD_COMPILE_FLAGS([-Wall])
 
 if test "${enable_pedantic}" = "yes"; then
-- 
2.17.1

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to