waltl updated this revision to Diff 102265.
waltl added a comment.

PR32476: __nop_locale_mgmt.h not needed with newlib 2.5+

Newlib 2.5 added the locale management functions, so it should not
include __nop_local_mgmt.h.  This change adds proper guard around that
include statement.

For newlib 2.4, some releases contain these functions and some don't,
and they all have the same version numbers.  This patch will work
properly with the initial "2.4.0" release which does not include these
functions and require __nop_local_mgmt.h.

I've tested this against newlib 2.2 and 2.5, and also sanity check
against other different version numbers.


https://reviews.llvm.org/D32146

Files:
  include/support/newlib/xlocale.h


Index: include/support/newlib/xlocale.h
===================================================================
--- include/support/newlib/xlocale.h
+++ include/support/newlib/xlocale.h
@@ -16,7 +16,10 @@
 #include <clocale>
 #include <cwctype>
 #include <ctype.h>
+#if !defined(__NEWLIB__) || __NEWLIB__ < 2 || \
+    __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5
 #include <support/xlocale/__nop_locale_mgmt.h>
+#endif
 #include <support/xlocale/__posix_l_fallback.h>
 #include <support/xlocale/__strtonum_fallback.h>
 


Index: include/support/newlib/xlocale.h
===================================================================
--- include/support/newlib/xlocale.h
+++ include/support/newlib/xlocale.h
@@ -16,7 +16,10 @@
 #include <clocale>
 #include <cwctype>
 #include <ctype.h>
+#if !defined(__NEWLIB__) || __NEWLIB__ < 2 || \
+    __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5
 #include <support/xlocale/__nop_locale_mgmt.h>
+#endif
 #include <support/xlocale/__posix_l_fallback.h>
 #include <support/xlocale/__strtonum_fallback.h>
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to