This was never because of a bug in GCC.

C requires that static objects are initialised with constant expressions;
_mfn(), as a static inline, is not and cannot be made to be.

Correct the comments.  No functional change.

Signed-off-by: Andrew Cooper <[email protected]>
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau MonnĂ© <[email protected]>
CC: Stefano Stabellini <[email protected]>

Slightly RFC.  I left 'global variable' alone in the comment, because C's
"object with static storage durations" also isn't ideal; there's one user
which is non-static in terms of visibility.  I'm open to adjusting if we can
figure out some better wording.

In C++, we'd just make _mfn() be constexpr.  It turns out that C23 added this
keyword but restricted it to objects and therefore useless.

https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3018.htm literally admits
that constexpr on objects exists only to force some diagnostics which were
previously optional.
---
 xen/include/xen/mm-frame.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/include/xen/mm-frame.h b/xen/include/xen/mm-frame.h
index d973aec901fa..80885415a78a 100644
--- a/xen/include/xen/mm-frame.h
+++ b/xen/include/xen/mm-frame.h
@@ -9,8 +9,7 @@ TYPE_SAFE(unsigned long, mfn);
 #define INVALID_MFN_RAW  (~0UL)
 #define INVALID_MFN      _mfn(INVALID_MFN_RAW)
 /*
- * To be used for global variable initialization. This workaround a bug
- * in GCC < 5.0.
+ * To be used for global variable initialization.
  */
 #define INVALID_MFN_INITIALIZER { INVALID_MFN_RAW }
 
@@ -45,8 +44,7 @@ TYPE_SAFE(unsigned long, gfn);
 #define INVALID_GFN_RAW  (~0UL)
 #define INVALID_GFN      _gfn(INVALID_GFN_RAW)
 /*
- * To be used for global variable initialization. This workaround a bug
- * in GCC < 5.0 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856
+ * To be used for global variable initialization.
  */
 #define INVALID_GFN_INITIALIZER { INVALID_GFN_RAW }
 
-- 
2.39.5


Reply via email to