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 {
#define CAPNP_LITE 0
#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;
struct Void {
......
......@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#define CAPNP_TESTING_CAPNP 1
#include "ez-rpc.h"
#include "test-util.h"
#include <kj/compat/gtest.h>
......
......@@ -130,10 +130,10 @@ public:
// Get the server's main (aka "bootstrap") interface.
template <typename Type>
typename Type::Client importCap(kj::StringPtr name)
KJ_DEPRECATED("Change your server to export a main interface, then use getMain() instead.");
Capability::Client importCap(kj::StringPtr name)
KJ_DEPRECATED("Change your server to export a main interface, then use getMain() instead.");
typename Type::Client importCap(kj::StringPtr name) CAPNP_DEPRECATED(
"Change your server to export a main interface, then use getMain() instead.");
Capability::Client importCap(kj::StringPtr name) CAPNP_DEPRECATED(
"Change your server to export a main interface, then use getMain() instead.");
// ** DEPRECATED **
//
// Ask the sever for the capability with the given name. You may specify a type to automatically
......@@ -198,12 +198,12 @@ public:
explicit EzRpcServer(kj::StringPtr bindAddress, uint defaultPort = 0,
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,
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())
KJ_DEPRECATED("Please specify a main interface for your server.");
CAPNP_DEPRECATED("Please specify a main interface for your server.");
~EzRpcServer() noexcept(false);
......
......@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#define CAPNP_TESTING_CAPNP 1
#include "rpc.h"
#include "test-util.h"
#include "schema.h"
......
......@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#define CAPNP_TESTING_CAPNP 1
#include "rpc-twoparty.h"
#include "test-util.h"
#include <capnp/rpc.capnp.h>
......
......@@ -99,7 +99,7 @@ public:
// Connect to the given vat and return its bootstrap interface.
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 **
//
// Restores the given SturdyRef from the network and return the capability representing it.
......@@ -196,7 +196,7 @@ template <typename VatId, typename LocalSturdyRefObjectId,
RpcSystem<VatId> makeRpcServer(
VatNetwork<VatId, ProvisionId, RecipientId, ThirdPartyCapId, JoinResult>& network,
SturdyRefRestorer<LocalSturdyRefObjectId>& restorer)
KJ_DEPRECATED("Please transition to using a bootstrap interface instead.");
CAPNP_DEPRECATED("Please transition to using a bootstrap interface instead.");
// ** DEPRECATED **
//
// Create an RPC server which exports multiple main interfaces by object ID. The `restorer` object
......@@ -254,9 +254,8 @@ class SturdyRefRestorer: public _::SturdyRefRestorerBase {
// string names.
public:
virtual Capability::Client restore(typename SturdyRefObjectId::Reader ref)
KJ_DEPRECATED(
"Please transition to using bootstrap interfaces instead of SturdyRefRestorer.") = 0;
virtual Capability::Client restore(typename SturdyRefObjectId::Reader ref) CAPNP_DEPRECATED(
"Please transition to using bootstrap interfaces instead of SturdyRefRestorer.") = 0;
// Restore the given object, returning a capability representing it.
private:
......
......@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#define CAPNP_TESTING_CAPNP 1
#include "schema-loader.h"
#include <kj/compat/gtest.h>
#include "test-util.h"
......
......@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#define CAPNP_TESTING_CAPNP 1
#include "schema-parser.h"
#include <kj/compat/gtest.h>
#include "test-util.h"
......
......@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#define CAPNP_TESTING_CAPNP 1
#include "schema.h"
#include <kj/compat/gtest.h>
#include "test-util.h"
......
......@@ -82,7 +82,7 @@ public:
// Get the encoded schema node content as a single message segment. It is safe to read as an
// 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
// 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
......@@ -706,7 +706,7 @@ public:
// Construct the schema for a list of the given type.
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
// 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
......
......@@ -202,6 +202,11 @@ typedef unsigned char byte;
// TODO(msvc): Again, here, MSVC prefers a prefix, __declspec(deprecated).
#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
KJ_NORETURN(void inlineRequireFailure(
......
......@@ -1759,7 +1759,7 @@ public:
});
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) {
// We read exactly the amount expected. In order to detect an overshoot, we have to
// try reading one more byte. Ugh.
......
......@@ -157,7 +157,7 @@ TEST(Mutex, When) {
threads.add(kj::heap<kj::Thread>([i,&value]() {
if (i % 2 == 0) delay();
uint m = value.when([i](const uint& n) { return n == i; },
[i](uint& n) { return n++; });
[](uint& n) { return n++; });
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