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

Side by Side Diff: third_party/tcmalloc/chromium/src/base/abort.h

Issue 10392109: Write to NULL will trigger a Clang compile warning and the compiler may (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // --- 5 // ---
6 // On some platforms abort() is implemented in a way that Chrome's crash 6 // On some platforms abort() is implemented in a way that Chrome's crash
7 // reporter treats it as a normal exit. See issue: 7 // reporter treats it as a normal exit. See issue:
8 // http://code.google.com/p/chromium/issues/detail?id=118665 8 // http://code.google.com/p/chromium/issues/detail?id=118665
9 // So we replace abort with a 9 // So we replace abort with a
10 // segmentation fault, that crash reporter can always detect. 10 // segmentation fault, that crash reporter can always detect.
11 11
12 #ifndef BASE_ABORT_H_ 12 #ifndef BASE_ABORT_H_
13 #define BASE_ABORT_H_ 13 #define BASE_ABORT_H_
14 14
15 #if defined(TCMALLOC_USE_SYSTEM_ABORT) 15 #if defined(TCMALLOC_USE_SYSTEM_ABORT)
16 #include <stdlib.h> 16 #include <stdlib.h>
17 17
18 namespace tcmalloc { 18 namespace tcmalloc {
19 inline void Abort() { 19 inline void Abort() {
20 abort(); 20 abort();
21 } 21 }
22 } // namespace tcmalloc 22 } // namespace tcmalloc
23 23
24 #else 24 #else
25 namespace tcmalloc { 25 namespace tcmalloc {
26 inline void Abort() { 26 inline void Abort() {
27 // Make a segmentation fault to force abort. 27 // Make a segmentation fault to force abort.
28 *reinterpret_cast<int*>(NULL) = 0x2001; 28 *reinterpret_cast<volatile int*>(NULL) = 0x2001;
29 } 29 }
30 } // namespace tcmalloc 30 } // namespace tcmalloc
31 31
32 #endif 32 #endif
33 33
34 #endif // BASE_ABORT_H_ 34 #endif // BASE_ABORT_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698