comparison gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
86 86
87 ABSTRACT_STATE ::= name 87 ABSTRACT_STATE ::= name
88 88
89 For the semantics of this pragma, see the entry for aspect ``Abstract_State`` in 89 For the semantics of this pragma, see the entry for aspect ``Abstract_State`` in
90 the SPARK 2014 Reference Manual, section 7.1.4. 90 the SPARK 2014 Reference Manual, section 7.1.4.
91
92 Pragma Acc_Parallel
93 ===================
94 Syntax:
95
96 .. code-block:: ada
97
98 pragma Acc_Parallel [( ACC_PARALLEL_CLAUSE [, ACC_PARALLEL_CLAUSE... ])];
99
100 ACC_PARALLEL_CLAUSE ::=
101 Acc_If => boolean_EXPRESSION
102 | Acc_Private => IDENTIFIERS
103 | Async => integer_EXPRESSION
104 | Copy => IDENTIFIERS
105 | Copy_In => IDENTIFIERS
106 | Copy_Out => IDENTIFIERS
107 | Create => IDENTIFIERS
108 | Default => None
109 | Device_Ptr => IDENTIFIERS
110 | First_Private => IDENTIFIERS
111 | Num_Gangs => integer_EXPRESSION
112 | Num_Workers => integer_EXPRESSION
113 | Present => IDENTIFIERS
114 | Reduction => (REDUCTION_RECORD)
115 | Vector_Length => integer_EXPRESSION
116 | Wait => INTEGERS
117
118 REDUCTION_RECORD ::=
119 "+" => IDENTIFIERS
120 | "*" => IDENTIFIERS
121 | "min" => IDENTIFIERS
122 | "max" => IDENTIFIERS
123 | "or" => IDENTIFIERS
124 | "and" => IDENTIFIERS
125
126 IDENTIFIERS ::=
127 | IDENTIFIER
128 | (IDENTIFIER, IDENTIFIERS)
129
130 INTEGERS ::=
131 | integer_EXPRESSION
132 | (integer_EXPRESSION, INTEGERS)
133
134 Requires the :switch:`-fopenacc` flag.
135
136 Equivalent to the ``parallel`` directive of the OpenAcc standard. This pragma
137 should be placed in loops. It offloads the content of the loop to an
138 accelerator device.
139
140 For more information about the effect of the clauses, see the OpenAcc
141 specification.
142
143 Pragma Acc_Loop
144 ===============
145 Syntax:
146
147 .. code-block:: ada
148
149 pragma Acc_Loop [( ACC_LOOP_CLAUSE [, ACC_LOOP_CLAUSE... ])];
150
151 ACC_LOOP_CLAUSE ::=
152 Auto
153 | Collapse => INTEGER_LITERAL
154 | Gang [=> GANG_ARG]
155 | Independent
156 | Private => IDENTIFIERS
157 | Reduction => (REDUCTION_RECORD)
158 | Seq
159 | Tile => SIZE_EXPRESSION
160 | Vector [=> integer_EXPRESSION]
161 | Worker [=> integer_EXPRESSION]
162
163 GANG_ARG ::=
164 integer_EXPRESSION
165 | Static => SIZE_EXPRESSION
166
167 SIZE_EXPRESSION ::=
168 *
169 | integer_EXPRESSION
170
171 Requires the :switch:`-fopenacc` flag.
172
173 Equivalent to the ``loop`` directive of the OpenAcc standard. This pragma
174 should be placed in for loops after the "Acc_Parallel" pragma. It tells the
175 compiler how to parallelize the loop.
176
177 For more information about the effect of the clauses, see the OpenAcc
178 specification.
179
180 Pragma Acc_Kernels
181 ==================
182 Syntax:
183
184 .. code-block:: ada
185
186 pragma Acc_Kernels [( ACC_KERNELS_CLAUSE [, ACC_KERNELS_CLAUSE...])];
187
188 ACC_KERNELS_CLAUSE ::=
189 Acc_If => boolean_EXPRESSION
190 | Async => integer_EXPRESSION
191 | Copy => IDENTIFIERS
192 | Copy_In => IDENTIFIERS
193 | Copy_Out => IDENTIFIERS
194 | Create => IDENTIFIERS
195 | Default => None
196 | Device_Ptr => IDENTIFIERS
197 | Num_Gangs => integer_EXPRESSION
198 | Num_Workers => integer_EXPRESSION
199 | Present => IDENTIFIERS
200 | Vector_Length => integer_EXPRESSION
201 | Wait => INTEGERS
202
203 IDENTIFIERS ::=
204 | IDENTIFIER
205 | (IDENTIFIER, IDENTIFIERS)
206
207 INTEGERS ::=
208 | integer_EXPRESSION
209 | (integer_EXPRESSION, INTEGERS)
210
211 Requires the :switch:`-fopenacc` flag.
212
213 Equivalent to the kernels directive of the OpenAcc standard. This pragma should
214 be placed in loops.
215
216 For more information about the effect of the clauses, see the OpenAcc
217 specification.
218
219 Pragma Acc_Data
220 ===============
221 Syntax:
222
223 .. code-block:: ada
224
225 pragma Acc_Data ([ ACC_DATA_CLAUSE [, ACC_DATA_CLAUSE...]]);
226
227 ACC_DATA_CLAUSE ::=
228 Copy => IDENTIFIERS
229 | Copy_In => IDENTIFIERS
230 | Copy_Out => IDENTIFIERS
231 | Create => IDENTIFIERS
232 | Device_Ptr => IDENTIFIERS
233 | Present => IDENTIFIERS
234
235 Requires the :switch:`-fopenacc` flag.
236
237 Equivalent to the ``data`` directive of the OpenAcc standard. This pragma
238 should be placed in loops.
239
240 For more information about the effect of the clauses, see the OpenAcc
241 specification.
242
91 243
92 Pragma Ada_83 244 Pragma Ada_83
93 ============= 245 =============
94 246
95 Syntax: 247 Syntax:
394 Pragma Assertion_Policy 546 Pragma Assertion_Policy
395 ======================= 547 =======================
396 548
397 Syntax:: 549 Syntax::
398 550
399 pragma Assertion_Policy (CHECK | DISABLE | IGNORE); 551 pragma Assertion_Policy (CHECK | DISABLE | IGNORE | SUPPRESSIBLE);
400 552
401 pragma Assertion_Policy ( 553 pragma Assertion_Policy (
402 ASSERTION_KIND => POLICY_IDENTIFIER 554 ASSERTION_KIND => POLICY_IDENTIFIER
403 {, ASSERTION_KIND => POLICY_IDENTIFIER}); 555 {, ASSERTION_KIND => POLICY_IDENTIFIER});
404 556
417 ID_ASSERTION_KIND ::= Assertions | 569 ID_ASSERTION_KIND ::= Assertions |
418 Assert_And_Cut | 570 Assert_And_Cut |
419 Assume | 571 Assume |
420 Contract_Cases | 572 Contract_Cases |
421 Debug | 573 Debug |
574 Ghost |
422 Invariant | 575 Invariant |
423 Invariant'Class | 576 Invariant'Class |
424 Loop_Invariant | 577 Loop_Invariant |
425 Loop_Variant | 578 Loop_Variant |
426 Postcondition | 579 Postcondition |
1170 pragma Precondition ((C1 and not C2) or (C2 and not C1)); 1323 pragma Precondition ((C1 and not C2) or (C2 and not C1));
1171 pragma Postcondition (if C1 then Pred1); 1324 pragma Postcondition (if C1 then Pred1);
1172 pragma Postcondition (if C2 then Pred2); 1325 pragma Postcondition (if C2 then Pred2);
1173 1326
1174 1327
1175 The precondition ensures that one and only one of the conditions is 1328 The precondition ensures that one and only one of the case guards is
1176 satisfied on entry to the subprogram. 1329 satisfied on entry to the subprogram.
1177 The postcondition ensures that for the condition that was True on entry, 1330 The postcondition ensures that for the case guard that was True on entry,
1178 the corrresponding consequence is True on exit. Other consequence expressions 1331 the corrresponding consequence is True on exit. Other consequence expressions
1179 are not evaluated. 1332 are not evaluated.
1180 1333
1181 A precondition ``P`` and postcondition ``Q`` can also be 1334 A precondition ``P`` and postcondition ``Q`` can also be
1182 expressed as contract cases: 1335 expressed as contract cases:
1187 1340
1188 1341
1189 The placement and visibility rules for ``Contract_Cases`` pragmas are 1342 The placement and visibility rules for ``Contract_Cases`` pragmas are
1190 identical to those described for preconditions and postconditions. 1343 identical to those described for preconditions and postconditions.
1191 1344
1192 The compiler checks that boolean expressions given in conditions and 1345 The compiler checks that boolean expressions given in case guards and
1193 consequences are valid, where the rules for conditions are the same as 1346 consequences are valid, where the rules for case guards are the same as
1194 the rule for an expression in ``Precondition`` and the rules for 1347 the rule for an expression in ``Precondition`` and the rules for
1195 consequences are the same as the rule for an expression in 1348 consequences are the same as the rule for an expression in
1196 ``Postcondition``. In particular, attributes ``'Old`` and 1349 ``Postcondition``. In particular, attributes ``'Old`` and
1197 ``'Result`` can only be used within consequence expressions. 1350 ``'Result`` can only be used within consequence expressions.
1198 The condition for the last contract case may be ``others``, to denote 1351 The case guard for the last contract case may be ``others``, to denote
1199 any case not captured by the previous cases. The 1352 any case not captured by the previous cases. The
1200 following is an example of use within a package spec: 1353 following is an example of use within a package spec:
1201 1354
1202 1355
1203 .. code-block:: ada 1356 .. code-block:: ada
1211 ... 1364 ...
1212 end Math_Functions; 1365 end Math_Functions;
1213 1366
1214 1367
1215 The meaning of contract cases is that only one case should apply at each 1368 The meaning of contract cases is that only one case should apply at each
1216 call, as determined by the corresponding condition evaluating to True, 1369 call, as determined by the corresponding case guard evaluating to True,
1217 and that the consequence for this case should hold when the subprogram 1370 and that the consequence for this case should hold when the subprogram
1218 returns. 1371 returns.
1219 1372
1220 Pragma Convention_Identifier 1373 Pragma Convention_Identifier
1221 ============================ 1374 ============================
1675 .. code-block:: ada 1828 .. code-block:: ada
1676 1829
1677 pragma Elaboration_Checks (Dynamic | Static); 1830 pragma Elaboration_Checks (Dynamic | Static);
1678 1831
1679 1832
1680 This is a configuration pragma that provides control over the 1833 This is a configuration pragma which specifies the elaboration model to be
1681 elaboration model used by the compilation affected by the 1834 used during compilation. For more information on the elaboration models of
1682 pragma. If the parameter is ``Dynamic``, 1835 GNAT, consult the chapter on elaboration order handling in the *GNAT User's
1683 then the dynamic elaboration 1836 Guide*.
1684 model described in the Ada Reference Manual is used, as though 1837
1685 the *-gnatE* switch had been specified on the command 1838 The pragma may appear in the following contexts:
1686 line. If the parameter is ``Static``, then the default GNAT static 1839
1687 model is used. This configuration pragma overrides the setting 1840 * Configuration pragmas file
1688 of the command line. For full details on the elaboration models 1841
1689 used by the GNAT compiler, see the chapter on elaboration order handling 1842 * Prior to the context clauses of a compilation unit's initial declaration
1690 in the *GNAT User's Guide*. 1843
1691 1844 Any other placement of the pragma will result in a warning and the effects of
1845 the offending pragma will be ignored.
1846
1847 If the pragma argument is ``Dynamic``, then the dynamic elaboration model is in
1848 effect. If the pragma argument is ``Static``, then the static elaboration model
1849 is in effect.
1692 1850
1693 Pragma Eliminate 1851 Pragma Eliminate
1694 ================ 1852 ================
1695 .. index:: Elimination of unused subprograms 1853 .. index:: Elimination of unused subprograms
1696 1854
3884 Once the pragma has been given for a particular root tagged type, all subtypes 4042 Once the pragma has been given for a particular root tagged type, all subtypes
3885 and derived types of this type inherit the pragma automatically, so the effect 4043 and derived types of this type inherit the pragma automatically, so the effect
3886 applies to a complete hierarchy (this is necessary to deal with the class-wide 4044 applies to a complete hierarchy (this is necessary to deal with the class-wide
3887 dispatching versions of the stream routines). 4045 dispatching versions of the stream routines).
3888 4046
4047 When pragmas ``Discard_Names`` and ``No_Tagged_Streams`` are simultaneously
4048 applied to a tagged type its Expanded_Name and External_Tag are initialized
4049 with empty strings. This is useful to avoid exposing entity names at binary
4050 level but has a negative impact on the debuggability of tagged types.
4051
3889 Pragma Normalize_Scalars 4052 Pragma Normalize_Scalars
3890 ======================== 4053 ========================
3891 4054
3892 Syntax: 4055 Syntax:
3893 4056
6600 6763
6601 6764
6602 This pragma specifies that the specified entity, which must be 6765 This pragma specifies that the specified entity, which must be
6603 a variable declared in a library-level package, is to be marked as 6766 a variable declared in a library-level package, is to be marked as
6604 "Thread Local Storage" (``TLS``). On systems supporting this (which 6767 "Thread Local Storage" (``TLS``). On systems supporting this (which
6605 include Windows, Solaris, GNU/Linux and VxWorks 6), this causes each 6768 include Windows, Solaris, GNU/Linux, and VxWorks 6), this causes each
6606 thread (and hence each Ada task) to see a distinct copy of the variable. 6769 thread (and hence each Ada task) to see a distinct copy of the variable.
6607 6770
6608 The variable may not have default initialization, and if there is 6771 The variable must not have default initialization, and if there is
6609 an explicit initialization, it must be either ``null`` for an 6772 an explicit initialization, it must be either ``null`` for an
6610 access variable, or a static expression for a scalar variable. 6773 access variable, a static expression for a scalar variable, or a fully
6611 This provides a low level mechanism similar to that provided by 6774 static aggregate for a composite type, that is to say, an aggregate all
6775 of whose components are static, and which does not include packed or
6776 discriminated components.
6777
6778 This provides a low-level mechanism similar to that provided by
6612 the ``Ada.Task_Attributes`` package, but much more efficient 6779 the ``Ada.Task_Attributes`` package, but much more efficient
6613 and is also useful in writing interface code that will interact 6780 and is also useful in writing interface code that will interact
6614 with foreign threads. 6781 with foreign threads.
6615 6782
6616 If this pragma is used on a system where ``TLS`` is not supported, 6783 If this pragma is used on a system where ``TLS`` is not supported,
7443 7610
7444 In this usage, the pattern string must match in the Off and On 7611 In this usage, the pattern string must match in the Off and On
7445 pragmas, and (if *-gnatw.w* is given) at least one matching 7612 pragmas, and (if *-gnatw.w* is given) at least one matching
7446 warning must be suppressed. 7613 warning must be suppressed.
7447 7614
7615 Note: if the ON form is not found, then the effect of the OFF form extends
7616 until the end of the file (pragma Warnings is purely textual, so its effect
7617 does not stop at the end of the enclosing scope).
7618
7448 Note: to write a string that will match any warning, use the string 7619 Note: to write a string that will match any warning, use the string
7449 ``"***"``. It will not work to use a single asterisk or two 7620 ``"***"``. It will not work to use a single asterisk or two
7450 asterisks since this looks like an operator name. This form with three 7621 asterisks since this looks like an operator name. This form with three
7451 asterisks is similar in effect to specifying ``pragma Warnings (Off)`` except (if :switch:`-gnatw.w` is given) that a matching 7622 asterisks is similar in effect to specifying ``pragma Warnings (Off)`` except (if :switch:`-gnatw.w` is given) that a matching
7452 ``pragma Warnings (On, "***")`` will be required. This can be 7623 ``pragma Warnings (On, "***")`` will be required. This can be