From patchwork Tue Mar 11 21:24:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Behan Webster X-Patchwork-Id: 26049 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DEEA4202E1 for ; Tue, 11 Mar 2014 21:25:10 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id b6sf6183235yha.8 for ; Tue, 11 Mar 2014 14:25:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=pwL+0wSXoidaZaLTWYU09ef8p0AHaUUMJzs6AMFLR5M=; b=MJtFSoElclGfJPKlmrH0AeS6PBJPL3UOrk4rOo8tR/tbc1czoyiemWSgzrvkvnoE/1 PCb2hNYX1kM1BeTcHdw1QUaIwCXKxJEqyd/tjZJ/a47UJZzClIZ576bj9TXNBX+jTJOF F4CVTACAj37rpMvcthCp2DPQVzEsOFT3p7coetWhsUKwb/IHQfWmE43/bOCbukcw1Tav 7m50phcdMbFTkyBY53Hh7brlWuDaIop4yWhL5kkumN5wkBdVtrkeONKlYTV9vuxz5Lu1 wTLuY4+vajTYs2GYRShG/+pu5uL5rfrwCwlPJKoeKyZ35cXTwJNct1nOiNWuZycQ6QQ5 /tHg== X-Gm-Message-State: ALoCoQk0kGhlRGgYwWzaGC1+5AHjd81+ZknLcqylufwRNM6pEqLvpSqOwWkima3+fvfiYVqgzit9 X-Received: by 10.236.39.99 with SMTP id c63mr16166883yhb.31.1394573110678; Tue, 11 Mar 2014 14:25:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.92.133 with SMTP id b5ls2222129qge.38.gmail; Tue, 11 Mar 2014 14:25:10 -0700 (PDT) X-Received: by 10.221.40.10 with SMTP id to10mr10166357vcb.22.1394573110590; Tue, 11 Mar 2014 14:25:10 -0700 (PDT) Received: from mail-vc0-x22e.google.com (mail-vc0-x22e.google.com [2607:f8b0:400c:c03::22e]) by mx.google.com with ESMTPS id g4si6154017vch.73.2014.03.11.14.25.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Mar 2014 14:25:10 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c03::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c03::22e; Received: by mail-vc0-f174.google.com with SMTP id ld13so3985271vcb.33 for ; Tue, 11 Mar 2014 14:25:10 -0700 (PDT) X-Received: by 10.52.11.100 with SMTP id p4mr179884vdb.52.1394573110475; Tue, 11 Mar 2014 14:25:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp235239vck; Tue, 11 Mar 2014 14:25:09 -0700 (PDT) X-Received: by 10.66.159.194 with SMTP id xe2mr420092pab.33.1394573109162; Tue, 11 Mar 2014 14:25:09 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dj5si210017pad.203.2014.03.11.14.25.08; Tue, 11 Mar 2014 14:25:08 -0700 (PDT) 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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755643AbaCKVZA (ORCPT + 26 others); Tue, 11 Mar 2014 17:25:00 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:43566 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754289AbaCKVY6 (ORCPT ); Tue, 11 Mar 2014 17:24:58 -0400 Received: by mail-pd0-f181.google.com with SMTP id p10so115150pdj.12 for ; Tue, 11 Mar 2014 14:24:58 -0700 (PDT) X-Received: by 10.68.93.132 with SMTP id cu4mr402016pbb.129.1394573098351; Tue, 11 Mar 2014 14:24:58 -0700 (PDT) Received: from localhost.localdomain ([207.6.123.58]) by mx.google.com with ESMTPSA id iq10sm498807pbc.14.2014.03.11.14.24.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Mar 2014 14:24:56 -0700 (PDT) From: behanw@converseincode.com To: khali@linux-fr.org, rostedt@goodmis.org Cc: rusty@rustcorp.com.au, linux-kernel@vger.kernel.org, dwmw2@infradead.org, pageexec@freemail.hu, Mark Charlebois , Behan Webster Subject: [PATCH v3] module: LLVMLinux: Remove unused function warning from __param_check macro Date: Tue, 11 Mar 2014 14:24:51 -0700 Message-Id: <1394573091-4705-1-git-send-email-behanw@converseincode.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <87y50hw9go.fsf@rustcorp.com.au> References: <87y50hw9go.fsf@rustcorp.com.au> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: behanw@converseincode.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c03::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (bad format) header.i=@converseincode.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mark Charlebois This code makes a compile time type check that is optimized away. Clang complains that it generates an unused function: linux/kernel/panic.c:471:1: warning: unused function '__check_panic' [-Wunused-function] core_param(panic, panic_timeout, int, 0644); ^ linux/moduleparam.h:283:2: note: expanded from macro 'core_param' param_check_##type(name, &(var)); \ ^ :87:1: note: expanded from here param_check_int ^ linux/moduleparam.h:369:34: note: expanded from macro 'param_check_int' #define param_check_int(name, p) __param_check(name, p, int) ^ linux/moduleparam.h:349:22: note: expanded from macro '__param_check' static inline type *__check_##name(void) { return(p); } ^ :88:1: note: expanded from here __check_panic GCC won't complain for a static inline function but would if it was just a static function. Adding the unused attribute to the function declaration removes the warning. Per request from Rusty Russell it is marked as __always_unused as the code is meant to be optimized away. This code works for both GCC and clang. Signed-off-by: Mark Charlebois Signed-off-by: Behan Webster --- include/linux/moduleparam.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index c3eb102..175f699 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -346,7 +346,7 @@ static inline void destroy_params(const struct kernel_param *params, /* The macros to do compile-time type checking stolen from Jakub Jelinek, who IIRC came up with this idea for the 2.4 module init code. */ #define __param_check(name, p, type) \ - static inline type *__check_##name(void) { return(p); } + static inline type __always_unused *__check_##name(void) { return(p); } extern struct kernel_param_ops param_ops_byte; extern int param_set_byte(const char *val, const struct kernel_param *kp);