VirtualBox

Changeset 21390 in vbox


Ignore:
Timestamp:
Jul 8, 2009 12:17:50 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
49759
Message:

iprt/cdefs.h: RT_EXCEPTIONS_ENABLED, RT_THROW and RT_THROW_BAD_ALLOC.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cdefs.h

    r21109 r21390  
    8686#define Breakpoint
    8787#define RT_NO_DEPRECATED_MACROS
     88#define RT_EXCEPTIONS_ENABLED
    8889#endif /* DOXYGEN_RUNNING */
    8990
     
    482483#define RT_NOTHING
    483484
    484 
    485 /** @def RTCALL
    486  * The standard calling convention for the Runtime interfaces.
    487  */
    488 #ifdef _MSC_VER
    489 # define RTCALL     __cdecl
    490 #elif defined(__GNUC__) && defined(IN_RING0) && !(defined(RT_OS_OS2) || defined(RT_ARCH_AMD64)) /* the latter is kernel/gcc */
    491 # define RTCALL     __attribute__((cdecl,regparm(0)))
    492 #else
    493 # define RTCALL
     485/** @def RT_EXCEPTIONS_ENABLED
     486 * Defined when C++ exceptions are enabled.
     487 */
     488#if !defined(RT_EXCEPTIONS_ENABLED) \
     489 &&  defined(__cplusplus) \
     490 && (   (defined(_MSC_VER) && defined(_CPPUNWIND)) \
     491     || (defined(__GNUC__) && defined(__EXCEPTIONS)))
     492# define RT_EXCEPTIONS_ENABLED
    494493#endif
    495494
     
    500499 * and the semicolon in function prototypes (and implementation if C++).
    501500 */
    502 #if defined(__cplusplus) \
    503  && (   (defined(_MSC_VER) && defined(_CPPUNWIND)) \
    504      || (defined(__GNUC__) && defined(__EXCEPTIONS)))
    505 # define RT_NO_THROW    throw()
     501#ifdef RT_EXCEPTIONS_ENABLED
     502# define RT_NO_THROW            throw()
    506503#else
    507504# define RT_NO_THROW
     505#endif
     506
     507/** @def RT_THROW
     508 * How to express that a method or function throws a type of exceptions.
     509 *
     510 * @param   type    The type exception.
     511 *
     512 * @remarks If the actual throwing is done from the header, enclose it by
     513 *          \#ifdef RT_EXCEPTIONS_ENABLED ... \#else ... \#endif so the header
     514 *          compiles cleanly without exceptions enabled.
     515 *
     516 * @remarks Do NOT use this for the actual throwing of exceptions!
     517 */
     518#ifdef RT_EXCEPTIONS_ENABLED
     519# define RT_THROW(type)         throw(type)
     520#else
     521# define RT_THROW(type)
     522#endif
     523
     524/** @def RT_THROW_BAD_ALLOC
     525 * How to express that a method or function throws a std::bad_alloc exception.
     526 */
     527#ifdef RT_EXCEPTIONS_ENABLED
     528# define RT_THROW_BAD_ALLOC     throw(std::bad_alloc)
     529#else
     530# define RT_THROW_BAD_ALLOC
     531#endif
     532
     533/** @def RTCALL
     534 * The standard calling convention for the Runtime interfaces.
     535 */
     536#ifdef _MSC_VER
     537# define RTCALL     __cdecl
     538#elif defined(__GNUC__) && defined(IN_RING0) && !(defined(RT_OS_OS2) || defined(RT_ARCH_AMD64)) /* the latter is kernel/gcc */
     539# define RTCALL     __attribute__((cdecl,regparm(0)))
     540#else
     541# define RTCALL
    508542#endif
    509543
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette