Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:07:23

0001 // Copyright (C) 2022 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QEXCEPTIONHANDLING_H
0005 #define QEXCEPTIONHANDLING_H
0006 
0007 #include <QtCore/qtconfigmacros.h>
0008 #include <QtCore/qcompilerdetection.h>
0009 #include <QtCore/qtcoreexports.h>
0010 
0011 #if 0
0012 #pragma qt_class(QtExceptionHandling)
0013 #pragma qt_sync_stop_processing
0014 #endif
0015 
0016 QT_BEGIN_NAMESPACE
0017 
0018 /* These wrap try/catch so we can switch off exceptions later.
0019 
0020    Beware - do not use more than one QT_CATCH per QT_TRY, and do not use
0021    the exception instance in the catch block.
0022    If you can't live with those constraints, don't use these macros.
0023    Use the QT_NO_EXCEPTIONS macro to protect your code instead.
0024 */
0025 Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() noexcept;
0026 #ifdef QT_NO_EXCEPTIONS
0027 #  define QT_TRY if (true)
0028 #  define QT_CATCH(A) else
0029 #  define QT_THROW(A) qt_noop()
0030 #  define QT_RETHROW qt_noop()
0031 #  define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
0032 #else
0033 #  define QT_TRY try
0034 #  define QT_CATCH(A) catch (A)
0035 #  define QT_THROW(A) throw A
0036 #  define QT_RETHROW throw
0037 #  ifdef Q_COMPILER_NOEXCEPT
0038 #    define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
0039 #  else
0040 #    define QT_TERMINATE_ON_EXCEPTION(expr) do { try { expr; } catch (...) { qTerminate(); } } while (false)
0041 #  endif
0042 #endif
0043 
0044 QT_END_NAMESPACE
0045 
0046 #endif // QEXCEPTIONHANDLING_H