On Tue, Jan 17, 2017 at 08:19:23AM +1300, Evan Hanson wrote:
> Regarding the new warnings you're seeing, Peter, unfortunately I can't
> reproduce them. I've now tried all three combinations of Cygwin and
> Windows 7 (32 vs. 64-bit), and the _XOPEN_SOURCE declaration seems to
> work fine as-is on all of them for me. The x86 box I used was from
> modern.ie, too, which AIUI is what you're using as well(?), so I'm at a
> bit of a loss. Are you using the setup-x86.exe Cygwin installers from
> cygwin.com?

Yeah, that's the one I was using.  I've performed a system update of my
Cygwin install (which was at least a year old or so), and that seems to
have fixed the problem.  Sorry for bothering you with a red herring!

Unfortunately, the _XOPEN_SOURCE definition without a value broke the
build on MingW, it says something like:

  error: operator '<' has no left operand
  # if _XOPEN_SOURCE < 500

According to feature_test_macros, we can also define it to a value to
set a specific level of POSIX/XOPEN support.

Attached is a modified version of the patch which sets _XOPEN_SOURCE
to 700, which unlocks SUSv4 / POSIX.1-2008 support.  I've tested this
and an added benefit is that setting it to 700 also makes a warning 
about "implicit declaration of function nanosleep()" go away on GNU Hurd.

I've tested it on MingW, Cygwin, Hurd and Linux.

Looks to me like if this is applied the only thing that remains is the
compiler warnings on OpenBSD (#1107), which are unrelated to these
implicitly declared functions.

Cheers,
Peter
From 667ea3fc7b62d5d19965a7d1dad501118acfe5ff Mon Sep 17 00:00:00 2001
From: Evan Hanson <ev...@foldling.org>
Date: Fri, 13 Jan 2017 16:08:03 +1300
Subject: [PATCH] Add _XOPEN_SOURCE feature test macro

This provides access to strptime(3) from <time.h>, which is otherwise
undefined on at least Cygwin and possibly other platforms.

Signed-off-by: Peter Bex <pe...@more-magic.net>
---
 chicken.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/chicken.h b/chicken.h
index 4ae93e0..2adbc38 100644
--- a/chicken.h
+++ b/chicken.h
@@ -47,6 +47,10 @@
 # define __C99FEATURES__
 #endif
 
+#ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE   700
+#endif
+
 #ifndef _BSD_SOURCE
 # define _BSD_SOURCE
 #endif
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to