[libcxx] test fixes <locale>
Steve MacKenzie
stevemac321 at live.com
Tue Oct 21 20:05:08 PDT 2014
My scan-build run against libc++ tests and headers continues.. up to and
including localization tests.
The diff is applicable to libcxx/test/localization tests only, all fixes
address dead initialization.
Three suspected scan-build false positive bugs were opened as
well:21326,21333,21335.
Progress of the run is published here:
http://stevemac123.wordpress.com/static-analysis-run/
Thanks,
Steve MacKenzie
-------------- next part --------------
Index: locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp
===================================================================
--- locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp (revision 220245)
+++ locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp (working copy)
@@ -60,7 +60,7 @@
{ // zero
std::string v = "0.00";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00;
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -71,7 +71,7 @@
{ // negative one
std::string v = "-0.01";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -82,7 +82,7 @@
{ // positive
std::string v = "1,234,567.89";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -93,7 +93,7 @@
{ // negative
std::string v = "-1,234,567.89";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -104,7 +104,7 @@
{ // negative
std::string v = "-1234567.89";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -115,7 +115,7 @@
{ // zero, showbase
std::string v = "$0.00";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -127,7 +127,7 @@
std::string v = "$0.00";
showbase(ios);
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -139,7 +139,7 @@
{ // negative one, showbase
std::string v = "-$0.01";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -151,7 +151,7 @@
std::string v = "-$0.01";
showbase(ios);
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -163,7 +163,7 @@
{ // positive, showbase
std::string v = "$1,234,567.89";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -175,7 +175,7 @@
std::string v = "$1,234,567.89";
showbase(ios);
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -188,7 +188,7 @@
std::string v = "-$1,234,567.89";
showbase(ios);
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -201,7 +201,7 @@
std::string v = "-USD 1,234,567.89";
showbase(ios);
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -212,7 +212,7 @@
{ // negative, showbase
std::string v = "-USD 1,234,567.89";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -226,7 +226,7 @@
{ // zero
std::string v = "0.00";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -237,7 +237,7 @@
{ // negative one
std::string v = "-0.01";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -248,7 +248,7 @@
{ // positive
std::string v = "1,234,567.89";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -259,7 +259,7 @@
{ // negative
std::string v = "-1,234,567.89";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -270,7 +270,7 @@
{ // negative
std::string v = "-1234567.89";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -281,7 +281,7 @@
{ // zero, showbase
std::string v = "USD 0.00";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -293,7 +293,7 @@
std::string v = "USD 0.00";
showbase(ios);
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -305,7 +305,7 @@
{ // negative one, showbase
std::string v = "-USD 0.01";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -317,7 +317,7 @@
std::string v = "-USD 0.01";
showbase(ios);
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -329,7 +329,7 @@
{ // positive, showbase
std::string v = "USD 1,234,567.89";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -341,7 +341,7 @@
std::string v = "USD 1,234,567.89";
showbase(ios);
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -354,7 +354,7 @@
std::string v = "-USD 1,234,567.89";
showbase(ios);
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -367,7 +367,7 @@
std::string v = "-$1,234,567.89";
showbase(ios);
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -378,7 +378,7 @@
{ // negative, showbase
std::string v = "-$1,234,567.89";
typedef input_iterator<const char*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -392,7 +392,7 @@
{ // zero
std::wstring v = L"0.00";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -403,7 +403,7 @@
{ // negative one
std::wstring v = L"-0.01";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -414,7 +414,7 @@
{ // positive
std::wstring v = L"1,234,567.89";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -425,7 +425,7 @@
{ // negative
std::wstring v = L"-1,234,567.89";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -436,7 +436,7 @@
{ // negative
std::wstring v = L"-1234567.89";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -447,7 +447,7 @@
{ // zero, showbase
std::wstring v = L"$0.00";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -459,7 +459,7 @@
std::wstring v = L"$0.00";
showbase(ios);
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -471,7 +471,7 @@
{ // negative one, showbase
std::wstring v = L"-$0.01";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -483,7 +483,7 @@
std::wstring v = L"-$0.01";
showbase(ios);
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -495,7 +495,7 @@
{ // positive, showbase
std::wstring v = L"$1,234,567.89";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -507,7 +507,7 @@
std::wstring v = L"$1,234,567.89";
showbase(ios);
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -520,7 +520,7 @@
std::wstring v = L"-$1,234,567.89";
showbase(ios);
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -533,7 +533,7 @@
std::wstring v = L"-USD 1,234,567.89";
showbase(ios);
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -544,7 +544,7 @@
{ // negative, showbase
std::wstring v = L"-USD 1,234,567.89";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
false, ios, err, ex);
@@ -558,7 +558,7 @@
{ // zero
std::wstring v = L"0.00";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -569,7 +569,7 @@
{ // negative one
std::wstring v = L"-0.01";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -580,7 +580,7 @@
{ // positive
std::wstring v = L"1,234,567.89";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -591,7 +591,7 @@
{ // negative
std::wstring v = L"-1,234,567.89";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -602,7 +602,7 @@
{ // negative
std::wstring v = L"-1234567.89";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -613,7 +613,7 @@
{ // zero, showbase
std::wstring v = L"USD 0.00";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -625,7 +625,7 @@
std::wstring v = L"USD 0.00";
showbase(ios);
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -637,7 +637,7 @@
{ // negative one, showbase
std::wstring v = L"-USD 0.01";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -649,7 +649,7 @@
std::wstring v = L"-USD 0.01";
showbase(ios);
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -661,7 +661,7 @@
{ // positive, showbase
std::wstring v = L"USD 1,234,567.89";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -673,7 +673,7 @@
std::wstring v = L"USD 1,234,567.89";
showbase(ios);
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -686,7 +686,7 @@
std::wstring v = L"-USD 1,234,567.89";
showbase(ios);
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -699,7 +699,7 @@
std::wstring v = L"-$1,234,567.89";
showbase(ios);
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
@@ -710,7 +710,7 @@
{ // negative, showbase
std::wstring v = L"-$1,234,567.89";
typedef input_iterator<const wchar_t*> I;
- long double ex;
+ long double ex=55.00
std::ios_base::iostate err = std::ios_base::goodbit;
I iter = f.get(I(v.data()), I(v.data() + v.size()),
true, ios, err, ex);
Index: locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
===================================================================
--- locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp (revision 220245)
+++ locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp (working copy)
@@ -26225,6 +26225,7 @@
}
{
long double v = std::nan("");
+ (void)v; // for scan-build
}
{
@@ -26235,6 +26236,7 @@
}
{
long double v = std::nan("");
+ (void)v;
}
{
long double v = -INFINITY;
@@ -26241,5 +26243,6 @@
}
{
long double v = std::nan("");
+ (void)v;
}
}
More information about the cfe-commits
mailing list