mirror of https://github.com/acidanthera/audk.git
BaseTools/PatchCheck.py: Update to report error for EFI_D_*
In EDK2, DEBUG_* is recommended to be used instead of EFI_D_*. For new code, they should use DEBUG_* macro. Fixes:https://bugzilla.tianocore.org/show_bug.cgi?id=143 Cc: Liming Gao <liming.gao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
parent
e709bbb1ce
commit
c3926cdbbd
|
@ -340,6 +340,14 @@ class GitDiffCheck:
|
||||||
|
|
||||||
self.error(*lines)
|
self.error(*lines)
|
||||||
|
|
||||||
|
old_debug_re = \
|
||||||
|
re.compile(r'''
|
||||||
|
DEBUG \s* \( \s* \( \s*
|
||||||
|
(?: DEBUG_[A-Z_]+ \s* \| \s*)*
|
||||||
|
EFI_D_ ([A-Z_]+)
|
||||||
|
''',
|
||||||
|
re.VERBOSE)
|
||||||
|
|
||||||
def check_added_line(self, line):
|
def check_added_line(self, line):
|
||||||
eol = ''
|
eol = ''
|
||||||
for an_eol in self.line_endings:
|
for an_eol in self.line_endings:
|
||||||
|
@ -357,6 +365,12 @@ class GitDiffCheck:
|
||||||
if len(stripped) < len(line):
|
if len(stripped) < len(line):
|
||||||
self.added_line_error('Trailing whitespace found', line)
|
self.added_line_error('Trailing whitespace found', line)
|
||||||
|
|
||||||
|
mo = self.old_debug_re.search(line)
|
||||||
|
if mo is not None:
|
||||||
|
self.added_line_error('EFI_D_' + mo.group(1) + ' was used, '
|
||||||
|
'but DEBUG_' + mo.group(1) +
|
||||||
|
' is now recommended', line)
|
||||||
|
|
||||||
split_diff_re = re.compile(r'''
|
split_diff_re = re.compile(r'''
|
||||||
(?P<cmd>
|
(?P<cmd>
|
||||||
^ diff \s+ --git \s+ a/.+ \s+ b/.+ $
|
^ diff \s+ --git \s+ a/.+ \s+ b/.+ $
|
||||||
|
|
Loading…
Reference in New Issue