Example #1
0
local void CEndif( void )
{
    if( NestLevel == 0 ) {
        CErr1( ERR_MISPLACED_ENDIF );
    } else {
        struct cpp_info *cpp;

        --NestLevel;
        cpp = CppStack;
        if( cpp->flist != SrcFile->src_flist ) {
             CWarn2p( WARN_LEVEL_1, ERR_WEIRD_ENDIF_ENCOUNTER, FileIndexToCorrectName( cpp->src_loc.fno ) );
        }
        CppStack = cpp->prev_cpp;
        CMemFree( cpp );
    }
    if( NestLevel < SkipLevel ) {
        SkipLevel = NestLevel;
    }
    PPNextToken();
    WantEOL();
}
Example #2
0
// fill cmsg_info struct
static void CMsgInfo( cmsg_info *info, int parmno, msg_codes msgnum, va_list args )
{
    char        *fname;
    unsigned    line;
    char const  *msgstr;
    int         prefix_len;

    info->msgnum = msgnum;
//  CMsgSetClass( info, msgnum );
    info->col = 0;
    switch( msgnum ) {
    case ERR_INVALID_MEMORY_MODEL:
    case ERR_INVALID_OPTION:
    case ERR_INVALID_OPTIMIZATION:
        /* no location for error message */
        line = 0;
        fname = NULL;
        break;
    default:
        if( error_fname != NULL ) {
            fname = error_fname;
            line = error_line;
        } else {
            fname = FileIndexToCorrectName( TokenLoc.fno );
            line = TokenLoc.line;
        }
    }
    prefix_len = 0;
    if( parmno ) {
        msgstr = CGetMsgStr( PHRASE_PARAM );
        prefix_len = sprintf( info->msgtxt, msgstr, parmno );
        info->msgtxt[prefix_len++] = ' ';
    }
    msgstr = CGetMsgStr( msgnum );
    _vsnprintf( info->msgtxt + prefix_len, MAX_MSG_LEN - prefix_len, msgstr, args );
    info->msgtxt[MAX_MSG_LEN - 1] = '\0';
    info->line = line;
    info->fname = fname;
}