From 52906d364a8324736776fbd3e0e431e136d8037a Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Fri, 20 Jun 2014 15:18:01 -0400 Subject: [PATCH] abstract_compiler: add -Qunused-argument if clang Signed-off-by: Jean Privat --- src/abstract_compiler.nit | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/abstract_compiler.nit b/src/abstract_compiler.nit index 031be97..0f4070c 100644 --- a/src/abstract_compiler.nit +++ b/src/abstract_compiler.nit @@ -324,6 +324,15 @@ class MakefileToolchain if ost == "libunwind" or ost == "nitstack" then linker_options.add("-lunwind") makefile.write("CC = ccache cc\nCFLAGS = -g -O2 -Wno-unused-value -Wno-switch\nCINCL = {cc_includes}\nLDFLAGS ?= \nLDLIBS ?= -lm -lgc {linker_options.join(" ")}\n\n") + + # Dynamic adaptations + # While `platform` enable complex toolchains, they are statically applied + # For a dynamic adaptsation of the compilation, the generated Makefile should check and adapt things itself + + # Check and adapt for the compiler used + # clang need an additionnal `-Qunused-arguments` + makefile.write("clang_check := $(shell sh -c '$(CC) -v 2>&1 | grep -q clang; echo $$?')\nifeq ($(clang_check), 0)\n\tCFLAGS += -Qunused-arguments\nendif\n") + makefile.write("all: {outpath}\n\n") var ofiles = new Array[String] -- 1.7.9.5