Skip to content

Commit ba40863

Browse files
committed
Define ET_HAS_EXCEPTIONS macro
Pull Request resolved: #11603 To support passing ET_USE_PYTORCH_HEADERS only when exceptions are enabled. ghstack-source-id: 290334875 @exported-using-ghexport Differential Revision: [D76470039](https://our.internmc.facebook.com/intern/diff/D76470039/)
1 parent d660bde commit ba40863

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

runtime/platform/compiler.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@
171171
using ssize_t = ptrdiff_t;
172172
#endif
173173

174+
#ifdef __EXCEPTIONS
175+
#define ET_HAS_EXCEPTIONS 1
176+
#elif defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS
177+
#define ET_HAS_EXCEPTIONS 1
178+
#else
179+
#define ET_HAS_EXCEPTIONS 0
180+
#endif
181+
174182
// DEPRECATED: Use the non-underscore-prefixed versions instead.
175183
// TODO(T199005537): Remove these once all users have stopped using them.
176184
#define __ET_DEPRECATED ET_DEPRECATED

0 commit comments

Comments
 (0)