Re: [Openvpn-devel] [PATCH] fix clang warning about missing braces

2019-11-29 Thread David Sommerseth
On 29/11/2019 12:37, Gert Doering wrote:
> Hi,
> 
> On Fri, Nov 29, 2019 at 12:25:13PM +0100, David Sommerseth wrote:
>> On 29/11/2019 11:52, Gert Doering wrote:
>>> On Fri, Nov 29, 2019 at 11:47:02AM +0100, David Sommerseth wrote:
 With GCC-4.3.8, I see this warning:
>>>
>>> This is about as old as you :-) - do we care about suppressing warnings
>>> in old gcc versions that might suppress a *relevant* warning when
>>> compiling with a current gcc version?
>>
>> This is the default compiler on stock RHEL-7 ... which goes EOL August 2024.
> 
> We're not going to break it.
> 
> I'm just not going to care very much about the warnings it might throw
> (and I might object to any patches that are "just for the benefit of
> suppressing warnings from gcc-4").

Fair enough.  But that will actually restrain us from adding -Werror by
default for some time forward, unless we want to make package maintenance a
bit more tricky - needing to revert a -Werror chage or add
-Wno-missing-braces.  If we have status quo for the moment, I can live with
that until RHEL-7 is EOL.


-- 
kind regards,

David Sommerseth
OpenVPN Inc




signature.asc
Description: OpenPGP digital signature
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH] fix clang warning about missing braces

2019-11-29 Thread Gert Doering
Hi,

On Fri, Nov 29, 2019 at 12:25:13PM +0100, David Sommerseth wrote:
> On 29/11/2019 11:52, Gert Doering wrote:
> > On Fri, Nov 29, 2019 at 11:47:02AM +0100, David Sommerseth wrote:
> >> With GCC-4.3.8, I see this warning:
> > 
> > This is about as old as you :-) - do we care about suppressing warnings
> > in old gcc versions that might suppress a *relevant* warning when
> > compiling with a current gcc version?
> 
> This is the default compiler on stock RHEL-7 ... which goes EOL August 2024.

We're not going to break it.

I'm just not going to care very much about the warnings it might throw
(and I might object to any patches that are "just for the benefit of
suppressing warnings from gcc-4").

gert
-- 
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
 Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany g...@greenie.muc.de


signature.asc
Description: PGP signature
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH] fix clang warning about missing braces

2019-11-29 Thread David Sommerseth
On 29/11/2019 11:52, Gert Doering wrote:
> Hi,
> 
> On Fri, Nov 29, 2019 at 11:47:02AM +0100, David Sommerseth wrote:
>> With GCC-4.3.8, I see this warning:
> 
> This is about as old as you :-) - do we care about suppressing warnings
> in old gcc versions that might suppress a *relevant* warning when
> compiling with a current gcc version?

This is the default compiler on stock RHEL-7 ... which goes EOL August 2024.


-- 
kind regards,

David Sommerseth
OpenVPN Inc




signature.asc
Description: OpenPGP digital signature
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH] fix clang warning about missing braces

2019-11-29 Thread Gert Doering
Hi,

On Fri, Nov 29, 2019 at 11:47:02AM +0100, David Sommerseth wrote:
> With GCC-4.3.8, I see this warning:

This is about as old as you :-) - do we care about suppressing warnings
in old gcc versions that might suppress a *relevant* warning when
compiling with a current gcc version?

gert
-- 
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
 Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany g...@greenie.muc.de


signature.asc
Description: PGP signature
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH] fix clang warning about missing braces

2019-11-29 Thread Lev Stipakov
I upgraded clang to 9.0 and warning disappeared.

https://travis-ci.org/lstipakov/openvpn/builds/618527918

Patch is on the list.

to 28. marrask. 2019 klo 21.44 Gert Doering (g...@greenie.muc.de) kirjoitti:

> 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.
>
> gert
>
> --
> "If was one thing all people took for granted, was conviction that if you
>  feed honest figures into a computer, honest figures come out. Never
> doubted
>  it myself till I met a computer with a sense of humor."
>  Robert A. Heinlein, The Moon is a Harsh
> Mistress
>
> Gert Doering - Munich, Germany
> g...@greenie.muc.de
> ___
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
>


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


Re: [Openvpn-devel] [PATCH] fix clang warning about missing braces

2019-11-29 Thread David Sommerseth
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 
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 
---
 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



signature.asc
Description: OpenPGP digital signature
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH] fix clang warning about missing braces

2019-11-28 Thread Gert Doering
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.

gert

-- 
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
 Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany g...@greenie.muc.de


signature.asc
Description: PGP signature
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH] fix clang warning about missing braces

2019-11-28 Thread Selva Nair
Hi

On Thu, Nov 28, 2019 at 10:23 AM Steffan Karger <
steffan.kar...@foxcrypto.com> wrote:

> On 28-11-2019 09:06, Lev Stipakov wrote:
> > A struct with subobjects should be initialized
> > with double braces.
>
> This is not true. {0} is a valid initializer for structs in C. Both
> clang and gcc used to have a bug where they incorrectly warned about
> this. GCC fixed this a while ago[0]. I thought clang had fixed it too
> recently, but apparently not?
>

Pretty much same as my thoughts.

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 :)

That said, it seems clang has fixed this some time after clang-7.
I don't get this warning anymore after upgrading to clang-9.

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


Re: [Openvpn-devel] [PATCH] fix clang warning about missing braces

2019-11-28 Thread Steffan Karger
On 28-11-2019 09:06, Lev Stipakov wrote:
> A struct with subobjects should be initialized
> with double braces.

This is not true. {0} is a valid initializer for structs in C. Both
clang and gcc used to have a bug where they incorrectly warned about
this. GCC fixed this a while ago[0]. I thought clang had fixed it too
recently, but apparently not?

-Steffan

[0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119


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