From patchwork Fri Aug 12 08:31:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yaakov Selkowitz X-Patchwork-Id: 73835 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp59448qga; Fri, 12 Aug 2016 01:32:07 -0700 (PDT) X-Received: by 10.66.162.4 with SMTP id xw4mr24986472pab.97.1470990727885; Fri, 12 Aug 2016 01:32:07 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id j8si7841496paj.168.2016.08.12.01.32.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Aug 2016 01:32:07 -0700 (PDT) Received-SPF: pass (google.com: domain of newlib-return-13975-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of newlib-return-13975-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=newlib-return-13975-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=XlFzunX6WnZVEcEy5Z3DhVFXXXO14cb Aj3tehreNhEvW7KixHht+BJBMYc3qeLiM0m5mbv3j/YIfszhYVobDZ87uzPNsjRk Z914UUhQK8ouZ7II7pNhyayN/lV19EHqaHWBp5cnklSrF4scOlBLRDE0BAvv9dGi Rb0cNUmwbAG8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=tfei9eW7tfmjMUImMXAJduQZimM=; b=GktlR z3qj3CGkCAQ6PH25l2gT6CcJsJlJqmAGo3lCNjJA/zqaYUHvfV35jCXw0KtL9Fgm 5JQo8mz+4RYCd16PD1zm3cHcEeuIAlqjjqcm8Hs9vo9lhz8KpDqc9PmNBAt+hy+M V7Qltuq/UEU/AyE0I/KZ3h06/skC6kNn0FoF2s= Received: (qmail 54027 invoked by alias); 12 Aug 2016 08:31:59 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Delivered-To: mailing list newlib@sourceware.org Received: (qmail 54014 invoked by uid 89); 12 Aug 2016 08:31:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=va_list, stddefh, stddef.h, UD:stddef.h X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Aug 2016 08:31:48 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E4E7D3F725 for ; Fri, 12 Aug 2016 08:31:46 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-66.rdu2.redhat.com [10.10.116.66]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7C8VjZS021232 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 12 Aug 2016 04:31:46 -0400 From: Yaakov Selkowitz To: newlib@sourceware.org Subject: [PATCH] Define va_list in stdio.h and wchar.h Date: Fri, 12 Aug 2016 03:31:37 -0500 Message-Id: <20160812083137.8904-1-yselkowi@redhat.com> In-Reply-To: <571177E5.8040201@cygwin.com> References: <571177E5.8040201@cygwin.com> This typedef, along with that of FILE in wchar.h, were XSI prior to inclusion in POSIX.1-2008. Fixes: https://sourceware.org/ml/newlib/2016/msg00640.html Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/stdio.h | 13 +++++++++++++ newlib/libc/include/wchar.h | 21 ++++++++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) -- 2.8.3 diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index 866d816..097b0f6 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -35,9 +35,22 @@ #include #include +/* typedef only __gnuc_va_list, used throughout the header */ #define __need___va_list #include +/* typedef va_list only when required */ +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE +#ifdef __GNUC__ +#ifndef _VA_LIST_DEFINED +typedef __gnuc_va_list va_list; +#define _VA_LIST_DEFINED +#endif +#else /* !__GNUC__ */ +#include +#endif +#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ + /* * defines __FILE, _fpos_t. * They must be defined there because struct _reent needs them (and we don't diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h index e5b840d..f4996ec 100644 --- a/newlib/libc/include/wchar.h +++ b/newlib/libc/include/wchar.h @@ -11,15 +11,28 @@ #define __need_NULL #include -#define __need___va_list -#include - /* For _mbstate_t definition. */ #include #include /* For __STDC_ISO_10646__ */ #include +/* typedef only __gnuc_va_list, used throughout the header */ +#define __need___va_list +#include + +/* typedef va_list only when required */ +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE +#ifdef __GNUC__ +#ifndef _VA_LIST_DEFINED +typedef __gnuc_va_list va_list; +#define _VA_LIST_DEFINED +#endif +#else /* !__GNUC__ */ +#include +#endif +#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ + #if __XSI_VISIBLE /* && __XSI_VISIBLE < 800 */ #include #endif @@ -52,11 +65,13 @@ _BEGIN_STD_C +#if __POSIX_VISIBLE >= 200809 || _XSI_VISIBLE /* As in stdio.h, defines __FILE. */ #if !defined(__FILE_defined) typedef __FILE FILE; # define __FILE_defined #endif +#endif /* As required by POSIX.1-2008, declare tm as incomplete type. The actual definition is in time.h. */