From 7a749ef79c73c8ab1df065238df9c75733a91edf Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Fri, 20 Jun 2025 22:18:46 +0200 Subject: [PATCH] SCM_ALIGNED is always available _Alignas is C11. * libguile/scm.h (SCM_ALIGNED): Always present. * libguile/snarf.h: * libguile/strings.h: * libguile/symbols.h: Always have SCM_ALIGNED available. --- libguile/scm.h | 7 ++----- libguile/snarf.h | 10 +--------- libguile/strings.h | 3 --- libguile/symbols.h | 16 +--------------- 4 files changed, 4 insertions(+), 32 deletions(-) diff --git a/libguile/scm.h b/libguile/scm.h index 25a8fee2d..5509d239e 100644 --- a/libguile/scm.h +++ b/libguile/scm.h @@ -793,15 +793,12 @@ enum scm_tc8_tags #define SCM_LIKELY(_expr) SCM_EXPECT ((_expr), 1) #define SCM_UNLIKELY(_expr) SCM_EXPECT ((_expr), 0) -/* The SCM_ALIGNED macro, when defined, can be used to instruct the - compiler to honor the given alignment constraint. Sun Studio - supports alignment since Sun Studio 12. */ -#if defined __GNUC__ || (defined( __SUNPRO_C ) && (__SUNPRO_C - 0 >= 0x590)) +#if defined __GNUC__ # define SCM_ALIGNED(x) __attribute__ ((aligned (x))) #elif defined __INTEL_COMPILER # define SCM_ALIGNED(x) __declspec (align (x)) #else -# undef SCM_ALIGNED +# define SCM_ALIGNED(x) _Alignas(x) #endif /* Thread-local storage (TLS). */ diff --git a/libguile/snarf.h b/libguile/snarf.h index 54272d5c9..f9c9043bf 100644 --- a/libguile/snarf.h +++ b/libguile/snarf.h @@ -1,7 +1,7 @@ #ifndef SCM_SNARF_H #define SCM_SNARF_H -/* Copyright 1995-2004,2006,2009-2011,2013-2014,2017-2019 +/* Copyright 1995-2004,2006,2009-2011,2013-2014,2017-2019,2025 Free Software Foundation, Inc. This file is part of Guile. @@ -28,11 +28,6 @@ /* Macros for snarfing initialization actions from C source. */ -#ifdef SCM_ALIGNED -/* We support static allocation of some `SCM' objects. */ -# define SCM_SUPPORT_STATIC_ALLOCATION -#endif - /* C preprocessor token concatenation. */ #define scm_i_paste(x, y) x ## y #define scm_i_paste3(a, b, c) a ## b ## c @@ -86,8 +81,6 @@ DOCSTRING ^^ } /* Low-level snarfing for static memory allocation. */ -#ifdef SCM_SUPPORT_STATIC_ALLOCATION - #define SCM_IMMUTABLE_CELL(c_name, car, cdr) \ static SCM_ALIGNED (8) const SCM c_name ## _raw [2] = \ { SCM_PACK (car), SCM_PACK (cdr) }; \ @@ -97,7 +90,6 @@ DOCSTRING ^^ } static SCM_ALIGNED (8) const SCM c_name ## _raw [4] = \ { SCM_PACK (car), SCM_PACK (cbr), SCM_PACK (ccr), SCM_PACK (cdr) }; \ static SCM_UNUSED const SCM c_name = SCM_PACK (& c_name ## _raw) -#endif /* SCM_SUPPORT_STATIC_ALLOCATION */ diff --git a/libguile/strings.h b/libguile/strings.h index 4b0d85857..0262790ef 100644 --- a/libguile/strings.h +++ b/libguile/strings.h @@ -182,7 +182,6 @@ SCM_API SCM scm_makfromstrs (int argc, char **argv); /* Snarfing support. See snarf.h. */ -#ifdef SCM_SUPPORT_STATIC_ALLOCATION #define SCM_IMMUTABLE_STRINGBUF(c_name, contents) \ static SCM_UNUSED SCM_ALIGNED(8) const \ struct \ @@ -207,8 +206,6 @@ SCM_API SCM scm_makfromstrs (int argc, char **argv); (scm_t_bits) 0, \ (scm_t_bits) (sizeof (contents) - 1)) -#endif /* SCM_SUPPORT_STATIC_ALLOCATION */ - /* internal constants */ diff --git a/libguile/symbols.h b/libguile/symbols.h index e8bc3346f..0c4ae546f 100644 --- a/libguile/symbols.h +++ b/libguile/symbols.h @@ -1,7 +1,7 @@ #ifndef SCM_SYMBOLS_H #define SCM_SYMBOLS_H -/* Copyright 1995-1998,2000-2001,2003-2004,2006,2008,2010-2011,2018,2022 +/* Copyright 1995-1998,2000-2001,2003-2004,2006,2008,2010-2011,2018,2022,2025 Free Software Foundation, Inc. This file is part of Guile. @@ -45,8 +45,6 @@ -#ifdef SCM_SUPPORT_STATIC_ALLOCATION - # define SCM_SYMBOL(c_name, scheme_name) \ SCM_SNARF_HERE( \ SCM_IMMUTABLE_STRING (scm_i_paste (c_name, _string), scheme_name); \ @@ -63,18 +61,6 @@ SCM_SNARF_INIT( \ c_name = scm_string_to_symbol (scm_i_paste (c_name, _string)) \ ) -#else /* !SCM_SUPPORT_STATIC_ALLOCATION */ - -# define SCM_SYMBOL(c_name, scheme_name) \ -SCM_SNARF_HERE(static SCM c_name) \ -SCM_SNARF_INIT(c_name = scm_from_utf8_symbol (scheme_name)) - -# define SCM_GLOBAL_SYMBOL(c_name, scheme_name) \ -SCM_SNARF_HERE(SCM c_name) \ -SCM_SNARF_INIT(c_name = scm_from_utf8_symbol (scheme_name)) - -#endif /* !SCM_SUPPORT_STATIC_ALLOCATION */ - /* Older spellings; don't use in new code.