vtk-m/CMake/InstantiationTemplate.cxx.in
Kenneth Moreland 18461d676f Add a unique symbol to InstantiationTemplate.cxx.in
A compiler or linker may give an error if a .cxx file is empty (that is,
declares no symbols). This can happen if an instantiation declaration
gets removed during the compile either through preprocessor macros or
SFINAE.

To protect against this, declare a simple integer with a unique symbol
in each instantiation file. The overhead is very small and will prevent
compile/link errors.
2022-03-28 09:18:23 -06:00

13 lines
280 B
C++

#ifndef @INSTANTIATION_INC_GUARD@
#define @INSTANTIATION_INC_GUARD@
#endif
#include <@INSTANTIATION_TEMPLATE_SOURCE@>
/* Needed for linking errors when no instantiations */
int @INSTANTIATION_INC_GUARD@@counter@__;
@INSTANTIATION_DECLARATION@
#undef @INSTANTIATION_INC_GUARD@