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=145

Cc: Liming Gao <liming....@intel.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong....@intel.com>
---
 BaseTools/Scripts/PatchCheck.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 05f8f6e..3ac0769 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -337,10 +337,15 @@ class GitDiffCheck:
         if self.hunk_filename is not None:
             lines.append('File: ' + self.hunk_filename)
         lines.append('Line: ' + line)
 
         self.error(*lines)
+
+    DEBUG_macro_re = re.compile(r'''^
+                                    \s*DEBUG\s*\(\(
+                                ''',
+                                re.VERBOSE)
 
     def check_added_line(self, line):
         eol = ''
         for an_eol in self.line_endings:
             if line.endswith(an_eol):
@@ -354,10 +359,13 @@ class GitDiffCheck:
                                   line)
         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)
+        if self.DEBUG_macro_re.match(line):
+            if 'EFI_D_' in line:
+                self.added_line_error('EFI_D_* format is used, recommend to 
use DEBUG_* format', line)
 
     split_diff_re = re.compile(r'''
                                    (?P<cmd>
                                        ^ diff \s+ --git \s+ a/.+ \s+ b/.+ $
                                    )
-- 
2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to