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

Side by Side Diff: util/mach/mach_extensions.h

Issue 700383007: Use implicit_cast<> instead of static_cast<> whenever possible (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
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 #ifndef CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_ 15 #ifndef CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_
16 #define CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_ 16 #define CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_
17 17
18 #include <mach/mach.h> 18 #include <mach/mach.h>
19 19
20 namespace crashpad { 20 namespace crashpad {
21 21
22 //! \brief `MACH_PORT_NULL` with the correct type for a Mach port, 22 //! \brief `MACH_PORT_NULL` with the correct type for a Mach port,
23 //! `mach_port_t`. 23 //! `mach_port_t`.
24 //! 24 //!
25 //! For situations where implicit conversions between signed and unsigned types 25 //! For situations where implicit conversions between signed and unsigned types
26 //! are not performed, use kMachPortNull instead of an explicit `static_cast` of 26 //! are not performed, use kMachPortNull instead of an explicit `implicit_cast`
27 //! `MACH_PORT_NULL` to `mach_port_t`. This is useful for logging and testing 27 //! of `MACH_PORT_NULL` to `mach_port_t`. This is useful for logging and testing
28 //! assertions. 28 //! assertions.
29 const mach_port_t kMachPortNull = MACH_PORT_NULL; 29 const mach_port_t kMachPortNull = MACH_PORT_NULL;
30 30
31 //! \brief `MACH_EXCEPTION_CODES` with the correct type for a Mach exception 31 //! \brief `MACH_EXCEPTION_CODES` with the correct type for a Mach exception
32 //! behavior, `exception_behavior_t`. 32 //! behavior, `exception_behavior_t`.
33 //! 33 //!
34 //! Signedness problems can occur when ORing `MACH_EXCEPTION_CODES` as a signed 34 //! Signedness problems can occur when ORing `MACH_EXCEPTION_CODES` as a signed
35 //! integer, because a signed integer overflow results. This constant can be 35 //! integer, because a signed integer overflow results. This constant can be
36 //! used instead of `MACH_EXCEPTION_CODES` in such cases. 36 //! used instead of `MACH_EXCEPTION_CODES` in such cases.
37 const exception_behavior_t kMachExceptionCodes = MACH_EXCEPTION_CODES; 37 const exception_behavior_t kMachExceptionCodes = MACH_EXCEPTION_CODES;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 //! appropriate for the system at run time. 77 //! appropriate for the system at run time.
78 //! 78 //!
79 //! \note `EXC_MASK_ALL` does not include the value of `EXC_MASK_CRASH`. 79 //! \note `EXC_MASK_ALL` does not include the value of `EXC_MASK_CRASH`.
80 //! Consumers that want `EXC_MASK_ALL` along with `EXC_MASK_CRASH` must use 80 //! Consumers that want `EXC_MASK_ALL` along with `EXC_MASK_CRASH` must use
81 //! ExcMaskAll() | `EXC_MASK_CRASH` explicitly. 81 //! ExcMaskAll() | `EXC_MASK_CRASH` explicitly.
82 exception_mask_t ExcMaskAll(); 82 exception_mask_t ExcMaskAll();
83 83
84 } // namespace crashpad 84 } // namespace crashpad
85 85
86 #endif // CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_ 86 #endif // CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698