public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] BaseTools: Update PatchCheck.py to check for __FUNCTION__
@ 2023-04-07  1:30 Rebecca Cran
  0 siblings, 0 replies; only message in thread
From: Rebecca Cran @ 2023-04-07  1:30 UTC (permalink / raw)
  To: devel, Liming Gao, Bob Feng, Yuwei Chen; +Cc: Rebecca Cran

New code should use the C99 macro __func__ instead of the pre-Standard
macro __FUNCTION__. Update PatchCheck.py to reject patches with the
latter.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
---
 BaseTools/Scripts/PatchCheck.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 5d17d99a12ef..5f96b05dbcec 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -491,6 +491,10 @@ class GitDiffCheck:
                                   'but DEBUG_' + mo.group(1) +
                                   ' is now recommended', line)
 
+        if line.find('__FUNCTION__') != -1 and not self.filename.endswith('.py'):
+            self.added_line_error('__FUNCTION__ was used, but __func__ '
+                                  'is now recommended', line)
+
     split_diff_re = re.compile(r'''
                                    (?P<cmd>
                                        ^ diff \s+ --git \s+ a/.+ \s+ b/.+ $
-- 
2.34.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-07  1:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-07  1:30 [PATCH 1/1] BaseTools: Update PatchCheck.py to check for __FUNCTION__ Rebecca Cran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox