[dm-devel] [PATCH 2/2] multipath-tools: fix compilation with gcc < 4.9

Bart Van Assche Bart.VanAssche at sandisk.com
Wed May 17 14:23:52 UTC 2017


On Wed, 2017-05-17 at 15:54 +0200, Martin Wilck wrote:
> +# $(call TEST_CC_OPTION,option,fallback)
> +# Test if the C compiler supports the option.
> +# Evaluates to "option" if yes, and "fallback" otherwise.
> +TEST_CC_OPTION = $(shell \
> +	if $(CC) -o /dev/null -c "$(1)" -xc - <<<'int main(void){return 0;}' &>/dev/null; \
> +	then \
> +		echo "$(1)"; \
> +	else \
> +		echo "$(2)"; \
> +	fi)

Since '<<<' is nonstandard, please consider to use 'echo' and a pipe instead.
See also http://pubs.opengroup.org/onlinepubs/9699919799/.

> +STACKPROT = $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)

Please consider to use ":=" instead of "=" such that TEST_CC_OPTION gets called
once per "make" invocation instead of once per C file that is built.

Thanks,

Bart.




More information about the dm-devel mailing list