Skip to content

Commit

Permalink
make check-decl: Add detection for deprecated+removed
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Hursey <[email protected]>
  • Loading branch information
jjhursey committed Nov 2, 2020
1 parent 86eaecd commit b436c5c
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion bin/check-multi-declare.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
std_structs = {}
std_apis = {}
std_all_refs = {}
std_deprecated = {}
std_removed = {}

#
# Command line parsing
Expand Down Expand Up @@ -55,6 +57,21 @@

# Count will return to 0 when verified
value = m.group(1)

# Check for deprecated and removed identifiers
m = re.search(r"Deprecated", line)
if m is not None:
if value in std_deprecated:
std_deprecated[value] = std_deprecated[value] + 1
else:
std_deprecated[value] = 1
m = re.search(r"Removed", line)
if m is not None:
if value in std_removed:
std_removed[value] = std_removed[value] + 1
else:
std_removed[value] = 1

#print("Found \""+ref_str+"\" : "+value+" on line " + line)
std_all_refs[value] = -1
if ref_str == "attr":
Expand Down Expand Up @@ -89,7 +106,15 @@
return_count = 0
for val in std_attributes:
if std_attributes[val] > 1:
print("Error: " + val + " declared " + str(std_attributes[val]) + " times")
# Look for deprecation and removal (2 references)
if std_attributes[val] == 2:
if val in std_deprecated and val in std_removed:
# Skip this since it was marked as deprecated and removed
continue
if val in std_deprecated:
print("Deprecated: " + val + " declared " + str(std_attributes[val]) + " times (Deprecated in " + str(std_deprecated[val]) + " of those declarations)")
else:
print("Error: " + val + " declared " + str(std_attributes[val]) + " times")
return_count += 1
for val in std_consts:
if std_consts[val] > 1:
Expand Down

0 comments on commit b436c5c

Please sign in to comment.