Patchwork Head does not build Ada for RTEMS

login
register
mail settings
Submitter Joel Sherrill
Date Sept. 29, 2010, 5:11 p.m.
Message ID <4CA3735F.9060801@oarcorp.com>
Download mbox | patch
Permalink /patch/66079/
State New
Headers show

Comments

Joel Sherrill - Sept. 29, 2010, 5:11 p.m.
Hi,

This is because RTEMS does not have some of the errno's
and they get turned into -1.  And then the Ada compiler
complains that there are multiples with -1.

g-socket.adb:1902:25: warning: condition is always False
g-socket.adb:1902:25: warning: (see test at line 1900)

OK to commit?

2010-09-28  Joel Sherrill <joel.sherrill@oarcorp.com>

     * g-socket.adb: Move pragma to disable warnings in case
     multiple errnos are not defined by target.
Arnaud Charlet - Sept. 30, 2010, 6:17 a.m.
> OK to commit?

OK.

> 2010-09-28  Joel Sherrill <joel.sherrill@oarcorp.com>
> 
>     * g-socket.adb: Move pragma to disable warnings in case
>     multiple errnos are not defined by target.

Patch

Index: gcc/ada/g-socket.adb
===================================================================
--- gcc/ada/g-socket.adb	(revision 164697)
+++ gcc/ada/g-socket.adb	(working copy)
@@ -1821,12 +1821,14 @@ 
          return Resource_Temporarily_Unavailable;
       end if;
 
-      pragma Warnings (On);
-
       --  This is not a case statement because if a particular error
       --  number constant is not defined, s-oscons-tmplt.c defines
       --  it to -1.  If multiple constants are not defined, they
       --  would each be -1 and result in a "duplicate value in case" error.
+      --
+      --  But we have to leave warnings off because the compiler is also
+      --  smart enough to note that when two errnos have the same value,
+      --  the second if condition is useless.
       if Error_Value = ENOERROR then
          return Success;
       elsif Error_Value = EACCES then
@@ -1910,6 +1912,8 @@ 
       else
          return Cannot_Resolve_Error;
       end if;
+      pragma Warnings (On);
+
    end Resolve_Error;
 
    -----------------------