* clang warnings in regcomp.c
@ 2020-09-07 0:45 Bruno Haible
2020-09-07 2:05 ` Paul Eggert
0 siblings, 1 reply; 3+ messages in thread
From: Bruno Haible @ 2020-09-07 0:45 UTC (permalink / raw)
To: bug-gnulib
clang produces these warning about regcomp.c:
regcomp.c(40,25): warning: redundant parentheses surrounding declarator [-Wredundant-parens]
regcomp.c(43,19): warning: redundant parentheses surrounding declarator [-Wredundant-parens]
regcomp.c(1226,44): warning: redundant parentheses surrounding declarator [-Wredundant-parens]
regcomp.c(1258,43): warning: redundant parentheses surrounding declarator [-Wredundant-parens]
What is the point of these parentheses?
Would this patch be OK (also in glibc)?
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 692928b..392d125 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -37,10 +37,10 @@ static void optimize_utf8 (re_dfa_t *dfa);
#endif
static reg_errcode_t analyze (regex_t *preg);
static reg_errcode_t preorder (bin_tree_t *root,
- reg_errcode_t (fn (void *, bin_tree_t *)),
+ reg_errcode_t fn (void *, bin_tree_t *),
void *extra);
static reg_errcode_t postorder (bin_tree_t *root,
- reg_errcode_t (fn (void *, bin_tree_t *)),
+ reg_errcode_t fn (void *, bin_tree_t *),
void *extra);
static reg_errcode_t optimize_subexps (void *extra, bin_tree_t *node);
static reg_errcode_t lower_subexps (void *extra, bin_tree_t *node);
@@ -1223,7 +1223,7 @@ analyze (regex_t *preg)
implement parse tree visits. Instead, we use parent pointers and
some hairy code in these two functions. */
static reg_errcode_t
-postorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
+postorder (bin_tree_t *root, reg_errcode_t fn (void *, bin_tree_t *),
void *extra)
{
bin_tree_t *node, *prev;
@@ -1255,7 +1255,7 @@ postorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
}
static reg_errcode_t
-preorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
+preorder (bin_tree_t *root, reg_errcode_t fn (void *, bin_tree_t *),
void *extra)
{
bin_tree_t *node;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: clang warnings in regcomp.c
2020-09-07 0:45 clang warnings in regcomp.c Bruno Haible
@ 2020-09-07 2:05 ` Paul Eggert
2020-10-10 10:45 ` Bruno Haible
0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggert @ 2020-09-07 2:05 UTC (permalink / raw)
To: Bruno Haible; +Cc: bug-gnulib
On 9/6/20 5:45 PM, Bruno Haible wrote:
> What is the point of these parentheses?
Haven't a clue. It's an unusual style.
> static reg_errcode_t preorder (bin_tree_t *root,
> - reg_errcode_t (fn (void *, bin_tree_t *)),
> + reg_errcode_t fn (void *, bin_tree_t *),
> void *extra);
For corrections like that I suggest the style "reg_errcode_t (*fn) (void *,
bin_tree_t *)" instead, as that's the usual style in glibc and I expect it is
the style that was intended in regcomp.c anyway.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: clang warnings in regcomp.c
2020-09-07 2:05 ` Paul Eggert
@ 2020-10-10 10:45 ` Bruno Haible
0 siblings, 0 replies; 3+ messages in thread
From: Bruno Haible @ 2020-10-10 10:45 UTC (permalink / raw)
To: Paul Eggert; +Cc: bug-gnulib
Paul Eggert wrote:
> > What is the point of these parentheses?
>
> Haven't a clue. It's an unusual style.
>
> > static reg_errcode_t preorder (bin_tree_t *root,
> > - reg_errcode_t (fn (void *, bin_tree_t *)),
> > + reg_errcode_t fn (void *, bin_tree_t *),
> > void *extra);
>
> For corrections like that I suggest the style "reg_errcode_t (*fn) (void *,
> bin_tree_t *)" instead, as that's the usual style in glibc and I expect it is
> the style that was intended in regcomp.c anyway.
Thanks for the advice. I reported it on the glibc tracker:
https://sourceware.org/bugzilla/show_bug.cgi?id=26725
Bruno
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-10 10:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07 0:45 clang warnings in regcomp.c Bruno Haible
2020-09-07 2:05 ` Paul Eggert
2020-10-10 10:45 ` Bruno Haible
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).