Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260307011740.GK3520958@port70.net>
Date: Sat, 7 Mar 2026 02:17:40 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: Michael Forney <mforney@...rney.org>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH v2] mallocng: prevent stray ';' at top-level

* Michael Forney <mforney@...rney.org> [2024-04-15 03:26:17 -0700]:
> The LOCK_OBJ_DEF macro is used with a trailing semicolon. However,
> since the macro definition ends with the closing brace of a function
> definition, the ISO C grammar does not allow an extra semicolon.
> 
> To fix this, swap the order of the two definitions, and drop the
> semicolon from the __malloc_lock declaration.

fwiw i'd do the other way around: remove the ; at usage site.

this is supposed to be a macro that can expand to whatever lock
with whatever syntax at top level scope, the ; adds unnecessary
syntax constraint.

> ---
>  src/malloc/mallocng/glue.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/malloc/mallocng/glue.h b/src/malloc/mallocng/glue.h
> index 77f4c812..8c2586fb 100644
> --- a/src/malloc/mallocng/glue.h
> +++ b/src/malloc/mallocng/glue.h
> @@ -62,8 +62,8 @@ __attribute__((__visibility__("hidden")))
>  extern int __malloc_lock[1];
>  
>  #define LOCK_OBJ_DEF \
> -int __malloc_lock[1]; \
> -void __malloc_atfork(int who) { malloc_atfork(who); }
> +void __malloc_atfork(int who) { malloc_atfork(who); } \
> +int __malloc_lock[1]
>  
>  static inline void rdlock()
>  {
> -- 
> 2.49.0

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.