From: Bob Duff Date: Wed, 23 Mar 2022 14:27:44 +0000 (-0400) Subject: [Ada] Output.w always writes to stderr X-Git-Tag: basepoints/gcc-14~6670 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b81c9e4f9f48f6e65d2e7e02d928e31f24a37c63;p=thirdparty%2Fgcc.git [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. --- diff --git a/gcc/ada/output.adb b/gcc/ada/output.adb index bdb2a44bf6b..33d027ded8e 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; ----------------