ruby-changes:71636
From: Alan <ko1@a...>
Date: Wed, 6 Apr 2022 01:58:18 +0900 (JST)
Subject: [ruby-changes:71636] 2304cfa4c0 (master): Document MakeMakefile#append_cflags
https://git.ruby-lang.org/ruby.git/commit/?id=2304cfa4c0 From 2304cfa4c08a347f4df4915f88fb062cb12e4eeb Mon Sep 17 00:00:00 2001 From: Alan Wu <XrXr@u...> Date: Mon, 4 Apr 2022 15:23:42 -0400 Subject: Document MakeMakefile#append_cflags This method is at least 7 years old and is widely used in the wild. Since we need to support it, let's document it to make it discoverable. Add docs and move it out of the `# :stopdoc:` zone. --- lib/mkmf.rb | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 4ced064a8b..547a28577e 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -680,16 +680,6 @@ MSG https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L680 try_compile(MAIN_DOES_NOTHING, flags, {:werror => true}.update(opts)) end - def append_cflags(flags, *opts) - Array(flags).each do |flag| - if checking_for("whether #{flag} is accepted as CFLAGS") { - try_cflags(flag, *opts) - } - $CFLAGS << " " << flag - end - end - end - def with_ldflags(flags) ldflags = $LDFLAGS $LDFLAGS = flags.dup @@ -1024,6 +1014,21 @@ SRC https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L1014 # :startdoc: + # Check whether each given C compiler flag is acceptable and append it + # to <tt>$CFLAGS</tt> if so. + # + # [+flags+] a C compiler flag as a +String+ or an +Array+ of them + # + def append_cflags(flags, *opts) + Array(flags).each do |flag| + if checking_for("whether #{flag} is accepted as CFLAGS") { + try_cflags(flag, *opts) + } + $CFLAGS << " " << flag + end + end + end + # Returns whether or not +macro+ is defined either in the common header # files or within any +headers+ you provide. # -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/