poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU poke 2.0.91 pre-released in alpha.gnu.org


From: Jose E. Marchesi
Subject: Re: GNU poke 2.0.91 pre-released in alpha.gnu.org
Date: Sat, 05 Feb 2022 01:58:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Thanks for the report.

> On Linux/loongarch64:
>
>                 === poke Summary ===
>
> # of expected passes            6332
> # of unsupported tests          3
>
>
> These compilation warnings (from a GCC 12 prerelease) seem to be relevant:
> ../../poke/pk-cmd-def.c:56:10: warning: argument 4 of variable length
> array 'regmatch_t[restrict __nmatch]' is null but the corresponding
> bound argument 3 value is 1 [-Wnonnull]
> ../../poke/pk-cmd-def.c:119:10: warning: argument 4 of variable length
> array 'regmatch_t[restrict __nmatch]' is null but the corresponding
> bound argument 3 value is 1 [-Wnonnull]
>
> regexec takes nmatch, pmatch arguments. If nmatch is 1, pmatch must be an
> array of length 1, not NULL.

regex(3) says:

       REG_NOSUB
              Do  not report position of matches.  The nmatch and pmatch argu‐
              ments to regexec() are ignored if the  pattern  buffer  supplied
              was compiled with this flag set.

In this case we used REG_NOSUB to compile the pattern buffer.
I committed the patch below anyway.


2022-02-05  Jose E. Marchesi  <jemarch@gnu.org>

        * poke/pk-cmd-def.c (print_var_decl): Pass a `match' argument to
        regexec.
        (print_fun_decl): Likewise.
        (print_type_decl): Likewise.
---
 ChangeLog         | 7 +++++++
 poke/pk-cmd-def.c | 9 ++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 189c2db4..f93b9b86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-02-05  Jose E. Marchesi  <jemarch@gnu.org>
+
+       * poke/pk-cmd-def.c (print_var_decl): Pass a `match' argument to
+       regexec.
+       (print_fun_decl): Likewise.
+       (print_type_decl): Likewise.
+
 2022-02-04  Jose E. Marchesi  <jemarch@gnu.org>
 
        * poke/pk-cmd-set.c (yesno_completion_function): New function.
diff --git a/poke/pk-cmd-def.c b/poke/pk-cmd-def.c
index aa57f427..76c7c828 100644
--- a/poke/pk-cmd-def.c
+++ b/poke/pk-cmd-def.c
@@ -51,9 +51,10 @@ print_var_decl (int kind,
   struct pk_info_payload *payload = (struct pk_info_payload *) data;
   pk_table table = payload->table;
   regex_t regexp = payload->regexp;
+  regmatch_t match;
 
   if (payload->regexp_p
-      && regexec (&regexp, name, 1, NULL, 0) != 0)
+      && regexec (&regexp, name, 1, &match, 0) != 0)
     return;
 
   pk_table_row (table);
@@ -83,9 +84,10 @@ print_fun_decl (int kind,
   struct pk_info_payload *payload = (struct pk_info_payload *) data;
   pk_table table = payload->table;
   regex_t regexp = payload->regexp;
+  regmatch_t match;
 
   if (payload->regexp_p
-      && regexec (&regexp, name, 1, NULL, 0) != 0)
+      && regexec (&regexp, name, 1, &match, 0) != 0)
     return;
 
   pk_table_row (table);
@@ -114,9 +116,10 @@ print_type_decl (int kind,
   struct pk_info_payload *payload = (struct pk_info_payload *) data;
   pk_table table = payload->table;
   regex_t regexp = payload->regexp;
+  regmatch_t match;
 
   if (payload->regexp_p
-      && regexec (&regexp, name, 1, NULL, 0) != 0)
+      && regexec (&regexp, name, 1, &match, 0) != 0)
     return;
 
   pk_table_row (table);
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]