]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
check-format.pl: prevent false positive on typedef with space and '(' after type...
authorDr. David von Oheimb <dev@ddvo.net>
Mon, 16 Jun 2025 14:43:03 +0000 (16:43 +0200)
committerNeil Horman <nhorman@openssl.org>
Tue, 17 Jun 2025 19:33:21 +0000 (15:33 -0400)
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27836)

(cherry picked from commit 4a3809f7056b78031e72fc4e90eec3e708ca27e1)

util/check-format-test-negatives.c
util/check-format.pl

index 33abf00215333db98d35bde992983d1e8a165477..b813e5548f28864e4c8564f18cea78313678abf3 100644 (file)
@@ -296,6 +296,7 @@ const OPTIONS passwd_options[] = {
     {NULL}
 };
 
+typedef bool (*LOG_cb_t)(int lineno, severity level, const char *msg);
 typedef * d(int)
     x;
 typedef (int)
index 81b05f9ace2d56895a8fa6f254e4f955770ab905..baa4ab94ef8b3a122317fcdfefdffbaa474f2d65 100755 (executable)
@@ -833,7 +833,8 @@ while (<>) { # loop over all lines of all input files
         report("space after function/macro name")
                                       if $intra_line =~ m/(\w+)\s+\(/        # fn/macro name with space before '('
        && !($1 =~ m/^(sizeof|if|else|while|do|for|switch|case|default|break|continue|goto|return|void|char|signed|unsigned|int|short|long|float|double|typedef|enum|struct|union|auto|extern|static|const|volatile|register)$/) # not keyword
-                                    && !(m/^\s*#\s*define\s+\w+\s+\(/); # not a macro without parameters having a body that starts with '('
+                                    && !(m/^\s*#\s*define\s+\w+\s+\(/) # not a macro without parameters having a body that starts with '('
+                                    && !(m/^\s*typedef\W/); # not a typedef
         report("missing space before '{'")   if $intra_line =~ m/[^\s{(\[]\{/;      # '{' without preceding space or {([
         report("missing space after '}'")    if $intra_line =~ m/\}[^\s,;\])}]/;    # '}' without following space or ,;])}
     }