]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Ecc/c.py
BaseTools:Ecc handle another copyright format
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / c.py
index 7b645ff053658a8c184a7cf90e41a0998793149f..a67ebb0630c1c1d0dd8c89dde620588112b24bfe 100644 (file)
@@ -2,13 +2,7 @@
 # This file is used to be the c coding style checking of ECC tool\r
 #\r
 # Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution.  The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
 \r
 from __future__ import print_function\r
@@ -501,6 +495,8 @@ def CollectSourceCodeDataIntoDB(RootDir):
     tuple = os.walk(RootDir)\r
     IgnoredPattern = GetIgnoredDirListPattern()\r
     ParseErrorFileList = []\r
+    TokenReleaceList = EccGlobalData.gConfig.TokenReleaceList\r
+    TokenReleaceList.extend(['L",\\\""'])\r
 \r
     for dirpath, dirnames, filenames in tuple:\r
         if IgnoredPattern.match(dirpath.upper()):\r
@@ -525,6 +521,7 @@ def CollectSourceCodeDataIntoDB(RootDir):
                 EdkLogger.info("Parsing " + FullName)\r
                 model = f.endswith('c') and DataClass.MODEL_FILE_C or DataClass.MODEL_FILE_H\r
                 collector = CodeFragmentCollector.CodeFragmentCollector(FullName)\r
+                collector.TokenReleaceList = TokenReleaceList\r
                 try:\r
                     collector.ParseFile()\r
                 except UnicodeError:\r
@@ -2391,7 +2388,7 @@ def CheckFileHeaderDoxygenComments(FullFileName):
                     PrintErrorMsg(ERROR_HEADER_CHECK_FILE, 'File header comment content should start with two spaces at each line', FileTable, ID)\r
 \r
             CommentLine = CommentLine.strip()\r
-            if CommentLine.startswith('Copyright'):\r
+            if CommentLine.startswith('Copyright') or ('Copyright' in CommentLine and CommentLine.lower().startswith('(c)')):\r
                 NoCopyrightFlag = False\r
                 if CommentLine.find('All rights reserved') == -1:\r
                     for Copyright in EccGlobalData.gConfig.Copyright:\r