mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-30 23:49:05 +08:00
Use __builtin_trap instead of null pointer dereference to abort
This fixes a warning from Apple's clang compiler: [ 34%] Building CXX object CMakeFiles/libtesseract.dir/src/ccutil/errcode.cpp.o /Users/travis/build/stweil/tesseract/src/ccutil/errcode.cpp:83:7: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference] *reinterpret_cast<int*>(0) = 0; ^~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/travis/build/stweil/tesseract/src/ccutil/errcode.cpp:83:7: note: consider using __builtin_trap() or qualifying pointer with 'volatile' Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
4bd18c4c1b
commit
38861be639
@ -77,10 +77,14 @@ const char *format, ... // special message
|
||||
//err_exit();
|
||||
case ABORT:
|
||||
#if !defined(NDEBUG)
|
||||
// Create a deliberate segv as the stack trace is more useful that way.
|
||||
// This is done only in debug builds, because the error message
|
||||
// "segmentation fault" confuses most normal users.
|
||||
// Create a deliberate abnormal exit as the stack trace is more useful
|
||||
// that way. This is done only in debug builds, because the
|
||||
// error message "segmentation fault" confuses most normal users.
|
||||
#if defined(__GNUC__)
|
||||
__builtin_trap();
|
||||
#else
|
||||
*reinterpret_cast<int*>(0) = 0;
|
||||
#endif
|
||||
#endif
|
||||
abort();
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user