{"thread":{"id":"58570","subject":"[PATCH] git-compat-util.h: GCC deprecated message arg only in GCC 4.5+","startedAt":"2022-10-05T22:19:47Z","lastAt":"2022-10-06T12:24:36Z","messageCount":4,"participants":["Aleajndro R Sedeño","Alejandro R. Sedeño","Ævar Arnfjörð Bjarmason"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"464266","messageId":"20221005221928.703750-1-asedeno@google.com","threadId":"58570","inReplyTo":"xmqqilkynd91.fsf@gitster.g","subject":"[PATCH] git-compat-util.h: GCC deprecated message arg only in GCC 4.5+","fromName":"Aleajndro R Sedeño","fromEmail":"asedeno@google.com","sentAt":"2022-10-05T22:19:28Z","receivedAt":"2022-10-05T22:19:47Z","isPatch":true,"sender":{"key":"asedeno@google.com","avatar":"https://gravatar.com/avatar/5589bf0d288cb128a897149ca48feac7ae29cfa16b4d1452b37db5909405b6c6?d=mp&s=160"},"body":"From: Alejandro R. Sedeño <asedeno@mit.edu>\n\nFrom: https://gcc.gnu.org/gcc-4.5/changes.html\n\n> The deprecated attribute now takes an optional string argument, for\n> example, __attribute__((deprecated(\"text string\"))), that will be\n> printed together with the deprecation warning.\n\nWhile GCC 4.5 is already 12 years old, git checks for even older\nversions in places. Let's not needlessly break older compilers when\na small and simple fix is readily available.\n\nSigned-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\nSigned-off-by: Alejandro R Sedeño <asedeno@google.com>\n---\n git-compat-util.h | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex b90b64718e..045b47f83a 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -189,9 +189,12 @@ struct strbuf;\n #define _NETBSD_SOURCE 1\n #define _SGI_SOURCE 1\n \n-#if defined(__GNUC__)\n+#if GIT_GNUC_PREREQ(4, 5)\n #define UNUSED __attribute__((unused)) \\\n \t__attribute__((deprecated (\"parameter declared as UNUSED\")))\n+#elif defined(__GNUC__)\n+#define UNUSED __attribute__((unused)) \\\n+\t__attribute__((deprecated))\n #else\n #define UNUSED\n #endif\n-- \n2.38.0.rc1.362.ged0d419d3c-goog\n\n"},{"id":"464268","messageId":"CAOO-Oz1gQJJDiweWjeJAKq1ooVDwH629sXUAGPRd=efxJHK6yA@mail.gmail.com","threadId":"58570","inReplyTo":"xmqqilkynd91.fsf@gitster.g","subject":"Re: [PATCH] git-compat-util.h: GCC deprecated only takes a message in GCC 4.5+","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2022-10-05T22:22:38Z","receivedAt":"2022-10-05T22:22:58Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"Sorry for the subject line change; I had hoped that --in-reply-to\nwould get it threaded properly and wanted to trim it down a bit.\n\n-> \"[PATCH] git-compat-util.h: GCC deprecated message arg only in GCC 4.5+\"\n\n-Alejandro\n\nOn Wed, Oct 5, 2022 at 5:59 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> \"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n>\n> > On 2022-10-03 at 21:23:18, Aleajndro R Sedeño wrote:\n> >> From: Alejandro R. Sedeño <asedeno@mit.edu>\n> >>\n> >> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n> >> Signed-off-by: Alejandro R Sedeño <asedeno@google.com>\n> >\n> > It might be helpful to explain what system you're targeting when you see\n> > this.  CentOS 7 has GCC 4.8, and I'm not aware of any systems with an\n> > older compiler receiving publicly available updates still.  We've fairly\n> > recently only been testing and targeting GCC 4.8 for that reason.\n>\n> I do agree with you that an update to give \"why\" in the proposed log\n> message would be very welcome, e.g. \"Even though such an ancient\n> compiler may not matter much in real life, a workaround is simple\n> enough.\" or something along that line.\n>\n> As to the change in the patch, I think it is good.\n>\n> Thanks, all.  Expecting an updated version which hopefully would\n> become the final version ;-)\n>\n>\n"},{"id":"464275","messageId":"221006.86h70hs8xb.gmgdl@evledraar.gmail.com","threadId":"58570","inReplyTo":"20221005221928.703750-1-asedeno@google.com","subject":"Re: [PATCH] git-compat-util.h: GCC deprecated message arg only in GCC 4.5+","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-10-06T07:31:45Z","receivedAt":"2022-10-06T07:34:04Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Oct 05 2022, Aleajndro R Sedeño wrote:\n\n> From: Alejandro R. Sedeño <asedeno@mit.edu>\n>\n> From: https://gcc.gnu.org/gcc-4.5/changes.html\n>\n>> The deprecated attribute now takes an optional string argument, for\n>> example, __attribute__((deprecated(\"text string\"))), that will be\n>> printed together with the deprecation warning.\n>\n> While GCC 4.5 is already 12 years old, git checks for even older\n> versions in places. Let's not needlessly break older compilers when\n> a small and simple fix is readily available.\n>\n> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n> Signed-off-by: Alejandro R Sedeño <asedeno@google.com>\n> ---\n>  git-compat-util.h | 5 ++++-\n>  1 file changed, 4 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index b90b64718e..045b47f83a 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -189,9 +189,12 @@ struct strbuf;\n>  #define _NETBSD_SOURCE 1\n>  #define _SGI_SOURCE 1\n>  \n> -#if defined(__GNUC__)\n> +#if GIT_GNUC_PREREQ(4, 5)\n>  #define UNUSED __attribute__((unused)) \\\n>  \t__attribute__((deprecated (\"parameter declared as UNUSED\")))\n> +#elif defined(__GNUC__)\n> +#define UNUSED __attribute__((unused)) \\\n> +\t__attribute__((deprecated))\n>  #else\n>  #define UNUSED\n>  #endif\n\nThis LGTM, thanks a lot for that fix & fixing this (minor) breakage of\nmine.\n\nI did test on an older GCC myself, and then (in lieu of logging into an\nancient system I have access to) scoured the release notes of gcc, and\ndiscovered that \"deprecated\" was older than anything we cared about.\n\nBut I obviously missed that while the feature had been there for a\nlonger time, it didn't take this parameter until GCC 4.5, sorry!\n"},{"id":"464284","messageId":"CAOO-Oz3L7oe6SYPtp+Xgm2iJFzXkzxzkwr4LmXdN7uaye6zYQg@mail.gmail.com","threadId":"58570","inReplyTo":"221006.86h70hs8xb.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH] git-compat-util.h: GCC deprecated message arg only in GCC 4.5+","fromName":"Alejandro R. Sedeño","fromEmail":"asedeno@mit.edu","sentAt":"2022-10-06T12:24:10Z","receivedAt":"2022-10-06T12:24:36Z","isPatch":true,"sender":{"key":"asedeno@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28302?v=4"},"body":"Happy to do so! I build new versions of git on a few systems as they\nroll out, and you'll find many of my (not that many) patches involve\nbreakage on this particularly old system. I'm sure one day a big\nchange will break git for good there, but in the meantime I'll do what\nI can to keep it going. :-)\n\n-Alejandro\n\nOn Thu, Oct 6, 2022 at 3:33 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n>\n>\n> On Wed, Oct 05 2022, Aleajndro R Sedeño wrote:\n>\n> > From: Alejandro R. Sedeño <asedeno@mit.edu>\n> >\n> > From: https://gcc.gnu.org/gcc-4.5/changes.html\n> >\n> >> The deprecated attribute now takes an optional string argument, for\n> >> example, __attribute__((deprecated(\"text string\"))), that will be\n> >> printed together with the deprecation warning.\n> >\n> > While GCC 4.5 is already 12 years old, git checks for even older\n> > versions in places. Let's not needlessly break older compilers when\n> > a small and simple fix is readily available.\n> >\n> > Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>\n> > Signed-off-by: Alejandro R Sedeño <asedeno@google.com>\n> > ---\n> >  git-compat-util.h | 5 ++++-\n> >  1 file changed, 4 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/git-compat-util.h b/git-compat-util.h\n> > index b90b64718e..045b47f83a 100644\n> > --- a/git-compat-util.h\n> > +++ b/git-compat-util.h\n> > @@ -189,9 +189,12 @@ struct strbuf;\n> >  #define _NETBSD_SOURCE 1\n> >  #define _SGI_SOURCE 1\n> >\n> > -#if defined(__GNUC__)\n> > +#if GIT_GNUC_PREREQ(4, 5)\n> >  #define UNUSED __attribute__((unused)) \\\n> >       __attribute__((deprecated (\"parameter declared as UNUSED\")))\n> > +#elif defined(__GNUC__)\n> > +#define UNUSED __attribute__((unused)) \\\n> > +     __attribute__((deprecated))\n> >  #else\n> >  #define UNUSED\n> >  #endif\n>\n> This LGTM, thanks a lot for that fix & fixing this (minor) breakage of\n> mine.\n>\n> I did test on an older GCC myself, and then (in lieu of logging into an\n> ancient system I have access to) scoured the release notes of gcc, and\n> discovered that \"deprecated\" was older than anything we cared about.\n>\n> But I obviously missed that while the feature had been there for a\n> longer time, it didn't take this parameter until GCC 4.5, sorry!\n"}]}