1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
|
<!-- Crown Copyright (c) 1998 -->
<HTML>
<HEAD>
<TITLE>
C++ Producer Guide: #pragma directive syntax
</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#400080" ALINK="#FF0000">
<H1>C++ Producer Guide</H1>
<H3>March 1998</H3>
<A HREF="dump1.html"><IMG SRC="../images/next.gif" ALT="next section"></A>
<A HREF="tdf.html"><IMG SRC="../images/prev.gif" ALT="previous section"></A>
<A HREF="index.html"><IMG SRC="../images/top.gif" ALT="current document"></A>
<A HREF="../index.html"><IMG SRC="../images/home.gif" ALT="TenDRA home page">
</A>
<IMG SRC="../images/no_index.gif" ALT="document index"><P>
<HR>
<H1>Annex A. <CODE>#pragma</CODE> directive syntax</H1>
<P>
The following gives a summary of the syntax for the <CODE>#pragma</CODE>
directives used for <A HREF="pragma.html">compiler configuration</A>
and <A HREF="token.html">token specification</A>:
<PRE>
<HR>
<I>pragma-directive</I> :
<A HREF="#tendra"># pragma TenDRA ++<I><SUB>opt</SUB> tendra-directive</I></A>
<A HREF="#token"># pragma <I>token-directive</I></A>
<A NAME="tendra"><I>tendra-directive</I></A> :
<A HREF="#scope"><I>scope-directive</I></A>
<A HREF="#low"><I>low-level-directive</I></A>
<A HREF="#analysis"><I>analysis-directive on</I></A>
<A HREF="#check"><I>check-directive allow</I></A>
<A HREF="#keyword"><I>keyword-directive</I></A>
<A HREF="#type"><I>type-directive</I></A>
<A HREF="#linkage"><I>linkage-directive</I></A>
<A HREF="#misc"><I>misc-directive</I></A>
<A HREF="#token1"><I>tendra-token-directive</I></A>
<I>on</I> :
on
warning
off
<I>allow</I> :
allow
warning
disallow
<HR>
<A NAME="scope"><I>scope-directive</I></A> :
<A HREF="pragma.html#scope">begin</A>
<A HREF="pragma.html#scope">begin name environment <I>identifier</I></A>
<A HREF="pragma.html#scope">end</A>
<A HREF="pragma.html#scope">directory <I>identifier</I> use environment <I>identifier</I></A>
<A HREF="pragma.html#scope">use environment <I>identifier</I></A>
<A HREF="pragma.html#scope">use environment <I>identifier</I> reset <I>allow</I></A>
<HR>
<A NAME="low"><I>low-level-directive</I></A> :
<A HREF="pragma.html#low">error <I>string-literal allow</I></A>
<A HREF="pragma.html#low">error <I>string-literal on</I></A>
<A HREF="pragma.html#low">error <I>string-literal</I> as option <I>string-literal</I></A>
<A HREF="pragma.html#low">option <I>string-literal allow</I></A>
<A HREF="pragma.html#low">option <I>string-literal on</I></A>
<A HREF="pragma.html#limits">option value <I>string-literal integer-literal</I></A>
<A HREF="pragma.html#low">use error <I>string-literal</I></A>
<HR>
<A NAME="analysis"><I>analysis-directive</I></A> :
<A HREF="pragma.html#init">complete initialization analysis</A>
<A HREF="pragma.html#elab">complete struct / union analysis</A>
<A HREF="pragma.html#conv">conversion analysis <I>conversion-spec<SUB>opt</SUB></I></A>
<A HREF="pragma.html#discard">discard analysis <I>discard-spec<SUB>opt</SUB></I></A>
<A HREF="pragma.html#switch">enum switch analysis</A>
<A HREF="pragma.html#linkage">external function linkage</A>
<A HREF="pragma.html#for">for initialization block</A>
<A HREF="pragma.html#elab">ignore struct / union / enum tag</A>
<A HREF="pragma.html#template">implicit export template</A>
<A HREF="pragma.html#impl_func">implicit function declaration</A>
<A HREF="pragma.html#exp">integer operator analysis</A>
<A HREF="pragma.html#exp">integer overflow analysis</A>
<A HREF="pragma.html#comment">nested comment analysis</A>
<A HREF="pragma.html#exp">operator precedence analysis</A>
<A HREF="pragma.html#exp">pointer operator analysis</A>
<A HREF="pragma.html#throw">throw analysis</A>
<A HREF="pragma.html#linkage">unify external linkage</A>
<A HREF="pragma.html#variable">variable analysis</A>
<A HREF="pragma.html#hide">variable hiding analysis</A>
<A HREF="pragma.html#weak">weak prototype analysis</A>
<I>conversion-spec</I> :
( int - int <I>implicit-spec<SUB>opt</SUB></I> )
( int - pointer <I>implicit-spec<SUB>opt</SUB></I> )
( pointer - int <I>implicit-spec<SUB>opt</SUB></I> )
( pointer - pointer <I>implicit-spec<SUB>opt</SUB></I> )
( int - enum implicit )
( pointer - void * implicit )
( void * - pointer implicit )
<I>implicit-spec</I> :
implicit
explicit
<I>discard-spec</I> :
( function return )
( static )
( value )
<HR>
<A NAME="check"><I>check-directive</I></A> :
<A HREF="pragma.html#overload">ambiguous overload resolution</A>
<A HREF="pragma.html#if">assignment as bool</A>
<A HREF="pragma.html#bitfield">bitfield overflow</A>
<A HREF="pragma.html#linkage">block function static</A>
<A HREF="pragma.html#catch_all">catch all</A>
<A HREF="pragma.html#escape">character escape overflow</A>
<A HREF="token.html#tokdef">compatible token</A>
<A HREF="pragma.html#include">complete file includes</A>
<A HREF="pragma.html#target-if">conditional declaration</A>
<A HREF="pragma.html#lvalue">conditional lvalue</A>
<A HREF="pragma.html#overload">conditional overload resolution <I>overload-spec<SUB>opt</SUB></I></A>
<A HREF="pragma.html#if">const conditional</A>
<A HREF="pragma.html#macro">directive as macro argument</A>
<A HREF="pragma.html#identifier">dollar as ident</A>
<A HREF="pragma.html#elab">extra ,</A>
<A HREF="pragma.html#decl_none">extra ;</A>
<A HREF="pragma.html#if">extra ; after conditional</A>
<A HREF="pragma.html#weak">extra ...</A>
<A HREF="pragma.html#bitfield">extra bitfield int type</A>
<A HREF="pragma.html#macro">extra macro definition</A>
<A HREF="pragma.html#typedef">extra type definition</A>
<A HREF="pragma.html#switch">fall into case</A>
<A HREF="pragma.html#elab">forward enum declaration</A>
<A HREF="pragma.html#conv">function pointer as pointer</A>
<A HREF="pragma.html#ellipsis">ident ...</A>
<A HREF="pragma.html#implicit">implicit int type <I>inttype-spec<SUB>opt</SUB></I></A>
<A HREF="token.html#tokdef">implicit token definition</A>
<A HREF="token.html#spec">incompatible interface declaration</A>
<A HREF="token.html#member">incompatible member declaration</A>
<A HREF="pragma.html#linkage">incompatible linkage</A>
<A HREF="pragma.html#weak">incompatible promoted function argument</A>
<A HREF="pragma.html#compatible">incompatible type qualifier</A>
<A HREF="pragma.html#return">incompatible void return</A>
<A HREF="pragma.html#complete">incomplete type as object type</A>
<A HREF="pragma.html#ppdir">indented # directive</A>
<A HREF="pragma.html#ppdir">indented directive after #</A>
<A HREF="pragma.html#init">initialization of struct / union ( auto )</A>
<A HREF="pragma.html#longlong">longlong type</A>
<A HREF="pragma.html#ppdir">no directive / nline after ident</A>
<A HREF="pragma.html#empty">no external declaration</A>
<A HREF="pragma.html#macro">no ident after #</A>
<A HREF="pragma.html#lex">no nline after file end</A>
<A HREF="token.html#tokdef">no token definition</A>
<A HREF="pragma.html#overload">overload resolution</A>
<A HREF="pragma.html#weak">prototype</A>
<A HREF="pragma.html#weak">prototype ( weak )</A>
<A HREF="token.html#exp">rvalue token as const</A>
<A HREF="pragma.html#ppdir">text after directive</A>
<A HREF="pragma.html#lvalue">this lvalue</A>
<A HREF="pragma.html#string">unify incompatible string literal</A>
<A HREF="pragma.html#ppdir">unknown directive</A>
<A HREF="pragma.html#escape">unknown escape</A>
<A HREF="pragma.html#ppdir">unknown pragma</A>
<A HREF="pragma.html#decl_none">unknown struct / union</A>
<A HREF="pragma.html#string">unmatched quote</A>
<A HREF="pragma.html#reach">unreachable code</A>
<A HREF="pragma.html#init">variable initialization</A>
<A HREF="pragma.html#macro">weak macro equality</A>
<A HREF="pragma.html#string">writeable string literal</A>
<I>inttype-spec</I> :
for const / volatile
for external declaration
for function return
<I>overload-spec</I> :
( complete )
( incomplete )
<HR>
<A NAME="keyword"><I>keyword-directive</I></A> :
<A HREF="#keyword">keyword <I>identifier</I> for <I>keyword-spec</I></A>
<A HREF="pragma.html#keyword-spec">undef keyword <I>identifier</I></A>
<A NAME="keyword-spec"><I>keyword-spec</I></A> :
<A HREF="pragma.html#discard">discard value</A>
<A HREF="pragma.html#variable">discard variable</A>
<A HREF="pragma.html#switch">exhaustive</A>
<A HREF="pragma.html#switch">fall into case</A>
<A HREF="pragma.html#keyword">keyword <I>identifier</I></A>
<A HREF="pragma.html#keyword">operator <I>operator</I></A>
<A HREF="pragma.html#variable">set</A>
<A HREF="pragma.html#reach">set reachable</A>
<A HREF="pragma.html#reach">set unreachable</A>
<A HREF="pragma.html#conv">type representation</A>
<A HREF="pragma.html#weak">weak</A>
<HR>
<A NAME="type"><I>type-directive</I></A> :
<A HREF="pragma.html#reach">bottom <I>identifier</I></A>
<A HREF="pragma.html#char">character <I>character-sign</I></A>
<A HREF="pragma.html#identifier">character <I>character-literal character-mapping</I></A>
<A HREF="pragma.html#identifier">character <I>string-literal character-mapping</I></A>
<A HREF="lib.html#arith">compute promote <I>identifier</I></A>
<A HREF="pragma.html#escape">escape <I>character-literal character-mapping</I></A>
<A HREF="pragma.html#int">integer literal <I>literal-spec</I></A>
<A HREF="lib.html#arith">promoted <I>type-id</I> : <I>type-id</I></A>
<A HREF="pragma.html#char">set character literal : <I>type-id</I></A>
<A HREF="pragma.html#longlong">set longlong type : <I>longlong-spec</I></A>
<A HREF="pragma.html#char">set ptrdiff_t : <I>type-id</I></A>
<A HREF="pragma.html#char">set size_t : <I>type-id</I></A>
<A HREF="pragma.html#char">set wchar_t : <I>type-id</I></A>
<A HREF="pragma.html#string">set string literal : <I>string-const</I></A>
<A HREF="pragma.html#std">set std namespace : <I>scope-name</I></A>
<A HREF="#type-spec">type <I>identifier</I> for <I>type-spec</I></A>
<I>character-sign</I> :
signed
unsigned
either
<I>character-mapping</I> :
as <I>character-literal</I> allow
disallow
<I>literal-spec</I> :
<I>literal-base literal-suffix<SUB>opt</SUB> literal-type-list</I>
<I>literal-base</I> :
decimal
octal
hexadecimal
<I>literal-suffix</I> :
unsigned
long
unsigned long
long long
unsigned long long
<I>literal-type-list</I> :
* <I>literal-type-spec</I>
<I>integer-literal literal-type-spec</I> | <I>literal-type-list</I>
? <I>literal-type-spec</I> | <I>literal-type-list</I>
<I>literal-type-spec</I> :
: <I>type-id</I>
* <I>allow<SUB>opt</SUB></I> : <I>identifier</I>
* * <I>allow<SUB>opt</SUB></I> :
<I>longlong-spec</I> :
long
long long
<I>string-const</I> :
const
no const
<I>scope-name</I> :
<I>identifier</I>
::
<A NAME="type-spec"><I>type-spec</I></A> :
<A HREF="pragma.html#reach">bottom</A>
<A HREF="pragma.html#char">ptrdiff_t</A>
<A HREF="pragma.html#char">size_t</A>
<A HREF="pragma.html#char">wchar_t</A>
<A HREF="pragma.html#printf">... printf</A>
<A HREF="pragma.html#printf">... scanf</A>
<HR>
<A NAME="linkage"><I>linkage-directive</I></A> :
<A HREF="pragma.html#linkage">const linkage <I>linkage</I></A>
<A HREF="pragma.html#linkage">external linkage <I>string-literal</I></A>
<A HREF="pragma.html#linkage">external volatile_t</A>
<A HREF="pragma.html#linkage">inline linkage <I>linkage</I></A>
<A HREF="pragma.html#linkage">linkage resolution : <I>linkage-spec</I></A>
<I>linkage</I> :
external
internal
<I>linkage-spec</I> :
( <I>linkage</I> ) on
( <I>linkage</I> ) warning
off
<HR>
<A NAME="misc"><I>misc-directive</I></A> :
<A HREF="pragma.html#weak">argument <I>type-id</I> as ...</A>
<A HREF="pragma.html#weak">argument <I>type-id</I> as <I>type-id</I></A>
<A HREF="pragma.html#compatible">compatible type : <I>type-id</I> == <I>type-id</I> : <I>allow</I></A>
<A HREF="pragma.html#conv">conversion <I>identifier-list</I> allow</A>
<A HREF="dump.html#scope">declaration block <I>identifier</I> begin</A>
<A HREF="dump.html#scope">declaration block end</A>
<A HREF="pragma.html#ppdir">directive <I>directive-spec directive-state</I></A>
<A HREF="pragma.html#variable">discard <I>expression</I></A>
<A HREF="pragma.html#switch">exhaustive</A>
<A HREF="pragma.html#cast">explicit cast <I>cast-spec<SUB>opt</SUB> allow</I></A>
<A HREF="pragma.html#include">includes depth <I>integer-literal</I></A>
<A HREF="pragma.html#static">preserve <I>preserve-list</I></A>
<A HREF="pragma.html#variable">set <I>expression</I></A>
<A HREF="pragma.html#limits">set error limit <I>integer-literal</I></A>
<A HREF="pragma.html#identifier">set name limit <I>integer-literal</I> warning<I><SUB>opt</SUB></I></A>
<A HREF="pragma.html#discard">suspend static <I>identifier-list</I></A>
<I>directive-spec</I> :
assert
file
ident
import
include_next
unassert
warning
weak
<I>directive-state</I> :
allow
warning
disallow
( ignore ) allow
( ignore ) warning
<I>cast-operator</I> :
static_cast
const_cast
reinterpret_cast
<I>cast-spec</I> :
as <I>cast-operator</I>
<I>cast-spec</I> | <I>cast-operator</I>
<I>preserve-list</I> :
<I>identifier-list</I>
*
<I>identifier-list</I> :
<I>identifier identifier-list<SUB>opt</SUB></I>
<HR>
<A NAME="token"><I>token-directive</I></A> :
<A HREF="token.html#spec">token <I>token-spec</I></A>
<A HREF="token.html#tokdef">no_def <I>token-list</I></A>
<A HREF="token.html#tokdef">define <I>token-list</I></A>
<A HREF="token.html#tokdef">ignore <I>token-list</I></A>
<A HREF="token.html#tokdef">interface <I>token-list</I></A>
<A HREF="token.html#tokdef">undef token <I>token-list</I></A>
<A HREF="token.html#tokdef">extend interface <I>header-name</I></A>
<A HREF="token.html#tokdef">implement interface <I>header-name</I></A>
<A NAME="token1"><I>tendra-token-directive</I></A> :
<A HREF="token.html#spec">token <I>token-spec</I></A>
<A HREF="token.html#tokdef">no_def <I>token-list</I></A>
<A HREF="token.html#tokdef">define <I>token-list</I></A>
<A HREF="token.html#tokdef">reject <I>token-list</I></A>
<A HREF="token.html#tokdef">interface <I>token-list</I></A>
<A HREF="token.html#tokdef">undef token <I>token-list</I></A>
<A HREF="token.html#tokdef">extend <I>header-name</I></A>
<A HREF="token.html#tokdef">implement <I>header-name</I></A>
<A HREF="token.html#tokdef">member definition <I>type-id</I> : <I>identifier member-offset</I></A>
<I>member-offset</I> :
::<I><SUB>opt</SUB> id-expression</I>
<I>member-offset</I> . ::<I><SUB>opt</SUB> id-expression</I>
<I>member-offset</I> [ <I>constant-expression</I> ]
<I>token-list</I> :
<I>token-id token-list<SUB>opt</SUB></I>
# <I>preproc-token-list</I>
<I>token-id</I> :
<I>token-namespace<SUB>opt</SUB> identifier</I>
<I>type-id</I> . <I>identifier</I>
<HR>
<I>token-spec</I> :
<I>token-introduction token-identification</I>
<I>token-introduction</I> :
<I>exp-token</I>
<I>statement-token</I>
<I>type-token</I>
<I>member-token</I>
<I>procedure-token</I>
<I>token-identification</I> :
<I>token-namespace<SUB>opt</SUB> identifier</I> # <I>external-identifier<SUB>opt</SUB></I>
<I>token-namespace</I> :
TAG
<I>external-identifier</I> :
-
<I>preproc-token-list</I>
<I>exp-token</I> :
EXP <I>exp-storage<SUB>opt</SUB></I> : <I>type-id</I> :
NAT
INTEGER
<I>exp-storage</I> :
lvalue
rvalue
const
<I>statement-token</I> :
STATEMENT
<I>type-token</I> :
TYPE
VARIETY
VARIETY signed
VARIETY unsigned
FLOAT
ARITHMETIC
SCALAR
CLASS
STRUCT
UNION
<I>member-token</I> :
MEMBER <I>access-specifier<SUB>opt</SUB> member-type-id</I> : <I>type-id</I> :
<I>member-type-id</I> :
<I>type-id</I>
<I>type-id</I> % <I>constant-expression</I>
<I>access-specifier</I> :
public
protected
private
<I>procedure-token</I> :
<I>general-procedure</I>
<I>simple-procedure</I>
<I>function-procedure</I>
<I>general-procedure</I> :
PROC { <I>bound-toks<SUB>opt</SUB></I> | <I>prog-pars<SUB>opt</SUB></I> } <I>token-introduction</I>
<I>bound-toks</I> :
<I>bound-token</I>
<I>bound-token</I> , <I>bound-toks</I>
<I>bound-token</I> :
<I>token-introduction token-namespace<SUB>opt</SUB> identifier</I>
<I>prog-pars</I> :
<I>program-parameter</I>
<I>program-parameter</I> , <I>prog-pars</I>
<I>program-parameter</I> :
EXP <I>identifier</I>
STATEMENT <I>identifier</I>
TYPE <I>type-id</I>
MEMBER <I>type-id</I> : <I>identifier</I>
PROC <I>identifier</I>
<I>simple-procedure</I> :
PROC ( <I>simple-toks<SUB>opt</SUB></I> ) <I>token-introduction</I>
<I>simple-toks</I> :
<I>simple-token</I>
<I>simple-token</I> , <I>simple-toks</I>
<I>simple-token</I> :
<I>token-introduction token-namespace<SUB>opt</SUB> identifier<SUB>opt</SUB></I>
<I>function-procedure</I> :
FUNC <I>type-id</I> :
</PRE>
</P>
<HR>
<P><I>Part of the <A HREF="../index.html">TenDRA Web</A>.<BR>Crown
Copyright © 1998.</I></P>
</BODY>
</HTML>
|