fix: [Common] build failed with VS2015

The current BaseTools aligned with edk2-stable202311
introduces the replacement of __FUNCTION__ with __func__,
which causes compiler failure if the toolchain is using
VS2015. It is because VS2015 doesn't support __func__.
This patch reverts the change and its checker to continue
the VS2015 support.

Reference commit IDs from edk2 repo: b17a3a1 and c9fb11f

Test command: python BuildLoader.py build xxxx -t VS2015

Signed-off-by: Vincent Chen <vincent.chen@intel.com>
This commit is contained in:
Vincent Chen 2024-03-22 15:49:48 +08:00 committed by Guo Dong
parent 430306e4e9
commit 6958e19e06
2 changed files with 6 additions and 6 deletions

View File

@ -504,11 +504,11 @@ class GitDiffCheck:
'but DEBUG_' + mo.group(1) + 'but DEBUG_' + mo.group(1) +
' is now recommended', line) ' is now recommended', line)
rp_file = os.path.realpath(self.filename) #rp_file = os.path.realpath(self.filename)
rp_script = os.path.realpath(__file__) #rp_script = os.path.realpath(__file__)
if line.find('__FUNCTION__') != -1 and rp_file != rp_script: #if line.find('__FUNCTION__') != -1 and rp_file != rp_script:
self.added_line_error('__FUNCTION__ was used, but __func__ ' # self.added_line_error('__FUNCTION__ was used, but __func__ '
'is now recommended', line) # 'is now recommended', line)
split_diff_re = re.compile(r''' split_diff_re = re.compile(r'''
(?P<cmd> (?P<cmd>

View File

@ -17,7 +17,7 @@
if (!(Expression)) { \ if (!(Expression)) { \
DEBUG ((DEBUG_VERBOSE, \ DEBUG ((DEBUG_VERBOSE, \
"%a(%d) %a: SAFE_STRING_CONSTRAINT_CHECK(%a) failed. Return %r\n", \ "%a(%d) %a: SAFE_STRING_CONSTRAINT_CHECK(%a) failed. Return %r\n", \
__FILE__, DEBUG_LINE_NUMBER, __func__, DEBUG_EXPRESSION_STRING (Expression), Status)); \ __FILE__, DEBUG_LINE_NUMBER, __FUNCTION__, DEBUG_EXPRESSION_STRING (Expression), Status)); \
return Status; \ return Status; \
} \ } \
} while (FALSE) } while (FALSE)