From patchwork Thu Apr 30 15:45:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Torvalds X-Patchwork-Id: 6305311 Return-Path: X-Original-To: patchwork-linux-sparse@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 61BA59F373 for ; Thu, 30 Apr 2015 15:45:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C7DFD201B9 for ; Thu, 30 Apr 2015 15:45:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0010A20155 for ; Thu, 30 Apr 2015 15:45:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751184AbbD3Ppl (ORCPT ); Thu, 30 Apr 2015 11:45:41 -0400 Received: from mail-ie0-f172.google.com ([209.85.223.172]:34194 "EHLO mail-ie0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750809AbbD3Ppk (ORCPT ); Thu, 30 Apr 2015 11:45:40 -0400 Received: by iedfl3 with SMTP id fl3so79094391ied.1 for ; Thu, 30 Apr 2015 08:45:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=ASj5qzdUsrCVDNjncptys2kVFKDkpr/FzYEqpQddJOA=; b=XoH5JrL70AS4Vs+netzQQmRlG0RRUadBRV1F89brDtUlQhE/+k5PYG6+8Q8K1pD6CY y0PeV7MGUl5nh+G7Tk5jTXND8uL2sGjGOBIBE06yZwbfPcu5hjbZwI/Lrf5SsvowtC1d D+4F5JS/s32e83MhaUKgRje28Nh2LIDw2RbvBew1stp/lBpacz8yN98G4taWXRl7E7M1 Wx7n7qCQNZbBzSiXnYZjHWInVvxAqkD1DeBxQVnPtyibgdULFL694dRW4BKSy22OkZ4t QMIcReYMtHG2o92KMVIz87v++MNzNuGVL6HbZHrUAj134izR/e8s9TREz9k5cKzwG8yr 22Zw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=ASj5qzdUsrCVDNjncptys2kVFKDkpr/FzYEqpQddJOA=; b=Ccxsv+eJr3DG0IajbwK6R1DuMoCjA+uSqiI0T8reoQAXsjWxCQ9UMkAkSQozGu5sq7 G4W4QoXeNkWcz6+76LuHM0pXXOZEtVxVs7PSH8vaTm4Rdh9zlD84Ildv3/xDmzrmSkkc Wwcr0Gts7ZfpnYdJkdsWG0j6cJJlMrKEonGh4= MIME-Version: 1.0 X-Received: by 10.50.122.39 with SMTP id lp7mr4394068igb.24.1430408739799; Thu, 30 Apr 2015 08:45:39 -0700 (PDT) Received: by 10.36.53.141 with HTTP; Thu, 30 Apr 2015 08:45:33 -0700 (PDT) In-Reply-To: <1430218119-58354-1-git-send-email-heiko.carstens@de.ibm.com> References: <1430218119-58354-1-git-send-email-heiko.carstens@de.ibm.com> Date: Thu, 30 Apr 2015 08:45:33 -0700 X-Google-Sender-Auth: cf72EiTD-rNrRtppsVczr-wpRyc Message-ID: Subject: Re: [PATCH] sparse/parse.c: ignore hotpatch attribute From: Linus Torvalds To: Heiko Carstens Cc: Christopher Li , Sparse Mailing-list Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Apr 28, 2015 at 3:48 AM, Heiko Carstens wrote: > gcc knows about a new "hotpatch" attribute which sparse can safely ignore, > since it modifies only which code will be generated just like the > "no_instrument_function" attribute. I'm wondering if sparse should just ignore all attributes it doesn't recognize, so that we could just remove this ever-expanding list of things that don't actually matter for sparse.. The "unrecognized attribute" thing made more sense way back when - when I wanted to get he basic attributes handled. Now it's just noise... Something like the attached (mostly untested) patch.. Linus parse.c | 112 ---------------------------------------------------------------- 1 file changed, 112 deletions(-) diff --git a/parse.c b/parse.c index b43d6835528b..bab0a8e2e931 100644 --- a/parse.c +++ b/parse.c @@ -501,109 +501,6 @@ static struct init_keyword { { "__word__", NS_KEYWORD, MOD_LONG, .op = &mode_word_op }, }; -const char *ignored_attributes[] = { - "alias", - "__alias__", - "alloc_size", - "__alloc_size__", - "always_inline", - "__always_inline__", - "artificial", - "__artificial__", - "bounded", - "__bounded__", - "cdecl", - "__cdecl__", - "cold", - "__cold__", - "constructor", - "__constructor__", - "deprecated", - "__deprecated__", - "destructor", - "__destructor__", - "dllexport", - "__dllexport__", - "dllimport", - "__dllimport__", - "error", - "__error__", - "externally_visible", - "__externally_visible__", - "fastcall", - "__fastcall__", - "format", - "__format__", - "format_arg", - "__format_arg__", - "gnu_inline", - "__gnu_inline__", - "hot", - "__hot__", - "leaf", - "__leaf__", - "l1_text", - "__l1_text__", - "l1_data", - "__l1_data__", - "l2", - "__l2__", - "malloc", - "__malloc__", - "may_alias", - "__may_alias__", - "model", - "__model__", - "ms_abi", - "__ms_abi__", - "ms_hook_prologue", - "__ms_hook_prologue__", - "naked", - "__naked__", - "no_instrument_function", - "__no_instrument_function__", - "noclone", - "__noclone", - "__noclone__", - "noinline", - "__noinline__", - "nonnull", - "__nonnull", - "__nonnull__", - "nothrow", - "__nothrow", - "__nothrow__", - "regparm", - "__regparm__", - "section", - "__section__", - "sentinel", - "__sentinel__", - "signal", - "__signal__", - "stdcall", - "__stdcall__", - "syscall_linkage", - "__syscall_linkage__", - "sysv_abi", - "__sysv_abi__", - "unused", - "__unused__", - "used", - "__used__", - "vector_size", - "__vector_size__", - "visibility", - "__visibility__", - "warn_unused_result", - "__warn_unused_result__", - "warning", - "__warning__", - "weak", - "__weak__", -}; - - void init_parser(int stream) { int i; @@ -617,14 +514,6 @@ void init_parser(int stream) sym->ctype.base_type = ptr->type; sym->op = ptr->op; } - - for (i = 0; i < ARRAY_SIZE(ignored_attributes); i++) { - const char * name = ignored_attributes[i]; - struct symbol *sym = create_symbol(stream, name, SYM_KEYWORD, - NS_KEYWORD); - sym->ident->keyword = 1; - sym->op = &ignore_attr_op; - } } @@ -1222,7 +1111,6 @@ static struct token *recover_unknown_attribute(struct token *token) { struct expression *expr = NULL; - sparse_error(token->pos, "attribute '%s': unknown attribute", show_ident(token->ident)); token = token->next; if (match_op(token, '(')) token = parens_expression(token, &expr, "in attribute");