mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
fix copyright checker
properly handle files starting with #include or #pragma Change-Id: I89b438ef36d796c2e005bb2241a97bf5e4d9e48c Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
7de297763f
commit
23b6896f5f
@ -53,6 +53,11 @@ banned_paths = [
|
||||
'scripts/tests/copyright/out'
|
||||
]
|
||||
|
||||
cpp_sharp_lines = [
|
||||
'#pragma',
|
||||
'#include'
|
||||
]
|
||||
|
||||
def isBanned(path):
|
||||
path_ok = False
|
||||
for banned_path in banned_paths:
|
||||
@ -120,11 +125,18 @@ for path in sys.argv:
|
||||
line = f.readline()
|
||||
|
||||
# check whether comment type is '#'
|
||||
if first_line or line.startswith('#'):
|
||||
header_start = '#'
|
||||
header_end = '\n'
|
||||
header = header_bash_style
|
||||
comment_char = "#"
|
||||
try:
|
||||
if first_line or line.startswith('#'):
|
||||
for a in cpp_sharp_lines:
|
||||
print "a: %s ~ %s" % (a, line)
|
||||
if line.startswith(a):
|
||||
raise "c++"
|
||||
header_start = '#'
|
||||
header_end = '\n'
|
||||
header = header_bash_style
|
||||
comment_char = "#"
|
||||
except:
|
||||
pass
|
||||
|
||||
curr_comment = list()
|
||||
|
||||
|
3
scripts/tests/copyright/in/file6.cpp
Normal file
3
scripts/tests/copyright/in/file6.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
// header file with # in first line
|
3
scripts/tests/copyright/in/file7.cpp
Normal file
3
scripts/tests/copyright/in/file7.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include <cstdint>
|
||||
|
||||
// header file with # in first line
|
10
scripts/tests/copyright/out/file6.cpp
Normal file
10
scripts/tests/copyright/out/file6.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// header file with # in first line
|
10
scripts/tests/copyright/out/file7.cpp
Normal file
10
scripts/tests/copyright/out/file7.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
// header file with # in first line
|
Reference in New Issue
Block a user