From be76cec3422ddedbfce48768db5aec004e2f0aee Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Fri, 13 Sep 2019 17:14:37 +0900 Subject: Fix warnings for invalid C++ option with `enable_cxx_abi`; ref #3618, #4703 --- tasks/toolchains/gcc.rake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tasks') diff --git a/tasks/toolchains/gcc.rake b/tasks/toolchains/gcc.rake index ca083a4b2..1a28026bf 100644 --- a/tasks/toolchains/gcc.rake +++ b/tasks/toolchains/gcc.rake @@ -1,20 +1,23 @@ MRuby::Toolchain.new(:gcc) do |conf, params| default_command = params[:default_command] || 'gcc' - compile_flags = %w(-g -O3 -Wall -Wundef -Werror-implicit-function-declaration) + compiler_flags = %w(-g -O3 -Wall -Wundef) + c_mandatory_flags = %w(-std=gnu99) + cxx_invalid_flags = %w(-Wdeclaration-after-statement -Werror-implicit-function-declaration) [conf.cc, conf.objc, conf.asm, conf.cxx].each do |compiler| if compiler == conf.cxx compiler.command = ENV['CXX'] || default_command.sub(/cc|$/, '++') - compiler.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || compile_flags] + compiler.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || compiler_flags] else compiler.command = ENV['CC'] || default_command - compiler.flags = ['-std=gnu99', ENV['CFLAGS'] || [compile_flags, %w(-Wdeclaration-after-statement -Wwrite-strings)]] + compiler.flags = [c_mandatory_flags, ENV['CFLAGS'] || [compiler_flags, cxx_invalid_flags, %w(-Wwrite-strings)]] end compiler.option_include_path = '-I%s' compiler.option_define = '-D%s' compiler.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}' compiler.cxx_compile_flag = '-x c++ -std=c++03' compiler.cxx_exception_flag = '-fexceptions' + compiler.cxx_invalid_flags = c_mandatory_flags + cxx_invalid_flags end conf.linker do |linker| -- cgit v1.2.3