]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Produce .inst files that are easier to read. 14831/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Sat, 25 Feb 2023 21:40:16 +0000 (14:40 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sat, 25 Feb 2023 21:40:16 +0000 (14:40 -0700)
cmake/scripts/expand_instantiations.cc

index ac3805ef737d70c631c0c3d9cb83b8c387b79c55..1ce2223a917c6af704c51499196b569b97da2afc 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.