From patchwork Sun Dec 16 17:21:46 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: 10732551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0AB9924 for ; Sun, 16 Dec 2018 17:22:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFACF29985 for ; Sun, 16 Dec 2018 17:22:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B40F929995; Sun, 16 Dec 2018 17:22:01 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 A40AC29993 for ; Sun, 16 Dec 2018 17:22:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730518AbeLPRWA (ORCPT ); Sun, 16 Dec 2018 12:22:00 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33651 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730614AbeLPRWA (ORCPT ); Sun, 16 Dec 2018 12:22:00 -0500 Received: by mail-wr1-f68.google.com with SMTP id c14so9996126wrr.0 for ; Sun, 16 Dec 2018 09:21:58 -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 :mime-version:content-transfer-encoding; bh=r9gAlm43EjP7ZODvqORTqawrFgZWBJ1dcwpPXiZA9V8=; b=gs88vCcsmjGVPBxAY7ZTJ2bpEIRCnaOlHh+7iMpv5mAqXjI4qzHZnLwIOwgtT/GkZY LN55/we5IgCL6rkf/9gWt2q5zNN7px9SnOzWl48504lBQgP/73te6iJjeJ6kvZkF+qfR +Y/tJbYpSrscui1KUAi7oR/5DcZZeGlsyp6E7cC1B0gD6oWe/fzs+VxH48PAxEk0g3G/ RCn7U99lGXleez+zxpRuRuakK53sA96LlIIqJzGsQsDHel+p86czroTNQnJagW9o/ezw 5YINx/7QTnx1eouxfAqBlnZEpO8CRseF2f7XeKIIx0OC7G+Eey+ORg5u2HQzoP73HaBY ZHJg== 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:mime-version:content-transfer-encoding; bh=r9gAlm43EjP7ZODvqORTqawrFgZWBJ1dcwpPXiZA9V8=; b=mgPKNRakc472XG1qSobzgbB4+0DyLIA5WHYlVGoWA+WlWmHBSPP7aIQ7PiCW+hZJ8c h9FnbjKO08zcYfrKETONMdAWyaHU5w8g8BRsSMMJ2uGZWYDwbSp4srOg+Pnfu1dDItpm EpRbO5bbfvDICyMoZMJJauLyzLThEHzkaBYzXqs9yxncR1Q5Gy4t9OrOKU5lmprwlw4D /JXGcDZd76WxXuLF9oi5g2CjDUWDeLCezHOmjOW2+oJAYftaaYZ9eXYUGDlkwkCG+3S2 1/r8GzWlfWcD1ipUGiW5V4J9Hfb4J0Ltj0MYmTe6+ZLr7T59r26CHVrj54/qGnYHam+T priQ== X-Gm-Message-State: AA+aEWZljoWCzaHRBRFuI8yggFhg2qcIKgx1AF8AiAP7mNvvhwzPdqu5 j0o0Fw9yREcDq/Brz9dM1jWdTSrM X-Google-Smtp-Source: AFSGD/VE8ZEzRkaNmAu8UJYtb8U3qgpZMXe2lDR4xKoooUFDdXtmyx6guHtIdP/gaidG2zcDslahrw== X-Received: by 2002:adf:b783:: with SMTP id s3mr8668978wre.274.1544980917526; Sun, 16 Dec 2018 09:21:57 -0800 (PST) Received: from localhost.localdomain ([2a02:a03f:4059:bc00:511d:a2f9:81d4:4b91]) by smtp.gmail.com with ESMTPSA id z17sm9064743wrv.2.2018.12.16.09.21.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Dec 2018 09:21:56 -0800 (PST) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 1/6] show-parse: strip do_show_type()'s trailing space Date: Sun, 16 Dec 2018 18:21:46 +0100 Message-Id: <20181216172151.1361-2-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181216172151.1361-1-luc.vanoostenryck@gmail.com> References: <20181216172151.1361-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 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 It's possible that the result of do_show_type() ends with a space. Strip this unneeded space. Signed-off-by: Luc Van Oostenryck --- show-parse.c | 4 ++++ validation/enum-mismatch.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/show-parse.c b/show-parse.c index b892c189b..5590dae9b 100644 --- a/show-parse.c +++ b/show-parse.c @@ -408,6 +408,10 @@ out: prepend(name, "restricted "); if (fouled) prepend(name, "fouled "); + + // strip trailing space + if (name->end > name->start && name->end[-1] == ' ') + name->end--; } void show_type(struct symbol *sym) diff --git a/validation/enum-mismatch.c b/validation/enum-mismatch.c index f698c0161..1bdb1d6c2 100644 --- a/validation/enum-mismatch.c +++ b/validation/enum-mismatch.c @@ -13,7 +13,7 @@ static enum eb foo(enum ea a) * * check-error-start enum-mismatch.c:7:16: warning: mixing different enum types -enum-mismatch.c:7:16: unsigned int enum ea versus -enum-mismatch.c:7:16: unsigned int enum eb +enum-mismatch.c:7:16: unsigned int enum ea versus +enum-mismatch.c:7:16: unsigned int enum eb * check-error-end */ From patchwork Sun Dec 16 17:21:47 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: 10732553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A208C13AD for ; Sun, 16 Dec 2018 17:22:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 900BD29985 for ; Sun, 16 Dec 2018 17:22:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82C1829995; Sun, 16 Dec 2018 17:22:07 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 8C93B29985 for ; Sun, 16 Dec 2018 17:22:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730695AbeLPRWG (ORCPT ); Sun, 16 Dec 2018 12:22:06 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:45138 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730614AbeLPRWG (ORCPT ); Sun, 16 Dec 2018 12:22:06 -0500 Received: by mail-wr1-f68.google.com with SMTP id t6so9802952wrr.12 for ; Sun, 16 Dec 2018 09:22:03 -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 :mime-version:content-transfer-encoding; bh=eX0Tp1K9hty3FA2EJTw0CAlZBqQnr1dLiQ78Q3dAkB0=; b=jMotn+kHXGnN8TUcWYucOOgwCeRDouMdIwRu5yhbCg+UDbFn/YVXokXDg8DKyDxFjt cg4JjZ7etCocRxOLPuuVTJC7njk4pacTelx32ARbFavgJ4MtHomG9Zs94cQ1EuZ7Gcat Nnx5jsuPrYi4LjFPjcNWy2fUXUK1G3nziPHIBx07LUVFR0Ggda90onvs+r79UUqV/5hu NUO0FKzFdVF9vFMhjLoFaJRHMgUANDPBvZRUbXIEqF398+nB+wJ55v0NK/JDKZmUmGuV Iyn0ec8NKBKXxwIpG26d7MyqpCtkPDcAfW0PyVDP2YMKzOT1t68qHjnaBgEoRryUAiv7 D0bQ== 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:mime-version:content-transfer-encoding; bh=eX0Tp1K9hty3FA2EJTw0CAlZBqQnr1dLiQ78Q3dAkB0=; b=FKKtTUsS3HqxZ1zLIOer3XpRZeLFtVbX0STWKy1HWXY97JPmTDZ3d1QZKeLaqsG3Cq ARI7Or9sQICrFkZLkDziSMVGjNddvptPWKu6Lox6YQYqgNu1tXL3qCfNhaoPXNx6wKRB j51UmaE9JpZVnLAmTuLtgBYjtsCDMoqhfg9vTfz8Oe3sj2HlvVsX9tSSOaJiX2DilcJn k8EhUjTBYGpaLU8oym4IUtZF6NgV4WvQdJeQQZFv8yRpsyMuQWtnJ7EuMdkEG/iCoYwl lbCM59RzYC5BZF3/Idyo5RBSOzZ+EQwn4cDRrueLAuIVk1/r37pQ8UA5dVQ9eZeCqM+B EKMA== X-Gm-Message-State: AA+aEWbCQsZa/t7VVhper1yHYYnZpJXebHBdVbGFOgss79ZDIvmouTAd 978pEACEVZ6hXfoc5mDm6uUzrLbU X-Google-Smtp-Source: AFSGD/UKF+LWPffV58FfD8K4IBl9IJTohB/cT5vcv+9PQfJMExN027luAHc5gluRbmB6BoTfGAxq8w== X-Received: by 2002:a5d:4250:: with SMTP id s16mr8400001wrr.253.1544980919042; Sun, 16 Dec 2018 09:21:59 -0800 (PST) Received: from localhost.localdomain ([2a02:a03f:4059:bc00:511d:a2f9:81d4:4b91]) by smtp.gmail.com with ESMTPSA id z17sm9064743wrv.2.2018.12.16.09.21.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Dec 2018 09:21:58 -0800 (PST) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 2/6] show-parse: don't display null ident in show_typename() Date: Sun, 16 Dec 2018 18:21:47 +0100 Message-Id: <20181216172151.1361-3-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181216172151.1361-1-luc.vanoostenryck@gmail.com> References: <20181216172151.1361-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 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 Often show_typename() is used to display a type and the associated identifier is irrelevant but is displayed nevertheless. However, when the identifier is itself not present, it is still displayed as '', which is just noise can be confusing. Fix this by displaying nothing for null identifiers in show_typename(). Signed-off-by: Luc Van Oostenryck --- show-parse.c | 3 ++- validation/builtin-overflow.c | 12 ++++++------ validation/c11-atomic.c | 6 +++--- validation/cast-bad-00.c | 4 ++-- validation/choose_expr.c | 4 ++-- validation/expand/builtin-expect.c | 4 ++-- validation/nocast.c | 2 +- validation/noderef.c | 2 +- validation/ptr-inherit.c | 10 +++++----- validation/restrict.c | 6 +++--- 10 files changed, 27 insertions(+), 26 deletions(-) diff --git a/show-parse.c b/show-parse.c index 5590dae9b..e8a0b4dcb 100644 --- a/show-parse.c +++ b/show-parse.c @@ -353,7 +353,8 @@ deeper: break; case SYM_NODE: - append(name, "%s", show_ident(sym->ident)); + if (sym->ident) + append(name, "%s", show_ident(sym->ident)); mod |= sym->ctype.modifiers; combine_address_space(sym->pos, &as, sym->ctype.as); break; diff --git a/validation/builtin-overflow.c b/validation/builtin-overflow.c index a3dacc265..798868a31 100644 --- a/validation/builtin-overflow.c +++ b/validation/builtin-overflow.c @@ -143,13 +143,13 @@ builtin-overflow.c:62:38: int enum e [signed] e builtin-overflow.c:63:41: error: invalid type for argument 2: builtin-overflow.c:63:41: int enum e [signed] e builtin-overflow.c:64:45: error: invalid type for argument 3: -builtin-overflow.c:64:45: int enum e * +builtin-overflow.c:64:45: int enum e * builtin-overflow.c:65:38: error: invalid type for argument 1: builtin-overflow.c:65:38: bool [unsigned] [usertype] b builtin-overflow.c:66:41: error: invalid type for argument 2: builtin-overflow.c:66:41: bool [unsigned] [usertype] b builtin-overflow.c:67:45: error: invalid type for argument 3: -builtin-overflow.c:67:45: bool * +builtin-overflow.c:67:45: bool * builtin-overflow.c:68:44: error: invalid type for argument 3: builtin-overflow.c:68:44: void *p builtin-overflow.c:70:39: error: not enough arguments for __builtin_add_overflow_p @@ -179,13 +179,13 @@ builtin-overflow.c:86:38: int enum e [signed] [addressable] e builtin-overflow.c:87:41: error: invalid type for argument 2: builtin-overflow.c:87:41: int enum e [signed] [addressable] e builtin-overflow.c:88:45: error: invalid type for argument 3: -builtin-overflow.c:88:45: int enum e * +builtin-overflow.c:88:45: int enum e * builtin-overflow.c:89:38: error: invalid type for argument 1: builtin-overflow.c:89:38: bool [unsigned] [addressable] [usertype] b builtin-overflow.c:90:41: error: invalid type for argument 2: builtin-overflow.c:90:41: bool [unsigned] [addressable] [usertype] b builtin-overflow.c:91:45: error: invalid type for argument 3: -builtin-overflow.c:91:45: bool * +builtin-overflow.c:91:45: bool * builtin-overflow.c:92:44: error: invalid type for argument 3: builtin-overflow.c:92:44: void *p builtin-overflow.c:94:39: error: not enough arguments for __builtin_sub_overflow_p @@ -215,13 +215,13 @@ builtin-overflow.c:110:38: int enum e [signed] [addressable] e builtin-overflow.c:111:41: error: invalid type for argument 2: builtin-overflow.c:111:41: int enum e [signed] [addressable] e builtin-overflow.c:112:45: error: invalid type for argument 3: -builtin-overflow.c:112:45: int enum e * +builtin-overflow.c:112:45: int enum e * builtin-overflow.c:113:38: error: invalid type for argument 1: builtin-overflow.c:113:38: bool [unsigned] [addressable] [usertype] b builtin-overflow.c:114:41: error: invalid type for argument 2: builtin-overflow.c:114:41: bool [unsigned] [addressable] [usertype] b builtin-overflow.c:115:45: error: invalid type for argument 3: -builtin-overflow.c:115:45: bool * +builtin-overflow.c:115:45: bool * builtin-overflow.c:116:44: error: invalid type for argument 3: builtin-overflow.c:116:44: void *p builtin-overflow.c:118:39: error: not enough arguments for __builtin_mul_overflow_p diff --git a/validation/c11-atomic.c b/validation/c11-atomic.c index bea3dab8f..e87d06cd1 100644 --- a/validation/c11-atomic.c +++ b/validation/c11-atomic.c @@ -73,19 +73,19 @@ c11-atomic.c:11:6: error: symbol 'f02' redeclared with different type (originall c11-atomic.c:12:6: error: symbol 'f03' redeclared with different type (originally declared at c11-atomic.c:4) - incompatible argument 1 (different modifiers) c11-atomic.c:33:13: warning: incorrect type in assignment (different modifiers) c11-atomic.c:33:13: expected int *extern [assigned] puo -c11-atomic.c:33:13: got int const * +c11-atomic.c:33:13: got int const * c11-atomic.c:34:13: warning: incorrect type in assignment (different modifiers) c11-atomic.c:34:13: expected int *extern [assigned] puo c11-atomic.c:34:13: got int const *extern [assigned] pqo c11-atomic.c:48:13: warning: incorrect type in assignment (different modifiers) c11-atomic.c:48:13: expected int *extern [assigned] puo -c11-atomic.c:48:13: got int [atomic] * +c11-atomic.c:48:13: got int [atomic] * c11-atomic.c:49:13: warning: incorrect type in assignment (different modifiers) c11-atomic.c:49:13: expected int *extern [assigned] puo c11-atomic.c:49:13: got int [atomic] *extern [assigned] pqo c11-atomic.c:63:13: warning: incorrect type in assignment (different modifiers) c11-atomic.c:63:13: expected int *extern [assigned] puo -c11-atomic.c:63:13: got int [atomic] * +c11-atomic.c:63:13: got int [atomic] * c11-atomic.c:64:13: warning: incorrect type in assignment (different modifiers) c11-atomic.c:64:13: expected int *extern [assigned] puo c11-atomic.c:64:13: got int [atomic] *extern [assigned] pqo diff --git a/validation/cast-bad-00.c b/validation/cast-bad-00.c index 5f4a895f5..30aae2375 100644 --- a/validation/cast-bad-00.c +++ b/validation/cast-bad-00.c @@ -38,10 +38,10 @@ void struct_to_int(u16 val) * * check-error-start cast-bad-00.c:25:18: warning: incorrect type in argument 2 (different base types) -cast-bad-00.c:25:18: expected unsigned int [unsigned] [usertype] +cast-bad-00.c:25:18: expected unsigned int [unsigned] [usertype] cast-bad-00.c:25:18: got union u [assigned] u cast-bad-00.c:33:18: warning: incorrect type in argument 2 (different base types) -cast-bad-00.c:33:18: expected unsigned int [unsigned] [usertype] +cast-bad-00.c:33:18: expected unsigned int [unsigned] [usertype] cast-bad-00.c:33:18: got struct s [assigned] s * check-error-end */ diff --git a/validation/choose_expr.c b/validation/choose_expr.c index f6fd84cf2..b075e6562 100644 --- a/validation/choose_expr.c +++ b/validation/choose_expr.c @@ -8,10 +8,10 @@ static int z = 1/(sizeof(__builtin_choose_expr(1,s,0)) - 42); * check-error-start choose_expr.c:1:51: warning: incorrect type in initializer (different base types) choose_expr.c:1:51: expected int static [signed] [toplevel] x -choose_expr.c:1:51: got void +choose_expr.c:1:51: got void choose_expr.c:2:41: warning: incorrect type in initializer (different base types) choose_expr.c:2:41: expected int static [signed] [toplevel] y -choose_expr.c:2:41: got char * +choose_expr.c:2:41: got char * choose_expr.c:4:17: warning: division by zero * check-error-end */ diff --git a/validation/expand/builtin-expect.c b/validation/expand/builtin-expect.c index 77f714ef8..1207c1326 100644 --- a/validation/expand/builtin-expect.c +++ b/validation/expand/builtin-expect.c @@ -86,10 +86,10 @@ fptr: * * check-error-start expand/builtin-expect.c:33:33: warning: incorrect type in argument 1 (different base types) -expand/builtin-expect.c:33:33: expected long [signed] +expand/builtin-expect.c:33:33: expected long [signed] expand/builtin-expect.c:33:33: got void *a expand/builtin-expect.c:33:36: warning: incorrect type in argument 2 (different base types) -expand/builtin-expect.c:33:36: expected long [signed] +expand/builtin-expect.c:33:36: expected long [signed] expand/builtin-expect.c:33:36: got void *a expand/builtin-expect.c:33:32: warning: incorrect type in return expression (different base types) expand/builtin-expect.c:33:32: expected void * diff --git a/validation/nocast.c b/validation/nocast.c index cc0ab6b7c..6c5da9687 100644 --- a/validation/nocast.c +++ b/validation/nocast.c @@ -160,7 +160,7 @@ nocast.c:34:33: got unsigned long nocast.c:34:33: warning: implicit cast to nocast type nocast.c:35:39: warning: incorrect type in initializer (different modifiers) nocast.c:35:39: expected unsigned long *static [toplevel] bad_ptr_from -nocast.c:35:39: got unsigned long [nocast] * +nocast.c:35:39: got unsigned long [nocast] * nocast.c:35:39: warning: implicit cast from nocast type nocast.c:50:16: warning: implicit cast from nocast type nocast.c:54:16: warning: implicit cast from nocast type diff --git a/validation/noderef.c b/validation/noderef.c index 8c89f6092..bcd6c08cb 100644 --- a/validation/noderef.c +++ b/validation/noderef.c @@ -46,6 +46,6 @@ static void h(void) * check-error-start noderef.c:24:12: warning: incorrect type in assignment (different modifiers) noderef.c:24:12: expected char *[noderef] *q2 -noderef.c:24:12: got char [noderef] ** +noderef.c:24:12: got char [noderef] ** * check-error-end */ diff --git a/validation/ptr-inherit.c b/validation/ptr-inherit.c index 873305676..69e5a931b 100644 --- a/validation/ptr-inherit.c +++ b/validation/ptr-inherit.c @@ -63,18 +63,18 @@ static void test_tls(void) * check-error-start ptr-inherit.c:12:19: warning: incorrect type in initializer (different modifiers) ptr-inherit.c:12:19: expected int *p -ptr-inherit.c:12:19: got int const * +ptr-inherit.c:12:19: got int const * ptr-inherit.c:18:19: warning: incorrect type in initializer (different modifiers) ptr-inherit.c:18:19: expected int *p -ptr-inherit.c:18:19: got int volatile * +ptr-inherit.c:18:19: got int volatile * ptr-inherit.c:24:19: warning: incorrect type in initializer (different modifiers) ptr-inherit.c:24:19: expected int *p -ptr-inherit.c:24:19: got int [noderef] * +ptr-inherit.c:24:19: got int [noderef] * ptr-inherit.c:30:19: warning: incorrect type in initializer (different base types) ptr-inherit.c:30:19: expected int *p -ptr-inherit.c:30:19: got restricted int * +ptr-inherit.c:30:19: got restricted int * ptr-inherit.c:36:19: warning: incorrect type in initializer (different address spaces) ptr-inherit.c:36:19: expected int *p -ptr-inherit.c:36:19: got int * +ptr-inherit.c:36:19: got int * * check-error-end */ diff --git a/validation/restrict.c b/validation/restrict.c index f431f6d0f..92bfdae88 100644 --- a/validation/restrict.c +++ b/validation/restrict.c @@ -73,19 +73,19 @@ restrict.c:11:6: error: symbol 'f02' redeclared with different type (originally restrict.c:12:6: error: symbol 'f03' redeclared with different type (originally declared at restrict.c:4) - incompatible argument 1 (different modifiers) restrict.c:33:13: warning: incorrect type in assignment (different modifiers) restrict.c:33:13: expected void **extern [assigned] pup -restrict.c:33:13: got void *const * +restrict.c:33:13: got void *const * restrict.c:34:13: warning: incorrect type in assignment (different modifiers) restrict.c:34:13: expected void **extern [assigned] pup restrict.c:34:13: got void *const *extern [assigned] pqp restrict.c:48:13: warning: incorrect type in assignment (different modifiers) restrict.c:48:13: expected void **extern [assigned] pup -restrict.c:48:13: got void *restrict * +restrict.c:48:13: got void *restrict * restrict.c:49:13: warning: incorrect type in assignment (different modifiers) restrict.c:49:13: expected void **extern [assigned] pup restrict.c:49:13: got void *restrict *extern [assigned] prp restrict.c:63:13: warning: incorrect type in assignment (different modifiers) restrict.c:63:13: expected void **extern [assigned] pup -restrict.c:63:13: got void *restrict * +restrict.c:63:13: got void *restrict * restrict.c:64:13: warning: incorrect type in assignment (different modifiers) restrict.c:64:13: expected void **extern [assigned] pup restrict.c:64:13: got void *restrict *extern [assigned] prp From patchwork Sun Dec 16 17:21:48 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: 10732557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ECDBB924 for ; Sun, 16 Dec 2018 17:22:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9C5129985 for ; Sun, 16 Dec 2018 17:22:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE4A229995; Sun, 16 Dec 2018 17:22:08 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 D4E4B29985 for ; Sun, 16 Dec 2018 17:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730731AbeLPRWH (ORCPT ); Sun, 16 Dec 2018 12:22:07 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:40558 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730694AbeLPRWH (ORCPT ); Sun, 16 Dec 2018 12:22:07 -0500 Received: by mail-wr1-f68.google.com with SMTP id p4so9969103wrt.7 for ; Sun, 16 Dec 2018 09:22:05 -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 :mime-version:content-transfer-encoding; bh=sfROefR3KtfFxr64NB6krzrB1PugayoPb8bZAAOCY24=; b=dZphmPfz5QyHeTE9i8NSCPW5M2+2sdJ8Y9LZLSl+LgSA5F4Ewe3IVWGV6CLCTKeMs8 /L4xGSuZWiC9XCsW6B0HW1QohFn88OlpLYyfsJFomDmy9RflVb8FbCYnHFOzwUW4Ri+z hSeEMhp7GDiy1xJ6G8yGNAngjn6hK2AEVBrDc969zsJ+c5mBWm471JmFniHQgnCd1LsK xoQscDYg9vtWZN/Fhp2XgcQ3X7Cyw4UCNI7irAgqHcBrZYwM9sF/A7X+vnZaLv4Mm9az UOQjf0mY2+S+qpRnSCKfTjc4HMRaj7cRZxrE/lQThZdqA11jllTRDKxROF/X4xLDqAIh vD8Q== 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:mime-version:content-transfer-encoding; bh=sfROefR3KtfFxr64NB6krzrB1PugayoPb8bZAAOCY24=; b=PBa1HsnfWqOlRZRXHdbvnDM3yrT/WKbBEp6Y1S3SXwZZX/U9frudbDrKCaOCLqe3Uk yvcoaxvOFTBDGh5UmtL5NpvqsPRIdwM4juUDa0k3GmOA8HDO263lVZgrBpc4bdBNj8Df CBKsny0BYmGKAiXl2IDCD6gXhqA7IejXxHCUeoa2P65SmP+94n8FqfC4p5c7pPSdQq4M 85c4YoQBlIsBYibivs+lXJOwBqZC7PjcwIT5WvWn95th76Who18uDtSmS/kxD6y7/Tjm 7Mmi713HtExzYazqSB9jxQ/0GlVevd5tBTWom743Zl8M5QF+/fy6+GVgdsOUh11ooyNl ovQw== X-Gm-Message-State: AA+aEWbNzKHqgrjGSkkX9BPKB1xLUpand6HkGEkeeVuK3D11iAbqvScC ROfHET3Pfys3a+fAhBE37YmsR5Bt X-Google-Smtp-Source: AFSGD/XSsEExBr/SARk6Fx/4/elgHhqrRbepJN43wT11mCNQK8zgRQP7FBO6lhsiWAId5TeJf8LJTw== X-Received: by 2002:adf:a452:: with SMTP id e18mr78837wra.190.1544980919838; Sun, 16 Dec 2018 09:21:59 -0800 (PST) Received: from localhost.localdomain ([2a02:a03f:4059:bc00:511d:a2f9:81d4:4b91]) by smtp.gmail.com with ESMTPSA id z17sm9064743wrv.2.2018.12.16.09.21.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Dec 2018 09:21:59 -0800 (PST) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 3/6] show-parse: do not display base type's redundant specifiers Date: Sun, 16 Dec 2018 18:21:48 +0100 Message-Id: <20181216172151.1361-4-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181216172151.1361-1-luc.vanoostenryck@gmail.com> References: <20181216172151.1361-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 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 In do_show_type(), builtin_typename() is used to display builtin (base) types and modifier_string() is used to display modifiers. However, most base types contains some intrinsic modifiers, the type specifiers. So, a type like 'unsigned long' is displayed as 'unsigned long [unsigned] [long]'. Fix this redundancy by not displaying the specifiers when displaying a base_type (or an enum). Signed-off-by: Luc Van Oostenryck --- show-parse.c | 2 + validation/bad-type-twice1.c | 2 +- validation/builtin-overflow.c | 60 +++++++++++++++--------------- validation/cast-bad-00.c | 4 +- validation/choose_expr.c | 4 +- validation/expand/builtin-expect.c | 4 +- 6 files changed, 39 insertions(+), 37 deletions(-) diff --git a/show-parse.c b/show-parse.c index e8a0b4dcb..36b447421 100644 --- a/show-parse.c +++ b/show-parse.c @@ -298,6 +298,8 @@ deeper: if (as) prepend(name, "%s ", show_as(as)); + if (sym->type == SYM_BASETYPE || sym->type == SYM_ENUM) + mod &= ~MOD_SPECIFIER; s = modifier_string(mod); len = strlen(s); name->start -= len; diff --git a/validation/bad-type-twice1.c b/validation/bad-type-twice1.c index 95cfd9e01..cc81662af 100644 --- a/validation/bad-type-twice1.c +++ b/validation/bad-type-twice1.c @@ -10,7 +10,7 @@ static unsigned long foo(unsigned long val, void *ref) * * check-error-start bad-type-twice1.c:3:17: error: incompatible types for operation (>=) -bad-type-twice1.c:3:17: left side has type unsigned long [unsigned] val +bad-type-twice1.c:3:17: left side has type unsigned long val bad-type-twice1.c:3:17: right side has type void *ref * check-error-end */ diff --git a/validation/builtin-overflow.c b/validation/builtin-overflow.c index 798868a31..c3d1d3aa8 100644 --- a/validation/builtin-overflow.c +++ b/validation/builtin-overflow.c @@ -139,15 +139,15 @@ builtin-overflow.c:59:37: error: not enough arguments for __builtin_add_overflow builtin-overflow.c:60:37: error: not enough arguments for __builtin_add_overflow builtin-overflow.c:61:37: error: too many arguments for __builtin_add_overflow builtin-overflow.c:62:38: error: invalid type for argument 1: -builtin-overflow.c:62:38: int enum e [signed] e +builtin-overflow.c:62:38: int enum e e builtin-overflow.c:63:41: error: invalid type for argument 2: -builtin-overflow.c:63:41: int enum e [signed] e +builtin-overflow.c:63:41: int enum e e builtin-overflow.c:64:45: error: invalid type for argument 3: builtin-overflow.c:64:45: int enum e * builtin-overflow.c:65:38: error: invalid type for argument 1: -builtin-overflow.c:65:38: bool [unsigned] [usertype] b +builtin-overflow.c:65:38: bool [usertype] b builtin-overflow.c:66:41: error: invalid type for argument 2: -builtin-overflow.c:66:41: bool [unsigned] [usertype] b +builtin-overflow.c:66:41: bool [usertype] b builtin-overflow.c:67:45: error: invalid type for argument 3: builtin-overflow.c:67:45: bool * builtin-overflow.c:68:44: error: invalid type for argument 3: @@ -157,17 +157,17 @@ builtin-overflow.c:71:39: error: not enough arguments for __builtin_add_overflow builtin-overflow.c:72:39: error: not enough arguments for __builtin_add_overflow_p builtin-overflow.c:73:39: error: too many arguments for __builtin_add_overflow_p builtin-overflow.c:74:40: error: invalid type for argument 1: -builtin-overflow.c:74:40: int enum e [signed] [addressable] e +builtin-overflow.c:74:40: int enum e [addressable] e builtin-overflow.c:75:43: error: invalid type for argument 2: -builtin-overflow.c:75:43: int enum e [signed] [addressable] e +builtin-overflow.c:75:43: int enum e [addressable] e builtin-overflow.c:76:46: error: invalid type for argument 3: -builtin-overflow.c:76:46: int enum e [signed] [addressable] e +builtin-overflow.c:76:46: int enum e [addressable] e builtin-overflow.c:77:40: error: invalid type for argument 1: -builtin-overflow.c:77:40: bool [unsigned] [addressable] [usertype] b +builtin-overflow.c:77:40: bool [addressable] [usertype] b builtin-overflow.c:78:43: error: invalid type for argument 2: -builtin-overflow.c:78:43: bool [unsigned] [addressable] [usertype] b +builtin-overflow.c:78:43: bool [addressable] [usertype] b builtin-overflow.c:79:46: error: invalid type for argument 3: -builtin-overflow.c:79:46: bool [unsigned] [addressable] [usertype] b +builtin-overflow.c:79:46: bool [addressable] [usertype] b builtin-overflow.c:80:46: error: invalid type for argument 3: builtin-overflow.c:80:46: void *p builtin-overflow.c:82:37: error: not enough arguments for __builtin_sub_overflow @@ -175,15 +175,15 @@ builtin-overflow.c:83:37: error: not enough arguments for __builtin_sub_overflow builtin-overflow.c:84:37: error: not enough arguments for __builtin_sub_overflow builtin-overflow.c:85:37: error: too many arguments for __builtin_sub_overflow builtin-overflow.c:86:38: error: invalid type for argument 1: -builtin-overflow.c:86:38: int enum e [signed] [addressable] e +builtin-overflow.c:86:38: int enum e [addressable] e builtin-overflow.c:87:41: error: invalid type for argument 2: -builtin-overflow.c:87:41: int enum e [signed] [addressable] e +builtin-overflow.c:87:41: int enum e [addressable] e builtin-overflow.c:88:45: error: invalid type for argument 3: builtin-overflow.c:88:45: int enum e * builtin-overflow.c:89:38: error: invalid type for argument 1: -builtin-overflow.c:89:38: bool [unsigned] [addressable] [usertype] b +builtin-overflow.c:89:38: bool [addressable] [usertype] b builtin-overflow.c:90:41: error: invalid type for argument 2: -builtin-overflow.c:90:41: bool [unsigned] [addressable] [usertype] b +builtin-overflow.c:90:41: bool [addressable] [usertype] b builtin-overflow.c:91:45: error: invalid type for argument 3: builtin-overflow.c:91:45: bool * builtin-overflow.c:92:44: error: invalid type for argument 3: @@ -193,17 +193,17 @@ builtin-overflow.c:95:39: error: not enough arguments for __builtin_sub_overflow builtin-overflow.c:96:39: error: not enough arguments for __builtin_sub_overflow_p builtin-overflow.c:97:39: error: too many arguments for __builtin_sub_overflow_p builtin-overflow.c:98:40: error: invalid type for argument 1: -builtin-overflow.c:98:40: int enum e [signed] [addressable] e +builtin-overflow.c:98:40: int enum e [addressable] e builtin-overflow.c:99:43: error: invalid type for argument 2: -builtin-overflow.c:99:43: int enum e [signed] [addressable] e +builtin-overflow.c:99:43: int enum e [addressable] e builtin-overflow.c:100:46: error: invalid type for argument 3: -builtin-overflow.c:100:46: int enum e [signed] [addressable] e +builtin-overflow.c:100:46: int enum e [addressable] e builtin-overflow.c:101:40: error: invalid type for argument 1: -builtin-overflow.c:101:40: bool [unsigned] [addressable] [usertype] b +builtin-overflow.c:101:40: bool [addressable] [usertype] b builtin-overflow.c:102:43: error: invalid type for argument 2: -builtin-overflow.c:102:43: bool [unsigned] [addressable] [usertype] b +builtin-overflow.c:102:43: bool [addressable] [usertype] b builtin-overflow.c:103:46: error: invalid type for argument 3: -builtin-overflow.c:103:46: bool [unsigned] [addressable] [usertype] b +builtin-overflow.c:103:46: bool [addressable] [usertype] b builtin-overflow.c:104:46: error: invalid type for argument 3: builtin-overflow.c:104:46: void *p builtin-overflow.c:106:37: error: not enough arguments for __builtin_mul_overflow @@ -211,15 +211,15 @@ builtin-overflow.c:107:37: error: not enough arguments for __builtin_mul_overflo builtin-overflow.c:108:37: error: not enough arguments for __builtin_mul_overflow builtin-overflow.c:109:37: error: too many arguments for __builtin_mul_overflow builtin-overflow.c:110:38: error: invalid type for argument 1: -builtin-overflow.c:110:38: int enum e [signed] [addressable] e +builtin-overflow.c:110:38: int enum e [addressable] e builtin-overflow.c:111:41: error: invalid type for argument 2: -builtin-overflow.c:111:41: int enum e [signed] [addressable] e +builtin-overflow.c:111:41: int enum e [addressable] e builtin-overflow.c:112:45: error: invalid type for argument 3: builtin-overflow.c:112:45: int enum e * builtin-overflow.c:113:38: error: invalid type for argument 1: -builtin-overflow.c:113:38: bool [unsigned] [addressable] [usertype] b +builtin-overflow.c:113:38: bool [addressable] [usertype] b builtin-overflow.c:114:41: error: invalid type for argument 2: -builtin-overflow.c:114:41: bool [unsigned] [addressable] [usertype] b +builtin-overflow.c:114:41: bool [addressable] [usertype] b builtin-overflow.c:115:45: error: invalid type for argument 3: builtin-overflow.c:115:45: bool * builtin-overflow.c:116:44: error: invalid type for argument 3: @@ -229,17 +229,17 @@ builtin-overflow.c:119:39: error: not enough arguments for __builtin_mul_overflo builtin-overflow.c:120:39: error: not enough arguments for __builtin_mul_overflow_p builtin-overflow.c:121:39: error: too many arguments for __builtin_mul_overflow_p builtin-overflow.c:122:40: error: invalid type for argument 1: -builtin-overflow.c:122:40: int enum e [signed] [addressable] e +builtin-overflow.c:122:40: int enum e [addressable] e builtin-overflow.c:123:43: error: invalid type for argument 2: -builtin-overflow.c:123:43: int enum e [signed] [addressable] e +builtin-overflow.c:123:43: int enum e [addressable] e builtin-overflow.c:124:46: error: invalid type for argument 3: -builtin-overflow.c:124:46: int enum e [signed] [addressable] e +builtin-overflow.c:124:46: int enum e [addressable] e builtin-overflow.c:125:40: error: invalid type for argument 1: -builtin-overflow.c:125:40: bool [unsigned] [addressable] [usertype] b +builtin-overflow.c:125:40: bool [addressable] [usertype] b builtin-overflow.c:126:43: error: invalid type for argument 2: -builtin-overflow.c:126:43: bool [unsigned] [addressable] [usertype] b +builtin-overflow.c:126:43: bool [addressable] [usertype] b builtin-overflow.c:127:46: error: invalid type for argument 3: -builtin-overflow.c:127:46: bool [unsigned] [addressable] [usertype] b +builtin-overflow.c:127:46: bool [addressable] [usertype] b builtin-overflow.c:128:46: error: invalid type for argument 3: builtin-overflow.c:128:46: void *p * check-error-end diff --git a/validation/cast-bad-00.c b/validation/cast-bad-00.c index 30aae2375..6d15485d4 100644 --- a/validation/cast-bad-00.c +++ b/validation/cast-bad-00.c @@ -38,10 +38,10 @@ void struct_to_int(u16 val) * * check-error-start cast-bad-00.c:25:18: warning: incorrect type in argument 2 (different base types) -cast-bad-00.c:25:18: expected unsigned int [unsigned] [usertype] +cast-bad-00.c:25:18: expected unsigned int [usertype] cast-bad-00.c:25:18: got union u [assigned] u cast-bad-00.c:33:18: warning: incorrect type in argument 2 (different base types) -cast-bad-00.c:33:18: expected unsigned int [unsigned] [usertype] +cast-bad-00.c:33:18: expected unsigned int [usertype] cast-bad-00.c:33:18: got struct s [assigned] s * check-error-end */ diff --git a/validation/choose_expr.c b/validation/choose_expr.c index b075e6562..b5d2b4e6f 100644 --- a/validation/choose_expr.c +++ b/validation/choose_expr.c @@ -7,10 +7,10 @@ static int z = 1/(sizeof(__builtin_choose_expr(1,s,0)) - 42); * check-name: choose expr builtin * check-error-start choose_expr.c:1:51: warning: incorrect type in initializer (different base types) -choose_expr.c:1:51: expected int static [signed] [toplevel] x +choose_expr.c:1:51: expected int static [toplevel] x choose_expr.c:1:51: got void choose_expr.c:2:41: warning: incorrect type in initializer (different base types) -choose_expr.c:2:41: expected int static [signed] [toplevel] y +choose_expr.c:2:41: expected int static [toplevel] y choose_expr.c:2:41: got char * choose_expr.c:4:17: warning: division by zero * check-error-end diff --git a/validation/expand/builtin-expect.c b/validation/expand/builtin-expect.c index 1207c1326..f4e0664bb 100644 --- a/validation/expand/builtin-expect.c +++ b/validation/expand/builtin-expect.c @@ -86,10 +86,10 @@ fptr: * * check-error-start expand/builtin-expect.c:33:33: warning: incorrect type in argument 1 (different base types) -expand/builtin-expect.c:33:33: expected long [signed] +expand/builtin-expect.c:33:33: expected long expand/builtin-expect.c:33:33: got void *a expand/builtin-expect.c:33:36: warning: incorrect type in argument 2 (different base types) -expand/builtin-expect.c:33:36: expected long [signed] +expand/builtin-expect.c:33:36: expected long expand/builtin-expect.c:33:36: got void *a expand/builtin-expect.c:33:32: warning: incorrect type in return expression (different base types) expand/builtin-expect.c:33:32: expected void * From patchwork Sun Dec 16 17:21:49 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: 10732555 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B0BDF13AD for ; Sun, 16 Dec 2018 17:22:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1FA329993 for ; Sun, 16 Dec 2018 17:22:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96D3F29996; Sun, 16 Dec 2018 17:22:08 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 4928729993 for ; Sun, 16 Dec 2018 17:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730763AbeLPRWI (ORCPT ); Sun, 16 Dec 2018 12:22:08 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:53412 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730614AbeLPRWI (ORCPT ); Sun, 16 Dec 2018 12:22:08 -0500 Received: by mail-wm1-f68.google.com with SMTP id y1so10078972wmi.3 for ; Sun, 16 Dec 2018 09:22:05 -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 :mime-version:content-transfer-encoding; bh=rJ4EUkXBN9HC4SWoo4bItFPShF8c5LNq3qwf1GR8rtI=; b=Kvzz3a8ukN2tTYu4zCrYi9LIE6OaeDswfEVVP35BevGfG71H9eO0hoo69Ot1IdXDzB /ub4e2IqAacoZ4WS3kNN9mD56vAtfb0UHhFmlPiu/qtw+GU17xdbP9wML8M5h9SOQ8r7 znG7NK6TpZ/qPwkgqBnk7qAd53BdbjaWt2b/tFJ1+NR4V12+YGXa2t59B2eITMHUMbMJ BJ1NkRa0LXdu/9gw8w2AAndZpDVnh++T41zbGPHYQCArAy/rPbwisWjVrByFiWuFu5Lz u1b8fcsL3fwxGLQb0/md74NZ7Gtl96/518pHTQ7KcCpPsFEKfUnpaQx4uQInOc4Ka/BQ ERIA== 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:mime-version:content-transfer-encoding; bh=rJ4EUkXBN9HC4SWoo4bItFPShF8c5LNq3qwf1GR8rtI=; b=GVmNVYbjSn9yBFBXbrnEFUe4E/VfLoZBYON6Z8dtgdDNTa0mEwA8AylaL+mCcplC37 +DrjdsyCDWQ5GNivuKuP6z+NUvBDS577QyCcjzu+PnKx59rModID5YptoJg1fkQ/ZV6D UoXNxzRKjcxUL1xvFBQ6iaNvAREUhQirM9eZE4+GEvitnWPaB5DLMlN9a25nb7TMAxPI v5prjxA+cCxmqzJtRCOwsWkdTe7BYbS1ZJo+p2lYGuT3AdAb6DnBd3k/Q6E3n7cfBo6J FE3QUlymEMZnL2PFNlg71oVimfEpARdDmRXRyZdToed1EH02wVaMGBvv1oUCqYOqG1Wu pOnw== X-Gm-Message-State: AA+aEWbYUWYyZmZGNaxcgAwOLlcwCNOq3UKWdm9izOFYrG3hvlJlO04+ SNgeWj0NvL4urNj0Tf6BGFtA68Zn X-Google-Smtp-Source: AFSGD/WR6xWoO6Zn9xHWP84F+6nwXIh5iwFm06kcZTk5NAbMjjjahhu9gsajTyVdHc1w0tV7txDxaA== X-Received: by 2002:a7b:c399:: with SMTP id s25mr9589654wmj.90.1544980920826; Sun, 16 Dec 2018 09:22:00 -0800 (PST) Received: from localhost.localdomain ([2a02:a03f:4059:bc00:511d:a2f9:81d4:4b91]) by smtp.gmail.com with ESMTPSA id z17sm9064743wrv.2.2018.12.16.09.21.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Dec 2018 09:22:00 -0800 (PST) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 4/6] show-parse: remove string_ctype from typenames Date: Sun, 16 Dec 2018 18:21:49 +0100 Message-Id: <20181216172151.1361-5-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181216172151.1361-1-luc.vanoostenryck@gmail.com> References: <20181216172151.1361-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 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 Currently, a string_ctype (only used for the declaration of builtin functions) is displayed as "string", not "char *". Fix this by removing the entry for string_ctype from typenames[] which should only contains the name of base types. Signed-off-by: Luc Van Oostenryck --- show-parse.c | 1 - 1 file changed, 1 deletion(-) diff --git a/show-parse.c b/show-parse.c index 36b447421..c73ee4dd1 100644 --- a/show-parse.c +++ b/show-parse.c @@ -248,7 +248,6 @@ static struct ctype_name { { &void_ctype, "void" }, { &bool_ctype, "bool" }, - { &string_ctype, "string" }, { &float_ctype, "float" }, { &double_ctype, "double" }, From patchwork Sun Dec 16 17:21:50 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: 10732559 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9DDFB13AD for ; Sun, 16 Dec 2018 17:22:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D1D029985 for ; Sun, 16 Dec 2018 17:22:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81D3029995; Sun, 16 Dec 2018 17:22:09 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 35D9029985 for ; Sun, 16 Dec 2018 17:22:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730614AbeLPRWJ (ORCPT ); Sun, 16 Dec 2018 12:22:09 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39679 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730694AbeLPRWI (ORCPT ); Sun, 16 Dec 2018 12:22:08 -0500 Received: by mail-wr1-f67.google.com with SMTP id t27so9980443wra.6 for ; Sun, 16 Dec 2018 09:22:07 -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 :mime-version:content-transfer-encoding; bh=aS6n5zvXgzOshdqvHPufiEOLqZV2PEZmh78OdfD4w7c=; b=XXMOYq4AIeaV1wOEOCpKsjZoq0S5BIO29mYHZPPzwUO+sa5kWI0Gnqz5iSKhhSuMWw VTPXBPFHKTvRmir93m0cfuGFFzUJEMYrwLzIrsQwItARYTvZn1+diGZ43TWF8Xg1Qx2J mH/ITfSWupIlFnBWNDUhXzwzQ0zfE/fhhyWMT3hTUXW91bkh2rNuhl8sIepyNammyKX9 TYzLROSanBH1RZFjyVIy/2oADAohUu3pVnVxM8YbLPT44al8UnCUkIYRI8cB5FwmootF WMUw3zYHzYvk+E/DCylZUG6BkkSjz53SXeBSifPf/QHcakgFdQuxsmeBMng3PZkmSZoK XLmQ== 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:mime-version:content-transfer-encoding; bh=aS6n5zvXgzOshdqvHPufiEOLqZV2PEZmh78OdfD4w7c=; b=dEU+HVicWGPGu4ZI3obHKh8fv9eQyGWDZ2lGp71J2ymi3upzzKc/2GZFenonSM6iYa dPhlV1xl4WW3q3KeJ261I2TlAoYfvgKFY5yQzbbEsJPQjgKzqCqGxfnjTf7L1OImDWz4 Mqe53F+g6EQneqF+S41Ll8C3u88vIE49cKQNerQ3YENa8djDwCLSAhhZ25KiPzFy+vM0 20D+kkEIQfKqrgHh93h15/mNP4UFdqOLrSgLr0BkSO3mRjQ9MAou66kdQrPT4iywA+eH mmSnNRv0ozztpN7vIYrMLP54z46XCAR1pObgxRmeJb0d9rkS3Xrz3zanYquKGWTeYemW EPIg== X-Gm-Message-State: AA+aEWbXJpES2qINLLCIqxWQKWONVEryCQqAcBg87C7G3d4Hx4iTr7Oj TQll5BTiPynuQa06DjAXk4GOy6yA X-Google-Smtp-Source: AFSGD/XW52HbfdeppBSyYbRq6Q7xWLhPtg46UAKzChXzGwk8k4l3e0bD++/K7UfwPWdEyXH2sSoEJQ== X-Received: by 2002:adf:e846:: with SMTP id d6mr8598615wrn.72.1544980921635; Sun, 16 Dec 2018 09:22:01 -0800 (PST) Received: from localhost.localdomain ([2a02:a03f:4059:bc00:511d:a2f9:81d4:4b91]) by smtp.gmail.com with ESMTPSA id z17sm9064743wrv.2.2018.12.16.09.22.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Dec 2018 09:22:01 -0800 (PST) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 5/6] show-parse: remove unused builtin_ctypename() Date: Sun, 16 Dec 2018 18:21:50 +0100 Message-Id: <20181216172151.1361-6-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181216172151.1361-1-luc.vanoostenryck@gmail.com> References: <20181216172151.1361-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 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 This function has never been used and its usefulness is dubious. So, remove it. Signed-off-by: Luc Van Oostenryck --- show-parse.c | 10 ---------- symbol.h | 1 - 2 files changed, 11 deletions(-) diff --git a/show-parse.c b/show-parse.c index c73ee4dd1..7bff8f95f 100644 --- a/show-parse.c +++ b/show-parse.c @@ -269,16 +269,6 @@ const char *builtin_typename(struct symbol *sym) return NULL; } -const char *builtin_ctypename(struct ctype *ctype) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(typenames); i++) - if (&typenames[i].sym->ctype == ctype) - return typenames[i].name; - return NULL; -} - static void do_show_type(struct symbol *sym, struct type_name *name) { const char *typename; diff --git a/symbol.h b/symbol.h index d4c4d1205..91e1ea730 100644 --- a/symbol.h +++ b/symbol.h @@ -320,7 +320,6 @@ extern struct symbol *examine_pointer_target(struct symbol *); extern const char *show_as(struct ident *as); extern const char *show_typename(struct symbol *sym); extern const char *builtin_typename(struct symbol *sym); -extern const char *builtin_ctypename(struct ctype *ctype); extern const char* get_type_name(enum type type); extern void debug_symbol(struct symbol *); From patchwork Sun Dec 16 17:21:51 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: 10732561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7002313AD for ; Sun, 16 Dec 2018 17:22:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E7C729985 for ; Sun, 16 Dec 2018 17:22:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52D1A29995; Sun, 16 Dec 2018 17:22:11 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 EB99229985 for ; Sun, 16 Dec 2018 17:22:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730773AbeLPRWK (ORCPT ); Sun, 16 Dec 2018 12:22:10 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36974 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730694AbeLPRWK (ORCPT ); Sun, 16 Dec 2018 12:22:10 -0500 Received: by mail-wm1-f67.google.com with SMTP id g67so10313988wmd.2 for ; Sun, 16 Dec 2018 09:22:09 -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 :mime-version:content-transfer-encoding; bh=FG9o/lWsV4yGfdKR8dDoa04LKopAlyxISU7r7uX9blY=; b=ECTrUxA+rurcXRfXhDls0OhV3UNQSTMbI4uNzbuPnMNUGJDY5E2yK8leAcxwByjw4U ZNfVbuYjSPdXq52/Ayp6jdhHXnp3+RTPyHrSKQx02hjSRiRwGY7gBl0+juR5GA3fPZsF aVtkp/64BHebfufshxzUiG+AqpozZ1wxas+cdU6dWBIKiSlEtF3Hjksxf6Huai2bTtH5 uvJawg7lLxqJ7sELBt3D1iSLrnNW0DjGfnN9Q7EJx0wsc2QqeYoeVEOCuvRG+s38a2u0 GUiIlsIrzMlrnnKUaMoUda1EH/JtKbeqsVuew5AjnKgv+wGgKkw5ZmWGwfMKdGx/yxkM 9SlQ== 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:mime-version:content-transfer-encoding; bh=FG9o/lWsV4yGfdKR8dDoa04LKopAlyxISU7r7uX9blY=; b=cx91+ibsz/bkHQa8LrQT0Lj93NoebF83AwD+HFi+b7Lio0Zbk2N1AAk6aId08Ru6V7 gGIerUL6Iq5wZlSlYFVKAoT/G9RKTCmqBR/+0wg8nvjMabDrK0ULnRGBhUZ/5OqXsBMs GRrTI7/sKS9oH80Ck/elreNzeDb196rILhBgLx5gARd3SCesbKvZxAtD7zqH0GrXIlWh y/714TRAI+VYlCLfTruhOjz72qNHgk3CnZvcI0NTPJa8ACihXP1LBMilFGn4+CJQ91+l RFklZrIYfFr54/Wi7FoDtM6eIYK6urkJ2dRilQRjli7iou08dValyOCLI8xi/3uGDLx5 ZhnA== X-Gm-Message-State: AA+aEWYcV8VkkgWnFRsx8/mQ3hjm8MCiNSVJSeECFuZ4hBb+RadVO7pI 6Sgzz378D0kRDRtFCoydx6b8pLdY X-Google-Smtp-Source: AFSGD/WG0nQtGks0B36jpAPweswcwjoRSAlpeZWIDlhjfGsQaqqa38Gs/92gz0M5V5bRGhRaXGcgNQ== X-Received: by 2002:a1c:b515:: with SMTP id e21mr9341401wmf.82.1544980922573; Sun, 16 Dec 2018 09:22:02 -0800 (PST) Received: from localhost.localdomain ([2a02:a03f:4059:bc00:511d:a2f9:81d4:4b91]) by smtp.gmail.com with ESMTPSA id z17sm9064743wrv.2.2018.12.16.09.22.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Dec 2018 09:22:02 -0800 (PST) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 6/6] show-parse: use show_typename() instead of show_type() Date: Sun, 16 Dec 2018 18:21:51 +0100 Message-Id: <20181216172151.1361-7-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181216172151.1361-1-luc.vanoostenryck@gmail.com> References: <20181216172151.1361-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 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 show_type() is essentially a copy of show_typename() which also outputs its result to stdout. Replace its unique use by a call to show_typename() + printf() so this function name can be used later for a version which display only a type and not the associated identifier. Signed-off-by: Luc Van Oostenryck --- show-parse.c | 13 +------------ symbol.h | 1 - 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/show-parse.c b/show-parse.c index 7bff8f95f..1fa936b50 100644 --- a/show-parse.c +++ b/show-parse.c @@ -406,17 +406,6 @@ out: name->end--; } -void show_type(struct symbol *sym) -{ - char array[200]; - struct type_name name; - - name.start = name.end = array+100; - do_show_type(sym, &name); - *name.end = 0; - printf("%s", name.start); -} - const char *show_typename(struct symbol *sym) { static char array[200]; @@ -438,7 +427,7 @@ void show_symbol(struct symbol *sym) if (sym->ctype.alignment) printf(".align %ld\n", sym->ctype.alignment); - show_type(sym); + printf("%s", show_typename(sym)); type = sym->ctype.base_type; if (!type) { printf("\n"); diff --git a/symbol.h b/symbol.h index 91e1ea730..77c91c171 100644 --- a/symbol.h +++ b/symbol.h @@ -306,7 +306,6 @@ extern void init_builtins(int stream); extern void declare_builtins(void); extern void init_ctype(void); extern struct symbol *alloc_symbol(struct position, int type); -extern void show_type(struct symbol *); extern const char *modifier_string(unsigned long mod); extern void show_symbol(struct symbol *); extern int show_symbol_expr_init(struct symbol *sym);