From 0d7bbfc9415aa066ea8c17b90dd06c5d47fed50b Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 9 Jan 2023 18:30:05 +0900 Subject: [PATCH] mkmf.rb: Prefer `caller_locations` over parsing `caller` --- lib/mkmf.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/mkmf.rb b/lib/mkmf.rb index e4a6fc984f..791838308c 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -971,7 +971,11 @@ SRC # Internal use only. # def checking_for(m, fmt = nil) - f = caller[0][/in `([^<].*)'$/, 1] and f << ": " #` for vim #' + if f = caller_locations(1, 1).first.base_label and /\A\w/ =~ f + f += ": " + else + f = "" + end m = "checking #{/\Acheck/ =~ f ? '' : 'for '}#{m}... " message "%s", m a = r = nil