Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: client/simple_string_dictionary.cc

Issue 489993002: Add SimpleStringDictionary and its test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Rename the template to TSimpleStringDictionary<> Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/simple_string_dictionary.h ('k') | client/simple_string_dictionary_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/simple_string_dictionary.cc
diff --git a/client/simple_string_dictionary.cc b/client/simple_string_dictionary.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c8e9c98d64d7a7352a6540aa97b4f1f6749b43a5
--- /dev/null
+++ b/client/simple_string_dictionary.cc
@@ -0,0 +1,46 @@
+// Copyright 2014 The Crashpad Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "client/simple_string_dictionary.h"
+
+#include "base/basictypes.h"
+#include "util/stdlib/cxx.h"
+
+#if CXX_LIBRARY_VERSION >= 2011
+#include <type_traits>
+#endif
+
+namespace crashpad {
+namespace {
+
+typedef TSimpleStringDictionary<1, 1, 1> SimpleStringDictionaryForAssertion;
+
+#if CXX_LIBRARY_VERSION >= 2011
+// In C++11, check that TSimpleStringDictionary has standard layout, which is
+// what is actually important.
+COMPILE_ASSERT(
+ std::is_standard_layout<SimpleStringDictionaryForAssertion>::value,
+ SimpleStringDictionary_must_be_standard_layout);
+#else
+// In C++98 (ISO 14882), section 9.5.1 says that a union cannot have a member
+// with a non-trivial ctor, copy ctor, dtor, or assignment operator. Use this
+// property to ensure that Entry remains POD. This doesn’t work for C++11
+// because the requirements for unions have been relaxed.
+union Compile_Assert {
+ SimpleStringDictionaryForAssertion::Entry Compile_Assert__entry_must_be_pod;
+};
+#endif
+
+} // namespace
+} // namespace crashpad
« no previous file with comments | « client/simple_string_dictionary.h ('k') | client/simple_string_dictionary_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698