From 79373c372dca7a7d356dad8cbc4c075ecbc693c8 Mon Sep 17 00:00:00 2001 From: agiardullo Date: Fri, 17 Jul 2015 11:04:55 -0700 Subject: [PATCH] Fix ROCKSDB_WARNING Summary: ROCKSDB_WARNING is only defined if either ROCKSDB_PLATFORM_POSIX or OS_WIN is defined. This works well for building rocksdb with its own build scripts. But this won't work when an outside project(like mongodb) doesn't define ROCKSDB_PLATFORM_POSIX. This fix defines ROCKSDB_WARNING for all platforms. No idea if its defined correctly on non-posix,non-windows platforms but this is no worse that the current situation where this macro is missing on unexpected platforms. This fix should hopefully fix anyone whose build broke now that we've switched from using #warning to Pragma (to support windows). Unfortunately, while mongo-rocks compiles, it ignores the Pragma and doesn't print a warning. I have not been able to figure out a way to implement this portably on all platforms. Of course, an alternate solution would be to just get rid of ROCKSDB_WARNING and live with include file redirects indefinitely. Thoughts? Test Plan: build rocks, build mongorocks Reviewers: igor, kradhakrishnan, IslamAbdelRahman, sdong Reviewed By: sdong Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D42477 --- include/rocksdb/utilities/convenience.h | 6 +++--- include/{ => rocksdb}/utilities/pragma_error.h | 2 +- include/utilities/backupable_db.h | 2 +- include/utilities/db_ttl.h | 2 +- include/utilities/document_db.h | 2 +- include/utilities/geo_db.h | 2 +- include/utilities/json_document.h | 2 +- include/utilities/stackable_db.h | 2 +- include/utilities/utility_db.h | 2 +- java/rocksjni/options.cc | 2 +- util/db_test_util.h | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) rename include/{ => rocksdb}/utilities/pragma_error.h (96%) diff --git a/include/rocksdb/utilities/convenience.h b/include/rocksdb/utilities/convenience.h index 35d804d4d..b68cdf2f9 100644 --- a/include/rocksdb/utilities/convenience.h +++ b/include/rocksdb/utilities/convenience.h @@ -5,8 +5,8 @@ #pragma once -// #include "utilities/pragma_error.h" -// TODO(agiardullo): need to figure out how to make this portable -// ROCKSDB_WARNING("This file was moved to rocksdb/convenience.h") +#include "rocksdb/utilities/pragma_error.h" + +ROCKSDB_WARNING("This file was moved to rocksdb/convenience.h") #include "rocksdb/convenience.h" diff --git a/include/utilities/pragma_error.h b/include/rocksdb/utilities/pragma_error.h similarity index 96% rename from include/utilities/pragma_error.h rename to include/rocksdb/utilities/pragma_error.h index 53cde1000..35e7ab8ae 100644 --- a/include/utilities/pragma_error.h +++ b/include/rocksdb/utilities/pragma_error.h @@ -13,7 +13,7 @@ #define RDB_STR__(x) #x #define RDB_STR(x) RDB_STR__(x) -#if defined(ROCKSDB_PLATFORM_POSIX) +#if defined(__GNUC__) || defined(__clang__) // Wrap unportable warning macro #define ROCKSDB_WARNING(x) _Pragma(RDB_STR(GCC warning x)) diff --git a/include/utilities/backupable_db.h b/include/utilities/backupable_db.h index 4ee239cc7..c2ef2c2ac 100644 --- a/include/utilities/backupable_db.h +++ b/include/utilities/backupable_db.h @@ -9,7 +9,7 @@ #pragma once -#include "pragma_error.h" +#include "rocksdb/utilities/pragma_error.h" ROCKSDB_WARNING( "Warning: This file was moved to rocksdb/utilities/backupable_db.h") diff --git a/include/utilities/db_ttl.h b/include/utilities/db_ttl.h index 452012df3..e50746be4 100644 --- a/include/utilities/db_ttl.h +++ b/include/utilities/db_ttl.h @@ -5,7 +5,7 @@ #pragma once -#include "pragma_error.h" +#include "rocksdb/utilities/pragma_error.h" ROCKSDB_WARNING("This file was moved to rocksdb/utilities/db_ttl.h") diff --git a/include/utilities/document_db.h b/include/utilities/document_db.h index 9c4a388ea..de4b9d388 100644 --- a/include/utilities/document_db.h +++ b/include/utilities/document_db.h @@ -5,7 +5,7 @@ #pragma once -#include "pragma_error.h" +#include "rocksdb/utilities/pragma_error.h" ROCKSDB_WARNING("This file was moved to rocksdb/utilities/document_db.h") diff --git a/include/utilities/geo_db.h b/include/utilities/geo_db.h index ae2e8c47f..d161cd122 100644 --- a/include/utilities/geo_db.h +++ b/include/utilities/geo_db.h @@ -5,7 +5,7 @@ #pragma once -#include "pragma_error.h" +#include "rocksdb/utilities/pragma_error.h" ROCKSDB_WARNING("This file was moved to rocksdb/utilities/geo_db.h") diff --git a/include/utilities/json_document.h b/include/utilities/json_document.h index fb8b7d304..17e17c088 100644 --- a/include/utilities/json_document.h +++ b/include/utilities/json_document.h @@ -4,7 +4,7 @@ // of patent rights can be found in the PATENTS file in the same directory. #pragma once -#include "pragma_error.h" +#include "rocksdb/utilities/pragma_error.h" ROCKSDB_WARNING("This file was moved to rocksdb/utilities/json_document.h") diff --git a/include/utilities/stackable_db.h b/include/utilities/stackable_db.h index 8f72b04a6..9fe43fabb 100644 --- a/include/utilities/stackable_db.h +++ b/include/utilities/stackable_db.h @@ -3,7 +3,7 @@ // found in the LICENSE file. See the AUTHORS file for names of contributors. #pragma once -#include "pragma_error.h" +#include "rocksdb/utilities/pragma_error.h" ROCKSDB_WARNING("This file was moved to rocksdb/utilities/stackable_db.h") diff --git a/include/utilities/utility_db.h b/include/utilities/utility_db.h index 846980100..1e71fae22 100644 --- a/include/utilities/utility_db.h +++ b/include/utilities/utility_db.h @@ -4,7 +4,7 @@ #pragma once -#include "pragma_error.h" +#include "rocksdb/utilities/pragma_error.h" ROCKSDB_WARNING("This file was moved to rocksdb/utilities/utility_db.h") diff --git a/java/rocksjni/options.cc b/java/rocksjni/options.cc index c1d30ee16..15257ec67 100644 --- a/java/rocksjni/options.cc +++ b/java/rocksjni/options.cc @@ -30,8 +30,8 @@ #include "rocksdb/slice_transform.h" #include "rocksdb/rate_limiter.h" #include "rocksdb/comparator.h" +#include "rocksdb/convenience.h" #include "rocksdb/merge_operator.h" -#include "rocksdb/utilities/convenience.h" #include "utilities/merge_operators.h" /* diff --git a/util/db_test_util.h b/util/db_test_util.h index 2b7dd94d0..781977646 100644 --- a/util/db_test_util.h +++ b/util/db_test_util.h @@ -31,6 +31,7 @@ #include "db/filename.h" #include "rocksdb/cache.h" #include "rocksdb/compaction_filter.h" +#include "rocksdb/convenience.h" #include "rocksdb/db.h" #include "rocksdb/env.h" #include "rocksdb/filter_policy.h" @@ -38,7 +39,6 @@ #include "rocksdb/slice.h" #include "rocksdb/table.h" #include "rocksdb/utilities/checkpoint.h" -#include "rocksdb/convenience.h" #include "table/block_based_table_factory.h" #include "table/mock_table.h" #include "table/plain_table_factory.h"