schnellerhase / dolfinx

Next generation FEniCS problem solving environment
https://fenicsproject.org
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Make use of consteval for compile flags #3

Closed schnellerhase closed 3 weeks ago

schnellerhase commented 1 month ago

Currently compile flags are passed to the dolfinx library via functions, split as usual in header and source files. These are however always functions that 'hide' a constant - now even in a different compile unit. This may be avoided and made explicit with the use of header based consteval marked functions.

For example the current declaration

bool has_petsc();

with definition (in .cpp)

bool dolfinx::has_petsc()
{
#ifdef HAS_PETSC
  return true;
#else
  return false;
#endif
}

should be changed to something like, in header:

consteval bool dolfinx::has_petsc()
{
#ifdef HAS_PETSC
  return true;
#else
  return false;
#endif
}