From patchwork Tue Jun 13 08:26:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philipp Psurek X-Patchwork-Id: 17045 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: 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 ; Tue, 13 Jun 2017 10:26:50 +0200 (CEST) Received: by mail-wr0-x241.google.com with SMTP id e23so27671810wre.3 for ; 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 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" 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 --- 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 + # standard install paths PREFIX = /usr/local SBINDIR = $(PREFIX)/sbin