From e649b2938620c8f9767e2d89d9613b9ab9b6299b Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 31 Mar 2014 18:08:48 -0700 Subject: suppress args warnings when the number is forced anyhow --- lib/Target/JSBackend/CallHandlers.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Target/JSBackend/CallHandlers.h b/lib/Target/JSBackend/CallHandlers.h index 35ceb351af..6238251637 100644 --- a/lib/Target/JSBackend/CallHandlers.h +++ b/lib/Target/JSBackend/CallHandlers.h @@ -59,8 +59,10 @@ DEF_CALL_HANDLER(__default__, { } } - if (NumArgs == -1) NumArgs = getNumArgOperands(CI); - if (!FT->isVarArg()) { + bool ForcedNumArgs = NumArgs != -1; + if (!ForcedNumArgs) NumArgs = getNumArgOperands(CI); + + if (!FT->isVarArg() && !ForcedNumArgs) { int TypeNumArgs = FT->getNumParams(); if (TypeNumArgs != NumArgs) { if (EmscriptenAssertions) prettyWarning() << "unexpected number of arguments " << utostr(NumArgs) << " in call to '" << F->getName() << "', should be " << utostr(TypeNumArgs) << "\n"; @@ -1052,12 +1054,11 @@ std::string handleCall(const Instruction *CI) { // we don't need to use a function index. const std::string &Name = isa(CV) ? getJSName(CV) : getValueAsStr(CV); - unsigned NumArgs = getNumArgOperands(CI); CallHandlerMap::iterator CH = CallHandlers.find("___default__"); if (isa(CV)) { CallHandlerMap::iterator Custom = CallHandlers.find(Name); if (Custom != CallHandlers.end()) CH = Custom; } - return (this->*(CH->second))(CI, Name, NumArgs); + return (this->*(CH->second))(CI, Name, -1); } -- cgit v1.2.3-18-g5258