[
https://issues.apache.org/jira/browse/ARROW-2316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16400784#comment-16400784
]
ASF GitHub Bot commented on ARROW-2316:
---------------------------------------
wesm closed pull request #1756: ARROW-2316: [C++] Revert Buffer::mutable_data
to inline so that linkers do not have to remember to define NDEBUG for release
builds
URL: https://github.com/apache/arrow/pull/1756
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/cpp/src/arrow/buffer.cc b/cpp/src/arrow/buffer.cc
index e32e02c9f..60dd154e4 100644
--- a/cpp/src/arrow/buffer.cc
+++ b/cpp/src/arrow/buffer.cc
@@ -70,13 +70,7 @@ Status Buffer::FromString(const std::string& data,
std::shared_ptr<Buffer>* out)
return FromString(data, default_memory_pool(), out);
}
-#ifndef NDEBUG
-// DCHECK macros aren't allowed in public include files
-uint8_t* Buffer::mutable_data() {
- DCHECK(is_mutable());
- return mutable_data_;
-}
-#endif
+void Buffer::CheckMutable() const { DCHECK(is_mutable()) << "buffer not
mutable"; }
PoolBuffer::PoolBuffer(MemoryPool* pool) : ResizableBuffer(nullptr, 0) {
if (pool == nullptr) {
diff --git a/cpp/src/arrow/buffer.h b/cpp/src/arrow/buffer.h
index ad11ff943..06160d7d4 100644
--- a/cpp/src/arrow/buffer.h
+++ b/cpp/src/arrow/buffer.h
@@ -117,11 +117,13 @@ class ARROW_EXPORT Buffer {
int64_t capacity() const { return capacity_; }
const uint8_t* data() const { return data_; }
-#ifdef NDEBUG
- uint8_t* mutable_data() { return mutable_data_; }
-#else
- uint8_t* mutable_data();
+
+ uint8_t* mutable_data() {
+#ifndef NDEBUG
+ CheckMutable();
#endif
+ return mutable_data_;
+ }
int64_t size() const { return size_; }
@@ -137,6 +139,8 @@ class ARROW_EXPORT Buffer {
// null by default, but may be set
std::shared_ptr<Buffer> parent_;
+ void CheckMutable() const;
+
private:
ARROW_DISALLOW_COPY_AND_ASSIGN(Buffer);
};
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [C++] Revert Buffer::mutable_data member to always inline
> ---------------------------------------------------------
>
> Key: ARROW-2316
> URL: https://issues.apache.org/jira/browse/ARROW-2316
> Project: Apache Arrow
> Issue Type: Bug
> Components: C++
> Reporter: Wes McKinney
> Assignee: Wes McKinney
> Priority: Major
> Labels: pull-request-available
> Fix For: 0.9.0
>
>
> If not, linkers must remember to define {{NDEBUG}} depending on whether Arrow
> was built in release mode or not
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)