[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 40bee87 7/7: Work around a [bitmask.types] is
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 40bee87 7/7: Work around a [bitmask.types] issue |
Date: |
Tue, 13 Nov 2018 12:21:37 -0500 (EST) |
branch: master
commit 40bee8774d9a169e5025ea622e874ec775e001d8
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Work around a [bitmask.types] issue
See:
https://lists.nongnu.org/archive/html/lmi/2018-11/msg00021.html
et seqq.
---
facets.cpp | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/facets.cpp b/facets.cpp
index 2aeb705..677629c 100644
--- a/facets.cpp
+++ b/facets.cpp
@@ -87,17 +87,9 @@
// The underlying problem is that 'short unsigned int' does not fulfill the
// bitmask requirements, as unary operator ~ performs integral promotions.
//
-// This would avoid the warning:
+// This:
// rc[C] &= static_cast<std::ctype_base::mask>(~std::ctype_base::space);
-// but seems too violent. This does not avoid the warning:
-// constexpr auto z = ~std::ctype_base::space;
-// rc[C] &= z;
-// due to integral promotion. And braces are not allowed here:
-// rc[C] &= {~std::ctype_base::space};
-// so this code (used in the implementation below):
-// constexpr std::ctype_base::mask z = {~std::ctype_base::space};
-// rc[C] &= z;
-// is the least awful thing that works.
+// is the least awful workaround that avoids the warning.
namespace
{
@@ -115,8 +107,7 @@ namespace
static std::ctype_base::mask rc[table_size];
std::copy(classic_table(), classic_table() + table_size, rc);
// See "Implementation note" above.
- constexpr std::ctype_base::mask z = {~std::ctype_base::space};
- rc[C] &= z;
+ rc[C] &=
static_cast<std::ctype_base::mask>(~std::ctype_base::space);
return rc;
}
};
- [lmi-commits] [lmi] master updated (379fcf3 -> 40bee87), Greg Chicares, 2018/11/13
- [lmi-commits] [lmi] master fc4e8fe 1/7: Fix warnings in Boost.Regex compilation with clang, Greg Chicares, 2018/11/13
- [lmi-commits] [lmi] master 934c49e 5/7: Update #endif comments when #if conditions change, Greg Chicares, 2018/11/13
- [lmi-commits] [lmi] master 40bee87 7/7: Work around a [bitmask.types] issue,
Greg Chicares <=
- [lmi-commits] [lmi] master f79a907 4/7: Don't disable gcc-specific warnings in GUI code for clang, Greg Chicares, 2018/11/13
- [lmi-commits] [lmi] master ebed357 2/7: Don't try to disable GCC -Wuseless-cast warning for clang, Greg Chicares, 2018/11/13
- [lmi-commits] [lmi] master ea937af 3/7: Update #endif comments when #if conditions change, Greg Chicares, 2018/11/13
- [lmi-commits] [lmi] master 40fa47f 6/7: Remove disused object dependencies, Greg Chicares, 2018/11/13