From patchwork Mon Jun 19 21:14:54 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: 9797829 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 4438E601C8 for ; Mon, 19 Jun 2017 21:15:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 566BA28397 for ; Mon, 19 Jun 2017 21:15:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B5242846C; Mon, 19 Jun 2017 21:15: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=-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 EDE0128397 for ; Mon, 19 Jun 2017 21:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751988AbdFSVPA (ORCPT ); Mon, 19 Jun 2017 17:15:00 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34516 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751882AbdFSVO7 (ORCPT ); Mon, 19 Jun 2017 17:14:59 -0400 Received: by mail-wm0-f68.google.com with SMTP id f134so1485203wme.1 for ; Mon, 19 Jun 2017 14:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=cSL7Bjiea78gq7WbFvOOUP9G0QfTS2NobsM/9KZUs0Q=; b=cnv7rjfb7Ysu/WXiwBG57u1CPODvc2hW1l6QMBbulSw++WslGEatJKuskKHlN72xwU yJcfnWMmMKg8K4nF7dRB/bsz98I5SkFwI5/CnT1NI8udAQN1aD4yCgV3jkGzQ+xzYINo f9FxTc8QnGLGCzt0I2JwNOr4QwTTtCnaHa82J70xc8aBTautkIE7NRHL2LfdxruYaOW9 VwHKVSBGu33wacyACoyoMEBJOVvAsF9agx8ijxXVBMNGntAwFnFVF4zyX+b1jGyxrTYh UyAidFF70uo345gRZH6Q5WQK6b0DTXKUU2WP9ADLuy6vO9nmHFFtyXQo/IZ74xq30V1z vOnQ== 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; bh=cSL7Bjiea78gq7WbFvOOUP9G0QfTS2NobsM/9KZUs0Q=; b=cowEmC+g+vi7H8xcLlX2NwmGtBSFzLyV3gsWym2Hbp/EAHFCOPB4cruqKGhbgYrzq2 5vCpODdE0ZahQ16JsurvPfHGwcIAyxFiK/p5lUhEKnz2YuxEZ3v2v+/zsc0bd6S3ZzcD CEuohWIKBLN0MXfJOhkJexefWB/kGFakH//UpV/EeScNfTUEPfMxP/tItClObQe4lX/E qJSQlahe8hhByV9kiCbEbQlVmYVCYz3SsDybGuKttzYzuAYN8NbYGdq6Jnr0WrQqzuwW +phhR1c138E5PbgMGEcF7BunYUQw49lNNrnLd/8iHb0Q/2Tx6knJn07N1jYLBwsR+L/V 7fXg== X-Gm-Message-State: AKS2vOyqxziftrONQbbzMuYeoC/eSlq9Buf3VG9a1YksJcX9kyPWQQPd cl2dgug9h/YSUkfINUo= X-Received: by 10.80.153.143 with SMTP id m15mr18775967edb.35.1497906898157; Mon, 19 Jun 2017 14:14:58 -0700 (PDT) Received: from localhost.localdomain ([91.177.84.115]) by smtp.gmail.com with ESMTPSA id c23sm5307506edc.34.2017.06.19.14.14.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jun 2017 14:14:57 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Chris Li , Luc Van Oostenryck , Oleg Nesterov Subject: [PATCH] dissect: use built_in_ident() instead of MK_IDENT() Date: Mon, 19 Jun 2017 23:14:54 +0200 Message-Id: <20170619211454.45244-1-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.13.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 The motivation for this patch was to allow sparse to be compiled with clang which doesn't like what is done on VLAs in the MK_IDENT() macro. But also, I can't see any justification for not using the real thing to create identifiers: built_in_ident(). CC: Oleg Nesterov Signed-off-by: Luc Van Oostenryck --- dissect.h | 13 ------------- test-dissect.c | 6 +++--- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/dissect.h b/dissect.h index 3b72b8988..5ac1f4d40 100644 --- a/dissect.h +++ b/dissect.h @@ -25,16 +25,3 @@ struct reporter }; extern void dissect(struct symbol_list *, struct reporter *); - -#define MK_IDENT(s) ({ \ - static struct { \ - struct ident ident; \ - char __[sizeof(s)]; \ - } ident = {{ \ - .len = sizeof(s)-1, \ - .name = s, \ - }}; \ - &ident.ident; \ -}) - -#endif diff --git a/test-dissect.c b/test-dissect.c index a2548b7f2..862318f81 100644 --- a/test-dissect.c +++ b/test-dissect.c @@ -47,7 +47,7 @@ static void r_symbol(unsigned mode, struct position *pos, struct symbol *sym) print_usage(pos, sym, mode); if (!sym->ident) - sym->ident = MK_IDENT("__asm__"); + sym->ident = built_in_ident("__asm__"); printf("%-32.*s %s\n", sym->ident->len, sym->ident->name, @@ -60,10 +60,10 @@ static void r_member(unsigned mode, struct position *pos, struct symbol *sym, st print_usage(pos, sym, mode); - ni = MK_IDENT("?"); + ni = built_in_ident("?"); si = sym->ident ?: ni; /* mem == NULL means entire struct accessed */ - mi = mem ? (mem->ident ?: ni) : MK_IDENT("*"); + mi = mem ? (mem->ident ?: ni) : built_in_ident("*"); printf("%.*s.%-*.*s %s\n", si->len, si->name,