示例#1
0
void CPragma( void )                  // PROCESS A PRAGMA
{
    bool check_end = true;

    SrcFileGuardStateSig();
    CompFlags.in_pragma = 1;
    NextToken();
    if( PragRecog( "include_alias" ) ) {
        pragIncludeAlias();
    } else if( CompFlags.cpp_output ) {
        PPCTL_ENABLE_MACROS();
        fprintf( CppFile, "#pragma " );
        for( ; CurToken != T_NULL; ) {
            PrtToken();
            GetNextToken();
        }
        PPCTL_DISABLE_MACROS();
    } else if( IS_ID_OR_KEYWORD( CurToken ) ) {
        if( PragIdRecog( "on" ) ) {
            pragFlag( true );
        } else if( PragIdRecog( "off" ) ) {
            pragFlag( false );
        } else if( PragIdRecog( "aux" ) || PragIdRecog( "linkage" ) ) {
            PragAux();
        } else if( PragIdRecog( "library" ) ) {
            pragLibs();
        } else if( PragIdRecog( "once" ) ) {
            pragOnce();
        } else if( PragIdRecog( "extref" ) ) {
            pragExtRef();
        } else if( PragIdRecog( "comment" ) ) {
            pragComment();
        } else if( PragIdRecog( "pack" ) ) {
            pragPack();
        } else if( PragIdRecog( "warning" ) ) {
            if( pragWarning() ) {
                /* ignore #pragma warning */
                check_end = false;  /* skip rest of line */
            }
        } else if( PragIdRecog( "enable_message" ) ) {
            pragEnableMessage();
        } else if( PragIdRecog( "disable_message" ) ) {
            pragDisableMessage();
        } else if( PragIdRecog( "code_seg" ) ) {
            pragCodeSeg();
        } else if( PragIdRecog( "data_seg" ) ) {
            pragDataSeg();
        } else if( PragIdRecog( "initialize" ) ) {
            pragInitialize();
        } else if( PragIdRecog( "init_seg" ) ) {
            pragInitSeg();
        } else if( PragIdRecog( "inline_depth" ) ) {
            pragInlineDepth();
        } else if( PragIdRecog( "template_depth" ) ) {
            pragTemplateDepth();
        } else if( PragIdRecog( "inline_recursion" ) ) {
            pragInlineRecursion();
        } else if( PragIdRecog( "intrinsic" ) ) {
            pragIntrinsic( true );
        } else if( PragIdRecog( "function" ) ) {
            pragIntrinsic( false );
        } else if( PragIdRecog( "destruct" ) ) {
            pragDestruct();
        } else if( PragIdRecog( "enum" ) ) {
            pragEnum();
        } else if( PragIdRecog( "dump_object_model" ) ) {
            pragDumpObjectModel();
        } else if( startPragRecog( "read_only_file" ) ) {
            pragReadOnlyFile();
        } else if( startPragRecog( "read_only_directory" ) ) {
            pragReadOnlyDir();
        } else if( PragIdRecog( "include_alias" ) ) {
            pragIncludeAlias();
        } else if( PragIdRecog( "message" ) ) {
            pragMessage();
        } else if( PragIdRecog( "error" ) ) {
            pragError();
#ifndef NDEBUG
        } else if( PragIdRecog( "break" ) ) {
            pragBreak();
#endif
        } else {                /* unknown pragma */
            check_end = false;  /* skip rest of line */
        }
    } else {                    /* unknown pragma */
        check_end = false;      /* skip rest of line */
    }
    if( check_end ) {
        endOfPragma();
    }
    CompFlags.in_pragma = 0;
}
示例#2
0
void CPragma( void )
/******************/
{
    bool    check_end = TRUE;

    /* Note that the include_alias pragma must always be processed
     * because it's intended for the preprocessor, not the compiler.
     */
    CompFlags.in_pragma = 1;
    NextToken();
    if( PragRecog( "include_alias" ) ) {
        PragIncludeAlias();
    } else if( CompFlags.cpp_output ) {
        PPCTL_ENABLE_MACROS();
        CppPrtf( "#pragma " );
        for( ; CurToken != T_NULL; ) {
            CppPrtToken();
            GetNextToken();
        }
        PPCTL_DISABLE_MACROS();
    } else if( IS_ID_OR_KEYWORD( CurToken ) ) {
        if( PragIdRecog( "on" ) ) {
            PragFlag( 1 );
        } else if( PragIdRecog( "off" ) ) {
            PragFlag( 0 );
        } else if( PragIdRecog( "aux" ) || PragIdRecog( "linkage" ) ) {
            PragAux();
        } else if( PragIdRecog( "library" ) ) {
            PragLibs();
        } else if( PragIdRecog( "comment" ) ) {
            PragComment();
        } else if( PragIdRecog( "pack" ) ) {
            PragPack();
        } else if( PragIdRecog( "alloc_text" ) ) {
            PragAllocText();
        } else if( PragIdRecog( "code_seg" ) ) {
            PragCodeSeg();
        } else if( PragIdRecog( "data_seg" ) ) {
            PragDataSeg();
        } else if( PragIdRecog( "disable_message" ) ) {
            PragEnableDisableMessage( 0 );
        } else if( PragIdRecog( "enable_message" ) ) {
            PragEnableDisableMessage( 1 );
        } else if( PragIdRecog( "include_alias" ) ) {
            PragIncludeAlias();
        } else if( PragIdRecog( "message" ) ) {
            PragMessage();
        } else if( PragIdRecog( "intrinsic" ) ) {
            PragIntrinsic( 1 );
        } else if( PragIdRecog( "function" ) ) {
            PragIntrinsic( 0 );
        } else if( PragIdRecog( "enum" ) ) {
            PragEnum();
        } else if( startPragRecog( "read_only_file" ) ) {
            PragReadOnlyFile();
        } else if( startPragRecog( "read_only_directory" ) ) {
            PragReadOnlyDir();
        } else if( PragIdRecog( "once" ) ) {
            PragOnce();
        } else if( PragIdRecog( "unroll" ) ) {
            PragUnroll();
        } else if( PragIdRecog( "STDC" ) ) {
            PragSTDC();
        } else if( PragIdRecog( "extref" ) ) {
            PragExtRef();
        } else if( PragIdRecog( "alias" ) ) {
            PragAlias();
        } else {
            check_end = FALSE;
        }
    } else {
        check_end = FALSE;
    }
    if( check_end )
        EndOfPragma();
    CompFlags.in_pragma = 0;
}