OSDN Git Service

2012-08-06 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 6 Aug 2012 07:43:45 +0000 (07:43 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 6 Aug 2012 07:43:45 +0000 (07:43 +0000)
* s-htable.adb: Minor reformatting.

2012-08-06  Thomas Quinot  <quinot@adacore.com>

* s-oscons-tmplt.c, g-socket.adb (System.OS_Constants.Target_OS):
Suppress warnings so that we don't have to do it at each usage.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190157 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/g-socket.adb
gcc/ada/s-htable.adb
gcc/ada/s-oscons-tmplt.c

index f033632..df4334b 100644 (file)
@@ -1,3 +1,12 @@
+2012-08-06  Robert Dewar  <dewar@adacore.com>
+
+       * s-htable.adb: Minor reformatting.
+
+2012-08-06  Thomas Quinot  <quinot@adacore.com>
+
+       * s-oscons-tmplt.c, g-socket.adb (System.OS_Constants.Target_OS):
+       Suppress warnings so that we don't have to do it at each usage.
+
 2012-08-06  Vincent Pucci  <pucci@adacore.com>
 
        * exp_ch9.adb (Build_Lock_Free_Unprotected_Subprogram_Body):
index d84c28f..ac03f42 100644 (file)
@@ -480,9 +480,7 @@ package body GNAT.Sockets is
       --  no check required. Warnings suppressed because condition
       --  is known at compile time.
 
-      pragma Warnings (Off);
       if Target_OS = Windows then
-         pragma Warnings (On);
 
          return;
 
@@ -1150,10 +1148,7 @@ package body GNAT.Sockets is
             --  struct timeval, but on Windows it is a milliseconds count in
             --  a DWORD.
 
-            pragma Warnings (Off);
             if Target_OS = Windows then
-               pragma Warnings (On);
-
                Len := V4'Size / 8;
                Add := V4'Address;
 
@@ -1217,9 +1212,7 @@ package body GNAT.Sockets is
          when Send_Timeout    |
               Receive_Timeout =>
 
-            pragma Warnings (Off);
             if Target_OS = Windows then
-               pragma Warnings (On);
 
                --  Timeout is in milliseconds, actual value is 500 ms +
                --  returned value (unless it is 0).
@@ -1736,8 +1729,6 @@ package body GNAT.Sockets is
       Item   : out Ada.Streams.Stream_Element_Array;
       Last   : out Ada.Streams.Stream_Element_Offset)
    is
-      pragma Warnings (Off, Stream);
-
       First : Ada.Streams.Stream_Element_Offset          := Item'First;
       Index : Ada.Streams.Stream_Element_Offset          := First - 1;
       Max   : constant Ada.Streams.Stream_Element_Offset := Item'Last;
@@ -2270,9 +2261,7 @@ package body GNAT.Sockets is
          when Send_Timeout    |
               Receive_Timeout =>
 
-            pragma Warnings (Off);
             if Target_OS = Windows then
-               pragma Warnings (On);
 
                --  On Windows, the timeout is a DWORD in milliseconds, and
                --  the actual timeout is 500 ms + the given value (unless it
@@ -2317,17 +2306,12 @@ package body GNAT.Sockets is
       use type C.unsigned_short;
 
    begin
-      --  Big-endian case. No conversion needed. On these platforms,
-      --  htons() defaults to a null procedure.
-
-      pragma Warnings (Off);
-      --  Since the test can generate "always True/False" warning
+      --  Big-endian case. No conversion needed. On these platforms, htons()
+      --  defaults to a null procedure.
 
       if Default_Bit_Order = High_Order_First then
          return S;
 
-         pragma Warnings (On);
-
       --  Little-endian case. We must swap the high and low bytes of this
       --  short to make the port number network compliant.
 
index e2b5235..b8116f9 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                    Copyright (C) 1995-2011, AdaCore                      --
+--                    Copyright (C) 1995-2012, AdaCore                      --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -62,7 +62,6 @@ package body System.HTable is
 
       begin
          Elmt := Table (Hash (K));
-
          loop
             if Elmt = Null_Ptr then
                return Null_Ptr;
@@ -96,10 +95,10 @@ package body System.HTable is
       begin
          if not Iterator_Started then
             return Null_Ptr;
+         else
+            Iterator_Ptr := Next (Iterator_Ptr);
+            return Get_Non_Null;
          end if;
-
-         Iterator_Ptr := Next (Iterator_Ptr);
-         return Get_Non_Null;
       end Get_Next;
 
       ------------------
@@ -183,7 +182,6 @@ package body System.HTable is
 
       procedure Set (E : Elmt_Ptr) is
          Index : Header_Num;
-
       begin
          Index := Hash (Get_Key (E));
          Set_Next (E, Table (Index));
index 467a1e4..dbfab4e 100644 (file)
@@ -264,6 +264,13 @@ package System.OS_Constants is
 # define TARGET_OS "Other_OS"
 #endif
 C("Target_OS", OS_Type, TARGET_OS, "")
+/*
+   pragma Warnings (Off, Target_OS);
+   --  Suppress warnings on Target_OS since it is in general tested for
+   --  equality with a constant valueto implement conditional compilation,
+   --  which normally generates a constant condition warning.
+
+*/
 #define Target_Name TARGET
 CST(Target_Name, "")
 /*