Makefile: correct faligned-new test
Summary:
Commit 4f81ab38bf
has the test wrong.
clang doesn't support a -dumpversion option. By lucky coincidence
clang/gcc --version both place a version number at the same output location
when --verison is passed.
Example output (1st line only).
$ clang --version
clang version 3.9.1 (tags/RELEASE_391/final)
$ gcc --version
gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1)
During the test of the compiler we ensure that a minimum version is met
as Makefile doesn't support patterns.
Also xcode9 doesn't seem affected by https://github.com/facebook/rocksdb/issues/2672
and also doesn't have "clang" as the first part of its output so the
fix implemented here also is Apple clang friendly.
$ clang --version
Apple LLVM version 9.0.0 (clang-900.0.31)
Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
Closes https://github.com/facebook/rocksdb/pull/2699
Differential Revision: D5600818
Pulled By: yiwu-arbug
fbshipit-source-id: 3b0f2751becb53c1c35468bf29f3f828e7cf2c2a
This commit is contained in:
parent
7848f0b24c
commit
1fbad84b69
11
Makefile
11
Makefile
@ -259,18 +259,11 @@ default: all
|
||||
WARNING_FLAGS = -W -Wextra -Wall -Wsign-compare -Wshadow \
|
||||
-Wno-unused-parameter
|
||||
|
||||
CCVERSION = $(shell $(CXX) -dumpversion)
|
||||
CCNAME = $(shell $(CXX) --version | awk 'NR==1' | cut -f1 -d " ")
|
||||
CCFALIGNED := $(shell $(CXX) --version | awk 'NR==1 { split($$3, ver, "."); if (($$1 == "clang" && ver[1] >= 4) || ($$2 == "(GCC)" && ver[1] >= 7)) { print "yes" } }')
|
||||
|
||||
ifeq ($(CCNAME), clang)
|
||||
ifeq ($(CCVERSION), 4*)
|
||||
ifeq ($(CCFALIGNED), yes)
|
||||
CXXFLAGS += -faligned-new
|
||||
endif
|
||||
else
|
||||
ifeq ($(CCVERSION), 7)
|
||||
CXXFLAGS += -faligned-new
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef DISABLE_WARNING_AS_ERROR
|
||||
WARNING_FLAGS += -Werror
|
||||
|
Loading…
Reference in New Issue
Block a user