git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Cc: git@vger.kernel.org,  ps@pks.im,
	 "Randall S. Becker" <rsbecker@nexbridge.com>
Subject: Re: [PATCH] reftable: make REFTABLE_UNUSED C99 compatible
Date: Thu, 29 May 2025 09:17:14 -0700	[thread overview]
Message-ID: <xmqqtt53l7cl.fsf@gitster.g> (raw)
In-Reply-To: <20250529101136.16219-1-carenas@gmail.com> ("Carlo Marcelo Arenas Belón"'s message of "Thu, 29 May 2025 03:11:36 -0700")

Carlo Marcelo Arenas Belón <carenas@gmail.com> writes:

> Since f93b2a0424 (reftable/basics: introduce `REFTABLE_UNUSED`
> annotation, 2025-02-18), the reftable library was migrated to
> use an internal version of `UNUSED`, which unconditionally sets
> a GNU __attribute__ to avoid warnings function parameters that
> are not being used.
>
> Make the definition conditional to prevent breaking the build
> with non GNU compilers.

Quite a reasonable reasoning.

> Reported-by: "Randall S. Becker" <rsbecker@nexbridge.com>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
>  reftable/basics.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/reftable/basics.h b/reftable/basics.h
> index d8888c1262..7d22f96261 100644
> --- a/reftable/basics.h
> +++ b/reftable/basics.h
> @@ -16,7 +16,11 @@
>  #include "system.h"
>  #include "reftable-basics.h"
>  
> +#ifdef __GNUC__
>  #define REFTABLE_UNUSED __attribute__((__unused__))
> +#else
> +#define REFTABLE_UNUSED
> +#endif

Corresponding definition we use in the main part of the project
defined in compat/posix.h looks like this:

        #if GIT_GNUC_PREREQ(4, 5)
        #define UNUSED __attribute__((unused)) \
                __attribute__((deprecated ("parameter declared as UNUSED")))
        #elif defined(__GNUC__)
        #define UNUSED __attribute__((unused)) \
                __attribute__((deprecated))
        #else
        #define UNUSED
        #endif

GCC 4.5 or older may no longer be relevant, in which case yours may
be good enough.

Will queue.  Thanks.

  reply	other threads:[~2025-05-29 16:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-28 18:59 Build Failure: Git 2.50.0-rc0 on NonStop rsbecker
2025-05-29 10:11 ` [PATCH] reftable: make REFTABLE_UNUSED C99 compatible Carlo Marcelo Arenas Belón
2025-05-29 16:17   ` Junio C Hamano [this message]
2025-05-29 23:13     ` brian m. carlson
2025-05-30  4:12       ` Junio C Hamano
2025-05-30  5:35     ` Patrick Steinhardt
2025-05-30  6:25       ` Jeff King
2025-05-30  8:47         ` Patrick Steinhardt
2025-05-30 16:28           ` Junio C Hamano
2025-05-30 12:04 ` [Bug] Build Failure: Git 2.50.0-rc0 on NonStop rsbecker
2025-05-30 14:19   ` Kristoffer Haugsbakk
2025-05-30 14:26   ` Patrick Steinhardt
2025-06-01  9:36     ` rsbecker

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

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

  git send-email \
    --in-reply-to=xmqqtt53l7cl.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=carenas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    --cc=rsbecker@nexbridge.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 NNTP newsgroup(s).