Skip to contentSkip to conversation

Build Failure: Git 2.50.0-rc0 on NonStop

PATCH In review [email protected] 7 participants 13 messages May 28, 2025 – Jun 1, 2025

lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw

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
index d8888c1262..7d22f96261 100644
@@ -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
#2 lore raw

Re: [PATCH] reftable: make REFTABLE_UNUSED C99 compatible

Quoted 8 lines · Carlo Marcelo Arenas Belón

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.

Quoted 11 lines
---
 reftable/basics.h | 4 ++++
 1 file changed, 4 insertions(+)
reftable/basics.h +0 -0
index d8888c1262..7d22f96261 100644

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
        #endif

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

Will queue. Thanks.

#3 lore raw

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.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
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
#4 lore raw

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.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
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.

#5 lore raw

Re: [PATCH] reftable: make REFTABLE_UNUSED C99 compatible

In reply to Junio C Hamano
Quoted 46 lines · Junio C Hamano
Quoted 8 lines · Carlo Marcelo Arenas Belón

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.

Quoted 11 lines
---
 reftable/basics.h | 4 ++++
 1 file changed, 4 insertions(+)
reftable/basics.h +0 -0
index d8888c1262..7d22f96261 100644

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
        #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

#6 lore raw

Re: [PATCH] reftable: make REFTABLE_UNUSED C99 compatible

Quoted 3 lines · Patrick Steinhardt

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?

We turn __attribute__() into a noop for some platforms earlier in git-compat-util.h. So it doesn't need a separate #ifdef.

-Peff

#7 lore raw

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_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?

We turn __attribute__() into a noop for some platforms earlier in git-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

#8 lore raw

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.

#9 lore raw
In reply to [email protected]
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

#11 lore raw
In reply to [email protected]
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]>

#12 lore raw
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