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 <[email protected]>
Cc: Jordan Justen <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <[email protected]>
---
 BaseTools/Scripts/PatchCheck.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 455c130..177a8d9 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -338,10 +338,19 @@ class GitDiffCheck:
             lines.append('File: ' + self.hunk_filename)
         lines.append('Line: ' + line)
 
         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):
         eol = ''
         for an_eol in self.line_endings:
             if line.endswith(an_eol):
                 eol = an_eol
@@ -355,10 +364,16 @@ class GitDiffCheck:
         if '\t' in line:
             self.added_line_error('Tab character used', line)
         if len(stripped) < len(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'''
                                    (?P<cmd>
                                        ^ diff \s+ --git \s+ a/.+ \s+ b/.+ $
                                    )
                                    (?P<index>
-- 
2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to