1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
Nobuyoshi Nakada 2022-07-12 16:44:57 +09:00
parent a201cfd0cd
commit cd1a0b3caa
Notes: git 2022-08-12 15:57:46 +09:00
7 changed files with 33 additions and 5 deletions

View file

@ -88,7 +88,9 @@ AC_SUBST(GIT)
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)
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"],
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"'

View file

@ -1,3 +1,4 @@
# frozen_string_literal: false
return unless RUBY_PATCHLEVEL < 0
require_relative "../auto_ext.rb"
auto_ext(inc: true)

View file

@ -1,6 +1,8 @@
#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 @@
* - 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)
#endif
#endif
#endif

View file

@ -1,5 +1,7 @@
# 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?

View file

@ -38,18 +38,25 @@
#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

View file

@ -148,7 +148,10 @@ PLATFORM_DIR = win32
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
#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

View file

@ -178,6 +178,7 @@ main(void)
-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%
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