]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/PatchCheck.py: Update to report error for EFI_D_*
authorYonghong Zhu <yonghong.zhu@intel.com>
Mon, 17 Oct 2016 03:13:47 +0000 (11:13 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Thu, 20 Oct 2016 23:28:01 +0000 (07:28 +0800)
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>
BaseTools/Scripts/PatchCheck.py

index 05f8f6e4078183d1ab5992ade0d03fa48f83930c..7c3008233c24f07d540e37326f48f79ae8050540 100755 (executable)
@@ -340,6 +340,14 @@ class GitDiffCheck:
 \r
         self.error(*lines)\r
 \r
+    old_debug_re = \\r
+        re.compile(r'''\r
+                        DEBUG \s* \( \s* \( \s*\r
+                        (?: DEBUG_[A-Z_]+ \s* \| \s*)*\r
+                        EFI_D_ ([A-Z_]+)\r
+                   ''',\r
+                   re.VERBOSE)\r
+\r
     def check_added_line(self, line):\r
         eol = ''\r
         for an_eol in self.line_endings:\r
@@ -357,6 +365,12 @@ class GitDiffCheck:
         if len(stripped) < len(line):\r
             self.added_line_error('Trailing whitespace found', line)\r
 \r
+        mo = self.old_debug_re.search(line)\r
+        if mo is not None:\r
+            self.added_line_error('EFI_D_' + mo.group(1) + ' was used, '\r
+                                  'but DEBUG_' + mo.group(1) +\r
+                                  ' is now recommended', line)\r
+\r
     split_diff_re = re.compile(r'''\r
                                    (?P<cmd>\r
                                        ^ diff \s+ --git \s+ a/.+ \s+ b/.+ $\r