Commit 056b0f6f by Arnaud Charlet

[multiple changes]

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.

From-SVN: r150147
parent 5391897d
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> 2009-07-28 Olivier Hainque <hainque@adacore.com>
* g-ssinty.ads: Remove, pointless and just confusing at this stage. * g-ssinty.ads: Remove, pointless and just confusing at this stage.
......
...@@ -1664,7 +1664,8 @@ package body GNAT.Sockets is ...@@ -1664,7 +1664,8 @@ package body GNAT.Sockets is
(Msg_Name => System.Null_Address, (Msg_Name => System.Null_Address,
Msg_Namelen => 0, Msg_Namelen => 0,
Msg_Iov => Vector'Address, 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_Control => System.Null_Address,
Msg_Controllen => 0, Msg_Controllen => 0,
Msg_Flags => 0); Msg_Flags => 0);
......
...@@ -490,6 +490,7 @@ Verifying Properties Using gnatcheck ...@@ -490,6 +490,7 @@ Verifying Properties Using gnatcheck
* gnatcheck Rule Options:: * gnatcheck Rule Options::
* Adding the Results of Compiler Checks to gnatcheck Output:: * Adding the Results of Compiler Checks to gnatcheck Output::
* Project-Wide Checks:: * Project-Wide Checks::
* Rule exemption::
* Predefined Rules:: * Predefined Rules::
Sample Bodies Using gnatstub Sample Bodies Using gnatstub
...@@ -20696,6 +20697,7 @@ Either a @file{@var{filename}} or an @file{@var{arg_list_filename}} must be supp ...@@ -20696,6 +20697,7 @@ Either a @file{@var{filename}} or an @file{@var{arg_list_filename}} must be supp
* gnatcheck Rule Options:: * gnatcheck Rule Options::
* Adding the Results of Compiler Checks to gnatcheck Output:: * Adding the Results of Compiler Checks to gnatcheck Output::
* Project-Wide Checks:: * Project-Wide Checks::
* Rule exemption::
* Predefined Rules:: * Predefined Rules::
@end menu @end menu
...@@ -20946,6 +20948,108 @@ the @option{-U} option followed by the name of the main unit: ...@@ -20946,6 +20948,108 @@ the @option{-U} option followed by the name of the main unit:
@end smallexample @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 @node Predefined Rules
@section Predefined Rules @section Predefined Rules
@cindex Predefined rules (for @command{gnatcheck}) @cindex Predefined rules (for @command{gnatcheck})
...@@ -21222,7 +21326,7 @@ conditions is met: ...@@ -21222,7 +21326,7 @@ conditions is met:
@itemize @bullet @itemize @bullet
@item @item
it contains at least one complex declaration such as a subprogram body, 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}); (except instantiation of @code{Ada.Unchecked_Conversion});
@item @item
...@@ -4772,6 +4772,11 @@ package body Make is ...@@ -4772,6 +4772,11 @@ package body Make is
Exit_Program (E_Success); Exit_Program (E_Success);
else 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 -- Output usage information if no files to compile
Usage; Usage;
......
...@@ -78,6 +78,11 @@ pragma Style_Checks ("M32766"); ...@@ -78,6 +78,11 @@ pragma Style_Checks ("M32766");
** $ RUN xoscons ** $ 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 <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
......
...@@ -91,9 +91,9 @@ begin ...@@ -91,9 +91,9 @@ begin
Write_Eol; 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_Switch_Char ("fstack-check ", "");
Write_Line ("Generate stack checking code"); Write_Line ("Generate stack checking code");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment