From patchwork Tue Feb 13 23:21:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 10217699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9BFAA601C2 for ; Tue, 13 Feb 2018 23:21:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B18328F0E for ; Tue, 13 Feb 2018 23:21:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78BE528F6C; Tue, 13 Feb 2018 23:21:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE7FC2902F for ; Tue, 13 Feb 2018 23:21:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966064AbeBMXVT (ORCPT ); Tue, 13 Feb 2018 18:21:19 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:45437 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966007AbeBMXVS (ORCPT ); Tue, 13 Feb 2018 18:21:18 -0500 Received: by mail-wr0-f194.google.com with SMTP id h9so20241482wre.12 for ; Tue, 13 Feb 2018 15:21:17 -0800 (PST) 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; bh=Fnugtx9NHPK+uIIUpuQJSRAXbloohOFRaIk7vLtAL0U=; b=SNEcrYtW5PEUcD0dF1tjJIh8k/O7R7jSy0W8QzvAH+PuQUt7kfUfaISzUTw8isZSB8 q715QvEmz4RDM+iYmQlcuGjvEMDrtU73eEZY4biYP/CXLVr30TefN6v7nuj6gkKOFtpC eO7vmmbyaJU+738wavECeEgrbxo6I5ecW8q6xbfzov9OWfDGvgCW6MpjJwLvIl0SfevQ IA0NzVpEX8mf3Hhpi/EubmE7+X0wNe2L55Dv82b7queWghkclH7KRXPXbSxsJ9r9xaeJ /w9+T1mwlxbHo16gRUIp9KQWkPiDuyFMUMcXPuER/+3NfcfHmg+jMYSWYxkBftP7gD50 SQ6Q== 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; bh=Fnugtx9NHPK+uIIUpuQJSRAXbloohOFRaIk7vLtAL0U=; b=iWOntaNpC30N9D5L0v9mBLbwePHRkMBtvaX32QWLuSDlZ3kqVl2Vjh7c/Wnr1My3YW FHiKkIFb9IQZlTjBb+GOzPEVJpceqmTHgj/9J9/Gg0x27m0DBAOXNF0dk/Ma0WCCaWjT sgYjTAGUZTLk7WTh130GC9zUZg3XKKOYhmw2B6W5mhSJSJ8sNSPWNCB44N8sLV4aMdiv uX4e2Qb82bzT7l4C+NQ6uhpDQl0/U9GYP3oJ6S8fVlt5kxQNA6vswPLArmjNpqG2X5eR oetUbEynmU3z12jS2rHqlKqAlkCLDX40mP/kxpLWBwRz76YMFqW4rp/bUzsKQ5oZGb6d rpCQ== X-Gm-Message-State: APf1xPD6F8TsnZSlVx5gYJNZvJRIeWXuQglGQ4QEcbjq38kcDm48vo3q lNRS74lhlE4DGsji7DZgBZwaDGkh X-Google-Smtp-Source: AH8x225gbSlZvXqN4nABSZg4XkNcO6MmPRn0B6oMDS2az2+lOi5RRkutk3ZBrQz2EZhXij8SkzhJiw== X-Received: by 10.223.184.230 with SMTP id c35mr2420426wrg.190.1518564076720; Tue, 13 Feb 2018 15:21:16 -0800 (PST) Received: from localhost.localdomain ([2a02:a03f:40f4:c400:e1c3:b4b1:5ea4:9075]) by smtp.gmail.com with ESMTPSA id r70sm9913036wmg.30.2018.02.13.15.21.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 15:21:16 -0800 (PST) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Linus Torvalds , Josh Triplett , Lance Richardson , Ramsay Jones , Randy Dunlap , Rui Teng , Christopher Li , Luc Van Oostenryck Subject: [RFC PATCH 2/2] drop the concept of 'known-but-ignored' attributes Date: Wed, 14 Feb 2018 00:21:09 +0100 Message-Id: <20180213232109.20933-3-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180213232109.20933-1-luc.vanoostenryck@gmail.com> References: <20180213232109.20933-1-luc.vanoostenryck@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since, by definition, we ignore ignored attributes, it's completely useless to keep a list of those (which needs to be updated each time gcc, clang, ... add new attributes, wich is quite often). Let's just keep things simple and stop to try to make a distinction between 'unknown' and 'ignored' attributes. We can then only care about the attributes we (need to) handle and simply ignore the others ones since we don't do anything with them anyway. Signed-off-by: Luc Van Oostenryck --- gcc-attr-list.h | 210 -------------------------------------------------------- parse.c | 42 +----------- 2 files changed, 1 insertion(+), 251 deletions(-) delete mode 100644 gcc-attr-list.h diff --git a/gcc-attr-list.h b/gcc-attr-list.h deleted file mode 100644 index e21bec4f7..000000000 --- a/gcc-attr-list.h +++ /dev/null @@ -1,210 +0,0 @@ -GCC_ATTR(BELOW100) -GCC_ATTR(OS_Task) -GCC_ATTR(OS_main) -GCC_ATTR(OS_task) -GCC_ATTR(abi_tag) -GCC_ATTR(absdata) -GCC_ATTR(address) -GCC_ATTR(alias) -GCC_ATTR(aligned) -GCC_ATTR(alloc_align) -GCC_ATTR(alloc_size) -GCC_ATTR(altivec) -GCC_ATTR(always_inline) -GCC_ATTR(artificial) -GCC_ATTR(assume_aligned) -GCC_ATTR(bank_switch) -GCC_ATTR(based) -GCC_ATTR(below100) -GCC_ATTR(bnd_instrument) -GCC_ATTR(bnd_legacy) -GCC_ATTR(bnd_variable_size) -GCC_ATTR(break_handler) -GCC_ATTR(brk_interrupt) -GCC_ATTR(callee_pop_aggregate_return) -GCC_ATTR(cb) -GCC_ATTR(cdecl) -GCC_ATTR(cleanup) -GCC_ATTR(cmse_nonsecure_call) -GCC_ATTR(cmse_nonsecure_entry) -GCC_ATTR(cold) -GCC_ATTR(common) -GCC_ATTR(common_object) -GCC_ATTR(const) -GCC_ATTR(constructor) -GCC_ATTR(critical) -GCC_ATTR(default) -GCC_ATTR(deprecated) -GCC_ATTR(designated_init) -GCC_ATTR(destructor) -GCC_ATTR(disinterrupt) -GCC_ATTR(dllexport) -GCC_ATTR(dllimport) -GCC_ATTR(eightbit_data) -GCC_ATTR(either) -GCC_ATTR(error) -GCC_ATTR(exception) -GCC_ATTR(exception_handler) -GCC_ATTR(externally_visible) -GCC_ATTR(fallthrough) -GCC_ATTR(far) -GCC_ATTR(fast_interrupt) -GCC_ATTR(fastcall) -GCC_ATTR(flatten) -GCC_ATTR(force_align_arg_pointer) -GCC_ATTR(format) -GCC_ATTR(format_arg) -GCC_ATTR(forwarder_section) -GCC_ATTR(function_vector) -GCC_ATTR(gcc_struct) -GCC_ATTR(gnu_inline) -GCC_ATTR(hidden) -GCC_ATTR(hot) -GCC_ATTR(hotpatch) -GCC_ATTR(ifunc) -GCC_ATTR(indirect_branch) -GCC_ATTR(init_priority) -GCC_ATTR(interfacearm) -GCC_ATTR(internal) -GCC_ATTR(interrupt) -GCC_ATTR(interrupt_handler) -GCC_ATTR(interrupt_thread) -GCC_ATTR(io) -GCC_ATTR(io_low) -GCC_ATTR(isr) -GCC_ATTR(keep_interrupts_masked) -GCC_ATTR(kernel) -GCC_ATTR(kspisusp) -GCC_ATTR(l1_data) -GCC_ATTR(l1_data_A) -GCC_ATTR(l1_data_B) -GCC_ATTR(l1_text) -GCC_ATTR(l2) -GCC_ATTR(leaf) -GCC_ATTR(long_call) -GCC_ATTR(longcall) -GCC_ATTR(lower) -GCC_ATTR(malloc) -GCC_ATTR(may_alias) -GCC_ATTR(maybe_unused) -GCC_ATTR(medium_call) -GCC_ATTR(micromips) -GCC_ATTR(mips16) -GCC_ATTR(mode) -GCC_ATTR(model) -GCC_ATTR(monitor) -GCC_ATTR(ms_abi) -GCC_ATTR(ms_hook_prologue) -GCC_ATTR(ms_struct) -GCC_ATTR(naked) -GCC_ATTR(near) -GCC_ATTR(nested) -GCC_ATTR(nested_ready) -GCC_ATTR(nesting) -GCC_ATTR(nmi) -GCC_ATTR(nmi_handler) -GCC_ATTR(no_address_safety_analysis) -GCC_ATTR(no_caller_saved_registers) -GCC_ATTR(no_gccisr) -GCC_ATTR(no_icf) -GCC_ATTR(no_instrument_function) -GCC_ATTR(no_profile_instrument_function) -GCC_ATTR(no_reorder) -GCC_ATTR(no_sanitize) -GCC_ATTR(no_sanitize_address) -GCC_ATTR(no_sanitize_thread) -GCC_ATTR(no_sanitize_undefined) -GCC_ATTR(no_split_stack) -GCC_ATTR(no_stack_limit) -GCC_ATTR(noclone) -GCC_ATTR(nocommon) -GCC_ATTR(nocompression) -GCC_ATTR(nodiscard) -GCC_ATTR(noinit) -GCC_ATTR(noinline) -GCC_ATTR(noipa) -GCC_ATTR(nomicromips) -GCC_ATTR(nomips16) -GCC_ATTR(nonnull) -GCC_ATTR(nonstring) -GCC_ATTR(noplt) -GCC_ATTR(noreturn) -GCC_ATTR(nosave_low_regs) -GCC_ATTR(not_nested) -GCC_ATTR(nothrow) -GCC_ATTR(notshared) -GCC_ATTR(optimize) -GCC_ATTR(packed) -GCC_ATTR(partial_save) -GCC_ATTR(patchable_function_entry) -GCC_ATTR(pcs) -GCC_ATTR(persistent) -GCC_ATTR(progmem) -GCC_ATTR(protected) -GCC_ATTR(pure) -GCC_ATTR(reentrant) -GCC_ATTR(regparm) -GCC_ATTR(renesas) -GCC_ATTR(resbank) -GCC_ATTR(reset) -GCC_ATTR(returns_nonnull) -GCC_ATTR(returns_twice) -GCC_ATTR(s390_vector_bool) -GCC_ATTR(saddr) -GCC_ATTR(save_all) -GCC_ATTR(save_volatiles) -GCC_ATTR(saveall) -GCC_ATTR(scalar_storage_order) -GCC_ATTR(sda) -GCC_ATTR(section) -GCC_ATTR(selectany) -GCC_ATTR(sentinel) -GCC_ATTR(shared) -GCC_ATTR(short_call) -GCC_ATTR(shortcall) -GCC_ATTR(signal) -GCC_ATTR(simd) -GCC_ATTR(sp_switch) -GCC_ATTR(spu_vector) -GCC_ATTR(sseregparm) -GCC_ATTR(stack_protect) -GCC_ATTR(stdcall) -GCC_ATTR(syscall_linkage) -GCC_ATTR(sysv_abi) -GCC_ATTR(target) -GCC_ATTR(target_clones) -GCC_ATTR(tda) -GCC_ATTR(thiscall) -GCC_ATTR(tiny) -GCC_ATTR(tiny_data) -GCC_ATTR(tls_model) -GCC_ATTR(transaction_callable) -GCC_ATTR(transaction_may_cancel_outer) -GCC_ATTR(transaction_pure) -GCC_ATTR(transaction_safe) -GCC_ATTR(transaction_safe_dynamic) -GCC_ATTR(transaction_unsafe) -GCC_ATTR(transaction_wrap) -GCC_ATTR(transparent_union) -GCC_ATTR(trap_exit) -GCC_ATTR(trapa_handler) -GCC_ATTR(unused) -GCC_ATTR(upper) -GCC_ATTR(use_debug_exception_return) -GCC_ATTR(use_shadow_register_set) -GCC_ATTR(used) -GCC_ATTR(vector) -GCC_ATTR(vector_size) -GCC_ATTR(version_id) -GCC_ATTR(visibility) -GCC_ATTR(vliw) -GCC_ATTR(volatile) -GCC_ATTR(wakeup) -GCC_ATTR(warm) -GCC_ATTR(warn_if_not_aligned) -GCC_ATTR(warn_unused) -GCC_ATTR(warn_unused_result) -GCC_ATTR(warning) -GCC_ATTR(weak) -GCC_ATTR(weakref) -GCC_ATTR(zda) diff --git a/parse.c b/parse.c index e255345fd..fa6f0ffc7 100644 --- a/parse.c +++ b/parse.c @@ -85,7 +85,7 @@ static attr_t attribute_bitwise, attribute_address_space, attribute_context, attribute_designated_init, - attribute_transparent_union, ignore_attribute, + attribute_transparent_union, attribute_mode, attribute_force; typedef struct symbol *to_mode_t(struct symbol *); @@ -381,10 +381,6 @@ static struct symbol_op transparent_union_op = { .attribute = attribute_transparent_union, }; -static struct symbol_op ignore_attr_op = { - .attribute = ignore_attribute, -}; - static struct symbol_op mode_QI_op = { .type = KW_MODE, .to_mode = to_QI_mode @@ -548,24 +544,6 @@ static struct init_keyword { }; -static const char *ignored_attributes[] = { - -#define GCC_ATTR(x) \ - STRINGIFY(x), \ - STRINGIFY(__##x##__), - -#include "gcc-attr-list.h" - -#undef GCC_ATTR - - "bounded", - "__bounded__", - "__noclone", - "__nonnull", - "__nothrow", -}; - - void init_parser(int stream) { int i; @@ -579,16 +557,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); - if (!sym->op) { - sym->ident->keyword = 1; - sym->op = &ignore_attr_op; - } - } } @@ -990,14 +958,6 @@ static struct token *typeof_specifier(struct token *token, struct decl_state *ct return expect(token, ')', "after typeof"); } -static struct token *ignore_attribute(struct token *token, struct symbol *attr, struct decl_state *ctx) -{ - struct expression *expr = NULL; - if (match_op(token, '(')) - token = parens_expression(token, &expr, "in attribute"); - return token; -} - static struct token *attribute_packed(struct token *token, struct symbol *attr, struct decl_state *ctx) { if (!ctx->ctype.alignment)