From 3ee08beb79789cb2d74bbf9e212b95eedaa23ec3 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Tue, 17 Nov 2015 16:33:14 -0500 Subject: [PATCH] fix expand_instantiation split logic We optionally split instantiations in the generated .inst files based on two macros SPLIT_INSTANTIATIONS_COUNT and SPLIT_INSTANTIATIONS_INDEX. Intel 14 generates an error with an invalid % 0 in the old solution, which happens if _COUNT is undefined. Fix this by defining a macro at the beginning of the .inst file. --- cmake/scripts/expand_instantiations.cc | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/cmake/scripts/expand_instantiations.cc b/cmake/scripts/expand_instantiations.cc index bb099183bf..2e224bb298 100644 --- a/cmake/scripts/expand_instantiations.cc +++ b/cmake/scripts/expand_instantiations.cc @@ -386,9 +386,9 @@ void substitute (const std::string &text, // between 0 and SPLIT_INSTANTIATIONS_COUNT-1 to get the instantiations of that // particular chunk. static unsigned int counter = 0; - std::cout << "#if !defined(SPLIT_INSTANTIATIONS_COUNT) || (" + std::cout << "#if (SPLIT_INSTANTIATIONS_CHECK(" << counter++ - << " % SPLIT_INSTANTIATIONS_COUNT == SPLIT_INSTANTIATIONS_INDEX)" << std::endl; + << "))" << std::endl; std::cout << substitute_tokens (text, name, *expansion) << std::endl; std::cout << "#endif" << std::endl; @@ -506,5 +506,27 @@ int main (int argc, char **argv) for (int i=1; i