[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 4 Jul 2005 13:31:43 +0000 (15:31 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 4 Jul 2005 13:31:43 +0000 (15:31 +0200)
2005-07-04  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
    Thomas Quinot  <quinot@adacore.com>

* Make-lang.in: (ada/targtyps.o): Add missing TREE_H dependency.
new target gen-soccon.

2005-07-04  Robert Dewar  <dewar@adacore.com>

* s-mastop-irix.adb, s-mastop-vms.adb: Minor reformatting

2005-07-04  Thomas Quinot  <quinot@adacore.com>

* g-socket.ads (Check_Selector): Minor rewording of comment.

2005-07-04  Vincent Celier  <celier@adacore.com>

* vms_data.ads: Add VMS qualifiers for new gnatpp switch --eol=

2005-07-04  Thomas Quinot  <quinot@adacore.com>

* gen-soccon.c: Add constants SO_SNDTIMEO and SO_RCVTIMEO.

2005-07-04  Sergey Rybin  <rybin@adacore.com>

        * gnat_ugn.texi: Add description of --eol gnatpp option

2005-07-04  Eric Botcazou  <ebotcazou@adacore.com>
    Thomas Quinot  <quinot@adacore.com>

        * gnat_rm.texi: Add a note that pragma Unreferenced is not appropriate
if the user wants all calls of a subprogram to be flagged,
independently of whether they are made from within the same unit or
another unit.
        Mention restriction for pragma Linker_Alias on some platforms.
        Document pragma Linker_Constructor and Linker_Destructor.
        Rewrite documentation of Weak_External, Linker_Section and
        Linker_Alias pragmas.

From-SVN: r101598

gcc/ada/Make-lang.in
gcc/ada/g-socket.ads
gcc/ada/gen-soccon.c
gcc/ada/gnat_rm.texi
gcc/ada/gnat_ugn.texi
gcc/ada/s-mastop-irix.adb
gcc/ada/s-mastop-vms.adb
gcc/ada/vms_data.ads

index 5137246..c9d1c26 100644 (file)
@@ -289,6 +289,16 @@ gnat-cross: force
        make $(GNAT1_ADA_OBJS) CC="gcc -B../stage1/" CFLAGS="-S -gnatp" \
                $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) HOST_CFLAGS= HOST_CC=cc
 
+gen-soccon: force
+       $(MAKE) -C ada $(FLAGS_TO_PASS)  \
+          GNATLIBFLAGS="$(GNATLIBFLAGS)" \
+          GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
+          TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
+          THREAD_KIND="$(THREAD_KIND)" \
+          TRACE="$(TRACE)" \
+          LIBGNAT_OBJS=gen-soccon \
+          gnatlib
+
 gt-ada-decl.h gt-ada-trans.h gt-ada-utils.h gtype-ada.h : s-gtype ; @true
 \f
 # Build hooks:
@@ -1051,8 +1061,8 @@ ada/misc.o : ada/misc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
    ada/adadecode.h opts.h options.h target.h real.h
 
 ada/targtyps.o : ada/targtyps.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
-   ada/ada.h ada/types.h ada/atree.h ada/nlists.h ada/elists.h ada/uintp.h \
-   ada/sinfo.h ada/einfo.h ada/namet.h ada/snames.h ada/stringt.h \
+   $(TREE_H) ada/ada.h ada/types.h ada/atree.h ada/nlists.h ada/elists.h \
+   ada/uintp.h ada/sinfo.h ada/einfo.h ada/namet.h ada/snames.h ada/stringt.h \
    ada/urealp.h ada/fe.h $(ADA_TREE_H) ada/gigi.h
 
 ada/trans.o : ada/trans.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
index ab05fca..7529c05 100644 (file)
@@ -969,7 +969,7 @@ package GNAT.Sockets is
    --  this procedure process blocking. Note that a Timeout of 0.0 returns
    --  immediately. Also note that two different Socket_Set_Type objects must
    --  be passed as R_Socket_Set and W_Socket_Set (even if they denote the
-   --  same set of Sockets), or some event will be lost.
+   --  same set of Sockets), or some event may be lost.
    --  Socket_Error is raised when the select(2) system call returns an
    --  error condition, or when a read error occurs on the signalling socket
    --  used for the implementation of Abort_Selector.
