| Message ID | 20180126105803.26646-1-steffan@karger.me |
|---|---|
| State | Changes Requested |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net> Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director5.mail.ord1d.rsapps.net ([172.28.255.1]) by backend31.mail.ord1d.rsapps.net (Dovecot) with LMTP id DPHyDAoKa1p4EgAAgoeIoA for <patchwork@openvpn.net>; Fri, 26 Jan 2018 05:59:22 -0500 Received: from director9.mail.ord1c.rsapps.net ([172.28.255.1]) by director5.mail.ord1d.rsapps.net (Dovecot) with LMTP id YybMGwoKa1pbEgAAsdCWiw ; Fri, 26 Jan 2018 05:59:22 -0500 Received: from smtp55.gate.ord1a ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by director9.mail.ord1c.rsapps.net (Dovecot) with LMTP id v1YyAAoKa1o4fQAA4V03VA ; Fri, 26 Jan 2018 05:59:22 -0500 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.34.181.88] Authentication-Results: smtp55.gate.ord1a.rsapps.net; iprev=pass policy.iprev="216.34.181.88"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=karger-me.20150623.gappssmtp.com; dmarc=none (p=nil; dis=none) header.from=karger.me X-Classification-ID: f6c1761c-0287-11e8-9365-a4badb2864f3-1-1 Received: from [216.34.181.88] ([216.34.181.88:46326] helo=lists.sourceforge.net) by smtp55.gate.ord1a.rsapps.net (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id C8/BE-15209-90A0B6A5; Fri, 26 Jan 2018 05:59:22 -0500 Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.89) (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) id 1ef1i8-0003Uq-PX; Fri, 26 Jan 2018 10:58:20 +0000 Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from <steffan@karger.me>) id 1ef1i6-0003Ua-9m for openvpn-devel@lists.sourceforge.net; Fri, 26 Jan 2018 10:58:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=xNI5jCm+s83HsZdcCPO63EzkrXCdXOcCD9h9Ko2MdHA=; b=kmZU7pue7j/6jvM8Styt3q0V69 WxshyqZbQ/9igVM6zWjFGmrVtoPR9EiHEAyJzC82V/5RbPxeUSYvFnz8iW+Jn9bqRyfzQhmme1d3N 6wq5tfPrpOuCxNy2nQGtO8uOmB1W/Fd7WOXebEjvGhjHUpvLTlKQWLYzKfXfW5rbzk58=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To :MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=xNI5jCm+s83HsZdcCPO63EzkrXCdXOcCD9h9Ko2MdHA=; b=kQlzyVBSrwSRVruc3J+vc0bZmY HGCwJvrChtKB064vAKzCrQIDuhgSYKuEdoyb5TIAWpAGY+jpxxSx9bjXPBOAmddAlfqMqY5I5A1X1 i1d8TqE7OMAhzTpDALlutVF+oRE+gaaI26G0LBnEyjwLa9pY7FrmX4H8gkMJuiaHQw4o=; Received: from mail-wm0-f66.google.com ([74.125.82.66]) by sfi-mx-3.v28.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) id 1ef1i2-0004mo-Sl for openvpn-devel@lists.sourceforge.net; Fri, 26 Jan 2018 10:58:18 +0000 Received: by mail-wm0-f66.google.com with SMTP id x4so34734065wmc.0 for <openvpn-devel@lists.sourceforge.net>; Fri, 26 Jan 2018 02:58:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=karger-me.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xNI5jCm+s83HsZdcCPO63EzkrXCdXOcCD9h9Ko2MdHA=; b=pG2JiD5Jf0rsGWYVlesLEhVTscetTAaPnEGncfaZHl36eBeVq2Om3j29chRO4HugbC bu34kt8jx6zRkNKmaIh8owJV0qsw0Jh/2uQTLn8Z8wlREUAmxXoewkvVK+NZZUQ64scW edtkD29DzP6CWIOsOHNPqDv6ndAc9Y2F+31oqDiUjijxZLO0rvBXg14oQn8vByB1S0bo FQGR6iLJY6iNmNkSSuuZVbGWUvUMujfGE6KySIPVNbicr/7m1kegU1yujPIFjAwJxp3i tdboD0ZmrpfpS6LA/6KGSDjdwkfCiA/HAe9OPHDmAffNCJBQWvyhuwPkZo7ySgBKsqL4 WLWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xNI5jCm+s83HsZdcCPO63EzkrXCdXOcCD9h9Ko2MdHA=; b=o+lMFBtaSi5XSYo8INRZkwe7im56mti0eVO9+ABnT6s4qMjDwcBZdE1fizpuEVRIk0 rnSfF3jP+esBPbSPcpWjeq18KZwjS7et4k0P6mJE0TQjD3H/hX4ccCOHzPPHOZopsMpm RTRcY+ISyLl/LhScipKgVbJaGGS7AVOY4h0rWlFV2BlTp6ECvGyRzoWaIlTcWkDO/TTC MyjeYMHY0srBZq11aoWLDaf8jGuHCul75oQ15XyOExmeszsHza/jTEBP0e+kyBhkrGZG BzxjnQxMawEYlRqk6CHKNbJMwWGeXdbzzbLwUXd0tLwiX2YZt/7Hhr+74xYvq3+ysbET Ayog== X-Gm-Message-State: AKwxytfNoY+m9z+FzdE2IUb0XuuKdyFiqFmWByMpTqFYNag/UNuSl+72 d1C1NeCinNCGzuvJDJ0dErxdnRV3SQc= X-Google-Smtp-Source: AH8x227EC5re8limlLxHOHzAX/VVEO091NBngiWqWkWjeJ4Y6ngopnlhPRS20qi2Hz6SY9m/wAhC+A== X-Received: by 10.80.188.6 with SMTP id j6mr33996864edh.241.1516964288315; Fri, 26 Jan 2018 02:58:08 -0800 (PST) Received: from vesta.fritz.box ([2001:985:e54:1:8848:5cdb:3a76:ee95]) by smtp.gmail.com with ESMTPSA id u4sm2226483edc.91.2018.01.26.02.58.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 02:58:07 -0800 (PST) From: Steffan Karger <steffan@karger.me> To: openvpn-devel@lists.sourceforge.net Date: Fri, 26 Jan 2018 11:58:03 +0100 Message-Id: <20180126105803.26646-1-steffan@karger.me> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180120164114.12478-1-steffan@karger.me> References: <20180120164114.12478-1-steffan@karger.me> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.125.82.66 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1ef1i2-0004mo-Sl Subject: [Openvpn-devel] [PATCH v2] Enable stricter compiler warnings by default X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: <openvpn-devel.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel> List-Post: <mailto:openvpn-devel@lists.sourceforge.net> List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox |
| Series |
[Openvpn-devel,v2] Enable stricter compiler warnings by default
|
|
Commit Message
Steffan Karger
Jan. 25, 2018, 11:58 p.m. UTC
This by default enables the compiler warnings one could previously
enable using the --enable-strict configure option. I think it is
okay to do so now, because we've taken care of many warnings in the
more standard builds. (Most of those were totally harmless, but they
prevented us from spotting new more serious mistakes.)
The --enable-strict flag now enables two extra warning flags that I
think can be useful:
-Wsign-compare warns when the compiler promotes a signed type to
unsigned before comparing, which can lead to unexpected behaviour.
-Wuninitialized adds extra warnings about usage of uninitialized variables
or struct elements.
Signed-off-by: Steffan Karger <steffan@karger.me>
---
v2: Just move forward with warnings, don't add --disable-strict.
configure.ac | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
Hi, On Fri, Jan 26, 2018 at 5:58 AM, Steffan Karger <steffan@karger.me> wrote: > This by default enables the compiler warnings one could previously > enable using the --enable-strict configure option. I think it is > okay to do so now, because we've taken care of many warnings in the > more standard builds. (Most of those were totally harmless, but they > prevented us from spotting new more serious mistakes.) > > The --enable-strict flag now enables two extra warning flags that I > think can be useful: > > -Wsign-compare warns when the compiler promotes a signed type to > unsigned before comparing, which can lead to unexpected behaviour. > > -Wuninitialized adds extra warnings about usage of uninitialized variables > or struct elements. > > Signed-off-by: Steffan Karger <steffan@karger.me> > --- > v2: Just move forward with warnings, don't add --disable-strict. > > configure.ac | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/configure.ac b/configure.ac > index 2c1937e5..4d415565 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -1292,13 +1292,14 @@ if test "${enable_pkcs11}" = "yes"; then > ) > fi > > +CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function" As this is added by default (not in response to --enable/--disable directives), may be better to prepend to user's CFLAGS? I'm not sure what the standard practice is, though.. Considering the complexity of configury, preserving user's input is hard, so may be ok like this. > if test "${enable_pedantic}" = "yes"; then > enable_strict="yes" > CFLAGS="${CFLAGS} -pedantic" > AC_DEFINE([PEDANTIC], [1], [Enable pedantic mode]) > fi > if test "${enable_strict}" = "yes"; then > - CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function" > + CFLAGS="${CFLAGS} -Wsign-compare -Wuninitialized" I'm no fan of -Wsign-compare, but it does warn against some sloppy coding, is not on by default, so fine by me. And, I very much like -Wall -Wno-unused-foo becoming the "new normal". Just one thing: if we support compilers other than gcc/clang (say, xlc) this would need a test like AX_CHECK_COMPILE_FLAG(). Otherwise looks good. Selva ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi, On 27-01-18 17:47, Selva Nair wrote: > As this is added by default (not in response to --enable/--disable > directives), may be better to prepend to user's CFLAGS? I'm not sure > what the standard practice is, though.. Considering the complexity of > configury, preserving user's input is hard, so may be ok like this. Good point. I'll send a v3 with CFLAGS last (for default flags). > Just one thing: if we support compilers other than gcc/clang (say, > xlc) this would need a test like AX_CHECK_COMPILE_FLAG(). Hm, I don't think we do for configure.ac. We do sort-of support MSVC, but that doesn't use this build system. Gert, David, any opinions? -Steffan ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi, On Thu, Feb 01, 2018 at 07:34:44AM +0100, Steffan Karger wrote: > > Just one thing: if we support compilers other than gcc/clang (say, > > xlc) this would need a test like AX_CHECK_COMPILE_FLAG(). > > Hm, I don't think we do for configure.ac. We do sort-of support MSVC, > but that doesn't use this build system. Gert, David, any opinions? Well, on systems that have no gcc, configure will use whatever it finds - on Solaris this could be some Sun CC, on AIX it will be xlc. We should not break that gratuitously. So, gcc-specific flags need a test on whether they work with "OS cc" gert
On 01-02-18 16:45, Steffan Karger wrote: > +AX_CHECK_COMPILE_FLAG( > + [-Wno-unused-function], > + [CFLAGS="-Wno-unused-function ${CFLAGS}"] > +) > +AX_CHECK_COMPILE_FLAG( > + [-Wno-unused-parameter], > + [CFLAGS="-Wno-unused-parameter ${CFLAGS}"] > +) Gah, those should have been tab-indented like the surrounding code. If all else looks good, maybe the committed can fix that when applying? O-) -Steffan ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
diff --git a/configure.ac b/configure.ac index 2c1937e5..4d415565 100644 --- a/configure.ac +++ b/configure.ac @@ -1292,13 +1292,14 @@ if test "${enable_pkcs11}" = "yes"; then ) fi +CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function" if test "${enable_pedantic}" = "yes"; then enable_strict="yes" CFLAGS="${CFLAGS} -pedantic" AC_DEFINE([PEDANTIC], [1], [Enable pedantic mode]) fi if test "${enable_strict}" = "yes"; then - CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function" + CFLAGS="${CFLAGS} -Wsign-compare -Wuninitialized" fi if test "${enable_werror}" = "yes"; then CFLAGS="${CFLAGS} -Werror"