* [XEN PATCH 0/3] Drop alternative definitions for unsupported GCCs
@ 2025-08-13 19:12 nicola.vetrini
2025-08-13 19:12 ` [XEN PATCH 1/3] xen/compiler: drop alternative unreachable() definition for older GCC nicola.vetrini
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: nicola.vetrini @ 2025-08-13 19:12 UTC (permalink / raw)
To: xen-devel
Cc: Nicola Vetrini, Andrew Cooper, Anthony PERARD, Michal Orzel,
Jan Beulich, Julien Grall, Roger Pau Monné,
Stefano Stabellini, Daniel P. Smith,
Marek Marczykowski-Górecki
From: Nicola Vetrini <nicola.vetrini@gmail.com>
Similar to e4a042062787, drop alternative defines for older GCC versions
Nicola Vetrini (3):
xen/compiler: drop alternative unreachable() definition for older GCC
xen/macros: Drop alternative definition of BUILD_BUG_ON(_ZERO)? for
old GCC
xen/efi: efibind: Drop alternative define for old GCC versions
xen/arch/x86/include/asm/x86_64/efibind.h | 4 +---
xen/include/xen/compiler.h | 4 ----
xen/include/xen/macros.h | 8 --------
3 files changed, 1 insertion(+), 15 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 10+ messages in thread* [XEN PATCH 1/3] xen/compiler: drop alternative unreachable() definition for older GCC 2025-08-13 19:12 [XEN PATCH 0/3] Drop alternative definitions for unsupported GCCs nicola.vetrini @ 2025-08-13 19:12 ` nicola.vetrini 2025-08-13 22:32 ` Andrew Cooper 2025-08-13 19:12 ` [XEN PATCH 2/3] xen/macros: Drop alternative definition of BUILD_BUG_ON(_ZERO)? for old GCC nicola.vetrini 2025-08-13 19:12 ` [XEN PATCH 3/3] xen/efi: efibind: Drop alternative define for old GCC versions nicola.vetrini 2 siblings, 1 reply; 10+ messages in thread From: nicola.vetrini @ 2025-08-13 19:12 UTC (permalink / raw) To: xen-devel Cc: Nicola Vetrini, Andrew Cooper, Anthony PERARD, Michal Orzel, Jan Beulich, Julien Grall, Roger Pau Monné, Stefano Stabellini From: Nicola Vetrini <nicola.vetrini@gmail.com> The GCC baseline version is 5.1, which supports __builtin_unreachable(), therefore the alternative definition can be dropped Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com> --- Mentioned in https://gitlab.com/xen-project/xen/-/issues/201 --- xen/include/xen/compiler.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h index 735c844d2d15..88bf26bc5109 100644 --- a/xen/include/xen/compiler.h +++ b/xen/include/xen/compiler.h @@ -47,11 +47,7 @@ # define cf_check #endif -#if (!defined(__clang__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5)) -#define unreachable() do {} while (1) -#else #define unreachable() __builtin_unreachable() -#endif /* * Compilers estimate the size of an asm() block for inlining purposes. -- 2.43.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [XEN PATCH 1/3] xen/compiler: drop alternative unreachable() definition for older GCC 2025-08-13 19:12 ` [XEN PATCH 1/3] xen/compiler: drop alternative unreachable() definition for older GCC nicola.vetrini @ 2025-08-13 22:32 ` Andrew Cooper 0 siblings, 0 replies; 10+ messages in thread From: Andrew Cooper @ 2025-08-13 22:32 UTC (permalink / raw) To: nicola.vetrini, xen-devel Cc: Anthony PERARD, Michal Orzel, Jan Beulich, Julien Grall, Roger Pau Monné, Stefano Stabellini On 13/08/2025 8:12 pm, nicola.vetrini@gmail.com wrote: > From: Nicola Vetrini <nicola.vetrini@gmail.com> > > The GCC baseline version is 5.1, which supports __builtin_unreachable(), > therefore the alternative definition can be dropped > > Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com> > --- > Mentioned in https://gitlab.com/xen-project/xen/-/issues/201 Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> ^ permalink raw reply [flat|nested] 10+ messages in thread
* [XEN PATCH 2/3] xen/macros: Drop alternative definition of BUILD_BUG_ON(_ZERO)? for old GCC 2025-08-13 19:12 [XEN PATCH 0/3] Drop alternative definitions for unsupported GCCs nicola.vetrini 2025-08-13 19:12 ` [XEN PATCH 1/3] xen/compiler: drop alternative unreachable() definition for older GCC nicola.vetrini @ 2025-08-13 19:12 ` nicola.vetrini 2025-08-13 22:33 ` Andrew Cooper 2025-08-14 8:07 ` Jan Beulich 2025-08-13 19:12 ` [XEN PATCH 3/3] xen/efi: efibind: Drop alternative define for old GCC versions nicola.vetrini 2 siblings, 2 replies; 10+ messages in thread From: nicola.vetrini @ 2025-08-13 19:12 UTC (permalink / raw) To: xen-devel Cc: Nicola Vetrini, Andrew Cooper, Anthony PERARD, Michal Orzel, Jan Beulich, Julien Grall, Roger Pau Monné, Stefano Stabellini From: Nicola Vetrini <nicola.vetrini@gmail.com> The toolchain baseline for GCC is 5.1, which supports _Static_assert in c99 mode No functional change. Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com> --- Mentioned in https://gitlab.com/xen-project/xen/-/issues/201 --- xen/include/xen/macros.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/xen/include/xen/macros.h b/xen/include/xen/macros.h index cd528fbdb127..f9ccde86fb23 100644 --- a/xen/include/xen/macros.h +++ b/xen/include/xen/macros.h @@ -40,9 +40,6 @@ #ifndef __ASSEMBLY__ -/* All clang versions supported by Xen have _Static_assert. */ -#if defined(__clang__) || \ - (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) /* Force a compilation error if condition is true */ #define BUILD_BUG_ON(cond) ({ _Static_assert(!(cond), "!(" #cond ")"); }) @@ -54,11 +51,6 @@ */ #define BUILD_BUG_ON_ZERO(cond) \ (sizeof(struct { char c; _Static_assert(!(cond), "!(" #cond ")"); }) & 0) -#else -#define BUILD_BUG_ON_ZERO(cond) \ - (sizeof(struct { unsigned u : !(cond); }) & 0) -#define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond)) -#endif /* * Force a compilation error. This is for code which, in the normal case, -- 2.43.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [XEN PATCH 2/3] xen/macros: Drop alternative definition of BUILD_BUG_ON(_ZERO)? for old GCC 2025-08-13 19:12 ` [XEN PATCH 2/3] xen/macros: Drop alternative definition of BUILD_BUG_ON(_ZERO)? for old GCC nicola.vetrini @ 2025-08-13 22:33 ` Andrew Cooper 2025-08-14 8:07 ` Jan Beulich 1 sibling, 0 replies; 10+ messages in thread From: Andrew Cooper @ 2025-08-13 22:33 UTC (permalink / raw) To: nicola.vetrini, xen-devel Cc: Anthony PERARD, Michal Orzel, Jan Beulich, Julien Grall, Roger Pau Monné, Stefano Stabellini On 13/08/2025 8:12 pm, nicola.vetrini@gmail.com wrote: > From: Nicola Vetrini <nicola.vetrini@gmail.com> > > The toolchain baseline for GCC is 5.1, which supports _Static_assert > in c99 mode > > No functional change. > > Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com> > --- > Mentioned in https://gitlab.com/xen-project/xen/-/issues/201 Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [XEN PATCH 2/3] xen/macros: Drop alternative definition of BUILD_BUG_ON(_ZERO)? for old GCC 2025-08-13 19:12 ` [XEN PATCH 2/3] xen/macros: Drop alternative definition of BUILD_BUG_ON(_ZERO)? for old GCC nicola.vetrini 2025-08-13 22:33 ` Andrew Cooper @ 2025-08-14 8:07 ` Jan Beulich 2025-08-14 9:16 ` Nicola Vetrini 1 sibling, 1 reply; 10+ messages in thread From: Jan Beulich @ 2025-08-14 8:07 UTC (permalink / raw) To: nicola.vetrini Cc: Andrew Cooper, Anthony PERARD, Michal Orzel, Julien Grall, Roger Pau Monné, Stefano Stabellini, xen-devel On 13.08.2025 21:12, nicola.vetrini@gmail.com wrote: > From: Nicola Vetrini <nicola.vetrini@gmail.com> > > The toolchain baseline for GCC is 5.1, which supports _Static_assert > in c99 mode Hmm, interesting. I can confirm the behavior, but isn't this a bug? There's no _Static_assert() in plain C99. Respective notes in the "Changes, New Features, and Fixes" are also saying otherwise: https://gcc.gnu.org/gcc-4.6/changes.html has "This support may be selected with -std=c1x, or -std=gnu1x for C1X with GNU extensions." Nothing new is said in any of the respective documents up to the release of gcc5. (In fact, the compiler accepts the construct even with -std=c89.) Our misra/C-language-toolchain.rst refers to a section in gcc12's doc which doesn't mention _Static_assert() at all, afaics. Jan ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [XEN PATCH 2/3] xen/macros: Drop alternative definition of BUILD_BUG_ON(_ZERO)? for old GCC 2025-08-14 8:07 ` Jan Beulich @ 2025-08-14 9:16 ` Nicola Vetrini 0 siblings, 0 replies; 10+ messages in thread From: Nicola Vetrini @ 2025-08-14 9:16 UTC (permalink / raw) To: Jan Beulich Cc: Andrew Cooper, Anthony PERARD, Michal Orzel, Julien Grall, Roger Pau Monné, Stefano Stabellini, xen-devel [-- Attachment #1: Type: text/plain, Size: 1722 bytes --] On Thu, Aug 14, 2025, 10:08 Jan Beulich <jbeulich@suse.com> wrote: > On 13.08.2025 21:12, nicola.vetrini@gmail.com wrote: > > From: Nicola Vetrini <nicola.vetrini@gmail.com> > > > > The toolchain baseline for GCC is 5.1, which supports _Static_assert > > in c99 mode > > Hmm, interesting. I can confirm the behavior, but isn't this a bug? > There's no > _Static_assert() in plain C99. Respective notes in the "Changes, New > Features, > and Fixes" are also saying otherwise: > https://gcc.gnu.org/gcc-4.6/changes.html > has "This support may be selected with -std=c1x, or -std=gnu1x for C1X with > GNU extensions." Nothing new is said in any of the respective documents up > to > the release of gcc5. (In fact, the compiler accepts the construct even with > -std=c89.) > Some features that are part of the C99 standard are accepted as extensions in C90 mode, and some features that are part of the C11 standard are accepted as extensions in C90 and C99 modes. Use of the -std options listed above disables these extensions where they conflict with the C standard version selected If my reading is correct then this paragraph gives them the leeway needed to use it even in c89, except maybe with -pedantic > Our misra/C-language-toolchain.rst refers to a section in gcc12's doc which > doesn't mention _Static_assert() at all, afaics. > > Jan > I can check with my colleagues, but I suspect this is not documented as an extension by GCC because it's not one in C11, and gcc12 supports all(?) of C11, therefore it is an extension only with respect to certain conditions, which GCC does not use as a category in their docs, but we keep track of what is an extension and what is not, given the CU standard selected. > [-- Attachment #2: Type: text/html, Size: 2925 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* [XEN PATCH 3/3] xen/efi: efibind: Drop alternative define for old GCC versions 2025-08-13 19:12 [XEN PATCH 0/3] Drop alternative definitions for unsupported GCCs nicola.vetrini 2025-08-13 19:12 ` [XEN PATCH 1/3] xen/compiler: drop alternative unreachable() definition for older GCC nicola.vetrini 2025-08-13 19:12 ` [XEN PATCH 2/3] xen/macros: Drop alternative definition of BUILD_BUG_ON(_ZERO)? for old GCC nicola.vetrini @ 2025-08-13 19:12 ` nicola.vetrini 2025-08-13 22:39 ` Andrew Cooper 2 siblings, 1 reply; 10+ messages in thread From: nicola.vetrini @ 2025-08-13 19:12 UTC (permalink / raw) To: xen-devel Cc: Nicola Vetrini, Daniel P. Smith, Marek Marczykowski-Górecki, Jan Beulich, Andrew Cooper, Roger Pau Monné From: Nicola Vetrini <nicola.vetrini@gmail.com> Since the toolchain baseline for GCC is 5.1, there is no need for this case. Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com> --- Mentioned in https://gitlab.com/xen-project/xen/-/issues/201 --- xen/arch/x86/include/asm/x86_64/efibind.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/xen/arch/x86/include/asm/x86_64/efibind.h b/xen/arch/x86/include/asm/x86_64/efibind.h index b29342c61cac..d71b9324a6bb 100644 --- a/xen/arch/x86/include/asm/x86_64/efibind.h +++ b/xen/arch/x86/include/asm/x86_64/efibind.h @@ -173,10 +173,8 @@ typedef uint64_t UINTN; #ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options #ifdef _MSC_EXTENSIONS #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler - #elif __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) - #define EFIAPI __attribute__((__ms_abi__)) // Force Microsoft ABI #else - #define EFIAPI // Substitute expression to force C calling convention + #define EFIAPI __attribute__((__ms_abi__)) // Force Microsoft ABI #endif #endif -- 2.43.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [XEN PATCH 3/3] xen/efi: efibind: Drop alternative define for old GCC versions 2025-08-13 19:12 ` [XEN PATCH 3/3] xen/efi: efibind: Drop alternative define for old GCC versions nicola.vetrini @ 2025-08-13 22:39 ` Andrew Cooper 2025-08-14 7:48 ` Jan Beulich 0 siblings, 1 reply; 10+ messages in thread From: Andrew Cooper @ 2025-08-13 22:39 UTC (permalink / raw) To: nicola.vetrini, xen-devel Cc: Daniel P. Smith, Marek Marczykowski-Górecki, Jan Beulich, Roger Pau Monné On 13/08/2025 8:12 pm, nicola.vetrini@gmail.com wrote: > From: Nicola Vetrini <nicola.vetrini@gmail.com> > > Since the toolchain baseline for GCC is 5.1, there is no need for > this case. > > Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com> > --- > Mentioned in https://gitlab.com/xen-project/xen/-/issues/201 I personally am in favour of this change, but in the past there has been objection to changing this header it is vendered from elsewhere. e.g. far more could be stripped out if ... > --- > xen/arch/x86/include/asm/x86_64/efibind.h | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/xen/arch/x86/include/asm/x86_64/efibind.h b/xen/arch/x86/include/asm/x86_64/efibind.h > index b29342c61cac..d71b9324a6bb 100644 > --- a/xen/arch/x86/include/asm/x86_64/efibind.h > +++ b/xen/arch/x86/include/asm/x86_64/efibind.h > @@ -173,10 +173,8 @@ typedef uint64_t UINTN; > #ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options > #ifdef _MSC_EXTENSIONS > #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler ... it's noted that Xen doesn't use MSC and I can't see anyone taking the time to make it work. ~Andrew ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [XEN PATCH 3/3] xen/efi: efibind: Drop alternative define for old GCC versions 2025-08-13 22:39 ` Andrew Cooper @ 2025-08-14 7:48 ` Jan Beulich 0 siblings, 0 replies; 10+ messages in thread From: Jan Beulich @ 2025-08-14 7:48 UTC (permalink / raw) To: Andrew Cooper Cc: Daniel P. Smith, Marek Marczykowski-Górecki, Roger Pau Monné, nicola.vetrini, xen-devel On 14.08.2025 00:39, Andrew Cooper wrote: > On 13/08/2025 8:12 pm, nicola.vetrini@gmail.com wrote: >> From: Nicola Vetrini <nicola.vetrini@gmail.com> >> >> Since the toolchain baseline for GCC is 5.1, there is no need for >> this case. >> >> Signed-off-by: Nicola Vetrini <nicola.vetrini@gmail.com> >> --- >> Mentioned in https://gitlab.com/xen-project/xen/-/issues/201 > > I personally am in favour of this change, but in the past there has been > objection to changing this header it is vendered from elsewhere. The two lines Nicola is taking out altogether were our additions already anyway. Playing with them ought to be fine. Context may better be left intact. I'd like to note though that in gnuefi the detection logic has changed, too. Maintainers may want to sync that. As to me, earlier on, objecting to fiddling with imported files here: Now that maintainership has changed, the new maintainers will need to make up their take on this. Jan ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-08-14 9:17 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-08-13 19:12 [XEN PATCH 0/3] Drop alternative definitions for unsupported GCCs nicola.vetrini 2025-08-13 19:12 ` [XEN PATCH 1/3] xen/compiler: drop alternative unreachable() definition for older GCC nicola.vetrini 2025-08-13 22:32 ` Andrew Cooper 2025-08-13 19:12 ` [XEN PATCH 2/3] xen/macros: Drop alternative definition of BUILD_BUG_ON(_ZERO)? for old GCC nicola.vetrini 2025-08-13 22:33 ` Andrew Cooper 2025-08-14 8:07 ` Jan Beulich 2025-08-14 9:16 ` Nicola Vetrini 2025-08-13 19:12 ` [XEN PATCH 3/3] xen/efi: efibind: Drop alternative define for old GCC versions nicola.vetrini 2025-08-13 22:39 ` Andrew Cooper 2025-08-14 7:48 ` Jan Beulich
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.