Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using the standards-conforming preprocessor for C++ #4407

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ set(TILEDB_EP_INSTALL_PREFIX "${TILEDB_EP_BASE}/install")
if (MSVC)
# Turn on standards-conformance mode
add_compile_options("/permissive-")
# Enable the conforming preprocessor instead of the traditional (non-conforming) preprocessor
add_compile_options("/Zc:preprocessor")
# /EH: Enables standard C++ stack unwinding.
# s: Catches only standard C++ exceptions when you use catch(...) syntax.
# c: The compiler assumes that functions declared as extern "C" never throw a C++ exception
Expand Down
21 changes: 6 additions & 15 deletions tiledb/common/exception/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,12 @@ namespace common {
} \
} while (false)

#define RETURN_NOT_OK_TUPLE(s, ...) \
do { \
Status _s = (s); \
if (!_s.ok()) { \
return {_s, __VA_ARGS__}; \
} \
} while (false)

#define RETURN_NOT_OK_ELSE_TUPLE(s, else_, ...) \
do { \
Status _s = (s); \
if (!_s.ok()) { \
else_; \
return {_s, __VA_ARGS__}; \
} \
#define RETURN_NOT_OK_TUPLE(s, ...) \
do { \
Status _s = (s); \
if (!_s.ok()) { \
return {_s __VA_OPT__(, ) __VA_ARGS__}; \
} \
} while (false)

/**
Expand Down
10 changes: 3 additions & 7 deletions tiledb/common/heap_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,9 @@ using tiledb_unique_ptr = std::unique_ptr<T, TileDBUniquePtrDeleter<T>>;

#define tdb_free(p) tiledb::common::tiledb_free(p)

#ifdef _MSC_VER
#define tdb_new(T, ...) \
tiledb::common::tiledb_new<T>(TILEDB_HEAP_MEM_LABEL, __VA_ARGS__)
#else
#define tdb_new(T, ...) \
tiledb::common::tiledb_new<T>(TILEDB_HEAP_MEM_LABEL, ##__VA_ARGS__)
#endif
#define tdb_new(T, ...) \
tiledb::common::tiledb_new<T>(TILEDB_HEAP_MEM_LABEL __VA_OPT__(, ) \
__VA_ARGS__)

#define tdb_delete(p) tiledb::common::tiledb_delete(p);

Expand Down