mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] mallocng: remove stray ';' at top-level
@ 2024-04-15 10:26 Michael Forney
  2024-04-16 13:45 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Forney @ 2024-04-15 10:26 UTC (permalink / raw)
  To: musl

The LOCK_OBJ_DEF macro ends with the closing brace of a
function-definition, which is a complete external-declaration. The
semicolon following the macro use is therefore unnecessary. Empty
declarations are not syntactically valid according to the ISO C
grammar, so remove it.
---
 src/malloc/mallocng/malloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/malloc/mallocng/malloc.c b/src/malloc/mallocng/malloc.c
index d695ab8e..2549eb38 100644
--- a/src/malloc/mallocng/malloc.c
+++ b/src/malloc/mallocng/malloc.c
@@ -7,7 +7,7 @@
 
 #include "meta.h"
 
-LOCK_OBJ_DEF;
+LOCK_OBJ_DEF
 
 const uint16_t size_classes[] = {
 	1, 2, 3, 4, 5, 6, 7, 8,
-- 
2.44.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [musl] [PATCH] mallocng: remove stray ';' at top-level
  2024-04-15 10:26 [musl] [PATCH] mallocng: remove stray ';' at top-level Michael Forney
@ 2024-04-16 13:45 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2024-04-16 13:45 UTC (permalink / raw)
  To: Michael Forney; +Cc: musl

On Mon, Apr 15, 2024 at 03:26:17AM -0700, Michael Forney wrote:
> The LOCK_OBJ_DEF macro ends with the closing brace of a
> function-definition, which is a complete external-declaration. The
> semicolon following the macro use is therefore unnecessary. Empty
> declarations are not syntactically valid according to the ISO C
> grammar, so remove it.
> ---
>  src/malloc/mallocng/malloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/malloc/mallocng/malloc.c b/src/malloc/mallocng/malloc.c
> index d695ab8e..2549eb38 100644
> --- a/src/malloc/mallocng/malloc.c
> +++ b/src/malloc/mallocng/malloc.c
> @@ -7,7 +7,7 @@
>  
>  #include "meta.h"
>  
> -LOCK_OBJ_DEF;
> +LOCK_OBJ_DEF
>  
>  const uint16_t size_classes[] = {
>  	1, 2, 3, 4, 5, 6, 7, 8,
> -- 
> 2.44.0

This looks like a bug in how glue.h was written when mallocng was
imported into musl; from the mallocng-draft repo, it's clear that the
intent was for the declaration in LOCK_OBJ_DEF not to end in ; so that
the code in malloc.c using the macro would be correct.

Rich

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-16 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-15 10:26 [musl] [PATCH] mallocng: remove stray ';' at top-level Michael Forney
2024-04-16 13:45 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).