index b1728df..643f639 100644 (file)
@@ -1,26 +1,26 @@
-/*****************************************************************************
-**                                                                          **
-**                          GNAT SYSTEM UTILITIES                           **
-**                                                                          **
-**                           G E N - S O C C O N                            **
-**                                                                          **
-**            Copyright (C) 2004-2005 Free Software Foundation, Inc.        **
-**                                                                          **
-** 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- **
-** ware  Foundation;  either version 2,  or (at your option) any later ver- **
-** sion.  GNAT is distributed in the hope that it will be useful, but WITH- **
-** OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY **
-** or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License **
-** for  more details.  You should have  received  a copy of the GNU General **
-** Public License  distributed with GNAT;  see file COPYING.  If not, write **
-** to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, **
-** Boston, MA 02110-1301, USA.                                              **
-**                                                                          **
-** GNAT was originally developed  by the GNAT team at  New York University. **
-** Extensive contributions were provided by Ada Core Technologies Inc.      **
-**                                                                          **
-******************************************************************************/
+/****************************************************************************
+ *                                                                          *
+ *                          GNAT SYSTEM UTILITIES                           *
+ *                                                                          *
+ *                           G E N - S O C C O N                            *
+ *                                                                          *
+ *            Copyright (C) 2004-2005 Free Software Foundation, Inc.        *
+ *                                                                          *
+ * 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- *
+ * ware  Foundation;  either version 2,  or (at your option) any later ver- *
+ * sion.  GNAT is distributed in the hope that it will be useful, but WITH- *
+ * OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY *
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License *
+ * for  more details.  You should have  received  a copy of the GNU General *
+ * Public License  distributed with GNAT;  see file COPYING.  If not, write *
+ * to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, *
+ * Boston, MA 02110-1301, USA.                                              *
+ *                                                                          *
+ * GNAT was originally developed  by the GNAT team at  New York University. *
+ * Extensive contributions were provided by Ada Core Technologies Inc.      *
+ *                                                                          *
+ ****************************************************************************/
 
 /* This program generates g-soccon.ads */
 
@@ -478,16 +478,6 @@ _NL
 #endif
 CND(TCP_NODELAY, "Do not coalesce packets")
 
-#ifndef SO_SNDBUF
-#define SO_SNDBUF -1
-#endif
-CND(SO_SNDBUF, "Set/get send buffer size")
-
-#ifndef SO_RCVBUF
-#define SO_RCVBUF -1
-#endif
-CND(SO_RCVBUF, "Set/get recv buffer size")
-
 #ifndef SO_REUSEADDR
 #define SO_REUSEADDR -1
 #endif
@@ -503,16 +493,36 @@ CND(SO_KEEPALIVE, "Enable keep-alive msgs")
 #endif
 CND(SO_LINGER, "Defer close to flush data")
 
-#ifndef SO_ERROR
-#define SO_ERROR -1
-#endif
-CND(SO_ERROR, "Get/clear error status")
-
 #ifndef SO_BROADCAST
 #define SO_BROADCAST -1
 #endif
 CND(SO_BROADCAST, "Can send broadcast msgs")
 
+#ifndef SO_SNDBUF
+#define SO_SNDBUF -1
+#endif
+CND(SO_SNDBUF, "Set/get send buffer size")
+
+#ifndef SO_RCVBUF
+#define SO_RCVBUF -1
+#endif
+CND(SO_RCVBUF, "Set/get recv buffer size")
+
+#ifndef SO_SNDTIMEO
+#define SO_SNDTIMEO -1
+#endif
+CND(SO_SNDTIMEO, "Emission timeout")
+
+#ifndef SO_RCVTIMEO
+#define SO_RCVTIMEO -1
+#endif
+CND(SO_RCVTIMEO, "Reception timeout")
+
+#ifndef SO_ERROR
+#define SO_ERROR -1
+#endif
+CND(SO_ERROR, "Get/clear error status")
+
 #ifndef IP_MULTICAST_IF
 #define IP_MULTICAST_IF -1
 #endif
index c6d50b3..e31c8e8 100644 (file)
@@ -69,7 +69,7 @@ GNAT, The GNU Ada 95 Compiler@*
 GCC version @value{version-GCC}@*
 
 @noindent
-Ada Core Technologies, Inc.
+AdaCore
 
 @menu
 * About This Guide::
@@ -149,6 +149,8 @@ Implementation Defined Pragmas
 * Pragma License::
 * Pragma Link_With::
 * Pragma Linker_Alias::
+* Pragma Linker_Constructor::
+* Pragma Linker_Destructor::
 * Pragma Linker_Section::
 * Pragma Long_Float::
 * Pragma Machine_Attribute::
@@ -678,6 +680,8 @@ consideration, the use of these pragmas should be minimized.
 * Pragma License::
 * Pragma Link_With::
 * Pragma Linker_Alias::
+* Pragma Linker_Constructor::
+* Pragma Linker_Destructor::
 * Pragma Linker_Section::
 * Pragma Long_Float::
 * Pragma Machine_Attribute::
