Fix the legacy Makefiles to actually use our desired C++ dialect.
MODIFY
Makefile
Makefile
# Makefile for building Thrust unit test driver
-# Force C++11 mode. NVCC will ignore it if the host compiler doesn't support it.
-export CXX_STD = c++11
+# Force C++14 mode. NVCC will ignore it if the host compiler doesn't support it.
+export CXX_STD = c++14
export VERBOSE = 1

ADD
internal/build/common_build.mk
+USE_NEW_PROJECT_MK := 1
+
+ifeq ($(OS),Linux)
+ LIBRARIES += m
+endif
+
+include $(ROOTDIR)/thrust/internal/build/common_compiler.mk
+
+# Add /bigobj to Windows build flag to workaround building Thrust with debug
+ifeq ($(OS),win32)
+ CUDACC_FLAGS += -Xcompiler "/bigobj"
+endif
+
+# Add -mthumb for Linux on ARM to work around bug in arm cross compiler from p4
+ifeq ($(TARGET_ARCH),ARMv7)
+ ifneq ($(HOST_ARCH),ARMv7)
+ ifeq ($(THRUST_TEST),1)
+ CUDACC_FLAGS += -Xcompiler "-mthumb"
+ endif
+ endif
+endif
+
+# Make PGI statically link against its libraries.
+ifeq ($(OS),$(filter $(OS),Linux Darwin))
+ ifdef USEPGCXX
+ NVCC_LDFLAGS += -Xcompiler "-Bstatic_pgi"
+ endif
+endif
+ifeq ($(SRC_PATH),)
+ SRC_PATH:=$(dir $(BUILD_SRC))
+ BUILD_SRC:=$(notdir $(BUILD_SRC))
+endif
+
+BUILD_SRC_SUFFIX:=$(suffix $(BUILD_SRC))
+
+ifeq ($(BUILD_SRC_SUFFIX),.cu)
+ CU_FILES += $(BUILD_SRC)
+else ifeq ($(BUILD_SRC_SUFFIX),.cpp)
+ FILES += $(BUILD_SRC)
+endif
+
+ifndef BUILD_AGAINST_RELEASE
+ # CUDA includes
+ ifdef VULCAN
+ INCLUDES_ABSPATH += $(VULCAN_INSTALL_DIR)/cuda/include
+ INCLUDES_ABSPATH += $(VULCAN_INSTALL_DIR)/cuda/_internal/cudart
+ else
+ INCLUDES_ABSPATH += $(ROOTDIR)/cuda/inc
+ INCLUDES_ABSPATH += $(ROOTDIR)/cuda/tools/cudart
+ endif
+
+ # Thrust includes
+ ifdef VULCAN
+ INCLUDES_ABSPATH += $(VULCAN_TOOLKIT_BASE)/thrust
+ else
+ INCLUDES_ABSPATH += $(ROOTDIR)/thrust
+ endif
+
+ # CUB includes
+ ifdef VULCAN
+ INCLUDES_ABSPATH += $(VULCAN_TOOLKIT_BASE)/cub
+ else
+ INCLUDES_ABSPATH += $(ROOTDIR)/cub
+ endif
+else
+ # CUDA, CUB, and Thrust includes
+ INCLUDES_ABSPATH += $(GPGPU_COMPILER_EXPORT)/include
+
+ ifeq ($(TARGET_ARCH),ARMv7)
+ LIBDIRS_ABSPATH += $(GPGPU_COMPILER_EXPORT)/lib32
+ else
+ LIBDIRS_ABSPATH += $(GPGPU_COMPILER_EXPORT)/lib64
+ endif
+endif
+
+ifdef VULCAN
+ LIBDIRS_ABSPATH += $(VULCAN_BUILD_DIR)/bin/$(VULCAN_ARCH)_$(VULCAN_OS)$(VULCAN_ABI)_$(VULCAN_BUILD)
+endif
+
+USES_CUDA_DRIVER_HEADERS := 1
+
+ifdef VULCAN_TOOLKIT_BASE
+ include $(VULCAN_TOOLKIT_BASE)/build/common.mk
+else
+ include $(ROOTDIR)/build/common.mk
+endif
+

