git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-compat-util.h: GCC deprecated message arg only in GCC 4.5+

From
Alejandro R. Sedeño <asedeno@mit.edu>
Date
Oct 6, 2022, 12:24 UTC
Message-ID
<CAOO-Oz3L7oe6SYPtp+Xgm2iJFzXkzxzkwr4LmXdN7uaye6zYQg@mail.gmail.com>
In-Reply-To
<221006.86h70hs8xb.gmgdl@evledraar.gmail.com>

Happy to do so! I build new versions of git on a few systems as they roll out, and you'll find many of my (not that many) patches involve breakage on this particularly old system. I'm sure one day a big change will break git for good there, but in the meantime I'll do what I can to keep it going. :-)

-Alejandro
On Thu, Oct 6, 2022 at 3:33 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 50 quoted lines
>
>
> 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!
Previous: Ævar Arnfjörð BjarmasonNext: Alejandro R. Sedeño
Message 3 of 4 in “git-compat-util.h: GCC deprecated message arg only in GCC 4.5+”
  1. git-compat-util.h: GCC deprecated message arg only in GCC 4.5+Aleajndro R Sedeño, Oct 5, 2022
  2. Ævar Arnfjörð BjarmasonOct 6, 2022
  3. Alejandro R. SedeñoOct 6, 2022
  4. Alejandro R. SedeñoOct 5, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.