ruby-changes:72913
From: Nobuyoshi <ko1@a...>
Date: Fri, 12 Aug 2022 15:57:34 +0900 (JST)
Subject: [ruby-changes:72913] cd1a0b3caa (master): Stop defining `RUBY_ABI_VERSION` if released versions
https://git.ruby-lang.org/ruby.git/commit/?id=cd1a0b3caa From cd1a0b3caaa5446e9258c192cf483b6dfe8d7819 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 12 Jul 2022 16:44:57 +0900 Subject: Stop defining `RUBY_ABI_VERSION` if released versions As commented in include/ruby/internal/abi.h, since teeny versions of Ruby should guarantee ABI compatibility, `RUBY_ABI_VERSION` has no role in released versions of Ruby. --- configure.ac | 6 ++++++ ext/-test-/abi/extconf.rb | 1 + include/ruby/internal/abi.h | 6 +++++- test/-ext-/test_abi.rb | 2 ++ version.h | 11 +++++++++-- win32/Makefile.sub | 8 +++++++- win32/setup.mak | 4 +++- 7 files changed, 33 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index bc21c26292..0f4a31af7e 100644 --- a/configure.ac +++ b/configure.ac @@ -88,7 +88,9 @@ AC_SUBST(GIT) https://github.com/ruby/ruby/blob/trunk/configure.ac#L88 AC_SUBST(HAVE_GIT) eval `sed -n -e ['s/^@%:@define RUBY_[A-Z_]*VERSION_\([A-Z][A-Z][A-Z_0-9]*\) \([0-9][0-9]*\)$/\1=\2/p'] \ + -e ['s/^@%:@define \(RUBY_ABI_VERSION\) \([0-9][0-9]*\).*/\1=\2/p'] \ -e ['s/^@%:@define \(RUBY_PATCHLEVEL\) \(.*\)/\1=\2/p'] \ + $srcdir/include/ruby/internal/abi.h \ $srcdir/include/ruby/version.h $srcdir/version.h` for v in MAJOR MINOR TEENY; do AS_IF([eval "test \"\$$v\" = ''"], [ @@ -100,6 +102,9 @@ AC_SUBST(MINOR) https://github.com/ruby/ruby/blob/trunk/configure.ac#L102 AC_SUBST(TEENY) AC_SUBST(RUBY_API_VERSION, '$(MAJOR).$(MINOR)') AC_SUBST(RUBY_PROGRAM_VERSION, '$(MAJOR).$(MINOR).$(TEENY)') +AS_CASE([$RUBY_PATCHLEVEL], [-*], [ + AC_DEFINE_UNQUOTED(RUBY_ABI_VERSION, [${RUBY_ABI_VERSION}]) +], [RUBY_ABI_VERSION=]) AS_IF([test "$program_prefix" = NONE], [ program_prefix= @@ -4118,6 +4123,7 @@ AS_CASE(["$ruby_version"], https://github.com/ruby/ruby/blob/trunk/configure.ac#L4123 AS_IF([test ${RUBY_LIB_VERSION_STYLE+set}], [ { echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE" + echo '@%:@include "confdefs.h"' echo '#define STRINGIZE(x) x' test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0' echo '#include "version.h"' diff --git a/ext/-test-/abi/extconf.rb b/ext/-test-/abi/extconf.rb index d786b15db9..3b090b7553 100644 --- a/ext/-test-/abi/extconf.rb +++ b/ext/-test-/abi/extconf.rb @@ -1,3 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/ext/-test-/abi/extconf.rb#L1 # frozen_string_literal: false +return unless RUBY_PATCHLEVEL < 0 require_relative "../auto_ext.rb" auto_ext(inc: true) diff --git a/include/ruby/internal/abi.h b/include/ruby/internal/abi.h index e42a1777ff..fe1977a9a1 100644 --- a/include/ruby/internal/abi.h +++ b/include/ruby/internal/abi.h @@ -1,6 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/abi.h#L1 #ifndef RUBY_ABI_H #define RUBY_ABI_H +#ifdef RUBY_ABI_VERSION /* should match the definition in config.h */ + /* This number represents Ruby's ABI version. * * In development Ruby, it should be bumped every time an ABI incompatible @@ -19,7 +21,7 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/abi.h#L21 * - Backwards compatible refactors. * - Editing comments. * - * In released versions of Ruby, this number should not be changed since teeny + * In released versions of Ruby, this number is not defined since teeny * versions of Ruby should guarantee ABI compatibility. */ #define RUBY_ABI_VERSION 2 @@ -49,3 +51,5 @@ ruby_abi_version(void) https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/abi.h#L51 #endif #endif + +#endif diff --git a/test/-ext-/test_abi.rb b/test/-ext-/test_abi.rb index 59e70107a5..d3ea6bb9b1 100644 --- a/test/-ext-/test_abi.rb +++ b/test/-ext-/test_abi.rb @@ -1,5 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/test/-ext-/test_abi.rb#L1 # frozen_string_literal: true +return unless RUBY_PATCHLEVEL < 0 + class TestABI < Test::Unit::TestCase def test_require_lib_with_incorrect_abi_on_dev_ruby omit "ABI is not checked" unless abi_checking_supported? diff --git a/version.h b/version.h index 1b561623e9..d79ba396f7 100644 --- a/version.h +++ b/version.h @@ -38,18 +38,25 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L38 #define RUBY_RELEASE_DAY_STR STRINGIZE(RUBY_RELEASE_DAY) #endif +#ifdef RUBY_ABI_VERSION +# define RUBY_ABI_VERSION_SUFFIX "+"STRINGIZE(RUBY_ABI_VERSION) +#else +# define RUBY_ABI_VERSION_SUFFIX "" +#endif #if !defined RUBY_LIB_VERSION && defined RUBY_LIB_VERSION_STYLE # if RUBY_LIB_VERSION_STYLE == 3 # define RUBY_LIB_VERSION STRINGIZE(RUBY_API_VERSION_MAJOR)"."STRINGIZE(RUBY_API_VERSION_MINOR) \ - "."STRINGIZE(RUBY_API_VERSION_TEENY)"+"STRINGIZE(RUBY_ABI_VERSION) + "."STRINGIZE(RUBY_API_VERSION_TEENY) RUBY_ABI_VERSION_SUFFIX # elif RUBY_LIB_VERSION_STYLE == 2 # define RUBY_LIB_VERSION STRINGIZE(RUBY_API_VERSION_MAJOR)"."STRINGIZE(RUBY_API_VERSION_MINOR) \ - "+"STRINGIZE(RUBY_ABI_VERSION) + RUBY_ABI_VERSION_SUFFIX # endif #endif #if RUBY_PATCHLEVEL == -1 #define RUBY_PATCHLEVEL_STR "dev" +#elif defined RUBY_ABI_VERSION +#error RUBY_ABI_VERSION is defined in non-development branch #else #define RUBY_PATCHLEVEL_STR "" #endif diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 9dc5ee6f51..bea24450ed 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -148,7 +148,10 @@ PLATFORM_DIR = win32 https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L148 arch = $(ARCH)-$(PLATFORM) sitearch = $(ARCH)-$(RT) !if !defined(ruby_version) -ruby_version = $(MAJOR).$(MINOR).0+$(ABI_VERSION) +ruby_version = $(MAJOR).$(MINOR).0 +!endif +!if defined(ABI_VERSION) +ruby_version = $(ruby_version)+$(ABI_VERSION) !endif !if !defined(RUBY_VERSION_NAME) RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version) @@ -624,6 +627,9 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L627 #endif !endif #define RUBY_MSVCRT_VERSION $(RT_VER) +!if defined(ABI_VERSION) +#define RUBY_ABI_VERSION $(ABI_VERSION) +!endif #define STDC_HEADERS 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 diff --git a/win32/setup.mak b/win32/setup.mak index 39323c61c2..fd804a84ce 100644 --- a/win32/setup.mak +++ b/win32/setup.mak @@ -178,6 +178,7 @@ main(void) https://github.com/ruby/ruby/blob/trunk/win32/setup.mak#L178 -version-: nul verconf.mk verconf.mk: nul + @findstr /R /C:"^#define RUBY_ABI_VERSION " $(srcdir:/=\)\include\ruby\internal\abi.h > $(@) @$(CPP) -I$(srcdir) -I$(srcdir)/include <<"Creating $(@)" > $(*F).bat && cmd /c $(*F).bat > $(@) @echo off #define RUBY_REVISION 0 @@ -198,8 +199,9 @@ echo RUBY_RELEASE_DAY = %ruby_release_day:~-2% https://github.com/ruby/ruby/blob/trunk/win32/setup.mak#L199 echo MAJOR = RUBY_VERSION_MAJOR echo MINOR = RUBY_VERSION_MINOR echo TEENY = RUBY_VERSION_TEENY -echo ABI_VERSION = RUBY_ABI_VERSION #if defined RUBY_PATCHLEVEL && RUBY_PATCHLEVEL < 0 +#include "$(@F)" +echo ABI_VERSION = RUBY_ABI_VERSION #endif set /a MSC_VER = _MSC_VER #if _MSC_VER >= 1920 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/