summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-03-22 08:44:14 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-03-22 08:48:00 +0100
commita7cdba3a0e48360e2ed549e9d8996fe41460df70 (patch)
treedf48882124a4fc28a93e24e34a96be3b2d4efd2a /compilerplugins
parent7299481834b15c920f996f4b0f3b5f821a82a10d (diff)
Use nl_langinfo_l with an explicitly created locale
(where empty string arg to newlocale, per SUSv4, means "an implementation- defined native environment. This correspons to the value of the associated environment variables, LC_* and LANG") instead of relying on whatever setlocale would be in effect here. Also, nl_langinfo_l is less of an MT nightmare than nl_langinfo, which is of benefit once the last remaining use of nl_langinfo in sal/osl/unx/nlsupport.cxx will also have been changed to nl_langinfo_l. loplugin:nullptr needs a little hack, as SUSv4 locale_t could be anything from an integer type to a pointer type. Change-Id: Ic35dcbc2e0a4f650694b48df12470dd89476dff5
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/nullptr.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/compilerplugins/clang/nullptr.cxx b/compilerplugins/clang/nullptr.cxx
index 3ab32031e6f2..577a95715118 100644
--- a/compilerplugins/clang/nullptr.cxx
+++ b/compilerplugins/clang/nullptr.cxx
@@ -12,6 +12,7 @@
#include <limits>
#include <set>
+#include "check.hxx"
#include "plugin.hxx"
namespace {
@@ -128,6 +129,11 @@ bool Nullptr::VisitImplicitCastExpr(CastExpr const * expr) {
case Expr::NPCK_CXX11_nullptr:
break;
default:
+ if (loplugin::TypeCheck(expr->getType()).Typedef("locale_t")
+ .GlobalNamespace())
+ {
+ break; // POSIX locale_t is left unspecified
+ }
handleNull(expr->getSubExpr(), expr->getCastKindName(), k);
break;
}