From patchwork Fri Apr 1 22:49:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yaakov Selkowitz X-Patchwork-Id: 64908 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp76995lbc; Fri, 1 Apr 2016 15:49:55 -0700 (PDT) X-Received: by 10.98.16.150 with SMTP id 22mr2059538pfq.128.1459550995114; Fri, 01 Apr 2016 15:49:55 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 79si23266367pfo.227.2016.04.01.15.49.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Apr 2016 15:49:55 -0700 (PDT) Received-SPF: pass (google.com: domain of newlib-return-13424-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-13424-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=newlib-return-13424-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=sZOmAs63LmnbvycV9zGpUtAZ9rj9iqy JWuVPQC//9Bd8fLDIZ8vdKUe9F1v1ioUR23CgTCq4DeKbkpzSQUssPHYw5bhKsLF cfwoK50aIhh2GonXK4bDkK4vPpQyjokif0GEVPk+rWkFvR+2iu5HnWBBmOHQhmOb 7xPatL1OF/SM= 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=KfqBeTMjC5zIOSlJS9OjnJluXuU=; b=waeu1 NgOMWzgQuyabk+T47lKMCOWuvF4bWY5hqncTqIfHqHdI8YOr8x4PKv+dYP2GrYUF wimWgn9AxtU1QkxqTvwWCfx34tQQi9gQIHQbaqnakm2E3PYgPrp4w4kRwUl6b+cF Nds+RUqrw5pbi5bv//Ao18B7OMs7Jwco9jxyPI= Received: (qmail 56338 invoked by alias); 1 Apr 2016 22:49:40 -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 56223 invoked by uid 89); 1 Apr 2016 22:49:39 -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=5.2, SUS, Hx-languages-length:3524, 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; Fri, 01 Apr 2016 22:49:38 +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 41FC91E21 for ; Fri, 1 Apr 2016 22:49:37 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-17.rdu2.redhat.com [10.10.116.17]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u31MnZxf009521 (version=TLSv1/SSLv3 cipher=AES256-SHA256 bits=256 verify=NO) for ; Fri, 1 Apr 2016 18:49:36 -0400 From: Yaakov Selkowitz To: newlib@sourceware.org Subject: [PATCH 2/2] cygwin: make POSIX/XSI version macros dependent on feature test macros Date: Fri, 1 Apr 2016 17:49:30 -0500 Message-Id: <1459550970-3424-2-git-send-email-yselkowi@redhat.com> In-Reply-To: <1459550970-3424-1-git-send-email-yselkowi@redhat.com> References: <1459550970-3424-1-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 | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) -- 2.7.4 diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h index 86297de..4cf1b28 100644 --- a/newlib/libc/include/sys/features.h +++ b/newlib/libc/include/sys/features.h @@ -382,10 +382,9 @@ extern "C" { #ifdef __CYGWIN__ -#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L -#define _POSIX_VERSION 200809L -#define _POSIX2_VERSION 200809L -#define _XOPEN_VERSION 600 +#if __POSIX_VISIBLE +#define _POSIX_VERSION (long)__POSIX_VISIBLE +#endif #define _POSIX_ADVISORY_INFO 200809L /* #define _POSIX_ASYNCHRONOUS_IO -1 */ @@ -428,16 +427,20 @@ 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_VERSION (long)__POSIX_VISIBLE +#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 +450,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 +464,17 @@ 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_VERSION __XSI_VISIBLE #define _XOPEN_CRYPT 1 #define _XOPEN_ENH_I18N 1 /* #define _XOPEN_LEGACY -1 */ @@ -471,8 +483,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