From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B05411A1E56 for ; Wed, 19 Oct 2016 18:35:47 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP; 19 Oct 2016 18:35:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,516,1473145200"; d="scan'208";a="21893165" Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.144]) by orsmga004.jf.intel.com with ESMTP; 19 Oct 2016 18:35:46 -0700 From: Yonghong Zhu To: edk2-devel@lists.01.org Cc: Liming Gao , Jordan Justen Date: Thu, 20 Oct 2016 09:35:16 +0800 Message-Id: <1476927316-16028-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [Patch 3/3 V3] BaseTools/PatchCheck.py: Update to report error for EFI_D_* X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 01:35:47 -0000 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 Cc: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu --- 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 ^ diff \s+ --git \s+ a/.+ \s+ b/.+ $ ) (?P -- 2.6.1.windows.1