未验证 提交 649ee57d 编写于 作者: J Jesse Zhang 提交者: GitHub

Build ORCA with C++14: Take Two (#10068)

This patch makes the minimal changes to build ORCA with C++14. This
should address the grievance that ORCA cannot build with the default
Xerces C++ (3.2 or newer, which is built with GCC 8.3 in the default
C++14 mode) headers from Debian. I've kept the CMake build system in
sync with the main Makefile. I've also made sure that all ORCA tests
pass.

This patch set also enables ORCA in Travis so the community gets
compilation coverage.

=== FIXME / near-term TODOs:

What's _not_ included in this patch, but would be nice to have soon (in
descending order of importance):

1. -std=gnu++14 ought to be done in "configure", not in a Makefile. This
is not a pendantic aesthetic issue, sooner or later we'll run into this
problem, especially if we're mixing multiple things built in C++.

2. Clean up the Makefiles and move most CXXFLAGS override into autoconf.

3. Those noexept(false) seem excessive, we should benefit from
conditionally marking more code "noexcept" at least in production.

4. Detecting whether Xerces was generated (either by autoconf or CMake)
with a compiler that's effectively running post-C++11

5. Work around a GCC 9.2 bug that crashes the loading of minidumps (I've
tested with GCC 6 to 10). Last I checked, the bug has been fixed in GCC
releases 10.1 and 9.3.

[resolves #9923]
[resolves #10047]
Co-authored-by: NMelanie Plageman <mplageman@pivotal.io>
Reviewed-by: NHans Zeller <hzeller@pivotal.io>
Reviewed-by: NAshuka Xue <axue@pivotal.io>
Reviewed-by: NDavid Kimura <dkimura@pivotal.io>
上级 afd31921
......@@ -18,6 +18,7 @@ addons:
- gcc-8
- libxml2
- libxml2-dev
- libxerces-c-dev
- libevent-dev
- libperl-dev
- g++-8
......@@ -69,6 +70,7 @@ matrix:
homebrew:
packages:
- ccache
- xerces-c
#
# Configuration variations
# ----------------------------------------------------------------
......@@ -146,7 +148,7 @@ script:
--enable-debug-extensions \
--with-perl \
--with-python \
--disable-orca \
--enable-orca \
--with-openssl \
--with-ldap \
--with-libcurl \
......@@ -154,7 +156,7 @@ script:
--enable-mapreduce \
--enable-orafce \
$C
make -s install
travis_wait 40 make -s install
source ${TRAVIS_BUILD_DIR}/gpsql/greenplum_path.sh
make -s unittest-check
make -C gpAux/gpdemo cluster
......@@ -168,7 +170,7 @@ script:
--prefix=${TRAVIS_BUILD_DIR}/gpsql \
--with-perl \
--with-python \
--disable-orca \
--enable-orca \
--with-openssl \
--with-ldap \
--with-libcurl \
......@@ -196,6 +198,8 @@ script:
--disable-pxf \
--disable-gpcloud \
--without-zstd \
--with-includes=$(brew --prefix xerces-c)/include \
--with-libs=$(brew --prefix xerces-c)/lib \
$C
make -s install
source ${TRAVIS_BUILD_DIR}/gpsql/greenplum_path.sh
......
......@@ -3,7 +3,7 @@
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(gpopt_master LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 98)
set(CMAKE_CXX_STANDARD 14)
# Default to shared libraries.
option(BUILD_SHARED_LIBS "build shared libraries" ON)
......
......@@ -6,4 +6,4 @@ override CPPFLAGS := -I$(top_srcdir)/src/backend/gporca/libgpdbcost/include $(CP
# backtracing.
override CXXFLAGS := -Werror -Wextra -Wpedantic -Wno-variadic-macros -fno-omit-frame-pointer $(CXXFLAGS)
# FIXME: this really should be done in autoconf
override CXXFLAGS := -std=gnu++98 $(CXXFLAGS)
override CXXFLAGS := -std=gnu++14 $(CXXFLAGS)
......@@ -331,8 +331,7 @@ namespace gpopt
SGroupAndExpression() : m_group_info(NULL), m_expr_index(gpos::ulong_max) {}
SGroupAndExpression(SGroupInfo *g, ULONG ix) : m_group_info(g), m_expr_index(ix) {}
SGroupAndExpression(const SGroupAndExpression &other) : m_group_info(other.m_group_info),
m_expr_index(other.m_expr_index) {}
SGroupAndExpression(const SGroupAndExpression &other) = default;
SExpressionInfo *GetExprInfo() const { return (*m_group_info->m_best_expr_info_array)[m_expr_index]; }
BOOL IsValid() { return NULL != m_group_info && gpos::ulong_max != m_expr_index; }
BOOL operator == (const SGroupAndExpression &other) const
......
......@@ -39,15 +39,14 @@ namespace gpos
// actual element to point to
T *m_object;
// hidden copy ctor
public:
CAutoP<T>
(
const CAutoP&
);
) = delete;
public:
// ctor
explicit
CAutoP<T>()
......
......@@ -35,12 +35,11 @@ namespace gpos
// actual element to point to
T *m_object_array;
// hidden copy ctor
CAutoRg<T>(const CAutoRg&);
public:
CAutoRg<T>(const CAutoRg&) = delete;
// ctor
explicit
CAutoRg<T>()
......
......@@ -111,14 +111,6 @@ namespace gpos
return m_d;
}
// assignment
inline CDouble& operator=(const CDouble &right)
{
this->m_d = right.m_d;
return (*this);
}
// arithmetic operators
friend CDouble operator + (const CDouble &left, const CDouble &right)
{
......
......@@ -19,8 +19,7 @@ namespace gpos
private:
// no copy constructor
SLink(const SLink&);
SLink(const SLink&) = delete;
public:
......
......@@ -63,8 +63,9 @@ namespace gpos
m_refs(1)
{}
// FIXME: should mark this noexcept in non-assert builds
// dtor
virtual ~CRefCount()
virtual ~CRefCount() noexcept(false)
{
// enforce strict ref-counting unless we're in a pending exception,
// e.g., a ctor has thrown
......
......@@ -68,8 +68,9 @@ namespace gpos
ELeakCheck leak_check_type = ElcExc
);
// FIXME: should mark this noexcept in non-assert builds
// dtor
~CAutoMemoryPool();
~CAutoMemoryPool() noexcept(false);
// accessor
CMemoryPool *Pmp() const
......
......@@ -160,6 +160,8 @@ namespace gpos
m_ulKey = elem.m_ulKey;
}
SElem& operator = (const SElem&) = default;
#ifdef GPOS_DEBUG
static
BOOL IsValid
......
......@@ -79,7 +79,7 @@ CAutoMemoryPool::Detach()
// (2) no checking while pending exception indicated and no pending exception
//
//---------------------------------------------------------------------------
CAutoMemoryPool::~CAutoMemoryPool()
CAutoMemoryPool::~CAutoMemoryPool() noexcept(false)
{
if (NULL == m_mp)
{
......
......@@ -45,7 +45,7 @@ namespace
private:
CAutoMemoryPool m_amp;
gpos::CAutoP<CDXLMemoryManager> m_apmm;
std::auto_ptr<SAX2XMLReader> m_apxmlreader;
std::unique_ptr<SAX2XMLReader> m_apxmlreader;
gpos::CAutoP<CParseHandlerManager> m_apphm;
gpos::CAutoP<CParseHandlerCostModel> m_apphCostModel;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册