]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
grepc: Fix glitch with incorrectly indented code
authorAlejandro Colomar <alx.manpages@gmail.com>
Tue, 24 May 2022 22:05:20 +0000 (00:05 +0200)
committerAlejandro Colomar <alx@kernel.org>
Wed, 29 Oct 2025 20:29:07 +0000 (21:29 +0100)
Avoid this glich from glibc:

./sysdeps/unix/sysv/linux/x86/sys/ucontext.h:133:
typedef struct
  {
    gregset_t __ctx(gregs);
    /* Note that fpregs is a pointer.  */
    fpregset_t __ctx(fpregs);
    __extension__ unsigned long long __reserved1 [8];
} mcontext_t;

/* Userlevel context.  */
typedef struct ucontext_t
  {
    unsigned long int __ctx(uc_flags);
    struct ucontext_t *uc_link;
    stack_t uc_stack;
    mcontext_t uc_mcontext;
    sigset_t uc_sigmask;
    struct _libc_fpstate __fpregs_mem;
    __extension__ unsigned long long int __ssp[4];
  } ucontext_t;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
bin/grepc

index c60e587eac4776baf36a550f8d99bfc7884a4af2..0781f5eb62e2b3eed26ad7446dd58004ef028ada 100755 (executable)
--- a/bin/grepc
+++ b/bin/grepc
@@ -282,7 +282,7 @@ grepc_type_typedef_struct_union_enum()
        grepc_helper \
          '^[ \t]*typedef\s+(struct|union|enum)\b[^;]*$' \
          "^[ \t]*}\s*$1(\[[\w\(,\)]\])*;" \
-         '(?s)^[ \t]*typedef\s+(struct|union|enum)\b(?:(?!\W'"$1"'\W)([\w \t[\]]|::))*\n*([ \t]*){(?:(?!^\3}).)*?^\3}\s*'"$1"'(\[[\w\(,\)]\])*;' \
+         '(?s)^[ \t]*typedef\s+(struct|union|enum)\b(?:(?!\W'"$1"'\W)([\w \t[\]]|::))*\n*([ \t]*){(?:(?!^\3?}).)*?^\3}\s*'"$1"'(\[[\w\(,\)]\])*;' \
          <"$files";
 }
 
@@ -341,7 +341,7 @@ grepc_use_func_def()
        grepc_helper \
          "\b$1\b" \
          '.' \
-         '(?s)^[\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+\**\w+\s*\(([\w\s\(,\)[\]*]|::)+?(\.\.\.)?\)[ \t]*\n*([ \t]*){(?:(?!^\4}).)*'"$1"'.*?^\4}' \
+         '(?s)^[\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+\**\w+\s*\(([\w\s\(,\)[\]*]|::)+?(\.\.\.)?\)[ \t]*\n*([ \t]*){(?:(?!^\4?}).)*'"$1"'.*?^\4}' \
          <"$files";
 }
 
@@ -384,7 +384,7 @@ grepc_use_type_struct_union()
        grepc_helper \
          "\b(struct|union)\b" \
          "\b$1\b" \
-         '(?s)^(?!^[ \t]*typedef\b)([\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+)?\b(struct|union)\b([\w \t[\]]|::)*\w+\n*([ \t]*){(?:(?!^\5}).)*?'"$1"'.*?^\5}.*?;' \
+         '(?s)^(?!^[ \t]*typedef\b)([\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+)?\b(struct|union)\b([\w \t[\]]|::)*\w+\n*([ \t]*){(?:(?!^\5?}).)*?'"$1"'.*?^\5}.*?;' \
          <"$files";
 }
 
@@ -404,7 +404,7 @@ grepc_use_type_typedef_struct_union()
        grepc_helper \
          '^[ \t]*typedef\s+(struct|union)\b[^;]*$' \
          "\b$1\b" \
-         '(?s)^[ \t]*typedef\s+(struct|union)\b([\w \t[\]]|::)*\n*([ \t]*){(?:(?!^\3}|^\s*typedef).)*'"$1"'(?:(?!^\3}|^\s*typedef).)*^\3}\s*\w+;' \
+         '(?s)^[ \t]*typedef\s+(struct|union)\b([\w \t[\]]|::)*\n*([ \t]*){(?:(?!^\3?}|^\s*typedef).)*'"$1"'(?:(?!^\3?}|^\s*typedef).)*^\3}\s*\w+;' \
          <"$files";
 }