Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp81301imu; Thu, 15 Nov 2018 22:31:57 -0800 (PST) X-Google-Smtp-Source: AJdET5f5mBgbP9pv0PwMQl9Nm+5WyZPGEYyOEmPrqigrsYlWet+Uk7kGjzn5fTuQmXM6413Br7WF X-Received: by 2002:a63:ed15:: with SMTP id d21mr8715972pgi.305.1542349917374; Thu, 15 Nov 2018 22:31:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542349917; cv=none; d=google.com; s=arc-20160816; b=vsE3RsfizS5jgzRcF7BwjVx0Y9hxZgEJqOL8eYJi6OPVX8Bn5bdD44Ilr/DQyuKRkZ m0awfU2wVGiMgZ3B6XtwA2m47LR9g1/dB9yxqxsspqqiBKUF26ZcjlDc//K/Vb9Awnoz qIgJRlFlz/i9Nr+eIJ58pYEWZSrvOMW/PtKv6PQwMVZpXmz4NOdHMKaalgiG0Je6nAZo SwapRhixoBrR6oQ2vxzur2sO7pVQGNjEf9CqCgLbelhUED9tKo37Xki8+ERvpPCQnmj3 PuICCt8VusbcapYDDMl0TGUyb8dQTe2/6idqfR/csizSz0eKkSdEi3p9WQ8m8bJ14PHW dXgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=AE9HOGag1iWONloFmWzxxe9Ll1Q5kgvlETsrHKesQQI=; b=fVtjX8FHJ9yxYV9ywKfAHSHvGIap8vh+5yMgELuhhjtbM8HqBiep+mjAJR6UTyTmqm IKTd9KgPe83t1jSbY3TDuaBTH2jBd+jJ/3qd4LZanMAQYlPc5Q7hPiK+qw0RLrLIsoA/ V1Eqq5/UV3VSjAYaevRWLmppFZ1hlmX2XCxe6y3D0nZiiAuhJnY6po4diBqyeaqA3TF6 FOU/xwFLHaLuqk/4//cDwU+zLNb2mnYU9mMr6tHQ8TXayaQZhAp4u7anwOiNTe/y3eBQ XMwdCBGPeNMdrwSlq75AACk1d+P15r4KECnc9FF7cJs258J9cDk9LqN98VL975QS+z5+ +bEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=axIo3gH5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7si9271124ply.421.2018.11.15.22.31.42; Thu, 15 Nov 2018 22:31:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=axIo3gH5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389064AbeKPQjq (ORCPT + 99 others); Fri, 16 Nov 2018 11:39:46 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:37122 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727353AbeKPQjq (ORCPT ); Fri, 16 Nov 2018 11:39:46 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id wAG6RdQR027653; Fri, 16 Nov 2018 15:27:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wAG6RdQR027653 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1542349660; bh=AE9HOGag1iWONloFmWzxxe9Ll1Q5kgvlETsrHKesQQI=; h=From:To:Cc:Subject:Date:From; b=axIo3gH550BuYi8ju/zKpAPo4jB7f8KwnMfWuFjs05q0QLVBAlwjADUfypkd4eUiQ TrjazYvtYtLe1RcW32UTiu902FVodQzx2+vBu45JC893f4z8IXhGDupn5KvvQ3TGU5 0XuBeWctGjqYoboM5soYsA/C5AOiR/Axu35otKPa8nwvbV8I/+5IsgdiDa0DnxnrMp iDo2ytrEFRSBqC8P55m3jTlQC00wBW5cDhxULlMyzY6CdxFLsz4APwKgX7CS1fQHiy CThKwQYlakP/JbtAqEm/pXS8HA5rYCj/KxtjgO31vfq8tm2Qo3t7RRE35XXN76zdFO 1xIPfAyUhYz3g== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Andrew Morton Cc: Linus Torvalds , Arnd Bergmann , Kees Cook , Nick Desaulniers , Miguel Ojeda , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] build_bug.h: remove negative-array fallback for BUILD_BUG_ON() Date: Fri, 16 Nov 2018 15:27:24 +0900 Message-Id: <1542349645-8852-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel can only be compiled with an optimization option (-O2, -Os, or the currently proposed -Og). Hence, __OPTIMIZE__ is always defined in the kernel source. The fallback for -O0 case is just hypothetical and pointless. Moreover, commit 0bb95f80a38f ("Makefile: Globally enable VLA warning") enabled -Wvla warning. The use of variable length arrays is banned. Signed-off-by: Masahiro Yamada --- Changes in v2: None include/linux/build_bug.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h index 43d1fd5..d415c64 100644 --- a/include/linux/build_bug.h +++ b/include/linux/build_bug.h @@ -51,23 +51,9 @@ * If you have some code which relies on certain constants being equal, or * some other compile-time-evaluated condition, you should use BUILD_BUG_ON to * detect if someone changes it. - * - * The implementation uses gcc's reluctance to create a negative array, but gcc - * (as of 4.4) only emits that error for obvious cases (e.g. not arguments to - * inline functions). Luckily, in 4.3 they added the "error" function - * attribute just for this type of case. Thus, we use a negative sized array - * (should always create an error on gcc versions older than 4.4) and then call - * an undefined function with the error attribute (should always create an - * error on gcc 4.3 and later). If for some reason, neither creates a - * compile-time error, we'll still have a link-time error, which is harder to - * track down. */ -#ifndef __OPTIMIZE__ -#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) -#else #define BUILD_BUG_ON(condition) \ BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) -#endif /** * BUILD_BUG - break compile if used. -- 2.7.4