1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
// -*- C++ -*-
// ============================================================================
/**
* @file CORBA_macros.h
*
* Writing code that is portable between platforms with or without
* native C++ exceptions is hard. The following macros offer some
* help on this task, mostly oriented to making the ORB code and the
* IDL generated code portable.
*
* @author Nanbor Wang <nanbor@cs.wustl.edu>
* @author Aniruddha Gokhale <gokhale@sahyadri.research.bell-labs.com>
* @author Carlos O'Ryan <coryan@uci.edu>, et al.
*/
// ============================================================================
// Macros for handling CORBA exceptions.
#ifndef ACE_CORBA_MACROS_H
#define ACE_CORBA_MACROS_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
// The Windows MFC exception mechanism requires that a caught CException
// (including the CMemoryException in use here) be freed using its Delete()
// method. Thus, when MFC is in use and we're catching exceptions as a result
// of new(), the exception's Delete() method has to be called. No other
// platform imposes this sort of restriction/requirement. The Windows
// config stuff (at least for MSVC/MFC) defines a ACE_del_bad_alloc macro
// that works with its ACE_bad_alloc macro to implement this cleanup
// requirement. Since no other platform requires this, define it as
// empty here.
#if !defined (ACE_del_bad_alloc)
# define ACE_del_bad_alloc
#endif
// ACE_HAS_EXCEPTIONS is not the same as ACE_NEW_THROWS_EXCEPTIONS.
#if defined(ACE_NEW_THROWS_EXCEPTIONS)
# if defined (ACE_HAS_NEW_NOTHROW)
# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
do { POINTER = new (ACE_nothrow) CONSTRUCTOR; \
if (POINTER == 0) { throw EXCEPTION; } \
} while (0)
# else
# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
do { try { POINTER = new CONSTRUCTOR; } \
catch (ACE_bad_alloc) { ACE_del_bad_alloc throw EXCEPTION; } \
} while (0)
# endif /* ACE_HAS_NEW_NOTHROW */
#else /* ! ACE_NEW_THROWS_EXCEPTIONS */
# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
do { POINTER = new CONSTRUCTOR; \
if (POINTER == 0) { throw EXCEPTION; } \
} while (0)
#endif /* ACE_NEW_THROWS_EXCEPTIONS */
// FUZZ: disable check_for_ACE_Guard
# define ACE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \
ACE_Guard< MUTEX > OBJ (LOCK); \
if (OBJ.locked () == 0) throw EXCEPTION;
# define ACE_READ_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \
ACE_Read_Guard< MUTEX > OBJ (LOCK); \
if (OBJ.locked () == 0) throw EXCEPTION;
# define ACE_WRITE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \
ACE_Write_Guard< MUTEX > OBJ (LOCK); \
if (OBJ.locked () == 0) throw EXCEPTION;
// FUZZ: enable check_for_ACE_Guard
#include /**/ "ace/post.h"
#endif /* ACE_CORBA_MACROS_H */
|