@@ -2637,12 +2641,90 @@ Syntax:
 @smallexample @c ada
 pragma Linker_Alias (
   [Entity =>] local_NAME
-  [Alias  =>] static_string_EXPRESSION);
+  [Target =>] static_string_EXPRESSION);
 @end smallexample
 
 @noindent
-This pragma establishes a linker alias for the given named entity.  For
-further details on the exact effect, consult the GCC manual.
+@var{local_NAME} must refer to an object that is declared at the library
+level. This pragma establishes the given entity as a linker alias for the
+given target. It is equivalent to @code{__attribute__((alias))} in GNU C
+and causes @var{local_NAME} to be emitted as an alias for the symbol
+@var{static_string_EXPRESSION} in the object file, that is to say no space
+is reserved for @var{local_NAME} by the assembler and it will be resolved
+to the same address as @var{static_string_EXPRESSION} by the linker.
+
+The actual linker name for the target must be used (e.g. the fully
+encoded name with qualification in Ada, or the mangled name in C++),
+or it must be declared using the C convention with @code{pragma Import}
+or @code{pragma Export}.
+
+Not all target machines support this pragma. On some of them it is accepted
+only if @code{pragma Weak_External} has been applied to @var{local_NAME}.
+
+@smallexample @c ada
+--  Example of the use of pragma Linker_Alias
+
+package p is
+  i : Integer := 1;
+  pragma Export (C, i);
+
+  new_name_for_i : Integer;
+  pragma Linker_Alias (new_name_for_i, "i");
+end p; 
+@end smallexample
+
+@node Pragma Linker_Constructor
+@unnumberedsec Pragma Linker_Constructor
+@findex Linker_Constructor
+@noindent
+Syntax:
+
+@smallexample @c ada
+pragma Linker_Constructor (procedure_LOCAL_NAME);
+@end smallexample
+
+@noindent
+@var{procedure_local_NAME} must refer to a parameterless procedure that
+is declared at the library level. A procedure to which this pragma is
+applied will be treated as an initialization routine by the linker.
+It is equivalent to @code{__attribute__((constructor))} in GNU C and
+causes @var{procedure_LOCAL_NAME} to be invoked before the entry point
+of the executable is called (or immediately after the shared library is
+loaded if the procedure is linked in a shared library), in particular
+before the Ada run-time environment is set up.
+
+Because of these specific contexts, the set of operations such a procedure
+can perform is very limited and the type of objects it can manipulate is
+essentially restricted to the elementary types. In particular, it must only
+contain code to which pragma Restrictions (No_Elaboration_Code) applies.
+
+This pragma is used by GNAT to implement auto-initialization of shared Stand
+Alone Libraries, which provides a related capability without the restrictions
+listed above. Where possible, the use of Stand Alone Libraries is preferable
+to the use of this pragma.
+
+@node Pragma Linker_Destructor
+@unnumberedsec Pragma Linker_Destructor
+@findex Linker_Destructor
+@noindent
+Syntax:
+
+@smallexample @c ada
+pragma Linker_Destructor (procedure_LOCAL_NAME);
+@end smallexample
+
+@noindent
+@var{procedure_local_NAME} must refer to a parameterless procedure that
+is declared at the library level. A procedure to which this pragma is
+applied will be treated as a finalization routine by the linker.
+It is equivalent to @code{__attribute__((destructor))} in GNU C and
+causes @var{procedure_LOCAL_NAME} to be invoked after the entry point
+of the executable has exited (or immediately before the shared library
+is unloaded if the procedure is linked in a shared library), in particular
+after the Ada run-time environment is shut down.
+
+See @code{pragma Linker_Constructor} for the set of restrictions that apply
+because of these specific contexts.
 
 @node Pragma Linker_Section
 @unnumberedsec Pragma Linker_Section
