| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 
| 2 // | 2 // | 
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. | 
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at | 
| 6 // | 6 // | 
| 7 //     http://www.apache.org/licenses/LICENSE-2.0 | 7 //     http://www.apache.org/licenses/LICENSE-2.0 | 
| 8 // | 8 // | 
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software | 
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, | 
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and | 
| 13 // limitations under the License. | 13 // limitations under the License. | 
| 14 | 14 | 
| 15 #include "client/simple_string_dictionary.h" | 15 #include "client/simple_string_dictionary.h" | 
| 16 | 16 | 
| 17 #include "util/stdlib/cxx.h" | 17 #include "util/stdlib/cxx.h" | 
| 18 | 18 | 
| 19 #if CXX_LIBRARY_VERSION >= 2011 | 19 #if CXX_LIBRARY_VERSION >= 2011 | 
| 20 #include <type_traits> | 20 #include <type_traits> | 
| 21 #endif | 21 #endif | 
| 22 | 22 | 
| 23 namespace crashpad { | 23 namespace crashpad { | 
| 24 namespace { | 24 namespace { | 
| 25 | 25 | 
| 26 typedef TSimpleStringDictionary<1, 1, 1> SimpleStringDictionaryForAssertion; | 26 using SimpleStringDictionaryForAssertion = TSimpleStringDictionary<1, 1, 1>; | 
| 27 | 27 | 
| 28 #if CXX_LIBRARY_VERSION >= 2011 | 28 #if CXX_LIBRARY_VERSION >= 2011 | 
| 29 // In C++11, check that TSimpleStringDictionary has standard layout, which is | 29 // In C++11, check that TSimpleStringDictionary has standard layout, which is | 
| 30 // what is actually important. | 30 // what is actually important. | 
| 31 static_assert( | 31 static_assert( | 
| 32     std::is_standard_layout<SimpleStringDictionaryForAssertion>::value, | 32     std::is_standard_layout<SimpleStringDictionaryForAssertion>::value, | 
| 33     "SimpleStringDictionary must be standard layout"); | 33     "SimpleStringDictionary must be standard layout"); | 
| 34 #else | 34 #else | 
| 35 // In C++98 (ISO 14882), section 9.5.1 says that a union cannot have a member | 35 // In C++98 (ISO 14882), section 9.5.1 says that a union cannot have a member | 
| 36 // with a non-trivial ctor, copy ctor, dtor, or assignment operator. Use this | 36 // with a non-trivial ctor, copy ctor, dtor, or assignment operator. Use this | 
| 37 // property to ensure that Entry remains POD. This doesn’t work for C++11 | 37 // property to ensure that Entry remains POD. This doesn’t work for C++11 | 
| 38 // because the requirements for unions have been relaxed. | 38 // because the requirements for unions have been relaxed. | 
| 39 union Compile_Assert { | 39 union Compile_Assert { | 
| 40   SimpleStringDictionaryForAssertion::Entry Compile_Assert__entry_must_be_pod; | 40   SimpleStringDictionaryForAssertion::Entry Compile_Assert__entry_must_be_pod; | 
| 41 }; | 41 }; | 
| 42 #endif | 42 #endif | 
| 43 | 43 | 
| 44 }  // namespace | 44 }  // namespace | 
| 45 }  // namespace crashpad | 45 }  // namespace crashpad | 
| OLD | NEW | 
|---|