mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 16:36:20 +08:00
Drop revision.h dependency from dump_ast (#18224)
Follow-up on dd93d13c8a (#18071).
Baking revision.h into dump_ast couples every builtin *.rbinc to the
current commit: whenever HEAD changes, e.g. when switching between two
branches that only differ under yjit/, revision.h is regenerated,
dump_ast is relinked, all $(BUILTIN_RB_INCS) are regenerated with
identical content but fresh timestamps, and every C file that includes
one of them is recompiled, followed by relinking miniruby and ruby.
The --version banner was the only use of revision.h in dump_ast, so
print only the Prism version. Since dump_ast no longer includes revision.h,
it is not relinked when HEAD changes, so $(BUILTIN_RB_INCS) and their
dependents are no longer invalidated by commit-only changes.
This commit is contained in:
1 parent
c40a554941
commit
385dd9e950
2 files changed
+4
-32
Notes:
git
2026-08-07 16:52:14 +00:00
Merged-By: k0kubun <takashikkbn@gmail.com>
No files matched your search
@@ -1344,11 +1344,11 @@ $(BUILTIN_BINARY:no=builtin)_binary.rbbin:
|
||||
|
||||
$(BUILTIN_RB_INCS): $(tooldir)/mk_builtin_loader.rb $(DUMP_AST_TARGET)
|
||||
|
||||
dump_ast$(BUILD_EXEEXT): $(tooldir)/dump_ast.c $(LIBPRISM_OBJS) revision.h
|
||||
dump_ast$(BUILD_EXEEXT): $(tooldir)/dump_ast.c $(LIBPRISM_OBJS)
|
||||
$(ECHO) compiling $@
|
||||
$(Q) $(CC) $(CFLAGS) $(OUTFLAG)$@ $(INCFLAGS) $(tooldir)/dump_ast.c $(LIBPRISM_OBJS)
|
||||
|
||||
build-tool/Makefile: $(tooldir)/dump_ast.mkmf.rb prism-srcs prism-incs revision.h
|
||||
build-tool/Makefile: $(tooldir)/dump_ast.mkmf.rb prism-srcs prism-incs
|
||||
+$(BASERUBY) -s $(tooldir)/dump_ast.mkmf.rb \
|
||||
"-INCFLAGS=$(INCFLAGS)" "-make=$(MAKE)" "-objext=$(OBJEXT)" \
|
||||
build-tool $(tooldir)/dump_ast.c dump_ast.$(OBJEXT) $(LIBPRISM_OBJS)
|
||||
|
||||
+2
-30
@@ -2,7 +2,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include "revision.h"
|
||||
|
||||
/*
|
||||
* When prism is compiled as part of CRuby, the xmalloc/xfree/etc. macros are
|
||||
@@ -28,25 +27,12 @@ print_error(const pm_diagnostic_t *diagnostic, void *data)
|
||||
fprintf(stderr, "%" PRIi32 ":%" PRIu32 ":%s\n", line_column.line, line_column.column, pm_diagnostic_message(diagnostic));
|
||||
}
|
||||
|
||||
#if defined(RUBY_RELEASE_DATETIME) && defined(RUBY_RELEASE_DATETIME)
|
||||
# define SHOW_PROGRAM_VERSION 2
|
||||
#elif defined(RUBY_RELEASE_DATETIME) || defined(RUBY_RELEASE_DATETIME)
|
||||
# define SHOW_PROGRAM_VERSION 1
|
||||
#else
|
||||
# define SHOW_PROGRAM_VERSION 0
|
||||
#endif
|
||||
#if SHOW_PROGRAM_VERSION
|
||||
# define usage_versions "and program versions"
|
||||
#else
|
||||
# define usage_versions "version"
|
||||
#endif
|
||||
|
||||
static void
|
||||
usage(const char *prog)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s [options]... <filename>\n"
|
||||
"Options:\n"
|
||||
" -v, --version: show Prism " usage_versions "\n"
|
||||
" -v, --version: show Prism version\n"
|
||||
" -h, --help: show this message\n"
|
||||
"", prog);
|
||||
}
|
||||
@@ -69,21 +55,7 @@ main(int argc, const char *argv[])
|
||||
if (!arg[2]) break;
|
||||
if (strcmp(arg + 2, "version") == 0) {
|
||||
version:
|
||||
fputs("Prism " PRISM_VERSION
|
||||
#if SHOW_PROGRAM_VERSION
|
||||
" ["
|
||||
# ifdef RUBY_RELEASE_DATETIME
|
||||
RUBY_RELEASE_DATETIME
|
||||
# endif
|
||||
# if SHOW_PROGRAM_VERSION > 1
|
||||
" "
|
||||
# endif
|
||||
# ifdef RUBY_REVISION
|
||||
RUBY_REVISION
|
||||
# endif
|
||||
"]"
|
||||
#endif
|
||||
"\n", stdout);
|
||||
fputs("Prism " PRISM_VERSION "\n", stdout);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
if (strcmp(arg + 2, "help") == 0) {
|
||||
|
||||
Reference in new issue
Block a user