From 923e1e0a77564ac7ebe749b73e625849f3406d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Wed, 30 Mar 2022 11:11:57 +0300 Subject: [PATCH] Indexing.h C++ compatibility; flag C++ incompatible headers. --- qpms/indexing.h | 6 +++--- qpms/lattices.h | 1 + qpms/normalisation.h | 4 +++- tests/catch/all_includes.C | 17 ++++++++--------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/qpms/indexing.h b/qpms/indexing.h index 86ea952..e8ef012 100644 --- a/qpms/indexing.h +++ b/qpms/indexing.h @@ -109,7 +109,7 @@ static const qpms_uvswfi_t QPMS_UI_L00 = 0; /** Returns a non-zero value if the u value is invalid. */ static inline qpms_errno_t qpms_uvswfi2tmn(qpms_uvswfi_t u, qpms_vswf_type_t *t, qpms_m_t *m, qpms_l_t *n) { - *t = u & 3; + *t = (qpms_vswf_type_t)(u & 3); qpms_y_sc_t y_sc = u / 4; qpms_y2mn_sc_p(y_sc, m, n); // Test validity @@ -122,7 +122,7 @@ static inline qpms_errno_t qpms_uvswfi2tmn(qpms_uvswfi_t u, /** Does *not* allow for longitudinal waves. */ static inline qpms_errno_t qpms_uvswfi2ty(qpms_uvswfi_t u, qpms_vswf_type_t *t, qpms_y_t *y) { - *t = u & 3; + *t = (qpms_vswf_type_t)(u & 3); *y = u / 4 - 1; if (QPMS_UNLIKELY(*t == 0 || *t == 3)) return QPMS_ERROR; if (QPMS_UNLIKELY(*y < 0)) return QPMS_ERROR; @@ -135,7 +135,7 @@ static inline qpms_errno_t qpms_uvswfi2ty(qpms_uvswfi_t u, */ static inline qpms_errno_t qpms_uvswfi2ty_l(qpms_uvswfi_t u, qpms_vswf_type_t *t, qpms_y_t *y) { - *t = u & 3; + *t = (qpms_vswf_type_t)(u & 3); *y = u / 4 - 1; if (QPMS_UNLIKELY(*t == 3)) return QPMS_ERROR; if (QPMS_UNLIKELY(*y < 0)) return QPMS_ERROR; diff --git a/qpms/lattices.h b/qpms/lattices.h index d7bdac0..395a184 100644 --- a/qpms/lattices.h +++ b/qpms/lattices.h @@ -1,6 +1,7 @@ /*! \file lattices.h * \brief Lattice point generators and lattice vector analysis / transformation. * + * \bug Header file not C++ compatible. */ #ifndef LATTICES_H #define LATTICES_H diff --git a/qpms/normalisation.h b/qpms/normalisation.h index 2b72f82..a282231 100644 --- a/qpms/normalisation.h +++ b/qpms/normalisation.h @@ -2,10 +2,12 @@ * \brief Convention-dependent coefficients for VSWFs. * * See also @ref qpms_normalisation_t and @ref vswf_conventions. + * + * \bug Header file not C++ compatible. */ #ifndef NORMALISATION_H #define NORMALISATION_H -#ifdef __cplusplus +#ifdef __cplusplus //FIXME not C++ compatible yet (enum bit operations) extern "C" { #endif diff --git a/tests/catch/all_includes.C b/tests/catch/all_includes.C index 10f3e9a..7147355 100644 --- a/tests/catch/all_includes.C +++ b/tests/catch/all_includes.C @@ -1,8 +1,7 @@ // Just to test that all headers are C++ compatible #include -extern "C" { #include -//#include // C++ keyword as an identifier +#include #include #include #include @@ -18,14 +17,14 @@ extern "C" { #include #include #include +#include +#include +#include +#include +#include +#include // C++ type conversion issues: +#include //#include //#include -//#include -//#include //#include -//#include -//#include -//#include -//#include -}