Commit a5b2e440 by Yannick Moy Committed by Pierre-Marie de Rodat

[Ada] Update description of restriction SPARK_05 with SPARK 2014

2018-01-11  Yannick Moy  <moy@adacore.com>

gcc/ada/

	* doc/gnat_rm/standard_and_implementation_defined_restrictions.rst:
	Update description of restriction SPARK_05 with SPARK 2014.
	* gnat_rm.texi: Regenerate.

From-SVN: r256498
parent 151af7d2
2018-01-11 Yannick Moy <moy@adacore.com>
* doc/gnat_rm/standard_and_implementation_defined_restrictions.rst:
Update description of restriction SPARK_05 with SPARK 2014.
* gnat_rm.texi: Regenerate.
2018-01-11 Vasiliy Fofanov <fofanov@adacore.com> 2018-01-11 Vasiliy Fofanov <fofanov@adacore.com>
* doc/gnat_ugn/gnat_utility_programs.rst: Fix layout. * doc/gnat_ugn/gnat_utility_programs.rst: Fix layout.
......
...@@ -999,23 +999,32 @@ SPARK_05 ...@@ -999,23 +999,32 @@ SPARK_05
-------- --------
.. index:: SPARK_05 .. index:: SPARK_05
[GNAT] This restriction checks at compile time that some constructs [GNAT] This restriction checks at compile time that some constructs forbidden
forbidden in SPARK 2005 are not present. Error messages related to in SPARK 2005 are not present. Note that SPARK 2005 has been superseded by
SPARK restriction have the form: SPARK 2014, whose restrictions are checked by the tool GNATprove. To check that
a codebase respects SPARK 2014 restrictions, mark the code with pragma or
aspect ``SPARK_Mode``, and run the tool GNATprove at Stone assurance level, as
follows::
gnatprove -P project.gpr --mode=stone
or equivalently::
gnatprove -P project.gpr --mode=check_all
With restriction ``SPARK_05``, error messages related to SPARK 2005 restriction
have the form:
:: ::
violation of restriction "SPARK_05" at <source-location> violation of restriction "SPARK_05" at <source-location>
<error message> <error message>
.. index:: SPARK .. index:: SPARK
The restriction ``SPARK`` is recognized as a The restriction ``SPARK`` is recognized as a synonym for ``SPARK_05``. This is
synonym for ``SPARK_05``. This is retained for historical retained for historical compatibility purposes (and an unconditional warning
compatibility purposes (and an unconditional warning will be generated will be generated for its use, advising replacement by ``SPARK_05``).
for its use, advising replacement by ``SPARK``).
This is not a replacement for the semantic checks performed by the This is not a replacement for the semantic checks performed by the
SPARK Examiner tool, as the compiler currently only deals with code, SPARK Examiner tool, as the compiler currently only deals with code,
...@@ -1023,13 +1032,13 @@ not SPARK 2005 annotations, and does not guarantee catching all ...@@ -1023,13 +1032,13 @@ not SPARK 2005 annotations, and does not guarantee catching all
cases of constructs forbidden by SPARK 2005. cases of constructs forbidden by SPARK 2005.
Thus it may well be the case that code which passes the compiler with Thus it may well be the case that code which passes the compiler with
the SPARK restriction is rejected by the SPARK Examiner, e.g. due to the SPARK 2005 restriction is rejected by the SPARK Examiner, e.g. due to
the different visibility rules of the Examiner based on SPARK 2005 the different visibility rules of the Examiner based on SPARK 2005
``inherit`` annotations. ``inherit`` annotations.
This restriction can be useful in providing an initial filter for code This restriction can be useful in providing an initial filter for code
developed using SPARK 2005, or in examining legacy code to see how far developed using SPARK 2005, or in examining legacy code to see how far
it is from meeting SPARK restrictions. it is from meeting SPARK 2005 restrictions.
The list below summarizes the checks that are performed when this The list below summarizes the checks that are performed when this
restriction is in force: restriction is in force:
...@@ -1084,7 +1093,7 @@ restriction is in force: ...@@ -1084,7 +1093,7 @@ restriction is in force:
* Subprogram declaration only allowed in package spec (unless followed by import) * Subprogram declaration only allowed in package spec (unless followed by import)
* Access types not allowed * Access types not allowed
* Incomplete type declaration not allowed * Incomplete type declaration not allowed
* Object and subtype declarations must respect SPARK restrictions * Object and subtype declarations must respect SPARK 2005 restrictions
* Digits or delta constraint not allowed * Digits or delta constraint not allowed
* Decimal fixed point type not allowed * Decimal fixed point type not allowed
* Aliasing of objects not allowed * Aliasing of objects not allowed
...@@ -1093,7 +1102,7 @@ restriction is in force: ...@@ -1093,7 +1102,7 @@ restriction is in force:
* Unary operators not allowed on modular types (except not) * Unary operators not allowed on modular types (except not)
* Untagged record cannot be null * Untagged record cannot be null
* No class-wide operations * No class-wide operations
* Initialization expressions must respect SPARK restrictions * Initialization expressions must respect SPARK 2005 restrictions
* Nonstatic ranges not allowed except in iteration schemes * Nonstatic ranges not allowed except in iteration schemes
* String subtypes must have lower bound of 1 * String subtypes must have lower bound of 1
* Subtype of Boolean cannot have constraint * Subtype of Boolean cannot have constraint
...@@ -1117,7 +1126,7 @@ strict that the latest SPARK 2005 language definition: ...@@ -1117,7 +1126,7 @@ strict that the latest SPARK 2005 language definition:
This list summarises the main SPARK 2005 language rules that are not This list summarises the main SPARK 2005 language rules that are not
currently checked by the SPARK_05 restriction: currently checked by the SPARK_05 restriction:
* SPARK annotations are treated as comments so are not checked at all * SPARK 2005 annotations are treated as comments so are not checked at all
* Based real literals not allowed * Based real literals not allowed
* Objects cannot be initialized at declaration by calls to user-defined functions * Objects cannot be initialized at declaration by calls to user-defined functions
* Objects cannot be initialized at declaration by assignments from variables * Objects cannot be initialized at declaration by assignments from variables
...@@ -1142,6 +1151,6 @@ currently checked by the SPARK_05 restriction: ...@@ -1142,6 +1151,6 @@ currently checked by the SPARK_05 restriction:
* Pragma import must be immediately after entity it names * Pragma import must be immediately after entity it names
* No mutual recursion between multiple units (this can be checked with gnatcheck) * No mutual recursion between multiple units (this can be checked with gnatcheck)
Note that if a unit is compiled in Ada 95 mode with the SPARK restriction, Note that if a unit is compiled in Ada 95 mode with the SPARK 2005 restriction,
violations will be reported for constructs forbidden in SPARK 95, violations will be reported for constructs forbidden in SPARK 95,
instead of SPARK 2005. instead of SPARK 2005.
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
@copying @copying
@quotation @quotation
GNAT Reference Manual , Dec 15, 2017 GNAT Reference Manual , Jan 10, 2018
AdaCore AdaCore
...@@ -13152,9 +13152,25 @@ associated with dispatch tables can be placed in read-only memory. ...@@ -13152,9 +13152,25 @@ associated with dispatch tables can be placed in read-only memory.
@geindex SPARK_05 @geindex SPARK_05
[GNAT] This restriction checks at compile time that some constructs [GNAT] This restriction checks at compile time that some constructs forbidden
forbidden in SPARK 2005 are not present. Error messages related to in SPARK 2005 are not present. Note that SPARK 2005 has been superseded by
SPARK restriction have the form: SPARK 2014, whose restrictions are checked by the tool GNATprove. To check that
a codebase respects SPARK 2014 restrictions, mark the code with pragma or
aspect @code{SPARK_Mode}, and run the tool GNATprove at Stone assurance level, as
follows:
@example
gnatprove -P project.gpr --mode=stone
@end example
or equivalently:
@example
gnatprove -P project.gpr --mode=check_all
@end example
With restriction @code{SPARK_05}, error messages related to SPARK 2005 restriction
have the form:
@example @example
violation of restriction "SPARK_05" at <source-location> violation of restriction "SPARK_05" at <source-location>
...@@ -13163,10 +13179,9 @@ violation of restriction "SPARK_05" at <source-location> ...@@ -13163,10 +13179,9 @@ violation of restriction "SPARK_05" at <source-location>
@geindex SPARK @geindex SPARK
The restriction @code{SPARK} is recognized as a The restriction @code{SPARK} is recognized as a synonym for @code{SPARK_05}. This is
synonym for @code{SPARK_05}. This is retained for historical retained for historical compatibility purposes (and an unconditional warning
compatibility purposes (and an unconditional warning will be generated will be generated for its use, advising replacement by @code{SPARK_05}).
for its use, advising replacement by @code{SPARK}).
This is not a replacement for the semantic checks performed by the This is not a replacement for the semantic checks performed by the
SPARK Examiner tool, as the compiler currently only deals with code, SPARK Examiner tool, as the compiler currently only deals with code,
...@@ -13174,13 +13189,13 @@ not SPARK 2005 annotations, and does not guarantee catching all ...@@ -13174,13 +13189,13 @@ not SPARK 2005 annotations, and does not guarantee catching all
cases of constructs forbidden by SPARK 2005. cases of constructs forbidden by SPARK 2005.
Thus it may well be the case that code which passes the compiler with Thus it may well be the case that code which passes the compiler with
the SPARK restriction is rejected by the SPARK Examiner, e.g. due to the SPARK 2005 restriction is rejected by the SPARK Examiner, e.g. due to
the different visibility rules of the Examiner based on SPARK 2005 the different visibility rules of the Examiner based on SPARK 2005
@code{inherit} annotations. @code{inherit} annotations.
This restriction can be useful in providing an initial filter for code This restriction can be useful in providing an initial filter for code
developed using SPARK 2005, or in examining legacy code to see how far developed using SPARK 2005, or in examining legacy code to see how far
it is from meeting SPARK restrictions. it is from meeting SPARK 2005 restrictions.
The list below summarizes the checks that are performed when this The list below summarizes the checks that are performed when this
restriction is in force: restriction is in force:
...@@ -13339,7 +13354,7 @@ Access types not allowed ...@@ -13339,7 +13354,7 @@ Access types not allowed
Incomplete type declaration not allowed Incomplete type declaration not allowed
@item @item
Object and subtype declarations must respect SPARK restrictions Object and subtype declarations must respect SPARK 2005 restrictions
@item @item
Digits or delta constraint not allowed Digits or delta constraint not allowed
...@@ -13366,7 +13381,7 @@ Untagged record cannot be null ...@@ -13366,7 +13381,7 @@ Untagged record cannot be null
No class-wide operations No class-wide operations
@item @item
Initialization expressions must respect SPARK restrictions Initialization expressions must respect SPARK 2005 restrictions
@item @item
Nonstatic ranges not allowed except in iteration schemes Nonstatic ranges not allowed except in iteration schemes
...@@ -13428,7 +13443,7 @@ currently checked by the SPARK_05 restriction: ...@@ -13428,7 +13443,7 @@ currently checked by the SPARK_05 restriction:
@itemize * @itemize *
@item @item
SPARK annotations are treated as comments so are not checked at all SPARK 2005 annotations are treated as comments so are not checked at all
@item @item
Based real literals not allowed Based real literals not allowed
...@@ -13500,7 +13515,7 @@ Pragma import must be immediately after entity it names ...@@ -13500,7 +13515,7 @@ Pragma import must be immediately after entity it names
No mutual recursion between multiple units (this can be checked with gnatcheck) No mutual recursion between multiple units (this can be checked with gnatcheck)
@end itemize @end itemize
Note that if a unit is compiled in Ada 95 mode with the SPARK restriction, Note that if a unit is compiled in Ada 95 mode with the SPARK 2005 restriction,
violations will be reported for constructs forbidden in SPARK 95, violations will be reported for constructs forbidden in SPARK 95,
instead of SPARK 2005. instead of SPARK 2005.
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