From c5f8817d9d03784e0da59d7957ec49d3dbd8ea48 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 25 Dec 2019 23:45:32 +0000 Subject: [PATCH] generate: Introduce oraw Replace all other calls to `o' with `oraw'. This ensures we have no stray calls. It elminates an anomaly, namely that calls outside process_input_mk would rely on the $buffering_output variable which is set only there. No functional change. Signed-off-by: Ian Jackson --- generate | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/generate b/generate index 0f9dd2d..c608e8c 100755 --- a/generate +++ b/generate @@ -69,17 +69,17 @@ sub close_any_output_file() { $writing_output = undef; } -sub o { - if (defined $buffering_output) { - $buffering_output .= $_ foreach @_; - return; - } +sub oraw { die unless defined $writing_output; print O @_ or die "error writing $writing_output.tmp: $!\n"; } sub od { # maybe $-doubled - o @_; + if (defined $buffering_output) { + $buffering_output .= $_ foreach @_; + return; + } + oraw @_; } sub start_output_file ($) { @@ -88,7 +88,7 @@ sub start_output_file ($) { die "$writing_output ?" if $output_files{$writing_output}++; my $tmp = "$writing_output.tmp"; open O, ">", $tmp or die "create $tmp: $!\n"; - o "# autogenerated - do not edit\n"; + oraw "# autogenerated - do not edit\n"; } sub install_output_files () { @@ -106,7 +106,7 @@ sub write_makefile ($$) { my $suppress_templates= '$(if $(filter-out clean real-clean, $(subdirmk_targets)),,'. ' MAKEFILE_TEMPLATES=)'; - o <