Indexing.h C++ compatibility; flag C++ incompatible headers.

This commit is contained in:
Marek Nečada 2022-03-30 11:11:57 +03:00
parent d43ca9026b
commit 5dba7acd40
4 changed files with 15 additions and 13 deletions

View File

@ -109,7 +109,7 @@ static const qpms_uvswfi_t QPMS_UI_L00 = 0;
/** Returns a non-zero value if the u value is invalid. */ /** Returns a non-zero value if the u value is invalid. */
static inline qpms_errno_t qpms_uvswfi2tmn(qpms_uvswfi_t u, static inline qpms_errno_t qpms_uvswfi2tmn(qpms_uvswfi_t u,
qpms_vswf_type_t *t, qpms_m_t *m, qpms_l_t *n) { 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_y_sc_t y_sc = u / 4;
qpms_y2mn_sc_p(y_sc, m, n); qpms_y2mn_sc_p(y_sc, m, n);
// Test validity // Test validity
@ -122,7 +122,7 @@ static inline qpms_errno_t qpms_uvswfi2tmn(qpms_uvswfi_t u,
/** Does *not* allow for longitudinal waves. */ /** Does *not* allow for longitudinal waves. */
static inline qpms_errno_t qpms_uvswfi2ty(qpms_uvswfi_t u, static inline qpms_errno_t qpms_uvswfi2ty(qpms_uvswfi_t u,
qpms_vswf_type_t *t, qpms_y_t *y) { qpms_vswf_type_t *t, qpms_y_t *y) {
*t = u & 3; *t = (qpms_vswf_type_t)(u & 3);
*y = u / 4 - 1; *y = u / 4 - 1;
if (QPMS_UNLIKELY(*t == 0 || *t == 3)) return QPMS_ERROR; if (QPMS_UNLIKELY(*t == 0 || *t == 3)) return QPMS_ERROR;
if (QPMS_UNLIKELY(*y < 0)) 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, static inline qpms_errno_t qpms_uvswfi2ty_l(qpms_uvswfi_t u,
qpms_vswf_type_t *t, qpms_y_t *y) { qpms_vswf_type_t *t, qpms_y_t *y) {
*t = u & 3; *t = (qpms_vswf_type_t)(u & 3);
*y = u / 4 - 1; *y = u / 4 - 1;
if (QPMS_UNLIKELY(*t == 3)) return QPMS_ERROR; if (QPMS_UNLIKELY(*t == 3)) return QPMS_ERROR;
if (QPMS_UNLIKELY(*y < 0)) return QPMS_ERROR; if (QPMS_UNLIKELY(*y < 0)) return QPMS_ERROR;

View File

@ -1,6 +1,7 @@
/*! \file lattices.h /*! \file lattices.h
* \brief Lattice point generators and lattice vector analysis / transformation. * \brief Lattice point generators and lattice vector analysis / transformation.
* *
* \bug Header file not C++ compatible.
*/ */
#ifndef LATTICES_H #ifndef LATTICES_H
#define LATTICES_H #define LATTICES_H

View File

@ -2,10 +2,12 @@
* \brief Convention-dependent coefficients for VSWFs. * \brief Convention-dependent coefficients for VSWFs.
* *
* See also @ref qpms_normalisation_t and @ref vswf_conventions. * See also @ref qpms_normalisation_t and @ref vswf_conventions.
*
* \bug Header file not C++ compatible.
*/ */
#ifndef NORMALISATION_H #ifndef NORMALISATION_H
#define NORMALISATION_H #define NORMALISATION_H
#ifdef __cplusplus #ifdef __cplusplus //FIXME not C++ compatible yet (enum bit operations)
extern "C" { extern "C" {
#endif #endif

View File

@ -1,8 +1,7 @@
// Just to test that all headers are C++ compatible // Just to test that all headers are C++ compatible
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
extern "C" {
#include <vswf.h> #include <vswf.h>
//#include <beyn.h> // C++ keyword as an identifier #include <beyn.h>
#include <gaunt.h> #include <gaunt.h>
#include <groups.h> #include <groups.h>
#include <kahansum.h> #include <kahansum.h>
@ -18,14 +17,14 @@ extern "C" {
#include <tiny_inlines.h> #include <tiny_inlines.h>
#include <tmatrices.h> #include <tmatrices.h>
#include <tolerances.h> #include <tolerances.h>
#include <translations.h>
#include <vectors.h>
#include <pointgroups.h>
#include <lattices_types.h>
#include <indexing.h>
#include <ewald.h>
// C++ type conversion issues: // C++ type conversion issues:
#include <quaternions.h>
//#include <lattices.h> //#include <lattices.h>
//#include <normalisation.h> //#include <normalisation.h>
//#include <indexing.h>
//#include <pointgroups.h>
//#include <qpmsblas.h> //#include <qpmsblas.h>
//#include <quaternions.h>
//#include <ewald.h>
//#include <translations.h>
//#include <vectors.h>
}