Rev 2 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<!-- 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>