Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

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