diff options
author | Liming Gao <liming.gao@intel.com> | 2013-08-23 02:18:16 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-08-23 02:18:16 +0000 |
commit | 4afd3d042215afe68d00b9ab8c32f063a3a1c03f (patch) | |
tree | b5190bd11547ac22fe35eeceee85ef42bfe6eea5 /BaseTools/Source/C/VfrCompile/VfrError.cpp | |
parent | a365eed476687881ce0ed49af7d483fd3cb0c491 (diff) | |
download | edk2-platforms-4afd3d042215afe68d00b9ab8c32f063a3a1c03f.tar.xz |
Sync BaseTool trunk (version r2599) into EDKII BaseTools.
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Heshen Chen <chen.heshen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14591 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/C/VfrCompile/VfrError.cpp')
-rw-r--r-- | BaseTools/Source/C/VfrCompile/VfrError.cpp | 69 |
1 files changed, 61 insertions, 8 deletions
diff --git a/BaseTools/Source/C/VfrCompile/VfrError.cpp b/BaseTools/Source/C/VfrCompile/VfrError.cpp index b0f9197e36..71305364f6 100644 --- a/BaseTools/Source/C/VfrCompile/VfrError.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp @@ -2,7 +2,7 @@ VfrCompiler error handler.
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -45,17 +45,24 @@ static SVFR_ERROR_HANDLE VFR_ERROR_HANDLE_TABLE [] = { { VFR_RETURN_DATA_STRING_ERROR, ": data field string error or not support"},
{ VFR_RETURN_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"},
{ VFR_RETURN_CONSTANT_ONLY, ": only constant is allowed in the expression"},
+ { VFR_RETURN_VARSTORE_NAME_REDEFINED_ERROR, ": Varstore name is defined by more than one varstores, it can't be referred as varstore, only varstore strucure name could be used."},
{ VFR_RETURN_CODEUNDEFINED, ": undefined Error Code" }
};
+static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE [] = {
+ { VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"},
+ { VFR_WARNING_CODEUNDEFINED, ": undefined Warning Code" }
+};
+
CVfrErrorHandle::CVfrErrorHandle (
VOID
)
{
- mInputFileName = NULL;
- mScopeRecordListHead = NULL;
- mScopeRecordListTail = NULL;
- mVfrErrorHandleTable = VFR_ERROR_HANDLE_TABLE;
+ mInputFileName = NULL;
+ mScopeRecordListHead = NULL;
+ mScopeRecordListTail = NULL;
+ mVfrErrorHandleTable = VFR_ERROR_HANDLE_TABLE;
+ mVfrWarningHandleTable = VFR_WARNING_HANDLE_TABLE;
}
CVfrErrorHandle::~CVfrErrorHandle (
@@ -74,9 +81,18 @@ CVfrErrorHandle::~CVfrErrorHandle ( delete pNode;
}
- mScopeRecordListHead = NULL;
- mScopeRecordListTail = NULL;
- mVfrErrorHandleTable = NULL;
+ mScopeRecordListHead = NULL;
+ mScopeRecordListTail = NULL;
+ mVfrErrorHandleTable = NULL;
+ mVfrWarningHandleTable = NULL;
+}
+
+VOID
+CVfrErrorHandle::SetWarningAsError (
+ IN BOOLEAN WarningAsError
+ )
+{
+ mWarningAsError = WarningAsError;
}
VOID
@@ -242,4 +258,41 @@ CVfrErrorHandle::HandleError ( }
}
+UINT8
+CVfrErrorHandle::HandleWarning (
+ IN EFI_VFR_WARNING_CODE WarningCode,
+ IN UINT32 LineNum,
+ IN CHAR8 *TokName
+ )
+{
+ UINT32 Index;
+ CHAR8 *FileName = NULL;
+ UINT32 FileLine;
+ CONST CHAR8 *WarningMsg = NULL;
+
+ if (mVfrWarningHandleTable == NULL) {
+ return 1;
+ }
+
+ GetFileNameLineNum (LineNum, &FileName, &FileLine);
+
+ if (mWarningAsError) {
+ Error (FileName, FileLine, 0x2220, "warning treated as error", NULL);
+ }
+
+ for (Index = 0; mVfrWarningHandleTable[Index].mWarningCode != VFR_WARNING_CODEUNDEFINED; Index++) {
+ if (WarningCode == mVfrWarningHandleTable[Index].mWarningCode) {
+ WarningMsg = mVfrWarningHandleTable[Index].mWarningMsg;
+ break;
+ }
+ }
+
+ if (WarningMsg != NULL) {
+ Warning (FileName, FileLine, 0, TokName, (CHAR8 *) "\t%s\n", (CHAR8 *) WarningMsg);
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
CVfrErrorHandle gCVfrErrorHandle;
|