From patchwork Tue Feb 26 02:36:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 1048059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-497011-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="KmiTD9GA"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 447jcW0R3gz9s4V for ; Tue, 26 Feb 2019 13:36:24 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=mHVkmggKnN+NE1hhOyPrRxpbVK54+PQ2HtVQXzFI6pESkVbeZt ooa8b9aGZaUtuFPnbGuh9mytagcfpb8IqqHpykXU6EMMHrH2MkwoIQqIyrLdBLEK BTPss9EJOzlvZ6kYcTCnmaDcpg2GNZlF8xQFcJFEu0ht3FPp7MZ7TtWyQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=0anWv3FmfMMbhZ0QYKm8fJ4xgSU=; b=KmiTD9GAcGD5QbTquQfZ wXQD0c3RB49FboobyslLurtVwP+2l54aU1lmGn8eDtNMuSZ1IeeEtqf8XEkNRi+e aCBculwsaqB+uoaBQnz82UiWpVkreQ7oj7HVheciqflNZqfM3GvFBMwe3SEXQSvS 1sHZd/exO8wdmB00MNe3oG0= Received: (qmail 62935 invoked by alias); 26 Feb 2019 02:36:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 62876 invoked by uid 89); 26 Feb 2019 02:36:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.4 required=5.0 tests=BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=c90, H*F:U*sandra, C90, H*r:0800 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Feb 2019 02:36:14 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gySbM-0000Je-BB from Sandra_Loosemore@mentor.com for gcc-patches@gcc.gnu.org; Mon, 25 Feb 2019 18:36:12 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 25 Feb 2019 18:36:10 -0800 To: "gcc-patches@gcc.gnu.org" From: Sandra Loosemore Subject: [doc, committed] fix PR c/80409 Message-ID: <9dcba733-0b8b-91c4-7922-54a45e536d0e@codesourcery.com> Date: Mon, 25 Feb 2019 19:36:06 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 I've checked in this patch to document the GNU extension to va_arg for pointer types, which is really a POSIX extension per discussion in the issue. -Sandra Index: gcc/doc/extend.texi =================================================================== --- gcc/doc/extend.texi (revision 269202) +++ gcc/doc/extend.texi (working copy) @@ -47,6 +47,7 @@ extensions, accepted by GCC in C90 mode * Escaped Newlines:: Slightly looser rules for escaped newlines. * Subscripting:: Any array can be subscripted, even if not an lvalue. * Pointer Arith:: Arithmetic on @code{void}-pointers and function pointers. +* Variadic Pointer Args:: Pointer arguments to variadic functions. * Pointers to Arrays:: Pointers to arrays with qualifiers work as expected. * Initializers:: Non-constant initializers. * Compound Literals:: Compound literals give structures, unions @@ -1944,6 +1945,22 @@ and on function types, and returns 1. The option @option{-Wpointer-arith} requests a warning if these extensions are used. +@node Variadic Pointer Args +@section Pointer Arguments in Variadic Functions +@cindex pointer arguments in variadic functions +@cindex variadic functions, pointer arguments + +Standard C requires that pointer types used with @code{va_arg} in +functions with variable argument lists either must be compatible with +that of the actual argument, or that one type must be a pointer to +@code{void} and the other a pointer to a character type. GNU C +implements the POSIX XSI extension that additionally permits the use +of @code{va_arg} with a pointer type to receive arguments of any other +pointer type. + +In particular, in GNU C @samp{va_arg (ap, void *)} can safely be used +to consume an argument of any pointer type. + @node Pointers to Arrays @section Pointers to Arrays with Qualifiers Work as Expected @cindex pointers to arrays