ADD
internal/build/common_compiler.mk
+ifeq ($(OS),$(filter $(OS),Linux Darwin))
+ ifndef USEPGCXX
+ CUDACC_FLAGS += -Xcompiler "-Wall -Wextra -Werror"
+
+ ifdef USEXLC
+ CXX_STD := c++14
+
+ # GCC does not warn about unused parameters in uninstantiated
+ # template functions, but xlC does. This causes xlC to choke on the
+ # OMP backend, which is mostly #ifdef'd out when you aren't using it.
+ CUDACC_FLAGS += -Xcompiler "-Wno-unused-parameter"
+
+ # xlC is unreasonable about unused functions in a translation unit
+ # when this warning is enabled; this includes warning on most functions
+ # that are defined as static inline in cuda_fp16.h. Disable this warning
+ # entirely under xlC.
+ CUDACC_FLAGS += -Xcompiler "-Wno-unused-function"
+ else # GCC, ICC or Clang AKA the sane ones.
+ # XXX Enable -Wcast-align.
+ CUDACC_FLAGS += -Xcompiler "-Winit-self -Woverloaded-virtual -Wno-cast-align -Wcast-qual -Wno-long-long -Wno-variadic-macros -Wno-unused-function"
+
+ ifdef USE_CLANGLLVM
+ IS_CLANG := 1
+ endif
+
+ ifeq ($(ABITYPE), androideabi)
+ ifneq ($(findstring clang, $(BASE_COMPILER)),)
+ IS_CLANG := 1
+ endif
+ endif
+
+ ifeq ($(OS), Darwin)
+ IS_CLANG := 1
+ endif
+
+ ifdef IS_CLANG
+ CXX_STD := c++14
+
+ ifdef USE_CLANGLLVM
+ CLANG_VERSION = $(shell $(USE_CLANGLLVM) --version 2>/dev/null | head -1 | sed -e 's/.*\([0-9]\)\.\([0-9]\)\(\.[0-9]\).*/\1\2/g')
+ else
+ CLANG_VERSION = $(shell $(CCBIN) --version 2>/dev/null | head -1 | sed -e 's/.*\([0-9]\)\.\([0-9]\)\(\.[0-9]\).*/\1\2/g')
+ endif
+
+ # GCC does not warn about unused parameters in uninstantiated
+ # template functions, but Clang does. This causes Clang to choke on the
+ # OMP backend, which is mostly #ifdef'd out when you aren't using it.
+ CUDACC_FLAGS += -Xcompiler "-Wno-unused-parameter"
+
+ # -Wunneeded-internal-declaration misfires in the unit test framework
+ # on older versions of Clang.
+ CUDACC_FLAGS += -Xcompiler "-Wno-unneeded-internal-declaration"
+
+ ifeq ($(shell if test $(CLANG_VERSION) -ge 60; then echo true; fi),true)
+ # Clang complains about name mangling changes due to `noexcept`
+ # becoming part of the type system; we don't care.
+ CUDACC_FLAGS += -Xcompiler "-Wno-noexcept-type"
+ endif
+ else # GCC
+ ifdef CCBIN
+ CCBIN_ENVIRONMENT :=
+ ifeq ($(OS), QNX)
+ # QNX's GCC complains if QNX_HOST and QNX_TARGET aren't defined in the
+ # environment.
+ CCBIN_ENVIRONMENT := QNX_HOST=$(QNX_HOST) QNX_TARGET=$(QNX_TARGET)
+ endif
+
+ # Newer versions of GCC only print the major number with the
+ # -dumpversion flag, but they print all three with -dumpfullversion.
+ GCC_VERSION = $(shell $(CCBIN_ENVIRONMENT) $(CCBIN) -dumpfullversion 2>/dev/null | sed -e 's/\([0-9]\)\.\([0-9]\)\(\.[0-9]\)\?/\1\2/g')
+
+ ifeq ($(GCC_VERSION),)
+ # Older versions of GCC (~4.4 and older) seem to print three version
+ # numbers (major, minor and patch) with the -dumpversion flag; newer
+ # versions only print one or two numbers.
+ GCC_VERSION = $(shell $(CCBIN_ENVIRONMENT) $(CCBIN) -dumpversion | sed -e 's/\([0-9]\)\.\([0-9]\)\(\.[0-9]\)\?/\1\2/g')
+ endif
+
+ ifeq ($(shell if test $(GCC_VERSION) -ge 50; then echo true; fi),true)
+ CXX_STD := c++14
+ else
+ CUDACC_FLAGS += -DTHRUST_IGNORE_DEPRECATED_CPP_DIALECT
+ endif
+
+ ifeq ($(shell if test $(GCC_VERSION) -ge 73; then echo true; fi),true)
+ # GCC 7.3 complains about name mangling changes due to `noexcept`
+ # becoming part of the type system; we don't care.
+ CUDACC_FLAGS += -Xcompiler "-Wno-noexcept-type"
+ endif
+ ifeq ($(shell if test $(GCC_VERSION) -ge 80; then echo true; fi),true)
+ # GCC 8.x has a new warning that tries to diagnose technical misuses of
+ # memcpy and memmove. We need to resolve it better than this, but for the
+ # time being, we'll downgrade it from an error to a warning.
+ CUDACC_FLAGS += -Xcompiler "-Wno-error=class-memaccess"
+ endif
+ else
+ $(error CCBIN is not defined.)
+ endif
+ endif
+ endif
+ else
+ CXX_STD := c++14
+ endif
+else ifeq ($(OS),win32)
+ CXX_STD := c++14
+
+ # XXX Enable /Wall
+ CUDACC_FLAGS += -Xcompiler "/WX"
+
+ # Disabled loss-of-data conversion warnings.
+ # XXX Re-enable.
+ CUDACC_FLAGS += -Xcompiler "/wd4244 /wd4267"
+
+ # Suppress numeric conversion-to-bool warnings.
+ # XXX Re-enable.
+ CUDACC_FLAGS += -Xcompiler "/wd4800"
+
+ # Disable warning about applying unary - to unsigned type.
+ CUDACC_FLAGS += -Xcompiler "/wd4146"
+endif
+

