[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] declare free() in lib/free.c
From: |
Bruno Haible |
Subject: |
Re: [PATCH] declare free() in lib/free.c |
Date: |
Wed, 08 Sep 2021 16:59:27 +0200 |
Hi,
> @@ -27,9 +27,11 @@
>
> # include <errno.h>
>
> +# undef free
> +void free (void *);
> +
> void
> rpl_free (void *p)
> -# undef free
> {
> # if defined __GNUC__ && !defined __clang__
> /* An invalid GCC optimization
>
>
Moving the '#undef' line up-front is generally not right: it makes it
impossible for a library, say 'libfoo', to be namespace-clean by defining
#define free libfoo_free
If there is an implicit declaration warning, it should be fixed by
including the specification header for that function. The specification
header for the 'free' function is <stdlib.h> — which is already included
at the top of free.c.
What exactly is the problem that you were seeing? (Commands to reproduce,
and compiler output, please.)
Bruno