From patchwork Fri Jul 19 10:33:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 2830439 Return-Path: X-Original-To: patchwork-linux-sparse@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5E698C0319 for ; Fri, 19 Jul 2013 10:33:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8553920365 for ; Fri, 19 Jul 2013 10:33:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 957E120356 for ; Fri, 19 Jul 2013 10:33:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965192Ab3GSKdy (ORCPT ); Fri, 19 Jul 2013 06:33:54 -0400 Received: from mail-ye0-f182.google.com ([209.85.213.182]:51325 "EHLO mail-ye0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965089Ab3GSKdx (ORCPT ); Fri, 19 Jul 2013 06:33:53 -0400 Received: by mail-ye0-f182.google.com with SMTP id m12so1236314yen.13 for ; Fri, 19 Jul 2013 03:33:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=XzEXfw4b/hTRESvoV9Is6yDzoc188XDD7EXe43bhpis=; b=o0vYv1vmdQW3TJ8sIrUOHs4iaskASyZnHENALp9FKaO22h6h0mjAVbvj1Vz/QAYKwh k9cSF96xYI/Fie8ghDgcevVYgMpIfioaHLHuCyQYBxEhnBRSGr45VSeN0KoVNoul4tGh RlSS6jUKUDf4Jo8Nn/vmJPL3HNrhV/h0q7AxbrkFyt47pgattda4ZTPdWd3E0nWXvuvs OpBOBitsT16Pbt7FZ427EADNpMudGHbYPfZkbDjKOhRD4/JHQHJ5JrFHrpavDySx5INH N5Q5tx/rF9zqvxYzoy4mfkK8l+n3tl1IxYWRV4uN5nyDSw4anmVKj7nc2CypQFdh1iUY RjjA== X-Received: by 10.236.182.41 with SMTP id n29mr8165979yhm.234.1374230032799; Fri, 19 Jul 2013 03:33:52 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-124-230.nc.res.rr.com. [107.15.124.230]) by mx.google.com with ESMTPSA id i27sm20584070yhj.24.2013.07.19.03.33.51 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 19 Jul 2013 03:33:52 -0700 (PDT) From: Jeff Layton To: linux-sparse@vger.kernel.org Cc: penberg@kernel.org, sparse@chrisli.org Subject: [PATCH v2] sparse: add __builtin_va_arg_pack() and __builtin_va_arg_pack_len() Date: Fri, 19 Jul 2013 06:33:40 -0400 Message-Id: <1374230020-26826-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: X-Gm-Message-State: ALoCoQnYfT2LzZbUP4yel75pR0j9iWZf6fvU43jtoCbkVP3rlCG+Zb0qb5iFPS3QmjkSoiq6WmjP Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP this patch stops sparse from complaining about them not being defined: /usr/include/bits/stdio2.h:98:25: error: undefined identifier '__builtin_va_arg_pack' /usr/include/bits/stdio2.h:98:25: error: not a function Signed-off-by: Jeff Layton --- lib.c | 2 ++ validation/builtin_va_arg_pack.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 validation/builtin_va_arg_pack.c diff --git a/lib.c b/lib.c index 7e822eb..3f687ae 100644 --- a/lib.c +++ b/lib.c @@ -777,6 +777,7 @@ void declare_builtin_functions(void) add_pre_buffer("extern long __builtin_alpha_cmpbge(long, long);\n"); add_pre_buffer("extern long __builtin_labs(long);\n"); add_pre_buffer("extern double __builtin_fabs(double);\n"); + add_pre_buffer("extern __SIZE_TYPE__ __builtin_va_arg_pack_len(void);\n"); add_pre_buffer("extern void __sync_synchronize();\n"); add_pre_buffer("extern int __sync_bool_compare_and_swap(void *, ...);\n"); @@ -876,6 +877,7 @@ void create_builtin_stream(void) add_pre_buffer("#define __builtin_va_copy(dest, src) ({ dest = src; (void)0; })\n"); add_pre_buffer("#define __builtin_va_end(arg)\n"); add_pre_buffer("#define __builtin_ms_va_end(arg)\n"); + add_pre_buffer("#define __builtin_va_arg_pack()\n"); /* FIXME! We need to do these as special magic macros at expansion time! */ add_pre_buffer("#define __BASE_FILE__ \"base_file.c\"\n"); diff --git a/validation/builtin_va_arg_pack.c b/validation/builtin_va_arg_pack.c new file mode 100644 index 0000000..3426b86 --- /dev/null +++ b/validation/builtin_va_arg_pack.c @@ -0,0 +1,20 @@ +extern void v(int a, ...); + +extern inline __attribute__((__always_inline__)) void f(int a, ...) +{ + __SIZE_TYPE__ b = __builtin_va_arg_pack_len(); +} + +extern inline __attribute__((__always_inline__)) void g(int a, ...) +{ + v(a, __builtin_va_arg_pack()); +} + +static void h(void) +{ + f(0, 0); + g(0, 0); +} +/* + * check-name: __builtin_va_arg_pack() + */