From b8d34e9013e9091f2b3fc7e6c35f9d986126bc95 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 24 May 2022 23:50:09 +0200 Subject: grepc: Fix some typedef corner cases - Typedefs to arrays of structures. - Typedefs to structures of the same name. Signed-off-by: Alejandro Colomar --- bin/grepc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/grepc b/bin/grepc index 51a638f..c60e587 100755 --- a/bin/grepc +++ b/bin/grepc @@ -263,7 +263,7 @@ grepc_type_struct_union_enum() grepc_helper \ '\b(struct|union|enum)\b([\w \t[\]]|::)+\b'"$1"'\b' \ '.' \ - '(?s)^(?!^[ \t]*typedef\b)([\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+)?\b(struct|union|enum)\b([\w \t[\]]|::)+\b'"$1"'\b[ \t]*\n*([ \t]*){.*?^\5}.*?;'; + '(?s)^([\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+)?\b(struct|union|enum)\b([\w \t[\]]|::)+\b'"$1"'\b[ \t]*\n*([ \t]*){.*?^\5}.*?;'; } @@ -281,8 +281,8 @@ grepc_type_typedef_struct_union_enum() { grepc_helper \ '^[ \t]*typedef\s+(struct|union|enum)\b[^;]*$' \ - "^[ \t]*}\s*$1;" \ - '(?s)^[ \t]*typedef\s+(struct|union|enum)\b([\w \t[\]]|::)*\n*([ \t]*){(?:(?!^\3}).)*?^\3}\s*'"$1"';' \ + "^[ \t]*}\s*$1(\[[\w\(,\)]\])*;" \ + '(?s)^[ \t]*typedef\s+(struct|union|enum)\b(?:(?!\W'"$1"'\W)([\w \t[\]]|::))*\n*([ \t]*){(?:(?!^\3}).)*?^\3}\s*'"$1"'(\[[\w\(,\)]\])*;' \ <"$files"; } -- cgit v1.2.3