summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2025-12-24 22:47:02 +0900
committerNARUSE, Yui <naruse@airemix.jp>2025-12-24 22:55:44 +0900
commitba2f6972193cdbd7c1e77e26212513e47926b115 (patch)
tree7dbcf8bf5ffe1e5c41c6cd7d1d1273431ddbe1f6
parent8de2622c1291afd29a9a570e6b396bbe722360a3 (diff)
Revert "Extract `ruby_api_version_name`"
This reverts commit 9b576cd6255aba97e5e2f55f4b09f00c7dd0e839.
-rw-r--r--ruby.c9
-rw-r--r--test/ruby/test_rubyoptions.rb19
-rw-r--r--version.c10
3 files changed, 14 insertions, 24 deletions
diff --git a/ruby.c b/ruby.c
index 11376cbe70..36d6ed203b 100644
--- a/ruby.c
+++ b/ruby.c
@@ -61,6 +61,7 @@
#include "ruby/util.h"
#include "ruby/version.h"
#include "ruby/internal/error.h"
+#include "version.h"
#define singlebit_only_p(x) !((x) & ((x)-1))
STATIC_ASSERT(Qnil_1bit_from_Qfalse, singlebit_only_p(Qnil^Qfalse));
@@ -305,8 +306,6 @@ ruby_show_usage_line(const char *name, const char *secondary, const char *descri
description, help, highlight, width, columns);
}
-RUBY_EXTERN const char ruby_api_version_name[];
-
static void
usage(const char *name, int help, int highlight, int columns)
{
@@ -409,9 +408,9 @@ usage(const char *name, int help, int highlight, int columns)
unsigned int w = (columns > 80 ? (columns - 79) / 2 : 0) + 16;
#define SHOW(m) show_usage_line(&(m), help, highlight, w, columns)
- printf("%sUsage:%s %s [options] [--] [filepath] [arguments]\n", sb, se, name);
- printf("\n""Details and examples at https://docs.ruby-lang.org/en/%s/ruby/options_md.html\n",
- ruby_api_version_name);
+ printf("%sUsage:%s %s [options] [--] [filepath] [arguments]\n\n", sb, se, name);
+ printf("Details and examples at https://docs.ruby-lang.org/en/%s/ruby/options_md.html\n",
+ RUBY_PATCHLEVEL == -1 ? "master" : STRINGIZE(RUBY_VERSION_MAJOR) "." STRINGIZE(RUBY_VERSION_MINOR));
for (i = 0; i < num; ++i)
SHOW(usage_msg[i]);
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 2ec6478a7f..96d932aea2 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -47,27 +47,26 @@ class TestRubyOptions < Test::Unit::TestCase
assert_in_out_err([], "", [], [])
end
- version = RUBY_PATCHLEVEL == -1 ? "master" : "#{RUBY_VERSION_MAJOR}.#{RUBY_VERSION_MINOR}"
- OPTIONS_LINK = "https://docs.ruby-lang.org/en/#{version}/ruby/options_md.html"
-
def test_usage
assert_in_out_err(%w(-h)) do |r, e|
- _, _, link, *r = r
- assert_include(link, OPTIONS_LINK)
- assert_operator(r.size, :<=, 24)
- longer = r.select {|x| x.size >= 80}
+ assert_operator(r.size, :<=, 26)
+ longer = r[3..-1].select {|x| x.size >= 80}
assert_equal([], longer)
assert_equal([], e)
+
+ version = RUBY_PATCHLEVEL == -1 ? "master" : "#{RUBY_VERSION_MAJOR}.#{RUBY_VERSION_MINOR}"
+ assert_include(r, "Details and examples at https://docs.ruby-lang.org/en/#{version}/ruby/options_md.html")
end
end
def test_usage_long
assert_in_out_err(%w(--help)) do |r, e|
- _, _, link, *r = r
- assert_include(link, OPTIONS_LINK)
- longer = r.select {|x| x.size > 80}
+ longer = r[3..-1].select {|x| x.size > 80}
assert_equal([], longer)
assert_equal([], e)
+
+ version = RUBY_PATCHLEVEL == -1 ? "master" : "#{RUBY_VERSION_MAJOR}.#{RUBY_VERSION_MINOR}"
+ assert_include(r, "Details and examples at https://docs.ruby-lang.org/en/#{version}/ruby/options_md.html")
end
end
diff --git a/version.c b/version.c
index 5547832652..448925f1fb 100644
--- a/version.c
+++ b/version.c
@@ -25,9 +25,8 @@
#ifdef RUBY_REVISION
# if RUBY_PATCHLEVEL == -1
-# define RUBY_API_VERSION_NAME "master"
# ifndef RUBY_BRANCH_NAME
-# define RUBY_BRANCH_NAME RUBY_API_VERSION_NAME
+# define RUBY_BRANCH_NAME "master"
# endif
# define RUBY_REVISION_STR " "RUBY_BRANCH_NAME" "RUBY_REVISION
# else
@@ -37,9 +36,6 @@
# define RUBY_REVISION "HEAD"
# define RUBY_REVISION_STR ""
#endif
-#ifndef RUBY_API_VERSION_NAME
-# define RUBY_API_VERSION_NAME RUBY_API_VERSION_STR
-#endif
#if !defined RUBY_RELEASE_DATETIME || RUBY_PATCHLEVEL != -1
# undef RUBY_RELEASE_DATETIME
# define RUBY_RELEASE_DATETIME RUBY_RELEASE_DATE
@@ -49,9 +45,6 @@
#define MKSTR(type) rb_obj_freeze(rb_usascii_str_new_static(ruby_##type, sizeof(ruby_##type)-1))
#define MKINT(name) INT2FIX(ruby_##name)
-#define RUBY_API_VERSION_STR \
- STRINGIZE(RUBY_API_VERSION_MAJOR) "." \
- STRINGIZE(RUBY_API_VERSION_MINOR)
const int ruby_api_version[] = {
RUBY_API_VERSION_MAJOR,
RUBY_API_VERSION_MINOR,
@@ -84,7 +77,6 @@ const char ruby_revision[] = RUBY_FULL_REVISION;
const char ruby_release_date[] = RUBY_RELEASE_DATE;
const char ruby_platform[] = RUBY_PLATFORM;
const int ruby_patchlevel = RUBY_PATCHLEVEL;
-const char ruby_api_version_name[] = RUBY_API_VERSION_NAME;
const char ruby_description[] =
"ruby " RUBY_VERSION RUBY_PATCHLEVEL_STR " "
"(" RUBY_RELEASE_DATETIME RUBY_REVISION_STR ") "