From f376c5ad0fa9e6996f8f11df94eec782ec04be9e Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Wed, 27 Nov 2024 13:50:53 +0100 Subject: [PATCH] bin/grepc: -tfp, -tfd: Add support for forward-declarations of parameters This is currently a (very useful) GNU extension, and soon might become standard in C2y. Link: n3394 Signed-off-by: Alejandro Colomar --- bin/grepc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/grepc b/bin/grepc index b5aff6951..b8d3cde3f 100755 --- a/bin/grepc +++ b/bin/grepc @@ -163,8 +163,8 @@ fi; grepc_c_e() { printf '%s\n' '(?s)^([\w[]+[\w\s]*)?\benum\b[ \t]*([\w \t[\]]|::)*\n*([ \t]*){[^}]*^[ \t]*'"$1"'\b\s*[=,].*?^\3}.*?;'; } -grepc_c_fp() { printf '%s\n' '(?s)^[\w[](?:[\w\s\(,\)[\]*]|::)+[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*(\((?:[\w\s,[\]*]|::|(?1))*(?:\.\.\.)?\))(?:[\w\s\(,\)[\]]|::)*;'; } -grepc_c_fd() { printf '%s\n' '(?s)^[\w[](?:[\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*(\((?:[\w\s,[\]*]|::|(?1))*(?:\.\.\.)?\))[ \t]*\n([ \t]*){.*?^\2}'; } +grepc_c_fp() { printf '%s\n' '(?s)^[\w[](?:[\w\s\(,\)[\]*]|::)+[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*(\((?:[\w\s,;[\]*]|::|(?1))*(?:\.\.\.)?\))(?:[\w\s\(,\)[\]]|::)*;'; } +grepc_c_fd() { printf '%s\n' '(?s)^[\w[](?:[\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*(\((?:[\w\s,;[\]*]|::|(?1))*(?:\.\.\.)?\))[ \t]*\n([ \t]*){.*?^\2}'; } grepc_c_fgd_libm() { grepc_c_fd "M_DECL_FUNC \(__$1\)"; } grepc_c_fgd_libio() { grepc_c_fd "_IO_$1"; } grepc_c_fgp_libio() { grepc_c_fp "_IO_$1"; } -- 2.47.3