@@ -2657,8 +2739,41 @@ pragma Linker_Section (
 @end smallexample
 
 @noindent
-This pragma specifies the name of the linker section for the given entity.
-For further details on the exact effect, consult the GCC manual.
+@var{local_NAME} must refer to an object that is declared at the library
+level. This pragma specifies the name of the linker section for the given
+entity. It is equivalent to @code{__attribute__((section))} in GNU C and
+causes @var{local_NAME} to be placed in the @var{static_string_EXPRESSION}
+section of the executable (assuming the linker doesn't rename the section).
+
+The compiler normally places library-level objects in standard sections
+depending on their type: procedures and functions generally go in the
+@code{.text} section, initialized variables in the @code{.data} section
+and uninitialized variables in the @code{.bss} section.
+
+Other, special sections may exist on given target machines to map special
+hardware, for example I/O ports or flash memory. This pragma is a means to
+defer the final layout of the executable to the linker, thus fully working
+at the symbolic level with the compiler.
+
+Some file formats do not support arbitrary sections so not all target
+machines support this pragma. The use of this pragma may cause a program
+execution to be erroneous if it is used to place an entity into an
+inappropriate section (e.g. a modified variable into the @code{.text}
+section). See also @code{pragma Persistent_BSS}.
+
+@smallexample @c ada
+--  Example of the use of pragma Linker_Section
+
+package IO_Card is
+  Port_A : Integer;
+  pragma Volatile (Port_A);
+  pragma Linker_Section (Port_A, ".bss.port_a");
+
+  Port_B : Integer;
+  pragma Volatile (Port_B);
+  pragma Linker_Section (Port_B, ".bss.port_b");
+end IO_Card;
+@end smallexample
 
 @node Pragma Long_Float
 @unnumberedsec Pragma Long_Float
@@ -3914,6 +4029,12 @@ The left hand side of an assignment does not count as a reference for the
 purpose of this pragma. Thus it is fine to assign to an entity for which
 pragma Unreferenced is given.
 
+Note that if a warning is desired for all calls to a given subprogram,
+regardless of whether they occur in the same unit as the subprogram
+declaration, then this pragma should not be used (calls from another
+unit would not be flagged); pragma Obsolescent can be used instead
+for this purpose (@xref{Pragma Obsolescent}).
+
 @node Pragma Unreserve_All_Interrupts
 @unnumberedsec Pragma Unreserve_All_Interrupts
 @findex Unreserve_All_Interrupts
@@ -4105,9 +4226,45 @@ pragma Weak_External ([Entity =>] local_NAME);
 @end smallexample
 
 @noindent
-This pragma specifies that the given entity should be marked as a weak
-external (one that does not have to be resolved) for the linker.  For
-further details, consult the GCC manual.
+@var{local_NAME} must refer to an object that is declared at the library
+level. This pragma specifies that the given entity should be marked as a
+weak symbol for the linker. It is equivalent to @code{__attribute__((weak))}
+in GNU C and causes @var{local_NAME} to be emitted as a weak symbol instead
+of a regular symbol, that is to say a symbol that does not have to be
+resolved by the linker if used in conjunction with a pragma Import.
+
+When a weak symbol is not resolved by the linker, its address is set to
+zero. This is useful in writing interfaces to external modules that may
+or may not be linked in the final executable, for example depending on
+configuration settings.
+
+If a program references at run time an entity to which this pragma has been
+applied, and the corresponding symbol was not resolved at link time, then
+the execution of the program is erroneous. It is not erroneous to take the
+Address of such an entity, for example to guard potential references,
+as shown in the example below.
+
+Some file formats do not support weak symbols so not all target machines
+support this pragma. 
+
+@smallexample @c ada
+--  Example of the use of pragma Weak_External
+
+package External_Module is
+  key : Integer;
+  pragma Import (C, key);
+  pragma Weak_External (key);
+  function Present return boolean;
+end External_Module;
+
+with System; use System;
+package body External_Module is
+  function Present return boolean is
+  begin
+    return key'Address /= System.Null_Address;
+  end Present;
+end External_Module;
+@end smallexample
 
 @node Implementation Defined Attributes
 @chapter Implementation Defined Attributes
index 38d4b4f..74b2c40 100644 (file)
@@ -2860,7 +2860,7 @@ The build procedure for this application is similar to the last
 example's.  First, compile the foreign language files to generate object
 files:
 @smallexample
-gcc -c main.c
+^gcc -c main.c^gcc -c main.c^
 @end smallexample
 
 @item
@@ -4948,14 +4948,14 @@ may not be properly initialized.
 @cindex Ada 2005 compatibility issues warnings
 For the most part Ada 2005 is upwards compatible with Ada 95,
 but there are some exceptions (for example the fact that
-@code{interface} is now a reserved word in Ada 2005. This
+@code{interface} is now a reserved word in Ada 2005). This
 switch activates several warnings to help in identifying
 and correcting such incompatibilities. The default is that
 these warnings are generated. Note that at one point Ada 2005
 was called Ada 0Y, hence the choice of character.
 
 @item -gnatwY
-@emph{Disab le warnings for Ada 2005 compatibility issues.}
+@emph{Disable warnings for Ada 2005 compatibility issues.}
 @cindex @option{-gnatwY} (@command{gcc})
 @cindex Ada 2005 compatibility issues warnings
 This switch suppresses several warnings intended to help in identifying
@@ -15049,13 +15049,31 @@ already exists, it is overwritten.
 @cindex @option{^-rnb^/NO_BACKUP^} (@code{gnatpp})
 Replace the input source file with the reformatted output without
 creating any backup copy of the input source.
+
+@item ^--eol=@var{xxx}^/END_OF_LINE=@var{xxx}^
+@cindex @option{^--eol^/END_OF_LINE^} (@code{gnatpp})
+Specifies the format of the reformatted output file. The @var{xxx}
+^string specified with the switch^option^ may be either
+@itemize @bullet
+@item ``@option{^dos^DOS^}'' MS DOS style, lines end with CR LF characters
+@item ``@option{^crlf^CRLF^}''
+the same as @option{^crlf^CRLF^}
+@item ``@option{^unix^UNIX^}'' UNIX style, lines end with LF character
+@item ``@option{^lf^LF^}''
+the same as @option{^unix^UNIX^}
+@end itemize
+
 @end table
 
 @noindent
 Options @option{^-pipe^/STANDARD_OUTPUT^},
 @option{^-o^/OUTPUT^} and
 @option{^-of^/FORCED_OUTPUT^} are allowed only if the call to gnatpp
-contains only one file to reformat
+contains only one file to reformat.
+Option
+@option{^--eol^/END_OF_LINE^}
+can not be used together
+with @option{^-pipe^/STANDARD_OUTPUT^} option.
 
 @node Other gnatpp Switches
 @subsection Other @code{gnatpp} Switches
index 626c02d..80f0d59 100644 (file)
@@ -420,7 +420,6 @@ package body System.Machine_State_Operations is
    is
       pragma Warnings (Off, M);
       pragma Warnings (Off, Context);
-
    begin
       null;
    end Set_Signal_Machine_State;
index 46ad275..764fe08 100644 (file)
@@ -7,7 +7,7 @@
 --                                 B o d y                                  --
 --                         (Version for Alpha/VMS)                          --
 --                                                                          --
---          Copyright (C) 2001-2002 Ada Core Technologies, Inc.             --
+--          Copyright (C) 2001-2005 Ada Core Technologies, Inc.             --
 --                                                                          --
 -- 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- --
@@ -311,7 +311,7 @@ package body System.Machine_State_Operations is
          (Invo_Handle_Type, Invo_Context_Blk_Type),
          (Value, Reference));
 
-      ICB : Invo_Context_Blk_Type;
+      ICB         : Invo_Context_Blk_Type;
       Invo_Handle : aliased Invo_Handle_Type;
 
    begin
@@ -331,7 +331,6 @@ package body System.Machine_State_Operations is
    is
       pragma Warnings (Off, M);
       pragma Warnings (Off, Context);
-
    begin
       null;
    end Set_Signal_Machine_State;
index 10e7642..50ed1ee 100644 (file)
@@ -4662,6 +4662,24 @@ package VMS_Data is
    --   unless the indentation is set to 1: in that case the default value for
    --   continuation line indentation is also 1.
 
+   S_Pretty_Eol       : aliased constant S := "/END_OF_LINE="              &
+                                                "DOS "                     &
+                                                   "--eol=dos "            &
+                                                "UNIX "                    &
+                                                   "--eol=unix "           &
+                                                "CRLF "                    &
+                                                   "--eol=crlf "           &
+                                                "LF "                      &
+                                                   "--eol=lf";
+   --        /END_OF_LINE=[option]
+   --
+   --   Specifies the form of the line terminators in the produced source.
+   --   By default, the form of the line terminator depends on the platforms.
+   --   On Unix and VMS, it is a Line Feed (LF) chararcter. On Windows (DOS),
+   --   It is a Carriage Return (CR) followed by a Line Feed.
+   --   The Options DOS and CRLF are equivalent. The options UNIX and LF are
+   --   also equivalent.
+
    S_Pretty_Ext       : aliased constant S := "/EXTERNAL_REFERENCE=" & '"' &
                                             "-X" & '"';
    --        /EXTERNAL_REFERENCE="name=val"
@@ -4924,9 +4942,10 @@ package VMS_Data is
       S_Pretty_Config    'Access,
       S_Pretty_Constr    'Access,
       S_Pretty_Comind    'Access,
-      S_Pretty_Ext       'Access,
       S_Pretty_Current   'Access,
       S_Pretty_Dico      'Access,
+      S_Pretty_Eol       'Access,
+      S_Pretty_Ext       'Access,
       S_Pretty_Files     'Access,
       S_Pretty_Forced    'Access,
       S_Pretty_Formfeed  'Access,