Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Add macro for deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
xhochy committed Jul 26, 2018
1 parent e0e4946 commit 07ffc73
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/parquet/types-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ TEST(TestLogicalTypeToString, LogicalTypes) {
}

TEST(TypePrinter, StatisticsTypes) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
std::string smin;
std::string smax;
int32_t int_min = 1024;
Expand Down Expand Up @@ -130,6 +132,7 @@ TEST(TypePrinter, StatisticsTypes) {
ASSERT_STREQ("ijklmnop", FormatStatValue(Type::FIXED_LEN_BYTE_ARRAY, smax).c_str());
ASSERT_STREQ("ijklmnop",
FormatStatValue(Type::FIXED_LEN_BYTE_ARRAY, smax.c_str()).c_str());
#pragma GCC diagnostic pop
}

} // namespace parquet
2 changes: 2 additions & 0 deletions src/parquet/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include "arrow/util/macros.h"

#include "parquet/util/macros.h"
#include "parquet/util/visibility.h"

namespace parquet {
Expand Down Expand Up @@ -296,6 +297,7 @@ PARQUET_EXPORT std::string FormatStatValue(Type::type parquet_type,
const std::string& val);

/// \deprecated Since 1.5.0
PARQUET_DEPRECATED("Use std::string instead of char* as input")
PARQUET_EXPORT std::string FormatStatValue(Type::type parquet_type, const char* val);

PARQUET_EXPORT int GetTypeByteSize(Type::type t);
Expand Down
15 changes: 15 additions & 0 deletions src/parquet/util/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,19 @@
#define FRIEND_TEST(test_case_name, test_name) \
friend class test_case_name##_##test_name##_Test

// clang-format off
// [[deprecated]] is only available in C++14, use this for the time being
// This macro takes an optional deprecation message
#if __cplusplus <= 201103L
# ifdef __GNUC__
# define PARQUET_DEPRECATED(...) __attribute__((deprecated(__VA_ARGS__)))
# elif defined(_MSC_VER)
# define PARQUET_DEPRECATED(...) __declspec(deprecated(__VA_ARGS__))
# else
# define PARQUET_DEPRECATED(...)
# endif
#else
# define PARQUET_DEPRECATED(...) [[deprecated(__VA_ARGS__)]]
#endif

#endif // PARQUET_UTIL_MACROS_H

0 comments on commit 07ffc73

Please sign in to comment.