From 3f5b48b76b7f6bb4a124f8cb987316df085600fa Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Sat, 23 Dec 2023 11:39:22 -0800 Subject: [PATCH] Use line control in merged .c file --- contrib/ruby/ext/trilogy-ruby/extconf.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/ruby/ext/trilogy-ruby/extconf.rb b/contrib/ruby/ext/trilogy-ruby/extconf.rb index 05ad2aec..f618ef21 100644 --- a/contrib/ruby/ext/trilogy-ruby/extconf.rb +++ b/contrib/ruby/ext/trilogy-ruby/extconf.rb @@ -2,8 +2,12 @@ # concatenate trilogy library sources to allow the compiler to optimise across # source files + +trilogy_src_dir = File.realpath("src", __dir__) File.binwrite("trilogy.c", - Dir["#{__dir__}/src/**/*.c"].map { |src| File.binread(src) }.join) + Dir["#{trilogy_src_dir}/**/*.c"].map { |src| + %{#line 1 "#{src}"\n} + File.binread(src) + }.join) $objs = %w[trilogy.o cast.o cext.o] $CFLAGS << " -I #{__dir__}/inc -std=gnu99 -fvisibility=hidden"