From bbef20780c0e9c6d525315b930bae4e4be1d3cc9 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 1 Jun 2021 08:59:29 -0700 Subject: mongodb: Fix -Wc++11-narrowing warning on 32bit Signed-off-by: Khem Raj --- .../0001-Use-explicit-typecast-to-size_t.patch | 35 ++++++++++++++++++++++ .../meta-python/recipes-dbs/mongodb/mongodb_git.bb | 1 + 2 files changed, 36 insertions(+) create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-explicit-typecast-to-size_t.patch diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-explicit-typecast-to-size_t.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-explicit-typecast-to-size_t.patch new file mode 100644 index 0000000000..5b724ff8aa --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-explicit-typecast-to-size_t.patch @@ -0,0 +1,35 @@ +From 6fdb2d304e05a17e57b2efd7f8252794a8722dbe Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 1 Jun 2021 08:25:36 -0700 +Subject: [PATCH] Use explicit typecast to size_t + +maxMemoryUsageBytes is size_t type which may not match long long value +internalDocumentSourceGroupMaxMemoryBytes.load() returns, so typecast it +to avoid narrowing warning from clang + +document_source_group.cpp:378:22: error: non-constant-expression cannot be narrowed from type 'long long' to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing] + maxMemoryUsageBytes ? *maxMemoryUsageBytes + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Upstream-Status: Submitted [https://github.com/mongodb/mongo/pull/1405] +Signed-off-by: Khem Raj +--- + src/mongo/db/pipeline/document_source_group.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/mongo/db/pipeline/document_source_group.cpp b/src/mongo/db/pipeline/document_source_group.cpp +index c7bf44e72e..a52906a940 100644 +--- a/src/mongo/db/pipeline/document_source_group.cpp ++++ b/src/mongo/db/pipeline/document_source_group.cpp +@@ -376,7 +376,7 @@ DocumentSourceGroup::DocumentSourceGroup(const intrusive_ptr& + _doingMerge(false), + _memoryTracker{pExpCtx->allowDiskUse && !pExpCtx->inMongos, + maxMemoryUsageBytes ? *maxMemoryUsageBytes +- : internalDocumentSourceGroupMaxMemoryBytes.load()}, ++ : (size_t)internalDocumentSourceGroupMaxMemoryBytes.load()}, + _initialized(false), + _groups(pExpCtx->getValueComparator().makeUnorderedValueMap()), + _spilled(false) { +-- +2.31.1 + diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb index ba6d052e43..95e0cf7a88 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb @@ -30,6 +30,7 @@ SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.4 \ file://disable_runtime_check.patch \ file://ppc64_ARCH_BITS.patch \ file://0001-Do-not-use-MINSIGSTKSZ.patch \ + file://0001-Use-explicit-typecast-to-size_t.patch \ " SRC_URI_append_libc-musl ="\ file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \ -- cgit v1.2.3-54-g00ecf