void CallDiagNoMatch( // DIAGNOSE NO MATCHES FOR CALL PTREE expr, // - call expression unsigned msg_one, // - message: one function unsigned msg_many, // - message: many functions PTREE this_node, // - this node (or NULL) SYMBOL orig, // - original symbol for overloading FNOV_DIAG *fnov_diag ) // - overload diagnosis information { DIAG_INFO diag; // - diagnostic information PTREE arg; // - argument that didn't match int bad_parm; // - index of bad argument switch( fnov_diag->num_candidates ) { case 0 : if( SymIsFunctionTemplateModel( orig ) ) { PTreeErrorExprSym( expr, ERR_TEMPLATE_FN_MISMATCH, orig ); } else { PTreeErrorExprSym( expr, ERR_PARM_COUNT_MISMATCH, orig ); } break; case 1 : if( ! SymIsFunctionTemplateModel( orig ) ) { bad_parm = FnovRejectParm( fnov_diag ); if( bad_parm == -1 ) { diag.bad_parm = 0; diag.bad_src = NodeType( this_node ); diag.bad_tgt = TypeThisForCall( this_node, orig ); } else { arg = diagnoseArg( expr, bad_parm ); orig = pickCorrectFunction( orig, expr ); buildDiagInfo( &diag, arg, bad_parm, orig ); } displayDiagInfo( &diag, msg_one, expr, orig ); break; } // fall through default : CallDiagnoseRejects( expr, msg_many, fnov_diag ); break; } }
void MsgDisplay // DISPLAY A MESSAGE ( IDEMsgSeverity severity // - message severity , MSG_NUM msgnum // - message number , va_list args ) // - substitution arguments { VBUF buffer; // - formatting buffer SYMBOL sym; // - sym requiring location TOKEN_LOCN prt_locn; // - print location TOKEN_LOCN *msg_locn; // - message location CTX context; // - current context void *inf; // - information about context char *inf_prefix; // - prefix for information boolean context_changed; // - TRUE ==> new context from last time context_changed = CtxCurrent( &context, &inf, &inf_prefix ); setMsgLocation( context ); prt_locn = err_locn; ++reserveDepth; VbufInit( &buffer ); sym = msgBuild( msgnum, args, &buffer ); switch( severity ) { case IDEMSGSEV_ERROR : case IDEMSGSEV_WARNING : if( CompFlags.ew_switch_used ) { switch( context ) { case CTX_INIT : case CTX_FINI : case CTX_CMDLN_VALID : case CTX_CG_OPT : case CTX_ENDFILE : if( context_changed ) { fmt_inf_hdr( inf_prefix ); } break; case CTX_CMDLN_ENV : case CTX_CMDLN_PGM : if( context_changed ) { fmt_inf_hdr_switch( inf_prefix, inf ); } break; case CTX_CG_FUNC : case CTX_FUNC_GEN : if( context_changed ) { fmt_inf_hdr_sym( inf_prefix, inf ); } break; case CTX_FORCED_INCS : case CTX_SOURCE : build_file_nesting(); break; DbgDefault( "Unexpected message context" ); } } msg_locn = &prt_locn; break; case IDEMSGSEV_NOTE : case IDEMSGSEV_NOTE_MSG : msg_locn = ¬es_locn; break; default : msg_locn = NULL; break; } ideDisplay( severity , msgnum , VbufString( &buffer ) , msg_locn ); if( context_changed && ! CompFlags.ew_switch_used && ( severity == IDEMSGSEV_ERROR || severity == IDEMSGSEV_WARNING ) && ( context == CTX_SOURCE || context == CTX_FORCED_INCS ) ) { build_file_nesting(); } VbufFree( &buffer ); --reserveDepth; if( NULL != sym ) { notes_locn = sym->locn->tl; MsgDisplayArgs( IDEMSGSEV_NOTE , SymIsFunctionTemplateModel( sym ) ? INF_TEMPLATE_FN_DECL : INF_SYMBOL_DECLARATION , sym , &sym->locn->tl ); } }