All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "Aleajndro R Sedeño" <asedeno@google.com>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	"Alejandro R. Sedeño" <asedeno@mit.edu>
Subject: Re: [PATCH] git-compat-util.h: GCC deprecated message arg only in GCC 4.5+
Date: Thu, 06 Oct 2022 09:31:45 +0200	[thread overview]
Message-ID: <221006.86h70hs8xb.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <20221005221928.703750-1-asedeno@google.com>


On Wed, Oct 05 2022, Aleajndro R Sedeño wrote:

> From: Alejandro R. Sedeño <asedeno@mit.edu>
>
> From: https://gcc.gnu.org/gcc-4.5/changes.html
>
>> The deprecated attribute now takes an optional string argument, for
>> example, __attribute__((deprecated("text string"))), that will be
>> printed together with the deprecation warning.
>
> While GCC 4.5 is already 12 years old, git checks for even older
> versions in places. Let's not needlessly break older compilers when
> a small and simple fix is readily available.
>
> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
> Signed-off-by: Alejandro R Sedeño <asedeno@google.com>
> ---
>  git-compat-util.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/git-compat-util.h b/git-compat-util.h
> index b90b64718e..045b47f83a 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -189,9 +189,12 @@ struct strbuf;
>  #define _NETBSD_SOURCE 1
>  #define _SGI_SOURCE 1
>  
> -#if defined(__GNUC__)
> +#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

This LGTM, thanks a lot for that fix & fixing this (minor) breakage of
mine.

I did test on an older GCC myself, and then (in lieu of logging into an
ancient system I have access to) scoured the release notes of gcc, and
discovered that "deprecated" was older than anything we cared about.

But I obviously missed that while the feature had been there for a
longer time, it didn't take this parameter until GCC 4.5, sorry!

  reply	other threads:[~2022-10-06  7:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-03 21:23 [PATCH] git-compat-util.h: GCC deprecated only takes a message in GCC 4.5+ Aleajndro R Sedeño
2022-10-03 22:25 ` brian m. carlson
2022-10-03 23:45   ` Alejandro R. Sedeño
2022-10-05 14:53     ` Jeff King
2022-10-06  7:29       ` Ævar Arnfjörð Bjarmason
2022-10-06 12:16         ` Jeff King
2022-10-06 21:15           ` Ævar Arnfjörð Bjarmason
2022-10-11  0:22             ` Jeff King
     [not found]   ` <xmqqilkynd91.fsf@gitster.g>
2022-10-05 22:19     ` [PATCH] git-compat-util.h: GCC deprecated message arg only " Aleajndro R Sedeño
2022-10-06  7:31       ` Ævar Arnfjörð Bjarmason [this message]
2022-10-06 12:24         ` Alejandro R. Sedeño
2022-10-05 22:22     ` [PATCH] git-compat-util.h: GCC deprecated only takes a message " Alejandro R. Sedeño
2022-10-06  7:33   ` Ævar Arnfjörð Bjarmason

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=221006.86h70hs8xb.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=asedeno@google.com \
    --cc=asedeno@mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sandals@crustytoothpaste.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.