This is about the 3 -Wuninitialized warnings for the build of the Ada library:
g-expect.adb: In function 'GNAT.EXPECT.SET_UP_CHILD_COMMUNICATIONS':
g-expect.adb:1356:7: warning: 'INPUT' is used uninitialized in this function
[-Wuninitialized]
g-expect.adb:1357:7: warning: 'OUTPUT' is used uninitialized in this function
[-Wuninitialized]
g-expect.adb:1358:7: warning: 'ERROR' is used uninitialized in this function
[-Wuninitialized]
They are actually false positives, but the compiler will never be able to
understand that because the uses are past a fork-like function call on Unix
systems.
Tested on x86-64/Linux, applied on the mainline.
2015-12-09 Eric Botcazou <ebotca...@adacore.com>
PR ada/66526
* g-expect.adb (Set_Up_Child_Communications): Add matching condition
for uses of Input, Ouput and Error variables after the Execvp call.
--
Eric Botcazou
Index: g-expect.adb
===================================================================
--- g-expect.adb (revision 231440)
+++ g-expect.adb (working copy)
@@ -1348,17 +1348,22 @@ package body GNAT.Expect is
Portable_Execvp (Pid.Pid'Access, Cmd & ASCII.NUL, Args);
- -- The following commands are not executed on Unix systems, and are only
- -- required for Windows systems. We are now in the parent process.
+ -- The following lines are only required for Windows systems and will
+ -- not be executed on Unix systems, but we use the same condition as
+ -- above to avoid warnings on uninitialized variables on Unix systems.
+ -- We are now in the parent process.
- -- Restore the old descriptors
+ if No_Fork_On_Target then
- Dup2 (Input, GNAT.OS_Lib.Standin);
- Dup2 (Output, GNAT.OS_Lib.Standout);
- Dup2 (Error, GNAT.OS_Lib.Standerr);
- Close (Input);
- Close (Output);
- Close (Error);
+ -- Restore the old descriptors
+
+ Dup2 (Input, GNAT.OS_Lib.Standin);
+ Dup2 (Output, GNAT.OS_Lib.Standout);
+ Dup2 (Error, GNAT.OS_Lib.Standerr);
+ Close (Input);
+ Close (Output);
+ Close (Error);
+ end if;
end Set_Up_Child_Communications;
---------------------------