From 04baaf35fb827484a487cfc62421fc0c389f7122 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 25 Feb 2023 14:40:16 -0700 Subject: [PATCH] Produce .inst files that are easier to read. --- cmake/scripts/expand_instantiations.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cmake/scripts/expand_instantiations.cc b/cmake/scripts/expand_instantiations.cc index ac3805ef73..1ce2223a91 100644 --- a/cmake/scripts/expand_instantiations.cc +++ b/cmake/scripts/expand_instantiations.cc @@ -112,6 +112,16 @@ get_substring_with_delim(std::string &in, const std::string &delim_list) in.erase(0, 1); } + // We often end up with the '}' delimiter on a separate line, but + // not in the first column of the line. Since whitespace isn't + // harmful, that isn't a problem in itself, except that it makes + // producing nicely formatted output a bit harder than necessary. It + // would be nice if we could just end the text we read with the last + // newline in such cases. To this end, just trim trailing + // whitespace. + while ((x.size() > 0) && (x.back() == ' ')) + x.erase(x.size() - 1, 1); + return x; } @@ -416,8 +426,8 @@ substitute(const std::string & text, static unsigned int counter = 0; std::cout << "#if (SPLIT_INSTANTIATIONS_CHECK(" << counter++ << "))" << std::endl; - std::cout << substitute_tokens(text, name, *expansion) << std::endl; - std::cout << "#endif" << std::endl; + std::cout << substitute_tokens(text, name, *expansion); + std::cout << "#endif" << std::endl << std::endl; } } else -- 2.39.5