From 43eb1e43b6b22a0343104387431db7f32a88b16c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 3 Feb 2025 06:46:29 +0200 Subject: Optimize maybe-used diag_record It turns out the std::ostringstream member of butl::diag_record is quite expensive to construct but to never use. --- libbuild2/script/parser.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libbuild2/script/parser.cxx') diff --git a/libbuild2/script/parser.cxx b/libbuild2/script/parser.cxx index a82ccb8..96b454f 100644 --- a/libbuild2/script/parser.cxx +++ b/libbuild2/script/parser.cxx @@ -1668,9 +1668,9 @@ namespace build2 if (es > 255) { - diag_record dr; + diag_record dr (fail (l)); - dr << fail (l) << "expected exit status instead of "; + dr << "expected exit status instead of "; to_stream (dr.os, ns, quote_mode::normal); dr << info << "exit status is an unsigned integer less than 256"; -- cgit v1.1