From patchwork Sun Feb 12 15:10:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 9568409 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 3087D60442 for ; Sun, 12 Feb 2017 15:12:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21607237A5 for ; Sun, 12 Feb 2017 15:12:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1635326E98; Sun, 12 Feb 2017 15:12:25 +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 A0E01237A5 for ; Sun, 12 Feb 2017 15:12:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751225AbdBLPMX (ORCPT ); Sun, 12 Feb 2017 10:12:23 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36334 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751247AbdBLPMW (ORCPT ); Sun, 12 Feb 2017 10:12:22 -0500 Received: by mail-wm0-f67.google.com with SMTP id r18so14671476wmd.3 for ; Sun, 12 Feb 2017 07:12:21 -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=FyYWkFZBrhxQ7n1i5FyLk+Y3MNJOiDhMyfHTr80RfXc=; b=PZShW/4IWxbDIDHPd2DwDEb/fm1ZfJkt9i2EH2R+8YN0+zYUgXIjosG3wNNA+wAq0i ErpjlAJmWfAxKU5R+KCoJYB/C+6WN+gbN3jNaW0/ELBz+6kVS3B8LH64WVv4i7u176wm 8SakXSF/7sXcqtQl8d4b+IoQODKbe2qDA2mMJwTZC9k59dpO/DTRfUR/KcUxmA8w16Z8 1TMxdnBAy0PxDy9VHtrJPmc5l30UwXK5VGqFEVyLwCHL6wfoNTYvMXnT+AB940STCXiR 4PkCjP6GGRTJBY6dLUy/MG4UnwgPv2IkSEU/KJQY9B/kK1FJgWiEvEMVAd9v2tTwCzay 8R/Q== 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=FyYWkFZBrhxQ7n1i5FyLk+Y3MNJOiDhMyfHTr80RfXc=; b=E0yQuZYUkS5id0OIHhLKBSSI5s9sIM3R/tarsS3TG+eGfkKxM4Ddu2v8qsF4oVo1vB sjdhNKCMrPT9P03Mt1CFBhrDp2qam6e4ll7KY5HDD6f6JdOo1YQFlJZyhrvKA4Al/bhk jNFEjTXgGox9sc1aKszeiH2W35iilLHPFv+gwor/5GWpcsIeQUEEM8RMuNtcYJDlT0l/ MwQ4rwdH2567IpSDUsrUekhdqhqPlM5EY9FflA1HdxWQRh3JZGHVaP0dVnibalCEzw2R y1d20OlcTK5ySZQ3x7jU+YNnM6kiN4p43YP6Bk6geFoCfVANl8FNObXmXeBgMC+U3cVK kUog== X-Gm-Message-State: AMke39lHKQVi7LyN6vGz00DWX7gWm5xd1dVWHde/+f6812I6wo+GW4PGtnXl8eZxnj256w== X-Received: by 10.28.20.144 with SMTP id 138mr32573459wmu.41.1486912340699; Sun, 12 Feb 2017 07:12:20 -0800 (PST) Received: from localhost.localdomain ([2a02:a03f:870:3e00:1cde:6e8b:d488:2b72]) by smtp.gmail.com with ESMTPSA id q39sm7092915wrb.51.2017.02.12.07.12.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Feb 2017 07:12:20 -0800 (PST) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Christopher Li , Johannes Berg , Luc Van Oostenryck Subject: [PATCH v2 2/3] let identical symbols share their evaluate/expand methods Date: Sun, 12 Feb 2017 16:10:59 +0100 Message-Id: <20170212151100.15868-3-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170212151100.15868-1-luc.vanoostenryck@gmail.com> References: <20170212150332.33xlxmzohgb7hrpp@macpro.local> <20170212151100.15868-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 So far, builtin functions which had some evaluate/expand method couldn't also have a prototype because the declaration of the prototype and the definition of the builtin with its method would each have their own symbol and only one of them will be seen, the last one, the one for the prototype. This also meant that the evaluate/expand methods had to take care to set the correct types for they argumenst & results, which is fine for some generic builtins like __builtin_constant_p() but much less practical for the ones like __builtin_bswap{16,32,64}(). Fix this by letting symbols with same name share their methods. Originally-by: Christopher Li Signed-off-by: Luc Van Oostenryck --- parse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/parse.c b/parse.c index b65a6ebce..a4a126720 100644 --- a/parse.c +++ b/parse.c @@ -2879,8 +2879,10 @@ struct token *external_declaration(struct token *token, struct symbol_list **lis } } check_declaration(decl); - if (decl->same_symbol) + if (decl->same_symbol) { decl->definition = decl->same_symbol->definition; + decl->op = decl->same_symbol->op; + } if (!match_op(token, ',')) break;