1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-03 08:10:31 +02:00

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.
This commit is contained in:
Andy Wingo 2025-06-20 22:18:46 +02:00
parent 9290698977
commit 7a749ef79c
4 changed files with 4 additions and 32 deletions

View file

@ -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). */

View file

@ -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 */

View file

@ -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 */

View file

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