mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
67b7f56ddb
Summary: Proposed header (or its dir) is a single place to put MSVC/GCC hacks. So far it only includes the COMPOUND_LITERAL macro which behaves differently depending on MSVC mode. When MSVC2015 is used in C++ mode, it does not support things like: `(my_type) {initializers}`, but in C mode it does. To clarify: I am not even sure whether we need to have the ability to compile in a purely C mode, but I did not want to figure out. Test Plan: - on Linux, run `python setup.py build`, run all the tests, see them passing Reviewers: #sourcecontrol, tja Reviewed By: tja Subscribers: tja, jsgf, mjpieters Differential Revision: https://phabricator.intern.facebook.com/D4843230 Signature: t1:4843230:1491496062:3fa10ae5a5aac850689991de1ca6ee1ac86d9dce
17 lines
565 B
C
17 lines
565 B
C
#ifndef PORTABILITY_PORTABILITY_H
|
|
#define PORTABILITY_PORTABILITY_H
|
|
|
|
#if defined(_MSC_VER)
|
|
/* MSVC2015 supports compound literals in C mode (/TC)
|
|
but does not support them in C++ mode (/TP) */
|
|
#if defined(__cplusplus)
|
|
#define COMPOUND_LITERAL(typename_) typename_
|
|
#else /* #if defined(__cplusplus) */
|
|
#define COMPOUND_LITERAL(typename_) (typename_)
|
|
#endif /* #if defined(__cplusplus) */
|
|
#else /* #if defined(_MSC_VER) */
|
|
#define COMPOUND_LITERAL(typename_) (typename_)
|
|
#endif /* #if defined(_MSC_VER) */
|
|
|
|
#endif /* #ifndef PORTABILITY_PORTABILITY_H */
|