summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-28 08:15:44 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-28 08:15:44 +0000
commitddf7bad06432a70e5ad31bc9af074b655c2ad0b0 (patch)
treeb06b173a93c4867a60c4e103f58ba1f992668109 /gcc
parentcc8931696c9f3b268008ba8b2592f293c9727aff (diff)
downloadppe42-gcc-ddf7bad06432a70e5ad31bc9af074b655c2ad0b0.tar.gz
ppe42-gcc-ddf7bad06432a70e5ad31bc9af074b655c2ad0b0.zip
2009-07-28 Sergey Rybin <rybin@adacore.com>
* gnat_ugn.texi: Add section about gnatcheck rule exemption. 2009-07-28 Vadim Godunko <godunko@adacore.com> * s-oscons-tmplt.c: Define _XOPEN_SOURCE on Linux, otherwise IOV_MAX is not defined by limits.h. * g-socket.adb (Receive_Vector): Use minimum length from user's vector length and maximum supported length of data vector. 2009-07-28 Gary Dismukes <dismukes@adacore.com> * usage.adb: Inhibit printing gcc-specific switches for AAMP target. * make.adb: Call Get_Target_Parameters before calling Usage so that VM_Target and AAMP_On_Target will be set. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150147 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog18
-rw-r--r--gcc/ada/g-socket.adb3
-rw-r--r--gcc/ada/gnat_ugn.texi106
-rw-r--r--gcc/ada/make.adb5
-rw-r--r--gcc/ada/s-oscons-tmplt.c5
-rw-r--r--gcc/ada/usage.adb4
6 files changed, 137 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 6dbd480dbff..c916da42339 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,21 @@
+2009-07-28 Sergey Rybin <rybin@adacore.com>
+
+ * gnat_ugn.texi: Add section about gnatcheck rule exemption.
+
+2009-07-28 Vadim Godunko <godunko@adacore.com>
+
+ * s-oscons-tmplt.c: Define _XOPEN_SOURCE on Linux, otherwise IOV_MAX is
+ not defined by limits.h.
+
+ * g-socket.adb (Receive_Vector): Use minimum length from user's vector
+ length and maximum supported length of data vector.
+
+2009-07-28 Gary Dismukes <dismukes@adacore.com>
+
+ * usage.adb: Inhibit printing gcc-specific switches for AAMP target.
+ * make.adb: Call Get_Target_Parameters before calling Usage so that
+ VM_Target and AAMP_On_Target will be set.
+
2009-07-28 Olivier Hainque <hainque@adacore.com>
* g-ssinty.ads: Remove, pointless and just confusing at this stage.
diff --git a/gcc/ada/g-socket.adb b/gcc/ada/g-socket.adb
index c002054395c..c816312ac3f 100644
--- a/gcc/ada/g-socket.adb
+++ b/gcc/ada/g-socket.adb
@@ -1664,7 +1664,8 @@ package body GNAT.Sockets is
(Msg_Name => System.Null_Address,
Msg_Namelen => 0,
Msg_Iov => Vector'Address,
- Msg_Iovlen => SOSC.Msg_Iovlen_T (Vector'Length),
+ Msg_Iovlen =>
+ SOSC.Msg_Iovlen_T'Min (Vector'Length, SOSC.IOV_MAX),
Msg_Control => System.Null_Address,
Msg_Controllen => 0,
Msg_Flags => 0);
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 7175dfd8edd..c1feece8654 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -490,6 +490,7 @@ Verifying Properties Using gnatcheck
* gnatcheck Rule Options::
* Adding the Results of Compiler Checks to gnatcheck Output::
* Project-Wide Checks::
+* Rule exemption::
* Predefined Rules::
Sample Bodies Using gnatstub
@@ -20696,6 +20697,7 @@ Either a @file{@var{filename}} or an @file{@var{arg_list_filename}} must be supp
* gnatcheck Rule Options::
* Adding the Results of Compiler Checks to gnatcheck Output::
* Project-Wide Checks::
+* Rule exemption::
* Predefined Rules::
@end menu
@@ -20946,6 +20948,108 @@ the @option{-U} option followed by the name of the main unit:
@end smallexample
+@node Rule exemption
+@section Rule exemption
+@cindex Rule exemption (for @command{gnatcheck})
+
+@noindent
+@command{gnatcheck} can be used to inforce a coding standard. It may be
+appropriate, in some circumstances, to accept violations of the coding
+standard. In such a case, it is a good idea to justify the violation within
+the sources themselves. It makes it possible to maintain the justification
+for such violations along with the sources containing them.
+@command{gnatcheck} supports such justified violations with the notion of
+``exemption'' covering a specific source code section. Usually,
+@command{gnatcheck} issues rule violation messages both on @file{stderr}
+and in a report file. Exempted violations are not reported at all on
+@file{stderr} so that users using @command{gnatcheck} in interactive mode
+(e.g. in its GPS interface) do not need to pay attention to known and
+justified violations. The @command{gnatcheck} report includes exempted
+violations in a special section along with their justification.
+
+@menu
+* Using pragma Annotate to Control Rule Exemption::
+* gnatcheck Annotations Rules::
+@end menu
+
+@node Using pragma Annotate to Control Rule Exemption
+@subsection Using pragma @code{Annotate} to Control Rule Exemption
+@cindex Using pragma Annotate to control rule exemption
+
+@noindent
+Rule exemption is controlled by pragma @code{Annotate} when its first parameter is
+``gnatcheck''. Here is the syntax of @command{gnatcheck} annotations:
+
+@smallexample @c ada
+pragma Annotate (gnatcheck, exemption_control, Rule_Name, [justification]);
+
+exemption_control ::= "Exempt_On" | "Exempt_Off"
+
+Rule_Name ::= string_literal
+
+justification ::= string_literal
+
+@end smallexample
+
+@noindent
+When a @command{gnatcheck} annotatation has more then four parameters,
+@command{gnatcheck} issues a warning and ignore additional parameters.
+If the additional parameters do not follow the syntax above,
+@command{gnatcheck} emits a warning and ignores the annotation.
+
+@code{Rule_Name} should be the name of some existing @command{gnatcheck} rule.
+If this is not the case, the warning message is generated and the pragma is
+ignored. If @code{Rule_Name} denotes a rule that is not activated by the given
+@command{gnatcheck} call, the pragma is ignored silently.
+
+A source code section where an exemption is active for a given rule starts with
+an extempt_on annotation and terminates with an exempt_off one:
+
+@smallexample @c ada
+pragma Annotate (gnatcheck, "Exempt_On", Rule_Name, "justification");
+-- source code section
+pragma Annotate (gnatcheck, "Exempt_Off", Rule_Name);
+@end smallexample
+
+
+@node gnatcheck Annotations Rules
+@subsection @command{gnatcheck} Annotations Rules
+@cindex @command{gnatcheck} annotations rules
+
+@itemize @bullet
+
+@item
+an ``Exempt_Off'' annotation can only appear after a corresponding
+``Exempt_On'' annotation in order to create a properly formed exempted source
+code section;
+
+@item
+exempted source code sections are only based on the source location of the
+annotations. Any source construct having a source location in between the two
+annotations is part of the exempted source code section;
+
+@item
+exempted source code sections for different rules are independent. They can
+be nested or intersect with one another without limitation. It is not allowed
+to create nested or intersecting source code sections for the same rule;
+
+@item
+malformed exempted source code sections are reported by a warning and
+the corresponding rule exemption is ignored;
+
+@item
+when an exempted source code section does not contain at least one violation
+of the exempted rule, a warning is emitted on @file{stderr}. This allow proper
+maintenance of exempted source code sections;
+
+@item
+if an exempted source code section reaches the end of the compilation unit
+source and there is no @code{Annotate} pragma closing this section, then the
+exemption for the given rule is turned off and a warning is issued.
+
+@end itemize
+
+
@node Predefined Rules
@section Predefined Rules
@cindex Predefined rules (for @command{gnatcheck})
@@ -21222,7 +21326,7 @@ conditions is met:
@itemize @bullet
@item
it contains at least one complex declaration such as a subprogram body,
-package, task, protected object declaration, or a generic instantiation
+package, task, protected declaration, or a generic instantiation
(except instantiation of @code{Ada.Unchecked_Conversion});
@item
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index a0f3b0b42fa..25124fa8314 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -4772,6 +4772,11 @@ package body Make is
Exit_Program (E_Success);
else
+ -- Call Get_Target_Parameters to ensure that VM_Target and
+ -- AAMP_On_Target get set before calling Usage.
+
+ Targparm.Get_Target_Parameters;
+
-- Output usage information if no files to compile
Usage;
diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c
index b5dd2a86a7b..c4218c2ab78 100644
--- a/gcc/ada/s-oscons-tmplt.c
+++ b/gcc/ada/s-oscons-tmplt.c
@@ -78,6 +78,11 @@ pragma Style_Checks ("M32766");
** $ RUN xoscons
**/
+#if defined (__linux__) && !defined (_XOPEN_SOURCE)
+/* For Linux _XOPEN_SOURCE must be defined, otherwise IOV_MAX is not defined */
+#define _XOPEN_SOURCE 500
+#endif
+
#include <stdlib.h>
#include <string.h>
#include <limits.h>
diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb
index 0d6e9ccac91..6d704403da9 100644
--- a/gcc/ada/usage.adb
+++ b/gcc/ada/usage.adb
@@ -91,9 +91,9 @@ begin
Write_Eol;
- -- Common GCC switches not available in JGNAT/MGNAT
+ -- Common GCC switches not available for JVM, .NET, and AAMP targets
- if VM_Target = No_VM then
+ if VM_Target = No_VM and then not AAMP_On_Target then
Write_Switch_Char ("fstack-check ", "");
Write_Line ("Generate stack checking code");
OpenPOWER on IntegriCloud