blob: 10d05b6ff691f960a3dee6919163febf16e6f010 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "tools/kazoo/outputs.h"
#include "tools/kazoo/syscall_library.h"
#include "tools/kazoo/test.h"
#include "tools/kazoo/test_ir_test_ownership_annotations.test.h"
namespace {
TEST(OwnershipAnnotationOutput, TrickyCases) {
SyscallLibrary library;
ASSERT_TRUE(SyscallLibraryLoader::FromJson(k_test_ownership_annotations, &library));
Writer writer;
ASSERT_TRUE(UserHeaderOutput(library, &writer));
EXPECT_EQ(writer.Out(),
R"(// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// WARNING: THIS FILE IS MACHINE GENERATED BY //tools/kazoo. DO NOT EDIT.
__EXPORT extern void zx_handleownership_fun0(
const zx_handle_t* in ZX_USE_HANDLE,
size_t num_in,
zx_handle_t* out ZX_ACQUIRE_HANDLE,
size_t num_out) __LEAF_FN;
__EXPORT extern void _zx_handleownership_fun0(
const zx_handle_t* in ZX_USE_HANDLE,
size_t num_in,
zx_handle_t* out ZX_ACQUIRE_HANDLE,
size_t num_out) __LEAF_FN;
__EXPORT extern void zx_handleownership_fun1(
const zx_handle_t* in ZX_RELEASE_HANDLE,
size_t num_in) __LEAF_FN;
__EXPORT extern void _zx_handleownership_fun1(
const zx_handle_t* in ZX_RELEASE_HANDLE,
size_t num_in) __LEAF_FN;
__EXPORT extern void zx_handleownership_fun2(
const zx_handle_t* in ZX_USE_HANDLE,
size_t num_in,
zx_handle_t* out ZX_USE_HANDLE,
size_t num_out) __LEAF_FN;
__EXPORT extern void _zx_handleownership_fun2(
const zx_handle_t* in ZX_USE_HANDLE,
size_t num_in,
zx_handle_t* out ZX_USE_HANDLE,
size_t num_out) __LEAF_FN;
__EXPORT extern void zx_handleownership_fun3(
const zx_handle_t* in ZX_USE_HANDLE,
size_t num_in,
zx_handle_t* out ZX_ACQUIRE_HANDLE,
size_t num_out) __LEAF_FN;
__EXPORT extern void _zx_handleownership_fun3(
const zx_handle_t* in ZX_USE_HANDLE,
size_t num_in,
zx_handle_t* out ZX_ACQUIRE_HANDLE,
size_t num_out) __LEAF_FN;
__EXPORT extern zx_status_t zx_handleownership_fun4(
zx_handle_t in ZX_USE_HANDLE,
zx_handle_t* out ZX_ACQUIRE_HANDLE) __NONNULL((2)) __LEAF_FN;
__EXPORT extern zx_status_t _zx_handleownership_fun4(
zx_handle_t in ZX_USE_HANDLE,
zx_handle_t* out ZX_ACQUIRE_HANDLE) __NONNULL((2)) __LEAF_FN;
__EXPORT extern zx_status_t zx_handleownership_fun5(
zx_handle_t in ZX_RELEASE_HANDLE,
zx_handle_t* out ZX_USE_HANDLE) __NONNULL((2)) __LEAF_FN;
__EXPORT extern zx_status_t _zx_handleownership_fun5(
zx_handle_t in ZX_RELEASE_HANDLE,
zx_handle_t* out ZX_USE_HANDLE) __NONNULL((2)) __LEAF_FN;
__EXPORT extern void zx_handleownership_fun6(
const zx_handle_t* in ZX_USE_HANDLE_UNCHECKED,
size_t num_in,
zx_handle_t* out ZX_ACQUIRE_HANDLE_UNCHECKED,
size_t num_out) __LEAF_FN;
__EXPORT extern void _zx_handleownership_fun6(
const zx_handle_t* in ZX_USE_HANDLE_UNCHECKED,
size_t num_in,
zx_handle_t* out ZX_ACQUIRE_HANDLE_UNCHECKED,
size_t num_out) __LEAF_FN;
)");
}
} // namespace