-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a new ddcommon-ffi crate and factorise generic ffi code inside…
… it (#24) * Create a ddcommon-ffi crate, to contain generic ffi code that can be used by both ddprof and ddtelemetry ffis * Move the Slice, Vec and Tag implementations to the ddcommon-ffi crate * Rename the generated header from `ddprof/ffi.h` to `datadog/common.h` and `datadog/profiling.h` * Add a tool crate for custom scripts used during build, that are to complex to be implemented in bash * Add a step to move every struct and enum definition from the ddprof ffi header to the ddcommon ffi header * Rename the namspace prefix from ddprof_ffi_* to ddog_* Co-authored-by: Levi Morrison <levi.morrison@datadoghq.com>
- Loading branch information
1 parent
7e0d038
commit 0d0ebd6
Showing
21 changed files
with
365 additions
and
182 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
# This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc. | ||
|
||
[package] | ||
name = "ddcommon-ffi" | ||
version = "0.7.0-rc.1" | ||
edition = "2021" | ||
license = "Apache-2.0" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
ddcommon = { path = "../ddcommon", version = "0.7.0-rc.1" } | ||
anyhow = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
# This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc. | ||
|
||
language = "C" | ||
tab_width = 2 | ||
header = """// Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc. | ||
""" | ||
include_guard = "DDOG_COMMON_H" | ||
style = "both" | ||
|
||
no_includes = true | ||
sys_includes = ["stdbool.h", "stddef.h", "stdint.h"] | ||
|
||
after_includes = """ | ||
#if defined(_MSC_VER) | ||
#define DDOG_CHARSLICE_C(string) \\ | ||
/* NOTE: Compilation fails if you pass in a char* instead of a literal */ {.ptr = "" string, .len = sizeof(string) - 1} | ||
#else | ||
#define DDOG_CHARSLICE_C(string) \\ | ||
/* NOTE: Compilation fails if you pass in a char* instead of a literal */ ((ddog_CharSlice){ .ptr = "" string, .len = sizeof(string) - 1 }) | ||
#endif | ||
#if defined(__cplusplus) && (__cplusplus >= 201703L) | ||
# define DDOG_CHECK_RETURN [[nodiscard]] | ||
#elif defined(_Check_return_) /* SAL */ | ||
# define DDOG_CHECK_RETURN _Check_return_ | ||
#elif (defined(__has_attribute) && __has_attribute(warn_unused_result)) || \\ | ||
(defined(__GNUC__) && (__GNUC__ >= 4)) | ||
# define DDOG_CHECK_RETURN __attribute__((__warn_unused_result__)) | ||
#else | ||
# define DDOG_CHECK_RETURN | ||
#endif""" | ||
|
||
[export] | ||
prefix = "ddog_" | ||
|
||
[export.mangle] | ||
rename_types="SnakeCase" | ||
|
||
[enum] | ||
prefix_with_name = true | ||
rename_variants = "ScreamingSnakeCase" | ||
|
||
[fn] | ||
must_use = "DDOG_CHECK_RETURN" | ||
|
||
[parse] | ||
parse_deps = true | ||
include = ["ddcommon"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc. | ||
|
||
pub mod slice; | ||
pub mod tags; | ||
pub mod vec; | ||
|
||
pub use slice::Slice; | ||
pub use vec::Vec; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.