[flang] Simplified C++ CFI_CDESC_T implem. Added local namespace around

Original-commit: flang-compiler/f18@456f5a0994
Reviewed-on: https://github.com/flang-compiler/f18/pull/222
This commit is contained in:
Jean Perier 2018-11-07 02:27:04 -08:00
parent 2ab0f0d86a
commit da9e84906a
1 changed files with 7 additions and 7 deletions

View File

@ -129,16 +129,16 @@ typedef struct CFI_cdesc_t {
#ifdef __cplusplus
// C++ does not support zero-sized array (rank=0)
// Also, CFI_cdesc_t already contains 1 dim in cpp
template<bool B, int rank> struct Cond_CFI_cdesc_t {
static_assert((rank >= 2 && rank <= CFI_MAX_RANK), "CFI_INVALID_RANK");
namespace cfi_internal {
template<int rank> struct CdescStorage {
static_assert((rank > 1 && rank <= CFI_MAX_RANK), "CFI_INVALID_RANK");
CFI_cdesc_t cdesc;
CFI_dim_t dim[rank - 1];
};
template<int rank> struct Cond_CFI_cdesc_t<false, rank> {
static_assert((rank >= 0 && rank < 2), "CFI_INVALID_RANK");
CFI_cdesc_t cdesc;
};
#define CFI_CDESC_T(rank) Cond_CFI_cdesc_t<(rank >= 2), rank>
template<> struct CdescStorage<1> { CFI_cdesc_t cdesc; };
template<> struct CdescStorage<0> { CFI_cdesc_t cdesc; };
}
#define CFI_CDESC_T(rank) cfi_internal::CdescStorage<rank>
#else
#define CFI_CDESC_T(rank) \
struct { \