summaryrefslogtreecommitdiff
path: root/src/mongo/bson
diff options
context:
space:
mode:
authorADAM David Alan Martin <adam.martin@10gen.com>2019-08-15 04:10:04 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-08-15 04:10:04 -0400
commit7eff30764a9d2137fc761e218dc2a58b6c006539 (patch)
treefc7c12ef222fb11353e9ac48dc7e1873785ba97d /src/mongo/bson
parenta810b1a727b2b4059c74bc9a17e04b0284ba9597 (diff)
downloadmongo-7eff30764a9d2137fc761e218dc2a58b6c006539.tar.gz
SERVER-41961 Remove the `NOINLINE_DECL` and replace with `MONGO_COMPILER_NOINLINE`
Also removed the `PACKED_DECL`, since it isn't used.
Diffstat (limited to 'src/mongo/bson')
-rw-r--r--src/mongo/bson/bson_validate.cpp4
-rw-r--r--src/mongo/bson/bsonelement.cpp5
-rw-r--r--src/mongo/bson/inline_decls.h47
-rw-r--r--src/mongo/bson/mutable/document.cpp3
-rw-r--r--src/mongo/bson/util/builder.h1
5 files changed, 7 insertions, 53 deletions
diff --git a/src/mongo/bson/bson_validate.cpp b/src/mongo/bson/bson_validate.cpp
index 40edd405c9b..3a7a9bf728e 100644
--- a/src/mongo/bson/bson_validate.cpp
+++ b/src/mongo/bson/bson_validate.cpp
@@ -48,7 +48,9 @@ namespace {
* 'elemName' should be the known, validated field name of the element containing the error, if it
* exists. Otherwise, it should be empty.
*/
-Status NOINLINE_DECL makeError(StringData baseMsg, BSONElement idElem, StringData elemName) {
+MONGO_COMPILER_NOINLINE Status makeError(StringData baseMsg,
+ BSONElement idElem,
+ StringData elemName) {
str::stream msg;
msg << baseMsg;
diff --git a/src/mongo/bson/bsonelement.cpp b/src/mongo/bson/bsonelement.cpp
index 7562b7ca408..c72e61eb888 100644
--- a/src/mongo/bson/bsonelement.cpp
+++ b/src/mongo/bson/bsonelement.cpp
@@ -697,10 +697,11 @@ BSONElement BSONElement::operator[](StringData field) const {
}
namespace {
-NOINLINE_DECL void msgAssertedBadType [[noreturn]] (int8_t type) {
+MONGO_COMPILER_NOINLINE void msgAssertedBadType [[noreturn]] (int8_t type) {
msgasserted(10320, str::stream() << "BSONElement: bad type " << (int)type);
}
} // namespace
+
int BSONElement::computeSize() const {
enum SizeStyle : uint8_t {
kFixed, // Total size is a fixed amount + key length.
@@ -759,7 +760,7 @@ int BSONElement::computeSize() const {
if (MONGO_likely(sizeInfo.style == SizeStyle::kIntPlusFixed))
return sizeInfo.bytes + fieldNameSize() + valuestrsize();
- return [this, type]() NOINLINE_DECL {
+ return [this, type]() {
// Regex is two c-strings back-to-back.
invariant(type == BSONType::RegEx);
const char* p = value();
diff --git a/src/mongo/bson/inline_decls.h b/src/mongo/bson/inline_decls.h
deleted file mode 100644
index 848050bf404..00000000000
--- a/src/mongo/bson/inline_decls.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#pragma once
-
-#if defined(__GNUC__)
-
-#define NOINLINE_DECL __attribute__((noinline))
-#define PACKED_DECL __attribute__((packed))
-
-#elif defined(_MSC_VER)
-
-#define NOINLINE_DECL __declspec(noinline)
-#define PACKED_DECL
-
-#else
-
-#define NOINLINE_DECL
-#define PACKED_DECL
-
-#endif
diff --git a/src/mongo/bson/mutable/document.cpp b/src/mongo/bson/mutable/document.cpp
index 443c57cebf1..d042e2a458f 100644
--- a/src/mongo/bson/mutable/document.cpp
+++ b/src/mongo/bson/mutable/document.cpp
@@ -38,7 +38,6 @@
#include <vector>
#include "mongo/base/static_assert.h"
-#include "mongo/bson/inline_decls.h"
#include "mongo/bson/mutable/damage_vector.h"
#include "mongo/util/debug_util.h"
@@ -559,7 +558,7 @@ bool canAttach(const Element::RepIdx id, const ElementRep& rep) {
// Returns a Status describing why 'canAttach' returned false. This function should not
// be inlined since it just makes the callers larger for no real gain.
-NOINLINE_DECL Status getAttachmentError(const ElementRep& rep);
+MONGO_COMPILER_NOINLINE Status getAttachmentError(const ElementRep& rep);
Status getAttachmentError(const ElementRep& rep) {
if (rep.sibling.left != Element::kInvalidRepIdx)
return Status(ErrorCodes::IllegalOperation, "dangling left sibling");
diff --git a/src/mongo/bson/util/builder.h b/src/mongo/bson/util/builder.h
index ce6c9b9779b..a6c821c5b0f 100644
--- a/src/mongo/bson/util/builder.h
+++ b/src/mongo/bson/util/builder.h
@@ -45,7 +45,6 @@
#include "mongo/base/static_assert.h"
#include "mongo/base/string_data.h"
#include "mongo/bson/bsontypes.h"
-#include "mongo/bson/inline_decls.h"
#include "mongo/platform/decimal128.h"
#include "mongo/stdx/type_traits.h"
#include "mongo/util/allocator.h"