[libcxx] r305394 - PR32476: __nop_locale_mgmt.h not needed with newlib 2.5+

James Y Knight via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 14 09:40:03 PDT 2017

Author: jyknight
Date: Wed Jun 14 11:40:03 2017
New Revision: 305394

URL: http://llvm.org/viewvc/llvm-project?rev=305394&view=rev
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.

This has been tested against newlib 2.2 and 2.5, and also sanity
checks against other different version numbers.

Patch by Martin J. O'Riordan and Walter Lee

Differential Revision: https://reviews.llvm.org/D32146


Modified: libcxx/trunk/include/support/newlib/xlocale.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/newlib/xlocale.h?rev=305394&r1=305393&r2=305394&view=diff
--- libcxx/trunk/include/support/newlib/xlocale.h (original)
+++ libcxx/trunk/include/support/newlib/xlocale.h Wed Jun 14 11:40:03 2017
@@ -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>
 #include <support/xlocale/__posix_l_fallback.h>
 #include <support/xlocale/__strtonum_fallback.h>

More information about the cfe-commits mailing list