public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-537] [Ada] Output.w always writes to stderr
@ 2022-05-17 8:28 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-17 8:28 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:b81c9e4f9f48f6e65d2e7e02d928e31f24a37c63
commit r13-537-gb81c9e4f9f48f6e65d2e7e02d928e31f24a37c63
Author: Bob Duff <duff@adacore.com>
Date: Wed Mar 23 10:27:44 2022 -0400
[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:
---
gcc/ada/output.adb | 46 ++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 42 insertions(+), 4 deletions(-)
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;
----------------
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-17 8:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17 8:28 [gcc r13-537] [Ada] Output.w always writes to stderr Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).