Web lists-archives.com

Re: [Mingw-users] _XOPEN_SOURCE




-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 22/04/17 11:28, Keith Marshall wrote:
> ... I favour leaving <_mingw.h> as-is; maintainers of affected
> applications should be encouraged to comply with the standards
> which are applicable _today_, and these make it mandatory to define 
> _XOPEN_SOURCE *with* an appropriate value.  We shouldn't simply 
> sweep obsolete usage under the rug; if we *must* tolerate it, then
> we should at least devise a strategy for nagging errant maintainers
> about it. 

Possibly by adding something like the attached to <_mingw.h>, before 
any other reference to _XOPEN_SOURCE?  (Yes, it is pretty verbose in 
its criticism of obsolete usage, but then, we want it to be so, don't 
we?  It does seem to DTRT, for me).

- -- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iQIcBAEBAgAGBQJY+1RsAAoJEMCtNsY0flo/uLoP/Amz+wOdKOXarKbdzoK/M5lT
rTCjRf4foAqmoG1Ae/pUqePh65AMKRdJetUIpJmbszeaZzbBJyEJJd0mc9ZiQ1bt
UxmMMGlFNPdQUUMeeTfwD1CEFTxA0y6obIAEpCBSilZX7aYwaVfDCaRUzCi+yabJ
7io7eZljKATZA1Ue/OQwbFfSUmQ27Mw45aQqvrYwv/sSKJQfZNz9QJ7ISsB3Cdw/
BDXrxIXAAb8ApmnHBDNWdgNhSypn9h0bjZx5g3U8meNzvUiwI6NoTkXrhJM4YuPM
IrNHy3GgrlVL4zRxUsD6v2d/WGIA7cxmKNMeY2E65w7MAq3mkXhKvo6p7WxhZm3e
+N4YDPwQ3TS4U1QC+g4IdaoX7rVeJ8IrMAx1ZGoI73esRcg974yG4hh0U9hb5KBw
9Z/fotASpUf6omM+vcjR/XChsWONIJDazgP/aVQEiyvGh+zO6JXYS4FMmOvtujJl
l6E24CP5U9ss3Il6pu3PeeFXn/oUR4tVq44VKEDIH4+tVBE2U1LlWzLVXMrwn/v0
QyvVIhvJgaO/zQ2psemCbnXG8wxBLdk83NIlaRDynBB/0z+THB1DofgaKEIqkzKV
Q6QA2JdkqurqrOHreCMc3KOLz7/QldkiN8+0O6IUS/P0mLEYWTkU46PLbWSUefGR
UEnprtjKZ+34/zZzm4H4
=fKyG
-----END PGP SIGNATURE-----
# HG changeset patch
# Parent bb4262073809ef999d1b6843533733913730660c
Automatically correct obsolete _XOPEN_SOURCE usage.

diff --git a/mingwrt/include/_mingw.h.in b/mingwrt/include/_mingw.h.in
--- a/mingwrt/include/_mingw.h.in
+++ b/mingwrt/include/_mingw.h.in
@@ -399,10 +399,43 @@ allow GCC to optimize away some EH unwin
     */
 #  define __USE_MINGW_ANSI_STDIO    (__MINGW_FEATURES__ & __MINGW_ANSI_STDIO__)
 # endif
 #endif
 
+#if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) == 0
+/* _XOPEN_SOURCE has been defined, but may not have been assigned a
+ * value, (which became mandatory, as of SUSv2).  Attempt to detect,
+ * and rectify this obsolete usage, as it makes it difficult to use
+ * _XOPEN_SOURCE effectively, (without ugly kludges at EVERY point
+ * of reference which attempts a version comparison).
+ */
+#undef __xopen_verify__
+#undef __xopen_extend__
+#define __xopen_verify__(__value__) __xopen_extend__(__value__,10)
+#define __xopen_extend__(__value__,__suffix__) __value__##__suffix__
+
+#if __xopen_verify__(_XOPEN_SOURCE) == 10
+/* _XOPEN_SOURCE usage DOES appear to be obsolete; diagnose (verbosely)...
+ */
+#warning "_XOPEN_SOURCE may have been improperly defined."
+#warning "Mandatory _XOPEN_SOURCE value assignment appears to be missing."
+#warning "Redefining _XOPEN_SOURCE to correct previous anomaly."
+/*
+ * ...and redefine, emulating implicit behaviour of -D_XPOEN_SOURCE on
+ * GCC command line, (which DOES assign an implied value of one).
+ */
+#undef _XOPEN_SOURCE
+#define _XOPEN_SOURCE  1
+#endif	/* _XOPEN_SOURCE value enforcement */
+
+/* Not strictly necessary, but we don't need these again; clean up
+ * our private macro namespace.
+ */
+#undef __xopen_verify__
+#undef __xopen_extend__
+#endif	/* _XOPEN_SOURCE validation */
+
 #ifndef _POSIX_C_SOURCE
  /* Users may define this, either directly or indirectly, to explicitly
   * enable a particular level of visibility for the subset of those POSIX
   * features which are supported by MinGW; (notice that this offers no
   * guarantee that any particular POSIX feature will be supported).
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe