bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org, Paul Eggert <eggert@cs.ucla.edu>
Cc: Lucy Phipps <landfillbaby69@gmail.com>
Subject: Re: [PATCH] declare free() in lib/free.c
Date: Wed, 08 Sep 2021 16:59:27 +0200	[thread overview]
Message-ID: <3548000.Y4W8hZkJsM@omega> (raw)
In-Reply-To: <CAGOd_F8_6dPLfW8gmQup1XnhKJSyBrdWAsvSjooO3cm6MjcOOg@mail.gmail.com>

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





  reply	other threads:[~2021-09-08 14:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08 11:42 [PATCH] declare free() in lib/free.c Lucy Phipps
2021-09-08 14:59 ` Bruno Haible [this message]
2021-09-10 10:23   ` Simon Josefsson via Gnulib discussion list
2021-09-10 11:17     ` Lucy Phipps
2021-09-10 11:24       ` Lucy Phipps

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3548000.Y4W8hZkJsM@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=landfillbaby69@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).