mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 09:09:10 -04:00
ci(check): update check_soc_struct_headers script
This commit is contained in:
parent
5863b66ba5
commit
0cfa86670a
@ -72,7 +72,7 @@ check_chip_support_components:
|
||||
expire_in: 1 week
|
||||
script:
|
||||
- python tools/ci/check_soc_headers_leak.py
|
||||
- find ${IDF_PATH}/components/soc/**/include/soc/ -name "*_struct.h" -print0 | xargs -0 -n1 ./tools/ci/check_soc_struct_headers.py
|
||||
- find ${IDF_PATH}/components/soc/**/include/soc/ ${IDF_PATH}/components/soc/**/register/soc/ -name "*_struct.h" -print0 | xargs -0 -n1 ./tools/ci/check_soc_struct_headers.py
|
||||
- tools/ci/check_esp_memory_utils_headers.sh
|
||||
|
||||
check_esp_err_to_name:
|
||||
|
@ -1,12 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# A check script that just works at the time of writing...
|
||||
#
|
||||
# also builds a structure tree for further reference
|
||||
#
|
||||
# Input file format must be similiar to those headers generated by regtool, or this script makes no sense at all
|
||||
# Input file format must be similar to those headers generated by regtool, or this script makes no sense at all
|
||||
#
|
||||
# Known limitation:
|
||||
# 1. won't accept /* ... */ /* ... */': badly behavior with multiline comment
|
||||
@ -21,18 +20,18 @@
|
||||
# 5. typedef volatile struct xxx{}: xxx must exists
|
||||
#
|
||||
# Otherwise won't fail but warning
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from typing import Any
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class MemberField:
|
||||
member_type = ''
|
||||
bitfield = None
|
||||
|
||||
def __init__(self, m_type: str, m_bits: int=None) -> None:
|
||||
def __init__(self, m_type: str, m_bits: Optional[int]=None) -> None:
|
||||
self.member_type = m_type
|
||||
self.bitfield = m_bits
|
||||
|
||||
@ -74,7 +73,7 @@ class SoCStructureHeaderChecker:
|
||||
# named typedef, or named struct/union. referd but will not delete
|
||||
__temp_ref_types = dict() # type: dict
|
||||
|
||||
def __expand_type(self, member_type: str, bitfield: int=None) -> Any:
|
||||
def __expand_type(self, member_type: str, bitfield: Optional[int]=None) -> Any:
|
||||
if member_type == 'uint32_t':
|
||||
return MemberField(member_type, bitfield)
|
||||
if bitfield is not None:
|
||||
@ -121,7 +120,7 @@ class SoCStructureHeaderChecker:
|
||||
# skip empty line
|
||||
return self.__getline()
|
||||
if rawline.count(';') > 1:
|
||||
print('\033[0;34mINFO\033[0m: line: {}: possibily multiple expression within same line'.format(self.__linecount))
|
||||
print('\033[0;34mINFO\033[0m: line: {}: possibly multiple expression within same line'.format(self.__linecount))
|
||||
print(rawline)
|
||||
return rawline
|
||||
|
||||
@ -129,7 +128,7 @@ class SoCStructureHeaderChecker:
|
||||
ret_val = 0
|
||||
# first check for anonymous register structs
|
||||
if is_typedef and is_volatile and name is None:
|
||||
print('\033[0;31mERROR\033[0m: line {}: annoymous struct'.format(self.__linecount))
|
||||
print('\033[0;31mERROR\033[0m: line {}: anonymous struct'.format(self.__linecount))
|
||||
ret_val = -1
|
||||
node_tree = dict()
|
||||
bitcount = 0
|
||||
@ -252,7 +251,7 @@ class SoCStructureHeaderChecker:
|
||||
ret_val = 0
|
||||
# first check for anonymous register structs
|
||||
if is_typedef and is_volatile and name is None:
|
||||
print('\033[0;31mERROR\033[0m: line {}: annoymous union'.format(self.__linecount))
|
||||
print('\033[0;31mERROR\033[0m: line {}: anonymous union'.format(self.__linecount))
|
||||
ret_val = -1
|
||||
node_tree = dict() # type: Any
|
||||
has_struct_count = 0
|
||||
@ -334,7 +333,7 @@ class SoCStructureHeaderChecker:
|
||||
node_tree[match_obj.groups()[1]] = member_node
|
||||
else:
|
||||
if '*' not in match_obj.groups()[0]:
|
||||
print('\033[0;31mERROR\033[0m: line {}: unknown type {}'.format(self.__linecount, match_obj.groups()[0]))
|
||||
print('\033[0;31mWARN\033[0m: line {}: unknown type {}'.format(self.__linecount, match_obj.groups()[0]))
|
||||
else:
|
||||
print('\033[0;33mWARN\033[0m: line {}: pointer type {}'.format(self.__linecount, match_obj.groups()[0]))
|
||||
continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user