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

llvm-svn: 305394
This commit is contained in:
James Y Knight 2017-06-14 16:40:03 +00:00
parent a8cfc29c9a
commit b6567b18c7
1 changed files with 3 additions and 0 deletions

View File

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