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