Web lists-archives.com

Re: [Mingw-users] Problems compiling Gnulib-assisted projects with MinGW runtime 3.22.2




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

On 12/10/16 15:34, Eli Zaretskii wrote:
> I still think it would be good to consider relaxing our standard 
> compliance in this one case, even though we are right and glibc is
>  wrong.

I'm not ruling that out, but having made the point that glibc isn't
standards compliant, and that projects which gratuitously depend on its
non-compliances are buggy, I would like to do it in a way which makes it
possible to preserve our compliance, while relaxing it by default.  I
think the attached (untested) patch may achieve that, in this case.

- -- 
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)

iQIcBAEBAgAGBQJX/q5cAAoJEMCtNsY0flo/joEP/2S8V57xxy1PDM33pfaXEsDx
4EXG9h1e2C0c2ePU+un9Hk8m6hYGJZSDEML3MBfYi9sNyAXPQXyavaAQMGDre1Jj
na+FGD0iyvkEk0tIs/YQmYOKHUmuoIdOfR2Egs3+C/no/7K59pUouT/FSie0cuSM
UmEQKbMunJtQNNzDjhg9MvztzUVo+MzWwAGqiKS4nzpaWIKGbAEUsenlSqc6YbMB
OJljShrVrN15IRgNkzvAZzV3FCWTFSq+MP1Rrft+nehZENBUZ0R65UdgUpnN6c8T
Jg0AjwGww9lf21cYzah+n8BMIHSMUCOmC4Pnk7TnGUThxDmWjR4ZGmEkQojUcinp
lnMGCcmToL9mc/Q6Z5/v9LKX9amsLARbo8p9QvDcJ99mV4VinhHZs6mZXGv2cMED
EDGgKSr/65VtFSW28ppDEl4EVuXaWR0R8+HqjeWErV4eqvTkokB50uvAewQjT64G
q5k2wvDy0XfAu864Wj1vuu7kgOFduRmM3Co0y7wzrTmUhEG+AaIxRwEASlQoqiSO
oF6cEiqo9O/n8EP5SiiQ+Q3lsoY+STjlxrueXd+CgBHYrFSpPXiyW8rNQUGkwjXY
8/hJfGeuphgVBnbMY4jAJRTz5W3rWoo/WZTrFeANAw4dtvqK309XfOuTWlEbZOoF
PPNJTseBoaGvUdl4YgDY
=+TkK
-----END PGP SIGNATURE-----
# HG changeset patch
# Parent 146cc9eddcfc0ccfe7cf01d0ce567807ba8770dd
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
@@ -428,10 +428,18 @@ allow GCC to optimize away some EH unwin
    * either GNU or BSD feature support, or does not seek to be strictly
    * ANSI-C compliant.
    */
 #  define _POSIX_C_SOURCE  200809L
 
+#  if ! defined _EMULATE_GLIBC && ! defined _POSIX_SOURCE
+   /* For this default case, unless it has already been specified
+    * otherwise, we enable some GNU glibc extensions, which may be
+    * considered as violations of strict POSIX.1 conformance.
+    */
+#   define _EMULATE_GLIBC  1
+#  endif
+
 # elif defined _POSIX_SOURCE
   /* Now formally deprecated by POSIX, some old code may specify this;
    * it will enable a minimal level of POSIX support, in addition to the
    * limited feature set enabled for strict ANSI-C conformity.
    */
diff --git a/mingwrt/include/string.h b/mingwrt/include/string.h
--- a/mingwrt/include/string.h
+++ b/mingwrt/include/string.h
@@ -50,10 +50,20 @@
   */
 # define __need_wchar_t
 #endif
 #include <stddef.h>
 
+#if _EMULATE_GLIBC
+/* GNU's glibc declares strcasecmp() and strncasecmp() in <string.h>,
+ * contravening POSIX.1-2008 which requires them to be declared only in
+ * <strings.h>; we may emulate this anomalous glibc behaviour, which is
+ * ostensibly to support BSD usage, (in spite of such usage now being
+ * obsolete in BSD), by simply including our <strings.h> here.
+ */
+#include <strings.h>
+#endif
+
 _BEGIN_C_DECLS
 
 #define __STRING_H_SOURCED__
 /* Prototypes for the ISO-C Standard library string functions.
  */
@@ -99,13 +109,16 @@
 _CRTIMP __cdecl __MINGW_NOTHROW  void _swab (const char *, char *, size_t);
 
 /* MSVC's non-ANSI _stricmp() and _strnicmp() functions must also be
  * prototyped here, but we need to share them with <strings.h>, where
  * we declare their POSIX strcasecmp() and strncasecmp() equivalents;
- * get the requisite prototypes by selective <strings.h> inclusion.
+ * get the requisite prototypes by selective <strings.h> inclusion,
+ * (noting that we've already done so, if emulating glibc).
  */
+#if !_EMULATE_GLIBC
 #include <strings.h>
+#endif
 
 # ifdef __MSVCRT__
  /* These were not present in the CRTDLL prior to the first release of
   * MSVCRT.DLL, but are available in all versions of that library.
   */
------------------------------------------------------------------------------
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