diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-26 11:05:26 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-26 11:05:26 -0700 |
commit | 76c53794b6202ec37f6dcace5f2ae86870e953b6 (patch) | |
tree | b7c9fce179cee0be2ac01ff966e6521169831e03 /xfa/fxfa/fm2js/xfa_error.h | |
parent | 186a78eb0a821a2f1feef524cb590d0fea2009ba (diff) | |
download | pdfium-76c53794b6202ec37f6dcace5f2ae86870e953b6.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_error.h')
-rw-r--r-- | xfa/fxfa/fm2js/xfa_error.h | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/xfa/fxfa/fm2js/xfa_error.h b/xfa/fxfa/fm2js/xfa_error.h index 2415cd3212..6ce102e03e 100644 --- a/xfa/fxfa/fm2js/xfa_error.h +++ b/xfa/fxfa/fm2js/xfa_error.h @@ -10,18 +10,13 @@ #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" -enum XFA_FM_ERRMSG { - FMERR_UNSUPPORTED_CHAR, - FMERR_BAD_SUFFIX_NUMBER, - FMERR_INVALIDATE_CHAR, - FMERR_EXPECTED_IDENTIFIER, - FMERR_EXPECTED_TOKEN, - FMERR_EXPECTED_IFEND, - FMERR_UNEXPECTED_EXPRESSION, - FMERR_EXPTECTED_OPERATOR, - FMERR_EXPECTED_NON_EMPTY_EXPRESSION, - FMERR_MAXIMUM -}; +extern const FX_WCHAR kFMErrUnsupportedChar[]; +extern const FX_WCHAR kFMErrBadSuffixNumber[]; +extern const FX_WCHAR kFMErrExpectedIdentifier[]; +extern const FX_WCHAR kFMErrExpectedToken[]; +extern const FX_WCHAR kFMErrExpectedEndIf[]; +extern const FX_WCHAR kFMErrUnexpectedExpression[]; +extern const FX_WCHAR kFMErrExpectedNonEmptyExpression[]; class CXFA_FMErrorInfo { public: @@ -30,6 +25,5 @@ class CXFA_FMErrorInfo { uint32_t linenum; CFX_WideString message; }; -const FX_WCHAR* XFA_FM_ErrorMsg(XFA_FM_ERRMSG msg); #endif // XFA_FXFA_FM2JS_XFA_ERROR_H_ |