summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js/xfa_lexer.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-26 11:05:26 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-26 11:05:26 -0700
commit76c53794b6202ec37f6dcace5f2ae86870e953b6 (patch)
treeb7c9fce179cee0be2ac01ff966e6521169831e03 /xfa/fxfa/fm2js/xfa_lexer.cpp
parent186a78eb0a821a2f1feef524cb590d0fea2009ba (diff)
downloadpdfium-chromium/2721.tar.xz
Fix Wvarargs warning in XFA error code.chromium/2722chromium/2721chromium/2719chromium/2718
Chrome has enabled the -Wvarargs warning that was added to clang, this fails with PDFium XFA builds due to two warnings: ../../xfa/fxfa/fm2js/xfa_lexer.cpp:539:16: error: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Werror,-Wvarargs] va_start(ap, msg); ^ ../../xfa/fxfa/fm2js/xfa_lexer.cpp:535:40: note: parameter of type 'XFA_FM_ERRMSG' is declared here void CXFA_FMLexer::Error(XFA_FM_ERRMSG msg, ...) { The issue is that XFA_FM_ERRMSG is an enum and we violate the promotion rules for passing the value to va_start. I removed the enum and named the flags explicitly then pass in the string as the argument. BUG=chromium:606726 Review URL: https://codereview.chromium.org/1921323002
Diffstat (limited to 'xfa/fxfa/fm2js/xfa_lexer.cpp')
-rw-r--r--xfa/fxfa/fm2js/xfa_lexer.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/xfa/fxfa/fm2js/xfa_lexer.cpp b/xfa/fxfa/fm2js/xfa_lexer.cpp
index dd3b48ff54..f048f42668 100644
--- a/xfa/fxfa/fm2js/xfa_lexer.cpp
+++ b/xfa/fxfa/fm2js/xfa_lexer.cpp
@@ -177,14 +177,14 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
CXFA_FMToken* p = new CXFA_FMToken(m_uCurrentLine);
if (!XFA_FMDChar::isAvalid(m_ptr)) {
ch = XFA_FMDChar::get(m_ptr);
- Error(FMERR_UNSUPPORTED_CHAR, ch);
+ Error(kFMErrUnsupportedChar, ch);
return p;
}
int iRet = 0;
while (1) {
if (!XFA_FMDChar::isAvalid(m_ptr)) {
ch = XFA_FMDChar::get(m_ptr);
- Error(FMERR_UNSUPPORTED_CHAR, ch);
+ Error(kFMErrUnsupportedChar, ch);
return p;
}
ch = XFA_FMDChar::get(m_ptr);
@@ -227,7 +227,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
iRet = Number(p, m_ptr, pTemp);
m_ptr = pTemp;
if (iRet) {
- Error(FMERR_BAD_SUFFIX_NUMBER);
+ Error(kFMErrBadSuffixNumber);
return p;
}
}
@@ -246,7 +246,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
}
} else {
ch = XFA_FMDChar::get(m_ptr);
- Error(FMERR_UNSUPPORTED_CHAR, ch);
+ Error(kFMErrUnsupportedChar, ch);
return p;
}
break;
@@ -268,7 +268,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
}
} else {
ch = XFA_FMDChar::get(m_ptr);
- Error(FMERR_UNSUPPORTED_CHAR, ch);
+ Error(kFMErrUnsupportedChar, ch);
return p;
}
break;
@@ -286,7 +286,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
}
} else {
ch = XFA_FMDChar::get(m_ptr);
- Error(FMERR_UNSUPPORTED_CHAR, ch);
+ Error(kFMErrUnsupportedChar, ch);
return p;
}
break;
@@ -345,7 +345,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
}
} else {
ch = XFA_FMDChar::get(m_ptr);
- Error(FMERR_UNSUPPORTED_CHAR, ch);
+ Error(kFMErrUnsupportedChar, ch);
return p;
}
break;
@@ -372,7 +372,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
iRet = Number(p, m_ptr, pTemp);
m_ptr = pTemp;
if (iRet) {
- Error(FMERR_BAD_SUFFIX_NUMBER);
+ Error(kFMErrBadSuffixNumber);
}
return p;
} else {
@@ -381,7 +381,7 @@ CXFA_FMToken* CXFA_FMLexer::Scan() {
}
} else {
ch = XFA_FMDChar::get(m_ptr);
- Error(FMERR_UNSUPPORTED_CHAR, ch);
+ Error(kFMErrUnsupportedChar, ch);
return p;
}
case 0x09:
@@ -430,7 +430,7 @@ uint32_t CXFA_FMLexer::String(CXFA_FMToken* t,
ch = XFA_FMDChar::get(p);
pEnd = p;
t->m_wstring = CFX_WideStringC(pStart, (pEnd - pStart));
- Error(FMERR_UNSUPPORTED_CHAR, ch);
+ Error(kFMErrUnsupportedChar, ch);
return 1;
}
if (ch == '"') {
@@ -439,7 +439,7 @@ uint32_t CXFA_FMLexer::String(CXFA_FMToken* t,
ch = XFA_FMDChar::get(p);
pEnd = p;
t->m_wstring = CFX_WideStringC(pStart, (pEnd - pStart));
- Error(FMERR_UNSUPPORTED_CHAR, ch);
+ Error(kFMErrUnsupportedChar, ch);
return 1;
}
ch = XFA_FMDChar::get(p);
@@ -468,7 +468,7 @@ uint32_t CXFA_FMLexer::Identifiers(CXFA_FMToken* t,
if (!XFA_FMDChar::isAvalid(p)) {
pEnd = p;
t->m_wstring = CFX_WideStringC(pStart, (pEnd - pStart));
- Error(FMERR_UNSUPPORTED_CHAR, ch);
+ Error(kFMErrUnsupportedChar, ch);
return 1;
}
ch = XFA_FMDChar::get(p);
@@ -476,7 +476,7 @@ uint32_t CXFA_FMLexer::Identifiers(CXFA_FMToken* t,
if (!XFA_FMDChar::isAvalid(p)) {
pEnd = p;
t->m_wstring = CFX_WideStringC(pStart, (pEnd - pStart));
- Error(FMERR_UNSUPPORTED_CHAR, ch);
+ Error(kFMErrUnsupportedChar, ch);
return 1;
}
ch = XFA_FMDChar::get(p);
@@ -532,12 +532,11 @@ XFA_FM_TOKEN CXFA_FMLexer::IsKeyword(const CFX_WideStringC& str) {
return TOKidentifier;
}
-void CXFA_FMLexer::Error(XFA_FM_ERRMSG msg, ...) {
+void CXFA_FMLexer::Error(const FX_WCHAR* msg, ...) {
m_pErrorInfo->linenum = m_uCurrentLine;
- const FX_WCHAR* lpMessageInfo = XFA_FM_ErrorMsg(msg);
va_list ap;
va_start(ap, msg);
- m_pErrorInfo->message.FormatV(lpMessageInfo, ap);
+ m_pErrorInfo->message.FormatV(msg, ap);
va_end(ap);
}