Skip to content

Commit 349d232

Browse files
authored
GH-47099: [C++][Parquet] Add missing pragma warning(pop) to parquet/platform.h (#47114)
### Rationale for this change The missing pragma is causing warnings downstream see #47099 ### What changes are included in this PR? * Add the missing `pragma warning(pop)` * Use `pragma warning(disable : 4250)` explicitly in other `.cc`/`.h` * Add missing `PARQUET_EXPORT` ### Are these changes tested? Yes. ### Are there any user-facing changes? The developer should see less warnings otherwise, no. * GitHub Issue: #47099 Authored-by: Michael Behrisch <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
1 parent 0c8ce5f commit 349d232

File tree

7 files changed

+44
-3
lines changed

7 files changed

+44
-3
lines changed

cpp/src/parquet/column_reader.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
#include "parquet/thrift_internal.h" // IWYU pragma: keep
5858
#include "parquet/windows_fixup.h" // for OPTIONAL
5959

60+
#ifdef _MSC_VER
61+
// disable warning about inheritance via dominance in the diamond pattern
62+
# pragma warning(disable : 4250)
63+
#endif
64+
6065
using arrow::MemoryPool;
6166
using arrow::internal::AddWithOverflow;
6267
using arrow::internal::checked_cast;

cpp/src/parquet/decoder.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@
5353
#include "parquet/schema.h"
5454
#include "parquet/types.h"
5555

56+
#ifdef _MSC_VER
57+
// disable warning about inheritance via dominance in the diamond pattern
58+
# pragma warning(disable : 4250)
59+
#endif
60+
5661
namespace bit_util = arrow::bit_util;
5762

5863
using arrow::Status;

cpp/src/parquet/encoder.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@
4949
#include "parquet/schema.h"
5050
#include "parquet/types.h"
5151

52+
#ifdef _MSC_VER
53+
// disable warning about inheritance via dominance in the diamond pattern
54+
# pragma warning(disable : 4250)
55+
#endif
56+
5257
namespace bit_util = arrow::bit_util;
5358

5459
using arrow::Status;

cpp/src/parquet/exception.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@
2626
#include "arrow/util/string_util.h"
2727
#include "parquet/platform.h"
2828

29+
#ifdef _MSC_VER
30+
# pragma warning(push)
31+
// Disable warning for STL types usage in DLL interface
32+
// https://web.archive.org/web/20130317015847/http://connect.microsoft.com/VisualStudio/feedback/details/696593/vc-10-vs-2010-basic-string-exports
33+
# pragma warning(disable : 4275 4251)
34+
// Disable diamond inheritance warnings
35+
# pragma warning(disable : 4250)
36+
// Disable macro redefinition warnings
37+
# pragma warning(disable : 4005)
38+
// Disable extern before exported template warnings
39+
# pragma warning(disable : 4910)
40+
#endif
41+
2942
// PARQUET-1085
3043
#if !defined(ARROW_UNUSED)
3144
# define ARROW_UNUSED(x) UNUSED(x)
@@ -84,7 +97,7 @@
8497

8598
namespace parquet {
8699

87-
class ParquetException : public std::exception {
100+
class PARQUET_EXPORT ParquetException : public std::exception {
88101
public:
89102
PARQUET_NORETURN static void EofException(const std::string& msg = "") {
90103
static std::string prefix = "Unexpected end of stream";
@@ -156,3 +169,7 @@ void ThrowNotOk(StatusReturnBlock&& b) {
156169
}
157170

158171
} // namespace parquet
172+
173+
#ifdef _MSC_VER
174+
# pragma warning(pop)
175+
#endif

cpp/src/parquet/hasher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
namespace parquet {
2424
// Abstract class for hash
25-
class Hasher {
25+
class PARQUET_EXPORT Hasher {
2626
public:
2727
/// Compute hash for 32 bits value by using its plain encoding result.
2828
///

cpp/src/parquet/platform.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#if defined(_WIN32) || defined(__CYGWIN__)
3030

31-
# if defined(_MSC_VER)
31+
# ifdef _MSC_VER
3232
# pragma warning(push)
3333
// Disable warning for STL types usage in DLL interface
3434
// https://web.archive.org/web/20130317015847/http://connect.microsoft.com/VisualStudio/feedback/details/696593/vc-10-vs-2010-basic-string-exports
@@ -110,3 +110,7 @@ std::shared_ptr<ResizableBuffer> AllocateBuffer(
110110
::arrow::MemoryPool* pool = ::arrow::default_memory_pool(), int64_t size = 0);
111111

112112
} // namespace parquet
113+
114+
#ifdef _MSC_VER
115+
# pragma warning(pop)
116+
#endif

cpp/src/parquet/types.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939

4040
#include "generated/parquet_types.h"
4141

42+
#ifdef _MSC_VER
43+
// disable warning about inheritance via dominance in the diamond pattern
44+
# pragma warning(disable : 4250)
45+
#endif
46+
4247
using arrow::internal::checked_cast;
4348
using arrow::util::Codec;
4449

0 commit comments

Comments
 (0)