diff options
author | Bob Duff <duff@adacore.com> | 2022-03-23 10:27:44 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-05-17 08:25:46 +0000 |
commit | b81c9e4f9f48f6e65d2e7e02d928e31f24a37c63 (patch) | |
tree | f6b19b887f4e0078bf67a6e13725bcdba23b0550 /gcc | |
parent | a2bcadcef01990526712d07b4cbcdd6e47ad3da9 (diff) | |
download | gcc-b81c9e4f9f48f6e65d2e7e02d928e31f24a37c63.zip gcc-b81c9e4f9f48f6e65d2e7e02d928e31f24a37c63.tar.gz gcc-b81c9e4f9f48f6e65d2e7e02d928e31f24a37c63.tar.bz2 |
[Ada] Output.w always writes to stderr
There are several debugging procedures called Output.w, and some
output-redirection features. This patch modifies Output.w so their
output is not redirected; it always goes to standard error. Otherwise,
debugging output can get mixed in with some "real" output (perhaps to a
file), which causes confusion and in some cases failure to build.
gcc/ada/
* output.adb (Pop_Output, Set_Output): Unconditionally flush
output when switching from one output destination to another.
Otherwise buffering can cause garbled output.
(w): Push/pop the current settings, and temporarily
Set_Standard_Error during these procedures.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/output.adb | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/gcc/ada/output.adb b/gcc/ada/output.adb index bdb2a44..33d027d 100644 --- a/gcc/ada/output.adb +++ b/gcc/ada/output.adb @@ -235,6 +235,7 @@ package body Output is procedure Pop_Output is begin + Flush_Buffer; pragma Assert (FD_Stack_Idx >= FD_Array'First); Current_FD := FD_Stack (FD_Stack_Idx); FD_Stack_Idx := FD_Stack_Idx - 1; @@ -292,10 +293,7 @@ package body Output is procedure Set_Output (FD : File_Descriptor) is begin - if Special_Output_Proc = null then - Flush_Buffer; - end if; - + Flush_Buffer; Current_FD := FD; end Set_Output; @@ -323,59 +321,99 @@ package body Output is procedure w (C : Character) is begin + Push_Output; + Set_Standard_Error; + Write_Char ('''); Write_Char (C); Write_Char ('''); Write_Eol; + + Pop_Output; end w; procedure w (S : String) is begin + Push_Output; + Set_Standard_Error; + Write_Str (S); Write_Eol; + + Pop_Output; end w; procedure w (V : Int) is begin + Push_Output; + Set_Standard_Error; + Write_Int (V); Write_Eol; + + Pop_Output; end w; procedure w (B : Boolean) is begin + Push_Output; + Set_Standard_Error; + if B then w ("True"); else w ("False"); end if; + + Pop_Output; end w; procedure w (L : String; C : Character) is begin + Push_Output; + Set_Standard_Error; + Write_Str (L); Write_Char (' '); w (C); + + Pop_Output; end w; procedure w (L : String; S : String) is begin + Push_Output; + Set_Standard_Error; + Write_Str (L); Write_Char (' '); w (S); + + Pop_Output; end w; procedure w (L : String; V : Int) is begin + Push_Output; + Set_Standard_Error; + Write_Str (L); Write_Char (' '); w (V); + + Pop_Output; end w; procedure w (L : String; B : Boolean) is begin + Push_Output; + Set_Standard_Error; + Write_Str (L); Write_Char (' '); w (B); + + Pop_Output; end w; ---------------- |