ADD
internal/build/generic_example.mk
+# Generic project mk that is included by examples mk
+EXECUTABLE := $(EXAMPLE_NAME)
+BUILD_SRC := $(ROOTDIR)/thrust/$(EXAMPLE_SRC)
+
+include $(ROOTDIR)/thrust/internal/build/common_detect.mk
+
+EXAMPLE_MAKEFILE := $(join $(dir $(BUILD_SRC)), $(basename $(notdir $(BUILD_SRC))).mk)
+ifneq ("$(wildcard $(EXAMPLE_MAKEFILE))","") # Check if the file exists.
+ include $(EXAMPLE_MAKEFILE)
+endif
+
+include $(ROOTDIR)/thrust/internal/build/common_build.mk
+

ADD
internal/build/generic_test.mk
+# Generic project mk that is included by unit tests mk
+EXECUTABLE := $(TEST_NAME)
+BUILD_SRC := $(ROOTDIR)/thrust/$(TEST_SRC)
+
+ifdef VULCAN
+ INCLUDES_ABSPATH += $(VULCAN_TOOLKIT_BASE)/thrust/testing
+else
+ INCLUDES_ABSPATH += $(ROOTDIR)/thrust/testing
+endif
+
+PROJ_LIBRARIES += testframework
+
+THRUST_TEST := 1
+
+include $(ROOTDIR)/thrust/internal/build/common_detect.mk
+
+TEST_MAKEFILE := $(join $(dir $(BUILD_SRC)), $(basename $(notdir $(BUILD_SRC))).mk)
+ifneq ("$(wildcard $(TEST_MAKEFILE))","") # Check if the file exists.
+ include $(TEST_MAKEFILE)
+endif
+
+include $(ROOTDIR)/thrust/internal/build/common_build.mk
+

ADD
internal/build/warningstester.mk
+USE_NEW_PROJECT_MK := 1
+
+EXECUTABLE := warningstester
+PROJ_DIR := internal/build
+#GENCODE :=
+
+ifndef PROFILE
+ifdef VULCAN_TOOLKIT_BASE
+include $(VULCAN_TOOLKIT_BASE)/build/getprofile.mk
+include $(VULCAN_TOOLKIT_BASE)/build/config/$(PROFILE).mk
+else
+include $(ROOTDIR)/build/getprofile.mk
+include $(ROOTDIR)/build/config/$(PROFILE).mk
+endif
+endif
+
+ARCH_NEG_FILTER += 20 21
+
+ifdef VULCAN_TOOLKIT_BASE
+include $(VULCAN_TOOLKIT_BASE)/build/config/DetectOS.mk
+else
+include $(ROOTDIR)/build/config/DetectOS.mk
+endif
+
+CU_FILES += ../test/warningstester.cu
+
+# Thrust includes
+ifdef VULCAN
+INCLUDES += $(VULCAN_INSTALL_DIR)/cuda/include
+INCLUDES += $(VULCAN_INSTALL_DIR)/cuda/_internal/cudart
+INCLUDES += $(VULCAN_TOOLKIT_BASE)/cub
+else
+INCLUDES += ../..
+INCLUDES += ../../../cuda/tools/cudart
+INCLUDES += ../../../cub
+endif
+
+# Location of generated include file that includes all Thrust public headers
+GENERATED_SOURCES = $(BUILT_CWD)
+CUDACC_FLAGS += -I$(GENERATED_SOURCES)
+
+include $(ROOTDIR)/thrust/internal/build/common_compiler.mk
+
+ifdef VULCAN_TOOLKIT_BASE
+include $(VULCAN_TOOLKIT_BASE)/build/common.mk
+else
+include $(ROOTDIR)/build/common.mk
+endif
+
+warningstester$(OBJSUFFIX): $(GENERATED_SOURCES)/warningstester.h
+
+$(GENERATED_SOURCES)/warningstester.h: FORCE
+ifdef VULCAN
+ifeq ($(TARGET_ARCH), ppc64le)
+ $(PYTHON) $(SRC_CWD)/warningstester_create_uber_header.py $(VULCAN_INSTALL_DIR)/cuda/targets/ppc64le-linux/include > $@
+else
+ $(PYTHON) $(SRC_CWD)/warningstester_create_uber_header.py $(VULCAN_INSTALL_DIR)/cuda/include > $@
+endif
+else
+ $(PYTHON) $(SRC_CWD)/warningstester_create_uber_header.py $(SRC_CWD)/../.. > $@
+endif
+
+FORCE:

Fix the legacy Makefiles to actually use our desired C++ dialect.