Build Failure: Git 2.50.0-rc0 on NonStop
I encountered the following failure of rc0:
static void file_release_data(void *b REFTABLE_UNUSED, struct reftable_block_data *dest REFTABLE_UNUSED)
^
"/home/jenkinsbuild/.jenkins/workspace/Git_Pipeline/reftable/blocksource.c", line 105: error(112): expected a ")"
I am not at all sure why this is failing at this point. Compiler is c99.
--
Brief whoami: NonStop&UNIX developer since approximately UNIX(421664400)
NonStop(211288444200000000)
-- In real life, I talk too much.
PATCH 1/1 reftable: make REFTABLE_UNUSED C99 compatible
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.
--- reftable/basics.h | 4 ++++ 1 file changed, 4 insertions(+)
reftable/basics.h +4 -0
@@ -16,7 +16,11 @@#include "system.h" #include "reftable-basics.h" +#ifdef __GNUC__#define REFTABLE_UNUSED __attribute__((__unused__)) +#else +#define REFTABLE_UNUSED +#endif /* * Initialize the buffer such that it is ready for use. This is equivalent to
Signature · 1 line
2.50.0.rc0.1.gb4243b6ac8
Re: [PATCH] reftable: make REFTABLE_UNUSED C99 compatible
Quoted 8 lines · Carlo Marcelo Arenas Belón
Since
f93b2a0424(reftable/basics: introduceREFTABLE_UNUSEDannotation, 2025-02-18), the reftable library was migrated to use an internal version ofUNUSED, 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.
Quoted 11 lines
Reported-by "Randall S. Becker" <[email protected]>Signed-off-by Carlo Marcelo Arenas Belón <[email protected]>--- reftable/basics.h | 4 ++++ 1 file changed, 4 insertions(+)reftable/basics.h +0
-0
reftable/basics.h line 23
Quoted 8 lines
reftable/basics.h +4
-0@@ -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
#endifGCC 4.5 or older may no longer be relevant, in which case yours may be good enough.
Will queue. Thanks.
Re: [PATCH] reftable: make REFTABLE_UNUSED C99 compatible
Quoted 13 lines · Junio C Hamano
Corresponding definition we use in the main part of the project defined in
compat/posix.hlooks 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
Quoted 2 lines
GCC 4.5 or older may no longer be relevant, in which case yours may be good enough.
RHEL 7, which is now well past EOL, had GCC 4.8 and Debian 7, released in 2013 and also well past EOL, had GCC 4.7. I think we can safely assume nobody within our support policy is using GCC before 4.5.
Signature · 2 lines
brian m. carlson (they/them) Toronto, Ontario, CA
Re: [PATCH] reftable: make REFTABLE_UNUSED C99 compatible
Quoted 14 lines · brian m. carlson
Quoted 13 lines · Junio C Hamano
Corresponding definition we use in the main part of the project defined in
compat/posix.hlooks 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
Quoted 6 lines
Quoted 2 lines
GCC 4.5 or older may no longer be relevant, in which case yours may be good enough.
RHEL 7, which is now well past EOL, had GCC 4.8 and Debian 7, released in 2013 and also well past EOL, had GCC 4.7. I think we can safely assume nobody within our support policy is using GCC before 4.5.
Good digging. There is another one in git-compat-util.h that is conditional on GIT_GNUC_PREREQ(3,1) which we can simplify away to just "#ifdef __GNUC__", together with the above. Of course totally outside of Carlo's fix to the reftable library.
Thanks.
Re: [PATCH] reftable: make REFTABLE_UNUSED C99 compatible
In reply to Junio C HamanoQuoted 46 lines · Junio C Hamano
Quoted 8 lines · Carlo Marcelo Arenas Belón
Since
f93b2a0424(reftable/basics: introduceREFTABLE_UNUSEDannotation, 2025-02-18), the reftable library was migrated to use an internal version ofUNUSED, 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.
Quoted 11 lines
Reported-by "Randall S. Becker" <[email protected]>Signed-off-by Carlo Marcelo Arenas Belón <[email protected]>--- reftable/basics.h | 4 ++++ 1 file changed, 4 insertions(+)reftable/basics.h +0
-0reftable/basics.h line 23
Quoted 8 lines
reftable/basics.h +4
-0@@ -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.hlooks 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
Quoted 2 lines
GCC 4.5 or older may no longer be relevant, in which case yours may be good enough.
What I don't understand though: we have a MAYBE_UNUSED macro that has the exact same definition in "git-compat-util.h". Why does the macro cause issues in the reftable library, but not over there?
Patrick
Re: [PATCH] reftable: make REFTABLE_UNUSED C99 compatible
Quoted 3 lines · Patrick Steinhardt
What I don't understand though: we have a
MAYBE_UNUSEDmacro that has the exact same definition in "git-compat-util.h". Why does the macro cause issues in the reftable library, but not over there?
We turn __attribute__() into a noop for some platforms earlier in git-compat-util.h. So it doesn't need a separate #ifdef.
-Peff
Re: [PATCH] reftable: make REFTABLE_UNUSED C99 compatible
Quoted 8 lines · Jeff King
Quoted 3 lines · Patrick Steinhardt
What I don't understand though: we have a
MAYBE_UNUSEDmacro that has the exact same definition in "git-compat-util.h". Why does the macro cause issues in the reftable library, but not over there?We turn
__attribute__()into a noop for some platforms earlier ingit-compat-util.h. So it doesn't need a separate #ifdef.
Ah, that's something I missed when introducing REFTABLE_UNUSED. With that added context the patch looks sensible to me. Thanks!
Patrick
Re: [PATCH] reftable: make REFTABLE_UNUSED C99 compatible
Quoted 2 lines · Patrick Steinhardt
Ah, that's something I missed when introducing
REFTABLE_UNUSED. With that added context the patch looks sensible to me. Thanks!
OK, let's fast-track the fix down to 'master' before '-rc1', then.
Thanks, all.
Quoted 7 lines · On May 28, 2025 2:59 PM, I wrote:
To: [email protected]
I encountered the following failure of rc0:static void
file_release_data(void *b REFTABLE_UNUSED, struct reftable_block_data *dest REFTABLE_UNUSED)^"
/home/jenkinsbuild/.jenkins/workspace/Git_Pipeline/reftable/blocksource.c"
,
Quoted 4 lines
line 105: error(112): expected a ")"
I am not at all sure why this is failing at this point. Compiler is c99.
Looking for help on resolving this before rc1.
Sincerely,
Randall
Quoted 4 lines · On Fri, May 30, 2025, at 14:04, [email protected] wrote:
Quoted 2 lines
[snip]
I am not at all sure why this is failing at this point. Compiler is c99.Looking for help on resolving this before rc1.
Quoted 8 lines · On Fri, May 30, 2025 at 08:04:47AM -0400, [email protected] wrote:
Quoted 7 lines · On May 28, 2025 2:59 PM, I wrote:
To: [email protected]
I encountered the following failure of rc0:static void
file_release_data(void *b REFTABLE_UNUSED, struct reftable_block_data *dest REFTABLE_UNUSED)^"
/home/jenkinsbuild/.jenkins/workspace/Git_Pipeline/reftable/blocksource.c"
Quoted 7 lines
,
Quoted 4 lines
line 105: error(112): expected a ")"
I am not at all sure why this is failing at this point. Compiler is c99.
Looking for help on resolving this before rc1.
Did you maybe miss the proposed patch at [1]? That should fix your issue.
Patrick
[1]: <[email protected]>
Quoted 11 lines · Patrick Steinhardt
Quoted 8 lines · On Fri, May 30, 2025 at 08:04:47AM -0400, [email protected] wrote:
Quoted 6 lines · On May 28, 2025 2:59 PM, I wrote:
To: [email protected]
I encountered the following failure of rc0:static void
file_release_data(void *b REFTABLE_UNUSED, struct reftable_block_data *dest REFTABLE_UNUSED)^"
/home/jenkinsbuild/.jenkins/workspace/Git_Pipeline/reftable/blocksource.c"Quoted 1 line
,
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
line 105: error(112): expected a ")"
I am not at all sure why this is failing at this point. Compiler is c99.
Looking for help on resolving this before rc1.
Did you maybe miss the proposed patch at [1]? That should fix your issue.
Thanks Patrick. As a packager, I can only build using merged fixes for 2.25.0-rc*. I'm hoping this
makes rc1