Commit 73a01874 authored by Kenton Varda's avatar Kenton Varda

Eliminate deprecation warnings from testing our own deprecated interfaces.

parent 715e6b6b
...@@ -51,6 +51,12 @@ namespace capnp { ...@@ -51,6 +51,12 @@ namespace capnp {
#define CAPNP_LITE 0 #define CAPNP_LITE 0
#endif #endif
#if CAPNP_TESTING_CAPNP // defined in Cap'n Proto's own unit tests; others should not define this
#define CAPNP_DEPRECATED(reason)
#else
#define CAPNP_DEPRECATED KJ_DEPRECATED
#endif
typedef unsigned int uint; typedef unsigned int uint;
struct Void { struct Void {
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#define CAPNP_TESTING_CAPNP 1
#include "ez-rpc.h" #include "ez-rpc.h"
#include "test-util.h" #include "test-util.h"
#include <kj/compat/gtest.h> #include <kj/compat/gtest.h>
......
...@@ -130,10 +130,10 @@ public: ...@@ -130,10 +130,10 @@ public:
// Get the server's main (aka "bootstrap") interface. // Get the server's main (aka "bootstrap") interface.
template <typename Type> template <typename Type>
typename Type::Client importCap(kj::StringPtr name) typename Type::Client importCap(kj::StringPtr name) CAPNP_DEPRECATED(
KJ_DEPRECATED("Change your server to export a main interface, then use getMain() instead."); "Change your server to export a main interface, then use getMain() instead.");
Capability::Client importCap(kj::StringPtr name) Capability::Client importCap(kj::StringPtr name) CAPNP_DEPRECATED(
KJ_DEPRECATED("Change your server to export a main interface, then use getMain() instead."); "Change your server to export a main interface, then use getMain() instead.");
// ** DEPRECATED ** // ** DEPRECATED **
// //
// Ask the sever for the capability with the given name. You may specify a type to automatically // Ask the sever for the capability with the given name. You may specify a type to automatically
...@@ -198,12 +198,12 @@ public: ...@@ -198,12 +198,12 @@ public:
explicit EzRpcServer(kj::StringPtr bindAddress, uint defaultPort = 0, explicit EzRpcServer(kj::StringPtr bindAddress, uint defaultPort = 0,
ReaderOptions readerOpts = ReaderOptions()) ReaderOptions readerOpts = ReaderOptions())
KJ_DEPRECATED("Please specify a main interface for your server."); CAPNP_DEPRECATED("Please specify a main interface for your server.");
EzRpcServer(struct sockaddr* bindAddress, uint addrSize, EzRpcServer(struct sockaddr* bindAddress, uint addrSize,
ReaderOptions readerOpts = ReaderOptions()) ReaderOptions readerOpts = ReaderOptions())
KJ_DEPRECATED("Please specify a main interface for your server."); CAPNP_DEPRECATED("Please specify a main interface for your server.");
EzRpcServer(int socketFd, uint port, ReaderOptions readerOpts = ReaderOptions()) EzRpcServer(int socketFd, uint port, ReaderOptions readerOpts = ReaderOptions())
KJ_DEPRECATED("Please specify a main interface for your server."); CAPNP_DEPRECATED("Please specify a main interface for your server.");
~EzRpcServer() noexcept(false); ~EzRpcServer() noexcept(false);
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#define CAPNP_TESTING_CAPNP 1
#include "rpc.h" #include "rpc.h"
#include "test-util.h" #include "test-util.h"
#include "schema.h" #include "schema.h"
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#define CAPNP_TESTING_CAPNP 1
#include "rpc-twoparty.h" #include "rpc-twoparty.h"
#include "test-util.h" #include "test-util.h"
#include <capnp/rpc.capnp.h> #include <capnp/rpc.capnp.h>
......
...@@ -99,7 +99,7 @@ public: ...@@ -99,7 +99,7 @@ public:
// Connect to the given vat and return its bootstrap interface. // Connect to the given vat and return its bootstrap interface.
Capability::Client restore(typename VatId::Reader hostId, AnyPointer::Reader objectId) Capability::Client restore(typename VatId::Reader hostId, AnyPointer::Reader objectId)
KJ_DEPRECATED("Please transition to using a bootstrap interface instead."); CAPNP_DEPRECATED("Please transition to using a bootstrap interface instead.");
// ** DEPRECATED ** // ** DEPRECATED **
// //
// Restores the given SturdyRef from the network and return the capability representing it. // Restores the given SturdyRef from the network and return the capability representing it.
...@@ -196,7 +196,7 @@ template <typename VatId, typename LocalSturdyRefObjectId, ...@@ -196,7 +196,7 @@ template <typename VatId, typename LocalSturdyRefObjectId,
RpcSystem<VatId> makeRpcServer( RpcSystem<VatId> makeRpcServer(
VatNetwork<VatId, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>& network, VatNetwork<VatId, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>& network,
SturdyRefRestorer<LocalSturdyRefObjectId>& restorer) SturdyRefRestorer<LocalSturdyRefObjectId>& restorer)
KJ_DEPRECATED("Please transition to using a bootstrap interface instead."); CAPNP_DEPRECATED("Please transition to using a bootstrap interface instead.");
// ** DEPRECATED ** // ** DEPRECATED **
// //
// Create an RPC server which exports multiple main interfaces by object ID. The `restorer` object // Create an RPC server which exports multiple main interfaces by object ID. The `restorer` object
...@@ -254,8 +254,7 @@ class SturdyRefRestorer: public _::SturdyRefRestorerBase { ...@@ -254,8 +254,7 @@ class SturdyRefRestorer: public _::SturdyRefRestorerBase {
// string names. // string names.
public: public:
virtual Capability::Client restore(typename SturdyRefObjectId::Reader ref) virtual Capability::Client restore(typename SturdyRefObjectId::Reader ref) CAPNP_DEPRECATED(
KJ_DEPRECATED(
"Please transition to using bootstrap interfaces instead of SturdyRefRestorer.") = 0; "Please transition to using bootstrap interfaces instead of SturdyRefRestorer.") = 0;
// Restore the given object, returning a capability representing it. // Restore the given object, returning a capability representing it.
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#define CAPNP_TESTING_CAPNP 1
#include "schema-loader.h" #include "schema-loader.h"
#include <kj/compat/gtest.h> #include <kj/compat/gtest.h>
#include "test-util.h" #include "test-util.h"
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#define CAPNP_TESTING_CAPNP 1
#include "schema-parser.h" #include "schema-parser.h"
#include <kj/compat/gtest.h> #include <kj/compat/gtest.h>
#include "test-util.h" #include "test-util.h"
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#define CAPNP_TESTING_CAPNP 1
#include "schema.h" #include "schema.h"
#include <kj/compat/gtest.h> #include <kj/compat/gtest.h>
#include "test-util.h" #include "test-util.h"
......
...@@ -82,7 +82,7 @@ public: ...@@ -82,7 +82,7 @@ public:
// Get the encoded schema node content as a single message segment. It is safe to read as an // Get the encoded schema node content as a single message segment. It is safe to read as an
// unchecked message. // unchecked message.
Schema getDependency(uint64_t id) const KJ_DEPRECATED("Does not handle generics correctly."); Schema getDependency(uint64_t id) const CAPNP_DEPRECATED("Does not handle generics correctly.");
// DEPRECATED: This method cannot correctly account for generic type parameter bindings that // DEPRECATED: This method cannot correctly account for generic type parameter bindings that
// may apply to the dependency. Instead of using this method, use a method of the Schema API // may apply to the dependency. Instead of using this method, use a method of the Schema API
// that corresponds to the exact kind of dependency. For example, to get a field type, use // that corresponds to the exact kind of dependency. For example, to get a field type, use
...@@ -706,7 +706,7 @@ public: ...@@ -706,7 +706,7 @@ public:
// Construct the schema for a list of the given type. // Construct the schema for a list of the given type.
static ListSchema of(schema::Type::Reader elementType, Schema context) static ListSchema of(schema::Type::Reader elementType, Schema context)
KJ_DEPRECATED("Does not handle generics correctly."); CAPNP_DEPRECATED("Does not handle generics correctly.");
// DEPRECATED: This method cannot correctly account for generic type parameter bindings that // DEPRECATED: This method cannot correctly account for generic type parameter bindings that
// may apply to the input type. Instead of using this method, use a method of the Schema API // may apply to the input type. Instead of using this method, use a method of the Schema API
// that corresponds to the exact kind of dependency. For example, to get a field type, use // that corresponds to the exact kind of dependency. For example, to get a field type, use
......
...@@ -202,6 +202,11 @@ typedef unsigned char byte; ...@@ -202,6 +202,11 @@ typedef unsigned char byte;
// TODO(msvc): Again, here, MSVC prefers a prefix, __declspec(deprecated). // TODO(msvc): Again, here, MSVC prefers a prefix, __declspec(deprecated).
#endif #endif
#if KJ_TESTING_KJ // defined in KJ's own unit tests; others should not define this
#undef KJ_DEPRECATED
#define KJ_DEPRECATED(reason)
#endif
namespace _ { // private namespace _ { // private
KJ_NORETURN(void inlineRequireFailure( KJ_NORETURN(void inlineRequireFailure(
......
...@@ -1759,7 +1759,7 @@ public: ...@@ -1759,7 +1759,7 @@ public:
}); });
if (overshot) { if (overshot) {
promise = promise.then([this,amount,&input](uint64_t actual) -> kj::Promise<uint64_t> { promise = promise.then([amount,&input](uint64_t actual) -> kj::Promise<uint64_t> {
if (actual == amount) { if (actual == amount) {
// We read exactly the amount expected. In order to detect an overshoot, we have to // We read exactly the amount expected. In order to detect an overshoot, we have to
// try reading one more byte. Ugh. // try reading one more byte. Ugh.
......
...@@ -157,7 +157,7 @@ TEST(Mutex, When) { ...@@ -157,7 +157,7 @@ TEST(Mutex, When) {
threads.add(kj::heap<kj::Thread>([i,&value]() { threads.add(kj::heap<kj::Thread>([i,&value]() {
if (i % 2 == 0) delay(); if (i % 2 == 0) delay();
uint m = value.when([i](const uint& n) { return n == i; }, uint m = value.when([i](const uint& n) { return n == i; },
[i](uint& n) { return n++; }); [](uint& n) { return n++; });
KJ_ASSERT(m == i); KJ_ASSERT(m == i);
})); }));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment