Message ID | 20170613082600.24910-3-philipp.psurek@gmail.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Simon Wunderlich |
Headers |
Return-Path: <b.a.t.m.a.n-bounces@lists.open-mesh.org> X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 4B51F820FD; Tue, 13 Jun 2017 13:09:02 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kzzJx5ie"; dkim-atps=neutral Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) by open-mesh.org (Postfix) with ESMTPS id 9627D8075E for <b.a.t.m.a.n@lists.open-mesh.org>; Tue, 13 Jun 2017 10:26:50 +0200 (CEST) Received: by mail-wr0-x241.google.com with SMTP id e23so27671810wre.3 for <b.a.t.m.a.n@lists.open-mesh.org>; Tue, 13 Jun 2017 01:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vRh77KsYUpRv+r373tg8NN/wWoTktSDR4qhTogpcjOY=; b=kzzJx5ie2H4UfYTAOIiD7ol5sHvdH6mlbC85pUSGuaYehcH+Pd+eoqaKSTMJ26ll6E s+r4+vDZJ0ibnSWIlDxPsZMid+xBpoUKWQmrywkF2BlauQ1QMxLgQozHlikh3VwBb/s6 XO+gqJ6j4V8xoH7ob9z8Jh+bbvXW0PEe/PTTOr5zKf8kBah/bv7VhNoA0xcvgGGG8Kb+ kbleVHqWpbGaCD8xtVk+bGZuTpBZrzQR6EKGEINlSNkokJ7LGlJNvOAUTzGaj1soQmtM IwbGuNu1AQwiy4F0Iu8pBiYhd19B6M0IodpFjKixIM1cCEJxFPjFFdLaYvT1UsgCHwuZ P5xw== 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:mime-version:content-transfer-encoding; bh=vRh77KsYUpRv+r373tg8NN/wWoTktSDR4qhTogpcjOY=; b=GPwoKGYGgsvAs2Tn6JZlrOWrzJz9HqT64pAin2XWRwa33SqXtT0ZpOravJIhOlq8ZO bqp9b73U8qFVvaGUvlrf2ZaRisFszsO4hKBAnqfnqBB/yRgOp6R+YC0d4GlHimzPrGxZ jbahAjeGnTSzg6spZ1aOEczZWHYb6Zxj/gf6O5mUpnzHBcg4EkQtf6VehZ2NfDY2iKE+ eya5yFIPZxBKJwbk/684QKcP/PwuE2H2DIPVsuTCeOK6hY9OoS4FItRhkhfknrmOkc0r pgkTX9devpwDMrvdp8LbBM3oSs7Q8N8D28pxMHmdSofjPSt6HKxEid7d5sfvreZ1DbnY YlCg== X-Gm-Message-State: AKS2vOyhNOtJ+8PCISHSUBXpqrj2YljwI9zSObUkLz0s6ruH6GuNnweA p9cBwNESSVgwApB0 X-Received: by 10.28.169.131 with SMTP id s125mr1799726wme.4.1497342409986; Tue, 13 Jun 2017 01:26:49 -0700 (PDT) Received: from soli.hausnetz (dslb-088-077-242-209.088.077.pools.vodafone-ip.de. [88.77.242.209]) by smtp.gmail.com with ESMTPSA id 135sm13921776wmy.11.2017.06.13.01.26.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Jun 2017 01:26:49 -0700 (PDT) From: Philipp Psurek <philipp.psurek@gmail.com> To: b.a.t.m.a.n@lists.open-mesh.org Date: Tue, 13 Jun 2017 10:26:00 +0200 Message-Id: <20170613082600.24910-3-philipp.psurek@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170613082600.24910-1-philipp.psurek@gmail.com> References: <1496077749.5980.2.camel@gmail.com> <20170613082600.24910-1-philipp.psurek@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [B.A.T.M.A.N.] [PATCH 2/2] batctl: suppress implicit-fallthrough compiler warning X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking <b.a.t.m.a.n.lists.open-mesh.org> List-Unsubscribe: <https://lists.open-mesh.org/mm/options/b.a.t.m.a.n>, <mailto:b.a.t.m.a.n-request@lists.open-mesh.org?subject=unsubscribe> List-Archive: <http://lists.open-mesh.org/pipermail/b.a.t.m.a.n/> List-Post: <mailto:b.a.t.m.a.n@lists.open-mesh.org> List-Help: <mailto:b.a.t.m.a.n-request@lists.open-mesh.org?subject=help> List-Subscribe: <https://lists.open-mesh.org/mm/listinfo/b.a.t.m.a.n>, <mailto:b.a.t.m.a.n-request@lists.open-mesh.org?subject=subscribe> Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking <b.a.t.m.a.n@lists.open-mesh.org> Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" <b.a.t.m.a.n-bounces@lists.open-mesh.org> |
Series |
[1/2] batctl: change PATH_BUFF_LEN to maximal possible value
|
|
Commit Message
Philipp Psurek
June 13, 2017, 8:26 a.m. UTC
GCC 7.1.0 complains about an intended fallthrough.
“__attribute__ ((fallthrough))” in this part of code would suppress this
warning. Because older GCC compiler don’t understand this statement attribute
and because there is already a comment in the source containing
“falls?[ \t-]*thr(ough|u)” we can suppress the warning with the
“-Wimplicit-fallthrough=2” warning option. Unintended fallthroughs without a
comment will trigger this warning.
Older GCC compiler don’t understand this warning option and exits with error.
There has to be a compiler recognition after that only GCC =>7.1.0 receives
this option.
Signed-off-by: Philipp Psurek <philipp.psurek@gmail.com>
---
Makefile | 5 +++++
1 file changed, 5 insertions(+)
Comments
On Tuesday, June 13, 2017 10:26:00 AM CEST Philipp Psurek wrote: > GCC 7.1.0 complains about an intended fallthrough. > “__attribute__ ((fallthrough))” in this part of code would suppress this > warning. Because older GCC compiler don’t understand this statement > attribute and because there is already a comment in the source containing > “falls?[ \t-]*thr(ough|u)” we can suppress the warning with the > “-Wimplicit-fallthrough=2” warning option. Unintended fallthroughs without a > comment will trigger this warning. > > Older GCC compiler don’t understand this warning option and exits with > error. There has to be a compiler recognition after that only GCC =>7.1.0 > receives this option. > > Signed-off-by: Philipp Psurek <philipp.psurek@gmail.com> > --- > Makefile | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/Makefile b/Makefile > index 6bebb7d..29b7e2f 100755 > --- a/Makefile > +++ b/Makefile > @@ -101,6 +101,11 @@ MKDIR ?= mkdir -p > COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c > LINK.o = $(Q_LD)$(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH) > > +# Check for GCC >=7 > +ifeq ($(shell $(CC) -x c++ --std=c++17 -E -P - <<< __cplusplus),201703L) > + CFLAGS += -Wimplicit-fallthrough=2 > +endif > + Hmm, I don't like this one too much, since it looks cryptic and we will have to add up new versions, which I'd like to avoid. Did you try to change the wording? I've googled a bit and it seems a comment containing the wording "fallthrough" will avoid it. Maybe we should just change "fall through" to "fallthrough"? Thanks, Simon
Am Dienstag, den 13.06.2017, 10:48 +0200 schrieb Simon Wunderlich: > Hmm, I don't like this one too much, since it looks cryptic and we > will have to add up new versions, which I'd like to avoid. > > Did you try to change the wording? I've googled a bit and it seems a > comment containing the wording "fallthrough" will avoid it. Maybe we should > just change "fall through" to "fallthrough"? I also read about the wording but for some reason I do not want to change the comment; because the many changes I tried were not recognized without a compiler warning option in conjunction with the complete comment. The now provided patch is recognized but the comment looks a little bit messed up. It works if you don't mind the formatting of the code. Thanks for the opportunity to contribute something to B.A.T.M.A.N.-Advanced. Best regards, Philipp
Sorry for the many posts but this one works also; the comment has to be definitely split up into two parts if you do not want to append warning options to the compiler.
diff --git a/Makefile b/Makefile index 6bebb7d..29b7e2f 100755 --- a/Makefile +++ b/Makefile @@ -101,6 +101,11 @@ MKDIR ?= mkdir -p COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c LINK.o = $(Q_LD)$(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH) +# Check for GCC >=7 +ifeq ($(shell $(CC) -x c++ --std=c++17 -E -P - <<< __cplusplus),201703L) + CFLAGS += -Wimplicit-fallthrough=2 +endif + # standard install paths PREFIX = /usr/local SBINDIR = $(PREFIX)/sbin