From patchwork Mon Apr 4 06:18:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yaakov Selkowitz X-Patchwork-Id: 64950 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1009919lbc; Sun, 3 Apr 2016 23:19:27 -0700 (PDT) X-Received: by 10.98.11.78 with SMTP id t75mr18014255pfi.72.1459750767498; Sun, 03 Apr 2016 23:19:27 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id uk4si1045809pab.234.2016.04.03.23.19.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Apr 2016 23:19:27 -0700 (PDT) Received-SPF: pass (google.com: domain of newlib-return-13434-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-13434-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=newlib-return-13434-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=vtiLeSgh5dDGakLyhyJfncKjGkca+Lw pJf2tA4ECeQjBX8SdmNlvKo2m7WXI6u1K/o9zdZ8/tLuVdYuS+rSFjlWunKazn5A /+9vHDYf5dEVduBDZqayYDF8S0N4YDlSz3tI5eqfQ67ggEFMLx6SZhi14UlZjFpp +9QHDsq7EJHY= 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=HsWNljeLXoSrZn24WFUiV+mWwh4=; b=bPCrf zVefHS5UnAz+lUJiHesVwxof/blT/3NOGkqxDqNAe3H4qaZUdnVjDhkBGEy4Fm9g qVEYAS16SwSKkTNghDy5lYXUC0rAos2R+w+vhWLYkON8Q3Pm0mMacb+DzFtSFPrM 74MEmtHzB2Of9fs+wV71kOiHesPMR8JPjw+MJo= Received: (qmail 118076 invoked by alias); 4 Apr 2016 06:19:17 -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 118061 invoked by uid 89); 4 Apr 2016 06:19:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sus 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 04 Apr 2016 06:19:15 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (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 1553C7F08B for ; Mon, 4 Apr 2016 06:19:14 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-26.rdu2.redhat.com [10.10.116.26]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u346JC1W013245 (version=TLSv1/SSLv3 cipher=AES256-SHA256 bits=256 verify=NO) for ; Mon, 4 Apr 2016 02:19:13 -0400 From: Yaakov Selkowitz To: newlib@sourceware.org Subject: [PATCH v2] cygwin: make POSIX/XSI version macros dependent on feature test macros Date: Mon, 4 Apr 2016 01:18:56 -0500 Message-Id: <1459750736-9636-1-git-send-email-yselkowi@redhat.com> In-Reply-To: <1459550970-3424-2-git-send-email-yselkowi@redhat.com> References: <1459550970-3424-2-git-send-email-yselkowi@redhat.com> Each version of SUS specifies a different value for _POSIX_VERSION, _POSIX2_VERSION, and _XOPEN_VERSION. glibc also changes the value of the other _POSIX2_ variables but not the _POSIX_* variables. _POSIX_TIMERS should be set to a version number, not just 1. The _POSIX_V7_* macros were missing, which was not noticed because the V6 values were aliased in sysconf (). Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/sys/features.h | 47 ++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 10 deletions(-) -- 2.7.4 diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h index 86297de..dbc4ebe 100644 --- a/newlib/libc/include/sys/features.h +++ b/newlib/libc/include/sys/features.h @@ -382,10 +382,27 @@ extern "C" { #ifdef __CYGWIN__ -#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L +#if __POSIX_VISIBLE >= 200809 #define _POSIX_VERSION 200809L #define _POSIX2_VERSION 200809L -#define _XOPEN_VERSION 600 +#elif __POSIX_VISIBLE >= 200112 +#define _POSIX_VERSION 200112L +#define _POSIX2_VERSION 200112L +#elif __POSIX_VISIBLE >= 199506 +#define _POSIX_VERSION 199506L +#define _POSIX2_VERSION 199506L +#elif __POSIX_VISIBLE >= 199309 +#define _POSIX_VERSION 199309L +#define _POSIX2_VERSION 199209L +#elif __POSIX_VISIBLE >= 199209 +#define _POSIX_VERSION 199009L +#define _POSIX2_VERSION 199209L +#elif __POSIX_VISIBLE +#define _POSIX_VERSION 199009L +#endif +#if __XSI_VISIBLE >= 4 +#define _XOPEN_VERSION __XSI_VISIBLE +#endif #define _POSIX_ADVISORY_INFO 200809L /* #define _POSIX_ASYNCHRONOUS_IO -1 */ @@ -428,16 +445,19 @@ extern "C" { /* #define _POSIX_THREAD_SPORADIC_SERVER -1 */ #define _POSIX_THREADS 200809L /* #define _POSIX_TIMEOUTS -1 */ -#define _POSIX_TIMERS 1 +#define _POSIX_TIMERS 200809L /* #define _POSIX_TRACE -1 */ /* #define _POSIX_TRACE_EVENT_FILTER -1 */ /* #define _POSIX_TRACE_INHERIT -1 */ /* #define _POSIX_TRACE_LOG -1 */ /* #define _POSIX_TYPED_MEMORY_OBJECTS -1 */ #define _POSIX_VDISABLE '\0' -#define _POSIX2_C_BIND 200809L -#define _POSIX2_C_DEV 200809L -#define _POSIX2_CHAR_TERM 200809L + +#if __POSIX_VISIBLE >= 2 +#define _POSIX2_C_VERSION _POSIX2_VERSION +#define _POSIX2_C_BIND _POSIX2_VERSION +#define _POSIX2_C_DEV _POSIX2_VERSION +#define _POSIX2_CHAR_TERM _POSIX2_VERSION /* #define _POSIX2_FORT_DEV -1 */ /* #define _POSIX2_FORT_RUN -1 */ /* #define _POSIX2_LOCALEDEF -1 */ @@ -447,8 +467,10 @@ extern "C" { /* #define _POSIX2_PBS_LOCATE -1 */ /* #define _POSIX2_PBS_MESSAGE -1 */ /* #define _POSIX2_PBS_TRACK -1 */ -#define _POSIX2_SW_DEV 200809L -#define _POSIX2_UPE 200809L +#define _POSIX2_SW_DEV _POSIX2_VERSION +#define _POSIX2_UPE _POSIX2_VERSION +#endif /* __POSIX_VISIBLE >= 2 */ + #define _POSIX_V6_ILP32_OFF32 -1 #ifdef __LP64__ #define _POSIX_V6_ILP32_OFFBIG -1 @@ -459,10 +481,16 @@ extern "C" { #define _POSIX_V6_LP64_OFF64 -1 #define _POSIX_V6_LPBIG_OFFBIG -1 #endif +#define _POSIX_V7_ILP32_OFF32 _POSIX_V6_ILP32_OFF32 +#define _POSIX_V7_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG +#define _POSIX_V7_LP64_OFF64 _POSIX_V6_LP64_OFF64 +#define _POSIX_V7_LPBIG_OFFBIG _POSIX_V6_LPBIG_OFFBIG #define _XBS5_ILP32_OFF32 _POSIX_V6_ILP32_OFF32 #define _XBS5_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG #define _XBS5_LP64_OFF64 _POSIX_V6_LP64_OFF64 #define _XBS5_LPBIG_OFFBIG _POSIX_V6_LPBIG_OFFBIG + +#if __XSI_VISIBLE #define _XOPEN_CRYPT 1 #define _XOPEN_ENH_I18N 1 /* #define _XOPEN_LEGACY -1 */ @@ -471,8 +499,7 @@ extern "C" { #define _XOPEN_SHM 1 /* #define _XOPEN_STREAMS -1 */ /* #define _XOPEN_UNIX -1 */ - -#endif /* !__STRICT_ANSI__ || __cplusplus || __STDC_VERSION__ >= 199901L */ +#endif /* __XSI_VISIBLE */ /* The value corresponds to UNICODE version 4.0, which is the version supported by XP. Newlib supports 5.2 (2011) but so far Cygwin needs