Update cbindgen to 0.27.0
Change-Id: I2900e5f4567aaeb442486f259a2a7df527c054f8
diff --git a/cbindgen-0.24.5/.cargo_vcs_info.json b/cbindgen-0.24.5/.cargo_vcs_info.json
deleted file mode 100644
index d58459c..0000000
--- a/cbindgen-0.24.5/.cargo_vcs_info.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "git": {
- "sha1": "3680e4d539e33977d613f161530c91a284a82428"
- },
- "path_in_vcs": ""
-}
\ No newline at end of file
diff --git a/cbindgen-0.24.5/.clippy.toml b/cbindgen-0.24.5/.clippy.toml
deleted file mode 100644
index 8eb9e00..0000000
--- a/cbindgen-0.24.5/.clippy.toml
+++ /dev/null
@@ -1,2 +0,0 @@
-# Specify the minimum supported Rust version
-msrv = "1.54.0"
diff --git a/cbindgen-0.24.5/.github/workflows/cbindgen.yml b/cbindgen-0.24.5/.github/workflows/cbindgen.yml
deleted file mode 100644
index 65aa42d..0000000
--- a/cbindgen-0.24.5/.github/workflows/cbindgen.yml
+++ /dev/null
@@ -1,87 +0,0 @@
-name: cbindgen
-
-on:
- push:
- branches:
- - master
- pull_request:
- branches:
- - master
-
-jobs:
- rustfmt-clippy:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v3
-
- - name: Install stable
- uses: dtolnay/rust-toolchain@stable
- with:
- components: "clippy, rustfmt"
-
- - name: Run rustfmt
- run: |
- cargo fmt --check
-
- - name: Run clippy
- run: |
- cargo clippy --workspace -- -D warnings
-
- - name: Install minimum supported Rust version
- id: msrv
- uses: dtolnay/rust-toolchain@1.54
-
- - name: Build with minimum supported Rust version
- run: |
- cargo +${{steps.msrv.outputs.name}} test nonexistent-test --verbose
-
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v3
-
- - name: Install stable Rust
- uses: dtolnay/rust-toolchain@stable
-
- - name: Install Python
- uses: actions/setup-python@v4
- with:
- python-version: '3.8'
-
- - name: Install Cython
- run: |
- python -m pip install --upgrade pip wheel
- pip install Cython==0.29.*
-
- - name: Build
- run: |
- cargo build --verbose
-
- - name: Build no-default-features
- run: |
- cargo build --verbose --no-default-features
-
- - name: Test package
- env:
- CBINDGEN_TEST_VERIFY: 1
- run: |
- cargo package --verbose
- (cd target/package/cbindgen-$(cargo run -- --version | cut -d ' ' -f 2) && cargo test --verbose)
-
- - name: Install nightly Rust
- uses: dtolnay/rust-toolchain@nightly
-
- - name: Test
- env:
- CBINDGEN_TEST_VERIFY: 1
- run: |
- cargo +nightly test --verbose
-
- - name: Test minimal-versions
- run: |
- cargo +nightly update -Zminimal-versions
- cargo +nightly test
diff --git a/cbindgen-0.24.5/.github/workflows/deploy.yml b/cbindgen-0.24.5/.github/workflows/deploy.yml
deleted file mode 100644
index 379e476..0000000
--- a/cbindgen-0.24.5/.github/workflows/deploy.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-name: deploy
-
-on:
- push:
- tags:
- - 'v*.*.*'
-
-jobs:
-
- linux-binaries:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v3
-
- - name: Install stable
- uses: dtolnay/rust-toolchain@stable
-
- - name: Build cbindgen
- run: |
- cargo build --release
-
- - name: Strip cbindgen
- run: |
- strip target/release/cbindgen
-
- - name: Handle release data and files
- id: tagName
- run: |
- VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
- echo "::set-output name=version::$VERSION"
- # Steps to extract the last release notes from CHANGES:
- # 1. Remove the first three lines
- # 2. Stop at the next heading level
- # 3. Remove the last line
- # 4. Deindent the bullet points to avoid a markdown code block
- tail -n +3 CHANGES | sed '/^##/q' |
- sed '$ d' | awk '{$1=$1};1' > CHANGES.txt
-
- - name: Create a release
- uses: softprops/action-gh-release@v1
- with:
- name: v${{ steps.tagName.outputs.version }}
- body_path: CHANGES.txt
- files: |
- target/release/cbindgen
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/cbindgen-0.24.5/CHANGES b/cbindgen-0.24.5/CHANGES
deleted file mode 100644
index 0751f59..0000000
--- a/cbindgen-0.24.5/CHANGES
+++ /dev/null
@@ -1,315 +0,0 @@
-## 0.24.5
-
- * Don't enforce tempfile version.
-
-## 0.24.4
-
- * Move expand infinite recursion fix (#799)
- * Add with_cpp_compat to the builder (#796)
- * Handle never type in return position consistently (#780)
- * Fix warnings (#816, #819)
- * Updated documentation (#788, #791, #792, #810, #823)
-
-## 0.24.3
-
- * Make struct expressions correctly generated through typedefs (#768).
-
-## 0.24.2
-
- * Make bitfield operators use explicit constructors.
-
-## 0.24.1
-
- * Add support for unary negation (#765).
- * Make more bitfield operators constexpr (#765).
-
-## 0.24.0
-
- * Basic const generic support (#759, #760 #762).
- * Suffixes on integer literals are now honored to avoid narrowing (#764).
-
-## 0.23.0
-
- * Better support for constexpr. (#756)
- * constexpr is now enabled by default in C++ mode. You can use const.allow_constexpr=false to revert to previous behavior. (#756)
- * Minimum syn version no longer parses old rust code. (#754)
-
-## 0.22.0
-
- * Support rename rule for union body members (#751).
- * constant: Add support for associated constant expressions (#752).
- * Fix regression in CamelCase rename rule (should be lowerCamelCase) (#750).
- * enumeration: simplify standard types in variants (#749).
- * Avoid generating and writing bindings when called recursively (#747).
- * Cython: Omit per-variant tags in unions generated for Rust enums (#748).
- * Update various dependencies.
-
-## 0.21.0
-
- * Update MSRV to 1.54.0
- * Update clap to 3.1.
- * Update heck to 0.4.0
- * unraw identifiers
- * Honor documentation_length in Cython.
- * Add documentation_style to with short and full options
- * Map RawFd to Int
- * Respect remove_underscores config when prefixing name to enum
-
-## 0.20.0
-
- * Add Builder::with_using_namespaces. (#688)
- * Ignore PhantomPinned. (#695)
- * Simplify Pin<T> to T. (#697)
- * Update --pretty=expanded to -Zunpretty=expanded. (#706)
-
-## 0.19.0
-
- * Simplify types in generics (#663)
- * Use --profile=check for macro expansion (#671)
- * Use exported name to prefix enum variants (#672)
- * Fix path attribute handling in inline submodules (#679)
- * Fix a stack overflow with some recursive typedefs (#680)
-
-## 0.18.0
-
- * Simplify types in nested types such as pointed-to types and function signatures (#661)
-
-## 0.17.0
-
- * Add with_parse_extra_bindings to builder. (#645)
- * Support NonZero and fix incorrect simplification of Option<ptr> into ptr. (#647)
- * Deal with name conflicts correctly in declaration type resolution. (#651)
- * Support pointers to ZSTs. (#656)
-
-## 0.16.0
-
- * Remove artificial restriction on lifetime parameters on enums (#604)
- * Add an option for converting usize/isize into size_t/ptrdiff_t. (#606)
- * Allow controlling the cargo profile used for expansion. (#607)
- * Support wider range of expressions in enum discriminants (#614)
- * Support generation of Cython bindings (#590)
- * Fixed some issues with style=tag and recursive structs (#615)
- * Default C style to Both (as specified in docs) (#615)
- * Fix resolution of path dependencies from certain modules. (#629)
- * Support inlined definitions for tuple variants with a single field in C (#631)
-
-Thanks to all the awesome contributors that contributed to this release.
-
-## 0.15.0
-
- * Allow customizing mangling of generic parameters in C (#575)
- * Box<T> simplifies to T* in C (4ce324c)
- * ManuallyDrop<T> and MaybeUninit<T> simplify to T in C, and are opaque in C++ (0076a17)
- * C++ supports a derive-ostream annotation to derive serialization of structs, unions and enums (#582)
- * Large character constants have been fixed on Windows (#586)
- * Constants are now generated for typedefs, etc (#589)
- * The `sort_by` configuration option has been made to work for constants (#587)
- * Default sort order is source order now (sort_by = "None"), and can be changed by the above option (#587)
-
-## 0.14.6
-
- * Fixed the builds with older versions of rustc.
-
-## 0.14.5
-
- * Add support to specify line ending style (#568)
- * Add cbindgen:ptrs-as-arrays annotation to allow making function
- arguments C/C++ arrays.
-
-## 0.14.4
-
- * Allow to override the mangling separator (#502)
-
- * cbindgen now handles better having ZSTs in template parameters, and
- default template parameters (#563).
-
- * Support for annotating nonnull pointers (#558)
-
- * Fixed bitflags that overflow a signed integer (#556)
-
- * Support for wildcard argument names (#550)
-
- * Support for the never return type, with configurable annotation (#549)
-
- * Properly reject arrays as function arguments (#540)
-
-## 0.14.3
-
- * Introduce cbindgen:ignore comment annotation, to allow ignoring items or modules. (#519)
- * Support for casts in constant expressions. (#526)
- * Make a non-fatal error a warning message. (#535)
- * Add a --metadata option to the CLI, to allow passing pre-computed cargo metadata. (#538)
-
-## 0.14.2
-
- * Fixed minimal dependency versions. (#507)
- * Add an option to write pragma once. (#511)
- * Fix submodule scanning for implicit Rust 2018 modules. (#512)
- * Fix dependency parsing / scanning to handle target-specific versions. (#513)
- * Use heck for case conversion. (#514)
- * Add support for verbatim content after includes. (#416)
- * Allow to add attributes to most generated functions. (#515)
-
-## 0.14.1
-
- * Handle mangling pointers. (#508)
- * Unconditionally generate a return statement in partialeq implementations. (#509)
-
-## 0.14.0
-
- * Minor tweak at how [export.exclude] is handled to allow excluding
- generic instantiations in C mode. (#501)
- * Documented cpp_compat option. (#496)
- * Fixed a panic when parsing associated constants for a built-in type. (#494)
-
-## 0.13.2
-
- * Constants now have suitable documentation. (#471)
- * Fixed some C warnings by emitting void when there are no arguments. (#470)
- * Avoids reading cargo.toml when not needed, which can cause panics in workspace situations.
- * Only write `default` cases if the switch is not exhaustive. (#475)
- * Some warnings have been refined. (#477)
- * Code generation for static arrays has been fixed. (#479)
- * Opt-in support for constexpr in constants. (#481)
- * Fix C code generation and some warnings when extremely large constants are used. (#490)
- * Proper escaping of enum variants and fields. (#483)
- * Added support for RefCell (as an opaque type) and Cell. (#489)
-
-## 0.13.1
-
- * Support `#[cfg]` on individual enum variants. (#469)
-
-## 0.13.0
-
- * Support 'swift_name' attributes on generated functions (#449)
- * Add [export.pre_body] to config (#452)
- * Handle new line in doc attribute (#454)
- * Add support for `Self` in tagged enums, structs and unions (#455, #455, #456)
- * Make sentinel variant respect regular config (#459)
- * Fix layout of tagged enums with size under some configurations (#463)
- * Add an option to allow configuring the order of function names in generated headers (#466)
-
-## 0.12.2
-
- * Fixed version detection with lockfile v2. https://github.com/eqrion/cbindgen/pull/446
- * Added support for export_name on functions. https://github.com/eqrion/cbindgen/pull/447
-
-## 0.12.1
-
- * Added support for #[repr*64)] on enums. https://github.com/eqrion/cbindgen/pull/441
- * Added support to generate plain enums instead of enum classes for C++. https://github.com/eqrion/cbindgen/pull/443
- * Fixed dependency resolution with lockfile v2. https://github.com/eqrion/cbindgen/pull/438
-
-## 0.12.0
-
- * Added support for #[repr(align)] and #[repr(packed)] on structs and unions. https://github.com/eqrion/cbindgen/pull/431
- * Added support to generate copy-assignment operators for enums. https://github.com/eqrion/cbindgen/pull/434
-
-## 0.11.1
-
- * More binary operators and expressions are supported. https://github.com/eqrion/cbindgen/pull/425
- * More built-in bitflags operators. https://github.com/eqrion/cbindgen/pull/426
-
-## 0.11.0
-
- * Made rust char map to uint32_t. https://github.com/eqrion/cbindgen/pull/424
-
-## 0.10.1
-
- * Improved error message for missing config file. https://github.com/eqrion/cbindgen/pull/422
- * Add missing header for char32_t. https://github.com/eqrion/cbindgen/pull/414
-
-## 0.10.0
-
- * Initialize struct literal with list-initializer for C++11 standard. https://github.com/eqrion/cbindgen/pull/401
- * Surround namespace with __cplusplus ifdef in cpp_compat mode. https://github.com/eqrion/cbindgen/pull/407
- * Add support for --quiet flag. https://github.com/eqrion/cbindgen/pull/400
- * Map char to char32_t. https://github.com/eqrion/cbindgen/pull/396
- * Improve binding_crate_ref() error message. https://github.com/eqrion/cbindgen/pull/395
- * avoid prematurely returning during expansion. https://github.com/eqrion/cbindgen/pull/389
- * Add support for adding "using namespace" statements. https://github.com/eqrion/cbindgen/pull/387
-
-## 0.9.1
-
- * Various improvements to comment output. https://github.com/eqrion/cbindgen/pull/370 / https://github.com/eqrion/cbindgen/pull/375.
- * Fixed expand when ran from build.rs. https://github.com/eqrion/cbindgen/pull/371
- * More debugging output for expansion. https://github.com/eqrion/cbindgen/pull/383
- * New option to add a default private constructor in C++ tagged enums. https://github.com/eqrion/cbindgen/pull/377
- * Syn and related dependencies updated to 1.0. https://github.com/eqrion/cbindgen/pull/379
-
-## 0.9.0
-
- * Support to generate C headers with C++ compatibility. https://github.com/eqrion/cbindgen/pull/349
- * Fix include guard generation when no_includes is set. https://github.com/eqrion/cbindgen/pull/352
- * Fix crate parsing order so that types from the binding crate are preferred in presence of conflicting names. https://github.com/eqrion/cbindgen/pull/355
- * Add extra_bindings option to generate bindings for dependencies. https://github.com/eqrion/cbindgen/pull/362
- * Clap dependency is optional now so it's feasible to avoid building it if cbindgen is used as a library. https://github.com/eqrion/cbindgen/pull/363
-
-## 0.8.7
-
- * Require C++11 to run the test-suite (#341, test-only)
- * Improve mangling error message (#340)
- * Add the ability to automatically derive copy-constructors for tagged enums (#339)
- * Use placement new for constructing in tagged unions' helper methods (#333)
-
-## 0.8.6
-
- * Fixed a panic when missing a lock file
-
-## 0.8.5
-
- * Improved support for Rust 2018 modules
- * Add possibility to autogenerate tagged union destructors
-
-## 0.8.4
-
- * Support for package renaming in Cargo.toml
- * Improved error messages for |cargo metadata| failures
- * Replaced 'test.py' harness with |cargo test|
- * Char constants will now be escaped properly
- * Visibility of constants will now be respected
- * Added a C99 doc comment style
-
-## 0.8.2
-
- * Improvements to bitflags parsing
-
-## 0.8.1
-
- * Support for manual parsing and expanding of bitflags macros
- * Support for optional tagged enum casts with asserts
-
-## 0.8.0
-
- * support for 'includes' without default includes
- * removed dependency on ancient serde_derive!
-
-## 0.7.1
-
- * Fix for crash when unwrapping unsupported type with associated constants
-
-## 0.7.0
-
- * support for libc::ssize_t
- * fixed some warnings on nightly
- * fix for transparent associated constants
- * switched more API's to use AsRef<Path>
- * impl std::error::Error for cbindgen::Error
- * now support putting user-defined content in item bodies
-
-## 0.6.8
-
- * ptrdiff_t is now a recognized primitive type
- * named function type arguments are now propagated
- * fixes for struct literals in constants
- * reserved C/C++ keywords are now escaped automatically
- * negative enum discriminants are now supported
- * fix for prefixing and formatting variant names
- * fix for snake_case formatter
- * syn update
- * doxygen style comments are now output by default
- * VaList is now a recognized primitive type
- * fix for comment processing
- * constant is propagated into array types
- * references are now supported in IR, and used for some helper method generation
- * assignment helper functions will generate array copies if necessary
diff --git a/cbindgen-0.24.5/Cargo.lock b/cbindgen-0.24.5/Cargo.lock
deleted file mode 100644
index aa32928..0000000
--- a/cbindgen-0.24.5/Cargo.lock
+++ /dev/null
@@ -1,401 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 3
-
-[[package]]
-name = "atty"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
-dependencies = [
- "hermit-abi",
- "libc",
- "winapi",
-]
-
-[[package]]
-name = "autocfg"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
-
-[[package]]
-name = "bitflags"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
-
-[[package]]
-name = "cbindgen"
-version = "0.24.5"
-dependencies = [
- "clap",
- "heck",
- "indexmap",
- "log",
- "proc-macro2",
- "quote",
- "serde",
- "serde_json",
- "serial_test",
- "syn 1.0.109",
- "tempfile",
- "toml",
-]
-
-[[package]]
-name = "cfg-if"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
-
-[[package]]
-name = "clap"
-version = "3.2.25"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123"
-dependencies = [
- "atty",
- "bitflags",
- "clap_lex",
- "indexmap",
- "strsim",
- "termcolor",
- "textwrap",
-]
-
-[[package]]
-name = "clap_lex"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
-dependencies = [
- "os_str_bytes",
-]
-
-[[package]]
-name = "fastrand"
-version = "1.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
-dependencies = [
- "instant",
-]
-
-[[package]]
-name = "hashbrown"
-version = "0.12.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
-
-[[package]]
-name = "heck"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
-
-[[package]]
-name = "hermit-abi"
-version = "0.1.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "indexmap"
-version = "1.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
-dependencies = [
- "autocfg",
- "hashbrown",
-]
-
-[[package]]
-name = "instant"
-version = "0.1.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
-name = "itoa"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
-
-[[package]]
-name = "lazy_static"
-version = "1.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
-
-[[package]]
-name = "libc"
-version = "0.2.144"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
-
-[[package]]
-name = "lock_api"
-version = "0.4.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
-dependencies = [
- "autocfg",
- "scopeguard",
-]
-
-[[package]]
-name = "log"
-version = "0.4.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
-name = "os_str_bytes"
-version = "6.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267"
-
-[[package]]
-name = "parking_lot"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
-dependencies = [
- "instant",
- "lock_api",
- "parking_lot_core",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.8.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
-dependencies = [
- "cfg-if",
- "instant",
- "libc",
- "redox_syscall",
- "smallvec",
- "winapi",
-]
-
-[[package]]
-name = "proc-macro2"
-version = "1.0.58"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8"
-dependencies = [
- "unicode-ident",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.27"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
-name = "redox_syscall"
-version = "0.2.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
-dependencies = [
- "bitflags",
-]
-
-[[package]]
-name = "remove_dir_all"
-version = "0.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
-dependencies = [
- "winapi",
-]
-
-[[package]]
-name = "ryu"
-version = "1.0.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
-
-[[package]]
-name = "scopeguard"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
-
-[[package]]
-name = "serde"
-version = "1.0.163"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2"
-dependencies = [
- "serde_derive",
-]
-
-[[package]]
-name = "serde_derive"
-version = "1.0.163"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.16",
-]
-
-[[package]]
-name = "serde_json"
-version = "1.0.96"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1"
-dependencies = [
- "itoa",
- "ryu",
- "serde",
-]
-
-[[package]]
-name = "serial_test"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0bccbcf40c8938196944a3da0e133e031a33f4d6b72db3bda3cc556e361905d"
-dependencies = [
- "lazy_static",
- "parking_lot",
- "serial_test_derive",
-]
-
-[[package]]
-name = "serial_test_derive"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2acd6defeddb41eb60bb468f8825d0cfd0c2a76bc03bfd235b6a1dc4f6a1ad5"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
-
-[[package]]
-name = "smallvec"
-version = "1.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
-
-[[package]]
-name = "strsim"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
-
-[[package]]
-name = "syn"
-version = "1.0.109"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-ident",
-]
-
-[[package]]
-name = "syn"
-version = "2.0.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-ident",
-]
-
-[[package]]
-name = "tempfile"
-version = "3.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
-dependencies = [
- "cfg-if",
- "fastrand",
- "libc",
- "redox_syscall",
- "remove_dir_all",
- "winapi",
-]
-
-[[package]]
-name = "termcolor"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"
-dependencies = [
- "winapi-util",
-]
-
-[[package]]
-name = "textwrap"
-version = "0.16.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
-
-[[package]]
-name = "toml"
-version = "0.5.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
-dependencies = [
- "serde",
-]
-
-[[package]]
-name = "unicode-ident"
-version = "1.0.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
-
-[[package]]
-name = "winapi"
-version = "0.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
-dependencies = [
- "winapi-i686-pc-windows-gnu",
- "winapi-x86_64-pc-windows-gnu",
-]
-
-[[package]]
-name = "winapi-i686-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-
-[[package]]
-name = "winapi-util"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
-dependencies = [
- "winapi",
-]
-
-[[package]]
-name = "winapi-x86_64-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/cbindgen-0.24.5/Cargo.toml b/cbindgen-0.24.5/Cargo.toml
deleted file mode 100644
index 6ff123a..0000000
--- a/cbindgen-0.24.5/Cargo.toml
+++ /dev/null
@@ -1,95 +0,0 @@
-# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
-#
-# When uploading crates to the registry Cargo will automatically
-# "normalize" Cargo.toml files for maximal compatibility
-# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies.
-#
-# If you are reading this file be aware that the original Cargo.toml
-# will likely look very different (and much more reasonable).
-# See Cargo.toml.orig for the original contents.
-
-[package]
-edition = "2018"
-name = "cbindgen"
-version = "0.24.5"
-authors = [
- "Emilio Cobos Álvarez <emilio@crisal.io>",
- "Jeff Muizelaar <jmuizelaar@mozilla.com>",
- "Kartikaya Gupta <kats@mozilla.com>",
- "Ryan Hunt <rhunt@eqrion.net>",
-]
-exclude = ["tests/profile.rs"]
-description = "A tool for generating C bindings to Rust code."
-readme = "README.md"
-keywords = [
- "bindings",
- "ffi",
- "code-generation",
-]
-categories = [
- "external-ffi-bindings",
- "development-tools::ffi",
-]
-license = "MPL-2.0"
-repository = "https://github.com/eqrion/cbindgen"
-
-[lib]
-name = "cbindgen"
-path = "src/lib.rs"
-
-[[bin]]
-name = "cbindgen"
-path = "src/main.rs"
-doc = false
-required-features = ["clap"]
-
-[dependencies.clap]
-version = "3.1"
-optional = true
-
-[dependencies.heck]
-version = "0.4"
-
-[dependencies.indexmap]
-version = "1"
-
-[dependencies.log]
-version = "0.4"
-
-[dependencies.proc-macro2]
-version = "1"
-
-[dependencies.quote]
-version = "1"
-
-[dependencies.serde]
-version = "1.0.103"
-features = ["derive"]
-default-features = false
-
-[dependencies.serde_json]
-version = "1.0"
-
-[dependencies.syn]
-version = "1.0.88"
-features = [
- "clone-impls",
- "extra-traits",
- "full",
- "parsing",
- "printing",
-]
-default-features = false
-
-[dependencies.tempfile]
-version = "3"
-
-[dependencies.toml]
-version = "0.5"
-
-[dev-dependencies.serial_test]
-version = "0.5.0"
-
-[features]
-default = ["clap"]
diff --git a/cbindgen-0.24.5/Cargo.toml.orig b/cbindgen-0.24.5/Cargo.toml.orig
deleted file mode 100644
index e82d854..0000000
--- a/cbindgen-0.24.5/Cargo.toml.orig
+++ /dev/null
@@ -1,51 +0,0 @@
-[package]
-name = "cbindgen"
-version = "0.24.5"
-authors = [
- "Emilio Cobos Álvarez <emilio@crisal.io>",
- "Jeff Muizelaar <jmuizelaar@mozilla.com>",
- "Kartikaya Gupta <kats@mozilla.com>",
- "Ryan Hunt <rhunt@eqrion.net>"
-]
-license = "MPL-2.0"
-description = "A tool for generating C bindings to Rust code."
-keywords = ["bindings", "ffi", "code-generation"]
-categories = ["external-ffi-bindings", "development-tools::ffi"]
-repository = "https://github.com/eqrion/cbindgen"
-edition = "2018"
-exclude = [
- "tests/profile.rs", # Test relies in a sub-crate, see https://github.com/rust-lang/cargo/issues/9017
-]
-
-[dependencies]
-clap = { version = "3.1", optional = true }
-indexmap = "1"
-log = "0.4"
-serde = { version = "1.0.103", default-features = false, features = ["derive"] }
-serde_json = "1.0"
-tempfile = "3"
-toml = "0.5"
-proc-macro2 = "1"
-quote = "1"
-heck = "0.4"
-
-[dependencies.syn]
-version = "1.0.88"
-default-features = false
-features = ["clone-impls", "extra-traits", "full", "parsing", "printing"]
-
-[dev-dependencies]
-serial_test = "0.5.0"
-
-[features]
-default = ["clap"]
-
-[[bin]]
-name = "cbindgen"
-path = "src/main.rs"
-doc = false
-required-features = ["clap"]
-
-[lib]
-name = "cbindgen"
-path = "src/lib.rs"
diff --git a/cbindgen-0.24.5/README.md b/cbindgen-0.24.5/README.md
deleted file mode 100644
index a67ece6..0000000
--- a/cbindgen-0.24.5/README.md
+++ /dev/null
@@ -1,97 +0,0 @@
-# `cbindgen`   [![Build Status]][actions] [![Latest Version]][crates.io] [![Api Rustdoc]][rustdoc] [](https://github.com/eqrion/cbindgen)
-
-[Build Status]: https://github.com/eqrion/cbindgen/workflows/cbindgen/badge.svg
-[actions]: https://github.com/eqrion/cbindgen/actions
-[Latest Version]: https://img.shields.io/crates/v/cbindgen.svg
-[crates.io]: https://crates.io/crates/cbindgen
-[Api Rustdoc]: https://img.shields.io/badge/api-rustdoc-blue.svg
-[rustdoc]: https://docs.rs/cbindgen
-
-[Read the full user docs here!](docs.md)
-
-cbindgen creates C/C++11 headers for Rust libraries which expose a public C API.
-
-While you could do this by hand, it's not a particularly good use of your time.
-It's also much more likely to be error-prone than machine-generated headers that
-are based on your actual Rust code. The cbindgen developers have also worked
-closely with the developers of Rust to ensure that the headers we generate
-reflect actual guarantees about Rust's type layout and ABI.
-
-C++ headers are nice because we can use operator overloads, constructors, enum
-classes, and templates to make the API more ergonomic and Rust-like. C headers
-are nice because you can be more confident that whoever you're interoperating
-with can handle them. With cbindgen *you don't need to choose*! You can just
-tell it to emit both from the same Rust library.
-
-There are two ways to use cbindgen: as a standalone program, or as a library
-(presumably in your build.rs). There isn't really much practical difference,
-because cbindgen is a simple rust library with no interesting dependencies.
-
-Using it as a program means people building your software will need it
-installed. Using it in your library means people may have to build cbindgen more
-frequently (e.g. every time they update their rust compiler).
-
-It's worth noting that the development of cbindgen has been largely adhoc, as
-features have been added to support the usecases of the maintainers. This means
-cbindgen may randomly fail to support some particular situation simply because
-no one has put in the effort to handle it yet. [Please file an issue if you run
-into such a situation](https://github.com/eqrion/cbindgen/issues/new). Although
-since we all have other jobs, you might need to do the implementation work too
-:)
-
-# Quick Start
-
-To install cbindgen, you just need to run
-
-```text
-cargo install --force cbindgen
-```
-
-(--force just makes it update to the latest cbindgen if it's already installed)
-
-Or with Homebrew, run
-
-```text
-brew install cbindgen
-```
-
-To use cbindgen you need two things:
-
-* A configuration (cbindgen.toml, which can be empty to start)
-* A Rust crate with a public C API
-
-Then all you need to do is run it:
-
-```text
-cbindgen --config cbindgen.toml --crate my_rust_library --output my_header.h
-```
-
-This produces a header file for C++. For C, add the `--lang c` switch.
-
-See `cbindgen --help` for more options.
-
-[Read the full user docs here!](docs.md)
-
-[Get a template cbindgen.toml here.](template.toml)
-
-# Examples
-
-We don't currently have a nice tailored example application, but [the
-tests](tests/rust/) contain plenty of interesting examples of our features.
-
-You may also find it interesting to browse the projects that are using cbindgen
-in production:
-
-* [milksnake](https://github.com/getsentry/milksnake)
-* [webrender](https://searchfox.org/mozilla-central/source/gfx/webrender_bindings) ([generated header](https://searchfox.org/mozilla-central/source/__GENERATED__/gfx/webrender_bindings/webrender_ffi_generated.h))
-* [stylo](https://searchfox.org/mozilla-central/source/layout/style) ([generated header](https://searchfox.org/mozilla-central/source/__GENERATED__/layout/style/ServoStyleConsts.h))
-* [maturin](https://github.com/PyO3/maturin)
-
-If you're using `cbindgen` and would like to be added to this list, please open
-a pull request!
-
-# Releases
-
-cbindgen doesn't have a fixed release calendar, please file an issue requesting
-a release if there's something fixed in trunk that you need released. Ping
-`@emilio` for increased effect.
diff --git a/cbindgen-0.24.5/build.rs b/cbindgen-0.24.5/build.rs
deleted file mode 100644
index 5644b02..0000000
--- a/cbindgen-0.24.5/build.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-fn generate_tests() {
- use std::env;
- use std::ffi::OsStr;
- use std::fs::{self, File};
- use std::io::Write;
- use std::path::{Path, PathBuf};
-
- let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
- let mut dst = File::create(Path::new(&out_dir).join("tests.rs")).unwrap();
-
- let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
- let tests_dir = manifest_dir.join("tests").join("rust");
- let tests = fs::read_dir(&tests_dir).unwrap();
-
- let entries = tests.map(|t| t.expect("Couldn't read test file"));
-
- println!("cargo:rerun-if-changed={}", tests_dir.display());
-
- // Try to make a decent guess at where our binary will end up in.
- //
- // TODO(emilio): Ideally running tests will just use the library-version of
- // cbindgen instead of the built binary.
- let cbindgen_path = out_dir
- .parent()
- .unwrap()
- .parent()
- .unwrap()
- .parent()
- .unwrap()
- .join("cbindgen");
-
- for entry in entries {
- let path_segment = if entry.file_type().unwrap().is_file() {
- match entry.path().extension().and_then(OsStr::to_str) {
- Some("rs") => {}
- _ => continue,
- };
-
- entry
- .path()
- .file_stem()
- .unwrap()
- .to_str()
- .unwrap()
- .to_owned()
- } else {
- entry.file_name().to_str().unwrap().to_owned()
- };
-
- let identifier = path_segment
- .replace(|c| !char::is_alphanumeric(c), "_")
- .replace("__", "_");
-
- writeln!(
- dst,
- "test_file!({:?}, test_{}, {:?}, {:?});",
- cbindgen_path,
- identifier,
- path_segment,
- entry.path(),
- )
- .unwrap();
- }
-
- dst.flush().unwrap();
-}
-
-fn main() {
- generate_tests();
-}
diff --git a/cbindgen-0.24.5/contributing.md b/cbindgen-0.24.5/contributing.md
deleted file mode 100644
index 5625d50..0000000
--- a/cbindgen-0.24.5/contributing.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# Contributing
-
-Thanks for wanting to contribute!
-
-If you want help or mentorship, please file a GitHub issue and I'll be sure to provide guidance to the best of my ability.
-
-Otherwise be sure to check out `internals.md` for an overview on the internals.
-
-## Filing a pull request
-
-Check out [Servo's GitHub workflow](https://github.com/servo/servo/wiki/Github-workflow) for an overview on creating a pull request.
-
-Don't worry about requesting code review, as there is nothing formally setup for this repository. I try and review each pull request as soon as I can.
-
-There is continuous integration setup for `cbindgen` using [GitHub Actions](https://github.com/eqrion/cbindgen/actions). It automatically runs `cargo test` which runs `cbindgen` against a series of Rust files from `tests/rust/` and checks that the output compiles using `gcc` or `g++`.
-
-In addition to a C/C++ compiler `cargo test` requires Python and Cython
-(`python -m pip install Cython`) for checking Cython bindings generated from tests (`.pyx` files).
-
-Please run `cargo test` before filing a pull request to be sure that all tests pass. This will also update the test expectations.
-
-Rustfmt is also enforced by GitHub Actions. To format your code install `rustfmt-preview` using `rustup component add rustfmt-preview` and then `cargo fmt`. GitHub Actions runs with Rust nightly, so use `rustup run nightly -- cargo fmt` to guarantee consistent results.
-
-Writing new tests with your pull requests is also appreciated.
diff --git a/cbindgen-0.24.5/docs.md b/cbindgen-0.24.5/docs.md
deleted file mode 100644
index d420f2d..0000000
--- a/cbindgen-0.24.5/docs.md
+++ /dev/null
@@ -1,1027 +0,0 @@
-# cbindgen User Guide
-
-cbindgen creates C/C++11 headers for Rust libraries which expose a public C API.
-
-While you could do this by hand, it's not a particularly good use of your time. It's also much more likely to be error-prone than machine-generated headers that are based on your actual Rust code. The cbindgen developers have also worked closely with the developers of Rust to ensure that the headers we generate reflect actual guarantees about Rust's type layout and ABI.
-
-C++ headers are nice because we can use operator overloads, constructors, enum classes, and templates to make the API more ergonomic and Rust-like. C headers are nice because you can be more confident that whoever you're interoperating with can handle them. With cbindgen *you don't need to choose*! You can just tell it to emit both from the same Rust library.
-
-There are two ways to use cbindgen: as a standalone program, or as a library (presumably in your build.rs).
-There isn't really much practical difference, because cbindgen is a simple rust library with no interesting dependencies. Using it as a program means people building your software will need it installed. Using it in your library means people may have to build cbindgen more frequently (e.g. every time they update their rust compiler).
-
-It's worth noting that the development of cbindgen has been largely adhoc, as features have been added to support the usecases of the maintainers. This means cbindgen may randomly fail to support some particular situation simply because no one has put in the effort to handle it yet. [Please file an issue if you run into such a situation][file-it]. Although since we all have other jobs, you might need to do the implementation work too :)
-
-
-
-
-
-# Quick Start
-
-To install cbindgen, you just need to run
-
-```text
-cargo install --force cbindgen
-```
-
-(--force just makes it update to the latest cbindgen if it's already installed)
-
-To use cbindgen you need two things:
-
-* A configuration (cbindgen.toml, which can be empty to start)
-* A Rust crate with a public C API
-
-Then all you need to do is run it:
-
-```text
-cbindgen --config cbindgen.toml --crate my_rust_library --output my_header.h
-```
-
-This produces a header file for C++. For C, add the `--lang c` switch. \
-`cbindgen` also supports generation of [Cython](https://cython.org) bindings,
-use `--lang cython` for that.
-
-See `cbindgen --help` for more options.
-
-[Get a template cbindgen.toml here.](template.toml)
-
-
-
-## build.rs
-
-If you don't want to use cbindgen as an application, here's an example build.rs script:
-
-```rust
-extern crate cbindgen;
-
-use std::env;
-
-fn main() {
- let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
-
- cbindgen::Builder::new()
- .with_crate(crate_dir)
- .generate()
- .expect("Unable to generate bindings")
- .write_to_file("bindings.h");
-}
-```
-
-You can add configuration options using the [`Builder`](https://docs.rs/cbindgen/*/cbindgen/struct.Builder.html#methods) interface.
-
-Be sure to add the following section to your Cargo.toml:
-
-```
-[build-dependencies]
-cbindgen = "0.24.0"
-```
-
-If you'd like to use a `build.rs` script with a `cbindgen.toml`, consider using [`cbindgen::generate()`](https://docs.rs/cbindgen/*/cbindgen/fn.generate.html) instead.
-
-
-
-
-
-# Writing Your C API
-
-cbindgen has a simple but effective strategy. It walks through your crate looking for:
-
-* `#[no_mangle] pub extern fn` ("functions")
-* `#[no_mangle] pub static` ("globals")
-* `pub const` ("constants")
-
-and generates a header declaring those items. But to declare those items, it needs to also be able to describe the layout and ABI of the types that appear in their signatures. So it will also spider through your crate (and optionally its dependencies) to try to find the definitions of every type used in your public API.
-
-> 🚨 NOTE: A major limitation of cbindgen is that it does not understand Rust's module system or namespacing. This means that if cbindgen sees that it needs the definition for `MyType` and there exists two things in your project with the type name `MyType`, it won't know what to do. Currently, cbindgen's behaviour is unspecified if this happens. However this may be ok if they have [different cfgs][section-cfgs].
-
-If a type is determined to have a guaranteed layout, a full definition will be emitted in the header. If the type doesn't have a guaranteed layout, only a forward declaration will be emitted. This may be fine if the type is intended to be passed around opaquely and by reference.
-
-
-
-
-# Examples
-
-🚧 🏗
-
-It would be really nice to have some curated and clean examples, but we don't have those yet.
-
-[The README has some useful links though](README.md#examples).
-
-
-
-# Supported Types
-
-Most things in Rust don't have a guaranteed layout by default. In most cases this is nice because it enables layout to be optimized in the majority of cases where type layout isn't that interesting. However this is problematic for our purposes. Thankfully Rust lets us opt into guaranteed layouts with the `repr` attribute.
-
-You can learn about all of the different repr attributes [by reading Rust's reference][reference], but here's a quick summary:
-
-* `#[repr(C)]`: give this struct/union/enum the same layout and ABI C would
-* `#[repr(u8, u16, ... etc)]`: give this enum the same layout and ABI as the given integer type
-* `#[repr(transparent)]`: give this single-field struct the same ABI as its field (useful for newtyping integers but keeping the integer ABI)
-
-cbindgen supports the `#[repr(align(N))]` and `#[repr(packed)]` attributes, but currently does not support `#[repr(packed(N))]`.
-
-cbindgen also supports using `repr(C)`/`repr(u8)` on non-C-like enums (enums with fields). This gives a C-compatible tagged union layout, as [defined by this RFC 2195][really-tagged-unions]. `repr(C)` will give a simpler layout that is perhaps more intuitive, while `repr(u8)` will produce a more compact layout.
-
-If you ensure everything has a guaranteed repr, then cbindgen will generate definitions for:
-
-* struct (named-style or tuple-style)
-* enum (fieldless or with fields)
-* union
-* type
-* `[T; n]` (arrays always have a guaranteed C-compatible layout)
-* `&T`, `&mut T`, `*const T`, `*mut T`, `Option<&T>`, `Option<&mut T>` (all have the same pointer ABI)
-* `fn()` (as an actual function pointer)
-* `bitflags! { ... }` (if macro_expansion.bitflags is enabled)
-
-structs, enums, unions, and type aliases may be generic, although certain generic substitutions may fail to resolve under certain configurations. In C mode generics are resolved through monomorphization and mangling, while in C++ mode generics are resolved with templates. cbindgen cannot support generic functions, as they do not actually have a single defined symbol.
-
-cbindgen sadly cannot ever support anonymous tuples `(A, B, ...)`, as there is no way to guarantee their layout. You must use a tuple struct.
-
-cbindgen also cannot support wide pointers like `&dyn Trait` or `&[T]`, as their layout and ABI is not guaranteed. In the case of slices you can at least decompose them into a pointer and length, and reconstruct them with `slice::from_raw_parts`.
-
-If cbindgen determines that a type is zero-sized, it will erase all references to that type (so fields of that type simply won't be emitted). This won't work if that type appears as a function argument because C, C++, and Rust all have different definitions of what it means for a type to be empty.
-
-Don't use the `[u64; 0]` trick to over-align a struct, we don't support this.
-
-cbindgen contains the following hardcoded mappings (again completely ignoring namespacing, literally just looking at the name of the type):
-
-
-
-
-## std types
-
-* bool => bool
-* char => uint32_t
-* u8 => uint8_t
-* u16 => uint16_t
-* u32 => uint32_t
-* u64 => uint64_t
-* usize => uintptr_t
-* i8 => int8_t
-* i16 => int16_t
-* i32 => int32_t
-* i64 => int64_t
-* isize => intptr_t
-* f32 => float
-* f64 => double
-* VaList => va_list
-* RawFd => int
-* PhantomData => *evaporates*, can only appear as the field of a type
-* PhantomPinned => *evaporates*, can only appear as the field of a type
-* () => *evaporates*, can only appear as the field of a type
-* MaybeUninit<T>, ManuallyDrop<T>, and Pin<T> => T
-
-
-
-
-## libc types
-
-* c_void => void
-* c_char => char
-* c_schar => signed char
-* c_uchar => unsigned char
-* c_float => float
-* c_double => double
-* c_short => short
-* c_int => int
-* c_long => long
-* c_longlong => long long
-* c_ushort => unsigned short
-* c_uint => unsigned int
-* c_ulong => unsigned long
-* c_ulonglong => unsigned long long
-
-
-
-## stdint types
-
-* uint8_t => uint8_t
-* uint16_t => uint16_t
-* uint32_t => uint32_t
-* uint64_t => uint64_t
-* uintptr_t => uintptr_t
-* size_t => size_t
-* int8_t => int8_t
-* int16_t => int16_t
-* int32_t => int32_t
-* int64_t => int64_t
-* intptr_t => intptr_t
-* ssize_t => ssize_t
-* ptrdiff_t => ptrdiff_t
-
-
-
-
-
-
-# Configuring Your Header
-
-cbindgen supports several different options for configuring the output of your header, including target language, styling, mangling, prefixing, includes, and defines.
-
-
-
-
-
-## Defines and Cfgs
-
-As cbindgen spiders through your crate, it will make note of all the cfgs it found on the path to every item. If it finds multiple declarations that share a single name but have different cfgs, it will then try to emit every version it found wrapped in defines that correspond to those cfgs. In this way platform-specific APIs or representations can be properly supported.
-
-However cbindgen has no way of knowing how you want to map those cfgs to defines. You will need to use the `[defines]` section in your cbindgen.toml to specify all the different mappings. It natively understands concepts like any() and all(), so you only need to tell it how you want to translate base concepts like `target_os = "freebsd"` or `feature = "serde"`.
-
-Note that because cbindgen just parses the source of your crate, you mostly don't need to worry about what crate features or what platform you're targetting. Every possible configuration should be visible to the parser. Our primitive mappings should also be completely platform agnostic (i32 is int32_t regardless of your target).
-
-While modules within a crate form a tree with uniquely defined paths to each item, and therefore uniquely defined cfgs for those items, dependencies do not. If you depend on a crate in multiple ways, and those ways produce different cfgs, one of them will be arbitrarily chosen for any types found in that crate.
-
-
-
-
-## Annotations
-
-While output configuration is primarily done through the cbindgen.toml, in some cases you need to manually override your global settings. In those cases you can add inline annotations to your types, which are doc comments that start with `cbindgen:`. Here's an example of using annotations to rename a struct's fields and opt into overloading `operator==`:
-
-```rust
-/// cbindgen:field-names=[x, y]
-/// cbindgen:derive-eq
-#[repr(C)]
-pub struct Point(pub f32, pub f32);
-```
-
-An annotation may be a bool, string (no quotes), or list of strings. If just the annotation's name is provided, `=true` is assumed. The annotation parser is currently fairly naive and lacks any capacity for escaping, so don't try to make any strings with `=`, `,`, `[` or `]`.
-
-Most annotations are just local overrides for identical settings in the cbindgen.toml, but a few are unique because they don't make sense in a global context. The set of supported annotation are as follows:
-
-### Ignore annotation
-
-cbindgen will automatically ignore any `#[test]` or `#[cfg(test)]` item it
-finds. You can manually ignore other stuff with the `ignore` annotation
-attribute:
-
-```rust
-pub mod my_interesting_mod;
-
-/// cbindgen:ignore
-pub mod my_uninteresting_mod; // This won't be scanned by cbindgen.
-```
-
-### Struct Annotations
-
-* field-names=\[field1, field2, ...\] -- sets the names of all the fields in the output struct. These names will be output verbatim, and are not eligible for renaming.
-
-The rest are just local overrides for the same options found in the cbindgen.toml:
-
-* rename-all=RenameRule
-* derive-constructor
-* derive-eq
-* derive-neq
-* derive-lt
-* derive-lte
-* derive-gt
-* derive-gte
-* {eq,neq,lt,lte,gt,gte}-attributes: Takes a single identifier which will be
- emitted before the signature of the auto-generated `operator==` / `operator!=`
- / etc(if any). The idea is for this to be used to annotate the operator with
- attributes, for example:
-
-```rust
-/// cbindgen:eq-attributes=MY_ATTRIBUTES
-#[repr(C)]
-pub struct Foo { .. }
-```
-
-Will generate something like:
-
-```
- MY_ATTRIBUTES bool operator==(const Foo& other) const {
- ...
- }
-```
-
-Combined with something like:
-
-```
-#define MY_ATTRIBUTES [[nodiscard]]
-```
-
-for example.
-
-### Enum Annotations
-
-* enum-trailing-values=\[variant1, variant2, ...\] -- add the following fieldless enum variants to the end of the enum's definition. These variant names *will* have the enum's renaming rules applied.
-
-WARNING: if any of these values are ever passed into Rust, behaviour will be Undefined. Rust does not know about them, and will assume they cannot happen.
-
-The rest are just local overrides for the same options found in the cbindgen.toml:
-
-* rename-all=RenameRule
-* add-sentinel
-* derive-helper-methods
-* derive-const-casts
-* derive-mut-casts
-* derive-tagged-enum-destructor
-* derive-tagged-enum-copy-constructor
-* enum-class
-* prefix-with-name
-* private-default-tagged-enum-constructor
-* {destructor,copy-constructor,copy-assignment}-attributes: See the description
- of the struct attributes, these do the same for the respective generated code.
-
-### Enum variant annotations
-
-These apply to both tagged and untagged enum _variants_.
-
-* variant-{constructor,const-cast,mut-cast,is}-attributes: See the description
- of the struct attributes. These do the same for the respective functions.
-
-TODO: We should allow to override the `derive-{const,mut}-casts`, helper methods
-et al. with per-variant annotations, probably.
-
-### Union Annotations
-
-* field-names=\[field1, field2, ...\] -- sets the names of all the fields in the output union. These names will be output verbatim, and are not eligible for renaming.
-
-The rest are just local overrides for the same options found in the cbindgen.toml:
-
-* rename-all=RenameRule
-
-
-
-### Function Annotations
-
-All function attributes are just local overrides for the same options found in the cbindgen.toml:
-
-* rename-all=RenameRule
-* prefix
-* postfix
-* ptrs-as-arrays=\[[ptr\_name1; array\_length1], [ptr\_name2; array\_length2], ...\] -- represents the pointer arguments of a function as arrays. Below how the mappings are performed:
-
-```
-arg: *const T --> const T arg[array_length]
-arg: *mut T ---> T arg[array_length]
-```
-
-If `array_length` is not specified:
-
-```
-arg: *const T --> const T arg[]
-arg: *mut T --> T arg[]
-```
-
-## Generating Swift Bindings
-
-In addition to parsing function names in C/C++ header files, the Swift compiler can make use of the `swift_name` attribute on functions to generate more idiomatic names for imported functions and methods.
-
-This attribute is commonly used in Objective-C/C/C++ via the `NS_SWIFT_NAME` and `CF_SWIFT_NAME` macros.
-
-Given configuration in the cbindgen.toml, `cbindgen` can generate these attributes for you by guessing an appropriate method signature based on the existing function name (and type, if it is a method in an `impl` block).
-
-This is controlled by the `swift_name_macro` option in the cbindgen.toml.
-
-## cbindgen.toml
-
-Most configuration happens through your cbindgen.toml file. Every value has a default (that is usually reasonable), so you can start with an empty cbindgen.toml and tweak it until you like the output you're getting.
-
-Note that many options defined here only apply for one of C or C++. Usually it's an option specifying whether we should try to make use of a feature in C++'s type system or generate a helper method.
-
-```toml
-# The language to output bindings in
-#
-# possible values: "C", "C++", "Cython"
-#
-# default: "C++"
-language = "C"
-
-
-
-
-# Options for wrapping the contents of the header:
-
-# An optional string of text to output at the beginning of the generated file
-# default: doesn't emit anything
-header = "/* Text to put at the beginning of the generated file. Probably a license. */"
-
-# An optional string of text to output at the end of the generated file
-# default: doesn't emit anything
-trailer = "/* Text to put at the end of the generated file */"
-
-# An optional name to use as an include guard
-# default: doesn't emit an include guard
-include_guard = "mozilla_wr_bindings_h"
-
-# Whether to add a `#pragma once` guard
-# default: doesn't emit a `#pragma once`
-pragma_once = true
-
-# An optional string of text to output between major sections of the generated
-# file as a warning against manual editing
-#
-# default: doesn't emit anything
-autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
-
-# Whether to include a comment with the version of cbindgen used to generate the file
-# default: false
-include_version = true
-
-# An optional namespace to output around the generated bindings
-# default: doesn't emit a namespace
-namespace = "ffi"
-
-# An optional list of namespaces to output around the generated bindings
-# default: []
-namespaces = ["mozilla", "wr"]
-
-# An optional list of namespaces to declare as using with "using namespace"
-# default: []
-using_namespaces = ["mozilla", "wr"]
-
-# A list of sys headers to #include (with angle brackets)
-# default: []
-sys_includes = ["stdio", "string"]
-
-# A list of headers to #include (with quotes)
-# default: []
-includes = ["my_great_lib.h"]
-
-# Whether cbindgen's default C/C++ standard imports should be suppressed. These
-# imports are included by default because our generated headers tend to require
-# them (e.g. for uint32_t). Currently, the generated imports are:
-#
-# * for C: <stdarg.h>, <stdbool.h>, <stdint.h>, <stdlib.h>, <uchar.h>
-#
-# * for C++: <cstdarg>, <cstdint>, <cstdlib>, <new>, <cassert> (depending on config)
-#
-# default: false
-no_includes = false
-
-# Whether to make a C header C++ compatible.
-# These will wrap generated functions into a `extern "C"` block, e.g.
-#
-# #ifdef __cplusplus
-# extern "C" {
-# #endif // __cplusplus
-#
-# // Generated functions.
-#
-# #ifdef __cplusplus
-# } // extern "C"
-# #endif // __cplusplus
-#
-# If the language is not C this option won't have any effect.
-#
-# default: false
-cpp_compat = false
-
-# A list of lines to add verbatim after the includes block
-after_includes = "#define VERSION 1"
-
-
-
-# Code Style Options
-
-# The style to use for curly braces
-#
-# possible values: "SameLine", "NextLine"
-#
-# default: "SameLine"
-braces = "SameLine"
-
-# The desired length of a line to use when formatting lines
-# default: 100
-line_length = 80
-
-# The amount of spaces to indent by
-# default: 2
-tab_width = 3
-
-# Include doc comments from Rust as documentation
-documentation = true
-
-# How the generated documentation should be commented.
-#
-# possible values:
-# * "c": /* like this */
-# * "c99": // like this
-# * "c++": /// like this
-# * "doxy": like C, but with leading *'s on each line
-# * "auto": "c++" if that's the language, "doxy" otherwise
-#
-# default: "auto"
-documentation_style = "doxy"
-
-# How much of the documentation for each item is output.
-#
-# possible values:
-# * "short": Only the first line.
-# * "full": The full documentation.
-#
-# default: "full"
-documentation_length = "short"
-
-
-
-
-# Codegen Options
-
-# When generating a C header, the kind of declaration style to use for structs
-# or enums.
-#
-# possible values:
-# * "type": typedef struct { ... } MyType;
-# * "tag": struct MyType { ... };
-# * "both": typedef struct MyType { ... } MyType;
-#
-# default: "both"
-style = "both"
-
-# If this option is true `usize` and `isize` will be converted into `size_t` and `ptrdiff_t`
-# instead of `uintptr_t` and `intptr_t` respectively.
-usize_is_size_t = true
-
-# A list of substitutions for converting cfg's to ifdefs. cfgs which aren't
-# defined here will just be discarded.
-#
-# e.g.
-# `#[cfg(target = "freebsd")] ...`
-# becomes
-# `#if defined(DEFINE_FREEBSD) ... #endif`
-[defines]
-"target_os = freebsd" = "DEFINE_FREEBSD"
-"feature = serde" = "DEFINE_SERDE"
-
-
-
-
-
-[export]
-# A list of additional items to always include in the generated bindings if they're
-# found but otherwise don't appear to be used by the public API.
-#
-# default: []
-include = ["MyOrphanStruct", "MyGreatTypeRename"]
-
-# A list of items to not include in the generated bindings
-# default: []
-exclude = ["Bad"]
-
-# A prefix to add before the name of every item
-# default: no prefix is added
-prefix = "CAPI_"
-
-# Types of items that we'll generate. If empty, then all types of item are emitted.
-#
-# possible items: (TODO: explain these in detail)
-# * "constants":
-# * "globals":
-# * "enums":
-# * "structs":
-# * "unions":
-# * "typedefs":
-# * "opaque":
-# * "functions":
-#
-# default: []
-item_types = ["enums", "structs", "opaque", "functions"]
-
-# Whether applying rules in export.rename prevents export.prefix from applying.
-#
-# e.g. given this toml:
-#
-# [export]
-# prefix = "capi_"
-# [export.rename]
-# "MyType" = "my_cool_type"
-#
-# You get the following results:
-#
-# renaming_overrides_prefixing = true:
-# "MyType" => "my_cool_type"
-#
-# renaming_overrides_prefixing = false:
-# "MyType => capi_my_cool_type"
-#
-# default: false
-renaming_overrides_prefixing = true
-
-# Table of name conversions to apply to item names (lhs becomes rhs)
-[export.rename]
-"MyType" = "my_cool_type"
-"my_function" = "BetterFunctionName"
-
-# Table of things to prepend to the body of any struct, union, or enum that has the
-# given name. This can be used to add things like methods which don't change ABI,
-# mark fields private, etc
-[export.pre_body]
-"MyType" = """
- MyType() = delete;
-private:
-"""
-
-# Table of things to append to the body of any struct, union, or enum that has the
-# given name. This can be used to add things like methods which don't change ABI.
-[export.body]
-"MyType" = """
- void cppMethod() const;
-"""
-
-# Configuration for name mangling
-[export.mangle]
-# Whether the types should be renamed during mangling, for example
-# c_char -> CChar, etc.
-rename_types = "PascalCase"
-# Whether the underscores from the mangled name should be omitted.
-remove_underscores = false
-
-[layout]
-# A string that should come before the name of any type which has been marked
-# as `#[repr(packed)]`. For instance, "__attribute__((packed))" would be a
-# reasonable value if targeting gcc/clang. A more portable solution would
-# involve emitting the name of a macro which you define in a platform-specific
-# way. e.g. "PACKED"
-#
-# default: `#[repr(packed)]` types will be treated as opaque, since it would
-# be unsafe for C callers to use a incorrectly laid-out union.
-packed = "PACKED"
-
-# A string that should come before the name of any type which has been marked
-# as `#[repr(align(n))]`. This string must be a function-like macro which takes
-# a single argument (the requested alignment, `n`). For instance, a macro
-# `#define`d as `ALIGNED(n)` in `header` which translates to
-# `__attribute__((aligned(n)))` would be a reasonable value if targeting
-# gcc/clang.
-#
-# default: `#[repr(align(n))]` types will be treated as opaque, since it
-# could be unsafe for C callers to use a incorrectly-aligned union.
-aligned_n = "ALIGNED"
-
-
-[fn]
-# An optional prefix to put before every function declaration
-# default: no prefix added
-prefix = "WR_START_FUNC"
-
-# An optional postfix to put after any function declaration
-# default: no postix added
-postfix = "WR_END_FUNC"
-
-# How to format function arguments
-#
-# possible values:
-# * "horizontal": place all arguments on the same line
-# * "vertical": place each argument on its own line
-# * "auto": only use vertical if horizontal would exceed line_length
-#
-# default: "auto"
-args = "horizontal"
-
-# An optional string that should prefix function declarations which have been
-# marked as `#[must_use]`. For instance, "__attribute__((warn_unused_result))"
-# would be a reasonable value if targeting gcc/clang. A more portable solution
-# would involve emitting the name of a macro which you define in a
-# platform-specific way. e.g. "MUST_USE_FUNC"
-# default: nothing is emitted for must_use functions
-must_use = "MUST_USE_FUNC"
-
-# An optional string that will be used in the attribute position for functions
-# that don't return (that return `!` in Rust).
-#
-# For instance, `__attribute__((noreturn))` would be a reasonable value if
-# targeting gcc/clang.
-no_return = "NO_RETURN"
-
-# An optional string that, if present, will be used to generate Swift function
-# and method signatures for generated functions, for example "CF_SWIFT_NAME".
-# If no such macro is available in your toolchain, you can define one using the
-# `header` option in cbindgen.toml
-# default: no swift_name function attributes are generated
-swift_name_macro = "CF_SWIFT_NAME"
-
-# A rule to use to rename function argument names. The renaming assumes the input
-# is the Rust standard snake_case, however it accepts all the different rename_args
-# inputs. This means many options here are no-ops or redundant.
-#
-# possible values (that actually do something):
-# * "CamelCase": my_arg => myArg
-# * "PascalCase": my_arg => MyArg
-# * "GeckoCase": my_arg => aMyArg
-# * "ScreamingSnakeCase": my_arg => MY_ARG
-# * "None": apply no renaming
-#
-# technically possible values (that shouldn't have a purpose here):
-# * "SnakeCase": apply no renaming
-# * "LowerCase": apply no renaming (actually applies to_lowercase, is this bug?)
-# * "UpperCase": same as ScreamingSnakeCase in this context
-# * "QualifiedScreamingSnakeCase" => same as ScreamingSnakeCase in this context
-#
-# default: "None"
-rename_args = "PascalCase"
-
-# This rule specifies the order in which functions will be sorted.
-#
-# "Name": sort by the name of the function
-# "None": keep order in which the functions have been parsed
-#
-# default: "None"
-sort_by = "Name"
-
-[struct]
-# A rule to use to rename struct field names. The renaming assumes the input is
-# the Rust standard snake_case, however it acccepts all the different rename_args
-# inputs. This means many options here are no-ops or redundant.
-#
-# possible values (that actually do something):
-# * "CamelCase": my_arg => myArg
-# * "PascalCase": my_arg => MyArg
-# * "GeckoCase": my_arg => mMyArg
-# * "ScreamingSnakeCase": my_arg => MY_ARG
-# * "None": apply no renaming
-#
-# technically possible values (that shouldn't have a purpose here):
-# * "SnakeCase": apply no renaming
-# * "LowerCase": apply no renaming (actually applies to_lowercase, is this bug?)
-# * "UpperCase": same as ScreamingSnakeCase in this context
-# * "QualifiedScreamingSnakeCase" => same as ScreamingSnakeCase in this context
-#
-# default: "None"
-rename_fields = "PascalCase"
-
-# An optional string that should come before the name of any struct which has been
-# marked as `#[must_use]`. For instance, "__attribute__((warn_unused))"
-# would be a reasonable value if targeting gcc/clang. A more portable solution
-# would involve emitting the name of a macro which you define in a
-# platform-specific way. e.g. "MUST_USE_STRUCT"
-#
-# default: nothing is emitted for must_use structs
-must_use = "MUST_USE_STRUCT"
-
-# Whether a Rust type with associated consts should emit those consts inside the
-# type's body. Otherwise they will be emitted trailing and with the type's name
-# prefixed. This does nothing if the target is C, or if
-# [const]allow_static_const = false
-#
-# default: false
-# associated_constants_in_body: false
-
-# Whether to derive a simple constructor that takes a value for every field.
-# default: false
-derive_constructor = true
-
-# Whether to derive an operator== for all structs
-# default: false
-derive_eq = false
-
-# Whether to derive an operator!= for all structs
-# default: false
-derive_neq = false
-
-# Whether to derive an operator< for all structs
-# default: false
-derive_lt = false
-
-# Whether to derive an operator<= for all structs
-# default: false
-derive_lte = false
-
-# Whether to derive an operator> for all structs
-# default: false
-derive_gt = false
-
-# Whether to derive an operator>= for all structs
-# default: false
-derive_gte = false
-
-
-
-
-
-[enum]
-# A rule to use to rename enum variants, and the names of any fields those
-# variants have. This should probably be split up into two separate options, but
-# for now, they're the same! See the documentation for `[struct]rename_fields`
-# for how this applies to fields. Renaming of the variant assumes that the input
-# is the Rust standard PascalCase. In the case of QualifiedScreamingSnakeCase,
-# it also assumed that the enum's name is PascalCase.
-#
-# possible values (that actually do something):
-# * "CamelCase": MyVariant => myVariant
-# * "SnakeCase": MyVariant => my_variant
-# * "ScreamingSnakeCase": MyVariant => MY_VARIANT
-# * "QualifiedScreamingSnakeCase": MyVariant => ENUM_NAME_MY_VARIANT
-# * "LowerCase": MyVariant => myvariant
-# * "UpperCase": MyVariant => MYVARIANT
-# * "None": apply no renaming
-#
-# technically possible values (that shouldn't have a purpose for the variants):
-# * "PascalCase": apply no renaming
-# * "GeckoCase": apply no renaming
-#
-# default: "None"
-rename_variants = "None"
-
-# Whether an extra "sentinel" enum variant should be added to all generated enums.
-# Firefox uses this for their IPC serialization library.
-#
-# WARNING: if the sentinel is ever passed into Rust, behaviour will be Undefined.
-# Rust does not know about this value, and will assume it cannot happen.
-#
-# default: false
-add_sentinel = false
-
-# Whether enum variant names should be prefixed with the name of the enum.
-# default: false
-prefix_with_name = false
-
-# Whether to emit enums using "enum class" when targeting C++.
-# default: true
-enum_class = true
-
-# Whether to generate static `::MyVariant(..)` constructors and `bool IsMyVariant()`
-# methods for enums with fields.
-#
-# default: false
-derive_helper_methods = false
-
-# Whether to generate `const MyVariant& AsMyVariant() const` methods for enums with fields.
-# default: false
-derive_const_casts = false
-
-# Whether to generate `MyVariant& AsMyVariant()` methods for enums with fields
-# default: false
-derive_mut_casts = false
-
-# The name of the macro/function to use for asserting `IsMyVariant()` in the body of
-# derived `AsMyVariant()` cast methods.
-#
-# default: "assert" (but also causes `<cassert>` to be included by default)
-cast_assert_name = "MOZ_RELEASE_ASSERT"
-
-# An optional string that should come before the name of any enum which has been
-# marked as `#[must_use]`. For instance, "__attribute__((warn_unused))"
-# would be a reasonable value if targeting gcc/clang. A more portable solution
-# would involve emitting the name of a macro which you define in a
-# platform-specific way. e.g. "MUST_USE_ENUM"
-#
-# Note that this refers to the *output* type. That means this will not apply to an enum
-# with fields, as it will be emitted as a struct. `[struct]must_use` will apply there.
-#
-# default: nothing is emitted for must_use enums
-must_use = "MUST_USE_ENUM"
-
-# Whether enums with fields should generate destructors. This exists so that generic
-# enums can be properly instantiated with payloads that are C++ types with
-# destructors. This isn't necessary for structs because C++ has rules to
-# automatically derive the correct constructors and destructors for those types.
-#
-# Care should be taken with this option, as Rust and C++ cannot
-# properly interoperate with eachother's notions of destructors. Also, this may
-# change the ABI for the type. Either your destructor-full enums must live
-# exclusively within C++, or they must only be passed by-reference between
-# C++ and Rust.
-#
-# default: false
-derive_tagged_enum_destructor = false
-
-# Whether enums with fields should generate copy-constructor. See the discussion on
-# derive_tagged_enum_destructor for why this is both useful and very dangerous.
-#
-# default: false
-derive_tagged_enum_copy_constructor = false
-# Whether enums with fields should generate copy-assignment operators.
-#
-# This depends on also deriving copy-constructors, and it is highly encouraged
-# for this to be set to true.
-#
-# default: false
-derive_tagged_enum_copy_assignment = false
-
-# Whether enums with fields should generate an empty, private destructor.
-# This allows the auto-generated constructor functions to compile, if there are
-# non-trivially constructible members. This falls in the same family of
-# dangerousness as `derive_tagged_enum_copy_constructor` and co.
-#
-# default: false
-private_default_tagged_enum_constructor = false
-
-
-
-
-
-[const]
-# Whether a generated constant can be a static const in C++ mode. I have no
-# idea why you would turn this off.
-#
-# default: true
-allow_static_const = true
-
-# Whether a generated constant can be constexpr in C++ mode.
-#
-# default: true
-allow_constexpr = false
-
-# This rule specifies the order in which constants will be sorted.
-#
-# "Name": sort by the name of the constant
-# "None": keep order in which the constants have been parsed
-#
-# default: "None"
-sort_by = "Name"
-
-
-
-
-[macro_expansion]
-# Whether bindings should be generated for instances of the bitflags! macro.
-# default: false
-bitflags = true
-
-
-
-
-
-
-# Options for how your Rust library should be parsed
-
-[parse]
-# Whether to parse dependent crates and include their types in the output
-# default: false
-parse_deps = true
-
-# A white list of crate names that are allowed to be parsed. If this is defined,
-# only crates found in this list will ever be parsed.
-#
-# default: there is no whitelist (NOTE: this is the opposite of [])
-include = ["webrender", "webrender_traits"]
-
-# A black list of crate names that are not allowed to be parsed.
-# default: []
-exclude = ["libc"]
-
-# Whether to use a new temporary target directory when running `rustc -Zunpretty=expanded`.
-# This may be required for some build processes.
-#
-# default: false
-clean = false
-
-# Which crates other than the top-level binding crate we should generate
-# bindings for.
-#
-# default: []
-extra_bindings = ["my_awesome_dep"]
-
-[parse.expand]
-# A list of crate names that should be run through `cargo expand` before
-# parsing to expand any macros. Note that if a crate is named here, it
-# will always be parsed, even if the blacklist/whitelist says it shouldn't be.
-#
-# default: []
-crates = ["euclid"]
-
-# If enabled, use the `--all-features` option when expanding. Ignored when
-# `features` is set. For backwards-compatibility, this is forced on if
-# `expand = ["euclid"]` shorthand is used.
-#
-# default: false
-all_features = false
-
-# When `all_features` is disabled and this is also disabled, use the
-# `--no-default-features` option when expanding.
-#
-# default: true
-default_features = true
-
-# A list of feature names that should be used when running `cargo expand`. This
-# combines with `default_features` like in your `Cargo.toml`. Note that the features
-# listed here are features for the current crate being built, *not* the crates
-# being expanded. The crate's `Cargo.toml` must take care of enabling the
-# appropriate features in its dependencies
-#
-# default: []
-features = ["cbindgen"]
-
-[ptr]
-# An optional string to decorate all pointers that are
-# required to be non null. Nullability is inferred from the Rust type: `&T`,
-# `&mut T` and `NonNull<T>` all require a valid pointer value.
-non_null_attribute = "_Nonnull"
-
-# Options specific to Cython bindings.
-
-[cython]
-
-# Header specified in the top level `cdef extern from header:` declaration.
-#
-# default: *
-header = '"my_header.h"'
-
-# `from module cimport name1, name2` declarations added in the same place
-# where you'd get includes in C.
-[cython.cimports]
-module = ["name1", "name2"]
-```
-
-
-
-
-
-[reference]: https://doc.rust-lang.org/nightly/reference/type-layout.html#representations
-[really-tagged-unions]: https://github.com/rust-lang/rfcs/blob/master/text/2195-really-tagged-unions.md
-[section-cfgs]: #defines-and-cfgs
-[file-it]: https://github.com/eqrion/cbindgen/issues/new
diff --git a/cbindgen-0.24.5/src/bindgen/bindings.rs b/cbindgen-0.24.5/src/bindgen/bindings.rs
deleted file mode 100644
index a03b282..0000000
--- a/cbindgen-0.24.5/src/bindgen/bindings.rs
+++ /dev/null
@@ -1,493 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::borrow::Cow;
-use std::cell::RefCell;
-use std::collections::HashMap;
-use std::fs;
-use std::fs::File;
-use std::io::{Read, Write};
-use std::path;
-use std::rc::Rc;
-
-use crate::bindgen::config::{Config, Language};
-use crate::bindgen::ir::{
- Constant, Function, ItemContainer, ItemMap, Path as BindgenPath, Static, Struct, Typedef,
-};
-use crate::bindgen::writer::{Source, SourceWriter};
-
-/// A bindings header that can be written.
-pub struct Bindings {
- pub config: Config,
- /// The map from path to struct, used to lookup whether a given type is a
- /// transparent struct. This is needed to generate code for constants.
- struct_map: ItemMap<Struct>,
- typedef_map: ItemMap<Typedef>,
- struct_fileds_memo: RefCell<HashMap<BindgenPath, Rc<Vec<String>>>>,
- globals: Vec<Static>,
- constants: Vec<Constant>,
- items: Vec<ItemContainer>,
- functions: Vec<Function>,
- /// Bindings are generated by a recursive call to cbindgen
- /// and shouldn't do anything when written anywhere.
- noop: bool,
-}
-
-#[derive(PartialEq, Eq)]
-enum NamespaceOperation {
- Open,
- Close,
-}
-
-impl Bindings {
- #[allow(clippy::too_many_arguments)]
- pub(crate) fn new(
- config: Config,
- struct_map: ItemMap<Struct>,
- typedef_map: ItemMap<Typedef>,
- constants: Vec<Constant>,
- globals: Vec<Static>,
- items: Vec<ItemContainer>,
- functions: Vec<Function>,
- noop: bool,
- ) -> Bindings {
- Bindings {
- config,
- struct_map,
- typedef_map,
- struct_fileds_memo: Default::default(),
- globals,
- constants,
- items,
- functions,
- noop,
- }
- }
-
- // FIXME(emilio): What to do when the configuration doesn't match?
- pub fn struct_is_transparent(&self, path: &BindgenPath) -> bool {
- let mut any = false;
- self.struct_map.for_items(path, |s| any |= s.is_transparent);
- any
- }
-
- /// Peels through typedefs to allow resolving structs.
- fn resolved_struct_path<'a>(&self, path: &'a BindgenPath) -> Cow<'a, BindgenPath> {
- use crate::bindgen::ir::Type;
-
- let mut resolved_path = Cow::Borrowed(path);
- loop {
- let mut found = None;
- self.typedef_map.for_items(&resolved_path, |item| {
- if let Type::Path(ref p) = item.aliased {
- found = Some(p.path().clone());
- }
- });
- resolved_path = match found {
- Some(p) => Cow::Owned(p),
- None => break,
- }
- }
- resolved_path
- }
-
- pub fn struct_exists(&self, path: &BindgenPath) -> bool {
- let mut any = false;
- self.struct_map
- .for_items(&self.resolved_struct_path(path), |_| any = true);
- any
- }
-
- pub fn struct_field_names(&self, path: &BindgenPath) -> Rc<Vec<String>> {
- let mut memos = self.struct_fileds_memo.borrow_mut();
- if let Some(memo) = memos.get(path) {
- return memo.clone();
- }
-
- let resolved_path = self.resolved_struct_path(path);
-
- let mut fields = Vec::<String>::new();
- self.struct_map.for_items(&resolved_path, |st| {
- let mut pos: usize = 0;
- for field in &st.fields {
- if let Some(found_pos) = fields.iter().position(|v| *v == field.name) {
- pos = found_pos + 1;
- } else {
- fields.insert(pos, field.name.clone());
- pos += 1;
- }
- }
- });
-
- let fields = Rc::new(fields);
- memos.insert(path.clone(), fields.clone());
- if let Cow::Owned(p) = resolved_path {
- memos.insert(p, fields.clone());
- }
- fields
- }
-
- pub fn write_to_file<P: AsRef<path::Path>>(&self, path: P) -> bool {
- if self.noop {
- return false;
- }
-
- // Don't compare files if we've never written this file before
- if !path.as_ref().is_file() {
- if let Some(parent) = path::Path::new(path.as_ref()).parent() {
- fs::create_dir_all(parent).unwrap();
- }
- self.write(File::create(path).unwrap());
- return true;
- }
-
- let mut new_file_contents = Vec::new();
- self.write(&mut new_file_contents);
-
- let mut old_file_contents = Vec::new();
- {
- let mut old_file = File::open(&path).unwrap();
- old_file.read_to_end(&mut old_file_contents).unwrap();
- }
-
- if old_file_contents != new_file_contents {
- let mut new_file = File::create(&path).unwrap();
- new_file.write_all(&new_file_contents).unwrap();
- true
- } else {
- false
- }
- }
-
- pub fn write_headers<F: Write>(&self, out: &mut SourceWriter<F>) {
- if self.noop {
- return;
- }
-
- if let Some(ref f) = self.config.header {
- out.new_line_if_not_start();
- write!(out, "{}", f);
- out.new_line();
- }
- if let Some(f) = self.config.include_guard() {
- out.new_line_if_not_start();
- write!(out, "#ifndef {}", f);
- out.new_line();
- write!(out, "#define {}", f);
- out.new_line();
- }
- if self.config.pragma_once && self.config.language != Language::Cython {
- out.new_line_if_not_start();
- write!(out, "#pragma once");
- out.new_line();
- }
- if self.config.include_version {
- out.new_line_if_not_start();
- write!(
- out,
- "/* Generated with cbindgen:{} */",
- crate::bindgen::config::VERSION
- );
- out.new_line();
- }
- if let Some(ref f) = self.config.autogen_warning {
- out.new_line_if_not_start();
- write!(out, "{}", f);
- out.new_line();
- }
-
- if self.config.no_includes
- && self.config.sys_includes().is_empty()
- && self.config.includes().is_empty()
- && (self.config.cython.cimports.is_empty() || self.config.language != Language::Cython)
- && self.config.after_includes.is_none()
- {
- return;
- }
-
- out.new_line_if_not_start();
-
- if !self.config.no_includes {
- match self.config.language {
- Language::C => {
- out.write("#include <stdarg.h>");
- out.new_line();
- out.write("#include <stdbool.h>");
- out.new_line();
- if self.config.usize_is_size_t {
- out.write("#include <stddef.h>");
- out.new_line();
- }
- out.write("#include <stdint.h>");
- out.new_line();
- out.write("#include <stdlib.h>");
- out.new_line();
- }
- Language::Cxx => {
- out.write("#include <cstdarg>");
- out.new_line();
- if self.config.usize_is_size_t {
- out.write("#include <cstddef>");
- out.new_line();
- }
- out.write("#include <cstdint>");
- out.new_line();
- out.write("#include <cstdlib>");
- out.new_line();
- out.write("#include <ostream>");
- out.new_line();
- out.write("#include <new>");
- out.new_line();
- if self.config.enumeration.cast_assert_name.is_none()
- && (self.config.enumeration.derive_mut_casts
- || self.config.enumeration.derive_const_casts)
- {
- out.write("#include <cassert>");
- out.new_line();
- }
- }
- Language::Cython => {
- out.write(
- "from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t",
- );
- out.new_line();
- out.write(
- "from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t",
- );
- out.new_line();
- out.write("cdef extern from *");
- out.open_brace();
- out.write("ctypedef bint bool");
- out.new_line();
- out.write("ctypedef struct va_list");
- out.new_line();
- out.close_brace(false);
- }
- }
- }
-
- for include in self.config.sys_includes() {
- write!(out, "#include <{}>", include);
- out.new_line();
- }
-
- for include in self.config.includes() {
- write!(out, "#include \"{}\"", include);
- out.new_line();
- }
-
- if self.config.language == Language::Cython {
- for (module, names) in &self.config.cython.cimports {
- write!(out, "from {} cimport {}", module, names.join(", "));
- out.new_line();
- }
- }
-
- if let Some(ref line) = self.config.after_includes {
- write!(out, "{}", line);
- out.new_line();
- }
- }
-
- pub fn write<F: Write>(&self, file: F) {
- if self.noop {
- return;
- }
-
- let mut out = SourceWriter::new(file, self);
-
- self.write_headers(&mut out);
-
- self.open_namespaces(&mut out);
-
- for constant in &self.constants {
- if constant.uses_only_primitive_types() {
- out.new_line_if_not_start();
- constant.write(&self.config, &mut out, None);
- out.new_line();
- }
- }
-
- for item in &self.items {
- if item
- .deref()
- .annotations()
- .bool("no-export")
- .unwrap_or(false)
- {
- continue;
- }
-
- out.new_line_if_not_start();
- match *item {
- ItemContainer::Constant(..) => unreachable!(),
- ItemContainer::Static(..) => unreachable!(),
- ItemContainer::Enum(ref x) => x.write(&self.config, &mut out),
- ItemContainer::Struct(ref x) => x.write(&self.config, &mut out),
- ItemContainer::Union(ref x) => x.write(&self.config, &mut out),
- ItemContainer::OpaqueItem(ref x) => x.write(&self.config, &mut out),
- ItemContainer::Typedef(ref x) => x.write(&self.config, &mut out),
- }
- out.new_line();
- }
-
- for constant in &self.constants {
- if !constant.uses_only_primitive_types() {
- out.new_line_if_not_start();
- constant.write(&self.config, &mut out, None);
- out.new_line();
- }
- }
-
- if !self.functions.is_empty() || !self.globals.is_empty() {
- if self.config.cpp_compatible_c() {
- out.new_line_if_not_start();
- out.write("#ifdef __cplusplus");
- }
-
- if self.config.language == Language::Cxx {
- if let Some(ref using_namespaces) = self.config.using_namespaces {
- for namespace in using_namespaces {
- out.new_line();
- write!(out, "using namespace {};", namespace);
- }
- out.new_line();
- }
- }
-
- if self.config.language == Language::Cxx || self.config.cpp_compatible_c() {
- out.new_line();
- out.write("extern \"C\" {");
- out.new_line();
- }
-
- if self.config.cpp_compatible_c() {
- out.write("#endif // __cplusplus");
- out.new_line();
- }
-
- for global in &self.globals {
- out.new_line_if_not_start();
- global.write(&self.config, &mut out);
- out.new_line();
- }
-
- for function in &self.functions {
- out.new_line_if_not_start();
- function.write(&self.config, &mut out);
- out.new_line();
- }
-
- if self.config.cpp_compatible_c() {
- out.new_line();
- out.write("#ifdef __cplusplus");
- }
-
- if self.config.language == Language::Cxx || self.config.cpp_compatible_c() {
- out.new_line();
- out.write("} // extern \"C\"");
- out.new_line();
- }
-
- if self.config.cpp_compatible_c() {
- out.write("#endif // __cplusplus");
- out.new_line();
- }
- }
-
- if self.config.language == Language::Cython
- && self.globals.is_empty()
- && self.constants.is_empty()
- && self.items.is_empty()
- && self.functions.is_empty()
- {
- out.write("pass");
- }
-
- self.close_namespaces(&mut out);
-
- if let Some(f) = self.config.include_guard() {
- out.new_line_if_not_start();
- if self.config.language == Language::C {
- write!(out, "#endif /* {} */", f);
- } else {
- write!(out, "#endif // {}", f);
- }
- out.new_line();
- }
- if let Some(ref f) = self.config.trailer {
- out.new_line_if_not_start();
- write!(out, "{}", f);
- if !f.ends_with('\n') {
- out.new_line();
- }
- }
- }
-
- fn all_namespaces(&self) -> Vec<&str> {
- if self.config.language != Language::Cxx && !self.config.cpp_compatible_c() {
- return vec![];
- }
- let mut ret = vec![];
- if let Some(ref namespace) = self.config.namespace {
- ret.push(&**namespace);
- }
- if let Some(ref namespaces) = self.config.namespaces {
- for namespace in namespaces {
- ret.push(&**namespace);
- }
- }
- ret
- }
-
- fn open_close_namespaces<F: Write>(&self, op: NamespaceOperation, out: &mut SourceWriter<F>) {
- if self.config.language == Language::Cython {
- if op == NamespaceOperation::Open {
- out.new_line();
- let header = self.config.cython.header.as_deref().unwrap_or("*");
- write!(out, "cdef extern from {}", header);
- out.open_brace();
- } else {
- out.close_brace(false);
- }
- return;
- }
-
- let mut namespaces = self.all_namespaces();
- if namespaces.is_empty() {
- return;
- }
-
- if op == NamespaceOperation::Close {
- namespaces.reverse();
- }
-
- if self.config.cpp_compatible_c() {
- out.new_line_if_not_start();
- out.write("#ifdef __cplusplus");
- }
-
- for namespace in namespaces {
- out.new_line();
- match op {
- NamespaceOperation::Open => write!(out, "namespace {} {{", namespace),
- NamespaceOperation::Close => write!(out, "}} // namespace {}", namespace),
- }
- }
-
- out.new_line();
- if self.config.cpp_compatible_c() {
- out.write("#endif // __cplusplus");
- out.new_line();
- }
- }
-
- pub(crate) fn open_namespaces<F: Write>(&self, out: &mut SourceWriter<F>) {
- self.open_close_namespaces(NamespaceOperation::Open, out);
- }
-
- pub(crate) fn close_namespaces<F: Write>(&self, out: &mut SourceWriter<F>) {
- self.open_close_namespaces(NamespaceOperation::Close, out);
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/bitflags.rs b/cbindgen-0.24.5/src/bindgen/bitflags.rs
deleted file mode 100644
index 2841294..0000000
--- a/cbindgen-0.24.5/src/bindgen/bitflags.rs
+++ /dev/null
@@ -1,143 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use proc_macro2::TokenStream;
-use syn::parse::{Parse, ParseStream, Parser, Result as ParseResult};
-
-// $(#[$outer:meta])*
-// ($($vis:tt)*) $BitFlags:ident: $T:ty {
-// $(
-// $(#[$inner:ident $($args:tt)*])*
-// const $Flag:ident = $value:expr;
-// )+
-// }
-#[derive(Debug)]
-pub struct Bitflags {
- attrs: Vec<syn::Attribute>,
- vis: syn::Visibility,
- #[allow(dead_code)]
- struct_token: Token![struct],
- name: syn::Ident,
- #[allow(dead_code)]
- colon_token: Token![:],
- repr: syn::Type,
- flags: Flags,
-}
-
-impl Bitflags {
- pub fn expand(&self) -> (syn::ItemStruct, syn::ItemImpl) {
- let Bitflags {
- ref attrs,
- ref vis,
- ref name,
- ref repr,
- ref flags,
- ..
- } = *self;
-
- let struct_ = parse_quote! {
- /// cbindgen:internal-derive-bitflags=true
- #(#attrs)*
- #vis struct #name {
- bits: #repr,
- }
- };
-
- let consts = flags.expand(name, repr);
- let impl_ = parse_quote! {
- impl #name {
- #consts
- }
- };
-
- (struct_, impl_)
- }
-}
-
-impl Parse for Bitflags {
- fn parse(input: ParseStream) -> ParseResult<Self> {
- Ok(Self {
- attrs: input.call(syn::Attribute::parse_outer)?,
- vis: input.parse()?,
- struct_token: input.parse()?,
- name: input.parse()?,
- colon_token: input.parse()?,
- repr: input.parse()?,
- flags: input.parse()?,
- })
- }
-}
-
-// $(#[$inner:ident $($args:tt)*])*
-// const $Flag:ident = $value:expr;
-#[derive(Debug)]
-struct Flag {
- attrs: Vec<syn::Attribute>,
- #[allow(dead_code)]
- const_token: Token![const],
- name: syn::Ident,
- #[allow(dead_code)]
- equals_token: Token![=],
- value: syn::Expr,
- #[allow(dead_code)]
- semicolon_token: Token![;],
-}
-
-impl Flag {
- fn expand(&self, struct_name: &syn::Ident, repr: &syn::Type) -> TokenStream {
- let Flag {
- ref attrs,
- ref name,
- ref value,
- ..
- } = *self;
- quote! {
- #(#attrs)*
- pub const #name : #struct_name = #struct_name { bits: (#value) as #repr };
- }
- }
-}
-
-impl Parse for Flag {
- fn parse(input: ParseStream) -> ParseResult<Self> {
- Ok(Self {
- attrs: input.call(syn::Attribute::parse_outer)?,
- const_token: input.parse()?,
- name: input.parse()?,
- equals_token: input.parse()?,
- value: input.parse()?,
- semicolon_token: input.parse()?,
- })
- }
-}
-
-#[derive(Debug)]
-struct Flags(Vec<Flag>);
-
-impl Parse for Flags {
- fn parse(input: ParseStream) -> ParseResult<Self> {
- let content;
- let _ = braced!(content in input);
- let mut flags = vec![];
- while !content.is_empty() {
- flags.push(content.parse()?);
- }
- Ok(Flags(flags))
- }
-}
-
-impl Flags {
- fn expand(&self, struct_name: &syn::Ident, repr: &syn::Type) -> TokenStream {
- let mut ts = quote! {};
- for flag in &self.0 {
- ts.extend(flag.expand(struct_name, repr));
- }
- ts
- }
-}
-
-pub fn parse(tokens: TokenStream) -> ParseResult<Bitflags> {
- let parser = Bitflags::parse;
- parser.parse2(tokens)
-}
diff --git a/cbindgen-0.24.5/src/bindgen/builder.rs b/cbindgen-0.24.5/src/bindgen/builder.rs
deleted file mode 100644
index 17d4ad1..0000000
--- a/cbindgen-0.24.5/src/bindgen/builder.rs
+++ /dev/null
@@ -1,420 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::path;
-
-use crate::bindgen::bindings::Bindings;
-use crate::bindgen::cargo::Cargo;
-use crate::bindgen::config::{Braces, Config, Language, Profile, Style};
-use crate::bindgen::error::Error;
-use crate::bindgen::library::Library;
-use crate::bindgen::parser::{self, Parse};
-
-/// A builder for generating a bindings header.
-#[derive(Debug, Clone)]
-pub struct Builder {
- config: Config,
- srcs: Vec<path::PathBuf>,
- lib: Option<(path::PathBuf, Option<String>)>,
- lib_cargo: Option<Cargo>,
- std_types: bool,
- lockfile: Option<path::PathBuf>,
-}
-
-impl Builder {
- #[allow(clippy::new_without_default)]
- pub fn new() -> Builder {
- Builder {
- config: Config::default(),
- srcs: Vec::new(),
- lib: None,
- lib_cargo: None,
- std_types: true,
- lockfile: None,
- }
- }
-
- #[allow(unused)]
- pub fn with_header<S: AsRef<str>>(mut self, header: S) -> Builder {
- self.config.header = Some(String::from(header.as_ref()));
- self
- }
-
- #[allow(unused)]
- pub fn with_no_includes(mut self) -> Builder {
- self.config.no_includes = true;
- self
- }
-
- #[allow(unused)]
- pub fn with_include<S: AsRef<str>>(mut self, include: S) -> Builder {
- self.config.includes.push(String::from(include.as_ref()));
- self
- }
-
- #[allow(unused)]
- pub fn with_sys_include<S: AsRef<str>>(mut self, include: S) -> Builder {
- self.config
- .sys_includes
- .push(String::from(include.as_ref()));
- self
- }
-
- #[allow(unused)]
- pub fn with_after_include<S: AsRef<str>>(mut self, line: S) -> Builder {
- self.config.after_includes = Some(String::from(line.as_ref()));
- self
- }
-
- #[allow(unused)]
- pub fn with_trailer<S: AsRef<str>>(mut self, trailer: S) -> Builder {
- self.config.trailer = Some(String::from(trailer.as_ref()));
- self
- }
-
- #[allow(unused)]
- pub fn with_include_guard<S: AsRef<str>>(mut self, include_guard: S) -> Builder {
- self.config.include_guard = Some(String::from(include_guard.as_ref()));
- self
- }
-
- #[allow(unused)]
- pub fn with_pragma_once(mut self, pragma_once: bool) -> Builder {
- self.config.pragma_once = pragma_once;
- self
- }
-
- #[allow(unused)]
- pub fn with_autogen_warning<S: AsRef<str>>(mut self, autogen_warning: S) -> Builder {
- self.config.autogen_warning = Some(String::from(autogen_warning.as_ref()));
- self
- }
-
- #[allow(unused)]
- pub fn with_include_version(mut self, include_version: bool) -> Builder {
- self.config.include_version = include_version;
- self
- }
-
- #[allow(unused)]
- pub fn with_namespace<S: AsRef<str>>(mut self, namespace: S) -> Builder {
- self.config.namespace = Some(String::from(namespace.as_ref()));
- self
- }
-
- #[allow(unused)]
- pub fn with_namespaces<S: AsRef<str>>(mut self, namespaces: &[S]) -> Builder {
- self.config.namespaces = Some(
- namespaces
- .iter()
- .map(|x| String::from(x.as_ref()))
- .collect(),
- );
- self
- }
-
- #[allow(unused)]
- pub fn with_using_namespaces<S: AsRef<str>>(mut self, namespaces: &[S]) -> Builder {
- self.config.using_namespaces = Some(
- namespaces
- .iter()
- .map(|x| String::from(x.as_ref()))
- .collect(),
- );
- self
- }
-
- #[allow(unused)]
- pub fn with_braces(mut self, braces: Braces) -> Builder {
- self.config.braces = braces;
- self
- }
-
- #[allow(unused)]
- pub fn with_line_length(mut self, line_length: usize) -> Builder {
- self.config.line_length = line_length;
- self
- }
-
- #[allow(unused)]
- pub fn with_tab_width(mut self, tab_width: usize) -> Builder {
- self.config.tab_width = tab_width;
- self
- }
-
- #[allow(unused)]
- pub fn with_language(mut self, language: Language) -> Builder {
- self.config.language = language;
- self
- }
-
- #[allow(unused)]
- pub fn with_cpp_compat(mut self, cpp_compat: bool) -> Builder {
- self.config.cpp_compat = cpp_compat;
- self
- }
-
- #[allow(unused)]
- pub fn with_style(mut self, style: Style) -> Builder {
- self.config.style = style;
- self
- }
-
- #[allow(unused)]
- pub fn include_item<S: AsRef<str>>(mut self, item_name: S) -> Builder {
- self.config
- .export
- .include
- .push(String::from(item_name.as_ref()));
- self
- }
-
- #[allow(unused)]
- pub fn exclude_item<S: AsRef<str>>(mut self, item_name: S) -> Builder {
- self.config
- .export
- .exclude
- .push(String::from(item_name.as_ref()));
- self
- }
-
- #[allow(unused)]
- pub fn rename_item<S: AsRef<str>>(mut self, from: S, to: S) -> Builder {
- self.config
- .export
- .rename
- .insert(String::from(from.as_ref()), String::from(to.as_ref()));
- self
- }
-
- #[allow(unused)]
- pub fn with_item_prefix<S: AsRef<str>>(mut self, prefix: S) -> Builder {
- self.config.export.prefix = Some(String::from(prefix.as_ref()));
- self
- }
-
- #[allow(unused)]
- pub fn with_parse_deps(mut self, parse_deps: bool) -> Builder {
- self.config.parse.parse_deps = parse_deps;
- self
- }
-
- #[allow(unused)]
- pub fn with_parse_include<S: AsRef<str>>(mut self, include: &[S]) -> Builder {
- self.config.parse.include =
- Some(include.iter().map(|x| String::from(x.as_ref())).collect());
- self
- }
-
- #[allow(unused)]
- pub fn with_parse_exclude<S: AsRef<str>>(mut self, exclude: &[S]) -> Builder {
- self.config.parse.exclude = exclude.iter().map(|x| String::from(x.as_ref())).collect();
- self
- }
-
- #[allow(unused)]
- pub fn with_parse_expand<S: AsRef<str>>(mut self, expand: &[S]) -> Builder {
- self.config.parse.expand.crates = expand.iter().map(|x| String::from(x.as_ref())).collect();
- self
- }
-
- #[allow(unused)]
- pub fn with_parse_expand_all_features(mut self, expand_all_features: bool) -> Builder {
- self.config.parse.expand.all_features = expand_all_features;
- self
- }
-
- #[allow(unused)]
- pub fn with_parse_expand_default_features(mut self, expand_default_features: bool) -> Builder {
- self.config.parse.expand.default_features = expand_default_features;
- self
- }
-
- #[allow(unused)]
- pub fn with_parse_expand_features<S: AsRef<str>>(mut self, expand_features: &[S]) -> Builder {
- self.config.parse.expand.features = Some(
- expand_features
- .iter()
- .map(|x| String::from(x.as_ref()))
- .collect(),
- );
- self
- }
-
- #[allow(unused)]
- pub fn with_parse_expand_profile(mut self, profile: Profile) -> Builder {
- self.config.parse.expand.profile = profile;
- self
- }
-
- #[allow(unused)]
- pub fn with_parse_extra_bindings<S: AsRef<str>>(mut self, extra_bindings: &[S]) -> Builder {
- self.config.parse.extra_bindings = extra_bindings
- .iter()
- .map(|x| String::from(x.as_ref()))
- .collect();
- self
- }
-
- #[allow(unused)]
- pub fn with_only_target_dependencies(mut self, only_target_dependencies: bool) -> Builder {
- self.config.only_target_dependencies = only_target_dependencies;
- self
- }
-
- #[allow(unused)]
- pub fn with_documentation(mut self, documentation: bool) -> Builder {
- self.config.documentation = documentation;
- self
- }
-
- #[allow(unused)]
- pub fn with_target_os_define(mut self, platform: &str, preprocessor_define: &str) -> Builder {
- self.config.defines.insert(
- format!("target_os = {}", platform),
- preprocessor_define.to_owned(),
- );
- self
- }
-
- #[allow(unused)]
- pub fn with_define(mut self, key: &str, value: &str, preprocessor_define: &str) -> Builder {
- self.config.defines.insert(
- format!("{} = {}", key, value),
- preprocessor_define.to_owned(),
- );
- self
- }
-
- #[allow(unused)]
- pub fn with_config(mut self, config: Config) -> Builder {
- self.config = config;
- self
- }
-
- #[allow(unused)]
- pub fn with_std_types(mut self, std_types: bool) -> Builder {
- self.std_types = std_types;
- self
- }
-
- #[allow(unused)]
- pub fn with_src<P: AsRef<path::Path>>(mut self, src: P) -> Builder {
- self.srcs.push(src.as_ref().to_owned());
- self
- }
-
- #[allow(unused)]
- pub fn with_crate<P: AsRef<path::Path>>(mut self, lib_dir: P) -> Builder {
- debug_assert!(self.lib.is_none());
- debug_assert!(self.lib_cargo.is_none());
- self.lib = Some((path::PathBuf::from(lib_dir.as_ref()), None));
- self
- }
-
- #[allow(unused)]
- pub fn with_crate_and_name<P: AsRef<path::Path>, S: AsRef<str>>(
- mut self,
- lib_dir: P,
- binding_lib_name: S,
- ) -> Builder {
- debug_assert!(self.lib.is_none());
- debug_assert!(self.lib_cargo.is_none());
- self.lib = Some((
- path::PathBuf::from(lib_dir.as_ref()),
- Some(String::from(binding_lib_name.as_ref())),
- ));
- self
- }
-
- #[allow(unused)]
- pub(crate) fn with_cargo(mut self, lib: Cargo) -> Builder {
- debug_assert!(self.lib.is_none());
- debug_assert!(self.lib_cargo.is_none());
- self.lib_cargo = Some(lib);
- self
- }
-
- #[allow(unused)]
- pub fn with_lockfile<P: AsRef<path::Path>>(mut self, lockfile: P) -> Builder {
- debug_assert!(self.lockfile.is_none());
- debug_assert!(self.lib_cargo.is_none());
- self.lockfile = Some(path::PathBuf::from(lockfile.as_ref()));
- self
- }
-
- pub fn generate(self) -> Result<Bindings, Error> {
- // If macro expansion is enabled, then cbindgen will attempt to build the crate
- // and will run its build script which may run cbindgen again. That second run may start
- // infinite recursion, or overwrite previously written files with bindings.
- // So if we are called recursively, we are skipping the whole generation
- // and produce "noop" bindings that won't be able to overwrite anything.
- if std::env::var("_CBINDGEN_IS_RUNNING").is_ok() {
- return Ok(Bindings::new(
- self.config,
- Default::default(),
- Default::default(),
- Default::default(),
- Default::default(),
- Default::default(),
- Default::default(),
- true,
- ));
- }
-
- let mut result = Parse::new();
-
- if self.std_types {
- result.add_std_types();
- }
-
- for x in &self.srcs {
- result.extend_with(&parser::parse_src(x, &self.config)?);
- }
-
- if let Some((lib_dir, binding_lib_name)) = self.lib.clone() {
- let lockfile = self.lockfile.as_ref().and_then(|p| p.to_str());
-
- let cargo = Cargo::load(
- &lib_dir,
- lockfile,
- binding_lib_name.as_deref(),
- self.config.parse.parse_deps,
- self.config.parse.clean,
- self.config.only_target_dependencies,
- /* existing_metadata = */ None,
- )?;
-
- result.extend_with(&parser::parse_lib(cargo, &self.config)?);
- } else if let Some(cargo) = self.lib_cargo.clone() {
- result.extend_with(&parser::parse_lib(cargo, &self.config)?);
- }
-
- Library::new(
- self.config,
- result.constants,
- result.globals,
- result.enums,
- result.structs,
- result.unions,
- result.opaque_items,
- result.typedefs,
- result.functions,
- )
- .generate()
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn with_style() {
- assert_eq!(
- Style::Tag,
- Builder::new().with_style(Style::Tag).config.style
- );
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/cargo/cargo.rs b/cbindgen-0.24.5/src/bindgen/cargo/cargo.rs
deleted file mode 100644
index 69cf938..0000000
--- a/cbindgen-0.24.5/src/bindgen/cargo/cargo.rs
+++ /dev/null
@@ -1,252 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::path::{Path, PathBuf};
-
-use crate::bindgen::cargo::cargo_expand;
-use crate::bindgen::cargo::cargo_lock::{self, Lock};
-pub(crate) use crate::bindgen::cargo::cargo_metadata::PackageRef;
-use crate::bindgen::cargo::cargo_metadata::{self, Metadata};
-use crate::bindgen::cargo::cargo_toml;
-use crate::bindgen::config::Profile;
-use crate::bindgen::error::Error;
-use crate::bindgen::ir::Cfg;
-
-/// Parse a dependency string used in Cargo.lock
-fn parse_dep_string(dep_string: &str) -> (&str, Option<&str>) {
- let split: Vec<&str> = dep_string.split_whitespace().collect();
-
- (split[0], split.get(1).cloned())
-}
-
-/// A collection of metadata for a library from cargo.
-#[derive(Clone, Debug)]
-pub(crate) struct Cargo {
- manifest_path: PathBuf,
- binding_crate_name: String,
- lock: Option<Lock>,
- metadata: Metadata,
- clean: bool,
-}
-
-impl Cargo {
- /// Gather metadata from cargo for a specific library and binding crate
- /// name. If dependency finding isn't needed then Cargo.lock files don't
- /// need to be parsed.
- pub(crate) fn load(
- crate_dir: &Path,
- lock_file: Option<&str>,
- binding_crate_name: Option<&str>,
- use_cargo_lock: bool,
- clean: bool,
- only_target_dependencies: bool,
- existing_metadata_file: Option<&Path>,
- ) -> Result<Cargo, Error> {
- let toml_path = crate_dir.join("Cargo.toml");
- let metadata =
- cargo_metadata::metadata(&toml_path, existing_metadata_file, only_target_dependencies)
- .map_err(|x| Error::CargoMetadata(toml_path.to_str().unwrap().to_owned(), x))?;
- let lock_path = lock_file
- .map(PathBuf::from)
- .unwrap_or_else(|| Path::new(&metadata.workspace_root).join("Cargo.lock"));
-
- let lock = if use_cargo_lock {
- match cargo_lock::lock(&lock_path) {
- Ok(lock) => Some(lock),
- Err(x) => {
- warn!("Couldn't load lock file {:?}: {:?}", lock_path, x);
- None
- }
- }
- } else {
- None
- };
-
- // Use the specified binding crate name or infer it from the manifest
- let binding_crate_name = match binding_crate_name {
- Some(s) => s.to_owned(),
- None => {
- let manifest = cargo_toml::manifest(&toml_path)
- .map_err(|x| Error::CargoToml(toml_path.to_str().unwrap().to_owned(), x))?;
- manifest.package.name
- }
- };
-
- Ok(Cargo {
- manifest_path: toml_path,
- binding_crate_name,
- lock,
- metadata,
- clean,
- })
- }
-
- pub(crate) fn binding_crate_name(&self) -> &str {
- &self.binding_crate_name
- }
-
- pub(crate) fn binding_crate_ref(&self) -> PackageRef {
- match self.find_pkg_ref(&self.binding_crate_name) {
- Some(pkg_ref) => pkg_ref,
- None => panic!(
- "Unable to find {} for {:?}",
- self.binding_crate_name, self.manifest_path
- ),
- }
- }
-
- pub(crate) fn dependencies(&self, package: &PackageRef) -> Vec<(PackageRef, Option<Cfg>)> {
- let lock = match self.lock {
- Some(ref lock) => lock,
- None => return vec![],
- };
-
- let mut dependencies = None;
-
- // Find the dependencies listing in the lockfile
- if let Some(ref root) = lock.root {
- // If the version is not on the lockfile then it shouldn't be
- // ambiguous.
- if root.name == package.name
- && package
- .version
- .as_ref()
- .map_or(true, |v| *v == root.version)
- {
- dependencies = root.dependencies.as_ref();
- }
- }
- if dependencies.is_none() {
- if let Some(ref lock_packages) = lock.package {
- for lock_package in lock_packages {
- if lock_package.name == package.name
- && package
- .version
- .as_ref()
- .map_or(true, |v| *v == lock_package.version)
- {
- dependencies = lock_package.dependencies.as_ref();
- break;
- }
- }
- }
- }
- if dependencies.is_none() {
- return vec![];
- }
-
- dependencies
- .unwrap()
- .iter()
- .map(|dep| {
- let (dep_name, dep_version) = parse_dep_string(dep);
-
- // If a version was not specified find the only package with the name of the dependency
- let dep_version = dep_version.or_else(|| {
- let mut versions = self.metadata.packages.iter().filter_map(|package| {
- if package.name_and_version.name != dep_name {
- return None;
- }
- package.name_and_version.version.as_deref()
- });
-
- // If the iterator contains more items, meaning multiple versions of the same
- // package are present, warn! amd abort.
- let version = versions.next();
- if versions.next().is_none() {
- version
- } else {
- warn!("when looking for a version for package {}, multiple versions where found", dep_name);
- None
- }
- });
-
- // Try to find the cfgs in the Cargo.toml
- let cfg = self
- .metadata
- .packages
- .get(package)
- .and_then(|meta_package| meta_package.dependencies.get(dep_name))
- .and_then(Cfg::load_metadata);
-
- let package_ref = PackageRef {
- name: dep_name.to_owned(),
- version: dep_version.map(|v| v.to_owned()),
- };
-
- (package_ref, cfg)
- })
- .collect()
- }
-
- /// Finds the package reference in `cargo metadata` that has `package_name`
- /// ignoring the version.
- fn find_pkg_ref(&self, package_name: &str) -> Option<PackageRef> {
- for package in &self.metadata.packages {
- if package.name_and_version.name == package_name {
- return Some(package.name_and_version.clone());
- }
- }
- None
- }
-
- /// Finds the directory for a specified package reference.
- #[allow(unused)]
- pub(crate) fn find_crate_dir(&self, package: &PackageRef) -> Option<PathBuf> {
- self.metadata
- .packages
- .get(package)
- .and_then(|meta_package| {
- Path::new(&meta_package.manifest_path)
- .parent()
- .map(|x| x.to_owned())
- })
- }
-
- /// Finds `src/lib.rs` for a specified package reference.
- pub(crate) fn find_crate_src(&self, package: &PackageRef) -> Option<PathBuf> {
- let kind_lib = String::from("lib");
- let kind_staticlib = String::from("staticlib");
- let kind_rlib = String::from("rlib");
- let kind_cdylib = String::from("cdylib");
- let kind_dylib = String::from("dylib");
-
- self.metadata
- .packages
- .get(package)
- .and_then(|meta_package| {
- for target in &meta_package.targets {
- if target.kind.contains(&kind_lib)
- || target.kind.contains(&kind_staticlib)
- || target.kind.contains(&kind_rlib)
- || target.kind.contains(&kind_cdylib)
- || target.kind.contains(&kind_dylib)
- {
- return Some(PathBuf::from(&target.src_path));
- }
- }
- None
- })
- }
-
- pub(crate) fn expand_crate(
- &self,
- package: &PackageRef,
- expand_all_features: bool,
- expand_default_features: bool,
- expand_features: &Option<Vec<String>>,
- profile: Profile,
- ) -> Result<String, cargo_expand::Error> {
- cargo_expand::expand(
- &self.manifest_path,
- &package.name,
- package.version.as_deref(),
- self.clean,
- expand_all_features,
- expand_default_features,
- expand_features,
- profile,
- )
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/cargo/cargo_lock.rs b/cbindgen-0.24.5/src/bindgen/cargo/cargo_lock.rs
deleted file mode 100644
index 9302082..0000000
--- a/cbindgen-0.24.5/src/bindgen/cargo/cargo_lock.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::fs::File;
-use std::io;
-use std::io::Read;
-use std::path::Path;
-
-#[derive(Debug)]
-/// Possible errors that can occur during Cargo.toml parsing.
-pub enum Error {
- /// Error during reading of Cargo.toml
- Io(io::Error),
- /// Deserialization error
- Toml(toml::de::Error),
-}
-
-impl From<io::Error> for Error {
- fn from(err: io::Error) -> Self {
- Error::Io(err)
- }
-}
-impl From<toml::de::Error> for Error {
- fn from(err: toml::de::Error) -> Self {
- Error::Toml(err)
- }
-}
-
-#[derive(Clone, Deserialize, Debug)]
-pub struct Lock {
- pub root: Option<Package>,
- pub package: Option<Vec<Package>>,
-}
-
-#[derive(Clone, Deserialize, Debug)]
-pub struct Package {
- pub name: String,
- pub version: String,
- /// A list of dependencies formatted like "NAME VERSION-OPT REGISTRY-OPT"
- pub dependencies: Option<Vec<String>>,
-}
-
-/// Parse the Cargo.toml for a given path
-pub fn lock(manifest_path: &Path) -> Result<Lock, Error> {
- let mut s = String::new();
- let mut f = File::open(manifest_path)?;
- f.read_to_string(&mut s)?;
-
- toml::from_str::<Lock>(&s).map_err(|x| x.into())
-}
diff --git a/cbindgen-0.24.5/src/bindgen/cdecl.rs b/cbindgen-0.24.5/src/bindgen/cdecl.rs
deleted file mode 100644
index d331d65..0000000
--- a/cbindgen-0.24.5/src/bindgen/cdecl.rs
+++ /dev/null
@@ -1,369 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::io::Write;
-
-use crate::bindgen::config::Layout;
-use crate::bindgen::declarationtyperesolver::DeclarationType;
-use crate::bindgen::ir::{ConstExpr, Function, GenericArgument, Type};
-use crate::bindgen::writer::{ListType, SourceWriter};
-use crate::bindgen::{Config, Language};
-
-// This code is for translating Rust types into C declarations.
-// See Section 6.7, Declarations, in the C standard for background.
-// http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
-
-enum CDeclarator {
- Ptr {
- is_const: bool,
- is_nullable: bool,
- is_ref: bool,
- },
- Array(String),
- Func {
- args: Vec<(Option<String>, CDecl)>,
- layout: Layout,
- never_return: bool,
- },
-}
-
-impl CDeclarator {
- fn is_ptr(&self) -> bool {
- matches!(self, CDeclarator::Ptr { .. } | CDeclarator::Func { .. })
- }
-}
-
-struct CDecl {
- type_qualifers: String,
- type_name: String,
- type_generic_args: Vec<GenericArgument>,
- declarators: Vec<CDeclarator>,
- type_ctype: Option<DeclarationType>,
-}
-
-impl CDecl {
- fn new() -> CDecl {
- CDecl {
- type_qualifers: String::new(),
- type_name: String::new(),
- type_generic_args: Vec::new(),
- declarators: Vec::new(),
- type_ctype: None,
- }
- }
-
- fn from_type(t: &Type, config: &Config) -> CDecl {
- let mut cdecl = CDecl::new();
- cdecl.build_type(t, false, config);
- cdecl
- }
-
- fn from_func_arg(t: &Type, array_length: Option<&str>, config: &Config) -> CDecl {
- let mut cdecl = CDecl::new();
- let length = match array_length {
- Some(l) => l,
- None => return CDecl::from_type(t, config),
- };
- let (ty, is_const) = match t {
- Type::Ptr { ty, is_const, .. } => (ty, is_const),
- _ => unreachable!(
- "Should never have an array length for a non pointer type {:?}",
- t
- ),
- };
- let ptr_as_array = Type::Array(ty.clone(), ConstExpr::Value(length.to_string()));
- cdecl.build_type(&ptr_as_array, *is_const, config);
- cdecl
- }
-
- fn from_func(f: &Function, layout: Layout, config: &Config) -> CDecl {
- let mut cdecl = CDecl::new();
- cdecl.build_func(f, layout, config);
- cdecl
- }
-
- fn build_func(&mut self, f: &Function, layout: Layout, config: &Config) {
- let args = f
- .args
- .iter()
- .map(|arg| {
- (
- arg.name.clone(),
- CDecl::from_func_arg(&arg.ty, arg.array_length.as_deref(), config),
- )
- })
- .collect();
- self.declarators.push(CDeclarator::Func {
- args,
- layout,
- never_return: f.never_return,
- });
- self.build_type(&f.ret, false, config);
- }
-
- fn build_type(&mut self, t: &Type, is_const: bool, config: &Config) {
- match t {
- Type::Path(ref generic) => {
- if is_const {
- assert!(
- self.type_qualifers.is_empty(),
- "error generating cdecl for {:?}",
- t
- );
- self.type_qualifers = "const".to_owned();
- }
-
- assert!(
- self.type_name.is_empty(),
- "error generating cdecl for {:?}",
- t
- );
- self.type_name = generic.export_name().to_owned();
- assert!(
- self.type_generic_args.is_empty(),
- "error generating cdecl for {:?}",
- t
- );
- self.type_generic_args = generic.generics().to_owned();
- self.type_ctype = generic.ctype().cloned();
- }
- Type::Primitive(ref p) => {
- if is_const {
- assert!(
- self.type_qualifers.is_empty(),
- "error generating cdecl for {:?}",
- t
- );
- self.type_qualifers = "const".to_owned();
- }
-
- assert!(
- self.type_name.is_empty(),
- "error generating cdecl for {:?}",
- t
- );
- self.type_name = p.to_repr_c(config).to_string();
- }
- Type::Ptr {
- ref ty,
- is_nullable,
- is_const: ptr_is_const,
- is_ref,
- } => {
- self.declarators.push(CDeclarator::Ptr {
- is_const,
- is_nullable: *is_nullable,
- is_ref: *is_ref,
- });
- self.build_type(ty, *ptr_is_const, config);
- }
- Type::Array(ref t, ref constant) => {
- let len = constant.as_str().to_owned();
- self.declarators.push(CDeclarator::Array(len));
- self.build_type(t, is_const, config);
- }
- Type::FuncPtr {
- ref ret,
- ref args,
- is_nullable: _,
- never_return,
- } => {
- let args = args
- .iter()
- .map(|(ref name, ref ty)| (name.clone(), CDecl::from_type(ty, config)))
- .collect();
- self.declarators.push(CDeclarator::Ptr {
- is_const: false,
- is_nullable: true,
- is_ref: false,
- });
- self.declarators.push(CDeclarator::Func {
- args,
- layout: config.function.args.clone(),
- never_return: *never_return,
- });
- self.build_type(ret, false, config);
- }
- }
- }
-
- fn write<F: Write>(&self, out: &mut SourceWriter<F>, ident: Option<&str>, config: &Config) {
- // Write the type-specifier and type-qualifier first
- if !self.type_qualifers.is_empty() {
- write!(out, "{} ", self.type_qualifers);
- }
-
- if config.language != Language::Cython {
- if let Some(ref ctype) = self.type_ctype {
- write!(out, "{} ", ctype.to_str());
- }
- }
-
- write!(out, "{}", self.type_name);
-
- if !self.type_generic_args.is_empty() {
- out.write("<");
- out.write_horizontal_source_list(&self.type_generic_args, ListType::Join(", "));
- out.write(">");
- }
-
- // When we have an identifier, put a space between the type and the declarators
- if ident.is_some() {
- out.write(" ");
- }
-
- // Write the left part of declarators before the identifier
- let mut iter_rev = self.declarators.iter().rev().peekable();
-
- #[allow(clippy::while_let_on_iterator)]
- while let Some(declarator) = iter_rev.next() {
- let next_is_pointer = iter_rev.peek().map_or(false, |x| x.is_ptr());
-
- match *declarator {
- CDeclarator::Ptr {
- is_const,
- is_nullable,
- is_ref,
- } => {
- out.write(if is_ref { "&" } else { "*" });
- if is_const {
- out.write("const ");
- }
- if !is_nullable && !is_ref && config.language != Language::Cython {
- if let Some(attr) = &config.pointer.non_null_attribute {
- write!(out, "{} ", attr);
- }
- }
- }
- CDeclarator::Array(..) => {
- if next_is_pointer {
- out.write("(");
- }
- }
- CDeclarator::Func { .. } => {
- if next_is_pointer {
- out.write("(");
- }
- }
- }
- }
-
- // Write the identifier
- if let Some(ident) = ident {
- write!(out, "{}", ident);
- }
-
- // Write the right part of declarators after the identifier
- let mut iter = self.declarators.iter();
- let mut last_was_pointer = false;
-
- #[allow(clippy::while_let_on_iterator)]
- while let Some(declarator) = iter.next() {
- match *declarator {
- CDeclarator::Ptr { .. } => {
- last_was_pointer = true;
- }
- CDeclarator::Array(ref constant) => {
- if last_was_pointer {
- out.write(")");
- }
- write!(out, "[{}]", constant);
-
- last_was_pointer = false;
- }
- CDeclarator::Func {
- ref args,
- ref layout,
- never_return,
- } => {
- if last_was_pointer {
- out.write(")");
- }
-
- out.write("(");
- if args.is_empty() && config.language == Language::C {
- out.write("void");
- }
-
- fn write_vertical<F: Write>(
- out: &mut SourceWriter<F>,
- config: &Config,
- args: &[(Option<String>, CDecl)],
- ) {
- let align_length = out.line_length_for_align();
- out.push_set_spaces(align_length);
- for (i, (arg_ident, arg_ty)) in args.iter().enumerate() {
- if i != 0 {
- out.write(",");
- out.new_line();
- }
-
- // Convert &Option<String> to Option<&str>
- let arg_ident = arg_ident.as_ref().map(|x| x.as_ref());
-
- arg_ty.write(out, arg_ident, config);
- }
- out.pop_tab();
- }
-
- fn write_horizontal<F: Write>(
- out: &mut SourceWriter<F>,
- config: &Config,
- args: &[(Option<String>, CDecl)],
- ) {
- for (i, (arg_ident, arg_ty)) in args.iter().enumerate() {
- if i != 0 {
- out.write(", ");
- }
-
- // Convert &Option<String> to Option<&str>
- let arg_ident = arg_ident.as_ref().map(|x| x.as_ref());
-
- arg_ty.write(out, arg_ident, config);
- }
- }
-
- match layout {
- Layout::Vertical => write_vertical(out, config, args),
- Layout::Horizontal => write_horizontal(out, config, args),
- Layout::Auto => {
- if !out.try_write(
- |out| write_horizontal(out, config, args),
- config.line_length,
- ) {
- write_vertical(out, config, args)
- }
- }
- }
- out.write(")");
-
- if never_return && config.language != Language::Cython {
- if let Some(ref no_return_attr) = config.function.no_return {
- out.write_fmt(format_args!(" {}", no_return_attr));
- }
- }
-
- last_was_pointer = true;
- }
- }
- }
- }
-}
-
-pub fn write_func<F: Write>(
- out: &mut SourceWriter<F>,
- f: &Function,
- layout: Layout,
- config: &Config,
-) {
- CDecl::from_func(f, layout, config).write(out, Some(f.path().name()), config);
-}
-
-pub fn write_field<F: Write>(out: &mut SourceWriter<F>, t: &Type, ident: &str, config: &Config) {
- CDecl::from_type(t, config).write(out, Some(ident), config);
-}
-
-pub fn write_type<F: Write>(out: &mut SourceWriter<F>, t: &Type, config: &Config) {
- CDecl::from_type(t, config).write(out, None, config);
-}
diff --git a/cbindgen-0.24.5/src/bindgen/config.rs b/cbindgen-0.24.5/src/bindgen/config.rs
deleted file mode 100644
index fbf35cb..0000000
--- a/cbindgen-0.24.5/src/bindgen/config.rs
+++ /dev/null
@@ -1,1104 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::collections::{BTreeMap, HashMap};
-use std::default::Default;
-use std::str::FromStr;
-use std::{fmt, fs, path::Path as StdPath};
-
-use serde::de::value::{MapAccessDeserializer, SeqAccessDeserializer};
-use serde::de::{Deserialize, Deserializer, MapAccess, SeqAccess, Visitor};
-
-use crate::bindgen::ir::annotation::AnnotationSet;
-use crate::bindgen::ir::path::Path;
-use crate::bindgen::ir::repr::ReprAlign;
-pub use crate::bindgen::rename::RenameRule;
-
-pub const VERSION: &str = env!("CARGO_PKG_VERSION");
-
-/// A language type to generate bindings for.
-#[derive(Debug, Copy, Clone, PartialEq, Eq)]
-pub enum Language {
- Cxx,
- C,
- Cython,
-}
-
-impl FromStr for Language {
- type Err = String;
-
- fn from_str(s: &str) -> Result<Language, Self::Err> {
- match s {
- "cxx" => Ok(Language::Cxx),
- "Cxx" => Ok(Language::Cxx),
- "CXX" => Ok(Language::Cxx),
- "cpp" => Ok(Language::Cxx),
- "Cpp" => Ok(Language::Cxx),
- "CPP" => Ok(Language::Cxx),
- "c++" => Ok(Language::Cxx),
- "C++" => Ok(Language::Cxx),
- "c" => Ok(Language::C),
- "C" => Ok(Language::C),
- "cython" => Ok(Language::Cython),
- "Cython" => Ok(Language::Cython),
- _ => Err(format!("Unrecognized Language: '{}'.", s)),
- }
- }
-}
-
-deserialize_enum_str!(Language);
-
-impl Language {
- pub(crate) fn typedef(self) -> &'static str {
- match self {
- Language::Cxx | Language::C => "typedef",
- Language::Cython => "ctypedef",
- }
- }
-}
-
-/// Controls what type of line endings are used in the generated code.
-#[derive(Debug, Clone, Copy)]
-#[allow(clippy::upper_case_acronyms)]
-pub enum LineEndingStyle {
- /// Use Unix-style linefeed characters
- LF,
- /// Use classic Mac-style carriage-return characters
- CR,
- /// Use Windows-style carriage-return and linefeed characters
- CRLF,
- /// Use the native mode for the platform: CRLF on Windows, LF everywhere else.
- Native,
-}
-
-impl Default for LineEndingStyle {
- fn default() -> Self {
- LineEndingStyle::LF
- }
-}
-
-impl LineEndingStyle {
- pub fn as_str(&self) -> &'static str {
- match self {
- Self::LF => "\n",
- Self::CR => "\r",
- Self::CRLF => "\r\n",
- Self::Native => {
- #[cfg(target_os = "windows")]
- {
- Self::CRLF.as_str()
- }
- #[cfg(not(target_os = "windows"))]
- {
- Self::LF.as_str()
- }
- }
- }
- }
-}
-
-impl FromStr for LineEndingStyle {
- type Err = String;
-
- fn from_str(s: &str) -> Result<Self, Self::Err> {
- match s.to_lowercase().as_ref() {
- "native" => Ok(Self::Native),
- "lf" => Ok(Self::LF),
- "crlf" => Ok(Self::CRLF),
- "cr" => Ok(Self::CR),
- _ => Err(format!("Unrecognized line ending style: '{}'.", s)),
- }
- }
-}
-
-deserialize_enum_str!(LineEndingStyle);
-
-/// A style of braces to use for generating code.
-#[derive(Debug, Clone, PartialEq, Eq)]
-pub enum Braces {
- SameLine,
- NextLine,
-}
-
-impl FromStr for Braces {
- type Err = String;
-
- fn from_str(s: &str) -> Result<Braces, Self::Err> {
- match s {
- "SameLine" => Ok(Braces::SameLine),
- "same_line" => Ok(Braces::SameLine),
- "NextLine" => Ok(Braces::NextLine),
- "next_line" => Ok(Braces::NextLine),
- _ => Err(format!("Unrecognized Braces: '{}'.", s)),
- }
- }
-}
-
-deserialize_enum_str!(Braces);
-
-/// A type of layout to use when generating long lines of code.
-#[derive(Debug, Clone, PartialEq, Eq)]
-pub enum Layout {
- Horizontal,
- Vertical,
- Auto,
-}
-
-impl FromStr for Layout {
- type Err = String;
-
- fn from_str(s: &str) -> Result<Layout, Self::Err> {
- match s {
- "Horizontal" => Ok(Layout::Horizontal),
- "horizontal" => Ok(Layout::Horizontal),
- "Vertical" => Ok(Layout::Vertical),
- "vertical" => Ok(Layout::Vertical),
- "Auto" => Ok(Layout::Auto),
- "auto" => Ok(Layout::Auto),
- _ => Err(format!("Unrecognized Layout: '{}'.", s)),
- }
- }
-}
-
-deserialize_enum_str!(Layout);
-
-/// How the comments containing documentation should be styled.
-#[derive(Debug, Clone, PartialEq, Eq, Copy)]
-pub enum DocumentationStyle {
- C,
- C99,
- Doxy,
- Cxx,
- Auto,
-}
-
-impl FromStr for DocumentationStyle {
- type Err = String;
-
- fn from_str(s: &str) -> Result<DocumentationStyle, Self::Err> {
- match s.to_lowercase().as_ref() {
- "c" => Ok(DocumentationStyle::C),
- "c99" => Ok(DocumentationStyle::C99),
- "cxx" => Ok(DocumentationStyle::Cxx),
- "c++" => Ok(DocumentationStyle::Cxx),
- "doxy" => Ok(DocumentationStyle::Doxy),
- "auto" => Ok(DocumentationStyle::Auto),
- _ => Err(format!("Unrecognized documentation style: '{}'.", s)),
- }
- }
-}
-
-deserialize_enum_str!(DocumentationStyle);
-
-/// How much of the documentation to include in the header file.
-#[derive(Debug, Clone, Copy)]
-pub enum DocumentationLength {
- Short,
- Full,
-}
-
-impl FromStr for DocumentationLength {
- type Err = String;
-
- fn from_str(s: &str) -> Result<DocumentationLength, Self::Err> {
- match s.to_lowercase().as_ref() {
- "short" => Ok(DocumentationLength::Short),
- "full" => Ok(DocumentationLength::Full),
- _ => Err(format!("Unrecognized documentation style: '{}'.", s)),
- }
- }
-}
-
-deserialize_enum_str!(DocumentationLength);
-
-/// A style of Style to use when generating structs and enums.
-#[derive(Debug, Copy, Clone, PartialEq, Eq)]
-pub enum Style {
- Both,
- Tag,
- Type,
-}
-
-impl Style {
- pub fn generate_tag(self) -> bool {
- match self {
- Style::Both | Style::Tag => true,
- Style::Type => false,
- }
- }
-
- pub fn generate_typedef(self) -> bool {
- match self {
- Style::Both | Style::Type => true,
- Style::Tag => false,
- }
- }
-
- // https://cython.readthedocs.io/en/latest/src/userguide/external_C_code.html#styles-of-struct-union-and-enum-declaration
- pub fn cython_def(self) -> &'static str {
- if self.generate_tag() {
- "cdef "
- } else {
- "ctypedef "
- }
- }
-}
-
-impl Default for Style {
- fn default() -> Self {
- Style::Both
- }
-}
-
-impl FromStr for Style {
- type Err = String;
-
- fn from_str(s: &str) -> Result<Style, Self::Err> {
- match s {
- "Both" => Ok(Style::Both),
- "both" => Ok(Style::Both),
- "Tag" => Ok(Style::Tag),
- "tag" => Ok(Style::Tag),
- "Type" => Ok(Style::Type),
- "type" => Ok(Style::Type),
- _ => Err(format!("Unrecognized Style: '{}'.", s)),
- }
- }
-}
-
-deserialize_enum_str!(Style);
-
-/// Different item types that we can generate and filter.
-#[derive(Debug, Clone, PartialEq, Eq)]
-pub enum ItemType {
- Constants,
- Globals,
- Enums,
- Structs,
- Unions,
- Typedefs,
- OpaqueItems,
- Functions,
-}
-
-impl FromStr for ItemType {
- type Err = String;
-
- fn from_str(s: &str) -> Result<Self, Self::Err> {
- use self::ItemType::*;
- Ok(match &*s.to_lowercase() {
- "constants" => Constants,
- "globals" => Globals,
- "enums" => Enums,
- "structs" => Structs,
- "unions" => Unions,
- "typedefs" => Typedefs,
- "opaque" => OpaqueItems,
- "functions" => Functions,
- _ => return Err(format!("Unrecognized Style: '{}'.", s)),
- })
- }
-}
-
-deserialize_enum_str!(ItemType);
-
-/// Type which specifies the sort order of functions
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-pub enum SortKey {
- Name,
- None,
-}
-
-impl FromStr for SortKey {
- type Err = String;
-
- fn from_str(s: &str) -> Result<Self, Self::Err> {
- use self::SortKey::*;
- Ok(match &*s.to_lowercase() {
- "name" => Name,
- "none" => None,
- _ => return Err(format!("Unrecognized sort option: '{}'.", s)),
- })
- }
-}
-
-deserialize_enum_str!(SortKey);
-
-/// Settings to apply when exporting items.
-#[derive(Debug, Clone, Deserialize, Default)]
-#[serde(rename_all = "snake_case")]
-#[serde(deny_unknown_fields)]
-#[serde(default)]
-pub struct ExportConfig {
- /// A list of additional items not used by exported functions to include in
- /// the generated bindings
- pub include: Vec<String>,
- /// A list of items to not include in the generated bindings
- pub exclude: Vec<String>,
- /// Table of name conversions to apply to item names
- pub rename: HashMap<String, String>,
- /// Table of raw strings to prepend to the body of items.
- pub pre_body: HashMap<String, String>,
- /// Table of raw strings to append to the body of items.
- pub body: HashMap<String, String>,
- /// A prefix to add before the name of every item
- pub prefix: Option<String>,
- /// Types of items to generate.
- pub item_types: Vec<ItemType>,
- /// Whether renaming overrides or extends prefixing.
- pub renaming_overrides_prefixing: bool,
- /// Mangling configuration.
- pub mangle: MangleConfig,
-}
-
-/// Mangling-specific configuration.
-#[derive(Debug, Clone, Deserialize, Default)]
-#[serde(rename_all = "snake_case")]
-#[serde(deny_unknown_fields)]
-#[serde(default)]
-pub struct MangleConfig {
- /// The rename rule to apply to the type names mangled.
- pub rename_types: RenameRule,
- /// Remove the underscores used for name mangling.
- pub remove_underscores: bool,
-}
-
-impl ExportConfig {
- pub(crate) fn should_generate(&self, item_type: ItemType) -> bool {
- self.item_types.is_empty() || self.item_types.contains(&item_type)
- }
-
- pub(crate) fn pre_body(&self, path: &Path) -> Option<&str> {
- self.pre_body.get(path.name()).map(|s| s.trim_matches('\n'))
- }
-
- pub(crate) fn post_body(&self, path: &Path) -> Option<&str> {
- self.body.get(path.name()).map(|s| s.trim_matches('\n'))
- }
-
- pub(crate) fn rename(&self, item_name: &mut String) {
- if let Some(name) = self.rename.get(item_name) {
- *item_name = name.clone();
- if self.renaming_overrides_prefixing {
- return;
- }
- }
- if let Some(ref prefix) = self.prefix {
- item_name.insert_str(0, prefix);
- }
- }
-}
-
-/// Settings to apply to generated types with layout modifiers.
-#[derive(Debug, Default, Clone, Deserialize)]
-#[serde(rename_all = "snake_case")]
-#[serde(deny_unknown_fields)]
-#[serde(default)]
-pub struct LayoutConfig {
- /// The way to annotate C types as #[repr(packed)].
- pub packed: Option<String>,
- /// The way to annotate C types as #[repr(align(...))]. This is assumed to be a functional
- /// macro which takes a single argument (the alignment).
- pub aligned_n: Option<String>,
-}
-
-impl LayoutConfig {
- pub(crate) fn ensure_safe_to_represent(&self, align: &ReprAlign) -> Result<(), String> {
- match (align, &self.packed, &self.aligned_n) {
- (ReprAlign::Packed, None, _) => Err("Cannot safely represent #[repr(packed)] type without configured 'packed' annotation.".to_string()),
- (ReprAlign::Align(_), _, None) => Err("Cannot safely represent #[repr(aligned(...))] type without configured 'aligned_n' annotation.".to_string()),
- _ => Ok(()),
- }
- }
-}
-
-/// Settings to apply to generated functions.
-#[derive(Debug, Clone, Deserialize)]
-#[serde(rename_all = "snake_case")]
-#[serde(deny_unknown_fields)]
-#[serde(default)]
-pub struct FunctionConfig {
- /// Optional text to output before each function declaration
- pub prefix: Option<String>,
- /// Optional text to output after each function declaration
- pub postfix: Option<String>,
- /// The way to annotation this function as #[must_use]
- pub must_use: Option<String>,
- /// The style to layout the args
- pub args: Layout,
- /// The rename rule to apply to function args
- pub rename_args: RenameRule,
- /// An optional macro to use when generating Swift function name attributes
- pub swift_name_macro: Option<String>,
- /// Sort key for functions
- pub sort_by: Option<SortKey>,
- /// Optional text to output after functions which return `!`.
- pub no_return: Option<String>,
-}
-
-impl Default for FunctionConfig {
- fn default() -> FunctionConfig {
- FunctionConfig {
- prefix: None,
- postfix: None,
- must_use: None,
- args: Layout::Auto,
- rename_args: RenameRule::None,
- swift_name_macro: None,
- sort_by: None,
- no_return: None,
- }
- }
-}
-
-impl FunctionConfig {
- pub(crate) fn prefix(&self, annotations: &AnnotationSet) -> Option<String> {
- if let Some(x) = annotations.atom("prefix") {
- return x;
- }
- self.prefix.clone()
- }
-
- pub(crate) fn postfix(&self, annotations: &AnnotationSet) -> Option<String> {
- if let Some(x) = annotations.atom("postfix") {
- return x;
- }
- self.postfix.clone()
- }
-}
-
-/// Settings to apply to generated structs.
-#[derive(Debug, Default, Clone, Deserialize)]
-#[serde(rename_all = "snake_case")]
-#[serde(deny_unknown_fields)]
-#[serde(default)]
-pub struct StructConfig {
- /// The rename rule to apply to the name of struct fields
- pub rename_fields: RenameRule,
- /// Whether to generate a constructor for the struct (which takes
- /// arguments to initialize all the members)
- pub derive_constructor: bool,
- /// Whether to generate a piecewise equality operator
- pub derive_eq: bool,
- /// Whether to generate a piecewise inequality operator
- pub derive_neq: bool,
- /// Whether to generate a less than operator on structs with one field
- pub derive_lt: bool,
- /// Whether to generate a less than or equal to operator on structs with one field
- pub derive_lte: bool,
- /// Whether to generate a greater than operator on structs with one field
- pub derive_gt: bool,
- /// Whether to generate a greater than or equal to operator on structs with one field
- pub derive_gte: bool,
- /// Whether to generate a ostream serializer for the struct
- pub derive_ostream: bool,
- /// Whether associated constants should be in the body. Only applicable to
- /// non-transparent structs, and in C++-only.
- pub associated_constants_in_body: bool,
- /// The way to annotate this struct as #[must_use].
- pub must_use: Option<String>,
-}
-
-impl StructConfig {
- pub(crate) fn derive_constructor(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-constructor") {
- return x;
- }
- self.derive_constructor
- }
- pub(crate) fn derive_eq(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-eq") {
- return x;
- }
- self.derive_eq
- }
- pub(crate) fn derive_neq(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-neq") {
- return x;
- }
- self.derive_neq
- }
- pub(crate) fn derive_lt(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-lt") {
- return x;
- }
- self.derive_lt
- }
- pub(crate) fn derive_lte(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-lte") {
- return x;
- }
- self.derive_lte
- }
- pub(crate) fn derive_gt(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-gt") {
- return x;
- }
- self.derive_gt
- }
- pub(crate) fn derive_gte(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-gte") {
- return x;
- }
- self.derive_gte
- }
- pub(crate) fn derive_ostream(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-ostream") {
- return x;
- }
- self.derive_ostream
- }
-}
-
-/// Settings to apply to generated enums.
-#[derive(Debug, Clone, Deserialize)]
-#[serde(rename_all = "snake_case")]
-#[serde(deny_unknown_fields)]
-#[serde(default)]
-pub struct EnumConfig {
- /// The rename rule to apply to the name of enum variants
- pub rename_variants: RenameRule,
- /// The rename rule to apply to the names of the union fields in C/C++
- /// generated from the Rust enum. Applied before rename_variants
- /// rename rule. Defaults to SnakeCase.
- pub rename_variant_name_fields: RenameRule,
- /// Whether to add a `Sentinel` value at the end of every enum
- /// This is useful in Gecko for IPC serialization
- pub add_sentinel: bool,
- /// Whether the enum variants should be prefixed with the enum name
- pub prefix_with_name: bool,
- /// Whether to generate static `::X(..)` constructors and `IsX()`
- /// methods for tagged enums.
- pub derive_helper_methods: bool,
- /// Whether to generate `AsX() const` methods for tagged enums.
- pub derive_const_casts: bool,
- /// Whether to generate `AsX()` methods for tagged enums.
- pub derive_mut_casts: bool,
- /// The name of the macro to use for `derive_{const,mut}casts`. If custom, you're
- /// responsible to provide the necessary header, otherwise `assert` will be
- /// used, and `<cassert>` will be included.
- pub cast_assert_name: Option<String>,
- /// The way to annotation this enum as #[must_use].
- pub must_use: Option<String>,
- /// Whether to generate destructors of tagged enums.
- pub derive_tagged_enum_destructor: bool,
- /// Whether to generate copy-constructors of tagged enums.
- pub derive_tagged_enum_copy_constructor: bool,
- /// Whether to generate copy-assignment operators of tagged enums.
- ///
- /// This is only generated if a copy constructor for the same tagged enum is
- /// generated as well.
- pub derive_tagged_enum_copy_assignment: bool,
- /// Whether to generate a ostream serializer for the struct
- pub derive_ostream: bool,
- /// Declare the enum as an enum class.
- /// Only relevant when targeting C++.
- pub enum_class: bool,
- /// Whether to generate empty, private default-constructors for tagged
- /// enums.
- pub private_default_tagged_enum_constructor: bool,
-}
-
-impl Default for EnumConfig {
- fn default() -> EnumConfig {
- EnumConfig {
- rename_variants: RenameRule::None,
- rename_variant_name_fields: RenameRule::SnakeCase,
- add_sentinel: false,
- prefix_with_name: false,
- derive_helper_methods: false,
- derive_const_casts: false,
- derive_mut_casts: false,
- cast_assert_name: None,
- must_use: None,
- derive_tagged_enum_destructor: false,
- derive_tagged_enum_copy_constructor: false,
- derive_tagged_enum_copy_assignment: false,
- derive_ostream: false,
- enum_class: true,
- private_default_tagged_enum_constructor: false,
- }
- }
-}
-
-impl EnumConfig {
- pub(crate) fn add_sentinel(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("add-sentinel") {
- return x;
- }
- self.add_sentinel
- }
- pub(crate) fn derive_helper_methods(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-helper-methods") {
- return x;
- }
- self.derive_helper_methods
- }
- pub(crate) fn derive_const_casts(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-const-casts") {
- return x;
- }
- self.derive_const_casts
- }
- pub(crate) fn derive_mut_casts(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-mut-casts") {
- return x;
- }
- self.derive_mut_casts
- }
- pub(crate) fn derive_tagged_enum_destructor(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-tagged-enum-destructor") {
- return x;
- }
- self.derive_tagged_enum_destructor
- }
- pub(crate) fn derive_tagged_enum_copy_constructor(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-tagged-enum-copy-constructor") {
- return x;
- }
- self.derive_tagged_enum_copy_constructor
- }
- pub(crate) fn derive_tagged_enum_copy_assignment(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-tagged-enum-copy-assignment") {
- return x;
- }
- self.derive_tagged_enum_copy_assignment
- }
- pub(crate) fn derive_ostream(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("derive-ostream") {
- return x;
- }
- self.derive_ostream
- }
- pub(crate) fn enum_class(&self, annotations: &AnnotationSet) -> bool {
- if let Some(x) = annotations.bool("enum-class") {
- return x;
- }
- self.enum_class
- }
- pub(crate) fn private_default_tagged_enum_constructor(
- &self,
- annotations: &AnnotationSet,
- ) -> bool {
- if let Some(x) = annotations.bool("private-default-tagged-enum-constructor") {
- return x;
- }
- self.private_default_tagged_enum_constructor
- }
-}
-
-/// Settings to apply to generated constants.
-#[derive(Debug, Clone, Deserialize)]
-#[serde(rename_all = "snake_case")]
-#[serde(deny_unknown_fields)]
-#[serde(default)]
-pub struct ConstantConfig {
- /// Whether a generated constant can be a static const in C++ mode.
- pub allow_static_const: bool,
- /// Whether a generated constant should be constexpr in C++ mode.
- pub allow_constexpr: bool,
- /// Sort key for constants
- pub sort_by: Option<SortKey>,
-}
-
-impl Default for ConstantConfig {
- fn default() -> ConstantConfig {
- ConstantConfig {
- allow_static_const: true,
- allow_constexpr: true,
- sort_by: None,
- }
- }
-}
-
-/// Settings for custom macro expansion.
-#[derive(Debug, Clone, Deserialize, Default)]
-#[serde(rename_all = "snake_case")]
-#[serde(deny_unknown_fields)]
-#[serde(default)]
-pub struct MacroExpansionConfig {
- /// Whether the `bitflags` macro should be expanded.
- pub bitflags: bool,
-}
-
-/// Controls which Cargo profile is used for macro expansion.
-#[derive(Debug, Copy, Clone, PartialEq, Eq)]
-pub enum Profile {
- Debug,
- Release,
-}
-
-impl FromStr for Profile {
- type Err = String;
-
- fn from_str(s: &str) -> Result<Profile, Self::Err> {
- match s {
- "debug" | "Debug" => Ok(Profile::Debug),
- "release" | "Release" => Ok(Profile::Release),
- _ => Err(format!("Unrecognized Profile: '{}'.", s)),
- }
- }
-}
-
-deserialize_enum_str!(Profile);
-
-/// Settings to apply when running `rustc -Zunpretty=expanded`
-#[derive(Debug, Clone, Deserialize)]
-#[serde(rename_all = "snake_case")]
-#[serde(deny_unknown_fields)]
-#[serde(default)]
-pub struct ParseExpandConfig {
- /// The names of crates to parse with `rustc -Zunpretty=expanded`
- pub crates: Vec<String>,
- /// Whether to enable all the features when expanding.
- pub all_features: bool,
- /// Whether to use the default feature set when expanding.
- pub default_features: bool,
- /// List of features to use when expanding. Combines with `default_features` like in
- /// `Cargo.toml`.
- pub features: Option<Vec<String>>,
- /// Controls whether or not to pass `--release` when expanding.
- pub profile: Profile,
-}
-
-impl Default for ParseExpandConfig {
- fn default() -> ParseExpandConfig {
- ParseExpandConfig {
- crates: Vec::new(),
- all_features: false,
- default_features: true,
- features: None,
- profile: Profile::Debug,
- }
- }
-}
-
-// Backwards-compatibility deserializer for ParseExpandConfig. This allows accepting both the
-// simple `expand = ["crate"]` and the more complex `expand = {"crates": ["crate"],
-// "default_features": false}` format for the `expand` key.
-//
-// Note that one (major) difference between the two forms is that, for backwards-compatibility
-// reasons, the `expand = ["crate"]` form will enable the `--all-features` flag by default while
-// the `expand = {"crates": ["crate"]}` form will use the default feature set by default.
-fn retrocomp_parse_expand_config_deserialize<'de, D: Deserializer<'de>>(
- deserializer: D,
-) -> Result<ParseExpandConfig, D::Error> {
- struct ParseExpandVisitor;
-
- impl<'de> Visitor<'de> for ParseExpandVisitor {
- type Value = ParseExpandConfig;
-
- fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
- formatter.write_str("a map or sequence of string")
- }
-
- fn visit_seq<A: SeqAccess<'de>>(self, seq: A) -> Result<Self::Value, A::Error> {
- let crates =
- <Vec<String> as Deserialize>::deserialize(SeqAccessDeserializer::new(seq))?;
- Ok(ParseExpandConfig {
- crates,
- all_features: true,
- default_features: true,
- features: None,
- profile: Profile::Debug,
- })
- }
-
- fn visit_map<A: MapAccess<'de>>(self, map: A) -> Result<Self::Value, A::Error> {
- <ParseExpandConfig as Deserialize>::deserialize(MapAccessDeserializer::new(map))
- }
- }
-
- deserializer.deserialize_any(ParseExpandVisitor)
-}
-
-/// Settings to apply when parsing.
-#[derive(Debug, Default, Clone, Deserialize)]
-#[serde(rename_all = "snake_case")]
-#[serde(deny_unknown_fields)]
-#[serde(default)]
-pub struct ParseConfig {
- /// Whether to parse dependencies when generating bindings. When this is true,
- /// each dependent crate is found using a combination of `cargo metadata` and
- /// `Cargo.lock`. To further control this behavior, crates can be whitelisted or
- /// blacklisted using `include` and `exclude` respectively. Additionally in cases
- /// where crates have types to expose in bindings hidden in macros, a crate can
- /// be marked in `expand` and `cargo expand` will be used to expand the macros
- /// before parsing. A crate marked in `expand` doesn't need to be added to any
- /// whitelist.
- pub parse_deps: bool,
- /// An optional whitelist of names of crates to parse
- pub include: Option<Vec<String>>,
- /// The names of crates to not parse
- pub exclude: Vec<String>,
- /// The configuration options for `rustc -Zunpretty=expanded`
- #[serde(deserialize_with = "retrocomp_parse_expand_config_deserialize")]
- pub expand: ParseExpandConfig,
- /// Whether to use a new temporary target directory when running `rustc -Zunpretty=expanded`.
- /// This may be required for some build processes.
- pub clean: bool,
- /// List of crate names which generate consts, statics, and fns. By default
- /// no dependent crates generate them.
- pub extra_bindings: Vec<String>,
-}
-
-impl ParseConfig {
- pub(crate) fn should_generate_top_level_item(
- &self,
- crate_name: &str,
- binding_crate_name: &str,
- ) -> bool {
- if crate_name == binding_crate_name {
- // Always generate items for the binding crate.
- return true;
- }
-
- self.extra_bindings.iter().any(|dep| dep == crate_name)
- }
-}
-
-/// Settings to apply to pointers
-#[derive(Debug, Clone, Default, Deserialize)]
-#[serde(rename_all = "snake_case")]
-#[serde(deny_unknown_fields)]
-#[serde(default)]
-pub struct PtrConfig {
- /// Optional attribute to apply to pointers that are required to not be null
- pub non_null_attribute: Option<String>,
-}
-
-/// Settings specific to Cython bindings.
-#[derive(Debug, Clone, Default, Deserialize)]
-#[serde(rename_all = "snake_case")]
-#[serde(deny_unknown_fields)]
-#[serde(default)]
-pub struct CythonConfig {
- /// Header specified in the top level `cdef extern from header:` declaration.
- pub header: Option<String>,
- /// `from module cimport name1, name2, ...` declarations added in the same place
- /// where you'd get includes in C.
- pub cimports: BTreeMap<String, Vec<String>>,
-}
-
-/// A collection of settings to customize the generated bindings.
-#[derive(Debug, Clone, Deserialize)]
-#[serde(rename_all = "snake_case")]
-#[serde(deny_unknown_fields)]
-#[serde(default)]
-pub struct Config {
- /// Optional text to output at the beginning of the file
- pub header: Option<String>,
- /// A list of additional includes to put at the beginning of the generated header
- pub includes: Vec<String>,
- /// A list of additional system includes to put at the beginning of the generated header
- pub sys_includes: Vec<String>,
- /// Optional verbatim code added after the include blocks
- pub after_includes: Option<String>,
- /// Optional text to output at the end of the file
- pub trailer: Option<String>,
- /// Optional name to use for an include guard
- pub include_guard: Option<String>,
- /// Add a `#pragma once` guard
- pub pragma_once: bool,
- /// Generates no includes at all. Overrides all other include options
- ///
- /// This option is useful when using cbindgen with tools such as python's cffi which
- /// doesn't understand include directives
- pub no_includes: bool,
- /// Optional text to output at major sections to deter manual editing
- pub autogen_warning: Option<String>,
- /// Include a comment with the version of cbindgen used to generate the file
- pub include_version: bool,
- /// An optional name for the root namespace. Only applicable when language="C++"
- pub namespace: Option<String>,
- /// An optional list of namespaces. Only applicable when language="C++"
- pub namespaces: Option<Vec<String>>,
- /// An optional list of namespaces to declare as using. Only applicable when language="C++"
- pub using_namespaces: Option<Vec<String>>,
- /// The style to use for braces
- pub braces: Braces,
- /// The preferred length of a line, used for auto breaking function arguments
- pub line_length: usize,
- /// The amount of spaces in a tab
- pub tab_width: usize,
- /// The type of line endings to generate
- pub line_endings: LineEndingStyle,
- /// The language to output bindings for
- pub language: Language,
- /// Include preprocessor defines in C bindings to ensure C++ compatibility
- pub cpp_compat: bool,
- /// The style to declare structs, enums and unions in for C
- pub style: Style,
- /// Default sort key for functions and constants.
- pub sort_by: SortKey,
- /// If this option is true `usize` and `isize` will be converted into `size_t` and `ptrdiff_t`
- /// instead of `uintptr_t` and `intptr_t` respectively.
- pub usize_is_size_t: bool,
- /// The configuration options for parsing
- pub parse: ParseConfig,
- /// The configuration options for exporting
- pub export: ExportConfig,
- /// The configuration options for macros.
- pub macro_expansion: MacroExpansionConfig,
- /// The configuration options for type layouts.
- pub layout: LayoutConfig,
- /// The configuration options for functions
- #[serde(rename = "fn")]
- pub function: FunctionConfig,
- /// The configuration options for structs
- #[serde(rename = "struct")]
- pub structure: StructConfig,
- /// The configuration options for enums
- #[serde(rename = "enum")]
- pub enumeration: EnumConfig,
- /// The configuration options for constants
- #[serde(rename = "const")]
- pub constant: ConstantConfig,
- /// Preprocessor defines to use when generating #ifdef's for #[cfg]
- pub defines: HashMap<String, String>,
- /// Include doc comments from Rust as documentation
- pub documentation: bool,
- /// How documentation comments should be styled.
- pub documentation_style: DocumentationStyle,
- /// How much of the documentation should be output for each item.
- pub documentation_length: DocumentationLength,
- /// Configuration options for pointers
- #[serde(rename = "ptr")]
- pub pointer: PtrConfig,
- /// Only download sources for dependencies needed for the target platform.
- ///
- /// By default, cbindgen will fetch sources for dependencies used on any platform so that if a
- /// type is defined in terms of a type from a dependency on another target (probably behind a
- /// `#[cfg]`), cbindgen will be able to generate the appropriate binding as it can see the
- /// nested type's definition. However, this makes calling cbindgen slower, as it may have to
- /// download a number of additional dependencies.
- ///
- /// As an example, consider this Cargo.toml:
- ///
- /// ```toml
- /// [target.'cfg(windows)'.dependencies]
- /// windows = "0.7"
- /// ```
- ///
- /// with this declaration in one of the `.rs` files that cbindgen is asked to generate bindings
- /// for:
- ///
- /// ```rust,ignore
- /// #[cfg(windows)]
- /// pub struct Error(windows::ErrorCode);
- /// ```
- ///
- /// With the default value (`false`), cbindgen will download the `windows` dependency even when
- /// not compiling for Windows, and will thus be able to generate the binding for `Error`
- /// (behind a `#define`).
- ///
- /// If this value is instead to `true`, cbindgen will _not_ download the `windows` dependency
- /// if it's not compiling for Windows, but will also fail to generate a Windows binding for
- /// `Error` as it does not know the definition for `ErrorCode`.
- ///
- /// The target can be chosen via the `TARGET` environment variable (if used
- /// via the CLI, when ran from a build script cargo sets this variable
- /// appropriately).
- pub only_target_dependencies: bool,
- /// Configuration options specific to Cython.
- pub cython: CythonConfig,
-}
-
-impl Default for Config {
- fn default() -> Config {
- Config {
- header: None,
- includes: Vec::new(),
- sys_includes: Vec::new(),
- after_includes: None,
- trailer: None,
- include_guard: None,
- pragma_once: false,
- autogen_warning: None,
- include_version: false,
- no_includes: false,
- namespace: None,
- namespaces: None,
- using_namespaces: None,
- braces: Braces::SameLine,
- line_length: 100,
- tab_width: 2,
- line_endings: LineEndingStyle::default(),
- language: Language::Cxx,
- cpp_compat: false,
- style: Style::default(),
- usize_is_size_t: false,
- sort_by: SortKey::None,
- macro_expansion: Default::default(),
- parse: ParseConfig::default(),
- export: ExportConfig::default(),
- layout: LayoutConfig::default(),
- function: FunctionConfig::default(),
- structure: StructConfig::default(),
- enumeration: EnumConfig::default(),
- constant: ConstantConfig::default(),
- defines: HashMap::new(),
- documentation: true,
- documentation_style: DocumentationStyle::Auto,
- documentation_length: DocumentationLength::Full,
- pointer: PtrConfig::default(),
- only_target_dependencies: false,
- cython: CythonConfig::default(),
- }
- }
-}
-
-impl Config {
- pub(crate) fn cpp_compatible_c(&self) -> bool {
- self.language == Language::C && self.cpp_compat
- }
-
- pub(crate) fn include_guard(&self) -> Option<&str> {
- if self.language == Language::Cython {
- None
- } else {
- self.include_guard.as_deref()
- }
- }
-
- pub(crate) fn includes(&self) -> &[String] {
- if self.language == Language::Cython {
- &[]
- } else {
- &self.includes
- }
- }
-
- pub(crate) fn sys_includes(&self) -> &[String] {
- if self.language == Language::Cython {
- &[]
- } else {
- &self.sys_includes
- }
- }
-
- pub fn from_file<P: AsRef<StdPath>>(file_name: P) -> Result<Config, String> {
- let config_text = fs::read_to_string(file_name.as_ref()).map_err(|_| {
- format!(
- "Couldn't open config file: {}.",
- file_name.as_ref().display()
- )
- })?;
-
- match toml::from_str::<Config>(&config_text) {
- Ok(x) => Ok(x),
- Err(e) => Err(format!("Couldn't parse config file: {}.", e)),
- }
- }
-
- pub fn from_root_or_default<P: AsRef<StdPath>>(root: P) -> Config {
- let c = root.as_ref().join("cbindgen.toml");
-
- if c.exists() {
- Config::from_file(c).unwrap()
- } else {
- Config::default()
- }
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/annotation.rs b/cbindgen-0.24.5/src/bindgen/ir/annotation.rs
deleted file mode 100644
index c3c8db0..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/annotation.rs
+++ /dev/null
@@ -1,179 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::collections::hash_map::Entry;
-use std::collections::HashMap;
-use std::str::FromStr;
-
-use crate::bindgen::config::{Config, Language};
-use crate::bindgen::utilities::SynAttributeHelpers;
-
-// A system for specifying properties on items. Annotations are
-// given through document comments and parsed by this code.
-//
-// An annotation is in the form cbindgen:PROPERTY=VALUE
-// Where PROPERTY depends on the item
-// Where VALUE can be
-// * list - [Item1, Item2, Item3, ...]
-// * atom - Foo
-// * bool - true,false
-// Examples:
-// * cbindgen:field-names=[mHandle, mNamespace]
-// * cbindgen:function-postfix=WR_DESTRUCTOR_SAFE
-
-/// A value specified by an annotation.
-#[derive(Debug, Clone)]
-pub enum AnnotationValue {
- List(Vec<String>),
- Atom(Option<String>),
- Bool(bool),
-}
-
-/// A set of annotations specified by a document comment.
-#[derive(Debug, Default, Clone)]
-pub struct AnnotationSet {
- annotations: HashMap<String, AnnotationValue>,
- pub must_use: bool,
-}
-
-impl AnnotationSet {
- pub fn new() -> AnnotationSet {
- AnnotationSet {
- annotations: HashMap::new(),
- must_use: false,
- }
- }
-
- pub fn is_empty(&self) -> bool {
- self.annotations.is_empty() && !self.must_use
- }
-
- pub(crate) fn must_use(&self, config: &Config) -> bool {
- self.must_use && config.language != Language::Cython
- }
-
- pub fn load(attrs: &[syn::Attribute]) -> Result<AnnotationSet, String> {
- let lines = attrs.get_comment_lines();
- let lines: Vec<&str> = lines
- .iter()
- .filter_map(|line| {
- let line = line.trim_start();
- if !line.starts_with("cbindgen:") {
- return None;
- }
-
- Some(line)
- })
- .collect();
-
- let must_use = attrs.has_attr_word("must_use");
-
- let mut annotations = HashMap::new();
-
- // Look at each line for an annotation
- for line in lines {
- debug_assert!(line.starts_with("cbindgen:"));
-
- // Remove the "cbindgen:" prefix
- let annotation = &line[9..];
-
- // Split the annotation in two
- let parts: Vec<&str> = annotation.split('=').map(|x| x.trim()).collect();
-
- if parts.len() > 2 {
- return Err(format!("Couldn't parse {}.", line));
- }
-
- // Grab the name that this annotation is modifying
- let name = parts[0];
-
- // If the annotation only has a name, assume it's setting a bool flag
- if parts.len() == 1 {
- annotations.insert(name.to_string(), AnnotationValue::Bool(true));
- continue;
- }
-
- // Parse the value we're setting the name to
- let value = parts[1];
-
- if let Some(x) = parse_list(value) {
- annotations.insert(name.to_string(), AnnotationValue::List(x));
- continue;
- }
- if let Ok(x) = value.parse::<bool>() {
- annotations.insert(name.to_string(), AnnotationValue::Bool(x));
- continue;
- }
- annotations.insert(
- name.to_string(),
- if value.is_empty() {
- AnnotationValue::Atom(None)
- } else {
- AnnotationValue::Atom(Some(value.to_string()))
- },
- );
- }
-
- Ok(AnnotationSet {
- annotations,
- must_use,
- })
- }
-
- /// Adds an annotation value if none is specified.
- pub fn add_default(&mut self, name: &str, value: AnnotationValue) {
- if let Entry::Vacant(e) = self.annotations.entry(name.to_string()) {
- e.insert(value);
- }
- }
-
- pub fn list(&self, name: &str) -> Option<Vec<String>> {
- match self.annotations.get(name) {
- Some(AnnotationValue::List(x)) => Some(x.clone()),
- _ => None,
- }
- }
- pub fn atom(&self, name: &str) -> Option<Option<String>> {
- match self.annotations.get(name) {
- Some(AnnotationValue::Atom(x)) => Some(x.clone()),
- _ => None,
- }
- }
- pub fn bool(&self, name: &str) -> Option<bool> {
- match self.annotations.get(name) {
- Some(AnnotationValue::Bool(x)) => Some(*x),
- _ => None,
- }
- }
-
- pub fn parse_atom<T>(&self, name: &str) -> Option<T>
- where
- T: Default + FromStr,
- {
- match self.annotations.get(name) {
- Some(AnnotationValue::Atom(x)) => Some(
- x.as_ref()
- .map_or(T::default(), |y| y.parse::<T>().ok().unwrap()),
- ),
- _ => None,
- }
- }
-}
-
-/// Parse lists like "[x, y, z]". This is not implemented efficiently or well.
-fn parse_list(list: &str) -> Option<Vec<String>> {
- if list.len() < 2 {
- return None;
- }
-
- match (list.chars().next(), list.chars().last()) {
- (Some('['), Some(']')) => Some(
- list[1..list.len() - 1]
- .split(',')
- .map(|x| x.trim().to_string())
- .collect(),
- ),
- _ => None,
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/cfg.rs b/cbindgen-0.24.5/src/bindgen/ir/cfg.rs
deleted file mode 100644
index e8aa412..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/cfg.rs
+++ /dev/null
@@ -1,365 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::fmt;
-use std::io::Write;
-
-use crate::bindgen::cargo::cargo_metadata::Dependency;
-use crate::bindgen::config::{Config, Language};
-use crate::bindgen::writer::SourceWriter;
-
-#[derive(PartialEq, Eq)]
-enum DefineKey<'a> {
- Boolean(&'a str),
- Named(&'a str, &'a str),
-}
-
-impl<'a> DefineKey<'a> {
- fn load(key: &str) -> DefineKey {
- // TODO: dirty parser
- if !key.contains('=') {
- return DefineKey::Boolean(key);
- }
-
- let mut splits = key.trim().split('=');
-
- let name = match splits.next() {
- Some(n) => n.trim(),
- None => return DefineKey::Boolean(key),
- };
-
- let value = match splits.next() {
- Some(v) => v.trim(),
- None => return DefineKey::Boolean(key),
- };
-
- if splits.next().is_some() {
- return DefineKey::Boolean(key);
- }
-
- DefineKey::Named(name, value)
- }
-}
-
-#[derive(Debug, Clone)]
-pub enum Cfg {
- Boolean(String),
- Named(String, String),
- Any(Vec<Cfg>),
- All(Vec<Cfg>),
- Not(Box<Cfg>),
-}
-
-impl fmt::Display for Cfg {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match self {
- Cfg::Boolean(key) => write!(f, "{}", key),
- Cfg::Named(key, value) => write!(f, "{} = {:?}", key, value),
- Cfg::Any(cfgs) => {
- write!(f, "any(")?;
- for (index, cfg) in cfgs.iter().enumerate() {
- if index > 0 {
- write!(f, ", ")?;
- }
- write!(f, "{}", cfg)?;
- }
- write!(f, ")")
- }
- Cfg::All(cfgs) => {
- write!(f, "all(")?;
- for (index, cfg) in cfgs.iter().enumerate() {
- if index > 0 {
- write!(f, ", ")?;
- }
- write!(f, "{}", cfg)?;
- }
- write!(f, ")")
- }
- Cfg::Not(cfg) => write!(f, "not({})", cfg),
- }
- }
-}
-
-impl Cfg {
- pub fn join(cfgs: &[Cfg]) -> Option<Cfg> {
- if cfgs.is_empty() {
- None
- } else {
- Some(Cfg::All(cfgs.to_owned()))
- }
- }
-
- pub fn append(parent: Option<&Cfg>, child: Option<Cfg>) -> Option<Cfg> {
- match (parent, child) {
- (None, None) => None,
- (None, Some(child)) => Some(child),
- (Some(parent), None) => Some(parent.clone()),
- (Some(parent), Some(child)) => Some(Cfg::All(vec![parent.clone(), child])),
- }
- }
-
- pub fn load(attrs: &[syn::Attribute]) -> Option<Cfg> {
- let mut configs = Vec::new();
-
- for attr in attrs {
- if let Ok(syn::Meta::List(syn::MetaList { path, nested, .. })) = attr.parse_meta() {
- if !path.is_ident("cfg") || nested.len() != 1 {
- continue;
- }
-
- if let Some(config) = Cfg::load_single(nested.first().unwrap()) {
- configs.push(config);
- }
- }
- }
-
- match configs.len() {
- 0 => None,
- 1 => Some(configs.pop().unwrap()),
- _ => Some(Cfg::All(configs)),
- }
- }
-
- pub fn load_metadata(dependency: &Dependency) -> Option<Cfg> {
- let target = dependency.target.as_ref()?;
- match syn::parse_str::<syn::Meta>(target) {
- Ok(target) => {
- // Parsing succeeded using the #[cfg] syntax
- if let syn::Meta::List(syn::MetaList { path, nested, .. }) = target {
- if !path.is_ident("cfg") || nested.len() != 1 {
- return None;
- }
- Cfg::load_single(nested.first().unwrap())
- } else {
- None
- }
- }
- Err(_) => {
- // Parsing failed using #[cfg], this may be a literal target
- // name
- Cfg::load_single(&syn::NestedMeta::Lit(syn::Lit::Str(syn::LitStr::new(
- target,
- proc_macro2::Span::call_site(),
- ))))
- }
- }
- }
-
- fn load_single(item: &syn::NestedMeta) -> Option<Cfg> {
- Some(match *item {
- syn::NestedMeta::Meta(syn::Meta::Path(ref path)) => {
- Cfg::Boolean(format!("{}", path.segments.first().unwrap().ident))
- }
- syn::NestedMeta::Meta(syn::Meta::NameValue(syn::MetaNameValue {
- ref path,
- lit: syn::Lit::Str(ref value),
- ..
- })) => Cfg::Named(
- format!("{}", path.segments.first().unwrap().ident),
- value.value(),
- ),
- syn::NestedMeta::Meta(syn::Meta::List(syn::MetaList {
- ref path,
- ref nested,
- ..
- })) => {
- if path.is_ident("any") {
- Cfg::Any(Cfg::load_list(nested.iter())?)
- } else if path.is_ident("all") {
- Cfg::All(Cfg::load_list(nested.iter())?)
- } else if path.is_ident("not") {
- if nested.len() != 1 {
- return None;
- }
-
- Cfg::Not(Box::new(Cfg::load_single(&nested[0])?))
- } else {
- return None;
- }
- }
- _ => return None,
- })
- }
-
- fn load_list<'a, I: Iterator<Item = &'a syn::NestedMeta>>(attrs: I) -> Option<Vec<Cfg>> {
- let mut configs = Vec::new();
-
- for attr in attrs {
- configs.push(Cfg::load_single(attr)?);
- }
-
- if configs.is_empty() {
- None
- } else {
- Some(configs)
- }
- }
-}
-
-pub trait ToCondition: Sized {
- fn to_condition(&self, config: &Config) -> Option<Condition>;
-}
-
-impl ToCondition for Option<Cfg> {
- fn to_condition(&self, config: &Config) -> Option<Condition> {
- self.as_ref()?.to_condition(config)
- }
-}
-
-impl ToCondition for Cfg {
- fn to_condition(&self, config: &Config) -> Option<Condition> {
- match *self {
- Cfg::Boolean(ref cfg_name) => {
- let define = config
- .defines
- .iter()
- .find(|(key, ..)| DefineKey::Boolean(cfg_name) == DefineKey::load(key));
- if let Some((_, define)) = define {
- Some(Condition::Define(define.to_owned()))
- } else {
- warn!(
- "Missing `[defines]` entry for `{}` in cbindgen config.",
- self,
- );
- None
- }
- }
- Cfg::Named(ref cfg_name, ref cfg_value) => {
- let define = config.defines.iter().find(|(key, ..)| {
- DefineKey::Named(cfg_name, cfg_value) == DefineKey::load(key)
- });
- if let Some((_, define)) = define {
- Some(Condition::Define(define.to_owned()))
- } else {
- warn!(
- "Missing `[defines]` entry for `{}` in cbindgen config.",
- self,
- );
- None
- }
- }
- Cfg::Any(ref children) => {
- let conditions: Vec<_> = children
- .iter()
- .filter_map(|x| x.to_condition(config))
- .collect();
- match conditions.len() {
- 0 => None,
- 1 => conditions.into_iter().next(),
- _ => Some(Condition::Any(conditions)),
- }
- }
- Cfg::All(ref children) => {
- let cfgs: Vec<_> = children
- .iter()
- .filter_map(|x| x.to_condition(config))
- .collect();
- match cfgs.len() {
- 0 => None,
- 1 => cfgs.into_iter().next(),
- _ => Some(Condition::All(cfgs)),
- }
- }
- Cfg::Not(ref child) => child
- .to_condition(config)
- .map(|cfg| Condition::Not(Box::new(cfg))),
- }
- }
-}
-
-#[derive(Debug, Clone)]
-pub enum Condition {
- Define(String),
- Any(Vec<Condition>),
- All(Vec<Condition>),
- Not(Box<Condition>),
-}
-
-impl Condition {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- match *self {
- Condition::Define(ref define) => {
- if config.language == Language::Cython {
- write!(out, "{}", define);
- } else {
- out.write("defined(");
- write!(out, "{}", define);
- out.write(")");
- }
- }
- Condition::Any(ref conditions) => {
- out.write("(");
- for (i, condition) in conditions.iter().enumerate() {
- if i != 0 {
- out.write(if config.language == Language::Cython {
- " or "
- } else {
- " || "
- });
- }
- condition.write(config, out);
- }
- out.write(")");
- }
- Condition::All(ref conditions) => {
- out.write("(");
- for (i, condition) in conditions.iter().enumerate() {
- if i != 0 {
- out.write(if config.language == Language::Cython {
- " and "
- } else {
- " && "
- });
- }
- condition.write(config, out);
- }
- out.write(")");
- }
- Condition::Not(ref condition) => {
- out.write(if config.language == Language::Cython {
- "not "
- } else {
- "!"
- });
- condition.write(config, out);
- }
- }
- }
-}
-
-pub trait ConditionWrite {
- fn write_before<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>);
- fn write_after<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>);
-}
-
-impl ConditionWrite for Option<Condition> {
- fn write_before<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- if let Some(ref cfg) = *self {
- if config.language == Language::Cython {
- out.write("IF ");
- cfg.write(config, out);
- out.open_brace();
- } else {
- out.push_set_spaces(0);
- out.write("#if ");
- cfg.write(config, out);
- out.pop_set_spaces();
- out.new_line();
- }
- }
- }
-
- fn write_after<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- if self.is_some() {
- if config.language == Language::Cython {
- out.close_brace(false);
- } else {
- out.new_line();
- out.push_set_spaces(0);
- out.write("#endif");
- out.pop_set_spaces();
- }
- }
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/constant.rs b/cbindgen-0.24.5/src/bindgen/ir/constant.rs
deleted file mode 100644
index 42182ab..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/constant.rs
+++ /dev/null
@@ -1,813 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::borrow::Cow;
-use std::collections::HashMap;
-use std::io::Write;
-
-use syn::ext::IdentExt;
-use syn::{self, UnOp};
-
-use crate::bindgen::config::{Config, Language};
-use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
-use crate::bindgen::dependencies::Dependencies;
-use crate::bindgen::ir::{
- AnnotationSet, Cfg, ConditionWrite, Documentation, GenericParams, Item, ItemContainer, Path,
- Struct, ToCondition, Type,
-};
-use crate::bindgen::library::Library;
-use crate::bindgen::writer::{Source, SourceWriter};
-use crate::bindgen::Bindings;
-
-fn member_to_ident(member: &syn::Member) -> String {
- match member {
- syn::Member::Named(ref name) => name.unraw().to_string(),
- syn::Member::Unnamed(ref index) => format!("_{}", index.index),
- }
-}
-
-// TODO: Maybe add support to more std associated constants.
-fn to_known_assoc_constant(associated_to: &Path, name: &str) -> Option<String> {
- use crate::bindgen::ir::{IntKind, PrimitiveType};
-
- if name != "MAX" && name != "MIN" {
- return None;
- }
-
- let prim = PrimitiveType::maybe(associated_to.name())?;
- let prefix = match prim {
- PrimitiveType::Integer {
- kind,
- signed,
- zeroable: _,
- } => match kind {
- IntKind::B8 => {
- if signed {
- "INT8"
- } else {
- "UINT8"
- }
- }
- IntKind::B16 => {
- if signed {
- "INT16"
- } else {
- "UINT16"
- }
- }
- IntKind::B32 => {
- if signed {
- "INT32"
- } else {
- "UINT32"
- }
- }
- IntKind::B64 => {
- if signed {
- "INT64"
- } else {
- "UINT64"
- }
- }
- _ => return None,
- },
- _ => return None,
- };
- Some(format!("{}_{}", prefix, name))
-}
-
-#[derive(Debug, Clone)]
-pub enum Literal {
- Expr(String),
- Path {
- associated_to: Option<(Path, String)>,
- name: String,
- },
- PostfixUnaryOp {
- op: &'static str,
- value: Box<Literal>,
- },
- BinOp {
- left: Box<Literal>,
- op: &'static str,
- right: Box<Literal>,
- },
- FieldAccess {
- base: Box<Literal>,
- field: String,
- },
- Struct {
- path: Path,
- export_name: String,
- fields: HashMap<String, Literal>,
- },
- Cast {
- ty: Type,
- value: Box<Literal>,
- },
-}
-
-impl Literal {
- fn replace_self_with(&mut self, self_ty: &Path) {
- match *self {
- Literal::PostfixUnaryOp { ref mut value, .. } => {
- value.replace_self_with(self_ty);
- }
- Literal::BinOp {
- ref mut left,
- ref mut right,
- ..
- } => {
- left.replace_self_with(self_ty);
- right.replace_self_with(self_ty);
- }
- Literal::FieldAccess { ref mut base, .. } => {
- base.replace_self_with(self_ty);
- }
- Literal::Struct {
- ref mut path,
- ref mut export_name,
- ref mut fields,
- } => {
- if path.replace_self_with(self_ty) {
- *export_name = self_ty.name().to_owned();
- }
- for ref mut expr in fields.values_mut() {
- expr.replace_self_with(self_ty);
- }
- }
- Literal::Cast {
- ref mut ty,
- ref mut value,
- } => {
- ty.replace_self_with(self_ty);
- value.replace_self_with(self_ty);
- }
- Literal::Path {
- ref mut associated_to,
- ..
- } => {
- if let Some((ref mut path, ref mut export_name)) = *associated_to {
- if path.replace_self_with(self_ty) {
- *export_name = self_ty.name().to_owned();
- }
- }
- }
- Literal::Expr(..) => {}
- }
- }
-
- fn is_valid(&self, bindings: &Bindings) -> bool {
- match *self {
- Literal::Expr(..) => true,
- Literal::Path {
- ref associated_to,
- ref name,
- } => {
- if let Some((ref path, _export_name)) = associated_to {
- return bindings.struct_exists(path)
- || to_known_assoc_constant(path, name).is_some();
- }
- true
- }
- Literal::PostfixUnaryOp { ref value, .. } => value.is_valid(bindings),
- Literal::BinOp {
- ref left,
- ref right,
- ..
- } => left.is_valid(bindings) && right.is_valid(bindings),
- Literal::FieldAccess { ref base, .. } => base.is_valid(bindings),
- Literal::Struct { ref path, .. } => bindings.struct_exists(path),
- Literal::Cast { ref value, .. } => value.is_valid(bindings),
- }
- }
-
- fn can_be_constexpr(&self) -> bool {
- !self.has_pointer_casts()
- }
-
- fn visit(&self, visitor: &mut impl FnMut(&Self) -> bool) -> bool {
- if !visitor(self) {
- return false;
- }
- match self {
- Literal::Expr(..) | Literal::Path { .. } => true,
- Literal::PostfixUnaryOp { ref value, .. } => value.visit(visitor),
- Literal::BinOp {
- ref left,
- ref right,
- ..
- } => left.visit(visitor) && right.visit(visitor),
- Literal::FieldAccess { ref base, .. } => base.visit(visitor),
- Literal::Struct { ref fields, .. } => {
- for (_name, field) in fields.iter() {
- if !field.visit(visitor) {
- return false;
- }
- }
- true
- }
- Literal::Cast { ref value, .. } => value.visit(visitor),
- }
- }
-
- fn has_pointer_casts(&self) -> bool {
- let mut has_pointer_casts = false;
- self.visit(&mut |lit| {
- if let Literal::Cast { ref ty, .. } = *lit {
- has_pointer_casts = has_pointer_casts || ty.is_ptr();
- }
- !has_pointer_casts
- });
- has_pointer_casts
- }
-
- pub fn uses_only_primitive_types(&self) -> bool {
- let mut uses_only_primitive_types = true;
- self.visit(&mut |lit| {
- // XXX This is a bit sketchy, but alas.
- uses_only_primitive_types = uses_only_primitive_types
- && match *lit {
- Literal::Struct { .. } => false,
- Literal::Cast { ref ty, .. } => ty.is_primitive_or_ptr_primitive(),
- _ => true,
- };
- uses_only_primitive_types
- });
- uses_only_primitive_types
- }
-}
-
-impl Literal {
- pub fn rename_for_config(&mut self, config: &Config) {
- match self {
- Literal::Struct {
- ref mut export_name,
- fields,
- ..
- } => {
- config.export.rename(export_name);
- for lit in fields.values_mut() {
- lit.rename_for_config(config);
- }
- }
- Literal::FieldAccess { ref mut base, .. } => {
- base.rename_for_config(config);
- }
- Literal::Path {
- ref mut associated_to,
- ref mut name,
- } => {
- if let Some((_path, ref mut export_name)) = associated_to {
- config.export.rename(export_name);
- } else {
- config.export.rename(name);
- }
- }
- Literal::PostfixUnaryOp { ref mut value, .. } => {
- value.rename_for_config(config);
- }
- Literal::BinOp {
- ref mut left,
- ref mut right,
- ..
- } => {
- left.rename_for_config(config);
- right.rename_for_config(config);
- }
- Literal::Expr(_) => {}
- Literal::Cast {
- ref mut ty,
- ref mut value,
- } => {
- ty.rename_for_config(config, &GenericParams::default());
- value.rename_for_config(config);
- }
- }
- }
-
- // Translate from full blown `syn::Expr` into a simpler `Literal` type
- pub fn load(expr: &syn::Expr) -> Result<Literal, String> {
- match *expr {
- // Match binary expressions of the form `a * b`
- syn::Expr::Binary(ref bin_expr) => {
- let l = Self::load(&bin_expr.left)?;
- let r = Self::load(&bin_expr.right)?;
- let op = match bin_expr.op {
- syn::BinOp::Add(..) => "+",
- syn::BinOp::Sub(..) => "-",
- syn::BinOp::Mul(..) => "*",
- syn::BinOp::Div(..) => "/",
- syn::BinOp::Rem(..) => "%",
- syn::BinOp::And(..) => "&&",
- syn::BinOp::Or(..) => "||",
- syn::BinOp::BitXor(..) => "^",
- syn::BinOp::BitAnd(..) => "&",
- syn::BinOp::BitOr(..) => "|",
- syn::BinOp::Shl(..) => "<<",
- syn::BinOp::Shr(..) => ">>",
- syn::BinOp::Eq(..) => "==",
- syn::BinOp::Lt(..) => "<",
- syn::BinOp::Le(..) => "<=",
- syn::BinOp::Ne(..) => "!=",
- syn::BinOp::Ge(..) => ">=",
- syn::BinOp::Gt(..) => ">",
- syn::BinOp::AddEq(..) => "+=",
- syn::BinOp::SubEq(..) => "-=",
- syn::BinOp::MulEq(..) => "*=",
- syn::BinOp::DivEq(..) => "/=",
- syn::BinOp::RemEq(..) => "%=",
- syn::BinOp::BitXorEq(..) => "^=",
- syn::BinOp::BitAndEq(..) => "&=",
- syn::BinOp::BitOrEq(..) => "|=",
- syn::BinOp::ShlEq(..) => ">>=",
- syn::BinOp::ShrEq(..) => "<<=",
- };
- Ok(Literal::BinOp {
- left: Box::new(l),
- op,
- right: Box::new(r),
- })
- }
-
- // Match literals like true, 'a', 32 etc
- syn::Expr::Lit(syn::ExprLit { ref lit, .. }) => {
- match lit {
- syn::Lit::Byte(ref value) => Ok(Literal::Expr(format!("{}", value.value()))),
- syn::Lit::Char(ref value) => Ok(Literal::Expr(match value.value() as u32 {
- 0..=255 => format!("'{}'", value.value().escape_default()),
- other_code => format!(r"U'\U{:08X}'", other_code),
- })),
- syn::Lit::Int(ref value) => {
- let suffix = match value.suffix() {
- "u64" => "ull",
- "i64" => "ll",
- "u32" => "u",
- _ if value.base10_parse::<i64>().is_err() => "ull",
- _ => "",
- };
- Ok(Literal::Expr(format!(
- "{}{}",
- value.base10_digits(),
- suffix
- )))
- }
- syn::Lit::Float(ref value) => {
- Ok(Literal::Expr(value.base10_digits().to_string()))
- }
- syn::Lit::Bool(ref value) => Ok(Literal::Expr(format!("{}", value.value))),
- // TODO: Add support for byte string and Verbatim
- _ => Err(format!("Unsupported literal expression. {:?}", *lit)),
- }
- }
-
- syn::Expr::Field(syn::ExprField {
- ref base,
- ref member,
- ..
- }) => Ok(Literal::FieldAccess {
- base: Box::new(Literal::load(base)?),
- field: member_to_ident(member),
- }),
-
- syn::Expr::Call(syn::ExprCall {
- ref func, ref args, ..
- }) => {
- let struct_name = match Literal::load(func)? {
- Literal::Path {
- associated_to: None,
- name,
- } => name,
- _ => return Err(format!("Unsupported call expression. {:?}", *expr)),
- };
- let mut fields = HashMap::<String, Literal>::default();
- for (index, arg) in args.iter().enumerate() {
- let ident =
- member_to_ident(&syn::Member::Unnamed(syn::Index::from(index))).to_string();
- let value = Literal::load(arg)?;
- fields.insert(ident, value);
- }
- Ok(Literal::Struct {
- path: Path::new(struct_name.clone()),
- export_name: struct_name,
- fields,
- })
- }
-
- syn::Expr::Struct(syn::ExprStruct {
- ref path,
- ref fields,
- ..
- }) => {
- let struct_name = path.segments[0].ident.unraw().to_string();
- let mut field_map = HashMap::<String, Literal>::default();
- for field in fields {
- let ident = member_to_ident(&field.member).to_string();
- let value = Literal::load(&field.expr)?;
- field_map.insert(ident, value);
- }
- Ok(Literal::Struct {
- path: Path::new(struct_name.clone()),
- export_name: struct_name,
- fields: field_map,
- })
- }
-
- syn::Expr::Unary(syn::ExprUnary {
- ref op, ref expr, ..
- }) => match *op {
- UnOp::Not(_) => {
- let val = Self::load(expr)?;
- Ok(Literal::PostfixUnaryOp {
- op: "~",
- value: Box::new(val),
- })
- }
- UnOp::Neg(_) => {
- let val = Self::load(expr)?;
- Ok(Literal::PostfixUnaryOp {
- op: "-",
- value: Box::new(val),
- })
- }
- _ => Err(format!("Unsupported Unary expression. {:?}", *op)),
- },
-
- // Match identifiers, like `5 << SHIFT`
- syn::Expr::Path(syn::ExprPath { ref path, .. }) => {
- // Handle only the simplest identifiers and Associated::IDENT
- // kind of syntax.
- Ok(match path.segments.len() {
- 1 => Literal::Path {
- associated_to: None,
- name: path.segments[0].ident.to_string(),
- },
- 2 => {
- let struct_name = path.segments[0].ident.to_string();
- Literal::Path {
- associated_to: Some((Path::new(&struct_name), struct_name)),
- name: path.segments[1].ident.to_string(),
- }
- }
- _ => return Err(format!("Unsupported path expression. {:?}", path)),
- })
- }
-
- syn::Expr::Paren(syn::ExprParen { ref expr, .. }) => Self::load(expr),
-
- syn::Expr::Cast(syn::ExprCast {
- ref expr, ref ty, ..
- }) => {
- let val = Self::load(expr)?;
- match Type::load(ty)? {
- Some(ty) => Ok(Literal::Cast {
- ty,
- value: Box::new(val),
- }),
- None => Err("Cannot cast to zero sized type.".to_owned()),
- }
- }
-
- _ => Err(format!("Unsupported expression. {:?}", *expr)),
- }
- }
-
- pub(crate) fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- match self {
- Literal::Expr(v) => match (&**v, config.language) {
- ("true", Language::Cython) => write!(out, "True"),
- ("false", Language::Cython) => write!(out, "False"),
- (v, _) => write!(out, "{}", v),
- },
- Literal::Path {
- ref associated_to,
- ref name,
- } => {
- if let Some((ref path, ref export_name)) = associated_to {
- if let Some(known) = to_known_assoc_constant(path, name) {
- return write!(out, "{}", known);
- }
- let path_separator = match config.language {
- Language::Cython | Language::C => "_",
- Language::Cxx => {
- if config.structure.associated_constants_in_body {
- "::"
- } else {
- "_"
- }
- }
- };
- write!(out, "{}{}", export_name, path_separator)
- }
- write!(out, "{}", name)
- }
- Literal::FieldAccess {
- ref base,
- ref field,
- } => {
- write!(out, "(");
- base.write(config, out);
- write!(out, ").{}", field);
- }
- Literal::PostfixUnaryOp { op, ref value } => {
- write!(out, "{}", op);
- value.write(config, out);
- }
- Literal::BinOp {
- ref left,
- op,
- ref right,
- } => {
- write!(out, "(");
- left.write(config, out);
- write!(out, " {} ", op);
- right.write(config, out);
- write!(out, ")");
- }
- Literal::Cast { ref ty, ref value } => {
- out.write(if config.language == Language::Cython {
- "<"
- } else {
- "("
- });
- ty.write(config, out);
- out.write(if config.language == Language::Cython {
- ">"
- } else {
- ")"
- });
- value.write(config, out);
- }
- Literal::Struct {
- export_name,
- fields,
- path,
- } => {
- match config.language {
- Language::C => write!(out, "({})", export_name),
- Language::Cxx => write!(out, "{}", export_name),
- Language::Cython => write!(out, "<{}>", export_name),
- }
-
- write!(out, "{{ ");
- let mut is_first_field = true;
- // In C++, same order as defined is required.
- let ordered_fields = out.bindings().struct_field_names(path);
- for ordered_key in ordered_fields.iter() {
- if let Some(lit) = fields.get(ordered_key) {
- if !is_first_field {
- write!(out, ", ");
- } else {
- is_first_field = false;
- }
- match config.language {
- Language::Cxx => write!(out, "/* .{} = */ ", ordered_key),
- Language::C => write!(out, ".{} = ", ordered_key),
- Language::Cython => {}
- }
- lit.write(config, out);
- }
- }
- write!(out, " }}");
- }
- }
- }
-}
-
-#[derive(Debug, Clone)]
-pub struct Constant {
- pub path: Path,
- pub export_name: String,
- pub ty: Type,
- pub value: Literal,
- pub cfg: Option<Cfg>,
- pub annotations: AnnotationSet,
- pub documentation: Documentation,
- pub associated_to: Option<Path>,
-}
-
-impl Constant {
- pub fn load(
- path: Path,
- mod_cfg: Option<&Cfg>,
- ty: &syn::Type,
- expr: &syn::Expr,
- attrs: &[syn::Attribute],
- associated_to: Option<Path>,
- ) -> Result<Constant, String> {
- let ty = Type::load(ty)?;
- let mut ty = match ty {
- Some(ty) => ty,
- None => {
- return Err("Cannot have a zero sized const definition.".to_owned());
- }
- };
-
- let mut lit = Literal::load(expr)?;
-
- if let Some(ref associated_to) = associated_to {
- ty.replace_self_with(associated_to);
- lit.replace_self_with(associated_to);
- }
-
- Ok(Constant::new(
- path,
- ty,
- lit,
- Cfg::append(mod_cfg, Cfg::load(attrs)),
- AnnotationSet::load(attrs)?,
- Documentation::load(attrs),
- associated_to,
- ))
- }
-
- pub fn new(
- path: Path,
- ty: Type,
- value: Literal,
- cfg: Option<Cfg>,
- annotations: AnnotationSet,
- documentation: Documentation,
- associated_to: Option<Path>,
- ) -> Self {
- let export_name = path.name().to_owned();
- Self {
- path,
- export_name,
- ty,
- value,
- cfg,
- annotations,
- documentation,
- associated_to,
- }
- }
-
- pub fn uses_only_primitive_types(&self) -> bool {
- self.value.uses_only_primitive_types() && self.ty.is_primitive_or_ptr_primitive()
- }
-}
-
-impl Item for Constant {
- fn path(&self) -> &Path {
- &self.path
- }
-
- fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
- self.ty.add_dependencies(library, out);
- }
-
- fn export_name(&self) -> &str {
- &self.export_name
- }
-
- fn cfg(&self) -> Option<&Cfg> {
- self.cfg.as_ref()
- }
-
- fn annotations(&self) -> &AnnotationSet {
- &self.annotations
- }
-
- fn annotations_mut(&mut self) -> &mut AnnotationSet {
- &mut self.annotations
- }
-
- fn container(&self) -> ItemContainer {
- ItemContainer::Constant(self.clone())
- }
-
- fn rename_for_config(&mut self, config: &Config) {
- if self.associated_to.is_none() {
- config.export.rename(&mut self.export_name);
- }
- self.value.rename_for_config(config);
- self.ty.rename_for_config(config, &GenericParams::default()); // FIXME: should probably propagate something here
- }
-
- fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
- self.ty.resolve_declaration_types(resolver);
- }
-}
-
-impl Constant {
- pub fn write_declaration<F: Write>(
- &self,
- config: &Config,
- out: &mut SourceWriter<F>,
- associated_to_struct: &Struct,
- ) {
- debug_assert!(self.associated_to.is_some());
- debug_assert!(config.language == Language::Cxx);
- debug_assert!(!associated_to_struct.is_transparent);
- debug_assert!(config.structure.associated_constants_in_body);
- debug_assert!(config.constant.allow_static_const);
-
- if let Type::Ptr { is_const: true, .. } = self.ty {
- out.write("static ");
- } else {
- out.write("static const ");
- }
- self.ty.write(config, out);
- write!(out, " {};", self.export_name())
- }
-
- pub fn write<F: Write>(
- &self,
- config: &Config,
- out: &mut SourceWriter<F>,
- associated_to_struct: Option<&Struct>,
- ) {
- if let Some(assoc) = associated_to_struct {
- if assoc.is_generic() {
- return; // Not tested / implemented yet, so bail out.
- }
- }
-
- if !self.value.is_valid(out.bindings()) {
- return;
- }
-
- let associated_to_transparent = associated_to_struct.map_or(false, |s| s.is_transparent);
-
- let in_body = associated_to_struct.is_some()
- && config.language == Language::Cxx
- && config.structure.associated_constants_in_body
- && config.constant.allow_static_const
- && !associated_to_transparent;
-
- let condition = self.cfg.to_condition(config);
- condition.write_before(config, out);
-
- let name = if in_body {
- Cow::Owned(format!(
- "{}::{}",
- associated_to_struct.unwrap().export_name(),
- self.export_name(),
- ))
- } else if self.associated_to.is_none() {
- Cow::Borrowed(self.export_name())
- } else {
- let associated_name = match associated_to_struct {
- Some(s) => Cow::Borrowed(s.export_name()),
- None => {
- let mut name = self.associated_to.as_ref().unwrap().name().to_owned();
- config.export.rename(&mut name);
- Cow::Owned(name)
- }
- };
-
- Cow::Owned(format!("{}_{}", associated_name, self.export_name()))
- };
-
- let value = match self.value {
- Literal::Struct {
- ref fields,
- ref path,
- ..
- } if out.bindings().struct_is_transparent(path) => fields.iter().next().unwrap().1,
- _ => &self.value,
- };
-
- self.documentation.write(config, out);
-
- let allow_constexpr = config.constant.allow_constexpr && self.value.can_be_constexpr();
- match config.language {
- Language::Cxx if config.constant.allow_static_const || allow_constexpr => {
- if allow_constexpr {
- out.write("constexpr ")
- }
-
- if config.constant.allow_static_const {
- out.write(if in_body { "inline " } else { "static " });
- }
-
- if let Type::Ptr { is_const: true, .. } = self.ty {
- // Nothing.
- } else {
- out.write("const ");
- }
-
- self.ty.write(config, out);
- write!(out, " {} = ", name);
- value.write(config, out);
- write!(out, ";");
- }
- Language::Cxx | Language::C => {
- write!(out, "#define {} ", name);
- value.write(config, out);
- }
- Language::Cython => {
- out.write("const ");
- self.ty.write(config, out);
- // For extern Cython declarations the initializer is ignored,
- // but still useful as documentation, so we write it as a comment.
- write!(out, " {} # = ", name);
- value.write(config, out);
- }
- }
-
- condition.write_after(config, out);
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/documentation.rs b/cbindgen-0.24.5/src/bindgen/ir/documentation.rs
deleted file mode 100644
index 6822c0e..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/documentation.rs
+++ /dev/null
@@ -1,111 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::io::Write;
-
-use crate::bindgen::config::{Config, DocumentationLength, DocumentationStyle, Language};
-use crate::bindgen::utilities::SynAttributeHelpers;
-use crate::bindgen::writer::{Source, SourceWriter};
-
-#[derive(Debug, Clone)]
-pub struct Documentation {
- pub doc_comment: Vec<String>,
-}
-
-impl Documentation {
- pub fn load(attrs: &[syn::Attribute]) -> Self {
- let doc = attrs
- .get_comment_lines()
- .into_iter()
- .filter(|x| !x.trim_start().starts_with("cbindgen:"))
- .collect();
-
- Documentation { doc_comment: doc }
- }
-
- pub fn simple(line: &str) -> Self {
- Documentation {
- doc_comment: vec![line.to_owned()],
- }
- }
-
- pub fn none() -> Self {
- Documentation {
- doc_comment: Vec::new(),
- }
- }
-}
-
-impl Source for Documentation {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- if self.doc_comment.is_empty() || !config.documentation {
- return;
- }
-
- let end = match config.documentation_length {
- DocumentationLength::Short => 1,
- DocumentationLength::Full => self.doc_comment.len(),
- };
-
- // Cython uses Python-style comments, so `documentation_style` is not relevant.
- if config.language == Language::Cython {
- for line in &self.doc_comment[..end] {
- write!(out, "#{}", line);
- out.new_line();
- }
- return;
- }
-
- let style = match config.documentation_style {
- DocumentationStyle::Auto if config.language == Language::C => DocumentationStyle::Doxy,
- DocumentationStyle::Auto if config.language == Language::Cxx => DocumentationStyle::Cxx,
- DocumentationStyle::Auto => DocumentationStyle::C, // Fallback if `Language` gets extended.
- other => other,
- };
-
- // Following these documents for style conventions:
- // https://en.wikibooks.org/wiki/C++_Programming/Code/Style_Conventions/Comments
- // https://www.cs.cmu.edu/~410/doc/doxygen.html
- match style {
- DocumentationStyle::C => {
- out.write("/*");
- out.new_line();
- }
-
- DocumentationStyle::Doxy => {
- out.write("/**");
- out.new_line();
- }
-
- _ => (),
- }
-
- for line in &self.doc_comment[..end] {
- match style {
- DocumentationStyle::C => out.write(""),
- DocumentationStyle::Doxy => out.write(" *"),
- DocumentationStyle::C99 => out.write("//"),
- DocumentationStyle::Cxx => out.write("///"),
- DocumentationStyle::Auto => unreachable!(), // Auto case should always be covered
- }
-
- write!(out, "{}", line);
- out.new_line();
- }
-
- match style {
- DocumentationStyle::C => {
- out.write(" */");
- out.new_line();
- }
-
- DocumentationStyle::Doxy => {
- out.write(" */");
- out.new_line();
- }
-
- _ => (),
- }
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/enumeration.rs b/cbindgen-0.24.5/src/bindgen/ir/enumeration.rs
deleted file mode 100644
index b1b6c04..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/enumeration.rs
+++ /dev/null
@@ -1,1529 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::io::Write;
-
-use syn::ext::IdentExt;
-
-use crate::bindgen::config::{Config, Language};
-use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
-use crate::bindgen::dependencies::Dependencies;
-use crate::bindgen::ir::{
- AnnotationSet, AnnotationValue, Cfg, ConditionWrite, Documentation, Field, GenericArgument,
- GenericParams, GenericPath, Item, ItemContainer, Literal, Path, Repr, ReprStyle, Struct,
- ToCondition, Type,
-};
-use crate::bindgen::library::Library;
-use crate::bindgen::mangle;
-use crate::bindgen::monomorph::Monomorphs;
-use crate::bindgen::rename::{IdentifierType, RenameRule};
-use crate::bindgen::reserved;
-use crate::bindgen::writer::{ListType, Source, SourceWriter};
-
-#[allow(clippy::large_enum_variant)]
-#[derive(Debug, Clone)]
-pub enum VariantBody {
- Empty(AnnotationSet),
- Body {
- /// The variant field / export name.
- name: String,
- /// The struct with all the items.
- body: Struct,
- /// A separate named struct is not created for this variant,
- /// an unnamed struct is inlined at the point of use instead.
- /// This is a reasonable thing to do only for tuple variants with a single field.
- inline: bool,
- /// Generated cast methods return the variant's only field instead of the variant itself.
- /// For backward compatibility casts are inlined in a slightly
- /// larger set of cases than whole variants.
- inline_casts: bool,
- },
-}
-
-impl VariantBody {
- fn empty() -> Self {
- Self::Empty(AnnotationSet::new())
- }
-
- fn annotations(&self) -> &AnnotationSet {
- match *self {
- Self::Empty(ref anno) => anno,
- Self::Body { ref body, .. } => &body.annotations,
- }
- }
-
- fn is_empty(&self) -> bool {
- match *self {
- Self::Empty(..) => true,
- Self::Body { .. } => false,
- }
- }
-
- fn specialize(
- &self,
- generic_values: &[GenericArgument],
- mappings: &[(&Path, &GenericArgument)],
- config: &Config,
- ) -> Self {
- match *self {
- Self::Empty(ref annos) => Self::Empty(annos.clone()),
- Self::Body {
- ref name,
- ref body,
- inline,
- inline_casts,
- } => Self::Body {
- name: name.clone(),
- body: body.specialize(generic_values, mappings, config),
- inline,
- inline_casts,
- },
- }
- }
-}
-
-#[derive(Debug, Clone)]
-pub struct EnumVariant {
- pub name: String,
- pub export_name: String,
- pub discriminant: Option<Literal>,
- pub body: VariantBody,
- pub cfg: Option<Cfg>,
- pub documentation: Documentation,
-}
-
-impl EnumVariant {
- fn load(
- inline_tag_field: bool,
- variant: &syn::Variant,
- generic_params: GenericParams,
- mod_cfg: Option<&Cfg>,
- self_path: &Path,
- enum_annotations: &AnnotationSet,
- config: &Config,
- ) -> Result<Self, String> {
- let discriminant = match variant.discriminant {
- Some((_, ref expr)) => Some(Literal::load(expr)?),
- None => None,
- };
-
- fn parse_fields(
- inline_tag_field: bool,
- fields: &syn::punctuated::Punctuated<syn::Field, syn::token::Comma>,
- self_path: &Path,
- inline_name: Option<&str>,
- ) -> Result<Vec<Field>, String> {
- let mut res = Vec::new();
-
- if inline_tag_field {
- res.push(Field::from_name_and_type(
- inline_name.map_or_else(|| "tag".to_string(), |name| format!("{}_tag", name)),
- Type::Path(GenericPath::new(Path::new("Tag"), vec![])),
- ));
- }
-
- for (i, field) in fields.iter().enumerate() {
- if let Some(mut ty) = Type::load(&field.ty)? {
- ty.replace_self_with(self_path);
- res.push(Field {
- name: inline_name.map_or_else(
- || match field.ident {
- Some(ref ident) => ident.unraw().to_string(),
- None => i.to_string(),
- },
- |name| name.to_string(),
- ),
- ty,
- cfg: Cfg::load(&field.attrs),
- annotations: AnnotationSet::load(&field.attrs)?,
- documentation: Documentation::load(&field.attrs),
- });
- }
- }
-
- Ok(res)
- }
-
- let variant_cfg = Cfg::append(mod_cfg, Cfg::load(&variant.attrs));
- let mut annotations = AnnotationSet::load(&variant.attrs)?;
- if let Some(b) = enum_annotations.bool("derive-ostream") {
- annotations.add_default("derive-ostream", AnnotationValue::Bool(b));
- }
-
- let body_rule = enum_annotations
- .parse_atom::<RenameRule>("rename-variant-name-fields")
- .unwrap_or(config.enumeration.rename_variant_name_fields);
-
- let body = match variant.fields {
- syn::Fields::Unit => VariantBody::Empty(annotations),
- syn::Fields::Named(ref fields) => {
- let path = Path::new(format!("{}_Body", variant.ident));
- let name = body_rule
- .apply(
- &variant.ident.unraw().to_string(),
- IdentifierType::StructMember,
- )
- .into_owned();
- VariantBody::Body {
- body: Struct::new(
- path,
- generic_params,
- parse_fields(inline_tag_field, &fields.named, self_path, None)?,
- inline_tag_field,
- true,
- None,
- false,
- None,
- annotations,
- Documentation::none(),
- ),
- name,
- inline: false,
- inline_casts: false,
- }
- }
- syn::Fields::Unnamed(ref fields) => {
- let path = Path::new(format!("{}_Body", variant.ident));
- let name = body_rule
- .apply(
- &variant.ident.unraw().to_string(),
- IdentifierType::StructMember,
- )
- .into_owned();
- let inline_casts = fields.unnamed.len() == 1;
- // In C++ types with destructors cannot be put into unnamed structs like the
- // inlining requires, and it's hard to detect such types.
- // Besides that for C++ we generate casts/getters that can be used instead of
- // direct field accesses and also have a benefit of being checked.
- // As a result we don't currently inline variant definitions in C++ mode at all.
- let inline = inline_casts && config.language != Language::Cxx;
- let inline_name = if inline { Some(&*name) } else { None };
- VariantBody::Body {
- body: Struct::new(
- path,
- generic_params,
- parse_fields(inline_tag_field, &fields.unnamed, self_path, inline_name)?,
- inline_tag_field,
- true,
- None,
- false,
- None,
- annotations,
- Documentation::none(),
- ),
- name,
- inline,
- inline_casts,
- }
- }
- };
-
- Ok(EnumVariant::new(
- variant.ident.unraw().to_string(),
- discriminant,
- body,
- variant_cfg,
- Documentation::load(&variant.attrs),
- ))
- }
-
- pub fn new(
- name: String,
- discriminant: Option<Literal>,
- body: VariantBody,
- cfg: Option<Cfg>,
- documentation: Documentation,
- ) -> Self {
- let export_name = name.clone();
- Self {
- name,
- export_name,
- discriminant,
- body,
- cfg,
- documentation,
- }
- }
-
- fn simplify_standard_types(&mut self, config: &Config) {
- if let VariantBody::Body { ref mut body, .. } = self.body {
- body.simplify_standard_types(config);
- }
- }
-
- fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
- if let VariantBody::Body { ref body, .. } = self.body {
- body.add_dependencies(library, out);
- }
- }
-
- fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
- if let VariantBody::Body { ref mut body, .. } = self.body {
- body.resolve_declaration_types(resolver);
- }
- }
-
- fn specialize(
- &self,
- generic_values: &[GenericArgument],
- mappings: &[(&Path, &GenericArgument)],
- config: &Config,
- ) -> Self {
- Self::new(
- mangle::mangle_name(&self.name, generic_values, &config.export.mangle),
- self.discriminant.clone(),
- self.body.specialize(generic_values, mappings, config),
- self.cfg.clone(),
- self.documentation.clone(),
- )
- }
-
- fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
- if let VariantBody::Body { ref body, .. } = self.body {
- body.add_monomorphs(library, out);
- }
- }
-
- fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
- if let VariantBody::Body { ref mut body, .. } = self.body {
- body.mangle_paths(monomorphs);
- }
- }
-}
-
-impl Source for EnumVariant {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- let condition = self.cfg.to_condition(config);
- // Cython doesn't support conditional enum variants.
- if config.language != Language::Cython {
- condition.write_before(config, out);
- }
- self.documentation.write(config, out);
- write!(out, "{}", self.export_name);
- if let Some(discriminant) = &self.discriminant {
- if config.language == Language::Cython {
- // For extern Cython declarations the enumerator value is ignored,
- // but still useful as documentation, so we write it as a comment.
- out.write(" #")
- }
- out.write(" = ");
- discriminant.write(config, out);
- }
- out.write(",");
- if config.language != Language::Cython {
- condition.write_after(config, out);
- }
- }
-}
-
-#[derive(Debug, Clone)]
-pub struct Enum {
- pub path: Path,
- pub export_name: String,
- pub generic_params: GenericParams,
- pub repr: Repr,
- pub variants: Vec<EnumVariant>,
- pub tag: Option<String>,
- pub cfg: Option<Cfg>,
- pub annotations: AnnotationSet,
- pub documentation: Documentation,
-}
-
-impl Enum {
- /// Name of the generated tag enum.
- fn tag_name(&self) -> &str {
- self.tag.as_deref().unwrap_or_else(|| self.export_name())
- }
-
- /// Enum with data turns into a union of structs with each struct having its own tag field.
- fn inline_tag_field(repr: &Repr) -> bool {
- repr.style != ReprStyle::C
- }
-
- pub fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
- if self.generic_params.len() > 0 {
- return;
- }
-
- for v in &self.variants {
- v.add_monomorphs(library, out);
- }
- }
-
- fn can_derive_eq(&self) -> bool {
- if self.tag.is_none() {
- return false;
- }
-
- self.variants.iter().all(|variant| match variant.body {
- VariantBody::Empty(..) => true,
- VariantBody::Body { ref body, .. } => body.can_derive_eq(),
- })
- }
-
- pub fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
- for variant in &mut self.variants {
- variant.mangle_paths(monomorphs);
- }
- }
-
- pub fn load(
- item: &syn::ItemEnum,
- mod_cfg: Option<&Cfg>,
- config: &Config,
- ) -> Result<Enum, String> {
- let repr = Repr::load(&item.attrs)?;
- if repr.style == ReprStyle::Rust && repr.ty.is_none() {
- return Err("Enum is not marked with a valid #[repr(prim)] or #[repr(C)].".to_owned());
- }
- // TODO: Implement translation of aligned enums.
- if repr.align.is_some() {
- return Err("Enum is marked with #[repr(align(...))] or #[repr(packed)].".to_owned());
- }
-
- let path = Path::new(item.ident.unraw().to_string());
- let generic_params = GenericParams::load(&item.generics)?;
-
- let mut variants = Vec::new();
- let mut has_data = false;
-
- let annotations = AnnotationSet::load(&item.attrs)?;
-
- for variant in item.variants.iter() {
- let variant = EnumVariant::load(
- Self::inline_tag_field(&repr),
- variant,
- generic_params.clone(),
- mod_cfg,
- &path,
- &annotations,
- config,
- )?;
- has_data = has_data || !variant.body.is_empty();
- variants.push(variant);
- }
-
- if let Some(names) = annotations.list("enum-trailing-values") {
- for name in names {
- variants.push(EnumVariant::new(
- name,
- None,
- VariantBody::empty(),
- None,
- Documentation::none(),
- ));
- }
- }
-
- if config.enumeration.add_sentinel(&annotations) {
- variants.push(EnumVariant::new(
- "Sentinel".to_owned(),
- None,
- VariantBody::empty(),
- None,
- Documentation::simple(" Must be last for serialization purposes"),
- ));
- }
-
- let tag = if has_data {
- Some("Tag".to_string())
- } else {
- None
- };
-
- Ok(Enum::new(
- path,
- generic_params,
- repr,
- variants,
- tag,
- Cfg::append(mod_cfg, Cfg::load(&item.attrs)),
- annotations,
- Documentation::load(&item.attrs),
- ))
- }
-
- #[allow(clippy::too_many_arguments)]
- pub fn new(
- path: Path,
- generic_params: GenericParams,
- repr: Repr,
- variants: Vec<EnumVariant>,
- tag: Option<String>,
- cfg: Option<Cfg>,
- annotations: AnnotationSet,
- documentation: Documentation,
- ) -> Self {
- let export_name = path.name().to_owned();
- Self {
- path,
- export_name,
- generic_params,
- repr,
- variants,
- tag,
- cfg,
- annotations,
- documentation,
- }
- }
-}
-
-impl Item for Enum {
- fn path(&self) -> &Path {
- &self.path
- }
-
- fn export_name(&self) -> &str {
- &self.export_name
- }
-
- fn cfg(&self) -> Option<&Cfg> {
- self.cfg.as_ref()
- }
-
- fn annotations(&self) -> &AnnotationSet {
- &self.annotations
- }
-
- fn annotations_mut(&mut self) -> &mut AnnotationSet {
- &mut self.annotations
- }
-
- fn container(&self) -> ItemContainer {
- ItemContainer::Enum(self.clone())
- }
-
- fn collect_declaration_types(&self, resolver: &mut DeclarationTypeResolver) {
- if self.tag.is_some() {
- if self.repr.style == ReprStyle::C {
- resolver.add_struct(&self.path);
- } else {
- resolver.add_union(&self.path);
- }
- } else if self.repr.style == ReprStyle::C {
- resolver.add_enum(&self.path);
- } else {
- // This is important to handle conflicting names with opaque items.
- resolver.add_none(&self.path);
- }
- }
-
- fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
- for &mut ref mut var in &mut self.variants {
- var.resolve_declaration_types(resolver);
- }
- }
-
- fn rename_for_config(&mut self, config: &Config) {
- config.export.rename(&mut self.export_name);
-
- if config.language != Language::Cxx && self.tag.is_some() {
- // it makes sense to always prefix Tag with type name in C
- let new_tag = format!("{}_Tag", self.export_name);
- if self.repr.style == ReprStyle::Rust {
- for variant in &mut self.variants {
- if let VariantBody::Body { ref mut body, .. } = variant.body {
- let path = Path::new(new_tag.clone());
- let generic_path = GenericPath::new(path, vec![]);
- body.fields[0].ty = Type::Path(generic_path);
- }
- }
- }
- self.tag = Some(new_tag);
- }
-
- for variant in &mut self.variants {
- reserved::escape(&mut variant.export_name);
- if let Some(discriminant) = &mut variant.discriminant {
- discriminant.rename_for_config(config);
- }
- if let VariantBody::Body {
- ref mut name,
- ref mut body,
- ..
- } = variant.body
- {
- body.rename_for_config(config);
- reserved::escape(name);
- }
- }
-
- if config.enumeration.prefix_with_name
- || self.annotations.bool("prefix-with-name").unwrap_or(false)
- {
- let separator = if config.export.mangle.remove_underscores {
- ""
- } else {
- "_"
- };
-
- for variant in &mut self.variants {
- variant.export_name =
- format!("{}{}{}", self.export_name, separator, variant.export_name);
- if let VariantBody::Body { ref mut body, .. } = variant.body {
- body.export_name =
- format!("{}{}{}", self.export_name, separator, body.export_name());
- }
- }
- }
-
- let rules = self
- .annotations
- .parse_atom::<RenameRule>("rename-all")
- .unwrap_or(config.enumeration.rename_variants);
-
- if let Some(r) = rules.not_none() {
- self.variants = self
- .variants
- .iter()
- .map(|variant| {
- EnumVariant::new(
- r.apply(
- &variant.export_name,
- IdentifierType::EnumVariant {
- prefix: &self.export_name,
- },
- )
- .into_owned(),
- variant.discriminant.clone(),
- match variant.body {
- VariantBody::Empty(..) => variant.body.clone(),
- VariantBody::Body {
- ref name,
- ref body,
- inline,
- inline_casts,
- } => VariantBody::Body {
- name: r.apply(name, IdentifierType::StructMember).into_owned(),
- body: body.clone(),
- inline,
- inline_casts,
- },
- },
- variant.cfg.clone(),
- variant.documentation.clone(),
- )
- })
- .collect();
- }
- }
-
- fn instantiate_monomorph(
- &self,
- generic_values: &[GenericArgument],
- library: &Library,
- out: &mut Monomorphs,
- ) {
- let mappings = self.generic_params.call(self.path.name(), generic_values);
-
- for variant in &self.variants {
- if let VariantBody::Body { ref body, .. } = variant.body {
- body.instantiate_monomorph(generic_values, library, out);
- }
- }
-
- let mangled_path = mangle::mangle_path(
- &self.path,
- generic_values,
- &library.get_config().export.mangle,
- );
-
- let monomorph = Enum::new(
- mangled_path,
- GenericParams::default(),
- self.repr,
- self.variants
- .iter()
- .map(|v| v.specialize(generic_values, &mappings, library.get_config()))
- .collect(),
- self.tag.clone(),
- self.cfg.clone(),
- self.annotations.clone(),
- self.documentation.clone(),
- );
-
- out.insert_enum(library, self, monomorph, generic_values.to_owned());
- }
-
- fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
- for variant in &self.variants {
- variant.add_dependencies(library, out);
- }
- }
-}
-
-impl Source for Enum {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- let size = self.repr.ty.map(|ty| ty.to_primitive().to_repr_c(config));
- let has_data = self.tag.is_some();
- let inline_tag_field = Self::inline_tag_field(&self.repr);
- let tag_name = self.tag_name();
-
- let condition = self.cfg.to_condition(config);
- condition.write_before(config, out);
-
- self.documentation.write(config, out);
- self.generic_params.write(config, out);
-
- // If the enum has data, we need to emit a struct or union for the data
- // and enum for the tag. C++ supports nested type definitions, so we open
- // the struct or union here and define the tag enum inside it (*).
- if has_data && config.language == Language::Cxx {
- self.open_struct_or_union(config, out, inline_tag_field);
- }
-
- // Emit the tag enum and everything related to it.
- self.write_tag_enum(config, out, size, has_data, tag_name);
-
- // If the enum has data, we need to emit structs for the variants and gather them together.
- if has_data {
- self.write_variant_defs(config, out);
- out.new_line();
- out.new_line();
-
- // Open the struct or union for the data (**), gathering all the variants with data
- // together, unless it's C++, then we have already opened that struct/union at (*) and
- // are currently inside it.
- if config.language != Language::Cxx {
- self.open_struct_or_union(config, out, inline_tag_field);
- }
-
- // Emit tag field that is separate from all variants.
- self.write_tag_field(config, out, size, inline_tag_field, tag_name);
- out.new_line();
-
- // Open union of all variants with data, only in the non-inline tag scenario.
- // Cython extern declarations don't manage layouts, layouts are defined entierly by the
- // corresponding C code. So we can inline the unnamed union into the struct and get the
- // same observable result. Moreother we have to do it because Cython doesn't support
- // unnamed unions.
- if !inline_tag_field && config.language != Language::Cython {
- out.write("union");
- out.open_brace();
- }
-
- // Emit fields for all variants with data.
- self.write_variant_fields(config, out, inline_tag_field);
-
- // Close union of all variants with data, only in the non-inline tag scenario.
- // See the comment about Cython on `open_brace`.
- if !inline_tag_field && config.language != Language::Cython {
- out.close_brace(true);
- }
-
- // Emit convenience methods for the struct or enum for the data.
- self.write_derived_functions_data(config, out, tag_name);
-
- // Emit the post_body section, if relevant.
- if let Some(body) = config.export.post_body(&self.path) {
- out.new_line();
- out.write_raw_block(body);
- }
-
- // Close the struct or union opened either at (*) or at (**).
- if config.language == Language::C && config.style.generate_typedef() {
- out.close_brace(false);
- write!(out, " {};", self.export_name);
- } else {
- out.close_brace(true);
- }
- }
-
- condition.write_after(config, out);
- }
-}
-
-impl Enum {
- /// Emit the tag enum and convenience methods for it.
- /// For enums with data this is only a part of the output,
- /// but for enums without data it's the whole output (modulo doc comments etc.).
- fn write_tag_enum<F: Write>(
- &self,
- config: &Config,
- out: &mut SourceWriter<F>,
- size: Option<&str>,
- has_data: bool,
- tag_name: &str,
- ) {
- // Open the tag enum.
- match config.language {
- Language::C => {
- if let Some(prim) = size {
- // If we need to specify size, then we have no choice but to create a typedef,
- // so `config.style` is not respected.
- write!(out, "enum {}", tag_name);
-
- if config.cpp_compatible_c() {
- out.new_line();
- out.write("#ifdef __cplusplus");
- out.new_line();
- write!(out, " : {}", prim);
- out.new_line();
- out.write("#endif // __cplusplus");
- out.new_line();
- }
- } else {
- if config.style.generate_typedef() {
- out.write("typedef ");
- }
- out.write("enum");
- if config.style.generate_tag() {
- write!(out, " {}", tag_name);
- }
- }
- }
- Language::Cxx => {
- if config.enumeration.enum_class(&self.annotations) {
- out.write("enum class");
- } else {
- out.write("enum");
- }
-
- if self.annotations.must_use(config) {
- if let Some(ref anno) = config.enumeration.must_use {
- write!(out, " {}", anno)
- }
- }
-
- write!(out, " {}", tag_name);
- if let Some(prim) = size {
- write!(out, " : {}", prim);
- }
- }
- Language::Cython => {
- if size.is_some() {
- // If we need to specify size, then we have no choice but to create a typedef,
- // so `config.style` is not respected.
- write!(out, "cdef enum");
- } else {
- write!(out, "{}enum {}", config.style.cython_def(), tag_name);
- }
- }
- }
- out.open_brace();
-
- // Emit enumerators for the tag enum.
- for (i, variant) in self.variants.iter().enumerate() {
- if i != 0 {
- out.new_line()
- }
- variant.write(config, out);
- }
-
- // Close the tag enum.
- if config.language == Language::C && size.is_none() && config.style.generate_typedef() {
- out.close_brace(false);
- write!(out, " {};", tag_name);
- } else {
- out.close_brace(true);
- }
-
- // Emit typedef specifying the tag enum's size if necessary.
- // In C++ enums can "inherit" from numeric types (`enum E: uint8_t { ... }`),
- // but in C `typedef uint8_t E` is the only way to give a fixed size to `E`.
- if let Some(prim) = size {
- if config.cpp_compatible_c() {
- out.new_line_if_not_start();
- out.write("#ifndef __cplusplus");
- }
-
- if config.language != Language::Cxx {
- out.new_line();
- write!(out, "{} {} {};", config.language.typedef(), prim, tag_name);
- }
-
- if config.cpp_compatible_c() {
- out.new_line_if_not_start();
- out.write("#endif // __cplusplus");
- }
- }
-
- // Emit convenience methods for the tag enum.
- self.write_derived_functions_enum(config, out, has_data, tag_name);
- }
-
- /// The code here mirrors the beginning of `Struct::write` and `Union::write`.
- fn open_struct_or_union<F: Write>(
- &self,
- config: &Config,
- out: &mut SourceWriter<F>,
- inline_tag_field: bool,
- ) {
- match config.language {
- Language::C if config.style.generate_typedef() => out.write("typedef "),
- Language::C | Language::Cxx => {}
- Language::Cython => out.write(config.style.cython_def()),
- }
-
- out.write(if inline_tag_field { "union" } else { "struct" });
-
- if self.annotations.must_use(config) {
- if let Some(ref anno) = config.structure.must_use {
- write!(out, " {}", anno);
- }
- }
-
- if config.language != Language::C || config.style.generate_tag() {
- write!(out, " {}", self.export_name());
- }
-
- out.open_brace();
-
- // Emit the pre_body section, if relevant.
- if let Some(body) = config.export.pre_body(&self.path) {
- out.write_raw_block(body);
- out.new_line();
- }
- }
-
- /// Emit struct definitions for variants having data.
- fn write_variant_defs<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- for variant in &self.variants {
- if let VariantBody::Body {
- ref body,
- inline: false,
- ..
- } = variant.body
- {
- out.new_line();
- out.new_line();
- let condition = variant.cfg.to_condition(config);
- // Cython doesn't support conditional enum variants.
- if config.language != Language::Cython {
- condition.write_before(config, out);
- }
- body.write(config, out);
- if config.language != Language::Cython {
- condition.write_after(config, out);
- }
- }
- }
- }
-
- /// Emit tag field that is separate from all variants.
- /// For non-inline tag scenario this is *the* tag field, and it does not exist in the variants.
- /// For the inline tag scenario this is just a convenience and another way
- /// to refer to the same tag that exist in all the variants.
- fn write_tag_field<F: Write>(
- &self,
- config: &Config,
- out: &mut SourceWriter<F>,
- size: Option<&str>,
- inline_tag_field: bool,
- tag_name: &str,
- ) {
- // C++ allows accessing only common initial sequence of union
- // fields so we have to wrap the tag field into an anonymous struct.
- let wrap_tag = inline_tag_field && config.language == Language::Cxx;
-
- if wrap_tag {
- out.write("struct");
- out.open_brace();
- }
-
- if config.language == Language::C && size.is_none() && !config.style.generate_typedef() {
- out.write("enum ");
- }
-
- write!(out, "{} tag;", tag_name);
-
- if wrap_tag {
- out.close_brace(true);
- }
- }
-
- /// Emit fields for all variants with data.
- fn write_variant_fields<F: Write>(
- &self,
- config: &Config,
- out: &mut SourceWriter<F>,
- inline_tag_field: bool,
- ) {
- let mut first = true;
- for variant in &self.variants {
- if let VariantBody::Body {
- name, body, inline, ..
- } = &variant.body
- {
- if !first {
- out.new_line();
- }
- first = false;
- let condition = variant.cfg.to_condition(config);
- // Cython doesn't support conditional enum variants.
- if config.language != Language::Cython {
- condition.write_before(config, out);
- }
- if *inline {
- // Write definition of an inlined variant with data.
- // Cython extern declarations don't manage layouts, layouts are defined entierly
- // by the corresponding C code. So we can inline the unnamed struct and get the
- // same observable result. Moreother we have to do it because Cython doesn't
- // support unnamed structs.
- // For the same reason with Cython we can omit per-variant tags (the first
- // field) to avoid extra noise, the main `tag` is enough in this case.
- if config.language != Language::Cython {
- out.write("struct");
- out.open_brace();
- }
- let start_field =
- usize::from(inline_tag_field && config.language == Language::Cython);
- out.write_vertical_source_list(&body.fields[start_field..], ListType::Cap(";"));
- if config.language != Language::Cython {
- out.close_brace(true);
- }
- } else if config.style.generate_typedef() || config.language == Language::Cython {
- write!(out, "{} {};", body.export_name(), name);
- } else {
- write!(out, "struct {} {};", body.export_name(), name);
- }
- if config.language != Language::Cython {
- condition.write_after(config, out);
- }
- }
- }
- }
-
- // Emit convenience methods for enums themselves.
- fn write_derived_functions_enum<F: Write>(
- &self,
- config: &Config,
- out: &mut SourceWriter<F>,
- has_data: bool,
- tag_name: &str,
- ) {
- if config.language != Language::Cxx {
- return;
- }
-
- // Emit an ostream function if required.
- if config.enumeration.derive_ostream(&self.annotations) {
- // For enums without data, this emits the serializer function for the
- // enum. For enums with data, this emits the serializer function for
- // the tag enum. In the latter case we need a couple of minor changes
- // due to the function living inside the top-level struct or enum.
- let stream = config
- .function
- .rename_args
- .apply("stream", IdentifierType::FunctionArg);
- let instance = config
- .function
- .rename_args
- .apply("instance", IdentifierType::FunctionArg);
-
- out.new_line();
- out.new_line();
- // For enums without data, we mark the function inline because the
- // header might get included into multiple compilation units that
- // get linked together, and not marking it inline would result in
- // multiply-defined symbol errors. For enums with data we don't have
- // the same problem, but mark it as a friend function of the
- // containing union/struct.
- // Note also that for enums with data, the case labels for switch
- // statements apparently need to be qualified to the top-level
- // generated struct or union. This is why the generated case labels
- // below use the A::B::C format for enums with data, with A being
- // self.export_name(). Failure to have that qualification results
- // in a surprising compilation failure for the generated header.
- write!(
- out,
- "{} std::ostream& operator<<(std::ostream& {}, const {}& {})",
- if has_data { "friend" } else { "inline" },
- stream,
- tag_name,
- instance,
- );
-
- out.open_brace();
- if has_data {
- // C++ name resolution rules are weird.
- write!(
- out,
- "using {} = {}::{};",
- tag_name,
- self.export_name(),
- tag_name
- );
- out.new_line();
- }
- write!(out, "switch ({})", instance);
- out.open_brace();
- let vec: Vec<_> = self
- .variants
- .iter()
- .map(|x| {
- format!(
- "case {}::{}: {} << \"{}\"; break;",
- tag_name, x.export_name, stream, x.export_name
- )
- })
- .collect();
- out.write_vertical_source_list(&vec[..], ListType::Join(""));
- out.close_brace(false);
- out.new_line();
-
- write!(out, "return {};", stream);
- out.close_brace(false);
-
- if has_data {
- // For enums with data, this emits the serializer function for
- // the top-level union or struct.
- out.new_line();
- out.new_line();
- write!(
- out,
- "friend std::ostream& operator<<(std::ostream& {}, const {}& {})",
- stream,
- self.export_name(),
- instance,
- );
-
- out.open_brace();
-
- // C++ name resolution rules are weird.
- write!(
- out,
- "using {} = {}::{};",
- tag_name,
- self.export_name(),
- tag_name
- );
- out.new_line();
-
- write!(out, "switch ({}.tag)", instance);
- out.open_brace();
- let vec: Vec<_> = self
- .variants
- .iter()
- .map(|x| {
- let tag_str = format!("\"{}\"", x.export_name);
- if let VariantBody::Body {
- ref name, ref body, ..
- } = x.body
- {
- format!(
- "case {}::{}: {} << {}{}{}.{}; break;",
- tag_name,
- x.export_name,
- stream,
- if body.has_tag_field { "" } else { &tag_str },
- if body.has_tag_field { "" } else { " << " },
- instance,
- name,
- )
- } else {
- format!(
- "case {}::{}: {} << {}; break;",
- tag_name, x.export_name, stream, tag_str,
- )
- }
- })
- .collect();
- out.write_vertical_source_list(&vec[..], ListType::Join(""));
- out.close_brace(false);
- out.new_line();
-
- write!(out, "return {};", stream);
- out.close_brace(false);
- }
- }
- }
-
- // Emit convenience methods for structs or unions produced for enums with data.
- fn write_derived_functions_data<F: Write>(
- &self,
- config: &Config,
- out: &mut SourceWriter<F>,
- tag_name: &str,
- ) {
- if config.language != Language::Cxx {
- return;
- }
-
- if config.enumeration.derive_helper_methods(&self.annotations) {
- for variant in &self.variants {
- out.new_line();
- out.new_line();
-
- let condition = variant.cfg.to_condition(config);
- condition.write_before(config, out);
-
- let arg_renamer = |name: &str| {
- config
- .function
- .rename_args
- .apply(name, IdentifierType::FunctionArg)
- .into_owned()
- };
-
- macro_rules! write_attrs {
- ($op:expr) => {{
- if let Some(Some(attrs)) =
- variant
- .body
- .annotations()
- .atom(concat!("variant-", $op, "-attributes"))
- {
- write!(out, "{} ", attrs);
- }
- }};
- }
-
- write_attrs!("constructor");
- write!(out, "static {} {}(", self.export_name, variant.export_name);
-
- if let VariantBody::Body { ref body, .. } = variant.body {
- let skip_fields = body.has_tag_field as usize;
- let vec: Vec<_> = body
- .fields
- .iter()
- .skip(skip_fields)
- .map(|field| {
- Field::from_name_and_type(
- // const-ref args to constructor
- arg_renamer(&field.name),
- Type::const_ref_to(&field.ty),
- )
- })
- .collect();
- out.write_vertical_source_list(&vec[..], ListType::Join(","));
- }
-
- write!(out, ")");
- out.open_brace();
-
- write!(out, "{} result;", self.export_name);
-
- if let VariantBody::Body {
- name: ref variant_name,
- ref body,
- ..
- } = variant.body
- {
- let skip_fields = body.has_tag_field as usize;
- for field in body.fields.iter().skip(skip_fields) {
- out.new_line();
- match field.ty {
- Type::Array(ref ty, ref length) => {
- // arrays are not assignable in C++ so we
- // need to manually copy the elements
- write!(out, "for (int i = 0; i < {}; i++)", length.as_str());
- out.open_brace();
- write!(out, "::new (&result.{}.{}[i]) (", variant_name, field.name);
- ty.write(config, out);
- write!(out, ")({}[i]);", arg_renamer(&field.name));
- out.close_brace(false);
- }
- ref ty => {
- write!(out, "::new (&result.{}.{}) (", variant_name, field.name);
- ty.write(config, out);
- write!(out, ")({});", arg_renamer(&field.name));
- }
- }
- }
- }
-
- out.new_line();
- write!(out, "result.tag = {}::{};", tag_name, variant.export_name);
- out.new_line();
- write!(out, "return result;");
- out.close_brace(false);
-
- out.new_line();
- out.new_line();
-
- write_attrs!("is");
- // FIXME: create a config for method case
- write!(out, "bool Is{}() const", variant.export_name);
- out.open_brace();
- write!(out, "return tag == {}::{};", tag_name, variant.export_name);
- out.close_brace(false);
-
- let assert_name = match config.enumeration.cast_assert_name {
- Some(ref n) => &**n,
- None => "assert",
- };
-
- let mut derive_casts = |const_casts: bool| {
- let (member_name, body, inline_casts) = match variant.body {
- VariantBody::Body {
- ref name,
- ref body,
- inline_casts,
- ..
- } => (name, body, inline_casts),
- VariantBody::Empty(..) => return,
- };
-
- let skip_fields = body.has_tag_field as usize;
- let field_count = body.fields.len() - skip_fields;
- if field_count == 0 {
- return;
- }
-
- out.new_line();
- out.new_line();
-
- if const_casts {
- write_attrs!("const-cast");
- } else {
- write_attrs!("mut-cast");
- }
- if inline_casts {
- let field = body.fields.last().unwrap();
- let return_type = field.ty.clone();
- let return_type = Type::Ptr {
- ty: Box::new(return_type),
- is_const: const_casts,
- is_ref: true,
- is_nullable: false,
- };
- return_type.write(config, out);
- } else if const_casts {
- write!(out, "const {}&", body.export_name());
- } else {
- write!(out, "{}&", body.export_name());
- }
-
- write!(out, " As{}()", variant.export_name);
- if const_casts {
- write!(out, " const");
- }
- out.open_brace();
- write!(out, "{}(Is{}());", assert_name, variant.export_name);
- out.new_line();
- write!(out, "return {}", member_name);
- if inline_casts {
- write!(out, "._0");
- }
- write!(out, ";");
- out.close_brace(false);
- };
-
- if config.enumeration.derive_const_casts(&self.annotations) {
- derive_casts(true)
- }
-
- if config.enumeration.derive_mut_casts(&self.annotations) {
- derive_casts(false)
- }
-
- condition.write_after(config, out);
- }
- }
-
- let other = config
- .function
- .rename_args
- .apply("other", IdentifierType::FunctionArg);
-
- macro_rules! write_attrs {
- ($op:expr) => {{
- if let Some(Some(attrs)) = self.annotations.atom(concat!($op, "-attributes")) {
- write!(out, "{} ", attrs);
- }
- }};
- }
-
- if self.can_derive_eq() && config.structure.derive_eq(&self.annotations) {
- out.new_line();
- out.new_line();
- write_attrs!("eq");
- write!(
- out,
- "bool operator==(const {}& {}) const",
- self.export_name, other
- );
- out.open_brace();
- write!(out, "if (tag != {}.tag)", other);
- out.open_brace();
- write!(out, "return false;");
- out.close_brace(false);
- out.new_line();
- write!(out, "switch (tag)");
- out.open_brace();
- let mut exhaustive = true;
- for variant in &self.variants {
- if let VariantBody::Body {
- name: ref variant_name,
- ..
- } = variant.body
- {
- let condition = variant.cfg.to_condition(config);
- condition.write_before(config, out);
- write!(
- out,
- "case {}::{}: return {} == {}.{};",
- self.tag.as_ref().unwrap(),
- variant.export_name,
- variant_name,
- other,
- variant_name
- );
- condition.write_after(config, out);
- out.new_line();
- } else {
- exhaustive = false;
- }
- }
- if !exhaustive {
- write!(out, "default: break;");
- }
- out.close_brace(false);
-
- out.new_line();
- write!(out, "return true;");
-
- out.close_brace(false);
-
- if config.structure.derive_neq(&self.annotations) {
- out.new_line();
- out.new_line();
- write_attrs!("neq");
- write!(
- out,
- "bool operator!=(const {}& {}) const",
- self.export_name, other
- );
- out.open_brace();
- write!(out, "return !(*this == {});", other);
- out.close_brace(false);
- }
- }
-
- if config
- .enumeration
- .private_default_tagged_enum_constructor(&self.annotations)
- {
- out.new_line();
- out.new_line();
- write!(out, "private:");
- out.new_line();
- write!(out, "{}()", self.export_name);
- out.open_brace();
- out.close_brace(false);
- out.new_line();
- write!(out, "public:");
- out.new_line();
- }
-
- if config
- .enumeration
- .derive_tagged_enum_destructor(&self.annotations)
- {
- out.new_line();
- out.new_line();
- write_attrs!("destructor");
- write!(out, "~{}()", self.export_name);
- out.open_brace();
- write!(out, "switch (tag)");
- out.open_brace();
- let mut exhaustive = true;
- for variant in &self.variants {
- if let VariantBody::Body {
- ref name, ref body, ..
- } = variant.body
- {
- let condition = variant.cfg.to_condition(config);
- condition.write_before(config, out);
- write!(
- out,
- "case {}::{}: {}.~{}(); break;",
- self.tag.as_ref().unwrap(),
- variant.export_name,
- name,
- body.export_name(),
- );
- condition.write_after(config, out);
- out.new_line();
- } else {
- exhaustive = false;
- }
- }
- if !exhaustive {
- write!(out, "default: break;");
- }
- out.close_brace(false);
- out.close_brace(false);
- }
-
- if config
- .enumeration
- .derive_tagged_enum_copy_constructor(&self.annotations)
- {
- out.new_line();
- out.new_line();
- write_attrs!("copy-constructor");
- write!(
- out,
- "{}(const {}& {})",
- self.export_name, self.export_name, other
- );
- out.new_line();
- write!(out, " : tag({}.tag)", other);
- out.open_brace();
- write!(out, "switch (tag)");
- out.open_brace();
- let mut exhaustive = true;
- for variant in &self.variants {
- if let VariantBody::Body {
- ref name, ref body, ..
- } = variant.body
- {
- let condition = variant.cfg.to_condition(config);
- condition.write_before(config, out);
- write!(
- out,
- "case {}::{}: ::new (&{}) ({})({}.{}); break;",
- self.tag.as_ref().unwrap(),
- variant.export_name,
- name,
- body.export_name(),
- other,
- name,
- );
- condition.write_after(config, out);
- out.new_line();
- } else {
- exhaustive = false;
- }
- }
- if !exhaustive {
- write!(out, "default: break;");
- }
- out.close_brace(false);
- out.close_brace(false);
-
- if config
- .enumeration
- .derive_tagged_enum_copy_assignment(&self.annotations)
- {
- out.new_line();
- write_attrs!("copy-assignment");
- write!(
- out,
- "{}& operator=(const {}& {})",
- self.export_name, self.export_name, other
- );
- out.open_brace();
- write!(out, "if (this != &{})", other);
- out.open_brace();
- write!(out, "this->~{}();", self.export_name);
- out.new_line();
- write!(out, "new (this) {}({});", self.export_name, other);
- out.close_brace(false);
- out.new_line();
- write!(out, "return *this;");
- out.close_brace(false);
- }
- }
- }
-
- pub fn simplify_standard_types(&mut self, config: &Config) {
- for variant in &mut self.variants {
- variant.simplify_standard_types(config);
- }
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/field.rs b/cbindgen-0.24.5/src/bindgen/ir/field.rs
deleted file mode 100644
index 6e132bf..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/field.rs
+++ /dev/null
@@ -1,80 +0,0 @@
-use std::io::Write;
-
-use syn::ext::IdentExt;
-
-use crate::bindgen::cdecl;
-use crate::bindgen::config::{Config, Language};
-use crate::bindgen::ir::{AnnotationSet, Cfg, ConditionWrite};
-use crate::bindgen::ir::{Documentation, Path, ToCondition, Type};
-use crate::bindgen::writer::{Source, SourceWriter};
-
-#[derive(Debug, Clone)]
-pub struct Field {
- pub name: String,
- pub ty: Type,
- pub cfg: Option<Cfg>,
- pub annotations: AnnotationSet,
- pub documentation: Documentation,
-}
-
-impl Field {
- pub fn from_name_and_type(name: String, ty: Type) -> Field {
- Field {
- name,
- ty,
- cfg: None,
- annotations: AnnotationSet::new(),
- documentation: Documentation::none(),
- }
- }
-
- pub fn load(field: &syn::Field, self_path: &Path) -> Result<Option<Field>, String> {
- Ok(if let Some(mut ty) = Type::load(&field.ty)? {
- ty.replace_self_with(self_path);
- Some(Field {
- name: field
- .ident
- .as_ref()
- .ok_or_else(|| "field is missing identifier".to_string())?
- .unraw()
- .to_string(),
- ty,
- cfg: Cfg::load(&field.attrs),
- annotations: AnnotationSet::load(&field.attrs)?,
- documentation: Documentation::load(&field.attrs),
- })
- } else {
- None
- })
- }
-}
-
-impl Source for Field {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- // Cython doesn't support conditional fields.
- let condition = self.cfg.to_condition(config);
- if config.language != Language::Cython {
- condition.write_before(config, out);
- }
-
- self.documentation.write(config, out);
- cdecl::write_field(out, &self.ty, &self.name, config);
- // Cython extern declarations don't manage layouts, layouts are defined entierly by the
- // corresponding C code. So we can omit bitfield sizes which are not supported by Cython.
- if config.language != Language::Cython {
- if let Some(bitfield) = self.annotations.atom("bitfield") {
- write!(out, ": {}", bitfield.unwrap_or_default());
- }
- }
-
- if config.language != Language::Cython {
- condition.write_after(config, out);
- // FIXME(#634): `write_vertical_source_list` should support
- // configuring list elements natively. For now we print a newline
- // here to avoid printing `#endif;` with semicolon.
- if condition.is_some() {
- out.new_line();
- }
- }
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/function.rs b/cbindgen-0.24.5/src/bindgen/ir/function.rs
deleted file mode 100644
index da09207..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/function.rs
+++ /dev/null
@@ -1,376 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::collections::HashMap;
-use std::io::Write;
-
-use syn::ext::IdentExt;
-
-use crate::bindgen::cdecl;
-use crate::bindgen::config::{Config, Language, Layout};
-use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
-use crate::bindgen::dependencies::Dependencies;
-use crate::bindgen::ir::{
- AnnotationSet, Cfg, ConditionWrite, Documentation, GenericPath, Path, ToCondition, Type,
-};
-use crate::bindgen::library::Library;
-use crate::bindgen::monomorph::Monomorphs;
-use crate::bindgen::rename::{IdentifierType, RenameRule};
-use crate::bindgen::reserved;
-use crate::bindgen::utilities::IterHelpers;
-use crate::bindgen::writer::{Source, SourceWriter};
-
-#[derive(Debug, Clone)]
-pub struct FunctionArgument {
- pub name: Option<String>,
- pub ty: Type,
- pub array_length: Option<String>,
-}
-
-#[derive(Debug, Clone)]
-pub struct Function {
- pub path: Path,
- /// Path to the self-type of the function
- /// If the function is a method, this will contain the path of the type in the impl block
- pub self_type_path: Option<Path>,
- pub ret: Type,
- pub args: Vec<FunctionArgument>,
- pub extern_decl: bool,
- pub cfg: Option<Cfg>,
- pub annotations: AnnotationSet,
- pub documentation: Documentation,
- pub never_return: bool,
-}
-
-impl Function {
- pub fn load(
- path: Path,
- self_type_path: Option<&Path>,
- sig: &syn::Signature,
- extern_decl: bool,
- attrs: &[syn::Attribute],
- mod_cfg: Option<&Cfg>,
- ) -> Result<Function, String> {
- let mut args = sig.inputs.iter().try_skip_map(|x| x.as_argument())?;
-
- let (mut ret, never_return) = Type::load_from_output(&sig.output)?;
-
- if let Some(self_path) = self_type_path {
- for arg in &mut args {
- arg.ty.replace_self_with(self_path);
- }
- ret.replace_self_with(self_path);
- }
-
- Ok(Function {
- path,
- self_type_path: self_type_path.cloned(),
- ret,
- args,
- extern_decl,
- cfg: Cfg::append(mod_cfg, Cfg::load(attrs)),
- annotations: AnnotationSet::load(attrs)?,
- documentation: Documentation::load(attrs),
- never_return,
- })
- }
-
- pub fn swift_name(&self, config: &Config) -> Option<String> {
- if config.language == Language::Cython {
- return None;
- }
- // If the symbol name starts with the type name, separate the two components with '.'
- // so that Swift recognises the association between the method and the type
- let (ref type_prefix, ref type_name) = match self.self_type_path {
- Some(ref type_name) => {
- let type_name = type_name.to_string();
- if !self.path.name().starts_with(&type_name) {
- return Some(self.path.to_string());
- }
- (format!("{}.", type_name), type_name)
- }
- None => ("".to_string(), "".to_string()),
- };
-
- let item_name = self
- .path
- .name()
- .trim_start_matches(type_name)
- .trim_start_matches('_');
-
- let item_args = {
- let mut items = Vec::with_capacity(self.args.len());
- for arg in self.args.iter() {
- items.push(format!("{}:", arg.name.as_ref()?.as_str()));
- }
- items.join("")
- };
- Some(format!("{}{}({})", type_prefix, item_name, item_args))
- }
-
- pub fn path(&self) -> &Path {
- &self.path
- }
-
- pub fn simplify_standard_types(&mut self, config: &Config) {
- self.ret.simplify_standard_types(config);
- for arg in &mut self.args {
- arg.ty.simplify_standard_types(config);
- }
- }
-
- pub fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
- self.ret.add_dependencies(library, out);
- for arg in &self.args {
- arg.ty.add_dependencies(library, out);
- }
- }
-
- pub fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
- self.ret.add_monomorphs(library, out);
- for arg in &self.args {
- arg.ty.add_monomorphs(library, out);
- }
- }
-
- pub fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
- self.ret.mangle_paths(monomorphs);
- for arg in &mut self.args {
- arg.ty.mangle_paths(monomorphs);
- }
- }
-
- pub fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
- self.ret.resolve_declaration_types(resolver);
- for arg in &mut self.args {
- arg.ty.resolve_declaration_types(resolver);
- }
- }
-
- pub fn rename_for_config(&mut self, config: &Config) {
- // Rename the types used in arguments
- let generic_params = Default::default();
- self.ret.rename_for_config(config, &generic_params);
-
- // Apply rename rules to argument names
- let rules = self
- .annotations
- .parse_atom::<RenameRule>("rename-all")
- .unwrap_or(config.function.rename_args);
-
- if let Some(r) = rules.not_none() {
- let args = std::mem::take(&mut self.args);
- self.args = args
- .into_iter()
- .map(|arg| {
- let name = arg
- .name
- .map(|n| r.apply(&n, IdentifierType::FunctionArg).into_owned());
- FunctionArgument {
- name,
- ty: arg.ty,
- array_length: None,
- }
- })
- .collect()
- }
-
- // Escape C/C++ reserved keywords used in argument names, and
- // recursively rename argument types.
- for arg in &mut self.args {
- arg.ty.rename_for_config(config, &generic_params);
- if let Some(ref mut name) = arg.name {
- reserved::escape(name);
- }
- }
-
- // Save the array length of the pointer arguments which need to use
- // the C-array notation
- if let Some(tuples) = self.annotations.list("ptrs-as-arrays") {
- let mut ptrs_as_arrays: HashMap<String, String> = HashMap::new();
- for str_tuple in tuples {
- let parts: Vec<&str> = str_tuple[1..str_tuple.len() - 1]
- .split(';')
- .map(|x| x.trim())
- .collect();
- if parts.len() != 2 {
- warn!(
- "{:?} does not follow the correct syntax, so the annotation is being ignored",
- parts
- );
- continue;
- }
- ptrs_as_arrays.insert(parts[0].to_string(), parts[1].to_string());
- }
-
- for arg in &mut self.args {
- match arg.ty {
- Type::Ptr { .. } => {}
- _ => continue,
- }
- let name = match arg.name {
- Some(ref name) => name,
- None => continue,
- };
- arg.array_length = ptrs_as_arrays.get(name).cloned();
- }
- }
- }
-}
-
-impl Source for Function {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- fn write_1<W: Write>(func: &Function, config: &Config, out: &mut SourceWriter<W>) {
- let prefix = config.function.prefix(&func.annotations);
- let postfix = config.function.postfix(&func.annotations);
-
- let condition = func.cfg.to_condition(config);
- condition.write_before(config, out);
-
- func.documentation.write(config, out);
-
- if func.extern_decl {
- out.write("extern ");
- } else {
- if let Some(ref prefix) = prefix {
- write!(out, "{} ", prefix);
- }
- if func.annotations.must_use(config) {
- if let Some(ref anno) = config.function.must_use {
- write!(out, "{} ", anno);
- }
- }
- }
- cdecl::write_func(out, func, Layout::Horizontal, config);
-
- if !func.extern_decl {
- if let Some(ref postfix) = postfix {
- write!(out, " {}", postfix);
- }
- }
-
- if let Some(ref swift_name_macro) = config.function.swift_name_macro {
- if let Some(swift_name) = func.swift_name(config) {
- write!(out, " {}({})", swift_name_macro, swift_name);
- }
- }
-
- out.write(";");
-
- condition.write_after(config, out);
- }
-
- fn write_2<W: Write>(func: &Function, config: &Config, out: &mut SourceWriter<W>) {
- let prefix = config.function.prefix(&func.annotations);
- let postfix = config.function.postfix(&func.annotations);
-
- let condition = func.cfg.to_condition(config);
-
- condition.write_before(config, out);
-
- func.documentation.write(config, out);
-
- if func.extern_decl {
- out.write("extern ");
- } else {
- if let Some(ref prefix) = prefix {
- write!(out, "{}", prefix);
- out.new_line();
- }
- if func.annotations.must_use(config) {
- if let Some(ref anno) = config.function.must_use {
- write!(out, "{}", anno);
- out.new_line();
- }
- }
- }
- cdecl::write_func(out, func, Layout::Vertical, config);
- if !func.extern_decl {
- if let Some(ref postfix) = postfix {
- out.new_line();
- write!(out, "{}", postfix);
- }
- }
-
- if let Some(ref swift_name_macro) = config.function.swift_name_macro {
- if let Some(swift_name) = func.swift_name(config) {
- write!(out, " {}({})", swift_name_macro, swift_name);
- }
- }
-
- out.write(";");
-
- condition.write_after(config, out);
- }
-
- match config.function.args {
- Layout::Horizontal => write_1(self, config, out),
- Layout::Vertical => write_2(self, config, out),
- Layout::Auto => {
- if !out.try_write(|out| write_1(self, config, out), config.line_length) {
- write_2(self, config, out)
- }
- }
- }
- }
-}
-
-trait SynFnArgHelpers {
- fn as_argument(&self) -> Result<Option<FunctionArgument>, String>;
-}
-
-fn gen_self_type(receiver: &syn::Receiver) -> Type {
- let self_ty = Type::Path(GenericPath::self_path());
- if receiver.reference.is_none() {
- return self_ty;
- }
-
- let is_const = receiver.mutability.is_none();
- Type::Ptr {
- ty: Box::new(self_ty),
- is_const,
- is_nullable: false,
- is_ref: false,
- }
-}
-
-impl SynFnArgHelpers for syn::FnArg {
- fn as_argument(&self) -> Result<Option<FunctionArgument>, String> {
- match *self {
- syn::FnArg::Typed(syn::PatType {
- ref pat, ref ty, ..
- }) => {
- let name = match **pat {
- syn::Pat::Wild(..) => None,
- syn::Pat::Ident(syn::PatIdent { ref ident, .. }) => {
- Some(ident.unraw().to_string())
- }
- _ => {
- return Err(format!(
- "Parameter has an unsupported argument name: {:?}",
- pat
- ))
- }
- };
- let ty = match Type::load(ty)? {
- Some(x) => x,
- None => return Ok(None),
- };
- if let Type::Array(..) = ty {
- return Err("Array as function arguments are not supported".to_owned());
- }
- Ok(Some(FunctionArgument {
- name,
- ty,
- array_length: None,
- }))
- }
- syn::FnArg::Receiver(ref receiver) => Ok(Some(FunctionArgument {
- name: Some("self".to_string()),
- ty: gen_self_type(receiver),
- array_length: None,
- })),
- }
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/generic_path.rs b/cbindgen-0.24.5/src/bindgen/ir/generic_path.rs
deleted file mode 100644
index ef14890..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/generic_path.rs
+++ /dev/null
@@ -1,303 +0,0 @@
-use std::io::Write;
-use std::ops::Deref;
-
-use syn::ext::IdentExt;
-
-use crate::bindgen::cdecl;
-use crate::bindgen::config::{Config, Language};
-use crate::bindgen::declarationtyperesolver::{DeclarationType, DeclarationTypeResolver};
-use crate::bindgen::ir::{ConstExpr, Path, Type};
-use crate::bindgen::utilities::IterHelpers;
-use crate::bindgen::writer::{Source, SourceWriter};
-
-#[derive(Debug, Clone)]
-pub enum GenericParamType {
- Type,
- Const(Type),
-}
-
-#[derive(Debug, Clone)]
-pub struct GenericParam {
- name: Path,
- ty: GenericParamType,
-}
-
-impl GenericParam {
- pub fn new_type_param(name: &str) -> Self {
- GenericParam {
- name: Path::new(name),
- ty: GenericParamType::Type,
- }
- }
-
- pub fn load(param: &syn::GenericParam) -> Result<Option<Self>, String> {
- match *param {
- syn::GenericParam::Type(syn::TypeParam { ref ident, .. }) => Ok(Some(GenericParam {
- name: Path::new(ident.unraw().to_string()),
- ty: GenericParamType::Type,
- })),
-
- syn::GenericParam::Lifetime(_) => Ok(None),
-
- syn::GenericParam::Const(syn::ConstParam {
- ref ident, ref ty, ..
- }) => match Type::load(ty)? {
- None => {
- // A type that evaporates, like PhantomData.
- Err(format!("unsupported const generic type: {:?}", ty))
- }
- Some(ty) => Ok(Some(GenericParam {
- name: Path::new(ident.unraw().to_string()),
- ty: GenericParamType::Const(ty),
- })),
- },
- }
- }
-
- pub fn name(&self) -> &Path {
- &self.name
- }
-}
-
-#[derive(Default, Debug, Clone)]
-pub struct GenericParams(pub Vec<GenericParam>);
-
-impl GenericParams {
- pub fn load(generics: &syn::Generics) -> Result<Self, String> {
- let mut params = vec![];
- for param in &generics.params {
- if let Some(p) = GenericParam::load(param)? {
- params.push(p);
- }
- }
-
- Ok(GenericParams(params))
- }
-
- /// Associate each parameter with an argument.
- pub fn call<'out>(
- &'out self,
- item_name: &str,
- arguments: &'out [GenericArgument],
- ) -> Vec<(&'out Path, &'out GenericArgument)> {
- assert!(self.len() > 0, "{} is not generic", item_name);
- assert!(
- self.len() == arguments.len(),
- "{} has {} params but is being instantiated with {} values",
- item_name,
- self.len(),
- arguments.len(),
- );
- self.iter()
- .map(|param| param.name())
- .zip(arguments.iter())
- .collect()
- }
-
- fn write_internal<F: Write>(
- &self,
- config: &Config,
- out: &mut SourceWriter<F>,
- with_default: bool,
- ) {
- if !self.0.is_empty() && config.language == Language::Cxx {
- out.write("template<");
- for (i, item) in self.0.iter().enumerate() {
- if i != 0 {
- out.write(", ");
- }
- match item.ty {
- GenericParamType::Type => {
- write!(out, "typename {}", item.name);
- if with_default {
- write!(out, " = void");
- }
- }
- GenericParamType::Const(ref ty) => {
- cdecl::write_field(out, ty, item.name.name(), config);
- if with_default {
- write!(out, " = 0");
- }
- }
- }
- }
- out.write(">");
- out.new_line();
- }
- }
-
- pub fn write_with_default<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- self.write_internal(config, out, true);
- }
-}
-
-impl Deref for GenericParams {
- type Target = [GenericParam];
-
- fn deref(&self) -> &[GenericParam] {
- &self.0
- }
-}
-
-impl Source for GenericParams {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- self.write_internal(config, out, false);
- }
-}
-
-/// A (non-lifetime) argument passed to a generic, either a type or a constant expression.
-///
-/// Note: Both arguments in a type like `Array<T, N>` are represented as
-/// `GenericArgument::Type`s, even if `N` is actually the name of a const. This
-/// is a consequence of `syn::GenericArgument` doing the same thing.
-#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
-pub enum GenericArgument {
- Type(Type),
- Const(ConstExpr),
-}
-
-impl GenericArgument {
- pub fn specialize(&self, mappings: &[(&Path, &GenericArgument)]) -> GenericArgument {
- match *self {
- GenericArgument::Type(ref ty) => {
- if let Type::Path(ref path) = *ty {
- if path.is_single_identifier() {
- // See note on `GenericArgument` above: `ty` may
- // actually be the name of a const. Check for that now.
- for &(name, value) in mappings {
- if *name == path.path {
- return value.clone();
- }
- }
- }
- }
- GenericArgument::Type(ty.specialize(mappings))
- }
- GenericArgument::Const(ref expr) => GenericArgument::Const(expr.clone()),
- }
- }
-
- pub fn rename_for_config(&mut self, config: &Config, generic_params: &GenericParams) {
- match *self {
- GenericArgument::Type(ref mut ty) => ty.rename_for_config(config, generic_params),
- GenericArgument::Const(ref mut expr) => expr.rename_for_config(config),
- }
- }
-}
-
-impl Source for GenericArgument {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- match *self {
- GenericArgument::Type(ref ty) => ty.write(config, out),
- GenericArgument::Const(ref expr) => expr.write(config, out),
- }
- }
-}
-
-#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
-pub struct GenericPath {
- path: Path,
- export_name: String,
- generics: Vec<GenericArgument>,
- ctype: Option<DeclarationType>,
-}
-
-impl GenericPath {
- pub fn new(path: Path, generics: Vec<GenericArgument>) -> Self {
- let export_name = path.name().to_owned();
- Self {
- path,
- export_name,
- generics,
- ctype: None,
- }
- }
-
- pub fn self_path() -> Self {
- Self::new(Path::new("Self"), vec![])
- }
-
- pub fn replace_self_with(&mut self, self_ty: &Path) {
- if self.path.replace_self_with(self_ty) {
- self.export_name = self_ty.name().to_owned();
- }
- // Caller deals with generics.
- }
-
- pub fn path(&self) -> &Path {
- &self.path
- }
-
- pub fn generics(&self) -> &[GenericArgument] {
- &self.generics
- }
-
- pub fn generics_mut(&mut self) -> &mut [GenericArgument] {
- &mut self.generics
- }
-
- pub fn ctype(&self) -> Option<&DeclarationType> {
- self.ctype.as_ref()
- }
-
- pub fn name(&self) -> &str {
- self.path.name()
- }
-
- pub fn export_name(&self) -> &str {
- &self.export_name
- }
-
- pub fn is_single_identifier(&self) -> bool {
- self.generics.is_empty()
- }
-
- pub fn rename_for_config(&mut self, config: &Config, generic_params: &GenericParams) {
- for generic in &mut self.generics {
- generic.rename_for_config(config, generic_params);
- }
- if !generic_params.iter().any(|param| param.name == self.path) {
- config.export.rename(&mut self.export_name);
- }
- }
-
- pub fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
- self.ctype = resolver.type_for(&self.path);
- }
-
- pub fn load(path: &syn::Path) -> Result<Self, String> {
- assert!(
- !path.segments.is_empty(),
- "{:?} doesn't have any segments",
- path
- );
- let last_segment = path.segments.last().unwrap();
- let name = last_segment.ident.unraw().to_string();
-
- let path = Path::new(name);
- let phantom_data_path = Path::new("PhantomData");
- if path == phantom_data_path {
- return Ok(Self::new(path, Vec::new()));
- }
-
- let generics = match last_segment.arguments {
- syn::PathArguments::AngleBracketed(syn::AngleBracketedGenericArguments {
- ref args,
- ..
- }) => args.iter().try_skip_map(|x| match *x {
- syn::GenericArgument::Type(ref x) => Ok(Type::load(x)?.map(GenericArgument::Type)),
- syn::GenericArgument::Lifetime(_) => Ok(None),
- syn::GenericArgument::Const(ref x) => {
- Ok(Some(GenericArgument::Const(ConstExpr::load(x)?)))
- }
- _ => Err(format!("can't handle generic argument {:?}", x)),
- })?,
- syn::PathArguments::Parenthesized(_) => {
- return Err("Path contains parentheses.".to_owned());
- }
- _ => Vec::new(),
- };
-
- Ok(Self::new(path, generics))
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/global.rs b/cbindgen-0.24.5/src/bindgen/ir/global.rs
deleted file mode 100644
index 47c9960..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/global.rs
+++ /dev/null
@@ -1,119 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::io::Write;
-
-use syn::ext::IdentExt;
-
-use crate::bindgen::cdecl;
-use crate::bindgen::config::Config;
-use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
-use crate::bindgen::dependencies::Dependencies;
-use crate::bindgen::ir::{AnnotationSet, Cfg, Documentation, Item, ItemContainer, Path, Type};
-use crate::bindgen::library::Library;
-use crate::bindgen::writer::{Source, SourceWriter};
-
-#[derive(Debug, Clone)]
-pub struct Static {
- pub path: Path,
- pub export_name: String,
- pub ty: Type,
- pub mutable: bool,
- pub cfg: Option<Cfg>,
- pub annotations: AnnotationSet,
- pub documentation: Documentation,
-}
-
-impl Static {
- pub fn load(item: &syn::ItemStatic, mod_cfg: Option<&Cfg>) -> Result<Static, String> {
- let ty = Type::load(&item.ty)?;
-
- if ty.is_none() {
- return Err("Cannot have a zero sized static definition.".to_owned());
- }
-
- Ok(Static::new(
- Path::new(item.ident.unraw().to_string()),
- ty.unwrap(),
- item.mutability.is_some(),
- Cfg::append(mod_cfg, Cfg::load(&item.attrs)),
- AnnotationSet::load(&item.attrs)?,
- Documentation::load(&item.attrs),
- ))
- }
-
- pub fn new(
- path: Path,
- ty: Type,
- mutable: bool,
- cfg: Option<Cfg>,
- annotations: AnnotationSet,
- documentation: Documentation,
- ) -> Self {
- let export_name = path.name().to_owned();
- Self {
- path,
- export_name,
- ty,
- mutable,
- cfg,
- annotations,
- documentation,
- }
- }
-
- pub fn simplify_standard_types(&mut self, config: &Config) {
- self.ty.simplify_standard_types(config);
- }
-}
-
-impl Item for Static {
- fn path(&self) -> &Path {
- &self.path
- }
-
- fn export_name(&self) -> &str {
- &self.export_name
- }
-
- fn cfg(&self) -> Option<&Cfg> {
- self.cfg.as_ref()
- }
-
- fn annotations(&self) -> &AnnotationSet {
- &self.annotations
- }
-
- fn annotations_mut(&mut self) -> &mut AnnotationSet {
- &mut self.annotations
- }
-
- fn container(&self) -> ItemContainer {
- ItemContainer::Static(self.clone())
- }
-
- fn rename_for_config(&mut self, config: &Config) {
- self.ty.rename_for_config(config, &Default::default());
- }
-
- fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
- self.ty.resolve_declaration_types(resolver);
- }
-
- fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
- self.ty.add_dependencies(library, out);
- }
-}
-
-impl Source for Static {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- out.write("extern ");
- if let Type::Ptr { is_const: true, .. } = self.ty {
- } else if !self.mutable {
- out.write("const ");
- }
- cdecl::write_field(out, &self.ty, &self.export_name, config);
- out.write(";");
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/item.rs b/cbindgen-0.24.5/src/bindgen/ir/item.rs
deleted file mode 100644
index 16d98f5..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/item.rs
+++ /dev/null
@@ -1,250 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use indexmap::IndexMap;
-use std::mem;
-
-use crate::bindgen::config::Config;
-use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
-use crate::bindgen::dependencies::Dependencies;
-use crate::bindgen::ir::{
- AnnotationSet, Cfg, Constant, Enum, GenericArgument, OpaqueItem, Path, Static, Struct, Typedef,
- Union,
-};
-use crate::bindgen::library::Library;
-use crate::bindgen::monomorph::Monomorphs;
-
-/// An item is any type of rust item besides a function
-pub trait Item {
- fn path(&self) -> &Path;
- fn name(&self) -> &str {
- self.path().name()
- }
- fn export_name(&self) -> &str {
- self.name()
- }
- fn cfg(&self) -> Option<&Cfg>;
- fn annotations(&self) -> &AnnotationSet;
- fn annotations_mut(&mut self) -> &mut AnnotationSet;
-
- fn container(&self) -> ItemContainer;
-
- fn collect_declaration_types(&self, _resolver: &mut DeclarationTypeResolver) {
- unimplemented!()
- }
- fn resolve_declaration_types(&mut self, _resolver: &DeclarationTypeResolver) {
- unimplemented!()
- }
- fn rename_for_config(&mut self, _config: &Config) {}
- fn add_dependencies(&self, _library: &Library, _out: &mut Dependencies) {}
- fn instantiate_monomorph(
- &self,
- _generics: &[GenericArgument],
- _library: &Library,
- _out: &mut Monomorphs,
- ) {
- unreachable!("Cannot instantiate {} as a generic.", self.name())
- }
-}
-
-#[derive(Debug, Clone)]
-pub enum ItemContainer {
- Constant(Constant),
- Static(Static),
- OpaqueItem(OpaqueItem),
- Struct(Struct),
- Union(Union),
- Enum(Enum),
- Typedef(Typedef),
-}
-
-impl ItemContainer {
- pub fn deref(&self) -> &dyn Item {
- match *self {
- ItemContainer::Constant(ref x) => x,
- ItemContainer::Static(ref x) => x,
- ItemContainer::OpaqueItem(ref x) => x,
- ItemContainer::Struct(ref x) => x,
- ItemContainer::Union(ref x) => x,
- ItemContainer::Enum(ref x) => x,
- ItemContainer::Typedef(ref x) => x,
- }
- }
-}
-
-#[derive(Debug, Clone)]
-pub enum ItemValue<T: Item> {
- Cfg(Vec<T>),
- Single(T),
-}
-
-#[derive(Debug, Clone)]
-pub struct ItemMap<T: Item> {
- data: IndexMap<Path, ItemValue<T>>,
-}
-
-impl<T: Item> Default for ItemMap<T> {
- fn default() -> ItemMap<T> {
- ItemMap {
- data: Default::default(),
- }
- }
-}
-
-impl<T: Item + Clone> ItemMap<T> {
- pub fn rebuild(&mut self) {
- let old = mem::take(self);
- old.for_all_items(|x| {
- self.try_insert(x.clone());
- });
- }
-
- pub fn try_insert(&mut self, item: T) -> bool {
- match (item.cfg().is_some(), self.data.get_mut(item.path())) {
- (true, Some(&mut ItemValue::Cfg(ref mut items))) => {
- items.push(item);
- return true;
- }
- (false, Some(&mut ItemValue::Cfg(_))) => {
- return false;
- }
- (true, Some(&mut ItemValue::Single(_))) => {
- return false;
- }
- (false, Some(&mut ItemValue::Single(_))) => {
- return false;
- }
- _ => {}
- }
-
- let path = item.path().clone();
- if item.cfg().is_some() {
- self.data.insert(path, ItemValue::Cfg(vec![item]));
- } else {
- self.data.insert(path, ItemValue::Single(item));
- }
-
- true
- }
-
- pub fn extend_with(&mut self, other: &ItemMap<T>) {
- other.for_all_items(|x| {
- self.try_insert(x.clone());
- });
- }
-
- pub fn to_vec(&self) -> Vec<T> {
- let mut result = Vec::with_capacity(self.data.len());
- for container in self.data.values() {
- match *container {
- ItemValue::Cfg(ref items) => result.extend_from_slice(items),
- ItemValue::Single(ref item) => {
- result.push(item.clone());
- }
- }
- }
- result
- }
-
- pub fn get_items(&self, path: &Path) -> Option<Vec<ItemContainer>> {
- Some(match *self.data.get(path)? {
- ItemValue::Cfg(ref items) => items.iter().map(|x| x.container()).collect(),
- ItemValue::Single(ref item) => vec![item.container()],
- })
- }
-
- pub fn filter<F>(&mut self, callback: F)
- where
- F: Fn(&T) -> bool,
- {
- let data = mem::take(&mut self.data);
-
- for (name, container) in data {
- match container {
- ItemValue::Cfg(items) => {
- let mut new_items = Vec::new();
- for item in items {
- if !callback(&item) {
- new_items.push(item);
- }
- }
- if !new_items.is_empty() {
- self.data.insert(name, ItemValue::Cfg(new_items));
- }
- }
- ItemValue::Single(item) => {
- if !callback(&item) {
- self.data.insert(name, ItemValue::Single(item));
- }
- }
- }
- }
- }
-
- pub fn for_all_items<F>(&self, mut callback: F)
- where
- F: FnMut(&T),
- {
- for container in self.data.values() {
- match *container {
- ItemValue::Cfg(ref items) => {
- for item in items {
- callback(item);
- }
- }
- ItemValue::Single(ref item) => callback(item),
- }
- }
- }
-
- pub fn for_all_items_mut<F>(&mut self, mut callback: F)
- where
- F: FnMut(&mut T),
- {
- for container in self.data.values_mut() {
- match *container {
- ItemValue::Cfg(ref mut items) => {
- for item in items {
- callback(item);
- }
- }
- ItemValue::Single(ref mut item) => callback(item),
- }
- }
- }
-
- pub fn for_items<F>(&self, path: &Path, mut callback: F)
- where
- F: FnMut(&T),
- {
- match self.data.get(path) {
- Some(ItemValue::Cfg(items)) => {
- for item in items {
- callback(item);
- }
- }
- Some(ItemValue::Single(item)) => {
- callback(item);
- }
- None => {}
- }
- }
-
- pub fn for_items_mut<F>(&mut self, path: &Path, mut callback: F)
- where
- F: FnMut(&mut T),
- {
- match self.data.get_mut(path) {
- Some(&mut ItemValue::Cfg(ref mut items)) => {
- for item in items {
- callback(item);
- }
- }
- Some(&mut ItemValue::Single(ref mut item)) => {
- callback(item);
- }
- None => {}
- }
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/mod.rs b/cbindgen-0.24.5/src/bindgen/ir/mod.rs
deleted file mode 100644
index 7b0a922..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/mod.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-pub mod annotation;
-pub mod cfg;
-pub mod constant;
-pub mod documentation;
-pub mod enumeration;
-pub mod field;
-pub mod function;
-pub mod generic_path;
-pub mod global;
-pub mod item;
-pub mod opaque;
-pub mod path;
-pub mod repr;
-pub mod structure;
-pub mod ty;
-pub mod typedef;
-pub mod union;
-
-pub use self::annotation::{AnnotationSet, AnnotationValue};
-pub use self::cfg::*;
-pub use self::constant::*;
-pub use self::documentation::Documentation;
-pub use self::enumeration::*;
-pub use self::field::*;
-pub use self::function::*;
-pub use self::generic_path::*;
-pub use self::global::*;
-pub use self::item::*;
-pub use self::opaque::*;
-pub use self::path::*;
-pub use self::repr::*;
-pub use self::structure::*;
-pub use self::ty::*;
-pub use self::typedef::*;
-pub use self::union::*;
diff --git a/cbindgen-0.24.5/src/bindgen/ir/opaque.rs b/cbindgen-0.24.5/src/bindgen/ir/opaque.rs
deleted file mode 100644
index 4451d4a..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/opaque.rs
+++ /dev/null
@@ -1,176 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::io::Write;
-
-use crate::bindgen::config::{Config, Language};
-use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
-use crate::bindgen::dependencies::Dependencies;
-use crate::bindgen::ir::{
- AnnotationSet, Cfg, ConditionWrite, Documentation, GenericArgument, GenericParams, Item,
- ItemContainer, Path, ToCondition,
-};
-use crate::bindgen::library::Library;
-use crate::bindgen::mangle;
-use crate::bindgen::monomorph::Monomorphs;
-use crate::bindgen::writer::{Source, SourceWriter};
-
-#[derive(Debug, Clone)]
-pub struct OpaqueItem {
- pub path: Path,
- pub export_name: String,
- pub generic_params: GenericParams,
- pub cfg: Option<Cfg>,
- pub annotations: AnnotationSet,
- pub documentation: Documentation,
-}
-
-impl OpaqueItem {
- pub fn load(
- path: Path,
- generics: &syn::Generics,
- attrs: &[syn::Attribute],
- mod_cfg: Option<&Cfg>,
- ) -> Result<OpaqueItem, String> {
- Ok(Self::new(
- path,
- GenericParams::load(generics)?,
- Cfg::append(mod_cfg, Cfg::load(attrs)),
- AnnotationSet::load(attrs).unwrap_or_else(|_| AnnotationSet::new()),
- Documentation::load(attrs),
- ))
- }
-
- pub fn new(
- path: Path,
- generic_params: GenericParams,
- cfg: Option<Cfg>,
- annotations: AnnotationSet,
- documentation: Documentation,
- ) -> OpaqueItem {
- let export_name = path.name().to_owned();
- Self {
- path,
- export_name,
- generic_params,
- cfg,
- annotations,
- documentation,
- }
- }
-}
-
-impl Item for OpaqueItem {
- fn path(&self) -> &Path {
- &self.path
- }
-
- fn export_name(&self) -> &str {
- &self.export_name
- }
-
- fn cfg(&self) -> Option<&Cfg> {
- self.cfg.as_ref()
- }
-
- fn annotations(&self) -> &AnnotationSet {
- &self.annotations
- }
-
- fn annotations_mut(&mut self) -> &mut AnnotationSet {
- &mut self.annotations
- }
-
- fn container(&self) -> ItemContainer {
- ItemContainer::OpaqueItem(self.clone())
- }
-
- fn collect_declaration_types(&self, resolver: &mut DeclarationTypeResolver) {
- resolver.add_struct(&self.path);
- }
-
- fn rename_for_config(&mut self, config: &Config) {
- config.export.rename(&mut self.export_name);
- }
-
- fn add_dependencies(&self, _: &Library, _: &mut Dependencies) {}
-
- fn instantiate_monomorph(
- &self,
- generic_values: &[GenericArgument],
- library: &Library,
- out: &mut Monomorphs,
- ) {
- assert!(
- !self.generic_params.is_empty(),
- "{} is not generic",
- self.path
- );
-
- // We can be instantiated with less generic params because of default
- // template parameters, or because of empty types that we remove during
- // parsing (`()`).
- assert!(
- self.generic_params.len() >= generic_values.len(),
- "{} has {} params but is being instantiated with {} values",
- self.path,
- self.generic_params.len(),
- generic_values.len(),
- );
-
- let mangled_path = mangle::mangle_path(
- &self.path,
- generic_values,
- &library.get_config().export.mangle,
- );
-
- let monomorph = OpaqueItem::new(
- mangled_path,
- GenericParams::default(),
- self.cfg.clone(),
- self.annotations.clone(),
- self.documentation.clone(),
- );
-
- out.insert_opaque(self, monomorph, generic_values.to_owned());
- }
-}
-
-impl Source for OpaqueItem {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- let condition = self.cfg.to_condition(config);
- condition.write_before(config, out);
-
- self.documentation.write(config, out);
-
- self.generic_params.write_with_default(config, out);
-
- match config.language {
- Language::C if config.style.generate_typedef() => {
- write!(
- out,
- "typedef struct {} {};",
- self.export_name(),
- self.export_name()
- );
- }
- Language::C | Language::Cxx => {
- write!(out, "struct {};", self.export_name());
- }
- Language::Cython => {
- write!(
- out,
- "{}struct {}",
- config.style.cython_def(),
- self.export_name()
- );
- out.open_brace();
- out.write("pass");
- out.close_brace(false);
- }
- }
-
- condition.write_after(config, out);
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/repr.rs b/cbindgen-0.24.5/src/bindgen/ir/repr.rs
deleted file mode 100644
index 9713201..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/repr.rs
+++ /dev/null
@@ -1,187 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use syn::ext::IdentExt;
-
-use crate::bindgen::ir::ty::{IntKind, PrimitiveType};
-
-#[derive(Debug, Copy, Clone, PartialEq, Eq)]
-pub enum ReprStyle {
- Rust,
- C,
- Transparent,
-}
-
-impl Default for ReprStyle {
- fn default() -> Self {
- ReprStyle::Rust
- }
-}
-
-#[derive(Debug, Copy, Clone, PartialEq, Eq)]
-pub struct ReprType {
- kind: IntKind,
- signed: bool,
-}
-
-impl ReprType {
- pub(crate) fn to_primitive(self) -> PrimitiveType {
- PrimitiveType::Integer {
- kind: self.kind,
- signed: self.signed,
- zeroable: true,
- }
- }
-}
-
-#[derive(Debug, Copy, Clone, PartialEq, Eq)]
-pub enum ReprAlign {
- Packed,
- Align(u64),
-}
-
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
-pub struct Repr {
- pub style: ReprStyle,
- pub ty: Option<ReprType>,
- pub align: Option<ReprAlign>,
-}
-
-impl Repr {
- pub fn load(attrs: &[syn::Attribute]) -> Result<Repr, String> {
- let ids = attrs
- .iter()
- .filter_map(|attr| {
- if let syn::Meta::List(syn::MetaList { path, nested, .. }) =
- attr.parse_meta().ok()?
- {
- if path.is_ident("repr") {
- return Some(nested.into_iter().collect::<Vec<_>>());
- }
- }
- None
- })
- .flatten()
- .filter_map(|meta| match meta {
- syn::NestedMeta::Meta(syn::Meta::Path(path)) => Some((
- path.segments.first().unwrap().ident.unraw().to_string(),
- None,
- )),
- syn::NestedMeta::Meta(syn::Meta::List(syn::MetaList { path, nested, .. })) => {
- Some((
- path.segments.first().unwrap().ident.unraw().to_string(),
- Some(
- nested
- .iter()
- .filter_map(|meta| match meta {
- // Only used for #[repr(align(...))].
- syn::NestedMeta::Lit(syn::Lit::Int(literal)) => {
- Some(literal.base10_digits().to_string())
- }
- // Only single levels of nesting supported at the moment.
- _ => None,
- })
- .collect::<Vec<_>>(),
- ),
- ))
- }
- _ => None,
- });
-
- let mut repr = Repr::default();
- for id in ids {
- let (int_kind, signed) = match (id.0.as_ref(), id.1) {
- ("u8", None) => (IntKind::B8, false),
- ("u16", None) => (IntKind::B16, false),
- ("u32", None) => (IntKind::B32, false),
- ("u64", None) => (IntKind::B64, false),
- ("usize", None) => (IntKind::Size, false),
- ("i8", None) => (IntKind::B8, true),
- ("i16", None) => (IntKind::B16, true),
- ("i32", None) => (IntKind::B32, true),
- ("i64", None) => (IntKind::B64, true),
- ("isize", None) => (IntKind::Size, true),
- ("C", None) => {
- repr.style = ReprStyle::C;
- continue;
- }
- ("transparent", None) => {
- repr.style = ReprStyle::Transparent;
- continue;
- }
- ("packed", args) => {
- // #[repr(packed(n))] not supported because of some open questions about how
- // to calculate the native alignment of types. See eqrion/cbindgen#433.
- if args.is_some() {
- return Err(
- "Not-yet-implemented #[repr(packed(...))] encountered.".to_string()
- );
- }
- let align = ReprAlign::Packed;
- // Only permit a single alignment-setting repr.
- if let Some(old_align) = repr.align {
- return Err(format!(
- "Conflicting #[repr(align(...))] type hints {:?} and {:?}.",
- old_align, align
- ));
- }
- repr.align = Some(align);
- continue;
- }
- ("align", Some(args)) => {
- // #[repr(align(...))] only allows a single argument.
- if args.len() != 1 {
- return Err(format!(
- "Unsupported #[repr(align({}))], align must have exactly one argument.",
- args.join(", ")
- ));
- }
- // Must be a positive integer.
- let align = match args.first().unwrap().parse::<u64>() {
- Ok(align) => align,
- Err(_) => {
- return Err(format!("Non-numeric #[repr(align({}))].", args.join(", ")))
- }
- };
- // Must be a power of 2.
- if !align.is_power_of_two() || align == 0 {
- return Err(format!("Invalid alignment to #[repr(align({}))].", align));
- }
- // Only permit a single alignment-setting repr.
- if let Some(old_align) = repr.align {
- return Err(format!(
- "Conflicting #[repr(align(...))] type hints {:?} and {:?}.",
- old_align,
- ReprAlign::Align(align)
- ));
- }
- repr.align = Some(ReprAlign::Align(align));
- continue;
- }
- (path, args) => match args {
- None => return Err(format!("Unsupported #[repr({})].", path)),
- Some(args) => {
- return Err(format!(
- "Unsupported #[repr({}({}))].",
- path,
- args.join(", ")
- ));
- }
- },
- };
- let ty = ReprType {
- kind: int_kind,
- signed,
- };
- if let Some(old_ty) = repr.ty {
- return Err(format!(
- "Conflicting #[repr(...)] type hints {:?} and {:?}.",
- old_ty, ty
- ));
- }
- repr.ty = Some(ty);
- }
- Ok(repr)
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/structure.rs b/cbindgen-0.24.5/src/bindgen/ir/structure.rs
deleted file mode 100644
index 9f77739..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/structure.rs
+++ /dev/null
@@ -1,710 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::io::Write;
-
-use syn::ext::IdentExt;
-
-use crate::bindgen::config::{Config, Language, LayoutConfig};
-use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
-use crate::bindgen::dependencies::Dependencies;
-use crate::bindgen::ir::{
- AnnotationSet, Cfg, ConditionWrite, Constant, Documentation, Field, GenericArgument,
- GenericParams, Item, ItemContainer, Path, Repr, ReprAlign, ReprStyle, ToCondition, Type,
- Typedef,
-};
-use crate::bindgen::library::Library;
-use crate::bindgen::mangle;
-use crate::bindgen::monomorph::Monomorphs;
-use crate::bindgen::rename::{IdentifierType, RenameRule};
-use crate::bindgen::reserved;
-use crate::bindgen::utilities::IterHelpers;
-use crate::bindgen::writer::{ListType, Source, SourceWriter};
-
-#[derive(Debug, Clone)]
-pub struct Struct {
- pub path: Path,
- pub export_name: String,
- pub generic_params: GenericParams,
- pub fields: Vec<Field>,
- /// Whether there's a tag field on the body of this struct. When this is
- /// true, is_enum_variant_body is also guaranteed to be true.
- pub has_tag_field: bool,
- /// Whether this is an enum variant body.
- pub is_enum_variant_body: bool,
- pub alignment: Option<ReprAlign>,
- pub is_transparent: bool,
- pub cfg: Option<Cfg>,
- pub annotations: AnnotationSet,
- pub documentation: Documentation,
- pub associated_constants: Vec<Constant>,
-}
-
-impl Struct {
- /// Whether this struct can derive operator== / operator!=.
- pub fn can_derive_eq(&self) -> bool {
- !self.fields.is_empty() && self.fields.iter().all(|x| x.ty.can_cmp_eq())
- }
-
- pub fn add_associated_constant(&mut self, c: Constant) {
- self.associated_constants.push(c);
- }
-
- pub fn load(
- layout_config: &LayoutConfig,
- item: &syn::ItemStruct,
- mod_cfg: Option<&Cfg>,
- ) -> Result<Self, String> {
- let repr = Repr::load(&item.attrs)?;
- let is_transparent = match repr.style {
- ReprStyle::C => false,
- ReprStyle::Transparent => true,
- _ => {
- return Err("Struct is not marked #[repr(C)] or #[repr(transparent)].".to_owned());
- }
- };
-
- let path = Path::new(item.ident.unraw().to_string());
-
- // Ensure we can safely represent the struct given the configuration.
- if let Some(align) = repr.align {
- layout_config.ensure_safe_to_represent(&align)?;
- }
-
- let fields = match item.fields {
- syn::Fields::Unit => Vec::new(),
- syn::Fields::Named(ref fields) => fields
- .named
- .iter()
- .try_skip_map(|field| Field::load(field, &path))?,
- syn::Fields::Unnamed(ref fields) => {
- let mut out = Vec::new();
- let mut current = 0;
- for field in fields.unnamed.iter() {
- if let Some(mut ty) = Type::load(&field.ty)? {
- ty.replace_self_with(&path);
- out.push(Field {
- name: format!("{}", current),
- ty,
- cfg: Cfg::load(&field.attrs),
- annotations: AnnotationSet::load(&field.attrs)?,
- documentation: Documentation::load(&field.attrs),
- });
- current += 1;
- }
- }
- out
- }
- };
-
- let has_tag_field = false;
- let is_enum_variant_body = false;
-
- Ok(Struct::new(
- path,
- GenericParams::load(&item.generics)?,
- fields,
- has_tag_field,
- is_enum_variant_body,
- repr.align,
- is_transparent,
- Cfg::append(mod_cfg, Cfg::load(&item.attrs)),
- AnnotationSet::load(&item.attrs)?,
- Documentation::load(&item.attrs),
- ))
- }
-
- #[allow(clippy::too_many_arguments)]
- pub fn new(
- path: Path,
- generic_params: GenericParams,
- fields: Vec<Field>,
- has_tag_field: bool,
- is_enum_variant_body: bool,
- alignment: Option<ReprAlign>,
- is_transparent: bool,
- cfg: Option<Cfg>,
- annotations: AnnotationSet,
- documentation: Documentation,
- ) -> Self {
- let export_name = path.name().to_owned();
- Self {
- path,
- export_name,
- generic_params,
- fields,
- has_tag_field,
- is_enum_variant_body,
- alignment,
- is_transparent,
- cfg,
- annotations,
- documentation,
- associated_constants: vec![],
- }
- }
-
- pub fn simplify_standard_types(&mut self, config: &Config) {
- for field in &mut self.fields {
- field.ty.simplify_standard_types(config);
- }
- }
-
- pub fn is_generic(&self) -> bool {
- self.generic_params.len() > 0
- }
-
- pub fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
- // Generic structs can instantiate monomorphs only once they've been
- // instantiated. See `instantiate_monomorph` for more details.
- if self.is_generic() {
- return;
- }
-
- for field in &self.fields {
- field.ty.add_monomorphs(library, out);
- }
- }
-
- pub fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
- for field in &mut self.fields {
- field.ty.mangle_paths(monomorphs);
- }
- }
-
- pub fn specialize(
- &self,
- generic_values: &[GenericArgument],
- mappings: &[(&Path, &GenericArgument)],
- config: &Config,
- ) -> Self {
- let mangled_path = mangle::mangle_path(&self.path, generic_values, &config.export.mangle);
- Struct::new(
- mangled_path,
- GenericParams::default(),
- self.fields
- .iter()
- .map(|field| Field {
- name: field.name.clone(),
- ty: field.ty.specialize(mappings),
- cfg: field.cfg.clone(),
- annotations: field.annotations.clone(),
- documentation: field.documentation.clone(),
- })
- .collect(),
- self.has_tag_field,
- self.is_enum_variant_body,
- self.alignment,
- self.is_transparent,
- self.cfg.clone(),
- self.annotations.clone(),
- self.documentation.clone(),
- )
- }
-
- fn emit_bitflags_binop<F: Write>(
- &self,
- constexpr_prefix: &str,
- operator: char,
- other: &str,
- out: &mut SourceWriter<F>,
- ) {
- out.new_line();
- write!(
- out,
- "{}{} operator{}(const {}& {}) const",
- constexpr_prefix,
- self.export_name(),
- operator,
- self.export_name(),
- other
- );
- out.open_brace();
- write!(
- out,
- "return {} {{ static_cast<decltype(bits)>(this->bits {} {}.bits) }};",
- self.export_name(),
- operator,
- other
- );
- out.close_brace(false);
-
- out.new_line();
- write!(
- out,
- "{}& operator{}=(const {}& {})",
- self.export_name(),
- operator,
- self.export_name(),
- other
- );
- out.open_brace();
- write!(out, "*this = (*this {} {});", operator, other);
- out.new_line();
- write!(out, "return *this;");
- out.close_brace(false);
- }
-}
-
-impl Item for Struct {
- fn path(&self) -> &Path {
- &self.path
- }
-
- fn export_name(&self) -> &str {
- &self.export_name
- }
-
- fn cfg(&self) -> Option<&Cfg> {
- self.cfg.as_ref()
- }
-
- fn annotations(&self) -> &AnnotationSet {
- &self.annotations
- }
-
- fn annotations_mut(&mut self) -> &mut AnnotationSet {
- &mut self.annotations
- }
-
- fn container(&self) -> ItemContainer {
- ItemContainer::Struct(self.clone())
- }
-
- fn collect_declaration_types(&self, resolver: &mut DeclarationTypeResolver) {
- if self.is_transparent {
- resolver.add_none(&self.path);
- } else {
- resolver.add_struct(&self.path);
- }
- }
-
- fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
- for field in &mut self.fields {
- field.ty.resolve_declaration_types(resolver);
- }
- }
-
- fn rename_for_config(&mut self, config: &Config) {
- // Rename the name of the struct
- if !(self.has_tag_field && config.language == Language::Cxx) {
- config.export.rename(&mut self.export_name);
- }
-
- // Rename the types used in fields
- {
- let fields = self.fields.iter_mut().skip(self.has_tag_field as usize);
- for field in fields {
- field.ty.rename_for_config(config, &self.generic_params);
- }
- }
-
- // Apply renaming rules to fields in the following order
- // 1. `cbindgen::field-names` annotation
- // 2. `cbindgen::rename-all` annotation
- // 3. config struct rename rule
- // If the struct is a tuple struct and we have not renamed the
- // fields, then prefix each of them with an underscore.
- // If any field is a reserved keyword, then postfix it with an
- // underscore.
-
- // Scope for mutable borrow of fields
- {
- let names = self.fields.iter_mut().map(|field| &mut field.name);
-
- let field_rules = self
- .annotations
- .parse_atom::<RenameRule>("rename-all")
- .unwrap_or(config.structure.rename_fields);
-
- if let Some(o) = self.annotations.list("field-names") {
- for (dest, src) in names.zip(o) {
- *dest = src;
- }
- } else if let Some(r) = field_rules.not_none() {
- for name in names {
- *name = r.apply(name, IdentifierType::StructMember).into_owned();
- }
- } else {
- // If we don't have any rules for a tuple struct, prefix them with
- // an underscore so it still compiles.
- for name in names {
- if name.starts_with(|c: char| c.is_ascii_digit()) {
- name.insert(0, '_');
- }
- }
- }
- }
-
- for field in &mut self.fields {
- reserved::escape(&mut field.name);
- }
-
- for c in self.associated_constants.iter_mut() {
- c.rename_for_config(config);
- }
- }
-
- fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
- let mut fields = self.fields.iter();
-
- // If there is a tag field, skip it
- if self.has_tag_field {
- fields.next();
- }
-
- for field in fields {
- field
- .ty
- .add_dependencies_ignoring_generics(&self.generic_params, library, out);
- }
-
- for c in &self.associated_constants {
- c.add_dependencies(library, out);
- }
- }
-
- fn instantiate_monomorph(
- &self,
- generic_values: &[GenericArgument],
- library: &Library,
- out: &mut Monomorphs,
- ) {
- let mappings = self.generic_params.call(self.path.name(), generic_values);
- let monomorph = self.specialize(generic_values, &mappings, library.get_config());
- out.insert_struct(library, self, monomorph, generic_values.to_owned());
- }
-}
-
-impl Source for Struct {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- if self.is_transparent {
- let typedef = Typedef {
- path: self.path.clone(),
- export_name: self.export_name.to_owned(),
- generic_params: self.generic_params.clone(),
- aliased: self.fields[0].ty.clone(),
- cfg: self.cfg.clone(),
- annotations: self.annotations.clone(),
- documentation: self.documentation.clone(),
- };
- typedef.write(config, out);
- for constant in &self.associated_constants {
- out.new_line();
- constant.write(config, out, Some(self));
- }
- return;
- }
-
- let condition = self.cfg.to_condition(config);
- condition.write_before(config, out);
-
- self.documentation.write(config, out);
-
- if !self.is_enum_variant_body {
- self.generic_params.write(config, out);
- }
-
- // The following results in
- // C++ or C with Tag as style:
- // struct Name {
- // C with Type only style:
- // typedef struct {
- // C with Both as style:
- // typedef struct Name {
- match config.language {
- Language::C if config.style.generate_typedef() => out.write("typedef "),
- Language::C | Language::Cxx => {}
- Language::Cython => out.write(config.style.cython_def()),
- }
-
- // Cython extern declarations don't manage layouts, layouts are defined entierly by the
- // corresponding C code. So this `packed` is only for documentation, and missing
- // `aligned(n)` is also not a problem.
- if config.language == Language::Cython {
- if let Some(align) = self.alignment {
- match align {
- ReprAlign::Packed => out.write("packed "),
- ReprAlign::Align(_) => {} // Not supported
- }
- }
- }
-
- out.write("struct");
-
- if config.language != Language::Cython {
- if let Some(align) = self.alignment {
- match align {
- ReprAlign::Packed => {
- if let Some(ref anno) = config.layout.packed {
- write!(out, " {}", anno);
- }
- }
- ReprAlign::Align(n) => {
- if let Some(ref anno) = config.layout.aligned_n {
- write!(out, " {}({})", anno, n);
- }
- }
- }
- }
- }
-
- if self.annotations.must_use(config) {
- if let Some(ref anno) = config.structure.must_use {
- write!(out, " {}", anno);
- }
- }
-
- if config.language != Language::C || config.style.generate_tag() {
- write!(out, " {}", self.export_name());
- }
-
- out.open_brace();
-
- // Emit the pre_body section, if relevant
- if let Some(body) = config.export.pre_body(&self.path) {
- out.write_raw_block(body);
- out.new_line();
- }
-
- out.write_vertical_source_list(&self.fields, ListType::Cap(";"));
- if config.language == Language::Cython && self.fields.is_empty() {
- out.write("pass");
- }
-
- if config.language == Language::Cxx {
- let mut wrote_start_newline = false;
-
- if config.structure.derive_constructor(&self.annotations) && !self.fields.is_empty() {
- if !wrote_start_newline {
- wrote_start_newline = true;
- out.new_line();
- }
-
- out.new_line();
-
- let arg_renamer = |name: &str| {
- config
- .function
- .rename_args
- .apply(name, IdentifierType::FunctionArg)
- .into_owned()
- };
- write!(out, "{}(", self.export_name());
- let vec: Vec<_> = self
- .fields
- .iter()
- .map(|field| {
- Field::from_name_and_type(
- // const-ref args to constructor
- format!("const& {}", arg_renamer(&field.name)),
- field.ty.clone(),
- )
- })
- .collect();
- out.write_vertical_source_list(&vec[..], ListType::Join(","));
- write!(out, ")");
- out.new_line();
- write!(out, " : ");
- let vec: Vec<_> = self
- .fields
- .iter()
- .map(|field| format!("{}({})", field.name, arg_renamer(&field.name)))
- .collect();
- out.write_vertical_source_list(&vec[..], ListType::Join(","));
- out.new_line();
- write!(out, "{{}}");
- out.new_line();
- }
-
- let other = config
- .function
- .rename_args
- .apply("other", IdentifierType::FunctionArg);
-
- if self
- .annotations
- .bool("internal-derive-bitflags")
- .unwrap_or(false)
- {
- if !wrote_start_newline {
- wrote_start_newline = true;
- out.new_line();
- }
- let constexpr_prefix = if config.constant.allow_constexpr {
- "constexpr "
- } else {
- ""
- };
-
- out.new_line();
- write!(out, "{}explicit operator bool() const", constexpr_prefix);
- out.open_brace();
- write!(out, "return !!bits;");
- out.close_brace(false);
-
- out.new_line();
- write!(
- out,
- "{}{} operator~() const",
- constexpr_prefix,
- self.export_name()
- );
- out.open_brace();
- write!(
- out,
- "return {} {{ static_cast<decltype(bits)>(~bits) }};",
- self.export_name()
- );
- out.close_brace(false);
- self.emit_bitflags_binop(constexpr_prefix, '|', &other, out);
- self.emit_bitflags_binop(constexpr_prefix, '&', &other, out);
- self.emit_bitflags_binop(constexpr_prefix, '^', &other, out);
- }
-
- // Generate a serializer function that allows dumping this struct
- // to an std::ostream. It's defined as a friend function inside the
- // struct definition, and doesn't need the `inline` keyword even
- // though it's implemented right in the generated header file.
- if config.structure.derive_ostream(&self.annotations) {
- if !wrote_start_newline {
- wrote_start_newline = true;
- out.new_line();
- }
-
- out.new_line();
- let stream = config
- .function
- .rename_args
- .apply("stream", IdentifierType::FunctionArg);
- let instance = config
- .function
- .rename_args
- .apply("instance", IdentifierType::FunctionArg);
- write!(
- out,
- "friend std::ostream& operator<<(std::ostream& {}, const {}& {})",
- stream,
- self.export_name(),
- instance,
- );
- out.open_brace();
- write!(out, "return {} << \"{{ \"", stream);
- let vec: Vec<_> = self
- .fields
- .iter()
- .map(|x| format!(" << \"{}=\" << {}.{}", x.name, instance, x.name))
- .collect();
- out.write_vertical_source_list(&vec[..], ListType::Join(" << \", \""));
- out.write(" << \" }\";");
- out.close_brace(false);
- }
-
- let skip_fields = self.has_tag_field as usize;
-
- macro_rules! emit_op {
- ($op_name:expr, $op:expr, $conjuc:expr) => {{
- if !wrote_start_newline {
- #[allow(unused_assignments)]
- {
- wrote_start_newline = true;
- }
- out.new_line();
- }
-
- out.new_line();
-
- if let Some(Some(attrs)) =
- self.annotations.atom(concat!($op_name, "-attributes"))
- {
- write!(out, "{} ", attrs);
- }
-
- write!(
- out,
- "bool operator{}(const {}& {}) const",
- $op,
- self.export_name(),
- other
- );
- out.open_brace();
- out.write("return ");
- let vec: Vec<_> = self
- .fields
- .iter()
- .skip(skip_fields)
- .map(|field| format!("{} {} {}.{}", field.name, $op, other, field.name))
- .collect();
- out.write_vertical_source_list(
- &vec[..],
- ListType::Join(&format!(" {}", $conjuc)),
- );
- out.write(";");
- out.close_brace(false);
- }};
- }
-
- if config.structure.derive_eq(&self.annotations) && self.can_derive_eq() {
- emit_op!("eq", "==", "&&");
- }
- if config.structure.derive_neq(&self.annotations) && self.can_derive_eq() {
- emit_op!("neq", "!=", "||");
- }
- if config.structure.derive_lt(&self.annotations)
- && self.fields.len() == 1
- && self.fields[0].ty.can_cmp_order()
- {
- emit_op!("lt", "<", "&&");
- }
- if config.structure.derive_lte(&self.annotations)
- && self.fields.len() == 1
- && self.fields[0].ty.can_cmp_order()
- {
- emit_op!("lte", "<=", "&&");
- }
- if config.structure.derive_gt(&self.annotations)
- && self.fields.len() == 1
- && self.fields[0].ty.can_cmp_order()
- {
- emit_op!("gt", ">", "&&");
- }
- if config.structure.derive_gte(&self.annotations)
- && self.fields.len() == 1
- && self.fields[0].ty.can_cmp_order()
- {
- emit_op!("gte", ">=", "&&");
- }
- }
-
- // Emit the post_body section, if relevant
- if let Some(body) = config.export.post_body(&self.path) {
- out.new_line();
- out.write_raw_block(body);
- }
-
- if config.language == Language::Cxx
- && config.structure.associated_constants_in_body
- && config.constant.allow_static_const
- {
- for constant in &self.associated_constants {
- out.new_line();
- constant.write_declaration(config, out, self);
- }
- }
-
- if config.language == Language::C && config.style.generate_typedef() {
- out.close_brace(false);
- write!(out, " {};", self.export_name());
- } else {
- out.close_brace(true);
- }
-
- for constant in &self.associated_constants {
- out.new_line();
- constant.write(config, out, Some(self));
- }
-
- condition.write_after(config, out);
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/ty.rs b/cbindgen-0.24.5/src/bindgen/ir/ty.rs
deleted file mode 100644
index d51cd63..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/ty.rs
+++ /dev/null
@@ -1,1014 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::borrow::Cow;
-use std::io::Write;
-
-use syn::ext::IdentExt;
-
-use crate::bindgen::cdecl;
-use crate::bindgen::config::{Config, Language};
-use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
-use crate::bindgen::dependencies::Dependencies;
-use crate::bindgen::ir::{GenericArgument, GenericParams, GenericPath, Path};
-use crate::bindgen::library::Library;
-use crate::bindgen::monomorph::Monomorphs;
-use crate::bindgen::utilities::IterHelpers;
-use crate::bindgen::writer::{Source, SourceWriter};
-
-#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
-pub enum PrimitiveType {
- Void,
- Bool,
- Char,
- SChar,
- UChar,
- Char32,
- Float,
- Double,
- VaList,
- PtrDiffT,
- Integer {
- zeroable: bool,
- signed: bool,
- kind: IntKind,
- },
-}
-
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
-pub enum IntKind {
- Short,
- Int,
- Long,
- LongLong,
- SizeT,
- Size,
- B8,
- B16,
- B32,
- B64,
-}
-
-impl PrimitiveType {
- pub fn maybe(path: &str) -> Option<PrimitiveType> {
- Some(match path {
- "c_void" => PrimitiveType::Void,
- "c_char" => PrimitiveType::Char,
- "c_schar" => PrimitiveType::SChar,
- "c_uchar" => PrimitiveType::UChar,
- "c_float" => PrimitiveType::Float,
- "c_double" => PrimitiveType::Double,
- "ptrdiff_t" => PrimitiveType::PtrDiffT,
- "VaList" => PrimitiveType::VaList,
- "bool" => PrimitiveType::Bool,
- "char" => PrimitiveType::Char32,
-
- "f32" => PrimitiveType::Float,
- "f64" => PrimitiveType::Double,
-
- _ => {
- let (kind, signed) = match path {
- "c_short" => (IntKind::Short, true),
- "c_int" => (IntKind::Int, true),
- "c_long" => (IntKind::Long, true),
- "c_longlong" => (IntKind::LongLong, true),
- "ssize_t" => (IntKind::SizeT, true),
- "c_ushort" => (IntKind::Short, false),
- "c_uint" => (IntKind::Int, false),
- "c_ulong" => (IntKind::Long, false),
- "c_ulonglong" => (IntKind::LongLong, false),
- "size_t" => (IntKind::SizeT, false),
- "RawFd" => (IntKind::Int, true),
-
- "isize" | "intptr_t" => (IntKind::Size, true),
- "usize" | "uintptr_t" => (IntKind::Size, false),
-
- "u8" | "uint8_t" => (IntKind::B8, false),
- "u16" | "uint16_t" => (IntKind::B16, false),
- "u32" | "uint32_t" => (IntKind::B32, false),
- "u64" | "uint64_t" => (IntKind::B64, false),
- "i8" | "int8_t" => (IntKind::B8, true),
- "i16" | "int16_t" => (IntKind::B16, true),
- "i32" | "int32_t" => (IntKind::B32, true),
- "i64" | "int64_t" => (IntKind::B64, true),
- _ => return None,
- };
- PrimitiveType::Integer {
- zeroable: true,
- signed,
- kind,
- }
- }
- })
- }
-
- pub fn to_repr_rust(&self) -> &'static str {
- match *self {
- PrimitiveType::Bool => "bool",
- PrimitiveType::Void => "c_void",
- PrimitiveType::Char => "c_char",
- PrimitiveType::SChar => "c_schar",
- PrimitiveType::UChar => "c_uchar",
- PrimitiveType::Char32 => "char",
- PrimitiveType::Integer {
- kind,
- signed,
- zeroable: _,
- } => match kind {
- IntKind::Short => {
- if signed {
- "c_short"
- } else {
- "c_ushort"
- }
- }
- IntKind::Int => {
- if signed {
- "c_int"
- } else {
- "c_uint"
- }
- }
- IntKind::Long => {
- if signed {
- "c_long"
- } else {
- "c_ulong"
- }
- }
- IntKind::LongLong => {
- if signed {
- "c_longlong"
- } else {
- "c_ulonglong"
- }
- }
- IntKind::SizeT => {
- if signed {
- "ssize_t"
- } else {
- "size_t"
- }
- }
- IntKind::Size => {
- if signed {
- "isize"
- } else {
- "usize"
- }
- }
- IntKind::B8 => {
- if signed {
- "i8"
- } else {
- "u8"
- }
- }
- IntKind::B16 => {
- if signed {
- "i16"
- } else {
- "u16"
- }
- }
- IntKind::B32 => {
- if signed {
- "i32"
- } else {
- "u32"
- }
- }
- IntKind::B64 => {
- if signed {
- "i64"
- } else {
- "u64"
- }
- }
- },
- PrimitiveType::Float => "f32",
- PrimitiveType::Double => "f64",
- PrimitiveType::PtrDiffT => "ptrdiff_t",
- PrimitiveType::VaList => "va_list",
- }
- }
-
- pub fn to_repr_c(&self, config: &Config) -> &'static str {
- match *self {
- PrimitiveType::Void => "void",
- PrimitiveType::Bool => "bool",
- PrimitiveType::Char => "char",
- PrimitiveType::SChar => "signed char",
- PrimitiveType::UChar => "unsigned char",
- // NOTE: It'd be nice to use a char32_t, but:
- //
- // * uchar.h is not present on mac (see #423).
- //
- // * char32_t isn't required to be compatible with Rust's char, as
- // the C++ spec only requires it to be the same size as
- // uint_least32_t, which is _not_ guaranteed to be 4-bytes.
- //
- PrimitiveType::Char32 => "uint32_t",
- PrimitiveType::Integer {
- kind,
- signed,
- zeroable: _,
- } => match kind {
- IntKind::Short => {
- if signed {
- "short"
- } else {
- "unsigned short"
- }
- }
- IntKind::Int => {
- if signed {
- "int"
- } else {
- "unsigned int"
- }
- }
- IntKind::Long => {
- if signed {
- "long"
- } else {
- "unsigned long"
- }
- }
- IntKind::LongLong => {
- if signed {
- "long long"
- } else {
- "unsigned long long"
- }
- }
- IntKind::SizeT => {
- if signed {
- "ssize_t"
- } else {
- "size_t"
- }
- }
- IntKind::Size => {
- if config.usize_is_size_t {
- if signed {
- "ptrdiff_t"
- } else {
- "size_t"
- }
- } else if signed {
- "intptr_t"
- } else {
- "uintptr_t"
- }
- }
- IntKind::B8 => {
- if signed {
- "int8_t"
- } else {
- "uint8_t"
- }
- }
- IntKind::B16 => {
- if signed {
- "int16_t"
- } else {
- "uint16_t"
- }
- }
- IntKind::B32 => {
- if signed {
- "int32_t"
- } else {
- "uint32_t"
- }
- }
- IntKind::B64 => {
- if signed {
- "int64_t"
- } else {
- "uint64_t"
- }
- }
- },
- PrimitiveType::Float => "float",
- PrimitiveType::Double => "double",
- PrimitiveType::PtrDiffT => "ptrdiff_t",
- PrimitiveType::VaList => "va_list",
- }
- }
-
- fn can_cmp_order(&self) -> bool {
- !matches!(*self, PrimitiveType::Bool)
- }
-
- fn can_cmp_eq(&self) -> bool {
- true
- }
-}
-
-/// Constant expressions.
-///
-/// Used for the `U` part of `[T; U]` and const generics. We support a very
-/// limited vocabulary here: only identifiers and literals.
-#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
-pub enum ConstExpr {
- Name(String),
- Value(String),
-}
-
-impl ConstExpr {
- pub fn as_str(&self) -> &str {
- match *self {
- ConstExpr::Name(ref string) | ConstExpr::Value(ref string) => string,
- }
- }
-
- pub fn rename_for_config(&mut self, config: &Config) {
- if let ConstExpr::Name(ref mut name) = self {
- config.export.rename(name);
- }
- }
-
- pub fn load(expr: &syn::Expr) -> Result<Self, String> {
- match *expr {
- syn::Expr::Lit(syn::ExprLit { ref lit, .. }) => {
- let val = match *lit {
- syn::Lit::Bool(syn::LitBool { value, .. }) => value.to_string(),
- syn::Lit::Int(ref len) => len.base10_digits().to_string(),
- syn::Lit::Byte(ref byte) => u8::to_string(&byte.value()),
- syn::Lit::Char(ref ch) => u32::to_string(&ch.value().into()),
- _ => return Err(format!("can't handle const expression {:?}", lit)),
- };
- Ok(ConstExpr::Value(val))
- }
- syn::Expr::Path(ref path) => {
- let generic_path = GenericPath::load(&path.path)?;
- Ok(ConstExpr::Name(generic_path.export_name().to_owned()))
- }
- _ => Err(format!("can't handle const expression {:?}", expr)),
- }
- }
-
- pub fn specialize(&self, mappings: &[(&Path, &GenericArgument)]) -> ConstExpr {
- match *self {
- ConstExpr::Name(ref name) => {
- let path = Path::new(name);
- for &(param, value) in mappings {
- if path == *param {
- match *value {
- GenericArgument::Type(Type::Path(ref path))
- if path.is_single_identifier() =>
- {
- // This happens when the generic argument is a path.
- return ConstExpr::Name(path.name().to_string());
- }
- GenericArgument::Const(ref expr) => {
- return expr.clone();
- }
- _ => {
- // unsupported argument type - really should be an error
- }
- }
- }
- }
- }
- ConstExpr::Value(_) => {}
- }
- self.clone()
- }
-}
-
-impl Source for ConstExpr {
- fn write<F: Write>(&self, _config: &Config, out: &mut SourceWriter<F>) {
- write!(out, "{}", self.as_str());
- }
-}
-
-#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
-pub enum Type {
- Ptr {
- ty: Box<Type>,
- is_const: bool,
- is_nullable: bool,
- // FIXME: This is a bit of a hack, this is only to get us to codegen
- // `T&` / `const T&`, but we should probably pass that down as an option
- // to code generation or something.
- is_ref: bool,
- },
- Path(GenericPath),
- Primitive(PrimitiveType),
- Array(Box<Type>, ConstExpr),
- FuncPtr {
- ret: Box<Type>,
- args: Vec<(Option<String>, Type)>,
- is_nullable: bool,
- never_return: bool,
- },
-}
-
-impl Type {
- pub fn const_ref_to(ty: &Self) -> Self {
- Type::Ptr {
- ty: Box::new(ty.clone()),
- is_const: true,
- is_nullable: false,
- is_ref: true,
- }
- }
-
- pub fn load_from_output(output: &syn::ReturnType) -> Result<(Type, bool), String> {
- let mut never_return = false;
- let ty = match output {
- syn::ReturnType::Default => Type::Primitive(PrimitiveType::Void),
- syn::ReturnType::Type(_, ref ty) => {
- if let syn::Type::Never(_) = ty.as_ref() {
- never_return = true;
- Type::Primitive(PrimitiveType::Void)
- } else {
- Type::load(ty)?.unwrap_or(Type::Primitive(PrimitiveType::Void))
- }
- }
- };
- Ok((ty, never_return))
- }
-
- pub fn load(ty: &syn::Type) -> Result<Option<Type>, String> {
- let converted = match *ty {
- syn::Type::Reference(ref reference) => {
- let converted = Type::load(&reference.elem)?;
-
- let converted = match converted {
- Some(converted) => converted,
- None => Type::Primitive(PrimitiveType::Void),
- };
-
- // TODO(emilio): we could make these use is_ref: true.
- let is_const = reference.mutability.is_none();
- Type::Ptr {
- ty: Box::new(converted),
- is_const,
- is_nullable: false,
- is_ref: false,
- }
- }
- syn::Type::Ptr(ref pointer) => {
- let converted = Type::load(&pointer.elem)?;
-
- let converted = match converted {
- Some(converted) => converted,
- None => Type::Primitive(PrimitiveType::Void),
- };
-
- let is_const = pointer.mutability.is_none();
- Type::Ptr {
- ty: Box::new(converted),
- is_const,
- is_nullable: true,
- is_ref: false,
- }
- }
- syn::Type::Path(ref path) => {
- let generic_path = GenericPath::load(&path.path)?;
-
- if generic_path.name() == "PhantomData" || generic_path.name() == "PhantomPinned" {
- return Ok(None);
- }
-
- if let Some(prim) = PrimitiveType::maybe(generic_path.name()) {
- if !generic_path.generics().is_empty() {
- return Err("Primitive has generics.".to_owned());
- }
- Type::Primitive(prim)
- } else {
- Type::Path(generic_path)
- }
- }
- syn::Type::Array(syn::TypeArray {
- ref elem, ref len, ..
- }) => {
- let converted = Type::load(elem)?;
-
- let converted = match converted {
- Some(converted) => converted,
- None => return Err("Cannot have an array of zero sized types.".to_owned()),
- };
-
- let len = ConstExpr::load(len)?;
- Type::Array(Box::new(converted), len)
- }
- syn::Type::BareFn(ref function) => {
- let mut wildcard_counter = 0;
- let args = function.inputs.iter().try_skip_map(|x| {
- Type::load(&x.ty).map(|opt_ty| {
- opt_ty.map(|ty| {
- (
- x.name.as_ref().map(|(ref ident, _)| {
- if ident == "_" {
- wildcard_counter += 1;
- if wildcard_counter == 1 {
- "_".to_owned()
- } else {
- format!("_{}", wildcard_counter - 1)
- }
- } else {
- ident.unraw().to_string()
- }
- }),
- ty,
- )
- })
- })
- })?;
- let (ret, never_return) = Type::load_from_output(&function.output)?;
- Type::FuncPtr {
- ret: Box::new(ret),
- args,
- is_nullable: false,
- never_return,
- }
- }
- syn::Type::Tuple(ref tuple) => {
- if tuple.elems.is_empty() {
- return Ok(None);
- }
- return Err("Tuples are not supported types.".to_owned());
- }
- _ => return Err(format!("Unsupported type: {:?}", ty)),
- };
-
- Ok(Some(converted))
- }
-
- pub fn is_ptr(&self) -> bool {
- matches!(*self, Type::Ptr { .. } | Type::FuncPtr { .. })
- }
-
- pub fn is_primitive_or_ptr_primitive(&self) -> bool {
- match *self {
- Type::Primitive(..) => true,
- Type::Ptr { ref ty, .. } => matches!(ty.as_ref(), Type::Primitive(..)),
- _ => false,
- }
- }
-
- pub fn make_zeroable(&self) -> Option<Self> {
- let (kind, signed) = match *self {
- Type::Primitive(PrimitiveType::Integer {
- zeroable: false,
- kind,
- signed,
- }) => (kind, signed),
- _ => return None,
- };
-
- Some(Type::Primitive(PrimitiveType::Integer {
- kind,
- signed,
- zeroable: true,
- }))
- }
-
- pub fn make_nullable(&self) -> Option<Self> {
- match *self {
- Type::Ptr {
- ref ty,
- is_const,
- is_ref,
- is_nullable: false,
- } => Some(Type::Ptr {
- ty: ty.clone(),
- is_const,
- is_ref,
- is_nullable: true,
- }),
- Type::FuncPtr {
- ref ret,
- ref args,
- is_nullable: false,
- never_return,
- } => Some(Type::FuncPtr {
- ret: ret.clone(),
- args: args.clone(),
- is_nullable: true,
- never_return,
- }),
- _ => None,
- }
- }
-
- fn nonzero_to_primitive(&self) -> Option<Self> {
- let path = match *self {
- Type::Path(ref p) => p,
- _ => return None,
- };
-
- if !path.generics().is_empty() {
- return None;
- }
-
- let name = path.name();
- if !name.starts_with("NonZero") {
- return None;
- }
-
- let (kind, signed) = match path.name() {
- "NonZeroU8" => (IntKind::B8, false),
- "NonZeroU16" => (IntKind::B16, false),
- "NonZeroU32" => (IntKind::B32, false),
- "NonZeroU64" => (IntKind::B64, false),
- "NonZeroUSize" => (IntKind::Size, false),
- "NonZeroI8" => (IntKind::B8, true),
- "NonZeroI16" => (IntKind::B16, true),
- "NonZeroI32" => (IntKind::B32, true),
- "NonZeroI64" => (IntKind::B64, true),
- "NonZeroISize" => (IntKind::Size, true),
- _ => return None,
- };
-
- Some(Type::Primitive(PrimitiveType::Integer {
- zeroable: false,
- signed,
- kind,
- }))
- }
-
- fn simplified_type(&self, config: &Config) -> Option<Self> {
- let path = match *self {
- Type::Path(ref p) => p,
- _ => return None,
- };
-
- if path.generics().is_empty() {
- return self.nonzero_to_primitive();
- }
-
- if path.generics().len() != 1 {
- return None;
- }
-
- let unsimplified_generic = match path.generics()[0] {
- GenericArgument::Type(ref ty) => ty,
- GenericArgument::Const(_) => return None,
- };
-
- let generic = match unsimplified_generic.simplified_type(config) {
- Some(generic) => Cow::Owned(generic),
- None => Cow::Borrowed(unsimplified_generic),
- };
- match path.name() {
- "Option" => {
- if let Some(nullable) = generic.make_nullable() {
- return Some(nullable);
- }
- if let Some(zeroable) = generic.make_zeroable() {
- return Some(zeroable);
- }
- None
- }
- "NonNull" => Some(Type::Ptr {
- ty: Box::new(generic.into_owned()),
- is_const: false,
- is_nullable: false,
- is_ref: false,
- }),
- "Box" if config.language != Language::Cxx => Some(Type::Ptr {
- ty: Box::new(generic.into_owned()),
- is_const: false,
- is_nullable: false,
- is_ref: false,
- }),
- "Cell" => Some(generic.into_owned()),
- "ManuallyDrop" | "MaybeUninit" | "Pin" if config.language != Language::Cxx => {
- Some(generic.into_owned())
- }
- _ => None,
- }
- }
-
- pub fn simplify_standard_types(&mut self, config: &Config) {
- self.visit_types(|ty| ty.simplify_standard_types(config));
- if let Some(ty) = self.simplified_type(config) {
- *self = ty;
- }
- }
-
- pub fn replace_self_with(&mut self, self_ty: &Path) {
- if let Type::Path(ref mut generic_path) = *self {
- generic_path.replace_self_with(self_ty);
- }
- self.visit_types(|ty| ty.replace_self_with(self_ty))
- }
-
- fn visit_types(&mut self, mut visitor: impl FnMut(&mut Type)) {
- match *self {
- Type::Array(ref mut ty, ..) | Type::Ptr { ref mut ty, .. } => visitor(ty),
- Type::Path(ref mut path) => {
- for generic in path.generics_mut() {
- match *generic {
- GenericArgument::Type(ref mut ty) => visitor(ty),
- GenericArgument::Const(_) => {}
- }
- }
- }
- Type::Primitive(..) => {}
- Type::FuncPtr {
- ref mut ret,
- ref mut args,
- ..
- } => {
- visitor(ret);
- for arg in args {
- visitor(&mut arg.1)
- }
- }
- }
- }
-
- pub fn get_root_path(&self) -> Option<Path> {
- let mut current = self;
- loop {
- match *current {
- Type::Ptr { ref ty, .. } => current = ty,
- Type::Path(ref generic) => {
- return Some(generic.path().clone());
- }
- Type::Primitive(..) => {
- return None;
- }
- Type::Array(..) => {
- return None;
- }
- Type::FuncPtr { .. } => {
- return None;
- }
- };
- }
- }
-
- pub fn specialize(&self, mappings: &[(&Path, &GenericArgument)]) -> Type {
- match *self {
- Type::Ptr {
- ref ty,
- is_const,
- is_nullable,
- is_ref,
- } => Type::Ptr {
- ty: Box::new(ty.specialize(mappings)),
- is_const,
- is_nullable,
- is_ref,
- },
- Type::Path(ref generic_path) => {
- for &(param, value) in mappings {
- if generic_path.path() == param {
- if let GenericArgument::Type(ref ty) = *value {
- return ty.clone();
- }
- }
- }
-
- let specialized = GenericPath::new(
- generic_path.path().clone(),
- generic_path
- .generics()
- .iter()
- .map(|x| x.specialize(mappings))
- .collect(),
- );
- Type::Path(specialized)
- }
- Type::Primitive(ref primitive) => Type::Primitive(primitive.clone()),
- Type::Array(ref ty, ref constant) => Type::Array(
- Box::new(ty.specialize(mappings)),
- constant.specialize(mappings),
- ),
- Type::FuncPtr {
- ref ret,
- ref args,
- is_nullable,
- never_return,
- } => Type::FuncPtr {
- ret: Box::new(ret.specialize(mappings)),
- args: args
- .iter()
- .cloned()
- .map(|(name, ty)| (name, ty.specialize(mappings)))
- .collect(),
- is_nullable,
- never_return,
- },
- }
- }
-
- pub fn add_dependencies_ignoring_generics(
- &self,
- generic_params: &GenericParams,
- library: &Library,
- out: &mut Dependencies,
- ) {
- match *self {
- Type::Ptr { ref ty, .. } => {
- ty.add_dependencies_ignoring_generics(generic_params, library, out);
- }
- Type::Path(ref generic) => {
- for generic_value in generic.generics() {
- if let GenericArgument::Type(ref ty) = *generic_value {
- ty.add_dependencies_ignoring_generics(generic_params, library, out);
- }
- }
- let path = generic.path();
- if !generic_params.iter().any(|param| param.name() == path) {
- if let Some(items) = library.get_items(path) {
- if !out.items.contains(path) {
- out.items.insert(path.clone());
-
- for item in &items {
- item.deref().add_dependencies(library, out);
- }
- for item in items {
- out.order.push(item);
- }
- }
- } else {
- warn!(
- "Can't find {}. This usually means that this type was incompatible or \
- not found.",
- path
- );
- }
- }
- }
- Type::Primitive(_) => {}
- Type::Array(ref ty, _) => {
- ty.add_dependencies_ignoring_generics(generic_params, library, out);
- }
- Type::FuncPtr {
- ref ret, ref args, ..
- } => {
- ret.add_dependencies_ignoring_generics(generic_params, library, out);
- for (_, ref arg) in args {
- arg.add_dependencies_ignoring_generics(generic_params, library, out);
- }
- }
- }
- }
-
- pub fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
- self.add_dependencies_ignoring_generics(&GenericParams::default(), library, out)
- }
-
- pub fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
- match *self {
- Type::Ptr { ref ty, .. } => {
- ty.add_monomorphs(library, out);
- }
- Type::Path(ref generic) => {
- if generic.generics().is_empty() || out.contains(generic) {
- return;
- }
- let path = generic.path();
- if let Some(items) = library.get_items(path) {
- for item in items {
- item.deref()
- .instantiate_monomorph(generic.generics(), library, out);
- }
- }
- }
- Type::Primitive(_) => {}
- Type::Array(ref ty, _) => {
- ty.add_monomorphs(library, out);
- }
- Type::FuncPtr {
- ref ret, ref args, ..
- } => {
- ret.add_monomorphs(library, out);
- for (_, ref arg) in args {
- arg.add_monomorphs(library, out);
- }
- }
- }
- }
-
- pub fn rename_for_config(&mut self, config: &Config, generic_params: &GenericParams) {
- match *self {
- Type::Ptr { ref mut ty, .. } => {
- ty.rename_for_config(config, generic_params);
- }
- Type::Path(ref mut ty) => {
- ty.rename_for_config(config, generic_params);
- }
- Type::Primitive(_) => {}
- Type::Array(ref mut ty, ref mut len) => {
- ty.rename_for_config(config, generic_params);
- len.rename_for_config(config);
- }
- Type::FuncPtr {
- ref mut ret,
- ref mut args,
- ..
- } => {
- ret.rename_for_config(config, generic_params);
- for (_, arg) in args {
- arg.rename_for_config(config, generic_params);
- }
- }
- }
- }
-
- pub fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
- match *self {
- Type::Ptr { ref mut ty, .. } => {
- ty.resolve_declaration_types(resolver);
- }
- Type::Path(ref mut generic_path) => {
- generic_path.resolve_declaration_types(resolver);
- }
- Type::Primitive(_) => {}
- Type::Array(ref mut ty, _) => {
- ty.resolve_declaration_types(resolver);
- }
- Type::FuncPtr {
- ref mut ret,
- ref mut args,
- ..
- } => {
- ret.resolve_declaration_types(resolver);
- for (_, ref mut arg) in args {
- arg.resolve_declaration_types(resolver);
- }
- }
- }
- }
-
- pub fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
- match *self {
- Type::Ptr { ref mut ty, .. } => {
- ty.mangle_paths(monomorphs);
- }
- Type::Path(ref mut generic_path) => {
- if generic_path.generics().is_empty() {
- return;
- }
-
- if let Some(mangled_path) = monomorphs.mangle_path(generic_path) {
- *generic_path = GenericPath::new(mangled_path.clone(), vec![]);
- } else {
- warn!(
- "Cannot find a mangling for generic path {:?}. This usually means that a \
- type referenced by this generic was incompatible or not found.",
- generic_path
- );
- }
- }
- Type::Primitive(_) => {}
- Type::Array(ref mut ty, _) => {
- ty.mangle_paths(monomorphs);
- }
- Type::FuncPtr {
- ref mut ret,
- ref mut args,
- ..
- } => {
- ret.mangle_paths(monomorphs);
- for (_, ref mut arg) in args {
- arg.mangle_paths(monomorphs);
- }
- }
- }
- }
-
- pub fn can_cmp_order(&self) -> bool {
- match *self {
- // FIXME: Shouldn't this look at ty.can_cmp_order() as well?
- Type::Ptr { is_ref, .. } => !is_ref,
- Type::Path(..) => true,
- Type::Primitive(ref p) => p.can_cmp_order(),
- Type::Array(..) => false,
- Type::FuncPtr { .. } => false,
- }
- }
-
- pub fn can_cmp_eq(&self) -> bool {
- match *self {
- Type::Ptr { ref ty, is_ref, .. } => !is_ref || ty.can_cmp_eq(),
- Type::Path(..) => true,
- Type::Primitive(ref p) => p.can_cmp_eq(),
- Type::Array(..) => false,
- Type::FuncPtr { .. } => true,
- }
- }
-}
-
-impl Source for String {
- fn write<F: Write>(&self, _config: &Config, out: &mut SourceWriter<F>) {
- write!(out, "{}", self);
- }
-}
-
-impl Source for Type {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- cdecl::write_type(out, self, config);
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/typedef.rs b/cbindgen-0.24.5/src/bindgen/ir/typedef.rs
deleted file mode 100644
index 626732e..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/typedef.rs
+++ /dev/null
@@ -1,208 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::collections::HashMap;
-use std::io::Write;
-
-use syn::ext::IdentExt;
-
-use crate::bindgen::config::{Config, Language};
-use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
-use crate::bindgen::dependencies::Dependencies;
-use crate::bindgen::ir::{
- AnnotationSet, Cfg, ConditionWrite, Documentation, Field, GenericArgument, GenericParams, Item,
- ItemContainer, Path, ToCondition, Type,
-};
-use crate::bindgen::library::Library;
-use crate::bindgen::mangle;
-use crate::bindgen::monomorph::Monomorphs;
-use crate::bindgen::writer::{Source, SourceWriter};
-
-/// A type alias that is represented as a C typedef
-#[derive(Debug, Clone)]
-pub struct Typedef {
- pub path: Path,
- pub export_name: String,
- pub generic_params: GenericParams,
- pub aliased: Type,
- pub cfg: Option<Cfg>,
- pub annotations: AnnotationSet,
- pub documentation: Documentation,
-}
-
-impl Typedef {
- pub fn load(item: &syn::ItemType, mod_cfg: Option<&Cfg>) -> Result<Typedef, String> {
- if let Some(x) = Type::load(&item.ty)? {
- let path = Path::new(item.ident.unraw().to_string());
- Ok(Typedef::new(
- path,
- GenericParams::load(&item.generics)?,
- x,
- Cfg::append(mod_cfg, Cfg::load(&item.attrs)),
- AnnotationSet::load(&item.attrs)?,
- Documentation::load(&item.attrs),
- ))
- } else {
- Err("Cannot have a typedef of a zero sized type.".to_owned())
- }
- }
-
- pub fn new(
- path: Path,
- generic_params: GenericParams,
- aliased: Type,
- cfg: Option<Cfg>,
- annotations: AnnotationSet,
- documentation: Documentation,
- ) -> Self {
- let export_name = path.name().to_owned();
- Self {
- path,
- export_name,
- generic_params,
- aliased,
- cfg,
- annotations,
- documentation,
- }
- }
-
- pub fn simplify_standard_types(&mut self, config: &Config) {
- self.aliased.simplify_standard_types(config);
- }
-
- pub fn transfer_annotations(&mut self, out: &mut HashMap<Path, AnnotationSet>) {
- if self.annotations.is_empty() {
- return;
- }
-
- if let Some(alias_path) = self.aliased.get_root_path() {
- if out.contains_key(&alias_path) {
- warn!(
- "Multiple typedef's with annotations for {}. Ignoring annotations from {}.",
- alias_path, self.path
- );
- return;
- }
-
- out.insert(alias_path, self.annotations.clone());
- self.annotations = AnnotationSet::new();
- }
- }
-
- pub fn is_generic(&self) -> bool {
- self.generic_params.len() > 0
- }
-
- pub fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
- // Generic structs can instantiate monomorphs only once they've been
- // instantiated. See `instantiate_monomorph` for more details.
- if self.is_generic() {
- return;
- }
-
- self.aliased.add_monomorphs(library, out);
- }
-
- pub fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
- self.aliased.mangle_paths(monomorphs);
- }
-}
-
-impl Item for Typedef {
- fn path(&self) -> &Path {
- &self.path
- }
-
- fn export_name(&self) -> &str {
- &self.export_name
- }
-
- fn cfg(&self) -> Option<&Cfg> {
- self.cfg.as_ref()
- }
-
- fn annotations(&self) -> &AnnotationSet {
- &self.annotations
- }
-
- fn annotations_mut(&mut self) -> &mut AnnotationSet {
- &mut self.annotations
- }
-
- fn container(&self) -> ItemContainer {
- ItemContainer::Typedef(self.clone())
- }
-
- fn rename_for_config(&mut self, config: &Config) {
- config.export.rename(&mut self.export_name);
- self.aliased.rename_for_config(config, &self.generic_params);
- }
-
- fn collect_declaration_types(&self, resolver: &mut DeclarationTypeResolver) {
- resolver.add_none(&self.path);
- }
-
- fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
- self.aliased.resolve_declaration_types(resolver);
- }
-
- fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
- self.aliased
- .add_dependencies_ignoring_generics(&self.generic_params, library, out);
- }
-
- fn instantiate_monomorph(
- &self,
- generic_values: &[GenericArgument],
- library: &Library,
- out: &mut Monomorphs,
- ) {
- let mappings = self.generic_params.call(self.path.name(), generic_values);
-
- let mangled_path = mangle::mangle_path(
- &self.path,
- generic_values,
- &library.get_config().export.mangle,
- );
-
- let monomorph = Typedef::new(
- mangled_path,
- GenericParams::default(),
- self.aliased.specialize(&mappings),
- self.cfg.clone(),
- self.annotations.clone(),
- self.documentation.clone(),
- );
-
- out.insert_typedef(library, self, monomorph, generic_values.to_owned());
- }
-}
-
-impl Source for Typedef {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- let condition = self.cfg.to_condition(config);
- condition.write_before(config, out);
-
- self.documentation.write(config, out);
-
- self.generic_params.write(config, out);
-
- match config.language {
- Language::Cxx => {
- write!(out, "using {} = ", self.export_name());
- self.aliased.write(config, out);
- }
- Language::C | Language::Cython => {
- write!(out, "{} ", config.language.typedef());
- Field::from_name_and_type(self.export_name().to_owned(), self.aliased.clone())
- .write(config, out);
- }
- }
-
- out.write(";");
-
- condition.write_after(config, out);
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/union.rs b/cbindgen-0.24.5/src/bindgen/ir/union.rs
deleted file mode 100644
index 07bd16c..0000000
--- a/cbindgen-0.24.5/src/bindgen/ir/union.rs
+++ /dev/null
@@ -1,336 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::io::Write;
-
-use syn::ext::IdentExt;
-
-use crate::bindgen::config::{Config, Language, LayoutConfig};
-use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
-use crate::bindgen::dependencies::Dependencies;
-use crate::bindgen::ir::{
- AnnotationSet, Cfg, ConditionWrite, Documentation, Field, GenericArgument, GenericParams, Item,
- ItemContainer, Path, Repr, ReprAlign, ReprStyle, ToCondition,
-};
-use crate::bindgen::library::Library;
-use crate::bindgen::mangle;
-use crate::bindgen::monomorph::Monomorphs;
-use crate::bindgen::rename::{IdentifierType, RenameRule};
-use crate::bindgen::utilities::IterHelpers;
-use crate::bindgen::writer::{ListType, Source, SourceWriter};
-
-#[derive(Debug, Clone)]
-pub struct Union {
- pub path: Path,
- pub export_name: String,
- pub generic_params: GenericParams,
- pub fields: Vec<Field>,
- pub tuple_union: bool,
- pub alignment: Option<ReprAlign>,
- pub cfg: Option<Cfg>,
- pub annotations: AnnotationSet,
- pub documentation: Documentation,
-}
-
-impl Union {
- pub fn load(
- layout_config: &LayoutConfig,
- item: &syn::ItemUnion,
- mod_cfg: Option<&Cfg>,
- ) -> Result<Union, String> {
- let repr = Repr::load(&item.attrs)?;
- if repr.style != ReprStyle::C {
- return Err("Union is not marked #[repr(C)].".to_owned());
- }
-
- // Ensure we can safely represent the union given the configuration.
- if let Some(align) = repr.align {
- layout_config.ensure_safe_to_represent(&align)?;
- }
-
- let path = Path::new(item.ident.unraw().to_string());
-
- let (fields, tuple_union) = {
- let out = item
- .fields
- .named
- .iter()
- .try_skip_map(|field| Field::load(field, &path))?;
- (out, false)
- };
-
- Ok(Union::new(
- path,
- GenericParams::load(&item.generics)?,
- fields,
- repr.align,
- tuple_union,
- Cfg::append(mod_cfg, Cfg::load(&item.attrs)),
- AnnotationSet::load(&item.attrs)?,
- Documentation::load(&item.attrs),
- ))
- }
-
- #[allow(clippy::too_many_arguments)]
- pub fn new(
- path: Path,
- generic_params: GenericParams,
- fields: Vec<Field>,
- alignment: Option<ReprAlign>,
- tuple_union: bool,
- cfg: Option<Cfg>,
- annotations: AnnotationSet,
- documentation: Documentation,
- ) -> Self {
- let export_name = path.name().to_owned();
- Self {
- path,
- export_name,
- generic_params,
- fields,
- tuple_union,
- alignment,
- cfg,
- annotations,
- documentation,
- }
- }
-
- pub fn simplify_standard_types(&mut self, config: &Config) {
- for field in &mut self.fields {
- field.ty.simplify_standard_types(config);
- }
- }
-
- pub fn is_generic(&self) -> bool {
- self.generic_params.len() > 0
- }
-
- pub fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
- // Generic unions can instantiate monomorphs only once they've been
- // instantiated. See `instantiate_monomorph` for more details.
- if self.is_generic() {
- return;
- }
-
- for field in &self.fields {
- field.ty.add_monomorphs(library, out);
- }
- }
-
- pub fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
- for field in &mut self.fields {
- field.ty.mangle_paths(monomorphs);
- }
- }
-}
-
-impl Item for Union {
- fn path(&self) -> &Path {
- &self.path
- }
-
- fn export_name(&self) -> &str {
- &self.export_name
- }
-
- fn cfg(&self) -> Option<&Cfg> {
- self.cfg.as_ref()
- }
-
- fn annotations(&self) -> &AnnotationSet {
- &self.annotations
- }
-
- fn annotations_mut(&mut self) -> &mut AnnotationSet {
- &mut self.annotations
- }
-
- fn container(&self) -> ItemContainer {
- ItemContainer::Union(self.clone())
- }
-
- fn collect_declaration_types(&self, resolver: &mut DeclarationTypeResolver) {
- resolver.add_union(&self.path);
- }
-
- fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
- for field in &mut self.fields {
- field.ty.resolve_declaration_types(resolver);
- }
- }
-
- fn rename_for_config(&mut self, config: &Config) {
- config.export.rename(&mut self.export_name);
- for field in &mut self.fields {
- field.ty.rename_for_config(config, &self.generic_params);
- }
-
- let rules = self
- .annotations
- .parse_atom::<RenameRule>("rename-all")
- .unwrap_or(config.structure.rename_fields);
-
- if let Some(o) = self.annotations.list("field-names") {
- let mut overriden_fields = Vec::new();
-
- for (i, field) in self.fields.iter().enumerate() {
- if i >= o.len() {
- overriden_fields.push(field.clone());
- } else {
- overriden_fields.push(Field {
- name: o[i].clone(),
- ty: field.ty.clone(),
- cfg: field.cfg.clone(),
- annotations: field.annotations.clone(),
- documentation: field.documentation.clone(),
- });
- }
- }
-
- self.fields = overriden_fields;
- } else if let Some(r) = rules.not_none() {
- self.fields = self
- .fields
- .iter()
- .map(|field| Field {
- name: r
- .apply(&field.name, IdentifierType::StructMember)
- .into_owned(),
- ty: field.ty.clone(),
- cfg: field.cfg.clone(),
- annotations: field.annotations.clone(),
- documentation: field.documentation.clone(),
- })
- .collect();
- } else if self.tuple_union {
- // If we don't have any rules for a tuple union, prefix them with
- // an underscore so it still compiles
- for field in &mut self.fields {
- field.name.insert(0, '_');
- }
- }
- }
-
- fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
- for field in &self.fields {
- field
- .ty
- .add_dependencies_ignoring_generics(&self.generic_params, library, out);
- }
- }
-
- fn instantiate_monomorph(
- &self,
- generic_values: &[GenericArgument],
- library: &Library,
- out: &mut Monomorphs,
- ) {
- let mappings = self.generic_params.call(self.path.name(), generic_values);
-
- let mangled_path = mangle::mangle_path(
- &self.path,
- generic_values,
- &library.get_config().export.mangle,
- );
-
- let monomorph = Union::new(
- mangled_path,
- GenericParams::default(),
- self.fields
- .iter()
- .map(|field| Field {
- name: field.name.clone(),
- ty: field.ty.specialize(&mappings),
- cfg: field.cfg.clone(),
- annotations: field.annotations.clone(),
- documentation: field.documentation.clone(),
- })
- .collect(),
- self.alignment,
- self.tuple_union,
- self.cfg.clone(),
- self.annotations.clone(),
- self.documentation.clone(),
- );
-
- out.insert_union(library, self, monomorph, generic_values.to_owned());
- }
-}
-
-impl Source for Union {
- fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
- let condition = self.cfg.to_condition(config);
- condition.write_before(config, out);
-
- self.documentation.write(config, out);
-
- self.generic_params.write(config, out);
-
- // The following results in
- // C++ or C with Tag as style:
- // union Name {
- // C with Type only style:
- // typedef union {
- // C with Both as style:
- // typedef union Name {
- match config.language {
- Language::C if config.style.generate_typedef() => out.write("typedef "),
- Language::C | Language::Cxx => {}
- Language::Cython => out.write(config.style.cython_def()),
- }
-
- out.write("union");
-
- // Cython supports `packed` on structs (see comments there), but not on unions.
- if config.language != Language::Cython {
- if let Some(align) = self.alignment {
- match align {
- ReprAlign::Packed => {
- if let Some(ref anno) = config.layout.packed {
- write!(out, " {}", anno);
- }
- }
- ReprAlign::Align(n) => {
- if let Some(ref anno) = config.layout.aligned_n {
- write!(out, " {}({})", anno, n);
- }
- }
- }
- }
- }
-
- if config.language != Language::C || config.style.generate_tag() {
- write!(out, " {}", self.export_name);
- }
-
- out.open_brace();
-
- // Emit the pre_body section, if relevant
- if let Some(body) = config.export.pre_body(&self.path) {
- out.write_raw_block(body);
- out.new_line();
- }
-
- out.write_vertical_source_list(&self.fields, ListType::Cap(";"));
- if config.language == Language::Cython && self.fields.is_empty() {
- out.write("pass");
- }
-
- // Emit the post_body section, if relevant
- if let Some(body) = config.export.post_body(&self.path) {
- out.new_line();
- out.write_raw_block(body);
- }
-
- if config.language == Language::C && config.style.generate_typedef() {
- out.close_brace(false);
- write!(out, " {};", self.export_name);
- } else {
- out.close_brace(true);
- }
-
- condition.write_after(config, out);
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/library.rs b/cbindgen-0.24.5/src/bindgen/library.rs
deleted file mode 100644
index c00a6eb..0000000
--- a/cbindgen-0.24.5/src/bindgen/library.rs
+++ /dev/null
@@ -1,441 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::collections::HashMap;
-
-use crate::bindgen::bindings::Bindings;
-use crate::bindgen::config::{Config, Language, SortKey};
-use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
-use crate::bindgen::dependencies::Dependencies;
-use crate::bindgen::error::Error;
-use crate::bindgen::ir::{Constant, Enum, Function, Item, ItemContainer, ItemMap};
-use crate::bindgen::ir::{OpaqueItem, Path, Static, Struct, Typedef, Union};
-use crate::bindgen::monomorph::Monomorphs;
-use crate::bindgen::ItemType;
-
-#[derive(Debug, Clone)]
-pub struct Library {
- config: Config,
- constants: ItemMap<Constant>,
- globals: ItemMap<Static>,
- enums: ItemMap<Enum>,
- structs: ItemMap<Struct>,
- unions: ItemMap<Union>,
- opaque_items: ItemMap<OpaqueItem>,
- typedefs: ItemMap<Typedef>,
- functions: Vec<Function>,
-}
-
-impl Library {
- #[allow(clippy::too_many_arguments)]
- pub fn new(
- config: Config,
- constants: ItemMap<Constant>,
- globals: ItemMap<Static>,
- enums: ItemMap<Enum>,
- structs: ItemMap<Struct>,
- unions: ItemMap<Union>,
- opaque_items: ItemMap<OpaqueItem>,
- typedefs: ItemMap<Typedef>,
- functions: Vec<Function>,
- ) -> Library {
- Library {
- config,
- constants,
- globals,
- enums,
- structs,
- unions,
- opaque_items,
- typedefs,
- functions,
- }
- }
-
- pub fn generate(mut self) -> Result<Bindings, Error> {
- self.transfer_annotations();
- self.simplify_standard_types();
-
- match self.config.function.sort_by.unwrap_or(self.config.sort_by) {
- SortKey::Name => self.functions.sort_by(|x, y| x.path.cmp(&y.path)),
- SortKey::None => { /* keep input order */ }
- }
-
- if self.config.language != Language::Cxx {
- self.instantiate_monomorphs();
- }
- self.remove_excluded();
- if self.config.language == Language::C {
- self.resolve_declaration_types();
- }
-
- self.rename_items();
-
- let mut dependencies = Dependencies::new();
-
- for function in &self.functions {
- function.add_dependencies(&self, &mut dependencies);
- }
- self.globals.for_all_items(|global| {
- global.add_dependencies(&self, &mut dependencies);
- });
- self.constants.for_all_items(|constant| {
- constant.add_dependencies(&self, &mut dependencies);
- });
- for name in &self.config.export.include {
- let path = Path::new(name.clone());
- if let Some(items) = self.get_items(&path) {
- if dependencies.items.insert(path) {
- for item in &items {
- item.deref().add_dependencies(&self, &mut dependencies);
- }
- for item in items {
- dependencies.order.push(item);
- }
- }
- }
- }
-
- dependencies.sort();
-
- let items = dependencies.order;
- let constants = if self.config.export.should_generate(ItemType::Constants) {
- let mut constants = self.constants.to_vec();
- match self.config.constant.sort_by.unwrap_or(self.config.sort_by) {
- SortKey::Name => constants.sort_by(|x, y| x.path.cmp(&y.path)),
- SortKey::None => { /* keep input order */ }
- }
- constants
- } else {
- vec![]
- };
-
- let globals = if self.config.export.should_generate(ItemType::Globals) {
- let mut globals = self.globals.to_vec();
- match self.config.constant.sort_by.unwrap_or(self.config.sort_by) {
- SortKey::Name => globals.sort_by(|x, y| x.path.cmp(&y.path)),
- SortKey::None => { /* keep input order */ }
- }
- globals
- } else {
- vec![]
- };
- let functions = if self.config.export.should_generate(ItemType::Functions) {
- self.functions
- } else {
- vec![]
- };
-
- Ok(Bindings::new(
- self.config,
- self.structs,
- self.typedefs,
- constants,
- globals,
- items,
- functions,
- false,
- ))
- }
-
- pub fn get_items(&self, p: &Path) -> Option<Vec<ItemContainer>> {
- macro_rules! find {
- ($field:ident, $kind:ident) => {
- if self.config.export.should_generate(ItemType::$kind) {
- if let Some(x) = self.$field.get_items(p) {
- return Some(x);
- }
- }
- };
- }
-
- find!(enums, Enums);
- find!(structs, Structs);
- find!(unions, Unions);
- find!(opaque_items, OpaqueItems);
- find!(typedefs, Typedefs);
-
- None
- }
-
- pub fn get_config(&self) -> &Config {
- &self.config
- }
-
- fn remove_excluded(&mut self) {
- let config = &self.config;
- // FIXME: interpret `config.export.exclude` as `Path`s.
- self.functions
- .retain(|x| !config.export.exclude.iter().any(|y| y == x.path().name()));
- self.enums
- .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
- self.structs
- .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
- self.unions
- .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
- self.opaque_items
- .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
- self.typedefs
- .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
- self.globals
- .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
- self.constants
- .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
- }
-
- fn transfer_annotations(&mut self) {
- let mut annotations = HashMap::new();
-
- self.typedefs.for_all_items_mut(|x| {
- x.transfer_annotations(&mut annotations);
- });
-
- for (alias_path, annotations) in annotations {
- // TODO
- let mut transferred = false;
-
- self.enums.for_items_mut(&alias_path, |x| {
- if x.annotations().is_empty() {
- *x.annotations_mut() = annotations.clone();
- transferred = true;
- } else {
- warn!(
- "Can't transfer annotations from typedef to alias ({}) \
- that already has annotations.",
- alias_path
- );
- }
- });
- if transferred {
- continue;
- }
- self.structs.for_items_mut(&alias_path, |x| {
- if x.annotations().is_empty() {
- *x.annotations_mut() = annotations.clone();
- transferred = true;
- } else {
- warn!(
- "Can't transfer annotations from typedef to alias ({}) \
- that already has annotations.",
- alias_path
- );
- }
- });
- if transferred {
- continue;
- }
- self.unions.for_items_mut(&alias_path, |x| {
- if x.annotations().is_empty() {
- *x.annotations_mut() = annotations.clone();
- transferred = true;
- } else {
- warn!(
- "Can't transfer annotations from typedef to alias ({}) \
- that already has annotations.",
- alias_path
- );
- }
- });
- if transferred {
- continue;
- }
- self.opaque_items.for_items_mut(&alias_path, |x| {
- if x.annotations().is_empty() {
- *x.annotations_mut() = annotations.clone();
- transferred = true;
- } else {
- warn!(
- "Can't transfer annotations from typedef to alias ({}) \
- that already has annotations.",
- alias_path
- );
- }
- });
- if transferred {
- continue;
- }
- self.typedefs.for_items_mut(&alias_path, |x| {
- if x.annotations().is_empty() {
- *x.annotations_mut() = annotations.clone();
- transferred = true;
- } else {
- warn!(
- "Can't transfer annotations from typedef to alias ({}) \
- that already has annotations.",
- alias_path
- );
- }
- });
- if transferred {
- continue;
- }
- }
- }
-
- fn rename_items(&mut self) {
- let config = &self.config;
-
- self.globals
- .for_all_items_mut(|x| x.rename_for_config(config));
- self.globals.rebuild();
-
- self.constants
- .for_all_items_mut(|x| x.rename_for_config(config));
- self.constants.rebuild();
-
- self.structs
- .for_all_items_mut(|x| x.rename_for_config(config));
- self.structs.rebuild();
-
- self.unions
- .for_all_items_mut(|x| x.rename_for_config(config));
- self.unions.rebuild();
-
- self.enums
- .for_all_items_mut(|x| x.rename_for_config(config));
- self.enums.rebuild();
-
- self.opaque_items
- .for_all_items_mut(|x| x.rename_for_config(config));
- self.opaque_items.rebuild();
-
- self.typedefs
- .for_all_items_mut(|x| x.rename_for_config(config));
- self.typedefs.rebuild();
-
- for item in &mut self.functions {
- item.rename_for_config(&self.config);
- }
- }
-
- fn resolve_declaration_types(&mut self) {
- if !self.config.style.generate_tag() {
- return;
- }
-
- let mut resolver = DeclarationTypeResolver::default();
-
- self.structs.for_all_items(|x| {
- x.collect_declaration_types(&mut resolver);
- });
-
- self.enums.for_all_items(|x| {
- x.collect_declaration_types(&mut resolver);
- });
-
- self.unions.for_all_items(|x| {
- x.collect_declaration_types(&mut resolver);
- });
-
- self.typedefs.for_all_items(|x| {
- x.collect_declaration_types(&mut resolver);
- });
-
- // NOTE: Intentionally last, so that in case there's an opaque type
- // which is conflicting with a non-opaque one, the later wins.
- self.opaque_items.for_all_items(|x| {
- x.collect_declaration_types(&mut resolver);
- });
-
- self.enums
- .for_all_items_mut(|x| x.resolve_declaration_types(&resolver));
-
- self.structs
- .for_all_items_mut(|x| x.resolve_declaration_types(&resolver));
-
- self.unions
- .for_all_items_mut(|x| x.resolve_declaration_types(&resolver));
-
- self.typedefs
- .for_all_items_mut(|x| x.resolve_declaration_types(&resolver));
-
- self.globals
- .for_all_items_mut(|x| x.resolve_declaration_types(&resolver));
-
- for item in &mut self.functions {
- item.resolve_declaration_types(&resolver);
- }
- }
-
- fn simplify_standard_types(&mut self) {
- let config = &self.config;
-
- self.structs.for_all_items_mut(|x| {
- x.simplify_standard_types(config);
- });
- self.enums.for_all_items_mut(|x| {
- x.simplify_standard_types(config);
- });
- self.unions.for_all_items_mut(|x| {
- x.simplify_standard_types(config);
- });
- self.globals.for_all_items_mut(|x| {
- x.simplify_standard_types(config);
- });
- self.typedefs.for_all_items_mut(|x| {
- x.simplify_standard_types(config);
- });
- for x in &mut self.functions {
- x.simplify_standard_types(config);
- }
- }
-
- fn instantiate_monomorphs(&mut self) {
- // Collect a list of monomorphs
- let mut monomorphs = Monomorphs::default();
-
- self.structs.for_all_items(|x| {
- x.add_monomorphs(self, &mut monomorphs);
- });
- self.unions.for_all_items(|x| {
- x.add_monomorphs(self, &mut monomorphs);
- });
- self.enums.for_all_items(|x| {
- x.add_monomorphs(self, &mut monomorphs);
- });
- self.typedefs.for_all_items(|x| {
- x.add_monomorphs(self, &mut monomorphs);
- });
- for x in &self.functions {
- x.add_monomorphs(self, &mut monomorphs);
- }
-
- // Insert the monomorphs into self
- for monomorph in monomorphs.drain_structs() {
- self.structs.try_insert(monomorph);
- }
- for monomorph in monomorphs.drain_unions() {
- self.unions.try_insert(monomorph);
- }
- for monomorph in monomorphs.drain_opaques() {
- self.opaque_items.try_insert(monomorph);
- }
- for monomorph in monomorphs.drain_typedefs() {
- self.typedefs.try_insert(monomorph);
- }
- for monomorph in monomorphs.drain_enums() {
- self.enums.try_insert(monomorph);
- }
-
- // Remove structs and opaque items that are generic
- self.opaque_items.filter(|x| x.generic_params.len() > 0);
- self.structs.filter(|x| x.generic_params.len() > 0);
- self.unions.filter(|x| x.generic_params.len() > 0);
- self.enums.filter(|x| x.generic_params.len() > 0);
- self.typedefs.filter(|x| x.generic_params.len() > 0);
-
- // Mangle the paths that remain
- self.unions
- .for_all_items_mut(|x| x.mangle_paths(&monomorphs));
- self.structs
- .for_all_items_mut(|x| x.mangle_paths(&monomorphs));
- self.enums
- .for_all_items_mut(|x| x.mangle_paths(&monomorphs));
- self.typedefs
- .for_all_items_mut(|x| x.mangle_paths(&monomorphs));
- for x in &mut self.functions {
- x.mangle_paths(&monomorphs);
- }
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/mangle.rs b/cbindgen-0.24.5/src/bindgen/mangle.rs
deleted file mode 100644
index c8769f8..0000000
--- a/cbindgen-0.24.5/src/bindgen/mangle.rs
+++ /dev/null
@@ -1,348 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use crate::bindgen::config::MangleConfig;
-use crate::bindgen::ir::{ConstExpr, GenericArgument, GenericPath, Path, Type};
-use crate::bindgen::rename::IdentifierType;
-
-pub fn mangle_path(path: &Path, generic_values: &[GenericArgument], config: &MangleConfig) -> Path {
- Path::new(mangle_name(path.name(), generic_values, config))
-}
-
-pub fn mangle_name(
- name: &str,
- generic_values: &[GenericArgument],
- config: &MangleConfig,
-) -> String {
- Mangler::new(name, generic_values, /* last = */ true, config).mangle()
-}
-
-enum Separator {
- OpeningAngleBracket = 1,
- Comma,
- ClosingAngleBracket,
- BeginMutPtr,
- BeginConstPtr,
- BeginFn,
- BetweenFnArg,
- EndFn,
-}
-
-struct Mangler<'a> {
- input: &'a str,
- generic_values: &'a [GenericArgument],
- output: String,
- last: bool,
- config: &'a MangleConfig,
-}
-
-impl<'a> Mangler<'a> {
- fn new(
- input: &'a str,
- generic_values: &'a [GenericArgument],
- last: bool,
- config: &'a MangleConfig,
- ) -> Self {
- Self {
- input,
- generic_values,
- output: String::new(),
- last,
- config,
- }
- }
-
- fn mangle(mut self) -> String {
- self.mangle_internal();
- self.output
- }
-
- fn push(&mut self, id: Separator) {
- let count = id as usize;
- let separator = if self.config.remove_underscores {
- ""
- } else {
- "_"
- };
- self.output.extend(std::iter::repeat(separator).take(count));
- }
-
- fn append_mangled_argument(&mut self, arg: &GenericArgument, last: bool) {
- match *arg {
- GenericArgument::Type(ref ty) => self.append_mangled_type(ty, last),
- GenericArgument::Const(ConstExpr::Name(ref name)) => {
- // This must behave the same as a GenericArgument::Type,
- // because const arguments are commonly represented as Types;
- // see the comment on `enum GenericArgument`.
- let fake_ty = Type::Path(GenericPath::new(Path::new(name), vec![]));
- self.append_mangled_type(&fake_ty, last);
- }
- GenericArgument::Const(ConstExpr::Value(ref val)) => self.output.push_str(val),
- }
- }
-
- fn append_mangled_type(&mut self, ty: &Type, last: bool) {
- match *ty {
- Type::Path(ref generic) => {
- let sub_path =
- Mangler::new(generic.export_name(), generic.generics(), last, self.config)
- .mangle();
-
- self.output.push_str(
- &self
- .config
- .rename_types
- .apply(&sub_path, IdentifierType::Type),
- );
- }
- Type::Primitive(ref primitive) => {
- self.output.push_str(
- &self
- .config
- .rename_types
- .apply(primitive.to_repr_rust(), IdentifierType::Type),
- );
- }
- Type::Ptr {
- ref ty, is_const, ..
- } => {
- self.push(if is_const {
- Separator::BeginConstPtr
- } else {
- Separator::BeginMutPtr
- });
- self.append_mangled_type(ty, last);
- }
- Type::FuncPtr {
- ref ret, ref args, ..
- } => {
- self.push(Separator::BeginFn);
- self.append_mangled_type(ret, args.is_empty());
- for (i, arg) in args.iter().enumerate() {
- self.push(Separator::BetweenFnArg);
- let last = last && i == args.len() - 1;
- self.append_mangled_type(&arg.1, last);
- }
- if !self.last {
- self.push(Separator::EndFn);
- }
- }
- Type::Array(..) => {
- unimplemented!(
- "Unable to mangle generic parameter {:?} for '{}'",
- ty,
- self.input
- );
- }
- }
- }
-
- fn mangle_internal(&mut self) {
- debug_assert!(self.output.is_empty());
- self.output = self.input.to_owned();
- if self.generic_values.is_empty() {
- return;
- }
-
- self.push(Separator::OpeningAngleBracket);
- for (i, arg) in self.generic_values.iter().enumerate() {
- if i != 0 {
- self.push(Separator::Comma);
- }
- let last = self.last && i == self.generic_values.len() - 1;
- self.append_mangled_argument(arg, last);
- }
-
- // Skip writing the trailing '>' mangling when possible
- if !self.last {
- self.push(Separator::ClosingAngleBracket)
- }
- }
-}
-
-#[test]
-fn generics() {
- use crate::bindgen::ir::{GenericPath, PrimitiveType};
- use crate::bindgen::rename::RenameRule::{self, PascalCase};
-
- fn float() -> GenericArgument {
- GenericArgument::Type(Type::Primitive(PrimitiveType::Float))
- }
-
- fn c_char() -> GenericArgument {
- GenericArgument::Type(Type::Primitive(PrimitiveType::Char))
- }
-
- fn path(path: &str) -> GenericArgument {
- generic_path(path, &[])
- }
-
- fn generic_path(path: &str, arguments: &[GenericArgument]) -> GenericArgument {
- let path = Path::new(path);
- let generic_path = GenericPath::new(path, arguments.to_owned());
- GenericArgument::Type(Type::Path(generic_path))
- }
-
- // Foo<f32> => Foo_f32
- assert_eq!(
- mangle_path(&Path::new("Foo"), &[float()], &MangleConfig::default()),
- Path::new("Foo_f32")
- );
-
- // Foo<Bar<f32>> => Foo_Bar_f32
- assert_eq!(
- mangle_path(
- &Path::new("Foo"),
- &[generic_path("Bar", &[float()])],
- &MangleConfig::default(),
- ),
- Path::new("Foo_Bar_f32")
- );
-
- // Foo<Bar> => Foo_Bar
- assert_eq!(
- mangle_path(&Path::new("Foo"), &[path("Bar")], &MangleConfig::default()),
- Path::new("Foo_Bar")
- );
-
- // Foo<Bar> => FooBar
- assert_eq!(
- mangle_path(
- &Path::new("Foo"),
- &[path("Bar")],
- &MangleConfig {
- remove_underscores: true,
- rename_types: RenameRule::None,
- }
- ),
- Path::new("FooBar")
- );
-
- // Foo<Bar<f32>> => FooBarF32
- assert_eq!(
- mangle_path(
- &Path::new("Foo"),
- &[generic_path("Bar", &[float()])],
- &MangleConfig {
- remove_underscores: true,
- rename_types: PascalCase,
- },
- ),
- Path::new("FooBarF32")
- );
-
- // Foo<Bar<c_char>> => FooBarCChar
- assert_eq!(
- mangle_path(
- &Path::new("Foo"),
- &[generic_path("Bar", &[c_char()])],
- &MangleConfig {
- remove_underscores: true,
- rename_types: PascalCase,
- },
- ),
- Path::new("FooBarCChar")
- );
-
- // Foo<Bar<T>> => Foo_Bar_T
- assert_eq!(
- mangle_path(
- &Path::new("Foo"),
- &[generic_path("Bar", &[path("T")])],
- &MangleConfig::default(),
- ),
- Path::new("Foo_Bar_T")
- );
-
- // Foo<Bar<T>, E> => Foo_Bar_T_____E
- assert_eq!(
- mangle_path(
- &Path::new("Foo"),
- &[generic_path("Bar", &[path("T")]), path("E")],
- &MangleConfig::default(),
- ),
- Path::new("Foo_Bar_T_____E")
- );
-
- // Foo<Bar<T>, Bar<E>> => Foo_Bar_T_____Bar_E
- assert_eq!(
- mangle_path(
- &Path::new("Foo"),
- &[
- generic_path("Bar", &[path("T")]),
- generic_path("Bar", &[path("E")]),
- ],
- &MangleConfig::default(),
- ),
- Path::new("Foo_Bar_T_____Bar_E")
- );
-
- // Foo<Bar<T>, E> => FooBarTE
- assert_eq!(
- mangle_path(
- &Path::new("Foo"),
- &[generic_path("Bar", &[path("T")]), path("E")],
- &MangleConfig {
- remove_underscores: true,
- rename_types: PascalCase,
- },
- ),
- Path::new("FooBarTE")
- );
-
- // Foo<Bar<T>, Bar<E>> => FooBarTBarE
- assert_eq!(
- mangle_path(
- &Path::new("Foo"),
- &[
- generic_path("Bar", &[path("T")]),
- generic_path("Bar", &[path("E")]),
- ],
- &MangleConfig {
- remove_underscores: true,
- rename_types: PascalCase,
- },
- ),
- Path::new("FooBarTBarE")
- );
-
- assert_eq!(
- mangle_path(
- &Path::new("Top"),
- &[GenericArgument::Const(ConstExpr::Value("40".to_string()))],
- &MangleConfig::default(),
- ),
- Path::new("Top_40")
- );
-
- assert_eq!(
- mangle_path(
- &Path::new("Top"),
- &[GenericArgument::Const(ConstExpr::Name("N".to_string()))],
- &MangleConfig::default(),
- ),
- Path::new("Top_N")
- );
-
- assert_eq!(
- mangle_path(
- &Path::new("Top"),
- &[generic_path("N", &[])],
- &MangleConfig::default(),
- ),
- Path::new("Top_N")
- );
-
- assert_eq!(
- mangle_path(
- &Path::new("Foo"),
- &[
- float(),
- GenericArgument::Const(ConstExpr::Value("40".to_string()))
- ],
- &MangleConfig::default(),
- ),
- Path::new("Foo_f32__40")
- );
-}
diff --git a/cbindgen-0.24.5/src/bindgen/mod.rs b/cbindgen-0.24.5/src/bindgen/mod.rs
deleted file mode 100644
index d0789da..0000000
--- a/cbindgen-0.24.5/src/bindgen/mod.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/// A helper macro for deriving deserialize for an enum to be used in toml-rs.
-/// This macro works be relying on an existing FromStr implementation for the
-/// desired type.
-macro_rules! deserialize_enum_str {
- ($name:ident) => {
- impl<'de> ::serde::Deserialize<'de> for $name {
- fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
- where
- D: ::serde::Deserializer<'de>,
- {
- struct Visitor;
- impl<'de> ::serde::de::Visitor<'de> for Visitor {
- type Value = $name;
-
- fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- f.write_str("$name")
- }
-
- fn visit_str<E>(self, v: &str) -> Result<$name, E>
- where
- E: ::serde::de::Error,
- {
- match v.parse::<$name>() {
- Ok(v) => Ok(v),
- Err(m) => Err(E::custom(m)),
- }
- }
- }
- deserializer.deserialize_str(Visitor)
- }
- }
- };
-}
-
-mod bindings;
-mod bitflags;
-mod builder;
-mod cargo;
-mod cdecl;
-mod config;
-mod declarationtyperesolver;
-mod dependencies;
-mod error;
-mod ir;
-mod library;
-mod mangle;
-mod monomorph;
-mod parser;
-mod rename;
-mod reserved;
-mod utilities;
-mod writer;
-
-#[allow(unused)]
-pub(crate) use self::cargo::*;
-
-pub use self::bindings::Bindings;
-pub use self::builder::Builder;
-pub use self::config::Profile; // disambiguate with cargo::Profile
-pub use self::config::*;
-pub use self::error::Error;
diff --git a/cbindgen-0.24.5/src/bindgen/monomorph.rs b/cbindgen-0.24.5/src/bindgen/monomorph.rs
deleted file mode 100644
index db6dce6..0000000
--- a/cbindgen-0.24.5/src/bindgen/monomorph.rs
+++ /dev/null
@@ -1,147 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::collections::HashMap;
-use std::mem;
-
-use crate::bindgen::ir::{
- Enum, GenericArgument, GenericPath, OpaqueItem, Path, Struct, Typedef, Union,
-};
-use crate::bindgen::library::Library;
-
-#[derive(Default, Clone, Debug)]
-pub struct Monomorphs {
- replacements: HashMap<GenericPath, Path>,
- opaques: Vec<OpaqueItem>,
- structs: Vec<Struct>,
- unions: Vec<Union>,
- typedefs: Vec<Typedef>,
- enums: Vec<Enum>,
-}
-
-impl Monomorphs {
- pub fn contains(&self, path: &GenericPath) -> bool {
- self.replacements.contains_key(path)
- }
-
- pub fn insert_struct(
- &mut self,
- library: &Library,
- generic: &Struct,
- monomorph: Struct,
- arguments: Vec<GenericArgument>,
- ) {
- let replacement_path = GenericPath::new(generic.path.clone(), arguments);
-
- debug_assert!(generic.generic_params.len() > 0);
- debug_assert!(!self.contains(&replacement_path));
-
- self.replacements
- .insert(replacement_path, monomorph.path.clone());
-
- monomorph.add_monomorphs(library, self);
-
- self.structs.push(monomorph);
- }
-
- pub fn insert_enum(
- &mut self,
- library: &Library,
- generic: &Enum,
- monomorph: Enum,
- arguments: Vec<GenericArgument>,
- ) {
- let replacement_path = GenericPath::new(generic.path.clone(), arguments);
-
- debug_assert!(generic.generic_params.len() > 0);
- debug_assert!(!self.contains(&replacement_path));
-
- self.replacements
- .insert(replacement_path, monomorph.path.clone());
-
- monomorph.add_monomorphs(library, self);
-
- self.enums.push(monomorph);
- }
-
- pub fn insert_union(
- &mut self,
- library: &Library,
- generic: &Union,
- monomorph: Union,
- arguments: Vec<GenericArgument>,
- ) {
- let replacement_path = GenericPath::new(generic.path.clone(), arguments);
-
- debug_assert!(generic.generic_params.len() > 0);
- debug_assert!(!self.contains(&replacement_path));
-
- self.replacements
- .insert(replacement_path, monomorph.path.clone());
-
- monomorph.add_monomorphs(library, self);
-
- self.unions.push(monomorph);
- }
-
- pub fn insert_opaque(
- &mut self,
- generic: &OpaqueItem,
- monomorph: OpaqueItem,
- arguments: Vec<GenericArgument>,
- ) {
- let replacement_path = GenericPath::new(generic.path.clone(), arguments);
-
- debug_assert!(generic.generic_params.len() > 0);
- debug_assert!(!self.contains(&replacement_path));
-
- self.replacements
- .insert(replacement_path, monomorph.path.clone());
- self.opaques.push(monomorph);
- }
-
- pub fn insert_typedef(
- &mut self,
- library: &Library,
- generic: &Typedef,
- monomorph: Typedef,
- arguments: Vec<GenericArgument>,
- ) {
- let replacement_path = GenericPath::new(generic.path.clone(), arguments);
-
- debug_assert!(generic.generic_params.len() > 0);
- debug_assert!(!self.contains(&replacement_path));
-
- self.replacements
- .insert(replacement_path, monomorph.path.clone());
-
- monomorph.add_monomorphs(library, self);
-
- self.typedefs.push(monomorph);
- }
-
- pub fn mangle_path(&self, path: &GenericPath) -> Option<&Path> {
- self.replacements.get(path)
- }
-
- pub fn drain_opaques(&mut self) -> Vec<OpaqueItem> {
- mem::take(&mut self.opaques)
- }
-
- pub fn drain_structs(&mut self) -> Vec<Struct> {
- mem::take(&mut self.structs)
- }
-
- pub fn drain_unions(&mut self) -> Vec<Union> {
- mem::take(&mut self.unions)
- }
-
- pub fn drain_typedefs(&mut self) -> Vec<Typedef> {
- mem::take(&mut self.typedefs)
- }
-
- pub fn drain_enums(&mut self) -> Vec<Enum> {
- mem::take(&mut self.enums)
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/parser.rs b/cbindgen-0.24.5/src/bindgen/parser.rs
deleted file mode 100644
index a964cd2..0000000
--- a/cbindgen-0.24.5/src/bindgen/parser.rs
+++ /dev/null
@@ -1,1034 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::collections::hash_map::Entry;
-use std::collections::{HashMap, HashSet};
-use std::fs::File;
-use std::io::Read;
-use std::path::{Path as FilePath, PathBuf as FilePathBuf};
-
-use syn::ext::IdentExt;
-
-use crate::bindgen::bitflags;
-use crate::bindgen::cargo::{Cargo, PackageRef};
-use crate::bindgen::config::{Config, ParseConfig};
-use crate::bindgen::error::Error;
-use crate::bindgen::ir::{
- AnnotationSet, Cfg, Constant, Documentation, Enum, Function, GenericParam, GenericParams,
- ItemMap, OpaqueItem, Path, Static, Struct, Type, Typedef, Union,
-};
-use crate::bindgen::utilities::{SynAbiHelpers, SynAttributeHelpers, SynItemFnHelpers};
-
-const STD_CRATES: &[&str] = &[
- "std",
- "std_unicode",
- "alloc",
- "collections",
- "core",
- "proc_macro",
-];
-
-type ParseResult = Result<Parse, Error>;
-
-/// Parses a single rust source file, not following `mod` or `extern crate`.
-pub fn parse_src(src_file: &FilePath, config: &Config) -> ParseResult {
- let mod_name = src_file.file_stem().unwrap().to_str().unwrap();
- let mut config = config.clone();
- config.parse = ParseConfig {
- parse_deps: true,
- ..ParseConfig::default()
- };
-
- let mut context = Parser {
- binding_crate_name: mod_name.to_owned(),
- config: &config,
- lib: None,
- parsed_crates: HashSet::new(),
- cache_src: HashMap::new(),
- cache_expanded_crate: HashMap::new(),
- cfg_stack: Vec::new(),
- out: Parse::new(),
- };
-
- let pkg_ref = PackageRef {
- name: mod_name.to_owned(),
- version: None,
- };
-
- context.parse_mod(&pkg_ref, src_file, 0)?;
- Ok(context.out)
-}
-
-/// Recursively parses a rust library starting at the root crate's directory.
-///
-/// Inside a crate, `mod` and `extern crate` declarations are followed
-/// and parsed. To find an external crate, the parser uses the `cargo metadata`
-/// command to find the location of dependencies.
-pub(crate) fn parse_lib(lib: Cargo, config: &Config) -> ParseResult {
- let mut context = Parser {
- binding_crate_name: lib.binding_crate_name().to_owned(),
- config,
- lib: Some(lib),
- parsed_crates: HashSet::new(),
- cache_src: HashMap::new(),
- cache_expanded_crate: HashMap::new(),
- cfg_stack: Vec::new(),
- out: Parse::new(),
- };
-
- let binding_crate = context.lib.as_ref().unwrap().binding_crate_ref();
- context.parse_crate(&binding_crate)?;
- Ok(context.out)
-}
-
-#[derive(Debug, Clone)]
-struct Parser<'a> {
- binding_crate_name: String,
- lib: Option<Cargo>,
- config: &'a Config,
-
- parsed_crates: HashSet<String>,
- cache_src: HashMap<FilePathBuf, Vec<syn::Item>>,
- cache_expanded_crate: HashMap<String, Vec<syn::Item>>,
-
- cfg_stack: Vec<Cfg>,
-
- out: Parse,
-}
-
-impl<'a> Parser<'a> {
- fn should_parse_dependency(&self, pkg_name: &str) -> bool {
- if self.parsed_crates.contains(pkg_name) {
- return false;
- }
-
- if !self.config.parse.parse_deps {
- return false;
- }
-
- // Skip any whitelist or blacklist for expand
- if self
- .config
- .parse
- .expand
- .crates
- .iter()
- .any(|name| name == pkg_name)
- {
- return true;
- }
-
- // If we have a whitelist, check it
- if let Some(ref include) = self.config.parse.include {
- if !include.iter().any(|name| name == pkg_name) {
- debug!("Excluding crate {}", pkg_name);
- return false;
- }
- }
-
- // Check the blacklist
- !STD_CRATES.contains(&pkg_name)
- && !self
- .config
- .parse
- .exclude
- .iter()
- .any(|name| name == pkg_name)
- }
-
- fn parse_crate(&mut self, pkg: &PackageRef) -> Result<(), Error> {
- assert!(self.lib.is_some());
- debug!("Parsing crate {}", pkg.name);
- self.parsed_crates.insert(pkg.name.clone());
-
- // Check if we should use cargo expand for this crate
- if self.config.parse.expand.crates.contains(&pkg.name) {
- self.parse_expand_crate(pkg)?;
- } else {
- // Parse the crate before the dependencies otherwise the same-named idents we
- // want to generate bindings for would be replaced by the ones provided
- // by the first dependency containing it.
- let crate_src = self.lib.as_ref().unwrap().find_crate_src(pkg);
-
- match crate_src {
- Some(crate_src) => self.parse_mod(pkg, crate_src.as_path(), 0)?,
- None => {
- // This should be an error, but is common enough to just elicit a warning
- warn!(
- "Parsing crate `{}`: can't find lib.rs with `cargo metadata`. \
- The crate may be available only on a particular platform, \
- so consider setting `fetch_all_dependencies` in your cbindgen configuration.",
- pkg.name
- );
- }
- }
- }
-
- for (dep_pkg, cfg) in self.lib.as_ref().unwrap().dependencies(pkg) {
- if !self.should_parse_dependency(&dep_pkg.name) {
- continue;
- }
-
- if let Some(ref cfg) = cfg {
- self.cfg_stack.push(cfg.clone());
- }
-
- self.parse_crate(&dep_pkg)?;
-
- if cfg.is_some() {
- self.cfg_stack.pop();
- }
- }
-
- Ok(())
- }
-
- fn parse_expand_crate(&mut self, pkg: &PackageRef) -> Result<(), Error> {
- assert!(self.lib.is_some());
-
- let mod_items = {
- if !self.cache_expanded_crate.contains_key(&pkg.name) {
- let s = self
- .lib
- .as_ref()
- .unwrap()
- .expand_crate(
- pkg,
- self.config.parse.expand.all_features,
- self.config.parse.expand.default_features,
- &self.config.parse.expand.features,
- self.config.parse.expand.profile,
- )
- .map_err(|x| Error::CargoExpand(pkg.name.clone(), x))?;
- let i = syn::parse_file(&s).map_err(|x| Error::ParseSyntaxError {
- crate_name: pkg.name.clone(),
- src_path: "".to_owned(),
- error: x,
- })?;
- self.cache_expanded_crate.insert(pkg.name.clone(), i.items);
- }
-
- self.cache_expanded_crate.get(&pkg.name).unwrap().clone()
- };
-
- self.process_mod(
- pkg, None, None, &mod_items, 0, /* is_mod_rs = */ true,
- /* is_inline = */ false,
- )
- }
-
- fn parse_mod(
- &mut self,
- pkg: &PackageRef,
- mod_path: &FilePath,
- depth: usize,
- ) -> Result<(), Error> {
- let mod_items = match self.cache_src.entry(mod_path.to_path_buf()) {
- Entry::Vacant(vacant_entry) => {
- let mut s = String::new();
- let mut f = File::open(mod_path).map_err(|_| Error::ParseCannotOpenFile {
- crate_name: pkg.name.clone(),
- src_path: mod_path.to_str().unwrap().to_owned(),
- })?;
-
- f.read_to_string(&mut s)
- .map_err(|_| Error::ParseCannotOpenFile {
- crate_name: pkg.name.clone(),
- src_path: mod_path.to_str().unwrap().to_owned(),
- })?;
-
- let i = syn::parse_file(&s).map_err(|x| Error::ParseSyntaxError {
- crate_name: pkg.name.clone(),
- src_path: mod_path.to_string_lossy().into(),
- error: x,
- })?;
-
- vacant_entry.insert(i.items).clone()
- }
- Entry::Occupied(occupied_entry) => occupied_entry.get().clone(),
- };
-
- // Compute module directory according to Rust 2018 rules
- let submod_dir_2018;
-
- let mod_dir = mod_path.parent().unwrap();
-
- let is_mod_rs = depth == 0 || mod_path.ends_with("mod.rs");
- let submod_dir = if is_mod_rs {
- mod_dir
- } else {
- submod_dir_2018 = mod_path
- .parent()
- .unwrap()
- .join(mod_path.file_stem().unwrap());
- &submod_dir_2018
- };
-
- self.process_mod(
- pkg,
- Some(mod_dir),
- Some(submod_dir),
- &mod_items,
- depth,
- /* is_inline = */ false,
- is_mod_rs,
- )
- }
-
- /// `mod_dir` is the path to the current directory of the module. It may be
- /// `None` for pre-expanded modules.
- ///
- /// `submod_dir` is the path to search submodules in by default, which might
- /// be different for rust 2018 for example.
- #[allow(clippy::too_many_arguments)]
- fn process_mod(
- &mut self,
- pkg: &PackageRef,
- mod_dir: Option<&FilePath>,
- submod_dir: Option<&FilePath>,
- items: &[syn::Item],
- depth: usize,
- is_inline: bool,
- is_in_mod_rs: bool,
- ) -> Result<(), Error> {
- debug_assert_eq!(mod_dir.is_some(), submod_dir.is_some());
- // We process the items first then the nested modules.
- let nested_modules = self.out.load_syn_crate_mod(
- self.config,
- &self.binding_crate_name,
- &pkg.name,
- Cfg::join(&self.cfg_stack).as_ref(),
- items,
- );
-
- for item in nested_modules {
- let next_mod_name = item.ident.unraw().to_string();
- let cfg = Cfg::load(&item.attrs);
- if let Some(ref cfg) = cfg {
- self.cfg_stack.push(cfg.clone());
- }
-
- if let Some((_, ref inline_items)) = item.content {
- // TODO(emilio): This should use #[path] attribute if present,
- // rather than next_mod_name.
- let next_submod_dir = submod_dir.map(|dir| dir.join(&next_mod_name));
- let next_mod_dir = mod_dir.map(|dir| dir.join(&next_mod_name));
- self.process_mod(
- pkg,
- next_mod_dir.as_deref(),
- next_submod_dir.as_deref(),
- inline_items,
- depth,
- /* is_inline = */ true,
- is_in_mod_rs,
- )?;
- } else if let Some(mod_dir) = mod_dir {
- let submod_dir = submod_dir.unwrap();
- let next_mod_path1 = submod_dir.join(next_mod_name.clone() + ".rs");
- let next_mod_path2 = submod_dir.join(next_mod_name.clone()).join("mod.rs");
-
- if next_mod_path1.exists() {
- self.parse_mod(pkg, next_mod_path1.as_path(), depth + 1)?;
- } else if next_mod_path2.exists() {
- self.parse_mod(pkg, next_mod_path2.as_path(), depth + 1)?;
- } else {
- // Last chance to find a module path
- let mut path_attr_found = false;
- for attr in &item.attrs {
- if let Ok(syn::Meta::NameValue(syn::MetaNameValue { path, lit, .. })) =
- attr.parse_meta()
- {
- match lit {
- syn::Lit::Str(ref path_lit) if path.is_ident("path") => {
- path_attr_found = true;
- // https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute
- //
- // For path attributes on modules not inside inline module blocks, the file path
- // is relative to the directory the source file is located.
- //
- // For path attributes inside inline module blocks, the relative location of the
- // file path depends on the kind of source file the path attribute is located
- // in. "mod-rs" source files are root modules (such as lib.rs or main.rs) and
- // modules with files named mod.rs. "non-mod-rs" source files are all other
- // module files.
- //
- // Paths for path attributes inside inline module blocks in a mod-rs file are
- // relative to the directory of the mod-rs file including the inline module
- // components as directories. For non-mod-rs files, it is the same except the
- // path starts with a directory with the name of the non-mod-rs module.
- //
- let base = if is_inline && !is_in_mod_rs {
- submod_dir
- } else {
- mod_dir
- };
- self.parse_mod(pkg, &base.join(path_lit.value()), depth + 1)?;
- break;
- }
- _ => (),
- }
- }
- }
-
- // This should be an error, but it's common enough to
- // just elicit a warning
- if !path_attr_found {
- warn!(
- "Parsing crate `{}`: can't find mod {}`.",
- pkg.name, next_mod_name
- );
- }
- }
- } else {
- warn!(
- "Parsing expanded crate `{}`: can't find mod {}`.",
- pkg.name, next_mod_name
- );
- }
-
- if cfg.is_some() {
- self.cfg_stack.pop();
- }
- }
-
- Ok(())
- }
-}
-
-#[derive(Debug, Clone)]
-pub struct Parse {
- pub constants: ItemMap<Constant>,
- pub globals: ItemMap<Static>,
- pub enums: ItemMap<Enum>,
- pub structs: ItemMap<Struct>,
- pub unions: ItemMap<Union>,
- pub opaque_items: ItemMap<OpaqueItem>,
- pub typedefs: ItemMap<Typedef>,
- pub functions: Vec<Function>,
-}
-
-impl Parse {
- pub fn new() -> Parse {
- Parse {
- constants: ItemMap::default(),
- globals: ItemMap::default(),
- enums: ItemMap::default(),
- structs: ItemMap::default(),
- unions: ItemMap::default(),
- opaque_items: ItemMap::default(),
- typedefs: ItemMap::default(),
- functions: Vec::new(),
- }
- }
-
- pub fn add_std_types(&mut self) {
- let mut add_opaque = |path: &str, generic_params: Vec<&str>| {
- let path = Path::new(path);
- let generic_params: Vec<_> = generic_params
- .into_iter()
- .map(GenericParam::new_type_param)
- .collect();
- self.opaque_items.try_insert(OpaqueItem::new(
- path,
- GenericParams(generic_params),
- None,
- AnnotationSet::new(),
- Documentation::none(),
- ))
- };
-
- add_opaque("String", vec![]);
- add_opaque("Box", vec!["T"]);
- add_opaque("RefCell", vec!["T"]);
- add_opaque("Rc", vec!["T"]);
- add_opaque("Arc", vec!["T"]);
- add_opaque("Result", vec!["T", "E"]);
- add_opaque("Option", vec!["T"]);
- add_opaque("NonNull", vec!["T"]);
- add_opaque("Vec", vec!["T"]);
- add_opaque("HashMap", vec!["K", "V", "Hasher"]);
- add_opaque("BTreeMap", vec!["K", "V"]);
- add_opaque("HashSet", vec!["T"]);
- add_opaque("BTreeSet", vec!["T"]);
- add_opaque("LinkedList", vec!["T"]);
- add_opaque("VecDeque", vec!["T"]);
- add_opaque("ManuallyDrop", vec!["T"]);
- add_opaque("MaybeUninit", vec!["T"]);
- }
-
- pub fn extend_with(&mut self, other: &Parse) {
- self.constants.extend_with(&other.constants);
- self.globals.extend_with(&other.globals);
- self.enums.extend_with(&other.enums);
- self.structs.extend_with(&other.structs);
- self.unions.extend_with(&other.unions);
- self.opaque_items.extend_with(&other.opaque_items);
- self.typedefs.extend_with(&other.typedefs);
- self.functions.extend_from_slice(&other.functions);
- }
-
- fn load_syn_crate_mod<'a>(
- &mut self,
- config: &Config,
- binding_crate_name: &str,
- crate_name: &str,
- mod_cfg: Option<&Cfg>,
- items: &'a [syn::Item],
- ) -> Vec<&'a syn::ItemMod> {
- let mut impls_with_assoc_consts = Vec::new();
- let mut nested_modules = Vec::new();
-
- for item in items {
- if item.should_skip_parsing() {
- continue;
- }
- match item {
- syn::Item::ForeignMod(ref item) => {
- self.load_syn_foreign_mod(
- config,
- binding_crate_name,
- crate_name,
- mod_cfg,
- item,
- );
- }
- syn::Item::Fn(ref item) => {
- self.load_syn_fn(config, binding_crate_name, crate_name, mod_cfg, item);
- }
- syn::Item::Const(ref item) => {
- self.load_syn_const(config, binding_crate_name, crate_name, mod_cfg, item);
- }
- syn::Item::Static(ref item) => {
- self.load_syn_static(config, binding_crate_name, crate_name, mod_cfg, item);
- }
- syn::Item::Struct(ref item) => {
- self.load_syn_struct(config, crate_name, mod_cfg, item);
- }
- syn::Item::Union(ref item) => {
- self.load_syn_union(config, crate_name, mod_cfg, item);
- }
- syn::Item::Enum(ref item) => {
- self.load_syn_enum(config, crate_name, mod_cfg, item);
- }
- syn::Item::Type(ref item) => {
- self.load_syn_ty(crate_name, mod_cfg, item);
- }
- syn::Item::Impl(ref item_impl) => {
- let has_assoc_const = item_impl
- .items
- .iter()
- .any(|item| matches!(item, syn::ImplItem::Const(_)));
- if has_assoc_const {
- impls_with_assoc_consts.push(item_impl);
- }
-
- if let syn::Type::Path(ref path) = *item_impl.self_ty {
- if let Some(type_name) = path.path.get_ident() {
- for method in item_impl.items.iter().filter_map(|item| match item {
- syn::ImplItem::Method(method) => Some(method),
- _ => None,
- }) {
- self.load_syn_method(
- config,
- binding_crate_name,
- crate_name,
- mod_cfg,
- &Path::new(type_name.unraw().to_string()),
- method,
- )
- }
- }
- }
- }
- syn::Item::Macro(ref item) => {
- self.load_builtin_macro(config, crate_name, mod_cfg, item)
- }
- syn::Item::Mod(ref item) => {
- nested_modules.push(item);
- }
- _ => {}
- }
- }
-
- for item_impl in impls_with_assoc_consts {
- self.load_syn_assoc_consts_from_impl(crate_name, mod_cfg, item_impl)
- }
-
- nested_modules
- }
-
- fn load_syn_assoc_consts_from_impl(
- &mut self,
- crate_name: &str,
- mod_cfg: Option<&Cfg>,
- item_impl: &syn::ItemImpl,
- ) {
- let associated_constants = item_impl.items.iter().filter_map(|item| match item {
- syn::ImplItem::Const(ref associated_constant) => Some(associated_constant),
- _ => None,
- });
- self.load_syn_assoc_consts(
- crate_name,
- mod_cfg,
- &item_impl.self_ty,
- associated_constants,
- );
- }
-
- /// Enters a `extern "C" { }` declaration and loads function declarations.
- fn load_syn_foreign_mod(
- &mut self,
- config: &Config,
- binding_crate_name: &str,
- crate_name: &str,
- mod_cfg: Option<&Cfg>,
- item: &syn::ItemForeignMod,
- ) {
- if !item.abi.is_c() {
- info!("Skip {} - (extern block must be extern C).", crate_name);
- return;
- }
-
- for foreign_item in &item.items {
- if let syn::ForeignItem::Fn(ref function) = *foreign_item {
- if !config
- .parse
- .should_generate_top_level_item(crate_name, binding_crate_name)
- {
- info!(
- "Skip {}::{} - (fn's outside of the binding crate are not used).",
- crate_name, &function.sig.ident
- );
- return;
- }
- let path = Path::new(function.sig.ident.unraw().to_string());
- match Function::load(path, None, &function.sig, true, &function.attrs, mod_cfg) {
- Ok(func) => {
- info!("Take {}::{}.", crate_name, &function.sig.ident);
-
- self.functions.push(func);
- }
- Err(msg) => {
- error!(
- "Cannot use fn {}::{} ({}).",
- crate_name, &function.sig.ident, msg
- );
- }
- }
- }
- }
- }
-
- /// Loads a `fn` declaration inside an `impl` block, if the type is a simple identifier
- fn load_syn_method(
- &mut self,
- config: &Config,
- binding_crate_name: &str,
- crate_name: &str,
- mod_cfg: Option<&Cfg>,
- self_type: &Path,
- item: &syn::ImplItemMethod,
- ) {
- self.load_fn_declaration(
- config,
- binding_crate_name,
- crate_name,
- mod_cfg,
- item,
- Some(self_type),
- &item.sig,
- &item.vis,
- &item.attrs,
- )
- }
-
- /// Loads a `fn` declaration
- fn load_syn_fn(
- &mut self,
- config: &Config,
- binding_crate_name: &str,
- crate_name: &str,
- mod_cfg: Option<&Cfg>,
- item: &syn::ItemFn,
- ) {
- self.load_fn_declaration(
- config,
- binding_crate_name,
- crate_name,
- mod_cfg,
- item,
- None,
- &item.sig,
- &item.vis,
- &item.attrs,
- );
- }
-
- #[allow(clippy::too_many_arguments)]
- fn load_fn_declaration(
- &mut self,
- config: &Config,
- binding_crate_name: &str,
- crate_name: &str,
- mod_cfg: Option<&Cfg>,
- named_symbol: &dyn SynItemFnHelpers,
- self_type: Option<&Path>,
- sig: &syn::Signature,
- vis: &syn::Visibility,
- attrs: &[syn::Attribute],
- ) {
- if !config
- .parse
- .should_generate_top_level_item(crate_name, binding_crate_name)
- {
- info!(
- "Skip {}::{} - (fn's outside of the binding crate are not used).",
- crate_name, &sig.ident
- );
- return;
- }
-
- let loggable_item_name = || {
- let mut items = Vec::with_capacity(3);
- items.push(crate_name.to_owned());
- if let Some(ref self_type) = self_type {
- items.push(self_type.to_string());
- }
- items.push(sig.ident.unraw().to_string());
- items.join("::")
- };
-
- let is_extern_c = sig.abi.is_omitted() || sig.abi.is_c();
- let exported_name = named_symbol.exported_name();
-
- if let syn::Visibility::Public(_) = vis {
- match (is_extern_c, exported_name) {
- (true, Some(exported_name)) => {
- let path = Path::new(exported_name);
- match Function::load(path, self_type, sig, false, attrs, mod_cfg) {
- Ok(func) => {
- info!("Take {}.", loggable_item_name());
- self.functions.push(func);
- }
- Err(msg) => {
- error!("Cannot use fn {} ({}).", loggable_item_name(), msg);
- }
- }
- }
- (true, None) => {
- warn!(
- "Skipping {} - (not `no_mangle`, and has no `export_name` attribute)",
- loggable_item_name()
- );
- }
- (false, Some(_exported_name)) => {
- warn!("Skipping {} - (not `extern \"C\"`", loggable_item_name());
- }
- (false, None) => {}
- }
- } else {
- match (is_extern_c, exported_name) {
- (true, Some(..)) => {
- warn!(
- "Skipping {} - (not `pub` but is `extern \"C\"` and `no_mangle`)",
- loggable_item_name()
- );
- }
- (true, None) => {
- warn!(
- "Skipping {} - (not `pub` but is `extern \"C\"`)",
- loggable_item_name()
- );
- }
- (false, Some(..)) => {
- warn!(
- "Skipping {} - (not `pub` but is `no_mangle`)",
- loggable_item_name()
- );
- }
- (false, None) => {}
- }
- }
- }
-
- /// Loads associated `const` declarations
- fn load_syn_assoc_consts<'a, I>(
- &mut self,
- crate_name: &str,
- mod_cfg: Option<&Cfg>,
- impl_ty: &syn::Type,
- items: I,
- ) where
- I: IntoIterator<Item = &'a syn::ImplItemConst>,
- {
- let ty = match Type::load(impl_ty) {
- Ok(ty) => ty,
- Err(e) => {
- warn!("Skipping associated constants for {:?}: {:?}", impl_ty, e);
- return;
- }
- };
-
- let ty = match ty {
- Some(ty) => ty,
- None => return,
- };
-
- let impl_path = match ty.get_root_path() {
- Some(p) => p,
- None => {
- warn!(
- "Couldn't find path for {:?}, skipping associated constants",
- ty
- );
- return;
- }
- };
-
- for item in items.into_iter() {
- if let syn::Visibility::Public(_) = item.vis {
- } else {
- warn!("Skip {}::{} - (not `pub`).", crate_name, &item.ident);
- return;
- }
-
- let path = Path::new(item.ident.unraw().to_string());
- match Constant::load(
- path,
- mod_cfg,
- &item.ty,
- &item.expr,
- &item.attrs,
- Some(impl_path.clone()),
- ) {
- Ok(constant) => {
- info!("Take {}::{}::{}.", crate_name, impl_path, &item.ident);
- let mut any = false;
- self.structs.for_items_mut(&impl_path, |item| {
- any = true;
- item.add_associated_constant(constant.clone());
- });
- // Handle associated constants to other item types that are
- // not structs like enums or such as regular constants.
- if !any && !self.constants.try_insert(constant) {
- error!(
- "Conflicting name for constant {}::{}::{}.",
- crate_name, impl_path, &item.ident,
- );
- }
- }
- Err(msg) => {
- warn!("Skip {}::{} - ({})", crate_name, &item.ident, msg);
- }
- }
- }
- }
-
- /// Loads a `const` declaration
- fn load_syn_const(
- &mut self,
- config: &Config,
- binding_crate_name: &str,
- crate_name: &str,
- mod_cfg: Option<&Cfg>,
- item: &syn::ItemConst,
- ) {
- if !config
- .parse
- .should_generate_top_level_item(crate_name, binding_crate_name)
- {
- info!(
- "Skip {}::{} - (const's outside of the binding crate are not used).",
- crate_name, &item.ident
- );
- return;
- }
-
- if let syn::Visibility::Public(_) = item.vis {
- } else {
- warn!("Skip {}::{} - (not `pub`).", crate_name, &item.ident);
- return;
- }
-
- let path = Path::new(item.ident.unraw().to_string());
- match Constant::load(path, mod_cfg, &item.ty, &item.expr, &item.attrs, None) {
- Ok(constant) => {
- info!("Take {}::{}.", crate_name, &item.ident);
-
- let full_name = constant.path.clone();
- if !self.constants.try_insert(constant) {
- error!("Conflicting name for constant {}", full_name);
- }
- }
- Err(msg) => {
- warn!("Skip {}::{} - ({})", crate_name, &item.ident, msg);
- }
- }
- }
-
- /// Loads a `static` declaration
- fn load_syn_static(
- &mut self,
- config: &Config,
- binding_crate_name: &str,
- crate_name: &str,
- mod_cfg: Option<&Cfg>,
- item: &syn::ItemStatic,
- ) {
- if !config
- .parse
- .should_generate_top_level_item(crate_name, binding_crate_name)
- {
- info!(
- "Skip {}::{} - (static's outside of the binding crate are not used).",
- crate_name, &item.ident
- );
- return;
- }
-
- if let syn::Visibility::Public(_) = item.vis {
- if item.is_no_mangle() {
- match Static::load(item, mod_cfg) {
- Ok(constant) => {
- info!("Take {}::{}.", crate_name, &item.ident);
-
- self.globals.try_insert(constant);
- }
- Err(msg) => {
- warn!("Skip {}::{} - ({})", crate_name, &item.ident, msg);
- }
- }
- }
- }
-
- // TODO
- if let syn::Visibility::Public(_) = item.vis {
- } else {
- warn!("Skip {}::{} - (not `pub`).", crate_name, &item.ident);
- }
- if !item.is_no_mangle() {
- warn!("Skip {}::{} - (not `no_mangle`).", crate_name, &item.ident);
- }
- }
-
- /// Loads a `struct` declaration
- fn load_syn_struct(
- &mut self,
- config: &Config,
- crate_name: &str,
- mod_cfg: Option<&Cfg>,
- item: &syn::ItemStruct,
- ) {
- match Struct::load(&config.layout, item, mod_cfg) {
- Ok(st) => {
- info!("Take {}::{}.", crate_name, &item.ident);
- self.structs.try_insert(st);
- }
- Err(msg) => {
- info!("Take {}::{} - opaque ({}).", crate_name, &item.ident, msg);
- let path = Path::new(item.ident.unraw().to_string());
- self.opaque_items.try_insert(
- OpaqueItem::load(path, &item.generics, &item.attrs, mod_cfg).unwrap(),
- );
- }
- }
- }
-
- /// Loads a `union` declaration
- fn load_syn_union(
- &mut self,
- config: &Config,
- crate_name: &str,
- mod_cfg: Option<&Cfg>,
- item: &syn::ItemUnion,
- ) {
- match Union::load(&config.layout, item, mod_cfg) {
- Ok(st) => {
- info!("Take {}::{}.", crate_name, &item.ident);
-
- self.unions.try_insert(st);
- }
- Err(msg) => {
- info!("Take {}::{} - opaque ({}).", crate_name, &item.ident, msg);
- let path = Path::new(item.ident.unraw().to_string());
- self.opaque_items.try_insert(
- OpaqueItem::load(path, &item.generics, &item.attrs, mod_cfg).unwrap(),
- );
- }
- }
- }
-
- /// Loads a `enum` declaration
- fn load_syn_enum(
- &mut self,
- config: &Config,
- crate_name: &str,
- mod_cfg: Option<&Cfg>,
- item: &syn::ItemEnum,
- ) {
- match Enum::load(item, mod_cfg, config) {
- Ok(en) => {
- info!("Take {}::{}.", crate_name, &item.ident);
- self.enums.try_insert(en);
- }
- Err(msg) => {
- info!("Take {}::{} - opaque ({}).", crate_name, &item.ident, msg);
- let path = Path::new(item.ident.unraw().to_string());
- self.opaque_items.try_insert(
- OpaqueItem::load(path, &item.generics, &item.attrs, mod_cfg).unwrap(),
- );
- }
- }
- }
-
- /// Loads a `type` declaration
- fn load_syn_ty(&mut self, crate_name: &str, mod_cfg: Option<&Cfg>, item: &syn::ItemType) {
- match Typedef::load(item, mod_cfg) {
- Ok(st) => {
- info!("Take {}::{}.", crate_name, &item.ident);
-
- self.typedefs.try_insert(st);
- }
- Err(msg) => {
- info!("Take {}::{} - opaque ({}).", crate_name, &item.ident, msg);
- let path = Path::new(item.ident.unraw().to_string());
- self.opaque_items.try_insert(
- OpaqueItem::load(path, &item.generics, &item.attrs, mod_cfg).unwrap(),
- );
- }
- }
- }
-
- fn load_builtin_macro(
- &mut self,
- config: &Config,
- crate_name: &str,
- mod_cfg: Option<&Cfg>,
- item: &syn::ItemMacro,
- ) {
- let name = match item.mac.path.segments.last() {
- Some(n) => n.ident.unraw().to_string(),
- None => return,
- };
-
- if name != "bitflags" || !config.macro_expansion.bitflags {
- return;
- }
-
- let bitflags = match bitflags::parse(item.mac.tokens.clone()) {
- Ok(b) => b,
- Err(e) => {
- warn!("Failed to parse bitflags invocation: {:?}", e);
- return;
- }
- };
-
- let (struct_, impl_) = bitflags.expand();
- self.load_syn_struct(config, crate_name, mod_cfg, &struct_);
- // We know that the expansion will only reference `struct_`, so it's
- // fine to just do it here instead of deferring it like we do with the
- // other calls to this function.
- self.load_syn_assoc_consts_from_impl(crate_name, mod_cfg, &impl_);
- }
-}
diff --git a/cbindgen-0.24.5/src/bindgen/rename.rs b/cbindgen-0.24.5/src/bindgen/rename.rs
deleted file mode 100644
index e58b7a5..0000000
--- a/cbindgen-0.24.5/src/bindgen/rename.rs
+++ /dev/null
@@ -1,145 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::borrow::Cow;
-use std::str::FromStr;
-
-/// The type of identifier to be renamed.
-#[derive(Debug, Clone, Copy)]
-pub enum IdentifierType<'a> {
- StructMember,
- EnumVariant { prefix: &'a str },
- FunctionArg,
- Type,
- Enum,
-}
-
-impl<'a> IdentifierType<'a> {
- fn to_str(self) -> &'static str {
- match self {
- IdentifierType::StructMember => "m",
- IdentifierType::EnumVariant { .. } => "",
- IdentifierType::FunctionArg => "a",
- IdentifierType::Type => "",
- IdentifierType::Enum => "",
- }
- }
-}
-
-/// A rule to apply to an identifier when generating bindings.
-#[derive(Debug, Clone, Copy)]
-pub enum RenameRule {
- /// Do not apply any renaming. The default.
- None,
- /// Converts the identifier to PascalCase and adds a context dependent prefix
- GeckoCase,
- /// Converts the identifier to lower case.
- LowerCase,
- /// Converts the identifier to upper case.
- UpperCase,
- /// Converts the identifier to PascalCase.
- PascalCase,
- /// Converts the identifier to camelCase.
- CamelCase,
- /// Converts the identifier to snake_case.
- SnakeCase,
- /// Converts the identifier to SCREAMING_SNAKE_CASE.
- ScreamingSnakeCase,
- /// Converts the identifier to SCREAMING_SNAKE_CASE and prefixes enum variants
- /// with the enum name.
- QualifiedScreamingSnakeCase,
-}
-
-impl RenameRule {
- pub(crate) fn not_none(self) -> Option<Self> {
- match self {
- RenameRule::None => None,
- other => Some(other),
- }
- }
-
- /// Applies the rename rule to a string
- pub fn apply<'a>(self, text: &'a str, context: IdentifierType) -> Cow<'a, str> {
- use heck::*;
-
- if text.is_empty() {
- return Cow::Borrowed(text);
- }
-
- Cow::Owned(match self {
- RenameRule::None => return Cow::Borrowed(text),
- RenameRule::GeckoCase => context.to_str().to_owned() + &text.to_upper_camel_case(),
- RenameRule::LowerCase => text.to_lowercase(),
- RenameRule::UpperCase => text.to_uppercase(),
- RenameRule::PascalCase => text.to_pascal_case(),
- RenameRule::CamelCase => text.to_lower_camel_case(),
- RenameRule::SnakeCase => text.to_snake_case(),
- RenameRule::ScreamingSnakeCase => text.to_shouty_snake_case(),
- RenameRule::QualifiedScreamingSnakeCase => {
- let mut result = String::new();
-
- if let IdentifierType::EnumVariant { prefix } = context {
- result.push_str(
- &RenameRule::ScreamingSnakeCase.apply(prefix, IdentifierType::Enum),
- );
- result.push('_');
- }
-
- result.push_str(&RenameRule::ScreamingSnakeCase.apply(text, context));
- result
- }
- })
- }
-}
-
-impl Default for RenameRule {
- fn default() -> RenameRule {
- RenameRule::None
- }
-}
-
-impl FromStr for RenameRule {
- type Err = String;
-
- fn from_str(s: &str) -> Result<RenameRule, Self::Err> {
- match s {
- "none" => Ok(RenameRule::None),
- "None" => Ok(RenameRule::None),
-
- "mGeckoCase" => Ok(RenameRule::GeckoCase),
- "GeckoCase" => Ok(RenameRule::GeckoCase),
- "gecko_case" => Ok(RenameRule::GeckoCase),
-
- "lowercase" => Ok(RenameRule::LowerCase),
- "LowerCase" => Ok(RenameRule::LowerCase),
- "lower_case" => Ok(RenameRule::LowerCase),
-
- "UPPERCASE" => Ok(RenameRule::UpperCase),
- "UpperCase" => Ok(RenameRule::UpperCase),
- "upper_case" => Ok(RenameRule::UpperCase),
-
- "PascalCase" => Ok(RenameRule::PascalCase),
- "pascal_case" => Ok(RenameRule::PascalCase),
-
- "camelCase" => Ok(RenameRule::CamelCase),
- "CamelCase" => Ok(RenameRule::CamelCase),
- "camel_case" => Ok(RenameRule::CamelCase),
-
- "snake_case" => Ok(RenameRule::SnakeCase),
- "SnakeCase" => Ok(RenameRule::SnakeCase),
-
- "SCREAMING_SNAKE_CASE" => Ok(RenameRule::ScreamingSnakeCase),
- "ScreamingSnakeCase" => Ok(RenameRule::ScreamingSnakeCase),
- "screaming_snake_case" => Ok(RenameRule::ScreamingSnakeCase),
-
- "QUALIFIED_SCREAMING_SNAKE_CASE" => Ok(RenameRule::QualifiedScreamingSnakeCase),
- "QualifiedScreamingSnakeCase" => Ok(RenameRule::QualifiedScreamingSnakeCase),
- "qualified_screaming_snake_case" => Ok(RenameRule::QualifiedScreamingSnakeCase),
-
- _ => Err(format!("Unrecognized RenameRule: '{}'.", s)),
- }
- }
-}
-
-deserialize_enum_str!(RenameRule);
diff --git a/cbindgen-0.24.5/src/bindgen/utilities.rs b/cbindgen-0.24.5/src/bindgen/utilities.rs
deleted file mode 100644
index ae3ee60..0000000
--- a/cbindgen-0.24.5/src/bindgen/utilities.rs
+++ /dev/null
@@ -1,295 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#![allow(clippy::redundant_closure_call)]
-
-use syn::ext::IdentExt;
-
-pub trait IterHelpers: Iterator {
- fn try_skip_map<F, T, E>(&mut self, f: F) -> Result<Vec<T>, E>
- where
- F: FnMut(&Self::Item) -> Result<Option<T>, E>;
-}
-
-impl<I> IterHelpers for I
-where
- I: Iterator,
-{
- fn try_skip_map<F, T, E>(&mut self, mut f: F) -> Result<Vec<T>, E>
- where
- F: FnMut(&Self::Item) -> Result<Option<T>, E>,
- {
- let mut out = Vec::new();
- for item in self {
- if let Some(x) = f(&item)? {
- out.push(x);
- }
- }
- Ok(out)
- }
-}
-
-pub trait SynItemFnHelpers: SynAttributeHelpers {
- fn exported_name(&self) -> Option<String>;
-}
-
-impl SynItemFnHelpers for syn::ItemFn {
- fn exported_name(&self) -> Option<String> {
- self.attrs
- .attr_name_value_lookup("export_name")
- .or_else(|| {
- if self.is_no_mangle() {
- Some(self.sig.ident.unraw().to_string())
- } else {
- None
- }
- })
- }
-}
-
-impl SynItemFnHelpers for syn::ImplItemMethod {
- fn exported_name(&self) -> Option<String> {
- self.attrs
- .attr_name_value_lookup("export_name")
- .or_else(|| {
- if self.is_no_mangle() {
- Some(self.sig.ident.unraw().to_string())
- } else {
- None
- }
- })
- }
-}
-
-/// Returns whether this attribute causes us to skip at item. This basically
-/// checks for `#[cfg(test)]`, `#[test]`, `/// cbindgen::ignore` and
-/// variations thereof.
-fn is_skip_item_attr(attr: &syn::Meta) -> bool {
- match *attr {
- syn::Meta::Path(ref path) => {
- // TODO(emilio): It'd be great if rustc allowed us to use a syntax
- // like `#[cbindgen::ignore]` or such.
- path.is_ident("test")
- }
- syn::Meta::List(ref list) => {
- if !list.path.is_ident("cfg") {
- return false;
- }
- list.nested.iter().any(|nested| match *nested {
- syn::NestedMeta::Meta(ref meta) => is_skip_item_attr(meta),
- syn::NestedMeta::Lit(..) => false,
- })
- }
- syn::Meta::NameValue(ref name_value) => {
- if name_value.path.is_ident("doc") {
- if let syn::Lit::Str(ref content) = name_value.lit {
- // FIXME(emilio): Maybe should use the general annotation
- // mechanism, but it seems overkill for this.
- if content.value().trim() == "cbindgen:ignore" {
- return true;
- }
- }
- }
- false
- }
- }
-}
-
-pub trait SynAttributeHelpers {
- /// Returns the list of attributes for an item.
- fn attrs(&self) -> &[syn::Attribute];
-
- /// Searches for attributes like `#[test]`.
- /// Example:
- /// - `item.has_attr_word("test")` => `#[test]`
- fn has_attr_word(&self, name: &str) -> bool {
- self.attrs()
- .iter()
- .filter_map(|x| x.parse_meta().ok())
- .any(|attr| {
- if let syn::Meta::Path(ref path) = attr {
- path.is_ident(name)
- } else {
- false
- }
- })
- }
-
- fn is_no_mangle(&self) -> bool {
- self.has_attr_word("no_mangle")
- }
-
- /// Sees whether we should skip parsing a given item.
- fn should_skip_parsing(&self) -> bool {
- for attr in self.attrs() {
- let meta = match attr.parse_meta() {
- Ok(attr) => attr,
- Err(..) => return false,
- };
- if is_skip_item_attr(&meta) {
- return true;
- }
- }
-
- false
- }
-
- fn attr_name_value_lookup(&self, name: &str) -> Option<String> {
- self.attrs()
- .iter()
- .filter_map(|attr| {
- let attr = attr.parse_meta().ok()?;
- if let syn::Meta::NameValue(syn::MetaNameValue {
- path,
- lit: syn::Lit::Str(lit),
- ..
- }) = attr
- {
- if path.is_ident(name) {
- return Some(lit.value());
- }
- }
- None
- })
- .next()
- }
-
- fn get_comment_lines(&self) -> Vec<String> {
- let mut comment = Vec::new();
-
- for attr in self.attrs() {
- if attr.style == syn::AttrStyle::Outer {
- if let Ok(syn::Meta::NameValue(syn::MetaNameValue {
- path,
- lit: syn::Lit::Str(content),
- ..
- })) = attr.parse_meta()
- {
- if path.is_ident("doc") {
- comment.extend(split_doc_attr(&content.value()));
- }
- }
- }
- }
-
- comment
- }
-}
-
-macro_rules! syn_item_match_helper {
- ($s:ident => has_attrs: |$i:ident| $a:block, otherwise: || $b:block) => {
- match *$s {
- syn::Item::Const(ref $i) => $a,
- syn::Item::Enum(ref $i) => $a,
- syn::Item::ExternCrate(ref $i) => $a,
- syn::Item::Fn(ref $i) => $a,
- syn::Item::ForeignMod(ref $i) => $a,
- syn::Item::Impl(ref $i) => $a,
- syn::Item::Macro(ref $i) => $a,
- syn::Item::Macro2(ref $i) => $a,
- syn::Item::Mod(ref $i) => $a,
- syn::Item::Static(ref $i) => $a,
- syn::Item::Struct(ref $i) => $a,
- syn::Item::Trait(ref $i) => $a,
- syn::Item::Type(ref $i) => $a,
- syn::Item::Union(ref $i) => $a,
- syn::Item::Use(ref $i) => $a,
- syn::Item::TraitAlias(ref $i) => $a,
- syn::Item::Verbatim(_) => $b,
- _ => panic!("Unhandled syn::Item: {:?}", $s),
- }
- };
-}
-
-impl SynAttributeHelpers for syn::Item {
- fn attrs(&self) -> &[syn::Attribute] {
- syn_item_match_helper!(self =>
- has_attrs: |item| { &item.attrs },
- otherwise: || { &[] }
- )
- }
-}
-
-macro_rules! impl_syn_item_helper {
- ($t:ty) => {
- impl SynAttributeHelpers for $t {
- fn attrs(&self) -> &[syn::Attribute] {
- &self.attrs
- }
- }
- };
-}
-
-impl_syn_item_helper!(syn::ItemExternCrate);
-impl_syn_item_helper!(syn::ItemUse);
-impl_syn_item_helper!(syn::ItemStatic);
-impl_syn_item_helper!(syn::ItemConst);
-impl_syn_item_helper!(syn::ItemFn);
-impl_syn_item_helper!(syn::ImplItemMethod);
-impl_syn_item_helper!(syn::ItemMod);
-impl_syn_item_helper!(syn::ItemForeignMod);
-impl_syn_item_helper!(syn::ItemType);
-impl_syn_item_helper!(syn::ItemStruct);
-impl_syn_item_helper!(syn::ItemEnum);
-impl_syn_item_helper!(syn::ItemUnion);
-impl_syn_item_helper!(syn::ItemTrait);
-impl_syn_item_helper!(syn::ItemImpl);
-impl_syn_item_helper!(syn::ItemMacro);
-impl_syn_item_helper!(syn::ItemMacro2);
-impl_syn_item_helper!(syn::ItemTraitAlias);
-
-/// Helper function for accessing Abi information
-pub trait SynAbiHelpers {
- fn is_c(&self) -> bool;
- fn is_omitted(&self) -> bool;
-}
-
-impl SynAbiHelpers for Option<syn::Abi> {
- fn is_c(&self) -> bool {
- if let Some(ref abi) = *self {
- if let Some(ref lit_string) = abi.name {
- return lit_string.value() == "C";
- }
- }
- false
- }
- fn is_omitted(&self) -> bool {
- if let Some(ref abi) = *self {
- abi.name.is_none()
- } else {
- false
- }
- }
-}
-
-impl SynAbiHelpers for syn::Abi {
- fn is_c(&self) -> bool {
- if let Some(ref lit_string) = self.name {
- lit_string.value() == "C"
- } else {
- false
- }
- }
- fn is_omitted(&self) -> bool {
- self.name.is_none()
- }
-}
-
-impl SynAttributeHelpers for [syn::Attribute] {
- fn attrs(&self) -> &[syn::Attribute] {
- self
- }
-}
-
-fn split_doc_attr(input: &str) -> Vec<String> {
- input
- // Convert two newline (indicate "new paragraph") into two line break.
- .replace("\n\n", " \n \n")
- // Convert newline after two spaces (indicate "line break") into line break.
- .split(" \n")
- // Convert single newline (indicate hard-wrapped) into space.
- .map(|s| s.replace('\n', " "))
- .map(|s| s.trim_end().to_string())
- .collect()
-}
diff --git a/cbindgen-0.24.5/src/bindgen/writer.rs b/cbindgen-0.24.5/src/bindgen/writer.rs
deleted file mode 100644
index eed6917..0000000
--- a/cbindgen-0.24.5/src/bindgen/writer.rs
+++ /dev/null
@@ -1,258 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::cmp;
-use std::io;
-use std::io::Write;
-
-use crate::bindgen::config::{Braces, Config, Language};
-use crate::bindgen::Bindings;
-
-/// A type of way to format a list.
-pub enum ListType<'a> {
- /// Join each adjacent item with a str.
- Join(&'a str),
- /// End each item with a str.
- Cap(&'a str),
-}
-
-/// A utility wrapper to write unbuffered data and correctly adjust positions.
-struct InnerWriter<'a, 'b: 'a, F: 'a + Write>(&'a mut SourceWriter<'b, F>);
-
-impl<'a, 'b, F: Write> Write for InnerWriter<'a, 'b, F> {
- fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
- let writer = &mut self.0;
-
- if !writer.line_started {
- for _ in 0..writer.spaces() {
- write!(writer.out, " ").unwrap();
- }
- writer.line_started = true;
- writer.line_length += writer.spaces();
- }
-
- let written = writer.out.write(buf)?;
- writer.line_length += written;
- writer.max_line_length = cmp::max(writer.max_line_length, writer.line_length);
- Ok(written)
- }
-
- fn flush(&mut self) -> io::Result<()> {
- self.0.out.flush()
- }
-}
-
-/// A utility writer for generating code easier.
-pub struct SourceWriter<'a, F: Write> {
- out: F,
- bindings: &'a Bindings,
- spaces: Vec<usize>,
- line_started: bool,
- line_length: usize,
- line_number: usize,
- max_line_length: usize,
-}
-
-pub type MeasureWriter<'a> = SourceWriter<'a, &'a mut Vec<u8>>;
-
-impl<'a, F: Write> SourceWriter<'a, F> {
- pub fn new(out: F, bindings: &'a Bindings) -> Self {
- SourceWriter {
- out,
- bindings,
- spaces: vec![0],
- line_started: false,
- line_length: 0,
- line_number: 1,
- max_line_length: 0,
- }
- }
-
- pub fn bindings(&self) -> &Bindings {
- self.bindings
- }
-
- /// Takes a function that writes source and returns the maximum line length
- /// written.
- pub fn try_write<T>(&mut self, func: T, max_line_length: usize) -> bool
- where
- T: Fn(&mut MeasureWriter),
- {
- if self.line_length > max_line_length {
- return false;
- }
-
- let mut buffer = Vec::new();
- let line_length = {
- let mut measurer = SourceWriter {
- out: &mut buffer,
- bindings: self.bindings,
- spaces: self.spaces.clone(),
- line_started: self.line_started,
- line_length: self.line_length,
- line_number: self.line_number,
- max_line_length: self.line_length,
- };
-
- func(&mut measurer);
-
- measurer.max_line_length
- };
-
- if line_length > max_line_length {
- return false;
- }
- // We don't want the extra alignment, it's already accounted for by the
- // measurer.
- self.line_started = true;
- InnerWriter(self).write_all(&buffer).unwrap();
- true
- }
-
- fn spaces(&self) -> usize {
- *self.spaces.last().unwrap()
- }
-
- pub fn push_set_spaces(&mut self, spaces: usize) {
- self.spaces.push(spaces);
- }
-
- pub fn pop_set_spaces(&mut self) {
- self.pop_tab()
- }
-
- pub fn line_length_for_align(&self) -> usize {
- if self.line_started {
- self.line_length
- } else {
- self.line_length + self.spaces()
- }
- }
-
- pub fn push_tab(&mut self) {
- let spaces = self.spaces() - (self.spaces() % self.bindings.config.tab_width)
- + self.bindings.config.tab_width;
- self.spaces.push(spaces);
- }
-
- pub fn pop_tab(&mut self) {
- assert!(!self.spaces.is_empty());
- self.spaces.pop();
- }
-
- pub fn new_line(&mut self) {
- self.out
- .write_all(self.bindings.config.line_endings.as_str().as_bytes())
- .unwrap();
- self.line_started = false;
- self.line_length = 0;
- self.line_number += 1;
- }
-
- pub fn new_line_if_not_start(&mut self) {
- if self.line_number != 1 {
- self.new_line();
- }
- }
-
- pub fn open_brace(&mut self) {
- match self.bindings.config.language {
- Language::Cxx | Language::C => match self.bindings.config.braces {
- Braces::SameLine => {
- self.write(" {");
- self.push_tab();
- self.new_line();
- }
- Braces::NextLine => {
- self.new_line();
- self.write("{");
- self.push_tab();
- self.new_line();
- }
- },
- Language::Cython => {
- self.write(":");
- self.new_line();
- self.push_tab();
- }
- }
- }
-
- pub fn close_brace(&mut self, semicolon: bool) {
- self.pop_tab();
- match self.bindings.config.language {
- Language::Cxx | Language::C => {
- self.new_line();
- if semicolon {
- self.write("};");
- } else {
- self.write("}");
- }
- }
- Language::Cython => {}
- }
- }
-
- pub fn write(&mut self, text: &'static str) {
- write!(self, "{}", text);
- }
-
- pub fn write_raw_block(&mut self, block: &str) {
- self.line_started = true;
- write!(self, "{}", block);
- }
-
- pub fn write_fmt(&mut self, fmt: ::std::fmt::Arguments) {
- InnerWriter(self).write_fmt(fmt).unwrap();
- }
-
- pub fn write_horizontal_source_list<S: Source>(
- &mut self,
- items: &[S],
- list_type: ListType<'_>,
- ) {
- for (i, item) in items.iter().enumerate() {
- item.write(&self.bindings.config, self);
-
- match list_type {
- ListType::Join(text) => {
- if i != items.len() - 1 {
- write!(self, "{}", text);
- }
- }
- ListType::Cap(text) => {
- write!(self, "{}", text);
- }
- }
- }
- }
-
- pub fn write_vertical_source_list<S: Source>(&mut self, items: &[S], list_type: ListType<'_>) {
- let align_length = self.line_length_for_align();
- self.push_set_spaces(align_length);
- for (i, item) in items.iter().enumerate() {
- item.write(&self.bindings.config, self);
-
- match list_type {
- ListType::Join(text) => {
- if i != items.len() - 1 {
- write!(self, "{}", text);
- }
- }
- ListType::Cap(text) => {
- write!(self, "{}", text);
- }
- }
-
- if i != items.len() - 1 {
- self.new_line();
- }
- }
- self.pop_tab();
- }
-}
-
-pub trait Source {
- fn write<F: Write>(&self, config: &Config, _: &mut SourceWriter<F>);
-}
diff --git a/cbindgen-0.24.5/src/logging.rs b/cbindgen-0.24.5/src/logging.rs
deleted file mode 100644
index 3b698c8..0000000
--- a/cbindgen-0.24.5/src/logging.rs
+++ /dev/null
@@ -1,105 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::io;
-use std::io::Write;
-
-use log::*;
-
-pub struct TraceLogger;
-pub struct WarnLogger;
-pub struct InfoLogger;
-pub struct ErrorLogger;
-
-impl TraceLogger {
- pub fn init() -> Result<(), SetLoggerError> {
- log::set_logger(&InfoLogger)?;
- log::set_max_level(LevelFilter::Trace);
- Ok(())
- }
-}
-impl log::Log for TraceLogger {
- fn enabled(&self, metadata: &Metadata) -> bool {
- metadata.level() <= Level::Trace
- }
-
- fn log(&self, record: &Record) {
- if self.enabled(record.metadata()) {
- eprintln!("{}: {}", record.level(), record.args());
- }
- }
-
- fn flush(&self) {
- io::stderr().flush().unwrap();
- }
-}
-
-impl WarnLogger {
- pub fn init() -> Result<(), SetLoggerError> {
- log::set_logger(&InfoLogger)?;
- log::set_max_level(LevelFilter::Warn);
- Ok(())
- }
-}
-impl log::Log for WarnLogger {
- fn enabled(&self, metadata: &Metadata) -> bool {
- metadata.level() <= Level::Warn
- }
-
- fn log(&self, record: &Record) {
- if self.enabled(record.metadata()) {
- eprintln!("{}: {}", record.level(), record.args());
- }
- }
-
- fn flush(&self) {
- io::stderr().flush().unwrap();
- }
-}
-
-impl ErrorLogger {
- pub fn init() -> Result<(), SetLoggerError> {
- log::set_logger(&InfoLogger)?;
- log::set_max_level(LevelFilter::Error);
- Ok(())
- }
-}
-impl log::Log for ErrorLogger {
- fn enabled(&self, metadata: &Metadata) -> bool {
- metadata.level() <= Level::Error
- }
-
- fn log(&self, record: &Record) {
- if self.enabled(record.metadata()) {
- eprintln!("{}: {}", record.level(), record.args());
- }
- }
-
- fn flush(&self) {
- io::stderr().flush().unwrap();
- }
-}
-
-impl InfoLogger {
- pub fn init() -> Result<(), SetLoggerError> {
- log::set_logger(&InfoLogger)?;
- log::set_max_level(LevelFilter::Info);
- Ok(())
- }
-}
-impl log::Log for InfoLogger {
- fn enabled(&self, metadata: &Metadata) -> bool {
- metadata.level() <= Level::Info
- }
-
- fn log(&self, record: &Record) {
- if self.enabled(record.metadata()) {
- eprintln!("{}: {}", record.level(), record.args());
- }
- }
-
- fn flush(&self) {
- io::stderr().flush().unwrap();
- }
-}
diff --git a/cbindgen-0.24.5/src/main.rs b/cbindgen-0.24.5/src/main.rs
deleted file mode 100644
index 812366f..0000000
--- a/cbindgen-0.24.5/src/main.rs
+++ /dev/null
@@ -1,314 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::env;
-use std::io;
-use std::path::{Path, PathBuf};
-use std::str::FromStr;
-
-extern crate clap;
-#[macro_use]
-extern crate log;
-extern crate proc_macro2;
-#[macro_use]
-extern crate serde;
-extern crate serde_json;
-#[macro_use]
-extern crate quote;
-#[macro_use]
-extern crate syn;
-extern crate toml;
-
-use clap::{Arg, ArgMatches, Command};
-
-mod bindgen;
-mod logging;
-
-use crate::bindgen::{Bindings, Builder, Cargo, Config, Error, Profile, Style};
-
-fn apply_config_overrides(config: &mut Config, matches: &ArgMatches) {
- // We allow specifying a language to override the config default. This is
- // used by compile-tests.
- if let Some(lang) = matches.value_of("lang") {
- config.language = match lang.parse() {
- Ok(lang) => lang,
- Err(reason) => {
- error!("{}", reason);
- return;
- }
- }
- }
-
- if matches.is_present("cpp-compat") {
- config.cpp_compat = true;
- }
-
- if matches.is_present("only-target-dependencies") {
- config.only_target_dependencies = true;
- }
-
- if let Some(style) = matches.value_of("style") {
- config.style = match style {
- "Both" => Style::Both,
- "both" => Style::Both,
- "Tag" => Style::Tag,
- "tag" => Style::Tag,
- "Type" => Style::Type,
- "type" => Style::Type,
- _ => {
- error!("Unknown style specified.");
- return;
- }
- }
- }
-
- if let Some(profile) = matches.value_of("profile") {
- config.parse.expand.profile = match Profile::from_str(profile) {
- Ok(p) => p,
- Err(e) => {
- error!("{}", e);
- return;
- }
- }
- }
-
- if matches.is_present("d") {
- config.parse.parse_deps = true;
- }
-}
-
-fn load_bindings(input: &Path, matches: &ArgMatches) -> Result<Bindings, Error> {
- // If a file is specified then we load it as a single source
- if !input.is_dir() {
- // Load any config specified or search in the input directory
- let mut config = match matches.value_of("config") {
- Some(c) => Config::from_file(c).unwrap(),
- None => Config::from_root_or_default(input),
- };
-
- apply_config_overrides(&mut config, matches);
-
- return Builder::new()
- .with_config(config)
- .with_src(input)
- .generate();
- }
-
- // We have to load a whole crate, so we use cargo to gather metadata
- let lib = Cargo::load(
- input,
- matches.value_of("lockfile"),
- matches.value_of("crate"),
- true,
- matches.is_present("clean"),
- matches.is_present("only-target-dependencies"),
- matches.value_of("metadata").map(Path::new),
- )?;
-
- // Load any config specified or search in the binding crate directory
- let mut config = match matches.value_of("config") {
- Some(c) => Config::from_file(c).unwrap(),
- None => {
- let binding_crate_dir = lib.find_crate_dir(&lib.binding_crate_ref());
-
- if let Some(binding_crate_dir) = binding_crate_dir {
- Config::from_root_or_default(binding_crate_dir)
- } else {
- // This shouldn't happen
- Config::from_root_or_default(input)
- }
- }
- };
-
- apply_config_overrides(&mut config, matches);
-
- Builder::new()
- .with_config(config)
- .with_cargo(lib)
- .generate()
-}
-
-fn main() {
- let matches = Command::new("cbindgen")
- .version(bindgen::VERSION)
- .about("Generate C bindings for a Rust library")
- .arg(
- Arg::new("v")
- .short('v')
- .multiple_occurrences(true)
- .help("Enable verbose logging"),
- )
- .arg(
- Arg::new("verify")
- .long("verify")
- .help("Generate bindings and compare it to the existing bindings file and error if they are different"),
- )
- .arg(
- Arg::new("config")
- .short('c')
- .long("config")
- .value_name("PATH")
- .help("Specify path to a `cbindgen.toml` config to use"),
- )
- .arg(
- Arg::new("lang")
- .short('l')
- .long("lang")
- .value_name("LANGUAGE")
- .help("Specify the language to output bindings in")
- .possible_values(["c++", "C++", "c", "C", "cython", "Cython"]),
- )
- .arg(
- Arg::new("cpp-compat")
- .long("cpp-compat")
- .help("Whether to add C++ compatibility to generated C bindings")
- )
- .arg(
- Arg::new("only-target-dependencies")
- .long("only-target-dependencies")
- .help("Only fetch dependencies needed by the target platform. \
- The target platform defaults to the host platform; set TARGET to override.")
- )
- .arg(
- Arg::new("style")
- .short('s')
- .long("style")
- .value_name("STYLE")
- .help("Specify the declaration style to use for bindings")
- .possible_values(["Both", "both", "Tag", "tag", "Type", "type"]),
- )
- .arg(
- Arg::new("d")
- .short('d')
- .long("parse-dependencies")
- .help("Whether to parse dependencies when generating bindings"),
- )
- .arg(
- Arg::new("clean")
- .long("clean")
- .help(
- "Whether to use a new temporary directory for expanding macros. \
- Affects performance, but might be required in certain build processes.")
- .required(false)
- )
- .arg(
- Arg::new("INPUT")
- .help(
- "A crate directory or source file to generate bindings for. \
- In general this is the folder where the Cargo.toml file of \
- source Rust library resides.")
- .required(false)
- .index(1),
- )
- .arg(
- Arg::new("crate")
- .long("crate")
- .value_name("CRATE_NAME")
- .help(
- "If generating bindings for a crate, \
- the specific crate to generate bindings for",
- )
- .required(false),
- )
- .arg(
- Arg::new("out")
- .short('o')
- .long("output")
- .value_name("PATH")
- .help("The file to output the bindings to")
- .required(false),
- )
- .arg(
- Arg::new("lockfile")
- .long("lockfile")
- .value_name("PATH")
- .help(
- "Specify the path to the Cargo.lock file explicitly. If this \
- is not specified, the Cargo.lock file is searched for in the \
- same folder as the Cargo.toml file. This option is useful for \
- projects that use workspaces.")
- .required(false),
- )
- .arg(
- Arg::new("metadata")
- .long("metadata")
- .value_name("PATH")
- .help(
- "Specify the path to the output of a `cargo metadata` \
- command that allows to get dependency information. \
- This is useful because cargo metadata may be the longest \
- part of cbindgen runtime, and you may want to share it \
- across cbindgen invocations. By default cbindgen will run \
- `cargo metadata --all-features --format-version 1 \
- --manifest-path <path/to/crate/Cargo.toml>"
- )
- .required(false),
- )
- .arg(
- Arg::new("profile")
- .long("profile")
- .value_name("PROFILE")
- .help(
- "Specify the profile to use when expanding macros. \
- Has no effect otherwise."
- )
- .possible_values(["Debug", "debug", "Release", "release"]),
- )
- .arg(
- Arg::new("quiet")
- .short('q')
- .long("quiet")
- .help("Report errors only (overrides verbosity options).")
- .required(false),
- )
- .get_matches();
-
- if !matches.is_present("out") && matches.is_present("verify") {
- error!(
- "Cannot verify bindings against `stdout`, please specify a file to compare against."
- );
- std::process::exit(2);
- }
-
- // Initialize logging
- if matches.is_present("quiet") {
- logging::ErrorLogger::init().unwrap();
- } else {
- match matches.occurrences_of("v") {
- 0 => logging::WarnLogger::init().unwrap(),
- 1 => logging::InfoLogger::init().unwrap(),
- _ => logging::TraceLogger::init().unwrap(),
- }
- }
-
- // Find the input directory
- let input = match matches.value_of("INPUT") {
- Some(input) => PathBuf::from(input),
- None => env::current_dir().unwrap(),
- };
-
- let bindings = match load_bindings(&input, &matches) {
- Ok(bindings) => bindings,
- Err(msg) => {
- error!("{}", msg);
- error!("Couldn't generate bindings for {}.", input.display());
- std::process::exit(1);
- }
- };
-
- // Write the bindings file
- match matches.value_of("out") {
- Some(file) => {
- let changed = bindings.write_to_file(file);
-
- if matches.is_present("verify") && changed {
- error!("Bindings changed: {}", file);
- std::process::exit(2);
- }
- }
- _ => {
- bindings.write(io::stdout());
- }
- }
-}
diff --git a/cbindgen-0.24.5/template.toml b/cbindgen-0.24.5/template.toml
deleted file mode 100644
index bc41429..0000000
--- a/cbindgen-0.24.5/template.toml
+++ /dev/null
@@ -1,152 +0,0 @@
-# This is a template cbindgen.toml file with all of the default values.
-# Some values are commented out because their absence is the real default.
-#
-# See https://github.com/eqrion/cbindgen/blob/master/docs.md#cbindgentoml
-# for detailed documentation of every option here.
-
-
-
-language = "C++"
-
-
-
-############## Options for Wrapping the Contents of the Header #################
-
-# header = "/* Text to put at the beginning of the generated file. Probably a license. */"
-# trailer = "/* Text to put at the end of the generated file */"
-# include_guard = "my_bindings_h"
-# pragma_once = true
-# autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
-include_version = false
-# namespace = "my_namespace"
-namespaces = []
-using_namespaces = []
-sys_includes = []
-includes = []
-no_includes = false
-after_includes = ""
-
-
-
-
-############################ Code Style Options ################################
-
-braces = "SameLine"
-line_length = 100
-tab_width = 2
-documentation = true
-documentation_style = "auto"
-documentation_length = "full"
-line_endings = "LF" # also "CR", "CRLF", "Native"
-
-
-
-
-############################# Codegen Options ##################################
-
-style = "both"
-sort_by = "Name" # default for `fn.sort_by` and `const.sort_by`
-usize_is_size_t = true
-
-
-
-[defines]
-# "target_os = freebsd" = "DEFINE_FREEBSD"
-# "feature = serde" = "DEFINE_SERDE"
-
-
-
-[export]
-include = []
-exclude = []
-# prefix = "CAPI_"
-item_types = []
-renaming_overrides_prefixing = false
-
-
-
-[export.rename]
-
-
-
-[export.body]
-
-
-[export.mangle]
-
-
-[fn]
-rename_args = "None"
-# must_use = "MUST_USE_FUNC"
-# no_return = "NO_RETURN"
-# prefix = "START_FUNC"
-# postfix = "END_FUNC"
-args = "auto"
-sort_by = "Name"
-
-
-
-
-[struct]
-rename_fields = "None"
-# must_use = "MUST_USE_STRUCT"
-derive_constructor = false
-derive_eq = false
-derive_neq = false
-derive_lt = false
-derive_lte = false
-derive_gt = false
-derive_gte = false
-
-
-
-
-[enum]
-rename_variants = "None"
-# must_use = "MUST_USE_ENUM"
-add_sentinel = false
-prefix_with_name = false
-derive_helper_methods = false
-derive_const_casts = false
-derive_mut_casts = false
-# cast_assert_name = "ASSERT"
-derive_tagged_enum_destructor = false
-derive_tagged_enum_copy_constructor = false
-enum_class = true
-private_default_tagged_enum_constructor = false
-
-
-
-
-[const]
-allow_static_const = true
-allow_constexpr = false
-sort_by = "Name"
-
-
-
-
-[macro_expansion]
-bitflags = false
-
-
-
-
-
-
-############## Options for How Your Rust library Should Be Parsed ##############
-
-[parse]
-parse_deps = false
-# include = []
-exclude = []
-clean = false
-extra_bindings = []
-
-
-
-[parse.expand]
-crates = []
-all_features = false
-default_features = true
-features = []
diff --git a/cbindgen-0.24.5/tests/expectations/alias.both.compat.c b/cbindgen-0.24.5/tests/expectations/alias.both.compat.c
deleted file mode 100644
index da9afc7..0000000
--- a/cbindgen-0.24.5/tests/expectations/alias.both.compat.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum Status
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- Ok,
- Err,
-};
-#ifndef __cplusplus
-typedef uint32_t Status;
-#endif // __cplusplus
-
-typedef struct Dep {
- int32_t a;
- float b;
-} Dep;
-
-typedef struct Foo_i32 {
- int32_t a;
- int32_t b;
- struct Dep c;
-} Foo_i32;
-
-typedef struct Foo_i32 IntFoo;
-
-typedef struct Foo_f64 {
- double a;
- double b;
- struct Dep c;
-} Foo_f64;
-
-typedef struct Foo_f64 DoubleFoo;
-
-typedef int32_t Unit;
-
-typedef Status SpecialStatus;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/alias.compat.c b/cbindgen-0.24.5/tests/expectations/alias.compat.c
deleted file mode 100644
index 4b1372a..0000000
--- a/cbindgen-0.24.5/tests/expectations/alias.compat.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum Status
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- Ok,
- Err,
-};
-#ifndef __cplusplus
-typedef uint32_t Status;
-#endif // __cplusplus
-
-typedef struct {
- int32_t a;
- float b;
-} Dep;
-
-typedef struct {
- int32_t a;
- int32_t b;
- Dep c;
-} Foo_i32;
-
-typedef Foo_i32 IntFoo;
-
-typedef struct {
- double a;
- double b;
- Dep c;
-} Foo_f64;
-
-typedef Foo_f64 DoubleFoo;
-
-typedef int32_t Unit;
-
-typedef Status SpecialStatus;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/alias.cpp b/cbindgen-0.24.5/tests/expectations/alias.cpp
deleted file mode 100644
index 9433247..0000000
--- a/cbindgen-0.24.5/tests/expectations/alias.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-enum class Status : uint32_t {
- Ok,
- Err,
-};
-
-struct Dep {
- int32_t a;
- float b;
-};
-
-template<typename X>
-struct Foo {
- X a;
- X b;
- Dep c;
-};
-
-using IntFoo = Foo<int32_t>;
-
-using DoubleFoo = Foo<double>;
-
-using Unit = int32_t;
-
-using SpecialStatus = Status;
-
-extern "C" {
-
-void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/alias.tag.compat.c b/cbindgen-0.24.5/tests/expectations/alias.tag.compat.c
deleted file mode 100644
index 4cdb7ad..0000000
--- a/cbindgen-0.24.5/tests/expectations/alias.tag.compat.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum Status
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- Ok,
- Err,
-};
-#ifndef __cplusplus
-typedef uint32_t Status;
-#endif // __cplusplus
-
-struct Dep {
- int32_t a;
- float b;
-};
-
-struct Foo_i32 {
- int32_t a;
- int32_t b;
- struct Dep c;
-};
-
-typedef struct Foo_i32 IntFoo;
-
-struct Foo_f64 {
- double a;
- double b;
- struct Dep c;
-};
-
-typedef struct Foo_f64 DoubleFoo;
-
-typedef int32_t Unit;
-
-typedef Status SpecialStatus;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/annotation.both.compat.c b/cbindgen-0.24.5/tests/expectations/annotation.both.compat.c
deleted file mode 100644
index 2de2059..0000000
--- a/cbindgen-0.24.5/tests/expectations/annotation.both.compat.c
+++ /dev/null
@@ -1,91 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum C
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- X = 2,
- Y,
-};
-#ifndef __cplusplus
-typedef uint32_t C;
-#endif // __cplusplus
-
-typedef struct A {
- int32_t m0;
-} A;
-
-typedef struct B {
- int32_t x;
- float y;
-} B;
-
-enum F_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Foo,
- Bar,
- Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t F_Tag;
-#endif // __cplusplus
-
-typedef struct Bar_Body {
- F_Tag tag;
- uint8_t x;
- int16_t y;
-} Bar_Body;
-
-typedef union F {
- F_Tag tag;
- struct {
- F_Tag foo_tag;
- int16_t foo;
- };
- Bar_Body bar;
-} F;
-
-enum H_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Hello,
- There,
- Everyone,
-};
-#ifndef __cplusplus
-typedef uint8_t H_Tag;
-#endif // __cplusplus
-
-typedef struct There_Body {
- uint8_t x;
- int16_t y;
-} There_Body;
-
-typedef struct H {
- H_Tag tag;
- union {
- struct {
- int16_t hello;
- };
- There_Body there;
- };
-} H;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct A x, struct B y, C z, union F f, struct H h);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/annotation.compat.c b/cbindgen-0.24.5/tests/expectations/annotation.compat.c
deleted file mode 100644
index 27d36fa..0000000
--- a/cbindgen-0.24.5/tests/expectations/annotation.compat.c
+++ /dev/null
@@ -1,91 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum C
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- X = 2,
- Y,
-};
-#ifndef __cplusplus
-typedef uint32_t C;
-#endif // __cplusplus
-
-typedef struct {
- int32_t m0;
-} A;
-
-typedef struct {
- int32_t x;
- float y;
-} B;
-
-enum F_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Foo,
- Bar,
- Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t F_Tag;
-#endif // __cplusplus
-
-typedef struct {
- F_Tag tag;
- uint8_t x;
- int16_t y;
-} Bar_Body;
-
-typedef union {
- F_Tag tag;
- struct {
- F_Tag foo_tag;
- int16_t foo;
- };
- Bar_Body bar;
-} F;
-
-enum H_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Hello,
- There,
- Everyone,
-};
-#ifndef __cplusplus
-typedef uint8_t H_Tag;
-#endif // __cplusplus
-
-typedef struct {
- uint8_t x;
- int16_t y;
-} There_Body;
-
-typedef struct {
- H_Tag tag;
- union {
- struct {
- int16_t hello;
- };
- There_Body there;
- };
-} H;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(A x, B y, C z, F f, H h);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/annotation.cpp b/cbindgen-0.24.5/tests/expectations/annotation.cpp
deleted file mode 100644
index 90bf2d4..0000000
--- a/cbindgen-0.24.5/tests/expectations/annotation.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-enum class C : uint32_t {
- X = 2,
- Y,
-};
-
-struct A {
- int32_t m0;
-
- A(int32_t const& m0)
- : m0(m0)
- {}
-
- bool operator<(const A& other) const {
- return m0 < other.m0;
- }
- bool operator<=(const A& other) const {
- return m0 <= other.m0;
- }
-};
-
-struct B {
- int32_t x;
- float y;
-};
-
-union F {
- enum class Tag : uint8_t {
- Foo,
- Bar,
- Baz,
- };
-
- struct Foo_Body {
- Tag tag;
- int16_t _0;
- };
-
- struct Bar_Body {
- Tag tag;
- uint8_t x;
- int16_t y;
- };
-
- struct {
- Tag tag;
- };
- Foo_Body foo;
- Bar_Body bar;
-
- static F Foo(const int16_t &_0) {
- F result;
- ::new (&result.foo._0) (int16_t)(_0);
- result.tag = Tag::Foo;
- return result;
- }
-
- bool IsFoo() const {
- return tag == Tag::Foo;
- }
-
- static F Bar(const uint8_t &x,
- const int16_t &y) {
- F result;
- ::new (&result.bar.x) (uint8_t)(x);
- ::new (&result.bar.y) (int16_t)(y);
- result.tag = Tag::Bar;
- return result;
- }
-
- bool IsBar() const {
- return tag == Tag::Bar;
- }
-
- static F Baz() {
- F result;
- result.tag = Tag::Baz;
- return result;
- }
-
- bool IsBaz() const {
- return tag == Tag::Baz;
- }
-};
-
-struct H {
- enum class Tag : uint8_t {
- Hello,
- There,
- Everyone,
- };
-
- struct Hello_Body {
- int16_t _0;
- };
-
- struct There_Body {
- uint8_t x;
- int16_t y;
- };
-
- Tag tag;
- union {
- Hello_Body hello;
- There_Body there;
- };
-
- static H Hello(const int16_t &_0) {
- H result;
- ::new (&result.hello._0) (int16_t)(_0);
- result.tag = Tag::Hello;
- return result;
- }
-
- bool IsHello() const {
- return tag == Tag::Hello;
- }
-
- static H There(const uint8_t &x,
- const int16_t &y) {
- H result;
- ::new (&result.there.x) (uint8_t)(x);
- ::new (&result.there.y) (int16_t)(y);
- result.tag = Tag::There;
- return result;
- }
-
- bool IsThere() const {
- return tag == Tag::There;
- }
-
- static H Everyone() {
- H result;
- result.tag = Tag::Everyone;
- return result;
- }
-
- bool IsEveryone() const {
- return tag == Tag::Everyone;
- }
-};
-
-extern "C" {
-
-void root(A x, B y, C z, F f, H h);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/annotation.tag.compat.c b/cbindgen-0.24.5/tests/expectations/annotation.tag.compat.c
deleted file mode 100644
index a23c97a..0000000
--- a/cbindgen-0.24.5/tests/expectations/annotation.tag.compat.c
+++ /dev/null
@@ -1,91 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum C
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- X = 2,
- Y,
-};
-#ifndef __cplusplus
-typedef uint32_t C;
-#endif // __cplusplus
-
-struct A {
- int32_t m0;
-};
-
-struct B {
- int32_t x;
- float y;
-};
-
-enum F_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Foo,
- Bar,
- Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t F_Tag;
-#endif // __cplusplus
-
-struct Bar_Body {
- F_Tag tag;
- uint8_t x;
- int16_t y;
-};
-
-union F {
- F_Tag tag;
- struct {
- F_Tag foo_tag;
- int16_t foo;
- };
- struct Bar_Body bar;
-};
-
-enum H_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Hello,
- There,
- Everyone,
-};
-#ifndef __cplusplus
-typedef uint8_t H_Tag;
-#endif // __cplusplus
-
-struct There_Body {
- uint8_t x;
- int16_t y;
-};
-
-struct H {
- H_Tag tag;
- union {
- struct {
- int16_t hello;
- };
- struct There_Body there;
- };
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct A x, struct B y, C z, union F f, struct H h);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/array.both.compat.c b/cbindgen-0.24.5/tests/expectations/array.both.compat.c
deleted file mode 100644
index d3c7308..0000000
--- a/cbindgen-0.24.5/tests/expectations/array.both.compat.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef enum Foo_Tag {
- A,
-} Foo_Tag;
-
-typedef struct Foo {
- Foo_Tag tag;
- union {
- struct {
- float a[20];
- };
- };
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/array.compat.c b/cbindgen-0.24.5/tests/expectations/array.compat.c
deleted file mode 100644
index d5d7661..0000000
--- a/cbindgen-0.24.5/tests/expectations/array.compat.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef enum {
- A,
-} Foo_Tag;
-
-typedef struct {
- Foo_Tag tag;
- union {
- struct {
- float a[20];
- };
- };
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/array.cpp b/cbindgen-0.24.5/tests/expectations/array.cpp
deleted file mode 100644
index 1a57519..0000000
--- a/cbindgen-0.24.5/tests/expectations/array.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Foo {
- enum class Tag {
- A,
- };
-
- struct A_Body {
- float _0[20];
- };
-
- Tag tag;
- union {
- A_Body a;
- };
-
- static Foo A(const float (&_0)[20]) {
- Foo result;
- for (int i = 0; i < 20; i++) {
- ::new (&result.a._0[i]) (float)(_0[i]);
- }
- result.tag = Tag::A;
- return result;
- }
-
- bool IsA() const {
- return tag == Tag::A;
- }
-};
-
-extern "C" {
-
-void root(Foo a);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/array.tag.compat.c b/cbindgen-0.24.5/tests/expectations/array.tag.compat.c
deleted file mode 100644
index ea11fbf..0000000
--- a/cbindgen-0.24.5/tests/expectations/array.tag.compat.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum Foo_Tag {
- A,
-};
-
-struct Foo {
- enum Foo_Tag tag;
- union {
- struct {
- float a[20];
- };
- };
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/asserted_cast.both.compat.c b/cbindgen-0.24.5/tests/expectations/asserted_cast.both.compat.c
deleted file mode 100644
index 4eabaf3..0000000
--- a/cbindgen-0.24.5/tests/expectations/asserted_cast.both.compat.c
+++ /dev/null
@@ -1,104 +0,0 @@
-#define MY_ASSERT(...) do { } while (0)
-#define MY_ATTRS __attribute((noinline))
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct I I;
-
-enum H_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- H_Foo,
- H_Bar,
- H_Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t H_Tag;
-#endif // __cplusplus
-
-typedef struct H_Bar_Body {
- uint8_t x;
- int16_t y;
-} H_Bar_Body;
-
-typedef struct H {
- H_Tag tag;
- union {
- struct {
- int16_t foo;
- };
- H_Bar_Body bar;
- };
-} H;
-
-enum J_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- J_Foo,
- J_Bar,
- J_Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t J_Tag;
-#endif // __cplusplus
-
-typedef struct J_Bar_Body {
- uint8_t x;
- int16_t y;
-} J_Bar_Body;
-
-typedef struct J {
- J_Tag tag;
- union {
- struct {
- int16_t foo;
- };
- J_Bar_Body bar;
- };
-} J;
-
-enum K_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- K_Foo,
- K_Bar,
- K_Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t K_Tag;
-#endif // __cplusplus
-
-typedef struct K_Bar_Body {
- K_Tag tag;
- uint8_t x;
- int16_t y;
-} K_Bar_Body;
-
-typedef union K {
- K_Tag tag;
- struct {
- K_Tag foo_tag;
- int16_t foo;
- };
- K_Bar_Body bar;
-} K;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void foo(struct H h, struct I i, struct J j, union K k);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/asserted_cast.compat.c b/cbindgen-0.24.5/tests/expectations/asserted_cast.compat.c
deleted file mode 100644
index 5dee704..0000000
--- a/cbindgen-0.24.5/tests/expectations/asserted_cast.compat.c
+++ /dev/null
@@ -1,104 +0,0 @@
-#define MY_ASSERT(...) do { } while (0)
-#define MY_ATTRS __attribute((noinline))
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct I I;
-
-enum H_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- H_Foo,
- H_Bar,
- H_Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t H_Tag;
-#endif // __cplusplus
-
-typedef struct {
- uint8_t x;
- int16_t y;
-} H_Bar_Body;
-
-typedef struct {
- H_Tag tag;
- union {
- struct {
- int16_t foo;
- };
- H_Bar_Body bar;
- };
-} H;
-
-enum J_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- J_Foo,
- J_Bar,
- J_Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t J_Tag;
-#endif // __cplusplus
-
-typedef struct {
- uint8_t x;
- int16_t y;
-} J_Bar_Body;
-
-typedef struct {
- J_Tag tag;
- union {
- struct {
- int16_t foo;
- };
- J_Bar_Body bar;
- };
-} J;
-
-enum K_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- K_Foo,
- K_Bar,
- K_Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t K_Tag;
-#endif // __cplusplus
-
-typedef struct {
- K_Tag tag;
- uint8_t x;
- int16_t y;
-} K_Bar_Body;
-
-typedef union {
- K_Tag tag;
- struct {
- K_Tag foo_tag;
- int16_t foo;
- };
- K_Bar_Body bar;
-} K;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void foo(H h, I i, J j, K k);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/asserted_cast.cpp b/cbindgen-0.24.5/tests/expectations/asserted_cast.cpp
deleted file mode 100644
index 8e0517e..0000000
--- a/cbindgen-0.24.5/tests/expectations/asserted_cast.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-#define MY_ASSERT(...) do { } while (0)
-#define MY_ATTRS __attribute((noinline))
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct I;
-
-struct H {
- enum class Tag : uint8_t {
- H_Foo,
- H_Bar,
- H_Baz,
- };
-
- struct H_Foo_Body {
- int16_t _0;
- };
-
- struct H_Bar_Body {
- uint8_t x;
- int16_t y;
- };
-
- Tag tag;
- union {
- H_Foo_Body foo;
- H_Bar_Body bar;
- };
-
- static H H_Foo(const int16_t &_0) {
- H result;
- ::new (&result.foo._0) (int16_t)(_0);
- result.tag = Tag::H_Foo;
- return result;
- }
-
- bool IsH_Foo() const {
- return tag == Tag::H_Foo;
- }
-
- const int16_t& AsH_Foo() const {
- MY_ASSERT(IsH_Foo());
- return foo._0;
- }
-
- MY_ATTRS int16_t& AsH_Foo() {
- MY_ASSERT(IsH_Foo());
- return foo._0;
- }
-
- static H H_Bar(const uint8_t &x,
- const int16_t &y) {
- H result;
- ::new (&result.bar.x) (uint8_t)(x);
- ::new (&result.bar.y) (int16_t)(y);
- result.tag = Tag::H_Bar;
- return result;
- }
-
- bool IsH_Bar() const {
- return tag == Tag::H_Bar;
- }
-
- MY_ATTRS const H_Bar_Body& AsH_Bar() const {
- MY_ASSERT(IsH_Bar());
- return bar;
- }
-
- H_Bar_Body& AsH_Bar() {
- MY_ASSERT(IsH_Bar());
- return bar;
- }
-
- static H H_Baz() {
- H result;
- result.tag = Tag::H_Baz;
- return result;
- }
-
- MY_ATTRS bool IsH_Baz() const {
- return tag == Tag::H_Baz;
- }
-};
-
-struct J {
- enum class Tag : uint8_t {
- J_Foo,
- J_Bar,
- J_Baz,
- };
-
- struct J_Foo_Body {
- int16_t _0;
- };
-
- struct J_Bar_Body {
- uint8_t x;
- int16_t y;
- };
-
- Tag tag;
- union {
- J_Foo_Body foo;
- J_Bar_Body bar;
- };
-
- static J J_Foo(const int16_t &_0) {
- J result;
- ::new (&result.foo._0) (int16_t)(_0);
- result.tag = Tag::J_Foo;
- return result;
- }
-
- bool IsJ_Foo() const {
- return tag == Tag::J_Foo;
- }
-
- const int16_t& AsJ_Foo() const {
- MY_ASSERT(IsJ_Foo());
- return foo._0;
- }
-
- int16_t& AsJ_Foo() {
- MY_ASSERT(IsJ_Foo());
- return foo._0;
- }
-
- static J J_Bar(const uint8_t &x,
- const int16_t &y) {
- J result;
- ::new (&result.bar.x) (uint8_t)(x);
- ::new (&result.bar.y) (int16_t)(y);
- result.tag = Tag::J_Bar;
- return result;
- }
-
- bool IsJ_Bar() const {
- return tag == Tag::J_Bar;
- }
-
- const J_Bar_Body& AsJ_Bar() const {
- MY_ASSERT(IsJ_Bar());
- return bar;
- }
-
- J_Bar_Body& AsJ_Bar() {
- MY_ASSERT(IsJ_Bar());
- return bar;
- }
-
- static J J_Baz() {
- J result;
- result.tag = Tag::J_Baz;
- return result;
- }
-
- bool IsJ_Baz() const {
- return tag == Tag::J_Baz;
- }
-};
-
-union K {
- enum class Tag : uint8_t {
- K_Foo,
- K_Bar,
- K_Baz,
- };
-
- struct K_Foo_Body {
- Tag tag;
- int16_t _0;
- };
-
- struct K_Bar_Body {
- Tag tag;
- uint8_t x;
- int16_t y;
- };
-
- struct {
- Tag tag;
- };
- K_Foo_Body foo;
- K_Bar_Body bar;
-
- static K K_Foo(const int16_t &_0) {
- K result;
- ::new (&result.foo._0) (int16_t)(_0);
- result.tag = Tag::K_Foo;
- return result;
- }
-
- bool IsK_Foo() const {
- return tag == Tag::K_Foo;
- }
-
- const int16_t& AsK_Foo() const {
- MY_ASSERT(IsK_Foo());
- return foo._0;
- }
-
- int16_t& AsK_Foo() {
- MY_ASSERT(IsK_Foo());
- return foo._0;
- }
-
- static K K_Bar(const uint8_t &x,
- const int16_t &y) {
- K result;
- ::new (&result.bar.x) (uint8_t)(x);
- ::new (&result.bar.y) (int16_t)(y);
- result.tag = Tag::K_Bar;
- return result;
- }
-
- bool IsK_Bar() const {
- return tag == Tag::K_Bar;
- }
-
- const K_Bar_Body& AsK_Bar() const {
- MY_ASSERT(IsK_Bar());
- return bar;
- }
-
- K_Bar_Body& AsK_Bar() {
- MY_ASSERT(IsK_Bar());
- return bar;
- }
-
- static K K_Baz() {
- K result;
- result.tag = Tag::K_Baz;
- return result;
- }
-
- bool IsK_Baz() const {
- return tag == Tag::K_Baz;
- }
-};
-
-extern "C" {
-
-void foo(H h, I i, J j, K k);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/asserted_cast.tag.compat.c b/cbindgen-0.24.5/tests/expectations/asserted_cast.tag.compat.c
deleted file mode 100644
index 2e89b46..0000000
--- a/cbindgen-0.24.5/tests/expectations/asserted_cast.tag.compat.c
+++ /dev/null
@@ -1,104 +0,0 @@
-#define MY_ASSERT(...) do { } while (0)
-#define MY_ATTRS __attribute((noinline))
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct I;
-
-enum H_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- H_Foo,
- H_Bar,
- H_Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t H_Tag;
-#endif // __cplusplus
-
-struct H_Bar_Body {
- uint8_t x;
- int16_t y;
-};
-
-struct H {
- H_Tag tag;
- union {
- struct {
- int16_t foo;
- };
- struct H_Bar_Body bar;
- };
-};
-
-enum J_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- J_Foo,
- J_Bar,
- J_Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t J_Tag;
-#endif // __cplusplus
-
-struct J_Bar_Body {
- uint8_t x;
- int16_t y;
-};
-
-struct J {
- J_Tag tag;
- union {
- struct {
- int16_t foo;
- };
- struct J_Bar_Body bar;
- };
-};
-
-enum K_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- K_Foo,
- K_Bar,
- K_Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t K_Tag;
-#endif // __cplusplus
-
-struct K_Bar_Body {
- K_Tag tag;
- uint8_t x;
- int16_t y;
-};
-
-union K {
- K_Tag tag;
- struct {
- K_Tag foo_tag;
- int16_t foo;
- };
- struct K_Bar_Body bar;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void foo(struct H h, struct I i, struct J j, union K k);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/assoc_constant.both.compat.c b/cbindgen-0.24.5/tests/expectations/assoc_constant.both.compat.c
deleted file mode 100644
index 3edd13e..0000000
--- a/cbindgen-0.24.5/tests/expectations/assoc_constant.both.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo {
-
-} Foo;
-#define Foo_GA 10
-#define Foo_ZO 3.14
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/assoc_constant.compat.c b/cbindgen-0.24.5/tests/expectations/assoc_constant.compat.c
deleted file mode 100644
index 092e0d4..0000000
--- a/cbindgen-0.24.5/tests/expectations/assoc_constant.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
-
-} Foo;
-#define Foo_GA 10
-#define Foo_ZO 3.14
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Foo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/assoc_constant.cpp b/cbindgen-0.24.5/tests/expectations/assoc_constant.cpp
deleted file mode 100644
index 07a0dbd..0000000
--- a/cbindgen-0.24.5/tests/expectations/assoc_constant.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Foo {
-
-};
-constexpr static const int32_t Foo_GA = 10;
-constexpr static const float Foo_ZO = 3.14;
-
-extern "C" {
-
-void root(Foo x);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/assoc_constant.tag.compat.c b/cbindgen-0.24.5/tests/expectations/assoc_constant.tag.compat.c
deleted file mode 100644
index afba694..0000000
--- a/cbindgen-0.24.5/tests/expectations/assoc_constant.tag.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo {
-
-};
-#define Foo_GA 10
-#define Foo_ZO 3.14
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/associated_in_body.both.compat.c b/cbindgen-0.24.5/tests/expectations/associated_in_body.both.compat.c
deleted file mode 100644
index 926d7d3..0000000
--- a/cbindgen-0.24.5/tests/expectations/associated_in_body.both.compat.c
+++ /dev/null
@@ -1,67 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-/**
- * Constants shared by multiple CSS Box Alignment properties
- *
- * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
- */
-typedef struct StyleAlignFlags {
- uint8_t bits;
-} StyleAlignFlags;
-/**
- * 'auto'
- */
-#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = (uint8_t)0 }
-/**
- * 'normal'
- */
-#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = (uint8_t)1 }
-/**
- * 'start'
- */
-#define StyleAlignFlags_START (StyleAlignFlags){ .bits = (uint8_t)(1 << 1) }
-/**
- * 'end'
- */
-#define StyleAlignFlags_END (StyleAlignFlags){ .bits = (uint8_t)(1 << 2) }
-#define StyleAlignFlags_ALIAS (StyleAlignFlags){ .bits = (uint8_t)(StyleAlignFlags_END).bits }
-/**
- * 'flex-start'
- */
-#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = (uint8_t)(1 << 3) }
-#define StyleAlignFlags_MIXED (StyleAlignFlags){ .bits = (uint8_t)(((1 << 4) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
-#define StyleAlignFlags_MIXED_SELF (StyleAlignFlags){ .bits = (uint8_t)(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
-
-/**
- * An arbitrary identifier for a native (OS compositor) surface
- */
-typedef struct StyleNativeSurfaceId {
- uint64_t _0;
-} StyleNativeSurfaceId;
-/**
- * A special id for the native surface that is used for debug / profiler overlays.
- */
-#define StyleNativeSurfaceId_DEBUG_OVERLAY (StyleNativeSurfaceId){ ._0 = UINT64_MAX }
-
-typedef struct StyleNativeTileId {
- struct StyleNativeSurfaceId surface_id;
- int32_t x;
- int32_t y;
-} StyleNativeTileId;
-/**
- * A special id for the native surface that is used for debug / profiler overlays.
- */
-#define StyleNativeTileId_DEBUG_OVERLAY (StyleNativeTileId){ .surface_id = StyleNativeSurfaceId_DEBUG_OVERLAY, .x = 0, .y = 0 }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct StyleAlignFlags flags, struct StyleNativeTileId tile);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/associated_in_body.compat.c b/cbindgen-0.24.5/tests/expectations/associated_in_body.compat.c
deleted file mode 100644
index a7d61ab..0000000
--- a/cbindgen-0.24.5/tests/expectations/associated_in_body.compat.c
+++ /dev/null
@@ -1,67 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-/**
- * Constants shared by multiple CSS Box Alignment properties
- *
- * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
- */
-typedef struct {
- uint8_t bits;
-} StyleAlignFlags;
-/**
- * 'auto'
- */
-#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = (uint8_t)0 }
-/**
- * 'normal'
- */
-#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = (uint8_t)1 }
-/**
- * 'start'
- */
-#define StyleAlignFlags_START (StyleAlignFlags){ .bits = (uint8_t)(1 << 1) }
-/**
- * 'end'
- */
-#define StyleAlignFlags_END (StyleAlignFlags){ .bits = (uint8_t)(1 << 2) }
-#define StyleAlignFlags_ALIAS (StyleAlignFlags){ .bits = (uint8_t)(StyleAlignFlags_END).bits }
-/**
- * 'flex-start'
- */
-#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = (uint8_t)(1 << 3) }
-#define StyleAlignFlags_MIXED (StyleAlignFlags){ .bits = (uint8_t)(((1 << 4) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
-#define StyleAlignFlags_MIXED_SELF (StyleAlignFlags){ .bits = (uint8_t)(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
-
-/**
- * An arbitrary identifier for a native (OS compositor) surface
- */
-typedef struct {
- uint64_t _0;
-} StyleNativeSurfaceId;
-/**
- * A special id for the native surface that is used for debug / profiler overlays.
- */
-#define StyleNativeSurfaceId_DEBUG_OVERLAY (StyleNativeSurfaceId){ ._0 = UINT64_MAX }
-
-typedef struct {
- StyleNativeSurfaceId surface_id;
- int32_t x;
- int32_t y;
-} StyleNativeTileId;
-/**
- * A special id for the native surface that is used for debug / profiler overlays.
- */
-#define StyleNativeTileId_DEBUG_OVERLAY (StyleNativeTileId){ .surface_id = StyleNativeSurfaceId_DEBUG_OVERLAY, .x = 0, .y = 0 }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(StyleAlignFlags flags, StyleNativeTileId tile);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/associated_in_body.cpp b/cbindgen-0.24.5/tests/expectations/associated_in_body.cpp
deleted file mode 100644
index e93a63f..0000000
--- a/cbindgen-0.24.5/tests/expectations/associated_in_body.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-/// Constants shared by multiple CSS Box Alignment properties
-///
-/// These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
-struct StyleAlignFlags {
- uint8_t bits;
-
- constexpr explicit operator bool() const {
- return !!bits;
- }
- constexpr StyleAlignFlags operator~() const {
- return StyleAlignFlags { static_cast<decltype(bits)>(~bits) };
- }
- constexpr StyleAlignFlags operator|(const StyleAlignFlags& other) const {
- return StyleAlignFlags { static_cast<decltype(bits)>(this->bits | other.bits) };
- }
- StyleAlignFlags& operator|=(const StyleAlignFlags& other) {
- *this = (*this | other);
- return *this;
- }
- constexpr StyleAlignFlags operator&(const StyleAlignFlags& other) const {
- return StyleAlignFlags { static_cast<decltype(bits)>(this->bits & other.bits) };
- }
- StyleAlignFlags& operator&=(const StyleAlignFlags& other) {
- *this = (*this & other);
- return *this;
- }
- constexpr StyleAlignFlags operator^(const StyleAlignFlags& other) const {
- return StyleAlignFlags { static_cast<decltype(bits)>(this->bits ^ other.bits) };
- }
- StyleAlignFlags& operator^=(const StyleAlignFlags& other) {
- *this = (*this ^ other);
- return *this;
- }
- static const StyleAlignFlags AUTO;
- static const StyleAlignFlags NORMAL;
- static const StyleAlignFlags START;
- static const StyleAlignFlags END;
- static const StyleAlignFlags ALIAS;
- static const StyleAlignFlags FLEX_START;
- static const StyleAlignFlags MIXED;
- static const StyleAlignFlags MIXED_SELF;
-};
-/// 'auto'
-constexpr inline const StyleAlignFlags StyleAlignFlags::AUTO = StyleAlignFlags{ /* .bits = */ (uint8_t)0 };
-/// 'normal'
-constexpr inline const StyleAlignFlags StyleAlignFlags::NORMAL = StyleAlignFlags{ /* .bits = */ (uint8_t)1 };
-/// 'start'
-constexpr inline const StyleAlignFlags StyleAlignFlags::START = StyleAlignFlags{ /* .bits = */ (uint8_t)(1 << 1) };
-/// 'end'
-constexpr inline const StyleAlignFlags StyleAlignFlags::END = StyleAlignFlags{ /* .bits = */ (uint8_t)(1 << 2) };
-constexpr inline const StyleAlignFlags StyleAlignFlags::ALIAS = StyleAlignFlags{ /* .bits = */ (uint8_t)(StyleAlignFlags::END).bits };
-/// 'flex-start'
-constexpr inline const StyleAlignFlags StyleAlignFlags::FLEX_START = StyleAlignFlags{ /* .bits = */ (uint8_t)(1 << 3) };
-constexpr inline const StyleAlignFlags StyleAlignFlags::MIXED = StyleAlignFlags{ /* .bits = */ (uint8_t)(((1 << 4) | (StyleAlignFlags::FLEX_START).bits) | (StyleAlignFlags::END).bits) };
-constexpr inline const StyleAlignFlags StyleAlignFlags::MIXED_SELF = StyleAlignFlags{ /* .bits = */ (uint8_t)(((1 << 5) | (StyleAlignFlags::FLEX_START).bits) | (StyleAlignFlags::END).bits) };
-
-/// An arbitrary identifier for a native (OS compositor) surface
-struct StyleNativeSurfaceId {
- uint64_t _0;
- static const StyleNativeSurfaceId DEBUG_OVERLAY;
-};
-/// A special id for the native surface that is used for debug / profiler overlays.
-constexpr inline const StyleNativeSurfaceId StyleNativeSurfaceId::DEBUG_OVERLAY = StyleNativeSurfaceId{ /* ._0 = */ UINT64_MAX };
-
-struct StyleNativeTileId {
- StyleNativeSurfaceId surface_id;
- int32_t x;
- int32_t y;
- static const StyleNativeTileId DEBUG_OVERLAY;
-};
-/// A special id for the native surface that is used for debug / profiler overlays.
-constexpr inline const StyleNativeTileId StyleNativeTileId::DEBUG_OVERLAY = StyleNativeTileId{ /* .surface_id = */ StyleNativeSurfaceId::DEBUG_OVERLAY, /* .x = */ 0, /* .y = */ 0 };
-
-extern "C" {
-
-void root(StyleAlignFlags flags, StyleNativeTileId tile);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/associated_in_body.tag.compat.c b/cbindgen-0.24.5/tests/expectations/associated_in_body.tag.compat.c
deleted file mode 100644
index 901dd6e..0000000
--- a/cbindgen-0.24.5/tests/expectations/associated_in_body.tag.compat.c
+++ /dev/null
@@ -1,67 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-/**
- * Constants shared by multiple CSS Box Alignment properties
- *
- * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
- */
-struct StyleAlignFlags {
- uint8_t bits;
-};
-/**
- * 'auto'
- */
-#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = (uint8_t)0 }
-/**
- * 'normal'
- */
-#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = (uint8_t)1 }
-/**
- * 'start'
- */
-#define StyleAlignFlags_START (StyleAlignFlags){ .bits = (uint8_t)(1 << 1) }
-/**
- * 'end'
- */
-#define StyleAlignFlags_END (StyleAlignFlags){ .bits = (uint8_t)(1 << 2) }
-#define StyleAlignFlags_ALIAS (StyleAlignFlags){ .bits = (uint8_t)(StyleAlignFlags_END).bits }
-/**
- * 'flex-start'
- */
-#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = (uint8_t)(1 << 3) }
-#define StyleAlignFlags_MIXED (StyleAlignFlags){ .bits = (uint8_t)(((1 << 4) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
-#define StyleAlignFlags_MIXED_SELF (StyleAlignFlags){ .bits = (uint8_t)(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
-
-/**
- * An arbitrary identifier for a native (OS compositor) surface
- */
-struct StyleNativeSurfaceId {
- uint64_t _0;
-};
-/**
- * A special id for the native surface that is used for debug / profiler overlays.
- */
-#define StyleNativeSurfaceId_DEBUG_OVERLAY (StyleNativeSurfaceId){ ._0 = UINT64_MAX }
-
-struct StyleNativeTileId {
- struct StyleNativeSurfaceId surface_id;
- int32_t x;
- int32_t y;
-};
-/**
- * A special id for the native surface that is used for debug / profiler overlays.
- */
-#define StyleNativeTileId_DEBUG_OVERLAY (StyleNativeTileId){ .surface_id = StyleNativeSurfaceId_DEBUG_OVERLAY, .x = 0, .y = 0 }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct StyleAlignFlags flags, struct StyleNativeTileId tile);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/bitfield.both.compat.c b/cbindgen-0.24.5/tests/expectations/bitfield.both.compat.c
deleted file mode 100644
index b4ad797..0000000
--- a/cbindgen-0.24.5/tests/expectations/bitfield.both.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct HasBitfields {
- uint64_t foo: 8;
- uint64_t bar: 56;
-} HasBitfields;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const struct HasBitfields*);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/bitfield.compat.c b/cbindgen-0.24.5/tests/expectations/bitfield.compat.c
deleted file mode 100644
index aa906fa..0000000
--- a/cbindgen-0.24.5/tests/expectations/bitfield.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- uint64_t foo: 8;
- uint64_t bar: 56;
-} HasBitfields;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const HasBitfields*);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/bitfield.cpp b/cbindgen-0.24.5/tests/expectations/bitfield.cpp
deleted file mode 100644
index 3deb53f..0000000
--- a/cbindgen-0.24.5/tests/expectations/bitfield.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct HasBitfields {
- uint64_t foo: 8;
- uint64_t bar: 56;
-};
-
-extern "C" {
-
-void root(const HasBitfields*);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/bitfield.tag.compat.c b/cbindgen-0.24.5/tests/expectations/bitfield.tag.compat.c
deleted file mode 100644
index 6aa8aed..0000000
--- a/cbindgen-0.24.5/tests/expectations/bitfield.tag.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct HasBitfields {
- uint64_t foo: 8;
- uint64_t bar: 56;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const struct HasBitfields*);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/bitflags.both.c b/cbindgen-0.24.5/tests/expectations/bitflags.both.c
deleted file mode 100644
index b5cb6a7..0000000
--- a/cbindgen-0.24.5/tests/expectations/bitflags.both.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-/**
- * Constants shared by multiple CSS Box Alignment properties
- *
- * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
- */
-typedef struct AlignFlags {
- uint8_t bits;
-} AlignFlags;
-/**
- * 'auto'
- */
-#define AlignFlags_AUTO (AlignFlags){ .bits = (uint8_t)0 }
-/**
- * 'normal'
- */
-#define AlignFlags_NORMAL (AlignFlags){ .bits = (uint8_t)1 }
-/**
- * 'start'
- */
-#define AlignFlags_START (AlignFlags){ .bits = (uint8_t)(1 << 1) }
-/**
- * 'end'
- */
-#define AlignFlags_END (AlignFlags){ .bits = (uint8_t)(1 << 2) }
-#define AlignFlags_ALIAS (AlignFlags){ .bits = (uint8_t)(AlignFlags_END).bits }
-/**
- * 'flex-start'
- */
-#define AlignFlags_FLEX_START (AlignFlags){ .bits = (uint8_t)(1 << 3) }
-#define AlignFlags_MIXED (AlignFlags){ .bits = (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-#define AlignFlags_MIXED_SELF (AlignFlags){ .bits = (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-
-typedef struct DebugFlags {
- uint32_t bits;
-} DebugFlags;
-/**
- * Flag with the topmost bit set of the u32
- */
-#define DebugFlags_BIGGEST_ALLOWED (DebugFlags){ .bits = (uint32_t)(1 << 31) }
-
-typedef struct LargeFlags {
- uint64_t bits;
-} LargeFlags;
-/**
- * Flag with a very large shift that usually would be narrowed.
- */
-#define LargeFlags_LARGE_SHIFT (LargeFlags){ .bits = (uint64_t)(1ull << 44) }
-#define LargeFlags_INVERTED (LargeFlags){ .bits = (uint64_t)~(LargeFlags_LARGE_SHIFT).bits }
-
-void root(struct AlignFlags flags, struct DebugFlags bigger_flags, struct LargeFlags largest_flags);
diff --git a/cbindgen-0.24.5/tests/expectations/bitflags.both.compat.c b/cbindgen-0.24.5/tests/expectations/bitflags.both.compat.c
deleted file mode 100644
index 3572662..0000000
--- a/cbindgen-0.24.5/tests/expectations/bitflags.both.compat.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-/**
- * Constants shared by multiple CSS Box Alignment properties
- *
- * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
- */
-typedef struct AlignFlags {
- uint8_t bits;
-} AlignFlags;
-/**
- * 'auto'
- */
-#define AlignFlags_AUTO (AlignFlags){ .bits = (uint8_t)0 }
-/**
- * 'normal'
- */
-#define AlignFlags_NORMAL (AlignFlags){ .bits = (uint8_t)1 }
-/**
- * 'start'
- */
-#define AlignFlags_START (AlignFlags){ .bits = (uint8_t)(1 << 1) }
-/**
- * 'end'
- */
-#define AlignFlags_END (AlignFlags){ .bits = (uint8_t)(1 << 2) }
-#define AlignFlags_ALIAS (AlignFlags){ .bits = (uint8_t)(AlignFlags_END).bits }
-/**
- * 'flex-start'
- */
-#define AlignFlags_FLEX_START (AlignFlags){ .bits = (uint8_t)(1 << 3) }
-#define AlignFlags_MIXED (AlignFlags){ .bits = (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-#define AlignFlags_MIXED_SELF (AlignFlags){ .bits = (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-
-typedef struct DebugFlags {
- uint32_t bits;
-} DebugFlags;
-/**
- * Flag with the topmost bit set of the u32
- */
-#define DebugFlags_BIGGEST_ALLOWED (DebugFlags){ .bits = (uint32_t)(1 << 31) }
-
-typedef struct LargeFlags {
- uint64_t bits;
-} LargeFlags;
-/**
- * Flag with a very large shift that usually would be narrowed.
- */
-#define LargeFlags_LARGE_SHIFT (LargeFlags){ .bits = (uint64_t)(1ull << 44) }
-#define LargeFlags_INVERTED (LargeFlags){ .bits = (uint64_t)~(LargeFlags_LARGE_SHIFT).bits }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct AlignFlags flags, struct DebugFlags bigger_flags, struct LargeFlags largest_flags);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/bitflags.c b/cbindgen-0.24.5/tests/expectations/bitflags.c
deleted file mode 100644
index 9af76af..0000000
--- a/cbindgen-0.24.5/tests/expectations/bitflags.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-/**
- * Constants shared by multiple CSS Box Alignment properties
- *
- * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
- */
-typedef struct {
- uint8_t bits;
-} AlignFlags;
-/**
- * 'auto'
- */
-#define AlignFlags_AUTO (AlignFlags){ .bits = (uint8_t)0 }
-/**
- * 'normal'
- */
-#define AlignFlags_NORMAL (AlignFlags){ .bits = (uint8_t)1 }
-/**
- * 'start'
- */
-#define AlignFlags_START (AlignFlags){ .bits = (uint8_t)(1 << 1) }
-/**
- * 'end'
- */
-#define AlignFlags_END (AlignFlags){ .bits = (uint8_t)(1 << 2) }
-#define AlignFlags_ALIAS (AlignFlags){ .bits = (uint8_t)(AlignFlags_END).bits }
-/**
- * 'flex-start'
- */
-#define AlignFlags_FLEX_START (AlignFlags){ .bits = (uint8_t)(1 << 3) }
-#define AlignFlags_MIXED (AlignFlags){ .bits = (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-#define AlignFlags_MIXED_SELF (AlignFlags){ .bits = (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-
-typedef struct {
- uint32_t bits;
-} DebugFlags;
-/**
- * Flag with the topmost bit set of the u32
- */
-#define DebugFlags_BIGGEST_ALLOWED (DebugFlags){ .bits = (uint32_t)(1 << 31) }
-
-typedef struct {
- uint64_t bits;
-} LargeFlags;
-/**
- * Flag with a very large shift that usually would be narrowed.
- */
-#define LargeFlags_LARGE_SHIFT (LargeFlags){ .bits = (uint64_t)(1ull << 44) }
-#define LargeFlags_INVERTED (LargeFlags){ .bits = (uint64_t)~(LargeFlags_LARGE_SHIFT).bits }
-
-void root(AlignFlags flags, DebugFlags bigger_flags, LargeFlags largest_flags);
diff --git a/cbindgen-0.24.5/tests/expectations/bitflags.compat.c b/cbindgen-0.24.5/tests/expectations/bitflags.compat.c
deleted file mode 100644
index 863de08..0000000
--- a/cbindgen-0.24.5/tests/expectations/bitflags.compat.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-/**
- * Constants shared by multiple CSS Box Alignment properties
- *
- * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
- */
-typedef struct {
- uint8_t bits;
-} AlignFlags;
-/**
- * 'auto'
- */
-#define AlignFlags_AUTO (AlignFlags){ .bits = (uint8_t)0 }
-/**
- * 'normal'
- */
-#define AlignFlags_NORMAL (AlignFlags){ .bits = (uint8_t)1 }
-/**
- * 'start'
- */
-#define AlignFlags_START (AlignFlags){ .bits = (uint8_t)(1 << 1) }
-/**
- * 'end'
- */
-#define AlignFlags_END (AlignFlags){ .bits = (uint8_t)(1 << 2) }
-#define AlignFlags_ALIAS (AlignFlags){ .bits = (uint8_t)(AlignFlags_END).bits }
-/**
- * 'flex-start'
- */
-#define AlignFlags_FLEX_START (AlignFlags){ .bits = (uint8_t)(1 << 3) }
-#define AlignFlags_MIXED (AlignFlags){ .bits = (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-#define AlignFlags_MIXED_SELF (AlignFlags){ .bits = (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-
-typedef struct {
- uint32_t bits;
-} DebugFlags;
-/**
- * Flag with the topmost bit set of the u32
- */
-#define DebugFlags_BIGGEST_ALLOWED (DebugFlags){ .bits = (uint32_t)(1 << 31) }
-
-typedef struct {
- uint64_t bits;
-} LargeFlags;
-/**
- * Flag with a very large shift that usually would be narrowed.
- */
-#define LargeFlags_LARGE_SHIFT (LargeFlags){ .bits = (uint64_t)(1ull << 44) }
-#define LargeFlags_INVERTED (LargeFlags){ .bits = (uint64_t)~(LargeFlags_LARGE_SHIFT).bits }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(AlignFlags flags, DebugFlags bigger_flags, LargeFlags largest_flags);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/bitflags.cpp b/cbindgen-0.24.5/tests/expectations/bitflags.cpp
deleted file mode 100644
index 6ed4736..0000000
--- a/cbindgen-0.24.5/tests/expectations/bitflags.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-/// Constants shared by multiple CSS Box Alignment properties
-///
-/// These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
-struct AlignFlags {
- uint8_t bits;
-
- constexpr explicit operator bool() const {
- return !!bits;
- }
- constexpr AlignFlags operator~() const {
- return AlignFlags { static_cast<decltype(bits)>(~bits) };
- }
- constexpr AlignFlags operator|(const AlignFlags& other) const {
- return AlignFlags { static_cast<decltype(bits)>(this->bits | other.bits) };
- }
- AlignFlags& operator|=(const AlignFlags& other) {
- *this = (*this | other);
- return *this;
- }
- constexpr AlignFlags operator&(const AlignFlags& other) const {
- return AlignFlags { static_cast<decltype(bits)>(this->bits & other.bits) };
- }
- AlignFlags& operator&=(const AlignFlags& other) {
- *this = (*this & other);
- return *this;
- }
- constexpr AlignFlags operator^(const AlignFlags& other) const {
- return AlignFlags { static_cast<decltype(bits)>(this->bits ^ other.bits) };
- }
- AlignFlags& operator^=(const AlignFlags& other) {
- *this = (*this ^ other);
- return *this;
- }
-};
-/// 'auto'
-constexpr static const AlignFlags AlignFlags_AUTO = AlignFlags{ /* .bits = */ (uint8_t)0 };
-/// 'normal'
-constexpr static const AlignFlags AlignFlags_NORMAL = AlignFlags{ /* .bits = */ (uint8_t)1 };
-/// 'start'
-constexpr static const AlignFlags AlignFlags_START = AlignFlags{ /* .bits = */ (uint8_t)(1 << 1) };
-/// 'end'
-constexpr static const AlignFlags AlignFlags_END = AlignFlags{ /* .bits = */ (uint8_t)(1 << 2) };
-constexpr static const AlignFlags AlignFlags_ALIAS = AlignFlags{ /* .bits = */ (uint8_t)(AlignFlags_END).bits };
-/// 'flex-start'
-constexpr static const AlignFlags AlignFlags_FLEX_START = AlignFlags{ /* .bits = */ (uint8_t)(1 << 3) };
-constexpr static const AlignFlags AlignFlags_MIXED = AlignFlags{ /* .bits = */ (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) };
-constexpr static const AlignFlags AlignFlags_MIXED_SELF = AlignFlags{ /* .bits = */ (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) };
-
-struct DebugFlags {
- uint32_t bits;
-
- constexpr explicit operator bool() const {
- return !!bits;
- }
- constexpr DebugFlags operator~() const {
- return DebugFlags { static_cast<decltype(bits)>(~bits) };
- }
- constexpr DebugFlags operator|(const DebugFlags& other) const {
- return DebugFlags { static_cast<decltype(bits)>(this->bits | other.bits) };
- }
- DebugFlags& operator|=(const DebugFlags& other) {
- *this = (*this | other);
- return *this;
- }
- constexpr DebugFlags operator&(const DebugFlags& other) const {
- return DebugFlags { static_cast<decltype(bits)>(this->bits & other.bits) };
- }
- DebugFlags& operator&=(const DebugFlags& other) {
- *this = (*this & other);
- return *this;
- }
- constexpr DebugFlags operator^(const DebugFlags& other) const {
- return DebugFlags { static_cast<decltype(bits)>(this->bits ^ other.bits) };
- }
- DebugFlags& operator^=(const DebugFlags& other) {
- *this = (*this ^ other);
- return *this;
- }
-};
-/// Flag with the topmost bit set of the u32
-constexpr static const DebugFlags DebugFlags_BIGGEST_ALLOWED = DebugFlags{ /* .bits = */ (uint32_t)(1 << 31) };
-
-struct LargeFlags {
- uint64_t bits;
-
- constexpr explicit operator bool() const {
- return !!bits;
- }
- constexpr LargeFlags operator~() const {
- return LargeFlags { static_cast<decltype(bits)>(~bits) };
- }
- constexpr LargeFlags operator|(const LargeFlags& other) const {
- return LargeFlags { static_cast<decltype(bits)>(this->bits | other.bits) };
- }
- LargeFlags& operator|=(const LargeFlags& other) {
- *this = (*this | other);
- return *this;
- }
- constexpr LargeFlags operator&(const LargeFlags& other) const {
- return LargeFlags { static_cast<decltype(bits)>(this->bits & other.bits) };
- }
- LargeFlags& operator&=(const LargeFlags& other) {
- *this = (*this & other);
- return *this;
- }
- constexpr LargeFlags operator^(const LargeFlags& other) const {
- return LargeFlags { static_cast<decltype(bits)>(this->bits ^ other.bits) };
- }
- LargeFlags& operator^=(const LargeFlags& other) {
- *this = (*this ^ other);
- return *this;
- }
-};
-/// Flag with a very large shift that usually would be narrowed.
-constexpr static const LargeFlags LargeFlags_LARGE_SHIFT = LargeFlags{ /* .bits = */ (uint64_t)(1ull << 44) };
-constexpr static const LargeFlags LargeFlags_INVERTED = LargeFlags{ /* .bits = */ (uint64_t)~(LargeFlags_LARGE_SHIFT).bits };
-
-extern "C" {
-
-void root(AlignFlags flags, DebugFlags bigger_flags, LargeFlags largest_flags);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/bitflags.pyx b/cbindgen-0.24.5/tests/expectations/bitflags.pyx
deleted file mode 100644
index e3d1040..0000000
--- a/cbindgen-0.24.5/tests/expectations/bitflags.pyx
+++ /dev/null
@@ -1,39 +0,0 @@
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- # Constants shared by multiple CSS Box Alignment properties
- #
- # These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
- ctypedef struct AlignFlags:
- uint8_t bits;
- # 'auto'
- const AlignFlags AlignFlags_AUTO # = <AlignFlags>{ <uint8_t>0 }
- # 'normal'
- const AlignFlags AlignFlags_NORMAL # = <AlignFlags>{ <uint8_t>1 }
- # 'start'
- const AlignFlags AlignFlags_START # = <AlignFlags>{ <uint8_t>(1 << 1) }
- # 'end'
- const AlignFlags AlignFlags_END # = <AlignFlags>{ <uint8_t>(1 << 2) }
- const AlignFlags AlignFlags_ALIAS # = <AlignFlags>{ <uint8_t>(AlignFlags_END).bits }
- # 'flex-start'
- const AlignFlags AlignFlags_FLEX_START # = <AlignFlags>{ <uint8_t>(1 << 3) }
- const AlignFlags AlignFlags_MIXED # = <AlignFlags>{ <uint8_t>(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
- const AlignFlags AlignFlags_MIXED_SELF # = <AlignFlags>{ <uint8_t>(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-
- ctypedef struct DebugFlags:
- uint32_t bits;
- # Flag with the topmost bit set of the u32
- const DebugFlags DebugFlags_BIGGEST_ALLOWED # = <DebugFlags>{ <uint32_t>(1 << 31) }
-
- ctypedef struct LargeFlags:
- uint64_t bits;
- # Flag with a very large shift that usually would be narrowed.
- const LargeFlags LargeFlags_LARGE_SHIFT # = <LargeFlags>{ <uint64_t>(1ull << 44) }
- const LargeFlags LargeFlags_INVERTED # = <LargeFlags>{ <uint64_t>~(LargeFlags_LARGE_SHIFT).bits }
-
- void root(AlignFlags flags, DebugFlags bigger_flags, LargeFlags largest_flags);
diff --git a/cbindgen-0.24.5/tests/expectations/bitflags.tag.c b/cbindgen-0.24.5/tests/expectations/bitflags.tag.c
deleted file mode 100644
index c4be368..0000000
--- a/cbindgen-0.24.5/tests/expectations/bitflags.tag.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-/**
- * Constants shared by multiple CSS Box Alignment properties
- *
- * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
- */
-struct AlignFlags {
- uint8_t bits;
-};
-/**
- * 'auto'
- */
-#define AlignFlags_AUTO (AlignFlags){ .bits = (uint8_t)0 }
-/**
- * 'normal'
- */
-#define AlignFlags_NORMAL (AlignFlags){ .bits = (uint8_t)1 }
-/**
- * 'start'
- */
-#define AlignFlags_START (AlignFlags){ .bits = (uint8_t)(1 << 1) }
-/**
- * 'end'
- */
-#define AlignFlags_END (AlignFlags){ .bits = (uint8_t)(1 << 2) }
-#define AlignFlags_ALIAS (AlignFlags){ .bits = (uint8_t)(AlignFlags_END).bits }
-/**
- * 'flex-start'
- */
-#define AlignFlags_FLEX_START (AlignFlags){ .bits = (uint8_t)(1 << 3) }
-#define AlignFlags_MIXED (AlignFlags){ .bits = (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-#define AlignFlags_MIXED_SELF (AlignFlags){ .bits = (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-
-struct DebugFlags {
- uint32_t bits;
-};
-/**
- * Flag with the topmost bit set of the u32
- */
-#define DebugFlags_BIGGEST_ALLOWED (DebugFlags){ .bits = (uint32_t)(1 << 31) }
-
-struct LargeFlags {
- uint64_t bits;
-};
-/**
- * Flag with a very large shift that usually would be narrowed.
- */
-#define LargeFlags_LARGE_SHIFT (LargeFlags){ .bits = (uint64_t)(1ull << 44) }
-#define LargeFlags_INVERTED (LargeFlags){ .bits = (uint64_t)~(LargeFlags_LARGE_SHIFT).bits }
-
-void root(struct AlignFlags flags, struct DebugFlags bigger_flags, struct LargeFlags largest_flags);
diff --git a/cbindgen-0.24.5/tests/expectations/bitflags.tag.compat.c b/cbindgen-0.24.5/tests/expectations/bitflags.tag.compat.c
deleted file mode 100644
index d12ba40..0000000
--- a/cbindgen-0.24.5/tests/expectations/bitflags.tag.compat.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-/**
- * Constants shared by multiple CSS Box Alignment properties
- *
- * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
- */
-struct AlignFlags {
- uint8_t bits;
-};
-/**
- * 'auto'
- */
-#define AlignFlags_AUTO (AlignFlags){ .bits = (uint8_t)0 }
-/**
- * 'normal'
- */
-#define AlignFlags_NORMAL (AlignFlags){ .bits = (uint8_t)1 }
-/**
- * 'start'
- */
-#define AlignFlags_START (AlignFlags){ .bits = (uint8_t)(1 << 1) }
-/**
- * 'end'
- */
-#define AlignFlags_END (AlignFlags){ .bits = (uint8_t)(1 << 2) }
-#define AlignFlags_ALIAS (AlignFlags){ .bits = (uint8_t)(AlignFlags_END).bits }
-/**
- * 'flex-start'
- */
-#define AlignFlags_FLEX_START (AlignFlags){ .bits = (uint8_t)(1 << 3) }
-#define AlignFlags_MIXED (AlignFlags){ .bits = (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-#define AlignFlags_MIXED_SELF (AlignFlags){ .bits = (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-
-struct DebugFlags {
- uint32_t bits;
-};
-/**
- * Flag with the topmost bit set of the u32
- */
-#define DebugFlags_BIGGEST_ALLOWED (DebugFlags){ .bits = (uint32_t)(1 << 31) }
-
-struct LargeFlags {
- uint64_t bits;
-};
-/**
- * Flag with a very large shift that usually would be narrowed.
- */
-#define LargeFlags_LARGE_SHIFT (LargeFlags){ .bits = (uint64_t)(1ull << 44) }
-#define LargeFlags_INVERTED (LargeFlags){ .bits = (uint64_t)~(LargeFlags_LARGE_SHIFT).bits }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct AlignFlags flags, struct DebugFlags bigger_flags, struct LargeFlags largest_flags);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/bitflags.tag.pyx b/cbindgen-0.24.5/tests/expectations/bitflags.tag.pyx
deleted file mode 100644
index d5f2df6..0000000
--- a/cbindgen-0.24.5/tests/expectations/bitflags.tag.pyx
+++ /dev/null
@@ -1,39 +0,0 @@
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- # Constants shared by multiple CSS Box Alignment properties
- #
- # These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
- cdef struct AlignFlags:
- uint8_t bits;
- # 'auto'
- const AlignFlags AlignFlags_AUTO # = <AlignFlags>{ <uint8_t>0 }
- # 'normal'
- const AlignFlags AlignFlags_NORMAL # = <AlignFlags>{ <uint8_t>1 }
- # 'start'
- const AlignFlags AlignFlags_START # = <AlignFlags>{ <uint8_t>(1 << 1) }
- # 'end'
- const AlignFlags AlignFlags_END # = <AlignFlags>{ <uint8_t>(1 << 2) }
- const AlignFlags AlignFlags_ALIAS # = <AlignFlags>{ <uint8_t>(AlignFlags_END).bits }
- # 'flex-start'
- const AlignFlags AlignFlags_FLEX_START # = <AlignFlags>{ <uint8_t>(1 << 3) }
- const AlignFlags AlignFlags_MIXED # = <AlignFlags>{ <uint8_t>(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
- const AlignFlags AlignFlags_MIXED_SELF # = <AlignFlags>{ <uint8_t>(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
-
- cdef struct DebugFlags:
- uint32_t bits;
- # Flag with the topmost bit set of the u32
- const DebugFlags DebugFlags_BIGGEST_ALLOWED # = <DebugFlags>{ <uint32_t>(1 << 31) }
-
- cdef struct LargeFlags:
- uint64_t bits;
- # Flag with a very large shift that usually would be narrowed.
- const LargeFlags LargeFlags_LARGE_SHIFT # = <LargeFlags>{ <uint64_t>(1ull << 44) }
- const LargeFlags LargeFlags_INVERTED # = <LargeFlags>{ <uint64_t>~(LargeFlags_LARGE_SHIFT).bits }
-
- void root(AlignFlags flags, DebugFlags bigger_flags, LargeFlags largest_flags);
diff --git a/cbindgen-0.24.5/tests/expectations/body.both.compat.c b/cbindgen-0.24.5/tests/expectations/body.both.compat.c
deleted file mode 100644
index f5381ff..0000000
--- a/cbindgen-0.24.5/tests/expectations/body.both.compat.c
+++ /dev/null
@@ -1,101 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef enum MyCLikeEnum {
- Foo1,
- Bar1,
- Baz1,
-} MyCLikeEnum;
-
-typedef enum MyCLikeEnum_Prepended {
- Foo1_Prepended,
- Bar1_Prepended,
- Baz1_Prepended,
-} MyCLikeEnum_Prepended;
-
-typedef struct MyFancyStruct {
- int32_t i;
-#ifdef __cplusplus
- inline void foo();
-#endif
-} MyFancyStruct;
-
-typedef enum MyFancyEnum_Tag {
- Foo,
- Bar,
- Baz,
-} MyFancyEnum_Tag;
-
-typedef struct MyFancyEnum {
- MyFancyEnum_Tag tag;
- union {
- struct {
- int32_t bar;
- };
- struct {
- int32_t baz;
- };
- };
-#ifdef __cplusplus
- inline void wohoo();
-#endif
-} MyFancyEnum;
-
-typedef union MyUnion {
- float f;
- uint32_t u;
- int32_t extra_member;
-} MyUnion;
-
-typedef struct MyFancyStruct_Prepended {
-#ifdef __cplusplus
- inline void prepended_wohoo();
-#endif
- int32_t i;
-} MyFancyStruct_Prepended;
-
-typedef enum MyFancyEnum_Prepended_Tag {
- Foo_Prepended,
- Bar_Prepended,
- Baz_Prepended,
-} MyFancyEnum_Prepended_Tag;
-
-typedef struct MyFancyEnum_Prepended {
-#ifdef __cplusplus
- inline void wohoo();
-#endif
- MyFancyEnum_Prepended_Tag tag;
- union {
- struct {
- int32_t bar_prepended;
- };
- struct {
- int32_t baz_prepended;
- };
- };
-} MyFancyEnum_Prepended;
-
-typedef union MyUnion_Prepended {
- int32_t extra_member;
- float f;
- uint32_t u;
-} MyUnion_Prepended;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct MyFancyStruct s,
- struct MyFancyEnum e,
- enum MyCLikeEnum c,
- union MyUnion u,
- struct MyFancyStruct_Prepended sp,
- struct MyFancyEnum_Prepended ep,
- enum MyCLikeEnum_Prepended cp,
- union MyUnion_Prepended up);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/body.compat.c b/cbindgen-0.24.5/tests/expectations/body.compat.c
deleted file mode 100644
index c92d27a..0000000
--- a/cbindgen-0.24.5/tests/expectations/body.compat.c
+++ /dev/null
@@ -1,101 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef enum {
- Foo1,
- Bar1,
- Baz1,
-} MyCLikeEnum;
-
-typedef enum {
- Foo1_Prepended,
- Bar1_Prepended,
- Baz1_Prepended,
-} MyCLikeEnum_Prepended;
-
-typedef struct {
- int32_t i;
-#ifdef __cplusplus
- inline void foo();
-#endif
-} MyFancyStruct;
-
-typedef enum {
- Foo,
- Bar,
- Baz,
-} MyFancyEnum_Tag;
-
-typedef struct {
- MyFancyEnum_Tag tag;
- union {
- struct {
- int32_t bar;
- };
- struct {
- int32_t baz;
- };
- };
-#ifdef __cplusplus
- inline void wohoo();
-#endif
-} MyFancyEnum;
-
-typedef union {
- float f;
- uint32_t u;
- int32_t extra_member;
-} MyUnion;
-
-typedef struct {
-#ifdef __cplusplus
- inline void prepended_wohoo();
-#endif
- int32_t i;
-} MyFancyStruct_Prepended;
-
-typedef enum {
- Foo_Prepended,
- Bar_Prepended,
- Baz_Prepended,
-} MyFancyEnum_Prepended_Tag;
-
-typedef struct {
-#ifdef __cplusplus
- inline void wohoo();
-#endif
- MyFancyEnum_Prepended_Tag tag;
- union {
- struct {
- int32_t bar_prepended;
- };
- struct {
- int32_t baz_prepended;
- };
- };
-} MyFancyEnum_Prepended;
-
-typedef union {
- int32_t extra_member;
- float f;
- uint32_t u;
-} MyUnion_Prepended;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(MyFancyStruct s,
- MyFancyEnum e,
- MyCLikeEnum c,
- MyUnion u,
- MyFancyStruct_Prepended sp,
- MyFancyEnum_Prepended ep,
- MyCLikeEnum_Prepended cp,
- MyUnion_Prepended up);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/body.cpp b/cbindgen-0.24.5/tests/expectations/body.cpp
deleted file mode 100644
index c982576..0000000
--- a/cbindgen-0.24.5/tests/expectations/body.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-enum class MyCLikeEnum {
- Foo1,
- Bar1,
- Baz1,
-};
-
-enum class MyCLikeEnum_Prepended {
- Foo1_Prepended,
- Bar1_Prepended,
- Baz1_Prepended,
-};
-
-struct MyFancyStruct {
- int32_t i;
-#ifdef __cplusplus
- inline void foo();
-#endif
-};
-
-struct MyFancyEnum {
- enum class Tag {
- Foo,
- Bar,
- Baz,
- };
-
- struct Bar_Body {
- int32_t _0;
- };
-
- struct Baz_Body {
- int32_t _0;
- };
-
- Tag tag;
- union {
- Bar_Body bar;
- Baz_Body baz;
- };
-#ifdef __cplusplus
- inline void wohoo();
-#endif
-};
-
-union MyUnion {
- float f;
- uint32_t u;
- int32_t extra_member;
-};
-
-struct MyFancyStruct_Prepended {
-#ifdef __cplusplus
- inline void prepended_wohoo();
-#endif
- int32_t i;
-};
-
-struct MyFancyEnum_Prepended {
-#ifdef __cplusplus
- inline void wohoo();
-#endif
- enum class Tag {
- Foo_Prepended,
- Bar_Prepended,
- Baz_Prepended,
- };
-
- struct Bar_Prepended_Body {
- int32_t _0;
- };
-
- struct Baz_Prepended_Body {
- int32_t _0;
- };
-
- Tag tag;
- union {
- Bar_Prepended_Body bar_prepended;
- Baz_Prepended_Body baz_prepended;
- };
-};
-
-union MyUnion_Prepended {
- int32_t extra_member;
- float f;
- uint32_t u;
-};
-
-extern "C" {
-
-void root(MyFancyStruct s,
- MyFancyEnum e,
- MyCLikeEnum c,
- MyUnion u,
- MyFancyStruct_Prepended sp,
- MyFancyEnum_Prepended ep,
- MyCLikeEnum_Prepended cp,
- MyUnion_Prepended up);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/body.tag.compat.c b/cbindgen-0.24.5/tests/expectations/body.tag.compat.c
deleted file mode 100644
index 77c8277..0000000
--- a/cbindgen-0.24.5/tests/expectations/body.tag.compat.c
+++ /dev/null
@@ -1,101 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum MyCLikeEnum {
- Foo1,
- Bar1,
- Baz1,
-};
-
-enum MyCLikeEnum_Prepended {
- Foo1_Prepended,
- Bar1_Prepended,
- Baz1_Prepended,
-};
-
-struct MyFancyStruct {
- int32_t i;
-#ifdef __cplusplus
- inline void foo();
-#endif
-};
-
-enum MyFancyEnum_Tag {
- Foo,
- Bar,
- Baz,
-};
-
-struct MyFancyEnum {
- enum MyFancyEnum_Tag tag;
- union {
- struct {
- int32_t bar;
- };
- struct {
- int32_t baz;
- };
- };
-#ifdef __cplusplus
- inline void wohoo();
-#endif
-};
-
-union MyUnion {
- float f;
- uint32_t u;
- int32_t extra_member;
-};
-
-struct MyFancyStruct_Prepended {
-#ifdef __cplusplus
- inline void prepended_wohoo();
-#endif
- int32_t i;
-};
-
-enum MyFancyEnum_Prepended_Tag {
- Foo_Prepended,
- Bar_Prepended,
- Baz_Prepended,
-};
-
-struct MyFancyEnum_Prepended {
-#ifdef __cplusplus
- inline void wohoo();
-#endif
- enum MyFancyEnum_Prepended_Tag tag;
- union {
- struct {
- int32_t bar_prepended;
- };
- struct {
- int32_t baz_prepended;
- };
- };
-};
-
-union MyUnion_Prepended {
- int32_t extra_member;
- float f;
- uint32_t u;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct MyFancyStruct s,
- struct MyFancyEnum e,
- enum MyCLikeEnum c,
- union MyUnion u,
- struct MyFancyStruct_Prepended sp,
- struct MyFancyEnum_Prepended ep,
- enum MyCLikeEnum_Prepended cp,
- union MyUnion_Prepended up);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/box.both.compat.c b/cbindgen-0.24.5/tests/expectations/box.both.compat.c
deleted file mode 100644
index 3177970..0000000
--- a/cbindgen-0.24.5/tests/expectations/box.both.compat.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using Box = T*;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct NotReprC_____i32 NotReprC_____i32;
-
-typedef struct NotReprC_____i32 Foo;
-
-typedef struct MyStruct {
- int32_t *number;
-} MyStruct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const struct MyStruct *with_box);
-
-void drop_box(int32_t *x);
-
-void drop_box_opt(int32_t *x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/box.compat.c b/cbindgen-0.24.5/tests/expectations/box.compat.c
deleted file mode 100644
index cc05edf..0000000
--- a/cbindgen-0.24.5/tests/expectations/box.compat.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using Box = T*;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct NotReprC_____i32 NotReprC_____i32;
-
-typedef NotReprC_____i32 Foo;
-
-typedef struct {
- int32_t *number;
-} MyStruct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const MyStruct *with_box);
-
-void drop_box(int32_t *x);
-
-void drop_box_opt(int32_t *x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/box.cpp b/cbindgen-0.24.5/tests/expectations/box.cpp
deleted file mode 100644
index 423c987..0000000
--- a/cbindgen-0.24.5/tests/expectations/box.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using Box = T*;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T = void>
-struct NotReprC;
-
-template<typename T = void>
-struct Option;
-
-using Foo = NotReprC<Box<int32_t>>;
-
-struct MyStruct {
- Box<int32_t> number;
-};
-
-extern "C" {
-
-void root(const Foo *a, const MyStruct *with_box);
-
-void drop_box(Box<int32_t> x);
-
-void drop_box_opt(Option<Box<int32_t>> x);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/box.tag.compat.c b/cbindgen-0.24.5/tests/expectations/box.tag.compat.c
deleted file mode 100644
index a61e3a2..0000000
--- a/cbindgen-0.24.5/tests/expectations/box.tag.compat.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using Box = T*;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct NotReprC_____i32;
-
-typedef struct NotReprC_____i32 Foo;
-
-struct MyStruct {
- int32_t *number;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const struct MyStruct *with_box);
-
-void drop_box(int32_t *x);
-
-void drop_box_opt(int32_t *x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cdecl.compat.c b/cbindgen-0.24.5/tests/expectations/cdecl.compat.c
deleted file mode 100644
index 1d1d11e..0000000
--- a/cbindgen-0.24.5/tests/expectations/cdecl.compat.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef void (*A)(void);
-
-typedef void (*B)(void);
-
-typedef bool (*C)(int32_t, int32_t);
-
-typedef bool (*(*D)(int32_t))(float);
-
-typedef const int32_t (*(*E)(void))[16];
-
-typedef const int32_t *F;
-
-typedef const int32_t *const *G;
-
-typedef int32_t *const *H;
-
-typedef const int32_t (*I)[16];
-
-typedef double (**J)(float);
-
-typedef int32_t K[16];
-
-typedef const int32_t *L[16];
-
-typedef bool (*M[16])(int32_t, int32_t);
-
-typedef void (*N[16])(int32_t, int32_t);
-
-typedef void (*P)(int32_t named1st, bool, bool named3rd, int32_t _);
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void (*O(void))(void);
-
-void root(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, P p);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cdecl.cpp b/cbindgen-0.24.5/tests/expectations/cdecl.cpp
deleted file mode 100644
index 4545fe3..0000000
--- a/cbindgen-0.24.5/tests/expectations/cdecl.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-using A = void(*)();
-
-using B = void(*)();
-
-using C = bool(*)(int32_t, int32_t);
-
-using D = bool(*(*)(int32_t))(float);
-
-using E = const int32_t(*(*)())[16];
-
-using F = const int32_t*;
-
-using G = const int32_t*const *;
-
-using H = int32_t*const *;
-
-using I = const int32_t(*)[16];
-
-using J = double(**)(float);
-
-using K = int32_t[16];
-
-using L = const int32_t*[16];
-
-using M = bool(*[16])(int32_t, int32_t);
-
-using N = void(*[16])(int32_t, int32_t);
-
-using P = void(*)(int32_t named1st, bool, bool named3rd, int32_t _);
-
-extern "C" {
-
-void (*O())();
-
-void root(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, P p);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/cell.both.compat.c b/cbindgen-0.24.5/tests/expectations/cell.both.compat.c
deleted file mode 100644
index 2516695..0000000
--- a/cbindgen-0.24.5/tests/expectations/cell.both.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
-
-typedef struct NotReprC_RefCell_i32 Foo;
-
-typedef struct MyStruct {
- int32_t number;
-} MyStruct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const struct MyStruct *with_cell);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cell.compat.c b/cbindgen-0.24.5/tests/expectations/cell.compat.c
deleted file mode 100644
index f2fbb8b..0000000
--- a/cbindgen-0.24.5/tests/expectations/cell.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
-
-typedef NotReprC_RefCell_i32 Foo;
-
-typedef struct {
- int32_t number;
-} MyStruct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const MyStruct *with_cell);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cell.cpp b/cbindgen-0.24.5/tests/expectations/cell.cpp
deleted file mode 100644
index e2462fb..0000000
--- a/cbindgen-0.24.5/tests/expectations/cell.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T = void>
-struct NotReprC;
-
-template<typename T = void>
-struct RefCell;
-
-using Foo = NotReprC<RefCell<int32_t>>;
-
-struct MyStruct {
- int32_t number;
-};
-
-extern "C" {
-
-void root(const Foo *a, const MyStruct *with_cell);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/cell.tag.compat.c b/cbindgen-0.24.5/tests/expectations/cell.tag.compat.c
deleted file mode 100644
index 9e73b0d..0000000
--- a/cbindgen-0.24.5/tests/expectations/cell.tag.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct NotReprC_RefCell_i32;
-
-typedef struct NotReprC_RefCell_i32 Foo;
-
-struct MyStruct {
- int32_t number;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const struct MyStruct *with_cell);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cfg.both.c b/cbindgen-0.24.5/tests/expectations/cfg.both.c
deleted file mode 100644
index 120a1ad..0000000
--- a/cbindgen-0.24.5/tests/expectations/cfg.both.c
+++ /dev/null
@@ -1,89 +0,0 @@
-#if 0
-DEF PLATFORM_UNIX = 0
-DEF PLATFORM_WIN = 0
-DEF X11 = 0
-DEF M_32 = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-enum BarType {
- A,
- B,
- C,
-};
-typedef uint32_t BarType;
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-enum FooType {
- A,
- B,
- C,
-};
-typedef uint32_t FooType;
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-typedef struct FooHandle {
- FooType ty;
- int32_t x;
- float y;
-} FooHandle;
-#endif
-
-enum C_Tag {
- C1,
- C2,
-#if defined(PLATFORM_WIN)
- C3,
-#endif
-#if defined(PLATFORM_UNIX)
- C5,
-#endif
-};
-typedef uint8_t C_Tag;
-
-#if defined(PLATFORM_UNIX)
-typedef struct C5_Body {
- C_Tag tag;
- int32_t int_;
-} C5_Body;
-#endif
-
-typedef union C {
- C_Tag tag;
-#if defined(PLATFORM_UNIX)
- C5_Body c5;
-#endif
-} C;
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-typedef struct BarHandle {
- BarType ty;
- int32_t x;
- float y;
-} BarHandle;
-#endif
-
-typedef struct ConditionalField {
-#if defined(X11)
- int32_t field
-#endif
- ;
-} ConditionalField;
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-void root(struct FooHandle a, union C c);
-#endif
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-void root(struct BarHandle a, union C c);
-#endif
-
-void cond(struct ConditionalField a);
diff --git a/cbindgen-0.24.5/tests/expectations/cfg.both.compat.c b/cbindgen-0.24.5/tests/expectations/cfg.both.compat.c
deleted file mode 100644
index 998e5bd..0000000
--- a/cbindgen-0.24.5/tests/expectations/cfg.both.compat.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#if 0
-DEF PLATFORM_UNIX = 0
-DEF PLATFORM_WIN = 0
-DEF X11 = 0
-DEF M_32 = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-enum BarType
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- A,
- B,
- C,
-};
-#ifndef __cplusplus
-typedef uint32_t BarType;
-#endif // __cplusplus
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-enum FooType
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- A,
- B,
- C,
-};
-#ifndef __cplusplus
-typedef uint32_t FooType;
-#endif // __cplusplus
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-typedef struct FooHandle {
- FooType ty;
- int32_t x;
- float y;
-} FooHandle;
-#endif
-
-enum C_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- C1,
- C2,
-#if defined(PLATFORM_WIN)
- C3,
-#endif
-#if defined(PLATFORM_UNIX)
- C5,
-#endif
-};
-#ifndef __cplusplus
-typedef uint8_t C_Tag;
-#endif // __cplusplus
-
-#if defined(PLATFORM_UNIX)
-typedef struct C5_Body {
- C_Tag tag;
- int32_t int_;
-} C5_Body;
-#endif
-
-typedef union C {
- C_Tag tag;
-#if defined(PLATFORM_UNIX)
- C5_Body c5;
-#endif
-} C;
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-typedef struct BarHandle {
- BarType ty;
- int32_t x;
- float y;
-} BarHandle;
-#endif
-
-typedef struct ConditionalField {
-#if defined(X11)
- int32_t field
-#endif
- ;
-} ConditionalField;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-void root(struct FooHandle a, union C c);
-#endif
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-void root(struct BarHandle a, union C c);
-#endif
-
-void cond(struct ConditionalField a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cfg.c b/cbindgen-0.24.5/tests/expectations/cfg.c
deleted file mode 100644
index 0194bb1..0000000
--- a/cbindgen-0.24.5/tests/expectations/cfg.c
+++ /dev/null
@@ -1,89 +0,0 @@
-#if 0
-DEF PLATFORM_UNIX = 0
-DEF PLATFORM_WIN = 0
-DEF X11 = 0
-DEF M_32 = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-enum BarType {
- A,
- B,
- C,
-};
-typedef uint32_t BarType;
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-enum FooType {
- A,
- B,
- C,
-};
-typedef uint32_t FooType;
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-typedef struct {
- FooType ty;
- int32_t x;
- float y;
-} FooHandle;
-#endif
-
-enum C_Tag {
- C1,
- C2,
-#if defined(PLATFORM_WIN)
- C3,
-#endif
-#if defined(PLATFORM_UNIX)
- C5,
-#endif
-};
-typedef uint8_t C_Tag;
-
-#if defined(PLATFORM_UNIX)
-typedef struct {
- C_Tag tag;
- int32_t int_;
-} C5_Body;
-#endif
-
-typedef union {
- C_Tag tag;
-#if defined(PLATFORM_UNIX)
- C5_Body c5;
-#endif
-} C;
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-typedef struct {
- BarType ty;
- int32_t x;
- float y;
-} BarHandle;
-#endif
-
-typedef struct {
-#if defined(X11)
- int32_t field
-#endif
- ;
-} ConditionalField;
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-void root(FooHandle a, C c);
-#endif
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-void root(BarHandle a, C c);
-#endif
-
-void cond(ConditionalField a);
diff --git a/cbindgen-0.24.5/tests/expectations/cfg.compat.c b/cbindgen-0.24.5/tests/expectations/cfg.compat.c
deleted file mode 100644
index 2092e0a..0000000
--- a/cbindgen-0.24.5/tests/expectations/cfg.compat.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#if 0
-DEF PLATFORM_UNIX = 0
-DEF PLATFORM_WIN = 0
-DEF X11 = 0
-DEF M_32 = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-enum BarType
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- A,
- B,
- C,
-};
-#ifndef __cplusplus
-typedef uint32_t BarType;
-#endif // __cplusplus
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-enum FooType
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- A,
- B,
- C,
-};
-#ifndef __cplusplus
-typedef uint32_t FooType;
-#endif // __cplusplus
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-typedef struct {
- FooType ty;
- int32_t x;
- float y;
-} FooHandle;
-#endif
-
-enum C_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- C1,
- C2,
-#if defined(PLATFORM_WIN)
- C3,
-#endif
-#if defined(PLATFORM_UNIX)
- C5,
-#endif
-};
-#ifndef __cplusplus
-typedef uint8_t C_Tag;
-#endif // __cplusplus
-
-#if defined(PLATFORM_UNIX)
-typedef struct {
- C_Tag tag;
- int32_t int_;
-} C5_Body;
-#endif
-
-typedef union {
- C_Tag tag;
-#if defined(PLATFORM_UNIX)
- C5_Body c5;
-#endif
-} C;
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-typedef struct {
- BarType ty;
- int32_t x;
- float y;
-} BarHandle;
-#endif
-
-typedef struct {
-#if defined(X11)
- int32_t field
-#endif
- ;
-} ConditionalField;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-void root(FooHandle a, C c);
-#endif
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-void root(BarHandle a, C c);
-#endif
-
-void cond(ConditionalField a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cfg.cpp b/cbindgen-0.24.5/tests/expectations/cfg.cpp
deleted file mode 100644
index 24937cf..0000000
--- a/cbindgen-0.24.5/tests/expectations/cfg.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-#if 0
-DEF PLATFORM_UNIX = 0
-DEF PLATFORM_WIN = 0
-DEF X11 = 0
-DEF M_32 = 0
-#endif
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-enum class BarType : uint32_t {
- A,
- B,
- C,
-};
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-enum class FooType : uint32_t {
- A,
- B,
- C,
-};
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-struct FooHandle {
- FooType ty;
- int32_t x;
- float y;
-
- bool operator==(const FooHandle& other) const {
- return ty == other.ty &&
- x == other.x &&
- y == other.y;
- }
- bool operator!=(const FooHandle& other) const {
- return ty != other.ty ||
- x != other.x ||
- y != other.y;
- }
-};
-#endif
-
-union C {
- enum class Tag : uint8_t {
- C1,
- C2,
-#if defined(PLATFORM_WIN)
- C3,
-#endif
-#if defined(PLATFORM_UNIX)
- C5,
-#endif
- };
-
-#if defined(PLATFORM_UNIX)
- struct C5_Body {
- Tag tag;
- int32_t int_;
-
- bool operator==(const C5_Body& other) const {
- return int_ == other.int_;
- }
- bool operator!=(const C5_Body& other) const {
- return int_ != other.int_;
- }
- };
-#endif
-
- struct {
- Tag tag;
- };
-#if defined(PLATFORM_UNIX)
- C5_Body c5;
-#endif
-
- static C C1() {
- C result;
- result.tag = Tag::C1;
- return result;
- }
-
- bool IsC1() const {
- return tag == Tag::C1;
- }
-
- static C C2() {
- C result;
- result.tag = Tag::C2;
- return result;
- }
-
- bool IsC2() const {
- return tag == Tag::C2;
- }
-
-#if defined(PLATFORM_WIN)
- static C C3() {
- C result;
- result.tag = Tag::C3;
- return result;
- }
-
- bool IsC3() const {
- return tag == Tag::C3;
- }
-#endif
-
-#if defined(PLATFORM_UNIX)
- static C C5(const int32_t &int_) {
- C result;
- ::new (&result.c5.int_) (int32_t)(int_);
- result.tag = Tag::C5;
- return result;
- }
-
- bool IsC5() const {
- return tag == Tag::C5;
- }
-#endif
-
- bool operator==(const C& other) const {
- if (tag != other.tag) {
- return false;
- }
- switch (tag) {
-#if defined(PLATFORM_UNIX)
- case Tag::C5: return c5 == other.c5;
-#endif
- default: break;
- }
- return true;
- }
-
- bool operator!=(const C& other) const {
- return !(*this == other);
- }
-
- private:
- C() {
-
- }
- public:
-
-
- ~C() {
- switch (tag) {
-#if defined(PLATFORM_UNIX)
- case Tag::C5: c5.~C5_Body(); break;
-#endif
- default: break;
- }
- }
-
- C(const C& other)
- : tag(other.tag) {
- switch (tag) {
-#if defined(PLATFORM_UNIX)
- case Tag::C5: ::new (&c5) (C5_Body)(other.c5); break;
-#endif
- default: break;
- }
- }
- C& operator=(const C& other) {
- if (this != &other) {
- this->~C();
- new (this) C(other);
- }
- return *this;
- }
-};
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-struct BarHandle {
- BarType ty;
- int32_t x;
- float y;
-
- bool operator==(const BarHandle& other) const {
- return ty == other.ty &&
- x == other.x &&
- y == other.y;
- }
- bool operator!=(const BarHandle& other) const {
- return ty != other.ty ||
- x != other.x ||
- y != other.y;
- }
-};
-#endif
-
-struct ConditionalField {
-#if defined(X11)
- int32_t field
-#endif
- ;
-};
-
-extern "C" {
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-void root(FooHandle a, C c);
-#endif
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-void root(BarHandle a, C c);
-#endif
-
-void cond(ConditionalField a);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/cfg.pyx b/cbindgen-0.24.5/tests/expectations/cfg.pyx
deleted file mode 100644
index c4da233..0000000
--- a/cbindgen-0.24.5/tests/expectations/cfg.pyx
+++ /dev/null
@@ -1,67 +0,0 @@
-#if 0
-DEF PLATFORM_UNIX = 0
-DEF PLATFORM_WIN = 0
-DEF X11 = 0
-DEF M_32 = 0
-#endif
-
-
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- IF (PLATFORM_WIN or M_32):
- cdef enum:
- A,
- B,
- C,
- ctypedef uint32_t BarType;
-
- IF (PLATFORM_UNIX and X11):
- cdef enum:
- A,
- B,
- C,
- ctypedef uint32_t FooType;
-
- IF (PLATFORM_UNIX and X11):
- ctypedef struct FooHandle:
- FooType ty;
- int32_t x;
- float y;
-
- cdef enum:
- C1,
- C2,
- C3,
- C5,
- ctypedef uint8_t C_Tag;
-
- ctypedef struct C5_Body:
- C_Tag tag;
- int32_t int_;
-
- ctypedef union C:
- C_Tag tag;
- C5_Body c5;
-
- IF (PLATFORM_WIN or M_32):
- ctypedef struct BarHandle:
- BarType ty;
- int32_t x;
- float y;
-
- ctypedef struct ConditionalField:
- int32_t field;
-
- IF (PLATFORM_UNIX and X11):
- void root(FooHandle a, C c);
-
- IF (PLATFORM_WIN or M_32):
- void root(BarHandle a, C c);
-
- void cond(ConditionalField a);
diff --git a/cbindgen-0.24.5/tests/expectations/cfg.tag.c b/cbindgen-0.24.5/tests/expectations/cfg.tag.c
deleted file mode 100644
index 8935265..0000000
--- a/cbindgen-0.24.5/tests/expectations/cfg.tag.c
+++ /dev/null
@@ -1,89 +0,0 @@
-#if 0
-DEF PLATFORM_UNIX = 0
-DEF PLATFORM_WIN = 0
-DEF X11 = 0
-DEF M_32 = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-enum BarType {
- A,
- B,
- C,
-};
-typedef uint32_t BarType;
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-enum FooType {
- A,
- B,
- C,
-};
-typedef uint32_t FooType;
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-struct FooHandle {
- FooType ty;
- int32_t x;
- float y;
-};
-#endif
-
-enum C_Tag {
- C1,
- C2,
-#if defined(PLATFORM_WIN)
- C3,
-#endif
-#if defined(PLATFORM_UNIX)
- C5,
-#endif
-};
-typedef uint8_t C_Tag;
-
-#if defined(PLATFORM_UNIX)
-struct C5_Body {
- C_Tag tag;
- int32_t int_;
-};
-#endif
-
-union C {
- C_Tag tag;
-#if defined(PLATFORM_UNIX)
- struct C5_Body c5;
-#endif
-};
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-struct BarHandle {
- BarType ty;
- int32_t x;
- float y;
-};
-#endif
-
-struct ConditionalField {
-#if defined(X11)
- int32_t field
-#endif
- ;
-};
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-void root(struct FooHandle a, union C c);
-#endif
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-void root(struct BarHandle a, union C c);
-#endif
-
-void cond(struct ConditionalField a);
diff --git a/cbindgen-0.24.5/tests/expectations/cfg.tag.compat.c b/cbindgen-0.24.5/tests/expectations/cfg.tag.compat.c
deleted file mode 100644
index ceaebc7..0000000
--- a/cbindgen-0.24.5/tests/expectations/cfg.tag.compat.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#if 0
-DEF PLATFORM_UNIX = 0
-DEF PLATFORM_WIN = 0
-DEF X11 = 0
-DEF M_32 = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-enum BarType
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- A,
- B,
- C,
-};
-#ifndef __cplusplus
-typedef uint32_t BarType;
-#endif // __cplusplus
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-enum FooType
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- A,
- B,
- C,
-};
-#ifndef __cplusplus
-typedef uint32_t FooType;
-#endif // __cplusplus
-#endif
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-struct FooHandle {
- FooType ty;
- int32_t x;
- float y;
-};
-#endif
-
-enum C_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- C1,
- C2,
-#if defined(PLATFORM_WIN)
- C3,
-#endif
-#if defined(PLATFORM_UNIX)
- C5,
-#endif
-};
-#ifndef __cplusplus
-typedef uint8_t C_Tag;
-#endif // __cplusplus
-
-#if defined(PLATFORM_UNIX)
-struct C5_Body {
- C_Tag tag;
- int32_t int_;
-};
-#endif
-
-union C {
- C_Tag tag;
-#if defined(PLATFORM_UNIX)
- struct C5_Body c5;
-#endif
-};
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-struct BarHandle {
- BarType ty;
- int32_t x;
- float y;
-};
-#endif
-
-struct ConditionalField {
-#if defined(X11)
- int32_t field
-#endif
- ;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-#if (defined(PLATFORM_UNIX) && defined(X11))
-void root(struct FooHandle a, union C c);
-#endif
-
-#if (defined(PLATFORM_WIN) || defined(M_32))
-void root(struct BarHandle a, union C c);
-#endif
-
-void cond(struct ConditionalField a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cfg.tag.pyx b/cbindgen-0.24.5/tests/expectations/cfg.tag.pyx
deleted file mode 100644
index 3c1b871..0000000
--- a/cbindgen-0.24.5/tests/expectations/cfg.tag.pyx
+++ /dev/null
@@ -1,67 +0,0 @@
-#if 0
-DEF PLATFORM_UNIX = 0
-DEF PLATFORM_WIN = 0
-DEF X11 = 0
-DEF M_32 = 0
-#endif
-
-
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- IF (PLATFORM_WIN or M_32):
- cdef enum:
- A,
- B,
- C,
- ctypedef uint32_t BarType;
-
- IF (PLATFORM_UNIX and X11):
- cdef enum:
- A,
- B,
- C,
- ctypedef uint32_t FooType;
-
- IF (PLATFORM_UNIX and X11):
- cdef struct FooHandle:
- FooType ty;
- int32_t x;
- float y;
-
- cdef enum:
- C1,
- C2,
- C3,
- C5,
- ctypedef uint8_t C_Tag;
-
- cdef struct C5_Body:
- C_Tag tag;
- int32_t int_;
-
- cdef union C:
- C_Tag tag;
- C5_Body c5;
-
- IF (PLATFORM_WIN or M_32):
- cdef struct BarHandle:
- BarType ty;
- int32_t x;
- float y;
-
- cdef struct ConditionalField:
- int32_t field;
-
- IF (PLATFORM_UNIX and X11):
- void root(FooHandle a, C c);
-
- IF (PLATFORM_WIN or M_32):
- void root(BarHandle a, C c);
-
- void cond(ConditionalField a);
diff --git a/cbindgen-0.24.5/tests/expectations/cfg_2.both.compat.c b/cbindgen-0.24.5/tests/expectations/cfg_2.both.compat.c
deleted file mode 100644
index ffb1f1b..0000000
--- a/cbindgen-0.24.5/tests/expectations/cfg_2.both.compat.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#if 0
-DEF DEFINED = 1
-DEF NOT_DEFINED = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#if defined(NOT_DEFINED)
-#define DEFAULT_X 8
-#endif
-
-#if defined(DEFINED)
-#define DEFAULT_X 42
-#endif
-
-#if (defined(NOT_DEFINED) || defined(DEFINED))
-typedef struct Foo {
- int32_t x;
-} Foo;
-#endif
-
-#if defined(NOT_DEFINED)
-typedef struct Bar {
- struct Foo y;
-} Bar;
-#endif
-
-#if defined(DEFINED)
-typedef struct Bar {
- struct Foo z;
-} Bar;
-#endif
-
-typedef struct Root {
- struct Bar w;
-} Root;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Root a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cfg_2.compat.c b/cbindgen-0.24.5/tests/expectations/cfg_2.compat.c
deleted file mode 100644
index 6a0047a..0000000
--- a/cbindgen-0.24.5/tests/expectations/cfg_2.compat.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#if 0
-DEF DEFINED = 1
-DEF NOT_DEFINED = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#if defined(NOT_DEFINED)
-#define DEFAULT_X 8
-#endif
-
-#if defined(DEFINED)
-#define DEFAULT_X 42
-#endif
-
-#if (defined(NOT_DEFINED) || defined(DEFINED))
-typedef struct {
- int32_t x;
-} Foo;
-#endif
-
-#if defined(NOT_DEFINED)
-typedef struct {
- Foo y;
-} Bar;
-#endif
-
-#if defined(DEFINED)
-typedef struct {
- Foo z;
-} Bar;
-#endif
-
-typedef struct {
- Bar w;
-} Root;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Root a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cfg_2.cpp b/cbindgen-0.24.5/tests/expectations/cfg_2.cpp
deleted file mode 100644
index 40aee48..0000000
--- a/cbindgen-0.24.5/tests/expectations/cfg_2.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#if 0
-DEF DEFINED = 1
-DEF NOT_DEFINED = 0
-#endif
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-#if defined(NOT_DEFINED)
-constexpr static const int32_t DEFAULT_X = 8;
-#endif
-
-#if defined(DEFINED)
-constexpr static const int32_t DEFAULT_X = 42;
-#endif
-
-#if (defined(NOT_DEFINED) || defined(DEFINED))
-struct Foo {
- int32_t x;
-};
-#endif
-
-#if defined(NOT_DEFINED)
-struct Bar {
- Foo y;
-};
-#endif
-
-#if defined(DEFINED)
-struct Bar {
- Foo z;
-};
-#endif
-
-struct Root {
- Bar w;
-};
-
-extern "C" {
-
-void root(Root a);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/cfg_2.tag.compat.c b/cbindgen-0.24.5/tests/expectations/cfg_2.tag.compat.c
deleted file mode 100644
index 62a258d..0000000
--- a/cbindgen-0.24.5/tests/expectations/cfg_2.tag.compat.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#if 0
-DEF DEFINED = 1
-DEF NOT_DEFINED = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#if defined(NOT_DEFINED)
-#define DEFAULT_X 8
-#endif
-
-#if defined(DEFINED)
-#define DEFAULT_X 42
-#endif
-
-#if (defined(NOT_DEFINED) || defined(DEFINED))
-struct Foo {
- int32_t x;
-};
-#endif
-
-#if defined(NOT_DEFINED)
-struct Bar {
- struct Foo y;
-};
-#endif
-
-#if defined(DEFINED)
-struct Bar {
- struct Foo z;
-};
-#endif
-
-struct Root {
- struct Bar w;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Root a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/char.both.compat.c b/cbindgen-0.24.5/tests/expectations/char.both.compat.c
deleted file mode 100644
index bb69e53..0000000
--- a/cbindgen-0.24.5/tests/expectations/char.both.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo {
- uint32_t a;
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/char.compat.c b/cbindgen-0.24.5/tests/expectations/char.compat.c
deleted file mode 100644
index 59253a6..0000000
--- a/cbindgen-0.24.5/tests/expectations/char.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- uint32_t a;
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/char.cpp b/cbindgen-0.24.5/tests/expectations/char.cpp
deleted file mode 100644
index b801989..0000000
--- a/cbindgen-0.24.5/tests/expectations/char.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Foo {
- uint32_t a;
-};
-
-extern "C" {
-
-void root(Foo a);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/char.tag.compat.c b/cbindgen-0.24.5/tests/expectations/char.tag.compat.c
deleted file mode 100644
index b1574c5..0000000
--- a/cbindgen-0.24.5/tests/expectations/char.tag.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo {
- uint32_t a;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics.both.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics.both.compat.c
deleted file mode 100644
index 3274454..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics.both.compat.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define TITLE_SIZE 80
-
-typedef int8_t CArrayString_TITLE_SIZE[TITLE_SIZE];
-
-typedef int8_t CArrayString_40[40];
-
-typedef struct Book {
- CArrayString_TITLE_SIZE title;
- CArrayString_40 author;
-} Book;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Book *a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics.compat.c
deleted file mode 100644
index 40ded76..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics.compat.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define TITLE_SIZE 80
-
-typedef int8_t CArrayString_TITLE_SIZE[TITLE_SIZE];
-
-typedef int8_t CArrayString_40[40];
-
-typedef struct {
- CArrayString_TITLE_SIZE title;
- CArrayString_40 author;
-} Book;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Book *a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics.cpp b/cbindgen-0.24.5/tests/expectations/const_generics.cpp
deleted file mode 100644
index e5157e6..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-constexpr static const uintptr_t TITLE_SIZE = 80;
-
-template<uintptr_t CAP>
-using CArrayString = int8_t[CAP];
-
-struct Book {
- CArrayString<TITLE_SIZE> title;
- CArrayString<40> author;
-};
-
-extern "C" {
-
-void root(Book *a);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics.tag.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics.tag.compat.c
deleted file mode 100644
index f764e5b..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics.tag.compat.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define TITLE_SIZE 80
-
-typedef int8_t CArrayString_TITLE_SIZE[TITLE_SIZE];
-
-typedef int8_t CArrayString_40[40];
-
-struct Book {
- CArrayString_TITLE_SIZE title;
- CArrayString_40 author;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Book *a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.both.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.both.compat.c
deleted file mode 100644
index 3c382ba..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.both.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct ArrayVec_____u8__100 {
- uint8_t *xs[100];
- uint32_t len;
-} ArrayVec_____u8__100;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-int32_t push(struct ArrayVec_____u8__100 *v, uint8_t *elem);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.compat.c
deleted file mode 100644
index 3ed7a89..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- uint8_t *xs[100];
- uint32_t len;
-} ArrayVec_____u8__100;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-int32_t push(ArrayVec_____u8__100 *v, uint8_t *elem);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.cpp b/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.cpp
deleted file mode 100644
index 5e63c74..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T, uintptr_t CAP>
-struct ArrayVec {
- T xs[CAP];
- uint32_t len;
-};
-
-extern "C" {
-
-int32_t push(ArrayVec<uint8_t*, 100> *v, uint8_t *elem);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.tag.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.tag.compat.c
deleted file mode 100644
index cf45ebc..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.tag.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct ArrayVec_____u8__100 {
- uint8_t *xs[100];
- uint32_t len;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-int32_t push(struct ArrayVec_____u8__100 *v, uint8_t *elem);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_bool.both.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_bool.both.compat.c
deleted file mode 100644
index ad87976..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_bool.both.compat.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef const char *Str;
-
-typedef struct HashTable_Str__c_char__false {
- uintptr_t num_buckets;
- uintptr_t capacity;
- uint8_t *occupied;
- Str *keys;
- char *vals;
-} HashTable_Str__c_char__false;
-
-typedef struct HashTable_Str__c_char__false MySet;
-
-typedef void (*SetCallback)(Str key);
-
-typedef struct HashTable_Str__u64__true {
- uintptr_t num_buckets;
- uintptr_t capacity;
- uint8_t *occupied;
- Str *keys;
- uint64_t *vals;
-} HashTable_Str__u64__true;
-
-typedef void (*MapCallback)(Str key, uint64_t val);
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-MySet *new_set(void);
-
-void set_for_each(const MySet *set, SetCallback callback);
-
-struct HashTable_Str__u64__true *new_map(void);
-
-void map_for_each(const struct HashTable_Str__u64__true *map, MapCallback callback);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_bool.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_bool.compat.c
deleted file mode 100644
index 304c38d..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_bool.compat.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef const char *Str;
-
-typedef struct {
- uintptr_t num_buckets;
- uintptr_t capacity;
- uint8_t *occupied;
- Str *keys;
- char *vals;
-} HashTable_Str__c_char__false;
-
-typedef HashTable_Str__c_char__false MySet;
-
-typedef void (*SetCallback)(Str key);
-
-typedef struct {
- uintptr_t num_buckets;
- uintptr_t capacity;
- uint8_t *occupied;
- Str *keys;
- uint64_t *vals;
-} HashTable_Str__u64__true;
-
-typedef void (*MapCallback)(Str key, uint64_t val);
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-MySet *new_set(void);
-
-void set_for_each(const MySet *set, SetCallback callback);
-
-HashTable_Str__u64__true *new_map(void);
-
-void map_for_each(const HashTable_Str__u64__true *map, MapCallback callback);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_bool.cpp b/cbindgen-0.24.5/tests/expectations/const_generics_bool.cpp
deleted file mode 100644
index f2ee08b..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_bool.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T = void>
-struct MaybeUninit;
-
-using Str = const char*;
-
-template<typename K, typename V, bool IS_MAP>
-struct HashTable {
- uintptr_t num_buckets;
- uintptr_t capacity;
- uint8_t *occupied;
- MaybeUninit<K> *keys;
- MaybeUninit<V> *vals;
-};
-
-using MySet = HashTable<Str, char, false>;
-
-using SetCallback = void(*)(Str key);
-
-using MapCallback = void(*)(Str key, uint64_t val);
-
-extern "C" {
-
-MySet *new_set();
-
-void set_for_each(const MySet *set, SetCallback callback);
-
-HashTable<Str, uint64_t, true> *new_map();
-
-void map_for_each(const HashTable<Str, uint64_t, true> *map, MapCallback callback);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_bool.tag.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_bool.tag.compat.c
deleted file mode 100644
index 4b12798..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_bool.tag.compat.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef const char *Str;
-
-struct HashTable_Str__c_char__false {
- uintptr_t num_buckets;
- uintptr_t capacity;
- uint8_t *occupied;
- Str *keys;
- char *vals;
-};
-
-typedef struct HashTable_Str__c_char__false MySet;
-
-typedef void (*SetCallback)(Str key);
-
-struct HashTable_Str__u64__true {
- uintptr_t num_buckets;
- uintptr_t capacity;
- uint8_t *occupied;
- Str *keys;
- uint64_t *vals;
-};
-
-typedef void (*MapCallback)(Str key, uint64_t val);
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-MySet *new_set(void);
-
-void set_for_each(const MySet *set, SetCallback callback);
-
-struct HashTable_Str__u64__true *new_map(void);
-
-void map_for_each(const struct HashTable_Str__u64__true *map, MapCallback callback);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_byte.both.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_byte.both.compat.c
deleted file mode 100644
index 4d15803..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_byte.both.compat.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Parser_40__41 {
- uint8_t *buf;
- uintptr_t len;
-} Parser_40__41;
-
-typedef struct Parser_123__125 {
- uint8_t *buf;
- uintptr_t len;
-} Parser_123__125;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void init_parens_parser(struct Parser_40__41 *p, uint8_t *buf, uintptr_t len);
-
-void destroy_parens_parser(struct Parser_40__41 *p);
-
-void init_braces_parser(struct Parser_123__125 *p, uint8_t *buf, uintptr_t len);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_byte.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_byte.compat.c
deleted file mode 100644
index 6cf6102..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_byte.compat.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- uint8_t *buf;
- uintptr_t len;
-} Parser_40__41;
-
-typedef struct {
- uint8_t *buf;
- uintptr_t len;
-} Parser_123__125;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void init_parens_parser(Parser_40__41 *p, uint8_t *buf, uintptr_t len);
-
-void destroy_parens_parser(Parser_40__41 *p);
-
-void init_braces_parser(Parser_123__125 *p, uint8_t *buf, uintptr_t len);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_byte.cpp b/cbindgen-0.24.5/tests/expectations/const_generics_byte.cpp
deleted file mode 100644
index 118dc98..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_byte.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<uint8_t OPEN, uint8_t CLOSE>
-struct Parser {
- uint8_t *buf;
- uintptr_t len;
-};
-
-extern "C" {
-
-void init_parens_parser(Parser<40, 41> *p, uint8_t *buf, uintptr_t len);
-
-void destroy_parens_parser(Parser<40, 41> *p);
-
-void init_braces_parser(Parser<123, 125> *p, uint8_t *buf, uintptr_t len);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_byte.tag.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_byte.tag.compat.c
deleted file mode 100644
index 85172fd..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_byte.tag.compat.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Parser_40__41 {
- uint8_t *buf;
- uintptr_t len;
-};
-
-struct Parser_123__125 {
- uint8_t *buf;
- uintptr_t len;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void init_parens_parser(struct Parser_40__41 *p, uint8_t *buf, uintptr_t len);
-
-void destroy_parens_parser(struct Parser_40__41 *p);
-
-void init_braces_parser(struct Parser_123__125 *p, uint8_t *buf, uintptr_t len);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_char.both.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_char.both.compat.c
deleted file mode 100644
index 65f152e..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_char.both.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct TakeUntil_0 {
- const uint8_t *start;
- uintptr_t len;
- uintptr_t point;
-} TakeUntil_0;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-struct TakeUntil_0 until_nul(const uint8_t *start, uintptr_t len);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_char.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_char.compat.c
deleted file mode 100644
index 7ea7ba0..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_char.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- const uint8_t *start;
- uintptr_t len;
- uintptr_t point;
-} TakeUntil_0;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-TakeUntil_0 until_nul(const uint8_t *start, uintptr_t len);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_char.cpp b/cbindgen-0.24.5/tests/expectations/const_generics_char.cpp
deleted file mode 100644
index 22376cc..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_char.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<uint32_t V>
-struct TakeUntil {
- const uint8_t *start;
- uintptr_t len;
- uintptr_t point;
-};
-
-extern "C" {
-
-TakeUntil<0> until_nul(const uint8_t *start, uintptr_t len);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_char.tag.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_char.tag.compat.c
deleted file mode 100644
index 71c01fb..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_char.tag.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct TakeUntil_0 {
- const uint8_t *start;
- uintptr_t len;
- uintptr_t point;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-struct TakeUntil_0 until_nul(const uint8_t *start, uintptr_t len);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_constant.both.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_constant.both.compat.c
deleted file mode 100644
index ce880ae..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_constant.both.compat.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define FONT_WEIGHT_FRACTION_BITS 6
-
-typedef struct FixedPoint_FONT_WEIGHT_FRACTION_BITS {
- uint16_t value;
-} FixedPoint_FONT_WEIGHT_FRACTION_BITS;
-
-typedef struct FixedPoint_FONT_WEIGHT_FRACTION_BITS FontWeightFixedPoint;
-
-typedef struct FontWeight {
- FontWeightFixedPoint _0;
-} FontWeight;
-#define FontWeight_NORMAL (FontWeight){ ._0 = (FontWeightFixedPoint){ .value = (400 << FONT_WEIGHT_FRACTION_BITS) } }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct FontWeight w);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_constant.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_constant.compat.c
deleted file mode 100644
index 14ebfa2..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_constant.compat.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define FONT_WEIGHT_FRACTION_BITS 6
-
-typedef struct {
- uint16_t value;
-} FixedPoint_FONT_WEIGHT_FRACTION_BITS;
-
-typedef FixedPoint_FONT_WEIGHT_FRACTION_BITS FontWeightFixedPoint;
-
-typedef struct {
- FontWeightFixedPoint _0;
-} FontWeight;
-#define FontWeight_NORMAL (FontWeight){ ._0 = (FontWeightFixedPoint){ .value = (400 << FONT_WEIGHT_FRACTION_BITS) } }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(FontWeight w);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_constant.cpp b/cbindgen-0.24.5/tests/expectations/const_generics_constant.cpp
deleted file mode 100644
index 715a071..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_constant.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-constexpr static const uint16_t FONT_WEIGHT_FRACTION_BITS = 6;
-
-template<uint16_t FRACTION_BITS>
-struct FixedPoint {
- uint16_t value;
-};
-
-using FontWeightFixedPoint = FixedPoint<FONT_WEIGHT_FRACTION_BITS>;
-
-struct FontWeight {
- FontWeightFixedPoint _0;
-};
-constexpr static const FontWeight FontWeight_NORMAL = FontWeight{ /* ._0 = */ FontWeightFixedPoint{ /* .value = */ (400 << FONT_WEIGHT_FRACTION_BITS) } };
-
-extern "C" {
-
-void root(FontWeight w);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_constant.tag.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_constant.tag.compat.c
deleted file mode 100644
index fc115cf..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_constant.tag.compat.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define FONT_WEIGHT_FRACTION_BITS 6
-
-struct FixedPoint_FONT_WEIGHT_FRACTION_BITS {
- uint16_t value;
-};
-
-typedef struct FixedPoint_FONT_WEIGHT_FRACTION_BITS FontWeightFixedPoint;
-
-struct FontWeight {
- FontWeightFixedPoint _0;
-};
-#define FontWeight_NORMAL (FontWeight){ ._0 = (FontWeightFixedPoint){ .value = (400 << FONT_WEIGHT_FRACTION_BITS) } }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct FontWeight w);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_thru.both.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_thru.both.compat.c
deleted file mode 100644
index 8659d4e..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_thru.both.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Inner_1 {
- uint8_t bytes[1];
-} Inner_1;
-
-typedef struct Outer_1 {
- struct Inner_1 inner;
-} Outer_1;
-
-typedef struct Inner_2 {
- uint8_t bytes[2];
-} Inner_2;
-
-typedef struct Outer_2 {
- struct Inner_2 inner;
-} Outer_2;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-struct Outer_1 one(void);
-
-struct Outer_2 two(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_thru.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_thru.compat.c
deleted file mode 100644
index d80c949..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_thru.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- uint8_t bytes[1];
-} Inner_1;
-
-typedef struct {
- Inner_1 inner;
-} Outer_1;
-
-typedef struct {
- uint8_t bytes[2];
-} Inner_2;
-
-typedef struct {
- Inner_2 inner;
-} Outer_2;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-Outer_1 one(void);
-
-Outer_2 two(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_thru.cpp b/cbindgen-0.24.5/tests/expectations/const_generics_thru.cpp
deleted file mode 100644
index 0ca2529..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_thru.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<uintptr_t N>
-struct Inner {
- uint8_t bytes[N];
-};
-
-template<uintptr_t N>
-struct Outer {
- Inner<N> inner;
-};
-
-extern "C" {
-
-Outer<1> one();
-
-Outer<2> two();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_thru.tag.compat.c b/cbindgen-0.24.5/tests/expectations/const_generics_thru.tag.compat.c
deleted file mode 100644
index 55d58f2..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_generics_thru.tag.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Inner_1 {
- uint8_t bytes[1];
-};
-
-struct Outer_1 {
- struct Inner_1 inner;
-};
-
-struct Inner_2 {
- uint8_t bytes[2];
-};
-
-struct Outer_2 {
- struct Inner_2 inner;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-struct Outer_1 one(void);
-
-struct Outer_2 two(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_transparent.compat.c b/cbindgen-0.24.5/tests/expectations/const_transparent.compat.c
deleted file mode 100644
index 642e72e..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_transparent.compat.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef uint8_t Transparent;
-
-#define FOO 0
diff --git a/cbindgen-0.24.5/tests/expectations/const_transparent.cpp b/cbindgen-0.24.5/tests/expectations/const_transparent.cpp
deleted file mode 100644
index 920af50..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_transparent.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-using Transparent = uint8_t;
-
-constexpr static const Transparent FOO = 0;
diff --git a/cbindgen-0.24.5/tests/expectations/const_transparent.pyx b/cbindgen-0.24.5/tests/expectations/const_transparent.pyx
deleted file mode 100644
index 27e68d9..0000000
--- a/cbindgen-0.24.5/tests/expectations/const_transparent.pyx
+++ /dev/null
@@ -1,11 +0,0 @@
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- ctypedef uint8_t Transparent;
-
- const Transparent FOO # = 0
diff --git a/cbindgen-0.24.5/tests/expectations/constant.both.compat.c b/cbindgen-0.24.5/tests/expectations/constant.both.compat.c
deleted file mode 100644
index 08843c6..0000000
--- a/cbindgen-0.24.5/tests/expectations/constant.both.compat.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define FOO 10
-
-#define DELIMITER ':'
-
-#define LEFTCURLY '{'
-
-#define QUOTE '\''
-
-#define TAB '\t'
-
-#define NEWLINE '\n'
-
-#define HEART U'\U00002764'
-
-#define EQUID U'\U00010083'
-
-#define ZOM 3.14
-
-/**
- * A single-line doc comment.
- */
-#define POS_ONE 1
-
-/**
- * A
- * multi-line
- * doc
- * comment.
- */
-#define NEG_ONE -1
-
-#define SHIFT 3
-
-#define XBOOL 1
-
-#define XFALSE ((0 << SHIFT) | XBOOL)
-
-#define XTRUE (1 << (SHIFT | XBOOL))
-
-#define CAST (uint8_t)'A'
-
-#define DOUBLE_CAST (uint32_t)(float)1
-
-typedef struct Foo {
- int32_t x[FOO];
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/constant.compat.c b/cbindgen-0.24.5/tests/expectations/constant.compat.c
deleted file mode 100644
index 654a75e..0000000
--- a/cbindgen-0.24.5/tests/expectations/constant.compat.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define FOO 10
-
-#define DELIMITER ':'
-
-#define LEFTCURLY '{'
-
-#define QUOTE '\''
-
-#define TAB '\t'
-
-#define NEWLINE '\n'
-
-#define HEART U'\U00002764'
-
-#define EQUID U'\U00010083'
-
-#define ZOM 3.14
-
-/**
- * A single-line doc comment.
- */
-#define POS_ONE 1
-
-/**
- * A
- * multi-line
- * doc
- * comment.
- */
-#define NEG_ONE -1
-
-#define SHIFT 3
-
-#define XBOOL 1
-
-#define XFALSE ((0 << SHIFT) | XBOOL)
-
-#define XTRUE (1 << (SHIFT | XBOOL))
-
-#define CAST (uint8_t)'A'
-
-#define DOUBLE_CAST (uint32_t)(float)1
-
-typedef struct {
- int32_t x[FOO];
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Foo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/constant.cpp b/cbindgen-0.24.5/tests/expectations/constant.cpp
deleted file mode 100644
index a43099d..0000000
--- a/cbindgen-0.24.5/tests/expectations/constant.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-constexpr static const int32_t FOO = 10;
-
-constexpr static const uint32_t DELIMITER = ':';
-
-constexpr static const uint32_t LEFTCURLY = '{';
-
-constexpr static const uint32_t QUOTE = '\'';
-
-constexpr static const uint32_t TAB = '\t';
-
-constexpr static const uint32_t NEWLINE = '\n';
-
-constexpr static const uint32_t HEART = U'\U00002764';
-
-constexpr static const uint32_t EQUID = U'\U00010083';
-
-constexpr static const float ZOM = 3.14;
-
-/// A single-line doc comment.
-constexpr static const int8_t POS_ONE = 1;
-
-/// A
-/// multi-line
-/// doc
-/// comment.
-constexpr static const int8_t NEG_ONE = -1;
-
-constexpr static const int64_t SHIFT = 3;
-
-constexpr static const int64_t XBOOL = 1;
-
-constexpr static const int64_t XFALSE = ((0 << SHIFT) | XBOOL);
-
-constexpr static const int64_t XTRUE = (1 << (SHIFT | XBOOL));
-
-constexpr static const uint8_t CAST = (uint8_t)'A';
-
-constexpr static const uint32_t DOUBLE_CAST = (uint32_t)(float)1;
-
-struct Foo {
- int32_t x[FOO];
-};
-
-extern "C" {
-
-void root(Foo x);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/constant.tag.compat.c b/cbindgen-0.24.5/tests/expectations/constant.tag.compat.c
deleted file mode 100644
index 2154e49..0000000
--- a/cbindgen-0.24.5/tests/expectations/constant.tag.compat.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define FOO 10
-
-#define DELIMITER ':'
-
-#define LEFTCURLY '{'
-
-#define QUOTE '\''
-
-#define TAB '\t'
-
-#define NEWLINE '\n'
-
-#define HEART U'\U00002764'
-
-#define EQUID U'\U00010083'
-
-#define ZOM 3.14
-
-/**
- * A single-line doc comment.
- */
-#define POS_ONE 1
-
-/**
- * A
- * multi-line
- * doc
- * comment.
- */
-#define NEG_ONE -1
-
-#define SHIFT 3
-
-#define XBOOL 1
-
-#define XFALSE ((0 << SHIFT) | XBOOL)
-
-#define XTRUE (1 << (SHIFT | XBOOL))
-
-#define CAST (uint8_t)'A'
-
-#define DOUBLE_CAST (uint32_t)(float)1
-
-struct Foo {
- int32_t x[FOO];
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/constant_sort_name.compat.c b/cbindgen-0.24.5/tests/expectations/constant_sort_name.compat.c
deleted file mode 100644
index 1b9032a..0000000
--- a/cbindgen-0.24.5/tests/expectations/constant_sort_name.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define A 0
-
-#define B 0
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern const uint8_t C;
-
-extern const uint8_t D;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/constant_sort_name.cpp b/cbindgen-0.24.5/tests/expectations/constant_sort_name.cpp
deleted file mode 100644
index 1a7dd50..0000000
--- a/cbindgen-0.24.5/tests/expectations/constant_sort_name.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-constexpr static const uint8_t A = 0;
-
-constexpr static const uint8_t B = 0;
-
-extern "C" {
-
-extern const uint8_t C;
-
-extern const uint8_t D;
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/constant_sort_none.compat.c b/cbindgen-0.24.5/tests/expectations/constant_sort_none.compat.c
deleted file mode 100644
index c9c7445..0000000
--- a/cbindgen-0.24.5/tests/expectations/constant_sort_none.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define B 0
-
-#define A 0
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern const uint8_t D;
-
-extern const uint8_t C;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/constant_sort_none.cpp b/cbindgen-0.24.5/tests/expectations/constant_sort_none.cpp
deleted file mode 100644
index c5571e9..0000000
--- a/cbindgen-0.24.5/tests/expectations/constant_sort_none.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-constexpr static const uint8_t B = 0;
-
-constexpr static const uint8_t A = 0;
-
-extern "C" {
-
-extern const uint8_t D;
-
-extern const uint8_t C;
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/custom_header.compat.c b/cbindgen-0.24.5/tests/expectations/custom_header.compat.c
deleted file mode 100644
index 7adabf2..0000000
--- a/cbindgen-0.24.5/tests/expectations/custom_header.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#if 0
-# This file is generated by cbindgen. DO NOT EDIT
-#endif
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#if 0
-# This is a simple test to ensure that trailers do not cause extra newlines in files
-#endif
diff --git a/cbindgen-0.24.5/tests/expectations/custom_header.cpp b/cbindgen-0.24.5/tests/expectations/custom_header.cpp
deleted file mode 100644
index c7313b1..0000000
--- a/cbindgen-0.24.5/tests/expectations/custom_header.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#if 0
-# This file is generated by cbindgen. DO NOT EDIT
-#endif
-
-
-extern "C" {
-
-void root();
-
-} // extern "C"
-
-#if 0
-# This is a simple test to ensure that trailers do not cause extra newlines in files
-#endif
diff --git a/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.both.compat.c b/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.both.compat.c
deleted file mode 100644
index e8a8d49..0000000
--- a/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.both.compat.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum BindingType
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- Buffer = 0,
- NotBuffer = 1,
-};
-#ifndef __cplusplus
-typedef uint32_t BindingType;
-#endif // __cplusplus
-
-typedef struct BindGroupLayoutEntry {
- BindingType ty;
-} BindGroupLayoutEntry;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct BindGroupLayoutEntry entry);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.compat.c b/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.compat.c
deleted file mode 100644
index a78700f..0000000
--- a/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.compat.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum BindingType
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- Buffer = 0,
- NotBuffer = 1,
-};
-#ifndef __cplusplus
-typedef uint32_t BindingType;
-#endif // __cplusplus
-
-typedef struct {
- BindingType ty;
-} BindGroupLayoutEntry;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(BindGroupLayoutEntry entry);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.cpp b/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.cpp
deleted file mode 100644
index 74c2ae1..0000000
--- a/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-enum class BindingType : uint32_t {
- Buffer = 0,
- NotBuffer = 1,
-};
-
-struct BindGroupLayoutEntry {
- BindingType ty;
-};
-
-extern "C" {
-
-void root(BindGroupLayoutEntry entry);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.tag.compat.c b/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.tag.compat.c
deleted file mode 100644
index 6011756..0000000
--- a/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.tag.compat.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum BindingType
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- Buffer = 0,
- NotBuffer = 1,
-};
-#ifndef __cplusplus
-typedef uint32_t BindingType;
-#endif // __cplusplus
-
-struct BindGroupLayoutEntry {
- BindingType ty;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct BindGroupLayoutEntry entry);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.both.compat.c b/cbindgen-0.24.5/tests/expectations/dep_v2.both.compat.c
deleted file mode 100644
index 9cd14e4..0000000
--- a/cbindgen-0.24.5/tests/expectations/dep_v2.both.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct dep_struct {
- uint32_t x;
- double y;
-} dep_struct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-uint32_t get_x(const struct dep_struct *dep_struct);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.compat.c b/cbindgen-0.24.5/tests/expectations/dep_v2.compat.c
deleted file mode 100644
index 4dc7fb3..0000000
--- a/cbindgen-0.24.5/tests/expectations/dep_v2.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- uint32_t x;
- double y;
-} dep_struct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-uint32_t get_x(const dep_struct *dep_struct);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.cpp b/cbindgen-0.24.5/tests/expectations/dep_v2.cpp
deleted file mode 100644
index 914b798..0000000
--- a/cbindgen-0.24.5/tests/expectations/dep_v2.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct dep_struct {
- uint32_t x;
- double y;
-};
-
-extern "C" {
-
-uint32_t get_x(const dep_struct *dep_struct);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.tag.compat.c b/cbindgen-0.24.5/tests/expectations/dep_v2.tag.compat.c
deleted file mode 100644
index 344af64..0000000
--- a/cbindgen-0.24.5/tests/expectations/dep_v2.tag.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct dep_struct {
- uint32_t x;
- double y;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-uint32_t get_x(const struct dep_struct *dep_struct);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/derive_eq.both.compat.c b/cbindgen-0.24.5/tests/expectations/derive_eq.both.compat.c
deleted file mode 100644
index f628dd7..0000000
--- a/cbindgen-0.24.5/tests/expectations/derive_eq.both.compat.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo {
- bool a;
- int32_t b;
-} Foo;
-
-enum Bar_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Baz,
- Bazz,
- FooNamed,
- FooParen,
-};
-#ifndef __cplusplus
-typedef uint8_t Bar_Tag;
-#endif // __cplusplus
-
-typedef struct Bazz_Body {
- Bar_Tag tag;
- struct Foo named;
-} Bazz_Body;
-
-typedef struct FooNamed_Body {
- Bar_Tag tag;
- int32_t different;
- uint32_t fields;
-} FooNamed_Body;
-
-typedef struct FooParen_Body {
- Bar_Tag tag;
- int32_t _0;
- struct Foo _1;
-} FooParen_Body;
-
-typedef union Bar {
- Bar_Tag tag;
- Bazz_Body bazz;
- FooNamed_Body foo_named;
- FooParen_Body foo_paren;
-} Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-struct Foo root(union Bar aBar);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/derive_eq.compat.c b/cbindgen-0.24.5/tests/expectations/derive_eq.compat.c
deleted file mode 100644
index 51a8e4d..0000000
--- a/cbindgen-0.24.5/tests/expectations/derive_eq.compat.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- bool a;
- int32_t b;
-} Foo;
-
-enum Bar_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Baz,
- Bazz,
- FooNamed,
- FooParen,
-};
-#ifndef __cplusplus
-typedef uint8_t Bar_Tag;
-#endif // __cplusplus
-
-typedef struct {
- Bar_Tag tag;
- Foo named;
-} Bazz_Body;
-
-typedef struct {
- Bar_Tag tag;
- int32_t different;
- uint32_t fields;
-} FooNamed_Body;
-
-typedef struct {
- Bar_Tag tag;
- int32_t _0;
- Foo _1;
-} FooParen_Body;
-
-typedef union {
- Bar_Tag tag;
- Bazz_Body bazz;
- FooNamed_Body foo_named;
- FooParen_Body foo_paren;
-} Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-Foo root(Bar aBar);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/derive_eq.cpp b/cbindgen-0.24.5/tests/expectations/derive_eq.cpp
deleted file mode 100644
index 46c10d4..0000000
--- a/cbindgen-0.24.5/tests/expectations/derive_eq.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Foo {
- bool a;
- int32_t b;
-
- bool operator==(const Foo& aOther) const {
- return a == aOther.a &&
- b == aOther.b;
- }
- bool operator!=(const Foo& aOther) const {
- return a != aOther.a ||
- b != aOther.b;
- }
-};
-
-union Bar {
- enum class Tag : uint8_t {
- Baz,
- Bazz,
- FooNamed,
- FooParen,
- };
-
- struct Bazz_Body {
- Tag tag;
- Foo named;
-
- bool operator==(const Bazz_Body& aOther) const {
- return named == aOther.named;
- }
- bool operator!=(const Bazz_Body& aOther) const {
- return named != aOther.named;
- }
- };
-
- struct FooNamed_Body {
- Tag tag;
- int32_t different;
- uint32_t fields;
-
- bool operator==(const FooNamed_Body& aOther) const {
- return different == aOther.different &&
- fields == aOther.fields;
- }
- bool operator!=(const FooNamed_Body& aOther) const {
- return different != aOther.different ||
- fields != aOther.fields;
- }
- };
-
- struct FooParen_Body {
- Tag tag;
- int32_t _0;
- Foo _1;
-
- bool operator==(const FooParen_Body& aOther) const {
- return _0 == aOther._0 &&
- _1 == aOther._1;
- }
- bool operator!=(const FooParen_Body& aOther) const {
- return _0 != aOther._0 ||
- _1 != aOther._1;
- }
- };
-
- struct {
- Tag tag;
- };
- Bazz_Body bazz;
- FooNamed_Body foo_named;
- FooParen_Body foo_paren;
-
- bool operator==(const Bar& aOther) const {
- if (tag != aOther.tag) {
- return false;
- }
- switch (tag) {
- case Tag::Bazz: return bazz == aOther.bazz;
- case Tag::FooNamed: return foo_named == aOther.foo_named;
- case Tag::FooParen: return foo_paren == aOther.foo_paren;
- default: break;
- }
- return true;
- }
-
- bool operator!=(const Bar& aOther) const {
- return !(*this == aOther);
- }
-};
-
-extern "C" {
-
-Foo root(Bar aBar);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/derive_eq.tag.compat.c b/cbindgen-0.24.5/tests/expectations/derive_eq.tag.compat.c
deleted file mode 100644
index 4e99d1c..0000000
--- a/cbindgen-0.24.5/tests/expectations/derive_eq.tag.compat.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo {
- bool a;
- int32_t b;
-};
-
-enum Bar_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Baz,
- Bazz,
- FooNamed,
- FooParen,
-};
-#ifndef __cplusplus
-typedef uint8_t Bar_Tag;
-#endif // __cplusplus
-
-struct Bazz_Body {
- Bar_Tag tag;
- struct Foo named;
-};
-
-struct FooNamed_Body {
- Bar_Tag tag;
- int32_t different;
- uint32_t fields;
-};
-
-struct FooParen_Body {
- Bar_Tag tag;
- int32_t _0;
- struct Foo _1;
-};
-
-union Bar {
- Bar_Tag tag;
- struct Bazz_Body bazz;
- struct FooNamed_Body foo_named;
- struct FooParen_Body foo_paren;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-struct Foo root(union Bar aBar);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/derive_ostream.both.compat.c b/cbindgen-0.24.5/tests/expectations/derive_ostream.both.compat.c
deleted file mode 100644
index ef6143d..0000000
--- a/cbindgen-0.24.5/tests/expectations/derive_ostream.both.compat.c
+++ /dev/null
@@ -1,121 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum C
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- X = 2,
- Y,
-};
-#ifndef __cplusplus
-typedef uint32_t C;
-#endif // __cplusplus
-
-typedef struct A {
- int32_t _0;
-} A;
-
-typedef struct B {
- int32_t x;
- float y;
-} B;
-
-typedef struct D {
- uint8_t List;
- uintptr_t Of;
- struct B Things;
-} D;
-
-enum F_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Foo,
- Bar,
- Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t F_Tag;
-#endif // __cplusplus
-
-typedef struct Bar_Body {
- F_Tag tag;
- uint8_t x;
- int16_t y;
-} Bar_Body;
-
-typedef union F {
- F_Tag tag;
- struct {
- F_Tag foo_tag;
- int16_t foo;
- };
- Bar_Body bar;
-} F;
-
-enum H_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Hello,
- There,
- Everyone,
-};
-#ifndef __cplusplus
-typedef uint8_t H_Tag;
-#endif // __cplusplus
-
-typedef struct There_Body {
- uint8_t x;
- int16_t y;
-} There_Body;
-
-typedef struct H {
- H_Tag tag;
- union {
- struct {
- int16_t hello;
- };
- There_Body there;
- };
-} H;
-
-enum I_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- ThereAgain,
- SomethingElse,
-};
-#ifndef __cplusplus
-typedef uint8_t I_Tag;
-#endif // __cplusplus
-
-typedef struct ThereAgain_Body {
- uint8_t x;
- int16_t y;
-} ThereAgain_Body;
-
-typedef struct I {
- I_Tag tag;
- union {
- ThereAgain_Body there_again;
- };
-} I;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct A a, struct B b, C c, struct D d, union F f, struct H h, struct I i);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/derive_ostream.compat.c b/cbindgen-0.24.5/tests/expectations/derive_ostream.compat.c
deleted file mode 100644
index 60cb5fb..0000000
--- a/cbindgen-0.24.5/tests/expectations/derive_ostream.compat.c
+++ /dev/null
@@ -1,121 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum C
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- X = 2,
- Y,
-};
-#ifndef __cplusplus
-typedef uint32_t C;
-#endif // __cplusplus
-
-typedef struct {
- int32_t _0;
-} A;
-
-typedef struct {
- int32_t x;
- float y;
-} B;
-
-typedef struct {
- uint8_t List;
- uintptr_t Of;
- B Things;
-} D;
-
-enum F_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Foo,
- Bar,
- Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t F_Tag;
-#endif // __cplusplus
-
-typedef struct {
- F_Tag tag;
- uint8_t x;
- int16_t y;
-} Bar_Body;
-
-typedef union {
- F_Tag tag;
- struct {
- F_Tag foo_tag;
- int16_t foo;
- };
- Bar_Body bar;
-} F;
-
-enum H_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Hello,
- There,
- Everyone,
-};
-#ifndef __cplusplus
-typedef uint8_t H_Tag;
-#endif // __cplusplus
-
-typedef struct {
- uint8_t x;
- int16_t y;
-} There_Body;
-
-typedef struct {
- H_Tag tag;
- union {
- struct {
- int16_t hello;
- };
- There_Body there;
- };
-} H;
-
-enum I_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- ThereAgain,
- SomethingElse,
-};
-#ifndef __cplusplus
-typedef uint8_t I_Tag;
-#endif // __cplusplus
-
-typedef struct {
- uint8_t x;
- int16_t y;
-} ThereAgain_Body;
-
-typedef struct {
- I_Tag tag;
- union {
- ThereAgain_Body there_again;
- };
-} I;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(A a, B b, C c, D d, F f, H h, I i);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/derive_ostream.cpp b/cbindgen-0.24.5/tests/expectations/derive_ostream.cpp
deleted file mode 100644
index 4831cad..0000000
--- a/cbindgen-0.24.5/tests/expectations/derive_ostream.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-enum class C : uint32_t {
- X = 2,
- Y,
-};
-
-inline std::ostream& operator<<(std::ostream& stream, const C& instance) {
- switch (instance) {
- case C::X: stream << "X"; break;
- case C::Y: stream << "Y"; break;
- }
- return stream;
-}
-
-struct A {
- int32_t _0;
-
- friend std::ostream& operator<<(std::ostream& stream, const A& instance) {
- return stream << "{ " << "_0=" << instance._0 << " }";
- }
-};
-
-struct B {
- int32_t x;
- float y;
-
- friend std::ostream& operator<<(std::ostream& stream, const B& instance) {
- return stream << "{ " << "x=" << instance.x << ", "
- << "y=" << instance.y << " }";
- }
-};
-
-struct D {
- uint8_t List;
- uintptr_t Of;
- B Things;
-
- friend std::ostream& operator<<(std::ostream& stream, const D& instance) {
- return stream << "{ " << "List=" << instance.List << ", "
- << "Of=" << instance.Of << ", "
- << "Things=" << instance.Things << " }";
- }
-};
-
-union F {
- enum class Tag : uint8_t {
- Foo,
- Bar,
- Baz,
- };
-
- friend std::ostream& operator<<(std::ostream& stream, const Tag& instance) {
- using Tag = F::Tag;
- switch (instance) {
- case Tag::Foo: stream << "Foo"; break;
- case Tag::Bar: stream << "Bar"; break;
- case Tag::Baz: stream << "Baz"; break;
- }
- return stream;
- }
-
- friend std::ostream& operator<<(std::ostream& stream, const F& instance) {
- using Tag = F::Tag;
- switch (instance.tag) {
- case Tag::Foo: stream << instance.foo; break;
- case Tag::Bar: stream << instance.bar; break;
- case Tag::Baz: stream << "Baz"; break;
- }
- return stream;
- }
-
- struct Foo_Body {
- Tag tag;
- int16_t _0;
-
- friend std::ostream& operator<<(std::ostream& stream, const Foo_Body& instance) {
- return stream << "{ " << "tag=" << instance.tag << ", "
- << "_0=" << instance._0 << " }";
- }
- };
-
- struct Bar_Body {
- Tag tag;
- uint8_t x;
- int16_t y;
-
- friend std::ostream& operator<<(std::ostream& stream, const Bar_Body& instance) {
- return stream << "{ " << "tag=" << instance.tag << ", "
- << "x=" << instance.x << ", "
- << "y=" << instance.y << " }";
- }
- };
-
- struct {
- Tag tag;
- };
- Foo_Body foo;
- Bar_Body bar;
-};
-
-struct H {
- enum class Tag : uint8_t {
- Hello,
- There,
- Everyone,
- };
-
- friend std::ostream& operator<<(std::ostream& stream, const Tag& instance) {
- using Tag = H::Tag;
- switch (instance) {
- case Tag::Hello: stream << "Hello"; break;
- case Tag::There: stream << "There"; break;
- case Tag::Everyone: stream << "Everyone"; break;
- }
- return stream;
- }
-
- friend std::ostream& operator<<(std::ostream& stream, const H& instance) {
- using Tag = H::Tag;
- switch (instance.tag) {
- case Tag::Hello: stream << "Hello" << instance.hello; break;
- case Tag::There: stream << "There" << instance.there; break;
- case Tag::Everyone: stream << "Everyone"; break;
- }
- return stream;
- }
-
- struct Hello_Body {
- int16_t _0;
-
- friend std::ostream& operator<<(std::ostream& stream, const Hello_Body& instance) {
- return stream << "{ " << "_0=" << instance._0 << " }";
- }
- };
-
- struct There_Body {
- uint8_t x;
- int16_t y;
-
- friend std::ostream& operator<<(std::ostream& stream, const There_Body& instance) {
- return stream << "{ " << "x=" << instance.x << ", "
- << "y=" << instance.y << " }";
- }
- };
-
- Tag tag;
- union {
- Hello_Body hello;
- There_Body there;
- };
-};
-
-struct I {
- enum class Tag : uint8_t {
- ThereAgain,
- SomethingElse,
- };
-
- struct ThereAgain_Body {
- uint8_t x;
- int16_t y;
-
- friend std::ostream& operator<<(std::ostream& stream, const ThereAgain_Body& instance) {
- return stream << "{ " << "x=" << instance.x << ", "
- << "y=" << instance.y << " }";
- }
- };
-
- Tag tag;
- union {
- ThereAgain_Body there_again;
- };
-};
-
-extern "C" {
-
-void root(A a, B b, C c, D d, F f, H h, I i);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/derive_ostream.tag.compat.c b/cbindgen-0.24.5/tests/expectations/derive_ostream.tag.compat.c
deleted file mode 100644
index 430564b..0000000
--- a/cbindgen-0.24.5/tests/expectations/derive_ostream.tag.compat.c
+++ /dev/null
@@ -1,121 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum C
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- X = 2,
- Y,
-};
-#ifndef __cplusplus
-typedef uint32_t C;
-#endif // __cplusplus
-
-struct A {
- int32_t _0;
-};
-
-struct B {
- int32_t x;
- float y;
-};
-
-struct D {
- uint8_t List;
- uintptr_t Of;
- struct B Things;
-};
-
-enum F_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Foo,
- Bar,
- Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t F_Tag;
-#endif // __cplusplus
-
-struct Bar_Body {
- F_Tag tag;
- uint8_t x;
- int16_t y;
-};
-
-union F {
- F_Tag tag;
- struct {
- F_Tag foo_tag;
- int16_t foo;
- };
- struct Bar_Body bar;
-};
-
-enum H_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Hello,
- There,
- Everyone,
-};
-#ifndef __cplusplus
-typedef uint8_t H_Tag;
-#endif // __cplusplus
-
-struct There_Body {
- uint8_t x;
- int16_t y;
-};
-
-struct H {
- H_Tag tag;
- union {
- struct {
- int16_t hello;
- };
- struct There_Body there;
- };
-};
-
-enum I_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- ThereAgain,
- SomethingElse,
-};
-#ifndef __cplusplus
-typedef uint8_t I_Tag;
-#endif // __cplusplus
-
-struct ThereAgain_Body {
- uint8_t x;
- int16_t y;
-};
-
-struct I {
- I_Tag tag;
- union {
- struct ThereAgain_Body there_again;
- };
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct A a, struct B b, C c, struct D d, union F f, struct H h, struct I i);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.both.compat.c b/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.both.compat.c
deleted file mode 100644
index 4392a8c..0000000
--- a/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.both.compat.c
+++ /dev/null
@@ -1,266 +0,0 @@
-#define NOINLINE __attribute__((noinline))
-#define NODISCARD [[nodiscard]]
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum FillRule
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- A,
- B,
-};
-#ifndef __cplusplus
-typedef uint8_t FillRule;
-#endif // __cplusplus
-
-/**
- * This will have a destructor manually implemented via variant_body, and
- * similarly a Drop impl in Rust.
- */
-typedef struct OwnedSlice_u32 {
- uintptr_t len;
- uint32_t *ptr;
-} OwnedSlice_u32;
-
-typedef struct Polygon_u32 {
- FillRule fill;
- struct OwnedSlice_u32 coordinates;
-} Polygon_u32;
-
-/**
- * This will have a destructor manually implemented via variant_body, and
- * similarly a Drop impl in Rust.
- */
-typedef struct OwnedSlice_i32 {
- uintptr_t len;
- int32_t *ptr;
-} OwnedSlice_i32;
-
-enum Foo_u32_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar_u32,
- Polygon1_u32,
- Slice1_u32,
- Slice2_u32,
- Slice3_u32,
- Slice4_u32,
-};
-#ifndef __cplusplus
-typedef uint8_t Foo_u32_Tag;
-#endif // __cplusplus
-
-typedef struct Slice3_Body_u32 {
- FillRule fill;
- struct OwnedSlice_u32 coords;
-} Slice3_Body_u32;
-
-typedef struct Slice4_Body_u32 {
- FillRule fill;
- struct OwnedSlice_i32 coords;
-} Slice4_Body_u32;
-
-typedef struct Foo_u32 {
- Foo_u32_Tag tag;
- union {
- struct {
- struct Polygon_u32 polygon1;
- };
- struct {
- struct OwnedSlice_u32 slice1;
- };
- struct {
- struct OwnedSlice_i32 slice2;
- };
- Slice3_Body_u32 slice3;
- Slice4_Body_u32 slice4;
- };
-} Foo_u32;
-
-typedef struct Polygon_i32 {
- FillRule fill;
- struct OwnedSlice_i32 coordinates;
-} Polygon_i32;
-
-enum Baz_i32_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar2_i32,
- Polygon21_i32,
- Slice21_i32,
- Slice22_i32,
- Slice23_i32,
- Slice24_i32,
-};
-#ifndef __cplusplus
-typedef uint8_t Baz_i32_Tag;
-#endif // __cplusplus
-
-typedef struct Slice23_Body_i32 {
- Baz_i32_Tag tag;
- FillRule fill;
- struct OwnedSlice_i32 coords;
-} Slice23_Body_i32;
-
-typedef struct Slice24_Body_i32 {
- Baz_i32_Tag tag;
- FillRule fill;
- struct OwnedSlice_i32 coords;
-} Slice24_Body_i32;
-
-typedef union Baz_i32 {
- Baz_i32_Tag tag;
- struct {
- Baz_i32_Tag polygon21_tag;
- struct Polygon_i32 polygon21;
- };
- struct {
- Baz_i32_Tag slice21_tag;
- struct OwnedSlice_i32 slice21;
- };
- struct {
- Baz_i32_Tag slice22_tag;
- struct OwnedSlice_i32 slice22;
- };
- Slice23_Body_i32 slice23;
- Slice24_Body_i32 slice24;
-} Baz_i32;
-
-enum Taz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar3,
- Taz1,
- Taz3,
-};
-#ifndef __cplusplus
-typedef uint8_t Taz_Tag;
-#endif // __cplusplus
-
-typedef union Taz {
- Taz_Tag tag;
- struct {
- Taz_Tag taz1_tag;
- int32_t taz1;
- };
- struct {
- Taz_Tag taz3_tag;
- struct OwnedSlice_i32 taz3;
- };
-} Taz;
-
-enum Tazz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar4,
- Taz2,
-};
-#ifndef __cplusplus
-typedef uint8_t Tazz_Tag;
-#endif // __cplusplus
-
-typedef union Tazz {
- Tazz_Tag tag;
- struct {
- Tazz_Tag taz2_tag;
- int32_t taz2;
- };
-} Tazz;
-
-enum Tazzz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar5,
- Taz5,
-};
-#ifndef __cplusplus
-typedef uint8_t Tazzz_Tag;
-#endif // __cplusplus
-
-typedef union Tazzz {
- Tazzz_Tag tag;
- struct {
- Tazzz_Tag taz5_tag;
- int32_t taz5;
- };
-} Tazzz;
-
-enum Tazzzz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Taz6,
- Taz7,
-};
-#ifndef __cplusplus
-typedef uint8_t Tazzzz_Tag;
-#endif // __cplusplus
-
-typedef union Tazzzz {
- Tazzzz_Tag tag;
- struct {
- Tazzzz_Tag taz6_tag;
- int32_t taz6;
- };
- struct {
- Tazzzz_Tag taz7_tag;
- uint32_t taz7;
- };
-} Tazzzz;
-
-enum Qux_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Qux1,
- Qux2,
-};
-#ifndef __cplusplus
-typedef uint8_t Qux_Tag;
-#endif // __cplusplus
-
-typedef union Qux {
- Qux_Tag tag;
- struct {
- Qux_Tag qux1_tag;
- int32_t qux1;
- };
- struct {
- Qux_Tag qux2_tag;
- uint32_t qux2;
- };
-} Qux;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const struct Foo_u32 *a,
- const union Baz_i32 *b,
- const union Taz *c,
- union Tazz d,
- const union Tazzz *e,
- const union Tazzzz *f,
- const union Qux *g);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.compat.c b/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.compat.c
deleted file mode 100644
index 832a5a4..0000000
--- a/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.compat.c
+++ /dev/null
@@ -1,266 +0,0 @@
-#define NOINLINE __attribute__((noinline))
-#define NODISCARD [[nodiscard]]
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum FillRule
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- A,
- B,
-};
-#ifndef __cplusplus
-typedef uint8_t FillRule;
-#endif // __cplusplus
-
-/**
- * This will have a destructor manually implemented via variant_body, and
- * similarly a Drop impl in Rust.
- */
-typedef struct {
- uintptr_t len;
- uint32_t *ptr;
-} OwnedSlice_u32;
-
-typedef struct {
- FillRule fill;
- OwnedSlice_u32 coordinates;
-} Polygon_u32;
-
-/**
- * This will have a destructor manually implemented via variant_body, and
- * similarly a Drop impl in Rust.
- */
-typedef struct {
- uintptr_t len;
- int32_t *ptr;
-} OwnedSlice_i32;
-
-enum Foo_u32_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar_u32,
- Polygon1_u32,
- Slice1_u32,
- Slice2_u32,
- Slice3_u32,
- Slice4_u32,
-};
-#ifndef __cplusplus
-typedef uint8_t Foo_u32_Tag;
-#endif // __cplusplus
-
-typedef struct {
- FillRule fill;
- OwnedSlice_u32 coords;
-} Slice3_Body_u32;
-
-typedef struct {
- FillRule fill;
- OwnedSlice_i32 coords;
-} Slice4_Body_u32;
-
-typedef struct {
- Foo_u32_Tag tag;
- union {
- struct {
- Polygon_u32 polygon1;
- };
- struct {
- OwnedSlice_u32 slice1;
- };
- struct {
- OwnedSlice_i32 slice2;
- };
- Slice3_Body_u32 slice3;
- Slice4_Body_u32 slice4;
- };
-} Foo_u32;
-
-typedef struct {
- FillRule fill;
- OwnedSlice_i32 coordinates;
-} Polygon_i32;
-
-enum Baz_i32_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar2_i32,
- Polygon21_i32,
- Slice21_i32,
- Slice22_i32,
- Slice23_i32,
- Slice24_i32,
-};
-#ifndef __cplusplus
-typedef uint8_t Baz_i32_Tag;
-#endif // __cplusplus
-
-typedef struct {
- Baz_i32_Tag tag;
- FillRule fill;
- OwnedSlice_i32 coords;
-} Slice23_Body_i32;
-
-typedef struct {
- Baz_i32_Tag tag;
- FillRule fill;
- OwnedSlice_i32 coords;
-} Slice24_Body_i32;
-
-typedef union {
- Baz_i32_Tag tag;
- struct {
- Baz_i32_Tag polygon21_tag;
- Polygon_i32 polygon21;
- };
- struct {
- Baz_i32_Tag slice21_tag;
- OwnedSlice_i32 slice21;
- };
- struct {
- Baz_i32_Tag slice22_tag;
- OwnedSlice_i32 slice22;
- };
- Slice23_Body_i32 slice23;
- Slice24_Body_i32 slice24;
-} Baz_i32;
-
-enum Taz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar3,
- Taz1,
- Taz3,
-};
-#ifndef __cplusplus
-typedef uint8_t Taz_Tag;
-#endif // __cplusplus
-
-typedef union {
- Taz_Tag tag;
- struct {
- Taz_Tag taz1_tag;
- int32_t taz1;
- };
- struct {
- Taz_Tag taz3_tag;
- OwnedSlice_i32 taz3;
- };
-} Taz;
-
-enum Tazz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar4,
- Taz2,
-};
-#ifndef __cplusplus
-typedef uint8_t Tazz_Tag;
-#endif // __cplusplus
-
-typedef union {
- Tazz_Tag tag;
- struct {
- Tazz_Tag taz2_tag;
- int32_t taz2;
- };
-} Tazz;
-
-enum Tazzz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar5,
- Taz5,
-};
-#ifndef __cplusplus
-typedef uint8_t Tazzz_Tag;
-#endif // __cplusplus
-
-typedef union {
- Tazzz_Tag tag;
- struct {
- Tazzz_Tag taz5_tag;
- int32_t taz5;
- };
-} Tazzz;
-
-enum Tazzzz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Taz6,
- Taz7,
-};
-#ifndef __cplusplus
-typedef uint8_t Tazzzz_Tag;
-#endif // __cplusplus
-
-typedef union {
- Tazzzz_Tag tag;
- struct {
- Tazzzz_Tag taz6_tag;
- int32_t taz6;
- };
- struct {
- Tazzzz_Tag taz7_tag;
- uint32_t taz7;
- };
-} Tazzzz;
-
-enum Qux_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Qux1,
- Qux2,
-};
-#ifndef __cplusplus
-typedef uint8_t Qux_Tag;
-#endif // __cplusplus
-
-typedef union {
- Qux_Tag tag;
- struct {
- Qux_Tag qux1_tag;
- int32_t qux1;
- };
- struct {
- Qux_Tag qux2_tag;
- uint32_t qux2;
- };
-} Qux;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo_u32 *a,
- const Baz_i32 *b,
- const Taz *c,
- Tazz d,
- const Tazzz *e,
- const Tazzzz *f,
- const Qux *g);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.cpp b/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.cpp
deleted file mode 100644
index 97110e4..0000000
--- a/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.cpp
+++ /dev/null
@@ -1,712 +0,0 @@
-#define NOINLINE __attribute__((noinline))
-#define NODISCARD [[nodiscard]]
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-enum class FillRule : uint8_t {
- A,
- B,
-};
-
-/// This will have a destructor manually implemented via variant_body, and
-/// similarly a Drop impl in Rust.
-template<typename T>
-struct OwnedSlice {
- uintptr_t len;
- T *ptr;
- ~OwnedSlice() {}
-};
-
-template<typename LengthPercentage>
-struct Polygon {
- FillRule fill;
- OwnedSlice<LengthPercentage> coordinates;
-};
-
-template<typename T>
-struct Foo {
- enum class Tag : uint8_t {
- Bar,
- Polygon1,
- Slice1,
- Slice2,
- Slice3,
- Slice4,
- };
-
- struct Polygon1_Body {
- Polygon<T> _0;
- };
-
- struct Slice1_Body {
- OwnedSlice<T> _0;
- };
-
- struct Slice2_Body {
- OwnedSlice<int32_t> _0;
- };
-
- struct Slice3_Body {
- FillRule fill;
- OwnedSlice<T> coords;
- };
-
- struct Slice4_Body {
- FillRule fill;
- OwnedSlice<int32_t> coords;
- };
-
- Tag tag;
- union {
- Polygon1_Body polygon1;
- Slice1_Body slice1;
- Slice2_Body slice2;
- Slice3_Body slice3;
- Slice4_Body slice4;
- };
-
- static Foo Bar() {
- Foo result;
- result.tag = Tag::Bar;
- return result;
- }
-
- bool IsBar() const {
- return tag == Tag::Bar;
- }
-
- static Foo Polygon1(const Polygon<T> &_0) {
- Foo result;
- ::new (&result.polygon1._0) (Polygon<T>)(_0);
- result.tag = Tag::Polygon1;
- return result;
- }
-
- bool IsPolygon1() const {
- return tag == Tag::Polygon1;
- }
-
- static Foo Slice1(const OwnedSlice<T> &_0) {
- Foo result;
- ::new (&result.slice1._0) (OwnedSlice<T>)(_0);
- result.tag = Tag::Slice1;
- return result;
- }
-
- bool IsSlice1() const {
- return tag == Tag::Slice1;
- }
-
- static Foo Slice2(const OwnedSlice<int32_t> &_0) {
- Foo result;
- ::new (&result.slice2._0) (OwnedSlice<int32_t>)(_0);
- result.tag = Tag::Slice2;
- return result;
- }
-
- bool IsSlice2() const {
- return tag == Tag::Slice2;
- }
-
- static Foo Slice3(const FillRule &fill,
- const OwnedSlice<T> &coords) {
- Foo result;
- ::new (&result.slice3.fill) (FillRule)(fill);
- ::new (&result.slice3.coords) (OwnedSlice<T>)(coords);
- result.tag = Tag::Slice3;
- return result;
- }
-
- bool IsSlice3() const {
- return tag == Tag::Slice3;
- }
-
- static Foo Slice4(const FillRule &fill,
- const OwnedSlice<int32_t> &coords) {
- Foo result;
- ::new (&result.slice4.fill) (FillRule)(fill);
- ::new (&result.slice4.coords) (OwnedSlice<int32_t>)(coords);
- result.tag = Tag::Slice4;
- return result;
- }
-
- bool IsSlice4() const {
- return tag == Tag::Slice4;
- }
-
- private:
- Foo() {
-
- }
- public:
-
-
- ~Foo() {
- switch (tag) {
- case Tag::Polygon1: polygon1.~Polygon1_Body(); break;
- case Tag::Slice1: slice1.~Slice1_Body(); break;
- case Tag::Slice2: slice2.~Slice2_Body(); break;
- case Tag::Slice3: slice3.~Slice3_Body(); break;
- case Tag::Slice4: slice4.~Slice4_Body(); break;
- default: break;
- }
- }
-
- Foo(const Foo& other)
- : tag(other.tag) {
- switch (tag) {
- case Tag::Polygon1: ::new (&polygon1) (Polygon1_Body)(other.polygon1); break;
- case Tag::Slice1: ::new (&slice1) (Slice1_Body)(other.slice1); break;
- case Tag::Slice2: ::new (&slice2) (Slice2_Body)(other.slice2); break;
- case Tag::Slice3: ::new (&slice3) (Slice3_Body)(other.slice3); break;
- case Tag::Slice4: ::new (&slice4) (Slice4_Body)(other.slice4); break;
- default: break;
- }
- }
- Foo& operator=(const Foo& other) {
- if (this != &other) {
- this->~Foo();
- new (this) Foo(other);
- }
- return *this;
- }
-};
-
-template<typename T>
-union Baz {
- enum class Tag : uint8_t {
- Bar2,
- Polygon21,
- Slice21,
- Slice22,
- Slice23,
- Slice24,
- };
-
- struct Polygon21_Body {
- Tag tag;
- Polygon<T> _0;
- };
-
- struct Slice21_Body {
- Tag tag;
- OwnedSlice<T> _0;
- };
-
- struct Slice22_Body {
- Tag tag;
- OwnedSlice<int32_t> _0;
- };
-
- struct Slice23_Body {
- Tag tag;
- FillRule fill;
- OwnedSlice<T> coords;
- };
-
- struct Slice24_Body {
- Tag tag;
- FillRule fill;
- OwnedSlice<int32_t> coords;
- };
-
- struct {
- Tag tag;
- };
- Polygon21_Body polygon21;
- Slice21_Body slice21;
- Slice22_Body slice22;
- Slice23_Body slice23;
- Slice24_Body slice24;
-
- static Baz Bar2() {
- Baz result;
- result.tag = Tag::Bar2;
- return result;
- }
-
- bool IsBar2() const {
- return tag == Tag::Bar2;
- }
-
- static Baz Polygon21(const Polygon<T> &_0) {
- Baz result;
- ::new (&result.polygon21._0) (Polygon<T>)(_0);
- result.tag = Tag::Polygon21;
- return result;
- }
-
- bool IsPolygon21() const {
- return tag == Tag::Polygon21;
- }
-
- static Baz Slice21(const OwnedSlice<T> &_0) {
- Baz result;
- ::new (&result.slice21._0) (OwnedSlice<T>)(_0);
- result.tag = Tag::Slice21;
- return result;
- }
-
- bool IsSlice21() const {
- return tag == Tag::Slice21;
- }
-
- static Baz Slice22(const OwnedSlice<int32_t> &_0) {
- Baz result;
- ::new (&result.slice22._0) (OwnedSlice<int32_t>)(_0);
- result.tag = Tag::Slice22;
- return result;
- }
-
- bool IsSlice22() const {
- return tag == Tag::Slice22;
- }
-
- static Baz Slice23(const FillRule &fill,
- const OwnedSlice<T> &coords) {
- Baz result;
- ::new (&result.slice23.fill) (FillRule)(fill);
- ::new (&result.slice23.coords) (OwnedSlice<T>)(coords);
- result.tag = Tag::Slice23;
- return result;
- }
-
- bool IsSlice23() const {
- return tag == Tag::Slice23;
- }
-
- static Baz Slice24(const FillRule &fill,
- const OwnedSlice<int32_t> &coords) {
- Baz result;
- ::new (&result.slice24.fill) (FillRule)(fill);
- ::new (&result.slice24.coords) (OwnedSlice<int32_t>)(coords);
- result.tag = Tag::Slice24;
- return result;
- }
-
- bool IsSlice24() const {
- return tag == Tag::Slice24;
- }
-
- private:
- Baz() {
-
- }
- public:
-
-
- ~Baz() {
- switch (tag) {
- case Tag::Polygon21: polygon21.~Polygon21_Body(); break;
- case Tag::Slice21: slice21.~Slice21_Body(); break;
- case Tag::Slice22: slice22.~Slice22_Body(); break;
- case Tag::Slice23: slice23.~Slice23_Body(); break;
- case Tag::Slice24: slice24.~Slice24_Body(); break;
- default: break;
- }
- }
-
- Baz(const Baz& other)
- : tag(other.tag) {
- switch (tag) {
- case Tag::Polygon21: ::new (&polygon21) (Polygon21_Body)(other.polygon21); break;
- case Tag::Slice21: ::new (&slice21) (Slice21_Body)(other.slice21); break;
- case Tag::Slice22: ::new (&slice22) (Slice22_Body)(other.slice22); break;
- case Tag::Slice23: ::new (&slice23) (Slice23_Body)(other.slice23); break;
- case Tag::Slice24: ::new (&slice24) (Slice24_Body)(other.slice24); break;
- default: break;
- }
- }
- Baz& operator=(const Baz& other) {
- if (this != &other) {
- this->~Baz();
- new (this) Baz(other);
- }
- return *this;
- }
-};
-
-union Taz {
- enum class Tag : uint8_t {
- Bar3,
- Taz1,
- Taz3,
- };
-
- struct Taz1_Body {
- Tag tag;
- int32_t _0;
- };
-
- struct Taz3_Body {
- Tag tag;
- OwnedSlice<int32_t> _0;
- };
-
- struct {
- Tag tag;
- };
- Taz1_Body taz1;
- Taz3_Body taz3;
-
- static Taz Bar3() {
- Taz result;
- result.tag = Tag::Bar3;
- return result;
- }
-
- bool IsBar3() const {
- return tag == Tag::Bar3;
- }
-
- static Taz Taz1(const int32_t &_0) {
- Taz result;
- ::new (&result.taz1._0) (int32_t)(_0);
- result.tag = Tag::Taz1;
- return result;
- }
-
- bool IsTaz1() const {
- return tag == Tag::Taz1;
- }
-
- static Taz Taz3(const OwnedSlice<int32_t> &_0) {
- Taz result;
- ::new (&result.taz3._0) (OwnedSlice<int32_t>)(_0);
- result.tag = Tag::Taz3;
- return result;
- }
-
- bool IsTaz3() const {
- return tag == Tag::Taz3;
- }
-
- private:
- Taz() {
-
- }
- public:
-
-
- ~Taz() {
- switch (tag) {
- case Tag::Taz1: taz1.~Taz1_Body(); break;
- case Tag::Taz3: taz3.~Taz3_Body(); break;
- default: break;
- }
- }
-
- Taz(const Taz& other)
- : tag(other.tag) {
- switch (tag) {
- case Tag::Taz1: ::new (&taz1) (Taz1_Body)(other.taz1); break;
- case Tag::Taz3: ::new (&taz3) (Taz3_Body)(other.taz3); break;
- default: break;
- }
- }
- Taz& operator=(const Taz& other) {
- if (this != &other) {
- this->~Taz();
- new (this) Taz(other);
- }
- return *this;
- }
-};
-
-union Tazz {
- enum class Tag : uint8_t {
- Bar4,
- Taz2,
- };
-
- struct Taz2_Body {
- Tag tag;
- int32_t _0;
- };
-
- struct {
- Tag tag;
- };
- Taz2_Body taz2;
-
- static Tazz Bar4() {
- Tazz result;
- result.tag = Tag::Bar4;
- return result;
- }
-
- bool IsBar4() const {
- return tag == Tag::Bar4;
- }
-
- static Tazz Taz2(const int32_t &_0) {
- Tazz result;
- ::new (&result.taz2._0) (int32_t)(_0);
- result.tag = Tag::Taz2;
- return result;
- }
-
- bool IsTaz2() const {
- return tag == Tag::Taz2;
- }
-
- private:
- Tazz() {
-
- }
- public:
-
-};
-
-union Tazzz {
- enum class Tag : uint8_t {
- Bar5,
- Taz5,
- };
-
- struct Taz5_Body {
- Tag tag;
- int32_t _0;
- };
-
- struct {
- Tag tag;
- };
- Taz5_Body taz5;
-
- static Tazzz Bar5() {
- Tazzz result;
- result.tag = Tag::Bar5;
- return result;
- }
-
- bool IsBar5() const {
- return tag == Tag::Bar5;
- }
-
- static Tazzz Taz5(const int32_t &_0) {
- Tazzz result;
- ::new (&result.taz5._0) (int32_t)(_0);
- result.tag = Tag::Taz5;
- return result;
- }
-
- bool IsTaz5() const {
- return tag == Tag::Taz5;
- }
-
- private:
- Tazzz() {
-
- }
- public:
-
-
- ~Tazzz() {
- switch (tag) {
- case Tag::Taz5: taz5.~Taz5_Body(); break;
- default: break;
- }
- }
-
- Tazzz(const Tazzz& other)
- : tag(other.tag) {
- switch (tag) {
- case Tag::Taz5: ::new (&taz5) (Taz5_Body)(other.taz5); break;
- default: break;
- }
- }
-};
-
-union Tazzzz {
- enum class Tag : uint8_t {
- Taz6,
- Taz7,
- };
-
- struct Taz6_Body {
- Tag tag;
- int32_t _0;
- };
-
- struct Taz7_Body {
- Tag tag;
- uint32_t _0;
- };
-
- struct {
- Tag tag;
- };
- Taz6_Body taz6;
- Taz7_Body taz7;
-
- static Tazzzz Taz6(const int32_t &_0) {
- Tazzzz result;
- ::new (&result.taz6._0) (int32_t)(_0);
- result.tag = Tag::Taz6;
- return result;
- }
-
- bool IsTaz6() const {
- return tag == Tag::Taz6;
- }
-
- static Tazzzz Taz7(const uint32_t &_0) {
- Tazzzz result;
- ::new (&result.taz7._0) (uint32_t)(_0);
- result.tag = Tag::Taz7;
- return result;
- }
-
- bool IsTaz7() const {
- return tag == Tag::Taz7;
- }
-
- private:
- Tazzzz() {
-
- }
- public:
-
-
- ~Tazzzz() {
- switch (tag) {
- case Tag::Taz6: taz6.~Taz6_Body(); break;
- case Tag::Taz7: taz7.~Taz7_Body(); break;
-
- }
- }
-
- Tazzzz(const Tazzzz& other)
- : tag(other.tag) {
- switch (tag) {
- case Tag::Taz6: ::new (&taz6) (Taz6_Body)(other.taz6); break;
- case Tag::Taz7: ::new (&taz7) (Taz7_Body)(other.taz7); break;
-
- }
- }
- Tazzzz& operator=(const Tazzzz& other) {
- if (this != &other) {
- this->~Tazzzz();
- new (this) Tazzzz(other);
- }
- return *this;
- }
-};
-
-union Qux {
- enum class Tag : uint8_t {
- Qux1,
- Qux2,
- };
-
- struct Qux1_Body {
- Tag tag;
- int32_t _0;
-
- bool operator==(const Qux1_Body& other) const {
- return _0 == other._0;
- }
- };
-
- struct Qux2_Body {
- Tag tag;
- uint32_t _0;
-
- bool operator==(const Qux2_Body& other) const {
- return _0 == other._0;
- }
- };
-
- struct {
- Tag tag;
- };
- Qux1_Body qux1;
- Qux2_Body qux2;
-
- static Qux Qux1(const int32_t &_0) {
- Qux result;
- ::new (&result.qux1._0) (int32_t)(_0);
- result.tag = Tag::Qux1;
- return result;
- }
-
- bool IsQux1() const {
- return tag == Tag::Qux1;
- }
-
- static Qux Qux2(const uint32_t &_0) {
- Qux result;
- ::new (&result.qux2._0) (uint32_t)(_0);
- result.tag = Tag::Qux2;
- return result;
- }
-
- bool IsQux2() const {
- return tag == Tag::Qux2;
- }
-
- NODISCARD bool operator==(const Qux& other) const {
- if (tag != other.tag) {
- return false;
- }
- switch (tag) {
- case Tag::Qux1: return qux1 == other.qux1;
- case Tag::Qux2: return qux2 == other.qux2;
-
- }
- return true;
- }
-
- NODISCARD bool operator!=(const Qux& other) const {
- return !(*this == other);
- }
-
- private:
- Qux() {
-
- }
- public:
-
-
- NOINLINE ~Qux() {
- switch (tag) {
- case Tag::Qux1: qux1.~Qux1_Body(); break;
- case Tag::Qux2: qux2.~Qux2_Body(); break;
-
- }
- }
-
- NOINLINE Qux(const Qux& other)
- : tag(other.tag) {
- switch (tag) {
- case Tag::Qux1: ::new (&qux1) (Qux1_Body)(other.qux1); break;
- case Tag::Qux2: ::new (&qux2) (Qux2_Body)(other.qux2); break;
-
- }
- }
- NOINLINE Qux& operator=(const Qux& other) {
- if (this != &other) {
- this->~Qux();
- new (this) Qux(other);
- }
- return *this;
- }
-};
-
-extern "C" {
-
-void root(const Foo<uint32_t> *a,
- const Baz<int32_t> *b,
- const Taz *c,
- Tazz d,
- const Tazzz *e,
- const Tazzzz *f,
- const Qux *g);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.tag.compat.c b/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.tag.compat.c
deleted file mode 100644
index 5724999..0000000
--- a/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.tag.compat.c
+++ /dev/null
@@ -1,266 +0,0 @@
-#define NOINLINE __attribute__((noinline))
-#define NODISCARD [[nodiscard]]
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum FillRule
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- A,
- B,
-};
-#ifndef __cplusplus
-typedef uint8_t FillRule;
-#endif // __cplusplus
-
-/**
- * This will have a destructor manually implemented via variant_body, and
- * similarly a Drop impl in Rust.
- */
-struct OwnedSlice_u32 {
- uintptr_t len;
- uint32_t *ptr;
-};
-
-struct Polygon_u32 {
- FillRule fill;
- struct OwnedSlice_u32 coordinates;
-};
-
-/**
- * This will have a destructor manually implemented via variant_body, and
- * similarly a Drop impl in Rust.
- */
-struct OwnedSlice_i32 {
- uintptr_t len;
- int32_t *ptr;
-};
-
-enum Foo_u32_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar_u32,
- Polygon1_u32,
- Slice1_u32,
- Slice2_u32,
- Slice3_u32,
- Slice4_u32,
-};
-#ifndef __cplusplus
-typedef uint8_t Foo_u32_Tag;
-#endif // __cplusplus
-
-struct Slice3_Body_u32 {
- FillRule fill;
- struct OwnedSlice_u32 coords;
-};
-
-struct Slice4_Body_u32 {
- FillRule fill;
- struct OwnedSlice_i32 coords;
-};
-
-struct Foo_u32 {
- Foo_u32_Tag tag;
- union {
- struct {
- struct Polygon_u32 polygon1;
- };
- struct {
- struct OwnedSlice_u32 slice1;
- };
- struct {
- struct OwnedSlice_i32 slice2;
- };
- struct Slice3_Body_u32 slice3;
- struct Slice4_Body_u32 slice4;
- };
-};
-
-struct Polygon_i32 {
- FillRule fill;
- struct OwnedSlice_i32 coordinates;
-};
-
-enum Baz_i32_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar2_i32,
- Polygon21_i32,
- Slice21_i32,
- Slice22_i32,
- Slice23_i32,
- Slice24_i32,
-};
-#ifndef __cplusplus
-typedef uint8_t Baz_i32_Tag;
-#endif // __cplusplus
-
-struct Slice23_Body_i32 {
- Baz_i32_Tag tag;
- FillRule fill;
- struct OwnedSlice_i32 coords;
-};
-
-struct Slice24_Body_i32 {
- Baz_i32_Tag tag;
- FillRule fill;
- struct OwnedSlice_i32 coords;
-};
-
-union Baz_i32 {
- Baz_i32_Tag tag;
- struct {
- Baz_i32_Tag polygon21_tag;
- struct Polygon_i32 polygon21;
- };
- struct {
- Baz_i32_Tag slice21_tag;
- struct OwnedSlice_i32 slice21;
- };
- struct {
- Baz_i32_Tag slice22_tag;
- struct OwnedSlice_i32 slice22;
- };
- struct Slice23_Body_i32 slice23;
- struct Slice24_Body_i32 slice24;
-};
-
-enum Taz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar3,
- Taz1,
- Taz3,
-};
-#ifndef __cplusplus
-typedef uint8_t Taz_Tag;
-#endif // __cplusplus
-
-union Taz {
- Taz_Tag tag;
- struct {
- Taz_Tag taz1_tag;
- int32_t taz1;
- };
- struct {
- Taz_Tag taz3_tag;
- struct OwnedSlice_i32 taz3;
- };
-};
-
-enum Tazz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar4,
- Taz2,
-};
-#ifndef __cplusplus
-typedef uint8_t Tazz_Tag;
-#endif // __cplusplus
-
-union Tazz {
- Tazz_Tag tag;
- struct {
- Tazz_Tag taz2_tag;
- int32_t taz2;
- };
-};
-
-enum Tazzz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Bar5,
- Taz5,
-};
-#ifndef __cplusplus
-typedef uint8_t Tazzz_Tag;
-#endif // __cplusplus
-
-union Tazzz {
- Tazzz_Tag tag;
- struct {
- Tazzz_Tag taz5_tag;
- int32_t taz5;
- };
-};
-
-enum Tazzzz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Taz6,
- Taz7,
-};
-#ifndef __cplusplus
-typedef uint8_t Tazzzz_Tag;
-#endif // __cplusplus
-
-union Tazzzz {
- Tazzzz_Tag tag;
- struct {
- Tazzzz_Tag taz6_tag;
- int32_t taz6;
- };
- struct {
- Tazzzz_Tag taz7_tag;
- uint32_t taz7;
- };
-};
-
-enum Qux_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Qux1,
- Qux2,
-};
-#ifndef __cplusplus
-typedef uint8_t Qux_Tag;
-#endif // __cplusplus
-
-union Qux {
- Qux_Tag tag;
- struct {
- Qux_Tag qux1_tag;
- int32_t qux1;
- };
- struct {
- Qux_Tag qux2_tag;
- uint32_t qux2;
- };
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const struct Foo_u32 *a,
- const union Baz_i32 *b,
- const union Taz *c,
- union Tazz d,
- const union Tazzz *e,
- const union Tazzzz *f,
- const union Qux *g);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/display_list.both.compat.c b/cbindgen-0.24.5/tests/expectations/display_list.both.compat.c
deleted file mode 100644
index 2a2e1d3..0000000
--- a/cbindgen-0.24.5/tests/expectations/display_list.both.compat.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Rect {
- float x;
- float y;
- float w;
- float h;
-} Rect;
-
-typedef struct Color {
- uint8_t r;
- uint8_t g;
- uint8_t b;
- uint8_t a;
-} Color;
-
-enum DisplayItem_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Fill,
- Image,
- ClearScreen,
-};
-#ifndef __cplusplus
-typedef uint8_t DisplayItem_Tag;
-#endif // __cplusplus
-
-typedef struct Fill_Body {
- DisplayItem_Tag tag;
- struct Rect _0;
- struct Color _1;
-} Fill_Body;
-
-typedef struct Image_Body {
- DisplayItem_Tag tag;
- uint32_t id;
- struct Rect bounds;
-} Image_Body;
-
-typedef union DisplayItem {
- DisplayItem_Tag tag;
- Fill_Body fill;
- Image_Body image;
-} DisplayItem;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-bool push_item(union DisplayItem item);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/display_list.compat.c b/cbindgen-0.24.5/tests/expectations/display_list.compat.c
deleted file mode 100644
index 164e4d0..0000000
--- a/cbindgen-0.24.5/tests/expectations/display_list.compat.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- float x;
- float y;
- float w;
- float h;
-} Rect;
-
-typedef struct {
- uint8_t r;
- uint8_t g;
- uint8_t b;
- uint8_t a;
-} Color;
-
-enum DisplayItem_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Fill,
- Image,
- ClearScreen,
-};
-#ifndef __cplusplus
-typedef uint8_t DisplayItem_Tag;
-#endif // __cplusplus
-
-typedef struct {
- DisplayItem_Tag tag;
- Rect _0;
- Color _1;
-} Fill_Body;
-
-typedef struct {
- DisplayItem_Tag tag;
- uint32_t id;
- Rect bounds;
-} Image_Body;
-
-typedef union {
- DisplayItem_Tag tag;
- Fill_Body fill;
- Image_Body image;
-} DisplayItem;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-bool push_item(DisplayItem item);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/display_list.cpp b/cbindgen-0.24.5/tests/expectations/display_list.cpp
deleted file mode 100644
index b65fc14..0000000
--- a/cbindgen-0.24.5/tests/expectations/display_list.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Rect {
- float x;
- float y;
- float w;
- float h;
-};
-
-struct Color {
- uint8_t r;
- uint8_t g;
- uint8_t b;
- uint8_t a;
-};
-
-union DisplayItem {
- enum class Tag : uint8_t {
- Fill,
- Image,
- ClearScreen,
- };
-
- struct Fill_Body {
- Tag tag;
- Rect _0;
- Color _1;
- };
-
- struct Image_Body {
- Tag tag;
- uint32_t id;
- Rect bounds;
- };
-
- struct {
- Tag tag;
- };
- Fill_Body fill;
- Image_Body image;
-};
-
-extern "C" {
-
-bool push_item(DisplayItem item);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/display_list.tag.compat.c b/cbindgen-0.24.5/tests/expectations/display_list.tag.compat.c
deleted file mode 100644
index 86f9165..0000000
--- a/cbindgen-0.24.5/tests/expectations/display_list.tag.compat.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Rect {
- float x;
- float y;
- float w;
- float h;
-};
-
-struct Color {
- uint8_t r;
- uint8_t g;
- uint8_t b;
- uint8_t a;
-};
-
-enum DisplayItem_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Fill,
- Image,
- ClearScreen,
-};
-#ifndef __cplusplus
-typedef uint8_t DisplayItem_Tag;
-#endif // __cplusplus
-
-struct Fill_Body {
- DisplayItem_Tag tag;
- struct Rect _0;
- struct Color _1;
-};
-
-struct Image_Body {
- DisplayItem_Tag tag;
- uint32_t id;
- struct Rect bounds;
-};
-
-union DisplayItem {
- DisplayItem_Tag tag;
- struct Fill_Body fill;
- struct Image_Body image;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-bool push_item(union DisplayItem item);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/doclength_short.compat.c b/cbindgen-0.24.5/tests/expectations/doclength_short.compat.c
deleted file mode 100644
index c871ab2..0000000
--- a/cbindgen-0.24.5/tests/expectations/doclength_short.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-/**
- * The root of all evil.
- */
-void root(void);
-
-/**
- * A little above the root, and a lot more visible, with a run-on sentence
- */
-void trunk(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/doclength_short.cpp b/cbindgen-0.24.5/tests/expectations/doclength_short.cpp
deleted file mode 100644
index 162a050..0000000
--- a/cbindgen-0.24.5/tests/expectations/doclength_short.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-/// The root of all evil.
-void root();
-
-/// A little above the root, and a lot more visible, with a run-on sentence
-void trunk();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/docstyle_auto.compat.c b/cbindgen-0.24.5/tests/expectations/docstyle_auto.compat.c
deleted file mode 100644
index c1c2987..0000000
--- a/cbindgen-0.24.5/tests/expectations/docstyle_auto.compat.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-/**
- * The root of all evil.
- */
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/docstyle_auto.cpp b/cbindgen-0.24.5/tests/expectations/docstyle_auto.cpp
deleted file mode 100644
index e303a45..0000000
--- a/cbindgen-0.24.5/tests/expectations/docstyle_auto.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-/// The root of all evil.
-void root();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/docstyle_c99.compat.c b/cbindgen-0.24.5/tests/expectations/docstyle_c99.compat.c
deleted file mode 100644
index 2e5caf8..0000000
--- a/cbindgen-0.24.5/tests/expectations/docstyle_c99.compat.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-// The root of all evil.
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/docstyle_c99.cpp b/cbindgen-0.24.5/tests/expectations/docstyle_c99.cpp
deleted file mode 100644
index b0aa7c0..0000000
--- a/cbindgen-0.24.5/tests/expectations/docstyle_c99.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-// The root of all evil.
-void root();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/docstyle_doxy.compat.c b/cbindgen-0.24.5/tests/expectations/docstyle_doxy.compat.c
deleted file mode 100644
index c1c2987..0000000
--- a/cbindgen-0.24.5/tests/expectations/docstyle_doxy.compat.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-/**
- * The root of all evil.
- */
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/docstyle_doxy.cpp b/cbindgen-0.24.5/tests/expectations/docstyle_doxy.cpp
deleted file mode 100644
index c5097e5..0000000
--- a/cbindgen-0.24.5/tests/expectations/docstyle_doxy.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-/**
- * The root of all evil.
- */
-void root();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/documentation.c b/cbindgen-0.24.5/tests/expectations/documentation.c
deleted file mode 100644
index e455b8d..0000000
--- a/cbindgen-0.24.5/tests/expectations/documentation.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-/**
- * The root of all evil.
- *
- * But at least it contains some more documentation as someone would expect
- * from a simple test case like this.
- *
- * # Hint
- *
- * Always ensure that everything is properly documented, even if you feel lazy.
- * **Sometimes** it is also helpful to include some markdown formatting.
- *
- * ////////////////////////////////////////////////////////////////////////////
- *
- * Attention:
- *
- * Rust is going to trim all leading `/` symbols. If you want to use them as a
- * marker you need to add at least a single whitespace inbetween the tripple
- * slash doc-comment marker and the rest.
- *
- */
-void root(void);
diff --git a/cbindgen-0.24.5/tests/expectations/documentation.compat.c b/cbindgen-0.24.5/tests/expectations/documentation.compat.c
deleted file mode 100644
index fcdb544..0000000
--- a/cbindgen-0.24.5/tests/expectations/documentation.compat.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-/**
- * The root of all evil.
- *
- * But at least it contains some more documentation as someone would expect
- * from a simple test case like this.
- *
- * # Hint
- *
- * Always ensure that everything is properly documented, even if you feel lazy.
- * **Sometimes** it is also helpful to include some markdown formatting.
- *
- * ////////////////////////////////////////////////////////////////////////////
- *
- * Attention:
- *
- * Rust is going to trim all leading `/` symbols. If you want to use them as a
- * marker you need to add at least a single whitespace inbetween the tripple
- * slash doc-comment marker and the rest.
- *
- */
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/documentation.cpp b/cbindgen-0.24.5/tests/expectations/documentation.cpp
deleted file mode 100644
index ec2b8be..0000000
--- a/cbindgen-0.24.5/tests/expectations/documentation.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-/// The root of all evil.
-///
-/// But at least it contains some more documentation as someone would expect
-/// from a simple test case like this.
-///
-/// # Hint
-///
-/// Always ensure that everything is properly documented, even if you feel lazy.
-/// **Sometimes** it is also helpful to include some markdown formatting.
-///
-/// ////////////////////////////////////////////////////////////////////////////
-///
-/// Attention:
-///
-/// Rust is going to trim all leading `/` symbols. If you want to use them as a
-/// marker you need to add at least a single whitespace inbetween the tripple
-/// slash doc-comment marker and the rest.
-///
-void root();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/documentation.pyx b/cbindgen-0.24.5/tests/expectations/documentation.pyx
deleted file mode 100644
index 340b38a..0000000
--- a/cbindgen-0.24.5/tests/expectations/documentation.pyx
+++ /dev/null
@@ -1,27 +0,0 @@
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- # The root of all evil.
- #
- # But at least it contains some more documentation as someone would expect
- # from a simple test case like this.
- #
- # # Hint
- #
- # Always ensure that everything is properly documented, even if you feel lazy.
- # **Sometimes** it is also helpful to include some markdown formatting.
- #
- # ////////////////////////////////////////////////////////////////////////////
- #
- # Attention:
- #
- # Rust is going to trim all leading `/` symbols. If you want to use them as a
- # marker you need to add at least a single whitespace inbetween the tripple
- # slash doc-comment marker and the rest.
- #
- void root();
diff --git a/cbindgen-0.24.5/tests/expectations/documentation_attr.compat.c b/cbindgen-0.24.5/tests/expectations/documentation_attr.compat.c
deleted file mode 100644
index e7fe43b..0000000
--- a/cbindgen-0.24.5/tests/expectations/documentation_attr.compat.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-/**
- *With doc attr, each attr contribute to one line of document
- *like this one with a new line character at its end
- *and this one as well. So they are in the same paragraph
- *
- *Line ends with one new line should not break
- *
- *Line ends with two spaces and a new line
- *should break to next line
- *
- *Line ends with two new lines
- *
- *Should break to next paragraph
- */
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/documentation_attr.cpp b/cbindgen-0.24.5/tests/expectations/documentation_attr.cpp
deleted file mode 100644
index 5f98573..0000000
--- a/cbindgen-0.24.5/tests/expectations/documentation_attr.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-///With doc attr, each attr contribute to one line of document
-///like this one with a new line character at its end
-///and this one as well. So they are in the same paragraph
-///
-///Line ends with one new line should not break
-///
-///Line ends with two spaces and a new line
-///should break to next line
-///
-///Line ends with two new lines
-///
-///Should break to next paragraph
-void root();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/enum.both.compat.c b/cbindgen-0.24.5/tests/expectations/enum.both.compat.c
deleted file mode 100644
index 88d59a7..0000000
--- a/cbindgen-0.24.5/tests/expectations/enum.both.compat.c
+++ /dev/null
@@ -1,335 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using Box = T*;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum A
-#ifdef __cplusplus
- : uint64_t
-#endif // __cplusplus
- {
- a1 = 0,
- a2 = 2,
- a3,
- a4 = 5,
-};
-#ifndef __cplusplus
-typedef uint64_t A;
-#endif // __cplusplus
-
-enum B
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- b1 = 0,
- b2 = 2,
- b3,
- b4 = 5,
-};
-#ifndef __cplusplus
-typedef uint32_t B;
-#endif // __cplusplus
-
-enum C
-#ifdef __cplusplus
- : uint16_t
-#endif // __cplusplus
- {
- c1 = 0,
- c2 = 2,
- c3,
- c4 = 5,
-};
-#ifndef __cplusplus
-typedef uint16_t C;
-#endif // __cplusplus
-
-enum D
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- d1 = 0,
- d2 = 2,
- d3,
- d4 = 5,
-};
-#ifndef __cplusplus
-typedef uint8_t D;
-#endif // __cplusplus
-
-enum E
-#ifdef __cplusplus
- : uintptr_t
-#endif // __cplusplus
- {
- e1 = 0,
- e2 = 2,
- e3,
- e4 = 5,
-};
-#ifndef __cplusplus
-typedef uintptr_t E;
-#endif // __cplusplus
-
-enum F
-#ifdef __cplusplus
- : intptr_t
-#endif // __cplusplus
- {
- f1 = 0,
- f2 = 2,
- f3,
- f4 = 5,
-};
-#ifndef __cplusplus
-typedef intptr_t F;
-#endif // __cplusplus
-
-typedef enum L {
- l1,
- l2,
- l3,
- l4,
-} L;
-
-enum M
-#ifdef __cplusplus
- : int8_t
-#endif // __cplusplus
- {
- m1 = -1,
- m2 = 0,
- m3 = 1,
-};
-#ifndef __cplusplus
-typedef int8_t M;
-#endif // __cplusplus
-
-typedef enum N {
- n1,
- n2,
- n3,
- n4,
-} N;
-
-enum O
-#ifdef __cplusplus
- : int8_t
-#endif // __cplusplus
- {
- o1,
- o2,
- o3,
- o4,
-};
-#ifndef __cplusplus
-typedef int8_t O;
-#endif // __cplusplus
-
-typedef struct J J;
-
-typedef struct K K;
-
-typedef struct Opaque Opaque;
-
-enum G_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Foo,
- Bar,
- Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t G_Tag;
-#endif // __cplusplus
-
-typedef struct Bar_Body {
- G_Tag tag;
- uint8_t x;
- int16_t y;
-} Bar_Body;
-
-typedef union G {
- G_Tag tag;
- struct {
- G_Tag foo_tag;
- int16_t foo;
- };
- Bar_Body bar;
-} G;
-
-typedef enum H_Tag {
- H_Foo,
- H_Bar,
- H_Baz,
-} H_Tag;
-
-typedef struct H_Bar_Body {
- uint8_t x;
- int16_t y;
-} H_Bar_Body;
-
-typedef struct H {
- H_Tag tag;
- union {
- struct {
- int16_t foo;
- };
- H_Bar_Body bar;
- };
-} H;
-
-enum ExI_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- ExI_Foo,
- ExI_Bar,
- ExI_Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t ExI_Tag;
-#endif // __cplusplus
-
-typedef struct ExI_Bar_Body {
- uint8_t x;
- int16_t y;
-} ExI_Bar_Body;
-
-typedef struct ExI {
- ExI_Tag tag;
- union {
- struct {
- int16_t foo;
- };
- ExI_Bar_Body bar;
- };
-} ExI;
-
-enum P_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- P0,
- P1,
-};
-#ifndef __cplusplus
-typedef uint8_t P_Tag;
-#endif // __cplusplus
-
-typedef struct P1_Body {
- uint8_t _0;
- uint8_t _1;
- uint8_t _2;
-} P1_Body;
-
-typedef struct P {
- P_Tag tag;
- union {
- struct {
- uint8_t p0;
- };
- P1_Body p1;
- };
-} P;
-
-typedef enum Q_Tag {
- Ok,
- Err,
-} Q_Tag;
-
-typedef struct Q {
- Q_Tag tag;
- union {
- struct {
- uint32_t *ok;
- };
- struct {
- uint32_t err;
- };
- };
-} Q;
-
-typedef enum R_Tag {
- IRFoo,
- IRBar,
- IRBaz,
-} R_Tag;
-
-typedef struct IRBar_Body {
- uint8_t x;
- int16_t y;
-} IRBar_Body;
-
-typedef struct R {
- R_Tag tag;
- union {
- struct {
- int16_t IRFoo;
- };
- IRBar_Body IRBar;
- };
-} R;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Opaque *opaque,
- A a,
- B b,
- C c,
- D d,
- E e,
- F f,
- union G g,
- struct H h,
- struct ExI i,
- struct J j,
- struct K k,
- enum L l,
- M m,
- enum N n,
- O o,
- struct P p,
- struct Q q,
- struct R r);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#if 0
-''' '
-#endif
-
-#include <stddef.h>
-#include "testing-helpers.h"
-static_assert(offsetof(CBINDGEN_STRUCT(P), tag) == 0, "unexpected offset for tag");
-static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p0");
-static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p1");
-static_assert(sizeof(CBINDGEN_STRUCT(P)) == 4, "unexpected size for P");
-
-#if 0
-' '''
-#endif
diff --git a/cbindgen-0.24.5/tests/expectations/enum.compat.c b/cbindgen-0.24.5/tests/expectations/enum.compat.c
deleted file mode 100644
index 3dc7c33..0000000
--- a/cbindgen-0.24.5/tests/expectations/enum.compat.c
+++ /dev/null
@@ -1,335 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using Box = T*;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum A
-#ifdef __cplusplus
- : uint64_t
-#endif // __cplusplus
- {
- a1 = 0,
- a2 = 2,
- a3,
- a4 = 5,
-};
-#ifndef __cplusplus
-typedef uint64_t A;
-#endif // __cplusplus
-
-enum B
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- b1 = 0,
- b2 = 2,
- b3,
- b4 = 5,
-};
-#ifndef __cplusplus
-typedef uint32_t B;
-#endif // __cplusplus
-
-enum C
-#ifdef __cplusplus
- : uint16_t
-#endif // __cplusplus
- {
- c1 = 0,
- c2 = 2,
- c3,
- c4 = 5,
-};
-#ifndef __cplusplus
-typedef uint16_t C;
-#endif // __cplusplus
-
-enum D
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- d1 = 0,
- d2 = 2,
- d3,
- d4 = 5,
-};
-#ifndef __cplusplus
-typedef uint8_t D;
-#endif // __cplusplus
-
-enum E
-#ifdef __cplusplus
- : uintptr_t
-#endif // __cplusplus
- {
- e1 = 0,
- e2 = 2,
- e3,
- e4 = 5,
-};
-#ifndef __cplusplus
-typedef uintptr_t E;
-#endif // __cplusplus
-
-enum F
-#ifdef __cplusplus
- : intptr_t
-#endif // __cplusplus
- {
- f1 = 0,
- f2 = 2,
- f3,
- f4 = 5,
-};
-#ifndef __cplusplus
-typedef intptr_t F;
-#endif // __cplusplus
-
-typedef enum {
- l1,
- l2,
- l3,
- l4,
-} L;
-
-enum M
-#ifdef __cplusplus
- : int8_t
-#endif // __cplusplus
- {
- m1 = -1,
- m2 = 0,
- m3 = 1,
-};
-#ifndef __cplusplus
-typedef int8_t M;
-#endif // __cplusplus
-
-typedef enum {
- n1,
- n2,
- n3,
- n4,
-} N;
-
-enum O
-#ifdef __cplusplus
- : int8_t
-#endif // __cplusplus
- {
- o1,
- o2,
- o3,
- o4,
-};
-#ifndef __cplusplus
-typedef int8_t O;
-#endif // __cplusplus
-
-typedef struct J J;
-
-typedef struct K K;
-
-typedef struct Opaque Opaque;
-
-enum G_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Foo,
- Bar,
- Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t G_Tag;
-#endif // __cplusplus
-
-typedef struct {
- G_Tag tag;
- uint8_t x;
- int16_t y;
-} Bar_Body;
-
-typedef union {
- G_Tag tag;
- struct {
- G_Tag foo_tag;
- int16_t foo;
- };
- Bar_Body bar;
-} G;
-
-typedef enum {
- H_Foo,
- H_Bar,
- H_Baz,
-} H_Tag;
-
-typedef struct {
- uint8_t x;
- int16_t y;
-} H_Bar_Body;
-
-typedef struct {
- H_Tag tag;
- union {
- struct {
- int16_t foo;
- };
- H_Bar_Body bar;
- };
-} H;
-
-enum ExI_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- ExI_Foo,
- ExI_Bar,
- ExI_Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t ExI_Tag;
-#endif // __cplusplus
-
-typedef struct {
- uint8_t x;
- int16_t y;
-} ExI_Bar_Body;
-
-typedef struct {
- ExI_Tag tag;
- union {
- struct {
- int16_t foo;
- };
- ExI_Bar_Body bar;
- };
-} ExI;
-
-enum P_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- P0,
- P1,
-};
-#ifndef __cplusplus
-typedef uint8_t P_Tag;
-#endif // __cplusplus
-
-typedef struct {
- uint8_t _0;
- uint8_t _1;
- uint8_t _2;
-} P1_Body;
-
-typedef struct {
- P_Tag tag;
- union {
- struct {
- uint8_t p0;
- };
- P1_Body p1;
- };
-} P;
-
-typedef enum {
- Ok,
- Err,
-} Q_Tag;
-
-typedef struct {
- Q_Tag tag;
- union {
- struct {
- uint32_t *ok;
- };
- struct {
- uint32_t err;
- };
- };
-} Q;
-
-typedef enum {
- IRFoo,
- IRBar,
- IRBaz,
-} R_Tag;
-
-typedef struct {
- uint8_t x;
- int16_t y;
-} IRBar_Body;
-
-typedef struct {
- R_Tag tag;
- union {
- struct {
- int16_t IRFoo;
- };
- IRBar_Body IRBar;
- };
-} R;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Opaque *opaque,
- A a,
- B b,
- C c,
- D d,
- E e,
- F f,
- G g,
- H h,
- ExI i,
- J j,
- K k,
- L l,
- M m,
- N n,
- O o,
- P p,
- Q q,
- R r);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#if 0
-''' '
-#endif
-
-#include <stddef.h>
-#include "testing-helpers.h"
-static_assert(offsetof(CBINDGEN_STRUCT(P), tag) == 0, "unexpected offset for tag");
-static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p0");
-static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p1");
-static_assert(sizeof(CBINDGEN_STRUCT(P)) == 4, "unexpected size for P");
-
-#if 0
-' '''
-#endif
diff --git a/cbindgen-0.24.5/tests/expectations/enum.cpp b/cbindgen-0.24.5/tests/expectations/enum.cpp
deleted file mode 100644
index 2f16218..0000000
--- a/cbindgen-0.24.5/tests/expectations/enum.cpp
+++ /dev/null
@@ -1,271 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using Box = T*;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-enum class A : uint64_t {
- a1 = 0,
- a2 = 2,
- a3,
- a4 = 5,
-};
-
-enum class B : uint32_t {
- b1 = 0,
- b2 = 2,
- b3,
- b4 = 5,
-};
-
-enum class C : uint16_t {
- c1 = 0,
- c2 = 2,
- c3,
- c4 = 5,
-};
-
-enum class D : uint8_t {
- d1 = 0,
- d2 = 2,
- d3,
- d4 = 5,
-};
-
-enum class E : uintptr_t {
- e1 = 0,
- e2 = 2,
- e3,
- e4 = 5,
-};
-
-enum class F : intptr_t {
- f1 = 0,
- f2 = 2,
- f3,
- f4 = 5,
-};
-
-enum class L {
- l1,
- l2,
- l3,
- l4,
-};
-
-enum class M : int8_t {
- m1 = -1,
- m2 = 0,
- m3 = 1,
-};
-
-enum N {
- n1,
- n2,
- n3,
- n4,
-};
-
-enum O : int8_t {
- o1,
- o2,
- o3,
- o4,
-};
-
-struct J;
-
-struct K;
-
-struct Opaque;
-
-union G {
- enum class Tag : uint8_t {
- Foo,
- Bar,
- Baz,
- };
-
- struct Foo_Body {
- Tag tag;
- int16_t _0;
- };
-
- struct Bar_Body {
- Tag tag;
- uint8_t x;
- int16_t y;
- };
-
- struct {
- Tag tag;
- };
- Foo_Body foo;
- Bar_Body bar;
-};
-
-struct H {
- enum class Tag {
- H_Foo,
- H_Bar,
- H_Baz,
- };
-
- struct H_Foo_Body {
- int16_t _0;
- };
-
- struct H_Bar_Body {
- uint8_t x;
- int16_t y;
- };
-
- Tag tag;
- union {
- H_Foo_Body foo;
- H_Bar_Body bar;
- };
-};
-
-struct ExI {
- enum class Tag : uint8_t {
- ExI_Foo,
- ExI_Bar,
- ExI_Baz,
- };
-
- struct ExI_Foo_Body {
- int16_t _0;
- };
-
- struct ExI_Bar_Body {
- uint8_t x;
- int16_t y;
- };
-
- Tag tag;
- union {
- ExI_Foo_Body foo;
- ExI_Bar_Body bar;
- };
-};
-
-struct P {
- enum class Tag : uint8_t {
- P0,
- P1,
- };
-
- struct P0_Body {
- uint8_t _0;
- };
-
- struct P1_Body {
- uint8_t _0;
- uint8_t _1;
- uint8_t _2;
- };
-
- Tag tag;
- union {
- P0_Body p0;
- P1_Body p1;
- };
-};
-
-struct Q {
- enum class Tag {
- Ok,
- Err,
- };
-
- struct Ok_Body {
- Box<uint32_t> _0;
- };
-
- struct Err_Body {
- uint32_t _0;
- };
-
- Tag tag;
- union {
- Ok_Body ok;
- Err_Body err;
- };
-};
-
-struct R {
- enum class Tag {
- IRFoo,
- IRBar,
- IRBaz,
- };
-
- struct IRFoo_Body {
- int16_t _0;
- };
-
- struct IRBar_Body {
- uint8_t x;
- int16_t y;
- };
-
- Tag tag;
- union {
- IRFoo_Body IRFoo;
- IRBar_Body IRBar;
- };
-};
-
-extern "C" {
-
-void root(Opaque *opaque,
- A a,
- B b,
- C c,
- D d,
- E e,
- F f,
- G g,
- H h,
- ExI i,
- J j,
- K k,
- L l,
- M m,
- N n,
- O o,
- P p,
- Q q,
- R r);
-
-} // extern "C"
-
-#if 0
-''' '
-#endif
-
-#include <stddef.h>
-#include "testing-helpers.h"
-static_assert(offsetof(CBINDGEN_STRUCT(P), tag) == 0, "unexpected offset for tag");
-static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p0");
-static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p1");
-static_assert(sizeof(CBINDGEN_STRUCT(P)) == 4, "unexpected size for P");
-
-#if 0
-' '''
-#endif
diff --git a/cbindgen-0.24.5/tests/expectations/enum.tag.compat.c b/cbindgen-0.24.5/tests/expectations/enum.tag.compat.c
deleted file mode 100644
index 73d64ba..0000000
--- a/cbindgen-0.24.5/tests/expectations/enum.tag.compat.c
+++ /dev/null
@@ -1,335 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using Box = T*;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum A
-#ifdef __cplusplus
- : uint64_t
-#endif // __cplusplus
- {
- a1 = 0,
- a2 = 2,
- a3,
- a4 = 5,
-};
-#ifndef __cplusplus
-typedef uint64_t A;
-#endif // __cplusplus
-
-enum B
-#ifdef __cplusplus
- : uint32_t
-#endif // __cplusplus
- {
- b1 = 0,
- b2 = 2,
- b3,
- b4 = 5,
-};
-#ifndef __cplusplus
-typedef uint32_t B;
-#endif // __cplusplus
-
-enum C
-#ifdef __cplusplus
- : uint16_t
-#endif // __cplusplus
- {
- c1 = 0,
- c2 = 2,
- c3,
- c4 = 5,
-};
-#ifndef __cplusplus
-typedef uint16_t C;
-#endif // __cplusplus
-
-enum D
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- d1 = 0,
- d2 = 2,
- d3,
- d4 = 5,
-};
-#ifndef __cplusplus
-typedef uint8_t D;
-#endif // __cplusplus
-
-enum E
-#ifdef __cplusplus
- : uintptr_t
-#endif // __cplusplus
- {
- e1 = 0,
- e2 = 2,
- e3,
- e4 = 5,
-};
-#ifndef __cplusplus
-typedef uintptr_t E;
-#endif // __cplusplus
-
-enum F
-#ifdef __cplusplus
- : intptr_t
-#endif // __cplusplus
- {
- f1 = 0,
- f2 = 2,
- f3,
- f4 = 5,
-};
-#ifndef __cplusplus
-typedef intptr_t F;
-#endif // __cplusplus
-
-enum L {
- l1,
- l2,
- l3,
- l4,
-};
-
-enum M
-#ifdef __cplusplus
- : int8_t
-#endif // __cplusplus
- {
- m1 = -1,
- m2 = 0,
- m3 = 1,
-};
-#ifndef __cplusplus
-typedef int8_t M;
-#endif // __cplusplus
-
-enum N {
- n1,
- n2,
- n3,
- n4,
-};
-
-enum O
-#ifdef __cplusplus
- : int8_t
-#endif // __cplusplus
- {
- o1,
- o2,
- o3,
- o4,
-};
-#ifndef __cplusplus
-typedef int8_t O;
-#endif // __cplusplus
-
-struct J;
-
-struct K;
-
-struct Opaque;
-
-enum G_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Foo,
- Bar,
- Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t G_Tag;
-#endif // __cplusplus
-
-struct Bar_Body {
- G_Tag tag;
- uint8_t x;
- int16_t y;
-};
-
-union G {
- G_Tag tag;
- struct {
- G_Tag foo_tag;
- int16_t foo;
- };
- struct Bar_Body bar;
-};
-
-enum H_Tag {
- H_Foo,
- H_Bar,
- H_Baz,
-};
-
-struct H_Bar_Body {
- uint8_t x;
- int16_t y;
-};
-
-struct H {
- enum H_Tag tag;
- union {
- struct {
- int16_t foo;
- };
- struct H_Bar_Body bar;
- };
-};
-
-enum ExI_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- ExI_Foo,
- ExI_Bar,
- ExI_Baz,
-};
-#ifndef __cplusplus
-typedef uint8_t ExI_Tag;
-#endif // __cplusplus
-
-struct ExI_Bar_Body {
- uint8_t x;
- int16_t y;
-};
-
-struct ExI {
- ExI_Tag tag;
- union {
- struct {
- int16_t foo;
- };
- struct ExI_Bar_Body bar;
- };
-};
-
-enum P_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- P0,
- P1,
-};
-#ifndef __cplusplus
-typedef uint8_t P_Tag;
-#endif // __cplusplus
-
-struct P1_Body {
- uint8_t _0;
- uint8_t _1;
- uint8_t _2;
-};
-
-struct P {
- P_Tag tag;
- union {
- struct {
- uint8_t p0;
- };
- struct P1_Body p1;
- };
-};
-
-enum Q_Tag {
- Ok,
- Err,
-};
-
-struct Q {
- enum Q_Tag tag;
- union {
- struct {
- uint32_t *ok;
- };
- struct {
- uint32_t err;
- };
- };
-};
-
-enum R_Tag {
- IRFoo,
- IRBar,
- IRBaz,
-};
-
-struct IRBar_Body {
- uint8_t x;
- int16_t y;
-};
-
-struct R {
- enum R_Tag tag;
- union {
- struct {
- int16_t IRFoo;
- };
- struct IRBar_Body IRBar;
- };
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Opaque *opaque,
- A a,
- B b,
- C c,
- D d,
- E e,
- F f,
- union G g,
- struct H h,
- struct ExI i,
- struct J j,
- struct K k,
- enum L l,
- M m,
- enum N n,
- O o,
- struct P p,
- struct Q q,
- struct R r);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#if 0
-''' '
-#endif
-
-#include <stddef.h>
-#include "testing-helpers.h"
-static_assert(offsetof(CBINDGEN_STRUCT(P), tag) == 0, "unexpected offset for tag");
-static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p0");
-static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p1");
-static_assert(sizeof(CBINDGEN_STRUCT(P)) == 4, "unexpected size for P");
-
-#if 0
-' '''
-#endif
diff --git a/cbindgen-0.24.5/tests/expectations/enum_discriminant.compat.c b/cbindgen-0.24.5/tests/expectations/enum_discriminant.compat.c
deleted file mode 100644
index be57fde..0000000
--- a/cbindgen-0.24.5/tests/expectations/enum_discriminant.compat.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define FOURTY_FOUR 4
-
-enum E
-#ifdef __cplusplus
- : int8_t
-#endif // __cplusplus
- {
- A = 1,
- B = -1,
- C = (1 + 2),
- D = FOURTY_FOUR,
- F = 5,
- G = (int8_t)54,
- H = (int8_t)false,
-};
-#ifndef __cplusplus
-typedef int8_t E;
-#endif // __cplusplus
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const E*);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/enum_discriminant.cpp b/cbindgen-0.24.5/tests/expectations/enum_discriminant.cpp
deleted file mode 100644
index 8183823..0000000
--- a/cbindgen-0.24.5/tests/expectations/enum_discriminant.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-constexpr static const int8_t FOURTY_FOUR = 4;
-
-enum class E : int8_t {
- A = 1,
- B = -1,
- C = (1 + 2),
- D = FOURTY_FOUR,
- F = 5,
- G = (int8_t)54,
- H = (int8_t)false,
-};
-
-extern "C" {
-
-void root(const E*);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/enum_self.both.compat.c b/cbindgen-0.24.5/tests/expectations/enum_self.both.compat.c
deleted file mode 100644
index 2b17fa5..0000000
--- a/cbindgen-0.24.5/tests/expectations/enum_self.both.compat.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo_Bar {
- const int32_t *something;
-} Foo_Bar;
-
-enum Bar_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Min,
- Max,
- Other,
-};
-#ifndef __cplusplus
-typedef uint8_t Bar_Tag;
-#endif // __cplusplus
-
-typedef union Bar {
- Bar_Tag tag;
- struct {
- Bar_Tag min_tag;
- struct Foo_Bar min;
- };
- struct {
- Bar_Tag max_tag;
- struct Foo_Bar max;
- };
-} Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(union Bar b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/enum_self.compat.c b/cbindgen-0.24.5/tests/expectations/enum_self.compat.c
deleted file mode 100644
index b52e3df..0000000
--- a/cbindgen-0.24.5/tests/expectations/enum_self.compat.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- const int32_t *something;
-} Foo_Bar;
-
-enum Bar_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Min,
- Max,
- Other,
-};
-#ifndef __cplusplus
-typedef uint8_t Bar_Tag;
-#endif // __cplusplus
-
-typedef union {
- Bar_Tag tag;
- struct {
- Bar_Tag min_tag;
- Foo_Bar min;
- };
- struct {
- Bar_Tag max_tag;
- Foo_Bar max;
- };
-} Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Bar b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/enum_self.cpp b/cbindgen-0.24.5/tests/expectations/enum_self.cpp
deleted file mode 100644
index c25dbeb..0000000
--- a/cbindgen-0.24.5/tests/expectations/enum_self.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T>
-struct Foo {
- const int32_t *something;
-};
-
-union Bar {
- enum class Tag : uint8_t {
- Min,
- Max,
- Other,
- };
-
- struct Min_Body {
- Tag tag;
- Foo<Bar> _0;
- };
-
- struct Max_Body {
- Tag tag;
- Foo<Bar> _0;
- };
-
- struct {
- Tag tag;
- };
- Min_Body min;
- Max_Body max;
-};
-
-extern "C" {
-
-void root(Bar b);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/enum_self.tag.compat.c b/cbindgen-0.24.5/tests/expectations/enum_self.tag.compat.c
deleted file mode 100644
index 575f3e2..0000000
--- a/cbindgen-0.24.5/tests/expectations/enum_self.tag.compat.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo_Bar {
- const int32_t *something;
-};
-
-enum Bar_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Min,
- Max,
- Other,
-};
-#ifndef __cplusplus
-typedef uint8_t Bar_Tag;
-#endif // __cplusplus
-
-union Bar {
- Bar_Tag tag;
- struct {
- Bar_Tag min_tag;
- struct Foo_Bar min;
- };
- struct {
- Bar_Tag max_tag;
- struct Foo_Bar max;
- };
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(union Bar b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/euclid.both.compat.c b/cbindgen-0.24.5/tests/expectations/euclid.both.compat.c
deleted file mode 100644
index e4f9b90..0000000
--- a/cbindgen-0.24.5/tests/expectations/euclid.both.compat.c
+++ /dev/null
@@ -1,125 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct TypedLength_f32__UnknownUnit {
- float _0;
-} TypedLength_f32__UnknownUnit;
-
-typedef struct TypedLength_f32__LayoutUnit {
- float _0;
-} TypedLength_f32__LayoutUnit;
-
-typedef struct TypedLength_f32__UnknownUnit Length_f32;
-
-typedef struct TypedLength_f32__LayoutUnit LayoutLength;
-
-typedef struct TypedSideOffsets2D_f32__UnknownUnit {
- float top;
- float right;
- float bottom;
- float left;
-} TypedSideOffsets2D_f32__UnknownUnit;
-
-typedef struct TypedSideOffsets2D_f32__LayoutUnit {
- float top;
- float right;
- float bottom;
- float left;
-} TypedSideOffsets2D_f32__LayoutUnit;
-
-typedef struct TypedSideOffsets2D_f32__UnknownUnit SideOffsets2D_f32;
-
-typedef struct TypedSideOffsets2D_f32__LayoutUnit LayoutSideOffsets2D;
-
-typedef struct TypedSize2D_f32__UnknownUnit {
- float width;
- float height;
-} TypedSize2D_f32__UnknownUnit;
-
-typedef struct TypedSize2D_f32__LayoutUnit {
- float width;
- float height;
-} TypedSize2D_f32__LayoutUnit;
-
-typedef struct TypedSize2D_f32__UnknownUnit Size2D_f32;
-
-typedef struct TypedSize2D_f32__LayoutUnit LayoutSize2D;
-
-typedef struct TypedPoint2D_f32__UnknownUnit {
- float x;
- float y;
-} TypedPoint2D_f32__UnknownUnit;
-
-typedef struct TypedPoint2D_f32__LayoutUnit {
- float x;
- float y;
-} TypedPoint2D_f32__LayoutUnit;
-
-typedef struct TypedPoint2D_f32__UnknownUnit Point2D_f32;
-
-typedef struct TypedPoint2D_f32__LayoutUnit LayoutPoint2D;
-
-typedef struct TypedRect_f32__UnknownUnit {
- struct TypedPoint2D_f32__UnknownUnit origin;
- struct TypedSize2D_f32__UnknownUnit size;
-} TypedRect_f32__UnknownUnit;
-
-typedef struct TypedRect_f32__LayoutUnit {
- struct TypedPoint2D_f32__LayoutUnit origin;
- struct TypedSize2D_f32__LayoutUnit size;
-} TypedRect_f32__LayoutUnit;
-
-typedef struct TypedRect_f32__UnknownUnit Rect_f32;
-
-typedef struct TypedRect_f32__LayoutUnit LayoutRect;
-
-typedef struct TypedTransform2D_f32__UnknownUnit__LayoutUnit {
- float m11;
- float m12;
- float m21;
- float m22;
- float m31;
- float m32;
-} TypedTransform2D_f32__UnknownUnit__LayoutUnit;
-
-typedef struct TypedTransform2D_f32__LayoutUnit__UnknownUnit {
- float m11;
- float m12;
- float m21;
- float m22;
- float m31;
- float m32;
-} TypedTransform2D_f32__LayoutUnit__UnknownUnit;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct TypedLength_f32__UnknownUnit length_a,
- struct TypedLength_f32__LayoutUnit length_b,
- Length_f32 length_c,
- LayoutLength length_d,
- struct TypedSideOffsets2D_f32__UnknownUnit side_offsets_a,
- struct TypedSideOffsets2D_f32__LayoutUnit side_offsets_b,
- SideOffsets2D_f32 side_offsets_c,
- LayoutSideOffsets2D side_offsets_d,
- struct TypedSize2D_f32__UnknownUnit size_a,
- struct TypedSize2D_f32__LayoutUnit size_b,
- Size2D_f32 size_c,
- LayoutSize2D size_d,
- struct TypedPoint2D_f32__UnknownUnit point_a,
- struct TypedPoint2D_f32__LayoutUnit point_b,
- Point2D_f32 point_c,
- LayoutPoint2D point_d,
- struct TypedRect_f32__UnknownUnit rect_a,
- struct TypedRect_f32__LayoutUnit rect_b,
- Rect_f32 rect_c,
- LayoutRect rect_d,
- struct TypedTransform2D_f32__UnknownUnit__LayoutUnit transform_a,
- struct TypedTransform2D_f32__LayoutUnit__UnknownUnit transform_b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/euclid.compat.c b/cbindgen-0.24.5/tests/expectations/euclid.compat.c
deleted file mode 100644
index 9a261dc..0000000
--- a/cbindgen-0.24.5/tests/expectations/euclid.compat.c
+++ /dev/null
@@ -1,125 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- float _0;
-} TypedLength_f32__UnknownUnit;
-
-typedef struct {
- float _0;
-} TypedLength_f32__LayoutUnit;
-
-typedef TypedLength_f32__UnknownUnit Length_f32;
-
-typedef TypedLength_f32__LayoutUnit LayoutLength;
-
-typedef struct {
- float top;
- float right;
- float bottom;
- float left;
-} TypedSideOffsets2D_f32__UnknownUnit;
-
-typedef struct {
- float top;
- float right;
- float bottom;
- float left;
-} TypedSideOffsets2D_f32__LayoutUnit;
-
-typedef TypedSideOffsets2D_f32__UnknownUnit SideOffsets2D_f32;
-
-typedef TypedSideOffsets2D_f32__LayoutUnit LayoutSideOffsets2D;
-
-typedef struct {
- float width;
- float height;
-} TypedSize2D_f32__UnknownUnit;
-
-typedef struct {
- float width;
- float height;
-} TypedSize2D_f32__LayoutUnit;
-
-typedef TypedSize2D_f32__UnknownUnit Size2D_f32;
-
-typedef TypedSize2D_f32__LayoutUnit LayoutSize2D;
-
-typedef struct {
- float x;
- float y;
-} TypedPoint2D_f32__UnknownUnit;
-
-typedef struct {
- float x;
- float y;
-} TypedPoint2D_f32__LayoutUnit;
-
-typedef TypedPoint2D_f32__UnknownUnit Point2D_f32;
-
-typedef TypedPoint2D_f32__LayoutUnit LayoutPoint2D;
-
-typedef struct {
- TypedPoint2D_f32__UnknownUnit origin;
- TypedSize2D_f32__UnknownUnit size;
-} TypedRect_f32__UnknownUnit;
-
-typedef struct {
- TypedPoint2D_f32__LayoutUnit origin;
- TypedSize2D_f32__LayoutUnit size;
-} TypedRect_f32__LayoutUnit;
-
-typedef TypedRect_f32__UnknownUnit Rect_f32;
-
-typedef TypedRect_f32__LayoutUnit LayoutRect;
-
-typedef struct {
- float m11;
- float m12;
- float m21;
- float m22;
- float m31;
- float m32;
-} TypedTransform2D_f32__UnknownUnit__LayoutUnit;
-
-typedef struct {
- float m11;
- float m12;
- float m21;
- float m22;
- float m31;
- float m32;
-} TypedTransform2D_f32__LayoutUnit__UnknownUnit;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(TypedLength_f32__UnknownUnit length_a,
- TypedLength_f32__LayoutUnit length_b,
- Length_f32 length_c,
- LayoutLength length_d,
- TypedSideOffsets2D_f32__UnknownUnit side_offsets_a,
- TypedSideOffsets2D_f32__LayoutUnit side_offsets_b,
- SideOffsets2D_f32 side_offsets_c,
- LayoutSideOffsets2D side_offsets_d,
- TypedSize2D_f32__UnknownUnit size_a,
- TypedSize2D_f32__LayoutUnit size_b,
- Size2D_f32 size_c,
- LayoutSize2D size_d,
- TypedPoint2D_f32__UnknownUnit point_a,
- TypedPoint2D_f32__LayoutUnit point_b,
- Point2D_f32 point_c,
- LayoutPoint2D point_d,
- TypedRect_f32__UnknownUnit rect_a,
- TypedRect_f32__LayoutUnit rect_b,
- Rect_f32 rect_c,
- LayoutRect rect_d,
- TypedTransform2D_f32__UnknownUnit__LayoutUnit transform_a,
- TypedTransform2D_f32__LayoutUnit__UnknownUnit transform_b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/euclid.cpp b/cbindgen-0.24.5/tests/expectations/euclid.cpp
deleted file mode 100644
index 36c8085..0000000
--- a/cbindgen-0.24.5/tests/expectations/euclid.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct LayoutUnit;
-
-struct UnknownUnit;
-
-template<typename T, typename Unit>
-struct TypedLength {
- T _0;
-};
-
-template<typename T>
-using Length = TypedLength<T, UnknownUnit>;
-
-using LayoutLength = TypedLength<float, LayoutUnit>;
-
-template<typename T, typename U>
-struct TypedSideOffsets2D {
- T top;
- T right;
- T bottom;
- T left;
-};
-
-template<typename T>
-using SideOffsets2D = TypedSideOffsets2D<T, UnknownUnit>;
-
-using LayoutSideOffsets2D = TypedSideOffsets2D<float, LayoutUnit>;
-
-template<typename T, typename U>
-struct TypedSize2D {
- T width;
- T height;
-};
-
-template<typename T>
-using Size2D = TypedSize2D<T, UnknownUnit>;
-
-using LayoutSize2D = TypedSize2D<float, LayoutUnit>;
-
-template<typename T, typename U>
-struct TypedPoint2D {
- T x;
- T y;
-};
-
-template<typename T>
-using Point2D = TypedPoint2D<T, UnknownUnit>;
-
-using LayoutPoint2D = TypedPoint2D<float, LayoutUnit>;
-
-template<typename T, typename U>
-struct TypedRect {
- TypedPoint2D<T, U> origin;
- TypedSize2D<T, U> size;
-};
-
-template<typename T>
-using Rect = TypedRect<T, UnknownUnit>;
-
-using LayoutRect = TypedRect<float, LayoutUnit>;
-
-template<typename T, typename Src, typename Dst>
-struct TypedTransform2D {
- T m11;
- T m12;
- T m21;
- T m22;
- T m31;
- T m32;
-};
-
-extern "C" {
-
-void root(TypedLength<float, UnknownUnit> length_a,
- TypedLength<float, LayoutUnit> length_b,
- Length<float> length_c,
- LayoutLength length_d,
- TypedSideOffsets2D<float, UnknownUnit> side_offsets_a,
- TypedSideOffsets2D<float, LayoutUnit> side_offsets_b,
- SideOffsets2D<float> side_offsets_c,
- LayoutSideOffsets2D side_offsets_d,
- TypedSize2D<float, UnknownUnit> size_a,
- TypedSize2D<float, LayoutUnit> size_b,
- Size2D<float> size_c,
- LayoutSize2D size_d,
- TypedPoint2D<float, UnknownUnit> point_a,
- TypedPoint2D<float, LayoutUnit> point_b,
- Point2D<float> point_c,
- LayoutPoint2D point_d,
- TypedRect<float, UnknownUnit> rect_a,
- TypedRect<float, LayoutUnit> rect_b,
- Rect<float> rect_c,
- LayoutRect rect_d,
- TypedTransform2D<float, UnknownUnit, LayoutUnit> transform_a,
- TypedTransform2D<float, LayoutUnit, UnknownUnit> transform_b);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/euclid.tag.compat.c b/cbindgen-0.24.5/tests/expectations/euclid.tag.compat.c
deleted file mode 100644
index 61f6c04..0000000
--- a/cbindgen-0.24.5/tests/expectations/euclid.tag.compat.c
+++ /dev/null
@@ -1,125 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct TypedLength_f32__UnknownUnit {
- float _0;
-};
-
-struct TypedLength_f32__LayoutUnit {
- float _0;
-};
-
-typedef struct TypedLength_f32__UnknownUnit Length_f32;
-
-typedef struct TypedLength_f32__LayoutUnit LayoutLength;
-
-struct TypedSideOffsets2D_f32__UnknownUnit {
- float top;
- float right;
- float bottom;
- float left;
-};
-
-struct TypedSideOffsets2D_f32__LayoutUnit {
- float top;
- float right;
- float bottom;
- float left;
-};
-
-typedef struct TypedSideOffsets2D_f32__UnknownUnit SideOffsets2D_f32;
-
-typedef struct TypedSideOffsets2D_f32__LayoutUnit LayoutSideOffsets2D;
-
-struct TypedSize2D_f32__UnknownUnit {
- float width;
- float height;
-};
-
-struct TypedSize2D_f32__LayoutUnit {
- float width;
- float height;
-};
-
-typedef struct TypedSize2D_f32__UnknownUnit Size2D_f32;
-
-typedef struct TypedSize2D_f32__LayoutUnit LayoutSize2D;
-
-struct TypedPoint2D_f32__UnknownUnit {
- float x;
- float y;
-};
-
-struct TypedPoint2D_f32__LayoutUnit {
- float x;
- float y;
-};
-
-typedef struct TypedPoint2D_f32__UnknownUnit Point2D_f32;
-
-typedef struct TypedPoint2D_f32__LayoutUnit LayoutPoint2D;
-
-struct TypedRect_f32__UnknownUnit {
- struct TypedPoint2D_f32__UnknownUnit origin;
- struct TypedSize2D_f32__UnknownUnit size;
-};
-
-struct TypedRect_f32__LayoutUnit {
- struct TypedPoint2D_f32__LayoutUnit origin;
- struct TypedSize2D_f32__LayoutUnit size;
-};
-
-typedef struct TypedRect_f32__UnknownUnit Rect_f32;
-
-typedef struct TypedRect_f32__LayoutUnit LayoutRect;
-
-struct TypedTransform2D_f32__UnknownUnit__LayoutUnit {
- float m11;
- float m12;
- float m21;
- float m22;
- float m31;
- float m32;
-};
-
-struct TypedTransform2D_f32__LayoutUnit__UnknownUnit {
- float m11;
- float m12;
- float m21;
- float m22;
- float m31;
- float m32;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct TypedLength_f32__UnknownUnit length_a,
- struct TypedLength_f32__LayoutUnit length_b,
- Length_f32 length_c,
- LayoutLength length_d,
- struct TypedSideOffsets2D_f32__UnknownUnit side_offsets_a,
- struct TypedSideOffsets2D_f32__LayoutUnit side_offsets_b,
- SideOffsets2D_f32 side_offsets_c,
- LayoutSideOffsets2D side_offsets_d,
- struct TypedSize2D_f32__UnknownUnit size_a,
- struct TypedSize2D_f32__LayoutUnit size_b,
- Size2D_f32 size_c,
- LayoutSize2D size_d,
- struct TypedPoint2D_f32__UnknownUnit point_a,
- struct TypedPoint2D_f32__LayoutUnit point_b,
- Point2D_f32 point_c,
- LayoutPoint2D point_d,
- struct TypedRect_f32__UnknownUnit rect_a,
- struct TypedRect_f32__LayoutUnit rect_b,
- Rect_f32 rect_c,
- LayoutRect rect_d,
- struct TypedTransform2D_f32__UnknownUnit__LayoutUnit transform_a,
- struct TypedTransform2D_f32__LayoutUnit__UnknownUnit transform_b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.both.compat.c b/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.both.compat.c
deleted file mode 100644
index 3c1037e..0000000
--- a/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.both.compat.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <stdint.h>
-
-#if 0
-''' '
-#endif
-
-typedef uint64_t Option_Foo;
-
-#if 0
-' '''
-#endif
-
-#if 0
-from libc.stdint cimport uint64_t
-ctypedef uint64_t Option_Foo
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Bar {
- Option_Foo foo;
-} Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Bar f);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.compat.c b/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.compat.c
deleted file mode 100644
index 5c10d43..0000000
--- a/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.compat.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <stdint.h>
-
-#if 0
-''' '
-#endif
-
-typedef uint64_t Option_Foo;
-
-#if 0
-' '''
-#endif
-
-#if 0
-from libc.stdint cimport uint64_t
-ctypedef uint64_t Option_Foo
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- Option_Foo foo;
-} Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Bar f);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.tag.compat.c b/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.tag.compat.c
deleted file mode 100644
index fa8e3a1..0000000
--- a/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.tag.compat.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <stdint.h>
-
-#if 0
-''' '
-#endif
-
-typedef uint64_t Option_Foo;
-
-#if 0
-' '''
-#endif
-
-#if 0
-from libc.stdint cimport uint64_t
-ctypedef uint64_t Option_Foo
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Bar {
- Option_Foo foo;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Bar f);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand.both.compat.c b/cbindgen-0.24.5/tests/expectations/expand.both.compat.c
deleted file mode 100644
index 5a235ae..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand.both.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo {
-
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand.compat.c b/cbindgen-0.24.5/tests/expectations/expand.compat.c
deleted file mode 100644
index 173a130..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
-
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand.cpp b/cbindgen-0.24.5/tests/expectations/expand.cpp
deleted file mode 100644
index da67d07..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Foo {
-
-};
-
-extern "C" {
-
-void root(Foo a);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/expand.tag.compat.c b/cbindgen-0.24.5/tests/expectations/expand.tag.compat.c
deleted file mode 100644
index 144f9d2..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand.tag.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo {
-
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_default_features.both.compat.c b/cbindgen-0.24.5/tests/expectations/expand_default_features.both.compat.c
deleted file mode 100644
index ce7318c..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_default_features.both.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo {
-
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void extra_debug_fn(void);
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_default_features.compat.c b/cbindgen-0.24.5/tests/expectations/expand_default_features.compat.c
deleted file mode 100644
index a35c097..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_default_features.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
-
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void extra_debug_fn(void);
-
-void root(Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_default_features.cpp b/cbindgen-0.24.5/tests/expectations/expand_default_features.cpp
deleted file mode 100644
index 57b6e2c..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_default_features.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Foo {
-
-};
-
-extern "C" {
-
-void extra_debug_fn();
-
-void root(Foo a);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/expand_default_features.tag.compat.c b/cbindgen-0.24.5/tests/expectations/expand_default_features.tag.compat.c
deleted file mode 100644
index 8180ac6..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_default_features.tag.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo {
-
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void extra_debug_fn(void);
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep.both.c b/cbindgen-0.24.5/tests/expectations/expand_dep.both.c
deleted file mode 100644
index 9a91a4f..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep.both.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct dep_struct {
- uint32_t x;
- double y;
-} dep_struct;
-
-uint32_t get_x(const struct dep_struct *dep_struct);
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep.both.compat.c b/cbindgen-0.24.5/tests/expectations/expand_dep.both.compat.c
deleted file mode 100644
index 9cd14e4..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep.both.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct dep_struct {
- uint32_t x;
- double y;
-} dep_struct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-uint32_t get_x(const struct dep_struct *dep_struct);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep.compat.c b/cbindgen-0.24.5/tests/expectations/expand_dep.compat.c
deleted file mode 100644
index 4dc7fb3..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- uint32_t x;
- double y;
-} dep_struct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-uint32_t get_x(const dep_struct *dep_struct);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep.cpp b/cbindgen-0.24.5/tests/expectations/expand_dep.cpp
deleted file mode 100644
index 914b798..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct dep_struct {
- uint32_t x;
- double y;
-};
-
-extern "C" {
-
-uint32_t get_x(const dep_struct *dep_struct);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep.tag.c b/cbindgen-0.24.5/tests/expectations/expand_dep.tag.c
deleted file mode 100644
index 45fcba6..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep.tag.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct dep_struct {
- uint32_t x;
- double y;
-};
-
-uint32_t get_x(const struct dep_struct *dep_struct);
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep.tag.compat.c b/cbindgen-0.24.5/tests/expectations/expand_dep.tag.compat.c
deleted file mode 100644
index 344af64..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep.tag.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct dep_struct {
- uint32_t x;
- double y;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-uint32_t get_x(const struct dep_struct *dep_struct);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep.tag.pyx b/cbindgen-0.24.5/tests/expectations/expand_dep.tag.pyx
deleted file mode 100644
index 74d296b..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep.tag.pyx
+++ /dev/null
@@ -1,13 +0,0 @@
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- cdef struct dep_struct:
- uint32_t x;
- double y;
-
- uint32_t get_x(const dep_struct *dep_struct);
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.both.c b/cbindgen-0.24.5/tests/expectations/expand_dep_v2.both.c
deleted file mode 100644
index 9a91a4f..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.both.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct dep_struct {
- uint32_t x;
- double y;
-} dep_struct;
-
-uint32_t get_x(const struct dep_struct *dep_struct);
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.both.compat.c b/cbindgen-0.24.5/tests/expectations/expand_dep_v2.both.compat.c
deleted file mode 100644
index 9cd14e4..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.both.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct dep_struct {
- uint32_t x;
- double y;
-} dep_struct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-uint32_t get_x(const struct dep_struct *dep_struct);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.compat.c b/cbindgen-0.24.5/tests/expectations/expand_dep_v2.compat.c
deleted file mode 100644
index 4dc7fb3..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- uint32_t x;
- double y;
-} dep_struct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-uint32_t get_x(const dep_struct *dep_struct);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.cpp b/cbindgen-0.24.5/tests/expectations/expand_dep_v2.cpp
deleted file mode 100644
index 914b798..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct dep_struct {
- uint32_t x;
- double y;
-};
-
-extern "C" {
-
-uint32_t get_x(const dep_struct *dep_struct);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.tag.c b/cbindgen-0.24.5/tests/expectations/expand_dep_v2.tag.c
deleted file mode 100644
index 45fcba6..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.tag.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct dep_struct {
- uint32_t x;
- double y;
-};
-
-uint32_t get_x(const struct dep_struct *dep_struct);
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.tag.compat.c b/cbindgen-0.24.5/tests/expectations/expand_dep_v2.tag.compat.c
deleted file mode 100644
index 344af64..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.tag.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct dep_struct {
- uint32_t x;
- double y;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-uint32_t get_x(const struct dep_struct *dep_struct);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.tag.pyx b/cbindgen-0.24.5/tests/expectations/expand_dep_v2.tag.pyx
deleted file mode 100644
index 74d296b..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.tag.pyx
+++ /dev/null
@@ -1,13 +0,0 @@
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- cdef struct dep_struct:
- uint32_t x;
- double y;
-
- uint32_t get_x(const dep_struct *dep_struct);
diff --git a/cbindgen-0.24.5/tests/expectations/expand_features.both.compat.c b/cbindgen-0.24.5/tests/expectations/expand_features.both.compat.c
deleted file mode 100644
index e3ef2a6..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_features.both.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo {
-
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void extra_debug_fn(void);
-
-void cbindgen(void);
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_features.compat.c b/cbindgen-0.24.5/tests/expectations/expand_features.compat.c
deleted file mode 100644
index b65adc0..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_features.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
-
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void extra_debug_fn(void);
-
-void cbindgen(void);
-
-void root(Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_features.cpp b/cbindgen-0.24.5/tests/expectations/expand_features.cpp
deleted file mode 100644
index 9174b12..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_features.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Foo {
-
-};
-
-extern "C" {
-
-void extra_debug_fn();
-
-void cbindgen();
-
-void root(Foo a);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/expand_features.tag.compat.c b/cbindgen-0.24.5/tests/expectations/expand_features.tag.compat.c
deleted file mode 100644
index ee9d430..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_features.tag.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo {
-
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void extra_debug_fn(void);
-
-void cbindgen(void);
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.both.c b/cbindgen-0.24.5/tests/expectations/expand_no_default_features.both.c
deleted file mode 100644
index 7c7e0c9..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.both.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo {
-
-} Foo;
-
-void root(struct Foo a);
diff --git a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.both.compat.c b/cbindgen-0.24.5/tests/expectations/expand_no_default_features.both.compat.c
deleted file mode 100644
index 5a235ae..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.both.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo {
-
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.compat.c b/cbindgen-0.24.5/tests/expectations/expand_no_default_features.compat.c
deleted file mode 100644
index 173a130..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
-
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.cpp b/cbindgen-0.24.5/tests/expectations/expand_no_default_features.cpp
deleted file mode 100644
index da67d07..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Foo {
-
-};
-
-extern "C" {
-
-void root(Foo a);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.tag.c b/cbindgen-0.24.5/tests/expectations/expand_no_default_features.tag.c
deleted file mode 100644
index 96ededa..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.tag.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo {
-
-};
-
-void root(struct Foo a);
diff --git a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.tag.compat.c b/cbindgen-0.24.5/tests/expectations/expand_no_default_features.tag.compat.c
deleted file mode 100644
index 144f9d2..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.tag.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo {
-
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.tag.pyx b/cbindgen-0.24.5/tests/expectations/expand_no_default_features.tag.pyx
deleted file mode 100644
index 977a424..0000000
--- a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.tag.pyx
+++ /dev/null
@@ -1,12 +0,0 @@
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- cdef struct Foo:
- pass
-
- void root(Foo a);
diff --git a/cbindgen-0.24.5/tests/expectations/export_name.compat.c b/cbindgen-0.24.5/tests/expectations/export_name.compat.c
deleted file mode 100644
index 16e7c09..0000000
--- a/cbindgen-0.24.5/tests/expectations/export_name.compat.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void do_the_thing_with_export_name(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/export_name.cpp b/cbindgen-0.24.5/tests/expectations/export_name.cpp
deleted file mode 100644
index 0182905..0000000
--- a/cbindgen-0.24.5/tests/expectations/export_name.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-void do_the_thing_with_export_name();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/extern.both.c b/cbindgen-0.24.5/tests/expectations/extern.both.c
deleted file mode 100644
index 026661a..0000000
--- a/cbindgen-0.24.5/tests/expectations/extern.both.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Normal {
- int32_t x;
- float y;
-} Normal;
-
-extern int32_t foo(void);
-
-extern void bar(struct Normal a);
diff --git a/cbindgen-0.24.5/tests/expectations/extern.both.compat.c b/cbindgen-0.24.5/tests/expectations/extern.both.compat.c
deleted file mode 100644
index 3c49da3..0000000
--- a/cbindgen-0.24.5/tests/expectations/extern.both.compat.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Normal {
- int32_t x;
- float y;
-} Normal;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern int32_t foo(void);
-
-extern void bar(struct Normal a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/extern.c b/cbindgen-0.24.5/tests/expectations/extern.c
deleted file mode 100644
index 6fe9f5b..0000000
--- a/cbindgen-0.24.5/tests/expectations/extern.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- int32_t x;
- float y;
-} Normal;
-
-extern int32_t foo(void);
-
-extern void bar(Normal a);
diff --git a/cbindgen-0.24.5/tests/expectations/extern.compat.c b/cbindgen-0.24.5/tests/expectations/extern.compat.c
deleted file mode 100644
index 4f4129a..0000000
--- a/cbindgen-0.24.5/tests/expectations/extern.compat.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- int32_t x;
- float y;
-} Normal;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern int32_t foo(void);
-
-extern void bar(Normal a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/extern.cpp b/cbindgen-0.24.5/tests/expectations/extern.cpp
deleted file mode 100644
index 15294c0..0000000
--- a/cbindgen-0.24.5/tests/expectations/extern.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Normal {
- int32_t x;
- float y;
-};
-
-extern "C" {
-
-extern int32_t foo();
-
-extern void bar(Normal a);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/extern.pyx b/cbindgen-0.24.5/tests/expectations/extern.pyx
deleted file mode 100644
index dca17ac..0000000
--- a/cbindgen-0.24.5/tests/expectations/extern.pyx
+++ /dev/null
@@ -1,15 +0,0 @@
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- ctypedef struct Normal:
- int32_t x;
- float y;
-
- extern int32_t foo();
-
- extern void bar(Normal a);
diff --git a/cbindgen-0.24.5/tests/expectations/extern.tag.c b/cbindgen-0.24.5/tests/expectations/extern.tag.c
deleted file mode 100644
index 5a88d1a..0000000
--- a/cbindgen-0.24.5/tests/expectations/extern.tag.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Normal {
- int32_t x;
- float y;
-};
-
-extern int32_t foo(void);
-
-extern void bar(struct Normal a);
diff --git a/cbindgen-0.24.5/tests/expectations/extern.tag.compat.c b/cbindgen-0.24.5/tests/expectations/extern.tag.compat.c
deleted file mode 100644
index 3ca1625..0000000
--- a/cbindgen-0.24.5/tests/expectations/extern.tag.compat.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Normal {
- int32_t x;
- float y;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern int32_t foo(void);
-
-extern void bar(struct Normal a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/extern.tag.pyx b/cbindgen-0.24.5/tests/expectations/extern.tag.pyx
deleted file mode 100644
index 9cb7214..0000000
--- a/cbindgen-0.24.5/tests/expectations/extern.tag.pyx
+++ /dev/null
@@ -1,15 +0,0 @@
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- cdef struct Normal:
- int32_t x;
- float y;
-
- extern int32_t foo();
-
- extern void bar(Normal a);
diff --git a/cbindgen-0.24.5/tests/expectations/extern_2.compat.c b/cbindgen-0.24.5/tests/expectations/extern_2.compat.c
deleted file mode 100644
index 53851b3..0000000
--- a/cbindgen-0.24.5/tests/expectations/extern_2.compat.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void first(void);
-
-void second(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/extern_2.cpp b/cbindgen-0.24.5/tests/expectations/extern_2.cpp
deleted file mode 100644
index 511aa42..0000000
--- a/cbindgen-0.24.5/tests/expectations/extern_2.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-void first();
-
-void second();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/external_workspace_child.both.compat.c b/cbindgen-0.24.5/tests/expectations/external_workspace_child.both.compat.c
deleted file mode 100644
index 1bc8b14..0000000
--- a/cbindgen-0.24.5/tests/expectations/external_workspace_child.both.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct ExtType {
- uint32_t data;
-} ExtType;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void consume_ext(struct ExtType _ext);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/external_workspace_child.compat.c b/cbindgen-0.24.5/tests/expectations/external_workspace_child.compat.c
deleted file mode 100644
index 1529006..0000000
--- a/cbindgen-0.24.5/tests/expectations/external_workspace_child.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- uint32_t data;
-} ExtType;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void consume_ext(ExtType _ext);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/external_workspace_child.cpp b/cbindgen-0.24.5/tests/expectations/external_workspace_child.cpp
deleted file mode 100644
index 79e14c0..0000000
--- a/cbindgen-0.24.5/tests/expectations/external_workspace_child.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct ExtType {
- uint32_t data;
-};
-
-extern "C" {
-
-void consume_ext(ExtType _ext);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/external_workspace_child.tag.compat.c b/cbindgen-0.24.5/tests/expectations/external_workspace_child.tag.compat.c
deleted file mode 100644
index 1591a0a..0000000
--- a/cbindgen-0.24.5/tests/expectations/external_workspace_child.tag.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct ExtType {
- uint32_t data;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void consume_ext(struct ExtType _ext);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/fns.both.compat.c b/cbindgen-0.24.5/tests/expectations/fns.both.compat.c
deleted file mode 100644
index 16c9ee6..0000000
--- a/cbindgen-0.24.5/tests/expectations/fns.both.compat.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Fns {
- void (*noArgs)(void);
- void (*anonymousArg)(int32_t);
- int32_t (*returnsNumber)(void);
- int8_t (*namedArgs)(int32_t first, int16_t snd);
- int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
-} Fns;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Fns _fns);
-
-void no_return(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/fns.compat.c b/cbindgen-0.24.5/tests/expectations/fns.compat.c
deleted file mode 100644
index f61419c..0000000
--- a/cbindgen-0.24.5/tests/expectations/fns.compat.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- void (*noArgs)(void);
- void (*anonymousArg)(int32_t);
- int32_t (*returnsNumber)(void);
- int8_t (*namedArgs)(int32_t first, int16_t snd);
- int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
-} Fns;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Fns _fns);
-
-void no_return(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/fns.cpp b/cbindgen-0.24.5/tests/expectations/fns.cpp
deleted file mode 100644
index 1e52496..0000000
--- a/cbindgen-0.24.5/tests/expectations/fns.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Fns {
- void (*noArgs)();
- void (*anonymousArg)(int32_t);
- int32_t (*returnsNumber)();
- int8_t (*namedArgs)(int32_t first, int16_t snd);
- int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
-};
-
-extern "C" {
-
-void root(Fns _fns);
-
-void no_return();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/fns.tag.compat.c b/cbindgen-0.24.5/tests/expectations/fns.tag.compat.c
deleted file mode 100644
index 84efce6..0000000
--- a/cbindgen-0.24.5/tests/expectations/fns.tag.compat.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Fns {
- void (*noArgs)(void);
- void (*anonymousArg)(int32_t);
- int32_t (*returnsNumber)(void);
- int8_t (*namedArgs)(int32_t first, int16_t snd);
- int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Fns _fns);
-
-void no_return(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/forward_declaration.both.compat.c b/cbindgen-0.24.5/tests/expectations/forward_declaration.both.compat.c
deleted file mode 100644
index 0cdbd6d..0000000
--- a/cbindgen-0.24.5/tests/expectations/forward_declaration.both.compat.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#if 0
-''' '
-#endif
-#if defined(CBINDGEN_STYLE_TYPE)
-/* ANONYMOUS STRUCTS DO NOT SUPPORT FORWARD DECLARATIONS!
-#endif
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct StructInfo {
- const struct TypeInfo *const *fields;
- uintptr_t num_fields;
-} StructInfo;
-
-typedef enum TypeData_Tag {
- Primitive,
- Struct,
-} TypeData_Tag;
-
-typedef struct TypeData {
- TypeData_Tag tag;
- union {
- struct {
- struct StructInfo struct_;
- };
- };
-} TypeData;
-
-typedef struct TypeInfo {
- struct TypeData data;
-} TypeInfo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct TypeInfo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#if 0
-''' '
-#endif
-#if defined(CBINDGEN_STYLE_TYPE)
-*/
-#endif
-#if 0
-' '''
-#endif
diff --git a/cbindgen-0.24.5/tests/expectations/forward_declaration.compat.c b/cbindgen-0.24.5/tests/expectations/forward_declaration.compat.c
deleted file mode 100644
index c45679a..0000000
--- a/cbindgen-0.24.5/tests/expectations/forward_declaration.compat.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#if 0
-''' '
-#endif
-#if defined(CBINDGEN_STYLE_TYPE)
-/* ANONYMOUS STRUCTS DO NOT SUPPORT FORWARD DECLARATIONS!
-#endif
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- const TypeInfo *const *fields;
- uintptr_t num_fields;
-} StructInfo;
-
-typedef enum {
- Primitive,
- Struct,
-} TypeData_Tag;
-
-typedef struct {
- TypeData_Tag tag;
- union {
- struct {
- StructInfo struct_;
- };
- };
-} TypeData;
-
-typedef struct {
- TypeData data;
-} TypeInfo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(TypeInfo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#if 0
-''' '
-#endif
-#if defined(CBINDGEN_STYLE_TYPE)
-*/
-#endif
-#if 0
-' '''
-#endif
diff --git a/cbindgen-0.24.5/tests/expectations/forward_declaration.cpp b/cbindgen-0.24.5/tests/expectations/forward_declaration.cpp
deleted file mode 100644
index 2d1dfcb..0000000
--- a/cbindgen-0.24.5/tests/expectations/forward_declaration.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#if 0
-''' '
-#endif
-#if defined(CBINDGEN_STYLE_TYPE)
-/* ANONYMOUS STRUCTS DO NOT SUPPORT FORWARD DECLARATIONS!
-#endif
-#if 0
-' '''
-#endif
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct StructInfo {
- const TypeInfo *const *fields;
- uintptr_t num_fields;
-};
-
-struct TypeData {
- enum class Tag {
- Primitive,
- Struct,
- };
-
- struct Struct_Body {
- StructInfo _0;
- };
-
- Tag tag;
- union {
- Struct_Body struct_;
- };
-};
-
-struct TypeInfo {
- TypeData data;
-};
-
-extern "C" {
-
-void root(TypeInfo x);
-
-} // extern "C"
-
-#if 0
-''' '
-#endif
-#if defined(CBINDGEN_STYLE_TYPE)
-*/
-#endif
-#if 0
-' '''
-#endif
diff --git a/cbindgen-0.24.5/tests/expectations/forward_declaration.tag.compat.c b/cbindgen-0.24.5/tests/expectations/forward_declaration.tag.compat.c
deleted file mode 100644
index f9c2249..0000000
--- a/cbindgen-0.24.5/tests/expectations/forward_declaration.tag.compat.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#if 0
-''' '
-#endif
-#if defined(CBINDGEN_STYLE_TYPE)
-/* ANONYMOUS STRUCTS DO NOT SUPPORT FORWARD DECLARATIONS!
-#endif
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct StructInfo {
- const struct TypeInfo *const *fields;
- uintptr_t num_fields;
-};
-
-enum TypeData_Tag {
- Primitive,
- Struct,
-};
-
-struct TypeData {
- enum TypeData_Tag tag;
- union {
- struct {
- struct StructInfo struct_;
- };
- };
-};
-
-struct TypeInfo {
- struct TypeData data;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct TypeInfo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#if 0
-''' '
-#endif
-#if defined(CBINDGEN_STYLE_TYPE)
-*/
-#endif
-#if 0
-' '''
-#endif
diff --git a/cbindgen-0.24.5/tests/expectations/function_args.compat.c b/cbindgen-0.24.5/tests/expectations/function_args.compat.c
deleted file mode 100644
index 7f9f24b..0000000
--- a/cbindgen-0.24.5/tests/expectations/function_args.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void unnamed(const uint64_t*);
-
-void pointer_test(const uint64_t *a);
-
-void print_from_rust(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/function_args.cpp b/cbindgen-0.24.5/tests/expectations/function_args.cpp
deleted file mode 100644
index 903f1bb..0000000
--- a/cbindgen-0.24.5/tests/expectations/function_args.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-void unnamed(const uint64_t*);
-
-void pointer_test(const uint64_t *a);
-
-void print_from_rust();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/function_noreturn.both.compat.c b/cbindgen-0.24.5/tests/expectations/function_noreturn.both.compat.c
deleted file mode 100644
index 7336e59..0000000
--- a/cbindgen-0.24.5/tests/expectations/function_noreturn.both.compat.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-#ifndef NO_RETURN_ATTR
- #ifdef __GNUC__
- #define NO_RETURN_ATTR __attribute__ ((noreturn))
- #else // __GNUC__
- #define NO_RETURN_ATTR
- #endif // __GNUC__
-#endif // NO_RETURN_ATTR
-
-
-typedef struct Example {
- void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
-} Example;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void loop_forever(void) NO_RETURN_ATTR;
-
-uint8_t normal_return(struct Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/function_noreturn.compat.c b/cbindgen-0.24.5/tests/expectations/function_noreturn.compat.c
deleted file mode 100644
index 6ea836f..0000000
--- a/cbindgen-0.24.5/tests/expectations/function_noreturn.compat.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-#ifndef NO_RETURN_ATTR
- #ifdef __GNUC__
- #define NO_RETURN_ATTR __attribute__ ((noreturn))
- #else // __GNUC__
- #define NO_RETURN_ATTR
- #endif // __GNUC__
-#endif // NO_RETURN_ATTR
-
-
-typedef struct {
- void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
-} Example;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void loop_forever(void) NO_RETURN_ATTR;
-
-uint8_t normal_return(Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/function_noreturn.cpp b/cbindgen-0.24.5/tests/expectations/function_noreturn.cpp
deleted file mode 100644
index 5adbe11..0000000
--- a/cbindgen-0.24.5/tests/expectations/function_noreturn.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-#ifndef NO_RETURN_ATTR
- #ifdef __GNUC__
- #define NO_RETURN_ATTR __attribute__ ((noreturn))
- #else // __GNUC__
- #define NO_RETURN_ATTR
- #endif // __GNUC__
-#endif // NO_RETURN_ATTR
-
-
-struct Example {
- void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
-};
-
-extern "C" {
-
-void loop_forever() NO_RETURN_ATTR;
-
-uint8_t normal_return(Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/function_noreturn.tag.compat.c b/cbindgen-0.24.5/tests/expectations/function_noreturn.tag.compat.c
deleted file mode 100644
index dcb0e5b..0000000
--- a/cbindgen-0.24.5/tests/expectations/function_noreturn.tag.compat.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-#ifndef NO_RETURN_ATTR
- #ifdef __GNUC__
- #define NO_RETURN_ATTR __attribute__ ((noreturn))
- #else // __GNUC__
- #define NO_RETURN_ATTR
- #endif // __GNUC__
-#endif // NO_RETURN_ATTR
-
-
-struct Example {
- void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void loop_forever(void) NO_RETURN_ATTR;
-
-uint8_t normal_return(struct Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/function_ptr.compat.c b/cbindgen-0.24.5/tests/expectations/function_ptr.compat.c
deleted file mode 100644
index be3870c..0000000
--- a/cbindgen-0.24.5/tests/expectations/function_ptr.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef void (*MyCallback)(uintptr_t a, uintptr_t b);
-
-typedef void (*MyOtherCallback)(uintptr_t a,
- uintptr_t lot,
- uintptr_t of,
- uintptr_t args,
- uintptr_t and_then_some);
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void my_function(MyCallback a, MyOtherCallback b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/function_ptr.cpp b/cbindgen-0.24.5/tests/expectations/function_ptr.cpp
deleted file mode 100644
index 217a160..0000000
--- a/cbindgen-0.24.5/tests/expectations/function_ptr.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-using MyCallback = void(*)(uintptr_t a, uintptr_t b);
-
-using MyOtherCallback = void(*)(uintptr_t a,
- uintptr_t lot,
- uintptr_t of,
- uintptr_t args,
- uintptr_t and_then_some);
-
-extern "C" {
-
-void my_function(MyCallback a, MyOtherCallback b);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/function_sort_name.compat.c b/cbindgen-0.24.5/tests/expectations/function_sort_name.compat.c
deleted file mode 100644
index 9e8c7d6..0000000
--- a/cbindgen-0.24.5/tests/expectations/function_sort_name.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void A(void);
-
-void B(void);
-
-void C(void);
-
-void D(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/function_sort_name.cpp b/cbindgen-0.24.5/tests/expectations/function_sort_name.cpp
deleted file mode 100644
index d9de237..0000000
--- a/cbindgen-0.24.5/tests/expectations/function_sort_name.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-void A();
-
-void B();
-
-void C();
-
-void D();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/function_sort_none.compat.c b/cbindgen-0.24.5/tests/expectations/function_sort_none.compat.c
deleted file mode 100644
index a6138f7..0000000
--- a/cbindgen-0.24.5/tests/expectations/function_sort_none.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void C(void);
-
-void B(void);
-
-void D(void);
-
-void A(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/function_sort_none.cpp b/cbindgen-0.24.5/tests/expectations/function_sort_none.cpp
deleted file mode 100644
index 99b52e5..0000000
--- a/cbindgen-0.24.5/tests/expectations/function_sort_none.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-void C();
-
-void B();
-
-void D();
-
-void A();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/generic_pointer.both.compat.c b/cbindgen-0.24.5/tests/expectations/generic_pointer.both.compat.c
deleted file mode 100644
index 3288ece..0000000
--- a/cbindgen-0.24.5/tests/expectations/generic_pointer.both.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo_____u8 {
- uint8_t *a;
-} Foo_____u8;
-
-typedef struct Foo_____u8 Boo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Boo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/generic_pointer.compat.c b/cbindgen-0.24.5/tests/expectations/generic_pointer.compat.c
deleted file mode 100644
index 75c1017..0000000
--- a/cbindgen-0.24.5/tests/expectations/generic_pointer.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- uint8_t *a;
-} Foo_____u8;
-
-typedef Foo_____u8 Boo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Boo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/generic_pointer.cpp b/cbindgen-0.24.5/tests/expectations/generic_pointer.cpp
deleted file mode 100644
index eb1a1ef..0000000
--- a/cbindgen-0.24.5/tests/expectations/generic_pointer.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T>
-struct Foo {
- T a;
-};
-
-using Boo = Foo<uint8_t*>;
-
-extern "C" {
-
-void root(Boo x);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/generic_pointer.tag.compat.c b/cbindgen-0.24.5/tests/expectations/generic_pointer.tag.compat.c
deleted file mode 100644
index 0ab9285..0000000
--- a/cbindgen-0.24.5/tests/expectations/generic_pointer.tag.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo_____u8 {
- uint8_t *a;
-};
-
-typedef struct Foo_____u8 Boo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Boo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/global_variable.compat.c b/cbindgen-0.24.5/tests/expectations/global_variable.compat.c
deleted file mode 100644
index ee7b9d1..0000000
--- a/cbindgen-0.24.5/tests/expectations/global_variable.compat.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern char MUT_GLOBAL_ARRAY[128];
-
-extern const char CONST_GLOBAL_ARRAY[128];
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/global_variable.cpp b/cbindgen-0.24.5/tests/expectations/global_variable.cpp
deleted file mode 100644
index 727f28b..0000000
--- a/cbindgen-0.24.5/tests/expectations/global_variable.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-extern char MUT_GLOBAL_ARRAY[128];
-
-extern const char CONST_GLOBAL_ARRAY[128];
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/ignore.c b/cbindgen-0.24.5/tests/expectations/ignore.c
deleted file mode 100644
index 8e7da96..0000000
--- a/cbindgen-0.24.5/tests/expectations/ignore.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-void no_ignore_root(void);
diff --git a/cbindgen-0.24.5/tests/expectations/ignore.compat.c b/cbindgen-0.24.5/tests/expectations/ignore.compat.c
deleted file mode 100644
index a99dcee..0000000
--- a/cbindgen-0.24.5/tests/expectations/ignore.compat.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void no_ignore_root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/ignore.cpp b/cbindgen-0.24.5/tests/expectations/ignore.cpp
deleted file mode 100644
index aa7cf51..0000000
--- a/cbindgen-0.24.5/tests/expectations/ignore.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-void no_ignore_root();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/ignore.pyx b/cbindgen-0.24.5/tests/expectations/ignore.pyx
deleted file mode 100644
index 97162bd..0000000
--- a/cbindgen-0.24.5/tests/expectations/ignore.pyx
+++ /dev/null
@@ -1,9 +0,0 @@
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- void no_ignore_root();
diff --git a/cbindgen-0.24.5/tests/expectations/include_guard.c b/cbindgen-0.24.5/tests/expectations/include_guard.c
deleted file mode 100644
index eeecd48..0000000
--- a/cbindgen-0.24.5/tests/expectations/include_guard.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef INCLUDE_GUARD_H
-#define INCLUDE_GUARD_H
-
-void root(void);
-
-#endif /* INCLUDE_GUARD_H */
diff --git a/cbindgen-0.24.5/tests/expectations/include_guard.compat.c b/cbindgen-0.24.5/tests/expectations/include_guard.compat.c
deleted file mode 100644
index af1548f..0000000
--- a/cbindgen-0.24.5/tests/expectations/include_guard.compat.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef INCLUDE_GUARD_H
-#define INCLUDE_GUARD_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#endif /* INCLUDE_GUARD_H */
diff --git a/cbindgen-0.24.5/tests/expectations/include_guard.cpp b/cbindgen-0.24.5/tests/expectations/include_guard.cpp
deleted file mode 100644
index 5600fd3..0000000
--- a/cbindgen-0.24.5/tests/expectations/include_guard.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef INCLUDE_GUARD_H
-#define INCLUDE_GUARD_H
-
-extern "C" {
-
-void root();
-
-} // extern "C"
-
-#endif // INCLUDE_GUARD_H
diff --git a/cbindgen-0.24.5/tests/expectations/inner_mod.both.compat.c b/cbindgen-0.24.5/tests/expectations/inner_mod.both.compat.c
deleted file mode 100644
index d46bb80..0000000
--- a/cbindgen-0.24.5/tests/expectations/inner_mod.both.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo {
- float x;
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/inner_mod.compat.c b/cbindgen-0.24.5/tests/expectations/inner_mod.compat.c
deleted file mode 100644
index 6096ce2..0000000
--- a/cbindgen-0.24.5/tests/expectations/inner_mod.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- float x;
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/inner_mod.cpp b/cbindgen-0.24.5/tests/expectations/inner_mod.cpp
deleted file mode 100644
index 66afbba..0000000
--- a/cbindgen-0.24.5/tests/expectations/inner_mod.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Foo {
- float x;
-};
-
-extern "C" {
-
-void root(Foo a);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/inner_mod.tag.compat.c b/cbindgen-0.24.5/tests/expectations/inner_mod.tag.compat.c
deleted file mode 100644
index fff900a..0000000
--- a/cbindgen-0.24.5/tests/expectations/inner_mod.tag.compat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo {
- float x;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/lifetime_arg.both.compat.c b/cbindgen-0.24.5/tests/expectations/lifetime_arg.both.compat.c
deleted file mode 100644
index ab713cc..0000000
--- a/cbindgen-0.24.5/tests/expectations/lifetime_arg.both.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct A {
- const int32_t *data;
-} A;
-
-typedef enum E_Tag {
- V,
- U,
-} E_Tag;
-
-typedef struct E {
- E_Tag tag;
- union {
- struct {
- const uint8_t *u;
- };
- };
-} E;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct A _a, struct E _e);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/lifetime_arg.compat.c b/cbindgen-0.24.5/tests/expectations/lifetime_arg.compat.c
deleted file mode 100644
index 573f498..0000000
--- a/cbindgen-0.24.5/tests/expectations/lifetime_arg.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- const int32_t *data;
-} A;
-
-typedef enum {
- V,
- U,
-} E_Tag;
-
-typedef struct {
- E_Tag tag;
- union {
- struct {
- const uint8_t *u;
- };
- };
-} E;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(A _a, E _e);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/lifetime_arg.cpp b/cbindgen-0.24.5/tests/expectations/lifetime_arg.cpp
deleted file mode 100644
index dc5ed99..0000000
--- a/cbindgen-0.24.5/tests/expectations/lifetime_arg.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct A {
- const int32_t *data;
-};
-
-struct E {
- enum class Tag {
- V,
- U,
- };
-
- struct U_Body {
- const uint8_t *_0;
- };
-
- Tag tag;
- union {
- U_Body u;
- };
-};
-
-extern "C" {
-
-void root(A _a, E _e);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/lifetime_arg.tag.compat.c b/cbindgen-0.24.5/tests/expectations/lifetime_arg.tag.compat.c
deleted file mode 100644
index 68b078c..0000000
--- a/cbindgen-0.24.5/tests/expectations/lifetime_arg.tag.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct A {
- const int32_t *data;
-};
-
-enum E_Tag {
- V,
- U,
-};
-
-struct E {
- enum E_Tag tag;
- union {
- struct {
- const uint8_t *u;
- };
- };
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct A _a, struct E _e);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_cr.both.compat.c b/cbindgen-0.24.5/tests/expectations/linestyle_cr.both.compat.c
deleted file mode 100644
index 2af7888..0000000
--- a/cbindgen-0.24.5/tests/expectations/linestyle_cr.both.compat.c
+++ /dev/null
Binary files differ
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_cr.compat.c b/cbindgen-0.24.5/tests/expectations/linestyle_cr.compat.c
deleted file mode 100644
index e8b5e52..0000000
--- a/cbindgen-0.24.5/tests/expectations/linestyle_cr.compat.c
+++ /dev/null
Binary files differ
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_cr.cpp b/cbindgen-0.24.5/tests/expectations/linestyle_cr.cpp
deleted file mode 100644
index b307d57..0000000
--- a/cbindgen-0.24.5/tests/expectations/linestyle_cr.cpp
+++ /dev/null
Binary files differ
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_cr.tag.compat.c b/cbindgen-0.24.5/tests/expectations/linestyle_cr.tag.compat.c
deleted file mode 100644
index 01708bd..0000000
--- a/cbindgen-0.24.5/tests/expectations/linestyle_cr.tag.compat.c
+++ /dev/null
Binary files differ
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_crlf.both.compat.c b/cbindgen-0.24.5/tests/expectations/linestyle_crlf.both.compat.c
deleted file mode 100644
index fa16a15..0000000
--- a/cbindgen-0.24.5/tests/expectations/linestyle_crlf.both.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Dummy {
- int32_t x;
- float y;
-} Dummy;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Dummy d);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_crlf.compat.c b/cbindgen-0.24.5/tests/expectations/linestyle_crlf.compat.c
deleted file mode 100644
index e105589..0000000
--- a/cbindgen-0.24.5/tests/expectations/linestyle_crlf.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- int32_t x;
- float y;
-} Dummy;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Dummy d);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_crlf.cpp b/cbindgen-0.24.5/tests/expectations/linestyle_crlf.cpp
deleted file mode 100644
index 648188c..0000000
--- a/cbindgen-0.24.5/tests/expectations/linestyle_crlf.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Dummy {
- int32_t x;
- float y;
-};
-
-extern "C" {
-
-void root(Dummy d);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_crlf.tag.compat.c b/cbindgen-0.24.5/tests/expectations/linestyle_crlf.tag.compat.c
deleted file mode 100644
index 8be6001..0000000
--- a/cbindgen-0.24.5/tests/expectations/linestyle_crlf.tag.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Dummy {
- int32_t x;
- float y;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Dummy d);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_lf.both.compat.c b/cbindgen-0.24.5/tests/expectations/linestyle_lf.both.compat.c
deleted file mode 100644
index 715acd1..0000000
--- a/cbindgen-0.24.5/tests/expectations/linestyle_lf.both.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Dummy {
- int32_t x;
- float y;
-} Dummy;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Dummy d);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_lf.compat.c b/cbindgen-0.24.5/tests/expectations/linestyle_lf.compat.c
deleted file mode 100644
index 41aeec9..0000000
--- a/cbindgen-0.24.5/tests/expectations/linestyle_lf.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- int32_t x;
- float y;
-} Dummy;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Dummy d);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_lf.cpp b/cbindgen-0.24.5/tests/expectations/linestyle_lf.cpp
deleted file mode 100644
index d02b607..0000000
--- a/cbindgen-0.24.5/tests/expectations/linestyle_lf.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Dummy {
- int32_t x;
- float y;
-};
-
-extern "C" {
-
-void root(Dummy d);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_lf.tag.compat.c b/cbindgen-0.24.5/tests/expectations/linestyle_lf.tag.compat.c
deleted file mode 100644
index 8d53f1c..0000000
--- a/cbindgen-0.24.5/tests/expectations/linestyle_lf.tag.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Dummy {
- int32_t x;
- float y;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Dummy d);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mangle.both.compat.c b/cbindgen-0.24.5/tests/expectations/mangle.both.compat.c
deleted file mode 100644
index ceefcc8..0000000
--- a/cbindgen-0.24.5/tests/expectations/mangle.both.compat.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef enum Bar {
- BarSome,
- BarThing,
-} Bar;
-
-typedef struct FooU8 {
- uint8_t a;
-} FooU8;
-
-typedef struct FooU8 Boo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Boo x, enum Bar y);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mangle.compat.c b/cbindgen-0.24.5/tests/expectations/mangle.compat.c
deleted file mode 100644
index 2bfe97a..0000000
--- a/cbindgen-0.24.5/tests/expectations/mangle.compat.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef enum {
- BarSome,
- BarThing,
-} Bar;
-
-typedef struct {
- uint8_t a;
-} FooU8;
-
-typedef FooU8 Boo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Boo x, Bar y);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mangle.cpp b/cbindgen-0.24.5/tests/expectations/mangle.cpp
deleted file mode 100644
index 95224c9..0000000
--- a/cbindgen-0.24.5/tests/expectations/mangle.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-enum class Bar {
- BarSome,
- BarThing,
-};
-
-template<typename T>
-struct Foo {
- T a;
-};
-
-using Boo = Foo<uint8_t>;
-
-extern "C" {
-
-void root(Boo x, Bar y);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/mangle.tag.compat.c b/cbindgen-0.24.5/tests/expectations/mangle.tag.compat.c
deleted file mode 100644
index 7d7e992..0000000
--- a/cbindgen-0.24.5/tests/expectations/mangle.tag.compat.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum Bar {
- BarSome,
- BarThing,
-};
-
-struct FooU8 {
- uint8_t a;
-};
-
-typedef struct FooU8 Boo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Boo x, enum Bar y);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/manuallydrop.both.compat.c b/cbindgen-0.24.5/tests/expectations/manuallydrop.both.compat.c
deleted file mode 100644
index 9b9c26b..0000000
--- a/cbindgen-0.24.5/tests/expectations/manuallydrop.both.compat.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using ManuallyDrop = T;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct NotReprC_Point NotReprC_Point;
-
-typedef struct NotReprC_Point Foo;
-
-typedef struct Point {
- int32_t x;
- int32_t y;
-} Point;
-
-typedef struct MyStruct {
- struct Point point;
-} MyStruct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const struct MyStruct *with_manual_drop);
-
-void take(struct Point with_manual_drop);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/manuallydrop.compat.c b/cbindgen-0.24.5/tests/expectations/manuallydrop.compat.c
deleted file mode 100644
index 0615661..0000000
--- a/cbindgen-0.24.5/tests/expectations/manuallydrop.compat.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using ManuallyDrop = T;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct NotReprC_Point NotReprC_Point;
-
-typedef NotReprC_Point Foo;
-
-typedef struct {
- int32_t x;
- int32_t y;
-} Point;
-
-typedef struct {
- Point point;
-} MyStruct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const MyStruct *with_manual_drop);
-
-void take(Point with_manual_drop);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/manuallydrop.cpp b/cbindgen-0.24.5/tests/expectations/manuallydrop.cpp
deleted file mode 100644
index 3f46196..0000000
--- a/cbindgen-0.24.5/tests/expectations/manuallydrop.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using ManuallyDrop = T;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T = void>
-struct NotReprC;
-
-struct Point {
- int32_t x;
- int32_t y;
-};
-
-using Foo = NotReprC<ManuallyDrop<Point>>;
-
-struct MyStruct {
- ManuallyDrop<Point> point;
-};
-
-extern "C" {
-
-void root(const Foo *a, const MyStruct *with_manual_drop);
-
-void take(ManuallyDrop<Point> with_manual_drop);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/manuallydrop.tag.compat.c b/cbindgen-0.24.5/tests/expectations/manuallydrop.tag.compat.c
deleted file mode 100644
index b66146f..0000000
--- a/cbindgen-0.24.5/tests/expectations/manuallydrop.tag.compat.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using ManuallyDrop = T;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct NotReprC_Point;
-
-typedef struct NotReprC_Point Foo;
-
-struct Point {
- int32_t x;
- int32_t y;
-};
-
-struct MyStruct {
- struct Point point;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const struct MyStruct *with_manual_drop);
-
-void take(struct Point with_manual_drop);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/maybeuninit.both.compat.c b/cbindgen-0.24.5/tests/expectations/maybeuninit.both.compat.c
deleted file mode 100644
index 31d3b81..0000000
--- a/cbindgen-0.24.5/tests/expectations/maybeuninit.both.compat.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using MaybeUninit = T;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct NotReprC______i32 NotReprC______i32;
-
-typedef struct NotReprC______i32 Foo;
-
-typedef struct MyStruct {
- const int32_t *number;
-} MyStruct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const struct MyStruct *with_maybe_uninit);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/maybeuninit.compat.c b/cbindgen-0.24.5/tests/expectations/maybeuninit.compat.c
deleted file mode 100644
index c218fc5..0000000
--- a/cbindgen-0.24.5/tests/expectations/maybeuninit.compat.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using MaybeUninit = T;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct NotReprC______i32 NotReprC______i32;
-
-typedef NotReprC______i32 Foo;
-
-typedef struct {
- const int32_t *number;
-} MyStruct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const MyStruct *with_maybe_uninit);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/maybeuninit.cpp b/cbindgen-0.24.5/tests/expectations/maybeuninit.cpp
deleted file mode 100644
index 83d8515..0000000
--- a/cbindgen-0.24.5/tests/expectations/maybeuninit.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using MaybeUninit = T;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T = void>
-struct NotReprC;
-
-using Foo = NotReprC<MaybeUninit<const int32_t*>>;
-
-struct MyStruct {
- MaybeUninit<const int32_t*> number;
-};
-
-extern "C" {
-
-void root(const Foo *a, const MyStruct *with_maybe_uninit);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/maybeuninit.tag.compat.c b/cbindgen-0.24.5/tests/expectations/maybeuninit.tag.compat.c
deleted file mode 100644
index e788a4b..0000000
--- a/cbindgen-0.24.5/tests/expectations/maybeuninit.tag.compat.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using MaybeUninit = T;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct NotReprC______i32;
-
-typedef struct NotReprC______i32 Foo;
-
-struct MyStruct {
- const int32_t *number;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const struct MyStruct *with_maybe_uninit);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2015.both.compat.c b/cbindgen-0.24.5/tests/expectations/mod_2015.both.compat.c
deleted file mode 100644
index 264f020..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_2015.both.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define EXPORT_ME_TOO 42
-
-typedef struct ExportMe {
- uint64_t val;
-} ExportMe;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void export_me(struct ExportMe *val);
-
-void from_really_nested_mod(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2015.compat.c b/cbindgen-0.24.5/tests/expectations/mod_2015.compat.c
deleted file mode 100644
index 4f49992..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_2015.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define EXPORT_ME_TOO 42
-
-typedef struct {
- uint64_t val;
-} ExportMe;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void export_me(ExportMe *val);
-
-void from_really_nested_mod(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2015.cpp b/cbindgen-0.24.5/tests/expectations/mod_2015.cpp
deleted file mode 100644
index b3caaed..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_2015.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-constexpr static const uint8_t EXPORT_ME_TOO = 42;
-
-struct ExportMe {
- uint64_t val;
-};
-
-extern "C" {
-
-void export_me(ExportMe *val);
-
-void from_really_nested_mod();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2015.tag.compat.c b/cbindgen-0.24.5/tests/expectations/mod_2015.tag.compat.c
deleted file mode 100644
index 606808c..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_2015.tag.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define EXPORT_ME_TOO 42
-
-struct ExportMe {
- uint64_t val;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void export_me(struct ExportMe *val);
-
-void from_really_nested_mod(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2018.both.compat.c b/cbindgen-0.24.5/tests/expectations/mod_2018.both.compat.c
deleted file mode 100644
index b87a85e..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_2018.both.compat.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define EXPORT_ME_TOO 42
-
-typedef struct ExportMe {
- uint64_t val;
-} ExportMe;
-
-typedef struct ExportMe2 {
- uint64_t val;
-} ExportMe2;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void export_me(struct ExportMe *val);
-
-void export_me_2(struct ExportMe2*);
-
-void from_really_nested_mod(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2018.compat.c b/cbindgen-0.24.5/tests/expectations/mod_2018.compat.c
deleted file mode 100644
index 2af05c2..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_2018.compat.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define EXPORT_ME_TOO 42
-
-typedef struct {
- uint64_t val;
-} ExportMe;
-
-typedef struct {
- uint64_t val;
-} ExportMe2;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void export_me(ExportMe *val);
-
-void export_me_2(ExportMe2*);
-
-void from_really_nested_mod(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2018.cpp b/cbindgen-0.24.5/tests/expectations/mod_2018.cpp
deleted file mode 100644
index cd3ca85..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_2018.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-constexpr static const uint8_t EXPORT_ME_TOO = 42;
-
-struct ExportMe {
- uint64_t val;
-};
-
-struct ExportMe2 {
- uint64_t val;
-};
-
-extern "C" {
-
-void export_me(ExportMe *val);
-
-void export_me_2(ExportMe2*);
-
-void from_really_nested_mod();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2018.tag.compat.c b/cbindgen-0.24.5/tests/expectations/mod_2018.tag.compat.c
deleted file mode 100644
index 051cb67..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_2018.tag.compat.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define EXPORT_ME_TOO 42
-
-struct ExportMe {
- uint64_t val;
-};
-
-struct ExportMe2 {
- uint64_t val;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void export_me(struct ExportMe *val);
-
-void export_me_2(struct ExportMe2*);
-
-void from_really_nested_mod(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_attr.both.compat.c b/cbindgen-0.24.5/tests/expectations/mod_attr.both.compat.c
deleted file mode 100644
index 78ca229..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_attr.both.compat.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#if 0
-DEF FOO = 0
-DEF BAR = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#if defined(FOO)
-#define FOO 1
-#endif
-
-#if defined(BAR)
-#define BAR 2
-#endif
-
-#if defined(FOO)
-typedef struct Foo {
-
-} Foo;
-#endif
-
-#if defined(BAR)
-typedef struct Bar {
-
-} Bar;
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-#if defined(FOO)
-void foo(const struct Foo *foo);
-#endif
-
-#if defined(BAR)
-void bar(const struct Bar *bar);
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_attr.compat.c b/cbindgen-0.24.5/tests/expectations/mod_attr.compat.c
deleted file mode 100644
index 0098503..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_attr.compat.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#if 0
-DEF FOO = 0
-DEF BAR = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#if defined(FOO)
-#define FOO 1
-#endif
-
-#if defined(BAR)
-#define BAR 2
-#endif
-
-#if defined(FOO)
-typedef struct {
-
-} Foo;
-#endif
-
-#if defined(BAR)
-typedef struct {
-
-} Bar;
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-#if defined(FOO)
-void foo(const Foo *foo);
-#endif
-
-#if defined(BAR)
-void bar(const Bar *bar);
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_attr.cpp b/cbindgen-0.24.5/tests/expectations/mod_attr.cpp
deleted file mode 100644
index 10d0fe8..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_attr.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-#if 0
-DEF FOO = 0
-DEF BAR = 0
-#endif
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-#if defined(FOO)
-constexpr static const int32_t FOO = 1;
-#endif
-
-#if defined(BAR)
-constexpr static const int32_t BAR = 2;
-#endif
-
-#if defined(FOO)
-struct Foo {
-
-};
-#endif
-
-#if defined(BAR)
-struct Bar {
-
-};
-#endif
-
-extern "C" {
-
-#if defined(FOO)
-void foo(const Foo *foo);
-#endif
-
-#if defined(BAR)
-void bar(const Bar *bar);
-#endif
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/mod_attr.tag.compat.c b/cbindgen-0.24.5/tests/expectations/mod_attr.tag.compat.c
deleted file mode 100644
index aba6a6a..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_attr.tag.compat.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#if 0
-DEF FOO = 0
-DEF BAR = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#if defined(FOO)
-#define FOO 1
-#endif
-
-#if defined(BAR)
-#define BAR 2
-#endif
-
-#if defined(FOO)
-struct Foo {
-
-};
-#endif
-
-#if defined(BAR)
-struct Bar {
-
-};
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-#if defined(FOO)
-void foo(const struct Foo *foo);
-#endif
-
-#if defined(BAR)
-void bar(const struct Bar *bar);
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_path.both.compat.c b/cbindgen-0.24.5/tests/expectations/mod_path.both.compat.c
deleted file mode 100644
index 3d090e5..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_path.both.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define EXPORT_ME_TOO 42
-
-typedef struct ExportMe {
- uint64_t val;
-} ExportMe;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void export_me(struct ExportMe *val);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_path.compat.c b/cbindgen-0.24.5/tests/expectations/mod_path.compat.c
deleted file mode 100644
index 1527af6..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_path.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define EXPORT_ME_TOO 42
-
-typedef struct {
- uint64_t val;
-} ExportMe;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void export_me(ExportMe *val);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_path.cpp b/cbindgen-0.24.5/tests/expectations/mod_path.cpp
deleted file mode 100644
index 0cda2e6..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_path.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-constexpr static const uint8_t EXPORT_ME_TOO = 42;
-
-struct ExportMe {
- uint64_t val;
-};
-
-extern "C" {
-
-void export_me(ExportMe *val);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/mod_path.tag.compat.c b/cbindgen-0.24.5/tests/expectations/mod_path.tag.compat.c
deleted file mode 100644
index 097697e..0000000
--- a/cbindgen-0.24.5/tests/expectations/mod_path.tag.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define EXPORT_ME_TOO 42
-
-struct ExportMe {
- uint64_t val;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void export_me(struct ExportMe *val);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_1.both.compat.c b/cbindgen-0.24.5/tests/expectations/monomorph_1.both.compat.c
deleted file mode 100644
index b7de1da..0000000
--- a/cbindgen-0.24.5/tests/expectations/monomorph_1.both.compat.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Bar_Bar_f32 Bar_Bar_f32;
-
-typedef struct Bar_Foo_f32 Bar_Foo_f32;
-
-typedef struct Bar_f32 Bar_f32;
-
-typedef struct Foo_i32 {
- const int32_t *data;
-} Foo_i32;
-
-typedef struct Foo_f32 {
- const float *data;
-} Foo_f32;
-
-typedef struct Foo_Bar_f32 {
- const struct Bar_f32 *data;
-} Foo_Bar_f32;
-
-typedef struct Tuple_Foo_f32_____f32 {
- const struct Foo_f32 *a;
- const float *b;
-} Tuple_Foo_f32_____f32;
-
-typedef struct Tuple_f32__f32 {
- const float *a;
- const float *b;
-} Tuple_f32__f32;
-
-typedef struct Tuple_f32__f32 Indirection_f32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo_i32 a,
- struct Foo_f32 b,
- struct Bar_f32 c,
- struct Foo_Bar_f32 d,
- struct Bar_Foo_f32 e,
- struct Bar_Bar_f32 f,
- struct Tuple_Foo_f32_____f32 g,
- Indirection_f32 h);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_1.compat.c b/cbindgen-0.24.5/tests/expectations/monomorph_1.compat.c
deleted file mode 100644
index d94ddec..0000000
--- a/cbindgen-0.24.5/tests/expectations/monomorph_1.compat.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Bar_Bar_f32 Bar_Bar_f32;
-
-typedef struct Bar_Foo_f32 Bar_Foo_f32;
-
-typedef struct Bar_f32 Bar_f32;
-
-typedef struct {
- const int32_t *data;
-} Foo_i32;
-
-typedef struct {
- const float *data;
-} Foo_f32;
-
-typedef struct {
- const Bar_f32 *data;
-} Foo_Bar_f32;
-
-typedef struct {
- const Foo_f32 *a;
- const float *b;
-} Tuple_Foo_f32_____f32;
-
-typedef struct {
- const float *a;
- const float *b;
-} Tuple_f32__f32;
-
-typedef Tuple_f32__f32 Indirection_f32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Foo_i32 a,
- Foo_f32 b,
- Bar_f32 c,
- Foo_Bar_f32 d,
- Bar_Foo_f32 e,
- Bar_Bar_f32 f,
- Tuple_Foo_f32_____f32 g,
- Indirection_f32 h);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_1.cpp b/cbindgen-0.24.5/tests/expectations/monomorph_1.cpp
deleted file mode 100644
index 35904f9..0000000
--- a/cbindgen-0.24.5/tests/expectations/monomorph_1.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T = void>
-struct Bar;
-
-template<typename T>
-struct Foo {
- const T *data;
-};
-
-template<typename T, typename E>
-struct Tuple {
- const T *a;
- const E *b;
-};
-
-template<typename T>
-using Indirection = Tuple<T, float>;
-
-extern "C" {
-
-void root(Foo<int32_t> a,
- Foo<float> b,
- Bar<float> c,
- Foo<Bar<float>> d,
- Bar<Foo<float>> e,
- Bar<Bar<float>> f,
- Tuple<Foo<float>, float> g,
- Indirection<float> h);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_1.tag.compat.c b/cbindgen-0.24.5/tests/expectations/monomorph_1.tag.compat.c
deleted file mode 100644
index 17b9a08..0000000
--- a/cbindgen-0.24.5/tests/expectations/monomorph_1.tag.compat.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Bar_Bar_f32;
-
-struct Bar_Foo_f32;
-
-struct Bar_f32;
-
-struct Foo_i32 {
- const int32_t *data;
-};
-
-struct Foo_f32 {
- const float *data;
-};
-
-struct Foo_Bar_f32 {
- const struct Bar_f32 *data;
-};
-
-struct Tuple_Foo_f32_____f32 {
- const struct Foo_f32 *a;
- const float *b;
-};
-
-struct Tuple_f32__f32 {
- const float *a;
- const float *b;
-};
-
-typedef struct Tuple_f32__f32 Indirection_f32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo_i32 a,
- struct Foo_f32 b,
- struct Bar_f32 c,
- struct Foo_Bar_f32 d,
- struct Bar_Foo_f32 e,
- struct Bar_Bar_f32 f,
- struct Tuple_Foo_f32_____f32 g,
- Indirection_f32 h);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_2.both.compat.c b/cbindgen-0.24.5/tests/expectations/monomorph_2.both.compat.c
deleted file mode 100644
index 8f2b0be..0000000
--- a/cbindgen-0.24.5/tests/expectations/monomorph_2.both.compat.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct A A;
-
-typedef struct B B;
-
-typedef struct List_A {
- struct A *members;
- uintptr_t count;
-} List_A;
-
-typedef struct List_B {
- struct B *members;
- uintptr_t count;
-} List_B;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void foo(struct List_A a);
-
-void bar(struct List_B b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_2.compat.c b/cbindgen-0.24.5/tests/expectations/monomorph_2.compat.c
deleted file mode 100644
index 30c66ab..0000000
--- a/cbindgen-0.24.5/tests/expectations/monomorph_2.compat.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct A A;
-
-typedef struct B B;
-
-typedef struct {
- A *members;
- uintptr_t count;
-} List_A;
-
-typedef struct {
- B *members;
- uintptr_t count;
-} List_B;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void foo(List_A a);
-
-void bar(List_B b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_2.cpp b/cbindgen-0.24.5/tests/expectations/monomorph_2.cpp
deleted file mode 100644
index 41dde1b..0000000
--- a/cbindgen-0.24.5/tests/expectations/monomorph_2.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct A;
-
-struct B;
-
-template<typename T>
-struct List {
- T *members;
- uintptr_t count;
-};
-
-extern "C" {
-
-void foo(List<A> a);
-
-void bar(List<B> b);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_2.tag.compat.c b/cbindgen-0.24.5/tests/expectations/monomorph_2.tag.compat.c
deleted file mode 100644
index 4d5fb0d..0000000
--- a/cbindgen-0.24.5/tests/expectations/monomorph_2.tag.compat.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct A;
-
-struct B;
-
-struct List_A {
- struct A *members;
- uintptr_t count;
-};
-
-struct List_B {
- struct B *members;
- uintptr_t count;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void foo(struct List_A a);
-
-void bar(struct List_B b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_3.both.compat.c b/cbindgen-0.24.5/tests/expectations/monomorph_3.both.compat.c
deleted file mode 100644
index 0ff0be2..0000000
--- a/cbindgen-0.24.5/tests/expectations/monomorph_3.both.compat.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Bar_Bar_f32 Bar_Bar_f32;
-
-typedef struct Bar_Foo_f32 Bar_Foo_f32;
-
-typedef struct Bar_f32 Bar_f32;
-
-typedef union Foo_i32 {
- const int32_t *data;
-} Foo_i32;
-
-typedef union Foo_f32 {
- const float *data;
-} Foo_f32;
-
-typedef union Foo_Bar_f32 {
- const struct Bar_f32 *data;
-} Foo_Bar_f32;
-
-typedef union Tuple_Foo_f32_____f32 {
- const union Foo_f32 *a;
- const float *b;
-} Tuple_Foo_f32_____f32;
-
-typedef union Tuple_f32__f32 {
- const float *a;
- const float *b;
-} Tuple_f32__f32;
-
-typedef union Tuple_f32__f32 Indirection_f32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(union Foo_i32 a,
- union Foo_f32 b,
- struct Bar_f32 c,
- union Foo_Bar_f32 d,
- struct Bar_Foo_f32 e,
- struct Bar_Bar_f32 f,
- union Tuple_Foo_f32_____f32 g,
- Indirection_f32 h);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_3.compat.c b/cbindgen-0.24.5/tests/expectations/monomorph_3.compat.c
deleted file mode 100644
index b2fbd8d..0000000
--- a/cbindgen-0.24.5/tests/expectations/monomorph_3.compat.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Bar_Bar_f32 Bar_Bar_f32;
-
-typedef struct Bar_Foo_f32 Bar_Foo_f32;
-
-typedef struct Bar_f32 Bar_f32;
-
-typedef union {
- const int32_t *data;
-} Foo_i32;
-
-typedef union {
- const float *data;
-} Foo_f32;
-
-typedef union {
- const Bar_f32 *data;
-} Foo_Bar_f32;
-
-typedef union {
- const Foo_f32 *a;
- const float *b;
-} Tuple_Foo_f32_____f32;
-
-typedef union {
- const float *a;
- const float *b;
-} Tuple_f32__f32;
-
-typedef Tuple_f32__f32 Indirection_f32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Foo_i32 a,
- Foo_f32 b,
- Bar_f32 c,
- Foo_Bar_f32 d,
- Bar_Foo_f32 e,
- Bar_Bar_f32 f,
- Tuple_Foo_f32_____f32 g,
- Indirection_f32 h);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_3.cpp b/cbindgen-0.24.5/tests/expectations/monomorph_3.cpp
deleted file mode 100644
index d833b32..0000000
--- a/cbindgen-0.24.5/tests/expectations/monomorph_3.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T = void>
-struct Bar;
-
-template<typename T>
-union Foo {
- const T *data;
-};
-
-template<typename T, typename E>
-union Tuple {
- const T *a;
- const E *b;
-};
-
-template<typename T>
-using Indirection = Tuple<T, float>;
-
-extern "C" {
-
-void root(Foo<int32_t> a,
- Foo<float> b,
- Bar<float> c,
- Foo<Bar<float>> d,
- Bar<Foo<float>> e,
- Bar<Bar<float>> f,
- Tuple<Foo<float>, float> g,
- Indirection<float> h);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_3.tag.compat.c b/cbindgen-0.24.5/tests/expectations/monomorph_3.tag.compat.c
deleted file mode 100644
index 7306b59..0000000
--- a/cbindgen-0.24.5/tests/expectations/monomorph_3.tag.compat.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Bar_Bar_f32;
-
-struct Bar_Foo_f32;
-
-struct Bar_f32;
-
-union Foo_i32 {
- const int32_t *data;
-};
-
-union Foo_f32 {
- const float *data;
-};
-
-union Foo_Bar_f32 {
- const struct Bar_f32 *data;
-};
-
-union Tuple_Foo_f32_____f32 {
- const union Foo_f32 *a;
- const float *b;
-};
-
-union Tuple_f32__f32 {
- const float *a;
- const float *b;
-};
-
-typedef union Tuple_f32__f32 Indirection_f32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(union Foo_i32 a,
- union Foo_f32 b,
- struct Bar_f32 c,
- union Foo_Bar_f32 d,
- struct Bar_Foo_f32 e,
- struct Bar_Bar_f32 f,
- union Tuple_Foo_f32_____f32 g,
- Indirection_f32 h);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/must_use.both.compat.c b/cbindgen-0.24.5/tests/expectations/must_use.both.compat.c
deleted file mode 100644
index cf5fafb..0000000
--- a/cbindgen-0.24.5/tests/expectations/must_use.both.compat.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#define MUST_USE_FUNC __attribute__((warn_unused_result))
-#define MUST_USE_STRUCT __attribute__((warn_unused))
-#define MUST_USE_ENUM /* nothing */
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum MaybeOwnedPtr_i32_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Owned_i32,
- None_i32,
-};
-#ifndef __cplusplus
-typedef uint8_t MaybeOwnedPtr_i32_Tag;
-#endif // __cplusplus
-
-typedef struct MUST_USE_STRUCT MaybeOwnedPtr_i32 {
- MaybeOwnedPtr_i32_Tag tag;
- union {
- struct {
- int32_t *owned;
- };
- };
-} MaybeOwnedPtr_i32;
-
-typedef struct MUST_USE_STRUCT OwnedPtr_i32 {
- int32_t *ptr;
-} OwnedPtr_i32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-MUST_USE_FUNC struct MaybeOwnedPtr_i32 maybe_consume(struct OwnedPtr_i32 input);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/must_use.compat.c b/cbindgen-0.24.5/tests/expectations/must_use.compat.c
deleted file mode 100644
index d233a02..0000000
--- a/cbindgen-0.24.5/tests/expectations/must_use.compat.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#define MUST_USE_FUNC __attribute__((warn_unused_result))
-#define MUST_USE_STRUCT __attribute__((warn_unused))
-#define MUST_USE_ENUM /* nothing */
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum MaybeOwnedPtr_i32_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Owned_i32,
- None_i32,
-};
-#ifndef __cplusplus
-typedef uint8_t MaybeOwnedPtr_i32_Tag;
-#endif // __cplusplus
-
-typedef struct MUST_USE_STRUCT {
- MaybeOwnedPtr_i32_Tag tag;
- union {
- struct {
- int32_t *owned;
- };
- };
-} MaybeOwnedPtr_i32;
-
-typedef struct MUST_USE_STRUCT {
- int32_t *ptr;
-} OwnedPtr_i32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-MUST_USE_FUNC MaybeOwnedPtr_i32 maybe_consume(OwnedPtr_i32 input);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/must_use.cpp b/cbindgen-0.24.5/tests/expectations/must_use.cpp
deleted file mode 100644
index f2162cf..0000000
--- a/cbindgen-0.24.5/tests/expectations/must_use.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#define MUST_USE_FUNC __attribute__((warn_unused_result))
-#define MUST_USE_STRUCT __attribute__((warn_unused))
-#define MUST_USE_ENUM /* nothing */
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T>
-struct MUST_USE_STRUCT MaybeOwnedPtr {
- enum class MUST_USE_ENUM Tag : uint8_t {
- Owned,
- None,
- };
-
- struct Owned_Body {
- T *_0;
- };
-
- Tag tag;
- union {
- Owned_Body owned;
- };
-};
-
-template<typename T>
-struct MUST_USE_STRUCT OwnedPtr {
- T *ptr;
-};
-
-extern "C" {
-
-MUST_USE_FUNC MaybeOwnedPtr<int32_t> maybe_consume(OwnedPtr<int32_t> input);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/must_use.tag.compat.c b/cbindgen-0.24.5/tests/expectations/must_use.tag.compat.c
deleted file mode 100644
index 8bd71a0..0000000
--- a/cbindgen-0.24.5/tests/expectations/must_use.tag.compat.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#define MUST_USE_FUNC __attribute__((warn_unused_result))
-#define MUST_USE_STRUCT __attribute__((warn_unused))
-#define MUST_USE_ENUM /* nothing */
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum MaybeOwnedPtr_i32_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Owned_i32,
- None_i32,
-};
-#ifndef __cplusplus
-typedef uint8_t MaybeOwnedPtr_i32_Tag;
-#endif // __cplusplus
-
-struct MUST_USE_STRUCT MaybeOwnedPtr_i32 {
- MaybeOwnedPtr_i32_Tag tag;
- union {
- struct {
- int32_t *owned;
- };
- };
-};
-
-struct MUST_USE_STRUCT OwnedPtr_i32 {
- int32_t *ptr;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-MUST_USE_FUNC struct MaybeOwnedPtr_i32 maybe_consume(struct OwnedPtr_i32 input);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/namespace_constant.both.compat.c b/cbindgen-0.24.5/tests/expectations/namespace_constant.both.compat.c
deleted file mode 100644
index ca8ddbc..0000000
--- a/cbindgen-0.24.5/tests/expectations/namespace_constant.both.compat.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-namespace constants {
-#endif // __cplusplus
-
-#define FOO 10
-
-#define ZOM 3.14
-
-typedef struct Foo {
- int32_t x[FOO];
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#ifdef __cplusplus
-} // namespace constants
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/namespace_constant.compat.c b/cbindgen-0.24.5/tests/expectations/namespace_constant.compat.c
deleted file mode 100644
index 49e3f65..0000000
--- a/cbindgen-0.24.5/tests/expectations/namespace_constant.compat.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-namespace constants {
-#endif // __cplusplus
-
-#define FOO 10
-
-#define ZOM 3.14
-
-typedef struct {
- int32_t x[FOO];
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Foo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#ifdef __cplusplus
-} // namespace constants
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/namespace_constant.cpp b/cbindgen-0.24.5/tests/expectations/namespace_constant.cpp
deleted file mode 100644
index 889472c..0000000
--- a/cbindgen-0.24.5/tests/expectations/namespace_constant.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-namespace constants {
-
-constexpr static const int32_t FOO = 10;
-
-constexpr static const float ZOM = 3.14;
-
-struct Foo {
- int32_t x[FOO];
-};
-
-extern "C" {
-
-void root(Foo x);
-
-} // extern "C"
-
-} // namespace constants
diff --git a/cbindgen-0.24.5/tests/expectations/namespace_constant.tag.compat.c b/cbindgen-0.24.5/tests/expectations/namespace_constant.tag.compat.c
deleted file mode 100644
index cb599dc..0000000
--- a/cbindgen-0.24.5/tests/expectations/namespace_constant.tag.compat.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-namespace constants {
-#endif // __cplusplus
-
-#define FOO 10
-
-#define ZOM 3.14
-
-struct Foo {
- int32_t x[FOO];
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#ifdef __cplusplus
-} // namespace constants
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/namespaces_constant.both.c b/cbindgen-0.24.5/tests/expectations/namespaces_constant.both.c
deleted file mode 100644
index 853713a..0000000
--- a/cbindgen-0.24.5/tests/expectations/namespaces_constant.both.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define FOO 10
-
-#define ZOM 3.14
-
-typedef struct Foo {
- int32_t x[FOO];
-} Foo;
-
-void root(struct Foo x);
diff --git a/cbindgen-0.24.5/tests/expectations/namespaces_constant.both.compat.c b/cbindgen-0.24.5/tests/expectations/namespaces_constant.both.compat.c
deleted file mode 100644
index c253d74..0000000
--- a/cbindgen-0.24.5/tests/expectations/namespaces_constant.both.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-namespace constants {
-namespace test {
-#endif // __cplusplus
-
-#define FOO 10
-
-#define ZOM 3.14
-
-typedef struct Foo {
- int32_t x[FOO];
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#ifdef __cplusplus
-} // namespace test
-} // namespace constants
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/namespaces_constant.compat.c b/cbindgen-0.24.5/tests/expectations/namespaces_constant.compat.c
deleted file mode 100644
index 5c4a35f..0000000
--- a/cbindgen-0.24.5/tests/expectations/namespaces_constant.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-namespace constants {
-namespace test {
-#endif // __cplusplus
-
-#define FOO 10
-
-#define ZOM 3.14
-
-typedef struct {
- int32_t x[FOO];
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Foo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#ifdef __cplusplus
-} // namespace test
-} // namespace constants
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/namespaces_constant.cpp b/cbindgen-0.24.5/tests/expectations/namespaces_constant.cpp
deleted file mode 100644
index 2da55d7..0000000
--- a/cbindgen-0.24.5/tests/expectations/namespaces_constant.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-namespace constants {
-namespace test {
-
-constexpr static const int32_t FOO = 10;
-
-constexpr static const float ZOM = 3.14;
-
-struct Foo {
- int32_t x[FOO];
-};
-
-extern "C" {
-
-void root(Foo x);
-
-} // extern "C"
-
-} // namespace test
-} // namespace constants
diff --git a/cbindgen-0.24.5/tests/expectations/namespaces_constant.tag.c b/cbindgen-0.24.5/tests/expectations/namespaces_constant.tag.c
deleted file mode 100644
index 80a8ea0..0000000
--- a/cbindgen-0.24.5/tests/expectations/namespaces_constant.tag.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define FOO 10
-
-#define ZOM 3.14
-
-struct Foo {
- int32_t x[FOO];
-};
-
-void root(struct Foo x);
diff --git a/cbindgen-0.24.5/tests/expectations/namespaces_constant.tag.compat.c b/cbindgen-0.24.5/tests/expectations/namespaces_constant.tag.compat.c
deleted file mode 100644
index fd57fcc..0000000
--- a/cbindgen-0.24.5/tests/expectations/namespaces_constant.tag.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-namespace constants {
-namespace test {
-#endif // __cplusplus
-
-#define FOO 10
-
-#define ZOM 3.14
-
-struct Foo {
- int32_t x[FOO];
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#ifdef __cplusplus
-} // namespace test
-} // namespace constants
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/namespaces_constant.tag.pyx b/cbindgen-0.24.5/tests/expectations/namespaces_constant.tag.pyx
deleted file mode 100644
index 8c1d8aa..0000000
--- a/cbindgen-0.24.5/tests/expectations/namespaces_constant.tag.pyx
+++ /dev/null
@@ -1,16 +0,0 @@
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- const int32_t FOO # = 10
-
- const float ZOM # = 3.14
-
- cdef struct Foo:
- int32_t x[FOO];
-
- void root(Foo x);
diff --git a/cbindgen-0.24.5/tests/expectations/no_includes.compat.c b/cbindgen-0.24.5/tests/expectations/no_includes.compat.c
deleted file mode 100644
index cbb5e76..0000000
--- a/cbindgen-0.24.5/tests/expectations/no_includes.compat.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/no_includes.cpp b/cbindgen-0.24.5/tests/expectations/no_includes.cpp
deleted file mode 100644
index ba8247b..0000000
--- a/cbindgen-0.24.5/tests/expectations/no_includes.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-
-extern "C" {
-
-void root();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull.both.compat.c b/cbindgen-0.24.5/tests/expectations/nonnull.both.compat.c
deleted file mode 100644
index 018743b..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonnull.both.compat.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Opaque Opaque;
-
-typedef struct Foo_u64 {
- float *a;
- uint64_t *b;
- struct Opaque *c;
- uint64_t **d;
- float **e;
- struct Opaque **f;
- uint64_t *g;
- int32_t *h;
- int32_t **i;
-} Foo_u64;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(int32_t *arg, struct Foo_u64 *foo, struct Opaque **d);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull.compat.c b/cbindgen-0.24.5/tests/expectations/nonnull.compat.c
deleted file mode 100644
index a2605e0..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonnull.compat.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Opaque Opaque;
-
-typedef struct {
- float *a;
- uint64_t *b;
- Opaque *c;
- uint64_t **d;
- float **e;
- Opaque **f;
- uint64_t *g;
- int32_t *h;
- int32_t **i;
-} Foo_u64;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(int32_t *arg, Foo_u64 *foo, Opaque **d);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull.cpp b/cbindgen-0.24.5/tests/expectations/nonnull.cpp
deleted file mode 100644
index 323949a..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonnull.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Opaque;
-
-template<typename T>
-struct Foo {
- float *a;
- T *b;
- Opaque *c;
- T **d;
- float **e;
- Opaque **f;
- T *g;
- int32_t *h;
- int32_t **i;
-};
-
-extern "C" {
-
-void root(int32_t *arg, Foo<uint64_t> *foo, Opaque **d);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull.tag.compat.c b/cbindgen-0.24.5/tests/expectations/nonnull.tag.compat.c
deleted file mode 100644
index 2a074c8..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonnull.tag.compat.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Opaque;
-
-struct Foo_u64 {
- float *a;
- uint64_t *b;
- struct Opaque *c;
- uint64_t **d;
- float **e;
- struct Opaque **f;
- uint64_t *g;
- int32_t *h;
- int32_t **i;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(int32_t *arg, struct Foo_u64 *foo, struct Opaque **d);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull_attribute.both.compat.c b/cbindgen-0.24.5/tests/expectations/nonnull_attribute.both.compat.c
deleted file mode 100644
index 4ba7254..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonnull_attribute.both.compat.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifdef __clang__
-#define CBINDGEN_NONNULL _Nonnull
-#else
-#define CBINDGEN_NONNULL
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Opaque Opaque;
-
-typedef struct References {
- const struct Opaque *CBINDGEN_NONNULL a;
- struct Opaque *CBINDGEN_NONNULL b;
- const struct Opaque *c;
- struct Opaque *d;
-} References;
-
-typedef struct Pointers_u64 {
- float *CBINDGEN_NONNULL a;
- uint64_t *CBINDGEN_NONNULL b;
- struct Opaque *CBINDGEN_NONNULL c;
- uint64_t *CBINDGEN_NONNULL *CBINDGEN_NONNULL d;
- float *CBINDGEN_NONNULL *CBINDGEN_NONNULL e;
- struct Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL f;
- uint64_t *g;
- int32_t *h;
- int32_t *CBINDGEN_NONNULL *i;
- const uint64_t *j;
- uint64_t *k;
-} Pointers_u64;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void value_arg(struct References arg);
-
-void mutltiple_args(int32_t *CBINDGEN_NONNULL arg,
- struct Pointers_u64 *foo,
- struct Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL d);
-
-void ref_arg(const struct Pointers_u64 *CBINDGEN_NONNULL arg);
-
-void mut_ref_arg(struct Pointers_u64 *CBINDGEN_NONNULL arg);
-
-void optional_ref_arg(const struct Pointers_u64 *arg);
-
-void optional_mut_ref_arg(struct Pointers_u64 *arg);
-
-void nullable_const_ptr(const struct Pointers_u64 *arg);
-
-void nullable_mut_ptr(struct Pointers_u64 *arg);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull_attribute.compat.c b/cbindgen-0.24.5/tests/expectations/nonnull_attribute.compat.c
deleted file mode 100644
index 726b179..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonnull_attribute.compat.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifdef __clang__
-#define CBINDGEN_NONNULL _Nonnull
-#else
-#define CBINDGEN_NONNULL
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Opaque Opaque;
-
-typedef struct {
- const Opaque *CBINDGEN_NONNULL a;
- Opaque *CBINDGEN_NONNULL b;
- const Opaque *c;
- Opaque *d;
-} References;
-
-typedef struct {
- float *CBINDGEN_NONNULL a;
- uint64_t *CBINDGEN_NONNULL b;
- Opaque *CBINDGEN_NONNULL c;
- uint64_t *CBINDGEN_NONNULL *CBINDGEN_NONNULL d;
- float *CBINDGEN_NONNULL *CBINDGEN_NONNULL e;
- Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL f;
- uint64_t *g;
- int32_t *h;
- int32_t *CBINDGEN_NONNULL *i;
- const uint64_t *j;
- uint64_t *k;
-} Pointers_u64;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void value_arg(References arg);
-
-void mutltiple_args(int32_t *CBINDGEN_NONNULL arg,
- Pointers_u64 *foo,
- Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL d);
-
-void ref_arg(const Pointers_u64 *CBINDGEN_NONNULL arg);
-
-void mut_ref_arg(Pointers_u64 *CBINDGEN_NONNULL arg);
-
-void optional_ref_arg(const Pointers_u64 *arg);
-
-void optional_mut_ref_arg(Pointers_u64 *arg);
-
-void nullable_const_ptr(const Pointers_u64 *arg);
-
-void nullable_mut_ptr(Pointers_u64 *arg);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull_attribute.cpp b/cbindgen-0.24.5/tests/expectations/nonnull_attribute.cpp
deleted file mode 100644
index b57592a..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonnull_attribute.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifdef __clang__
-#define CBINDGEN_NONNULL _Nonnull
-#else
-#define CBINDGEN_NONNULL
-#endif
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Opaque;
-
-struct References {
- const Opaque *CBINDGEN_NONNULL a;
- Opaque *CBINDGEN_NONNULL b;
- const Opaque *c;
- Opaque *d;
-};
-
-template<typename T>
-struct Pointers {
- float *CBINDGEN_NONNULL a;
- T *CBINDGEN_NONNULL b;
- Opaque *CBINDGEN_NONNULL c;
- T *CBINDGEN_NONNULL *CBINDGEN_NONNULL d;
- float *CBINDGEN_NONNULL *CBINDGEN_NONNULL e;
- Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL f;
- T *g;
- int32_t *h;
- int32_t *CBINDGEN_NONNULL *i;
- const T *j;
- T *k;
-};
-
-extern "C" {
-
-void value_arg(References arg);
-
-void mutltiple_args(int32_t *CBINDGEN_NONNULL arg,
- Pointers<uint64_t> *foo,
- Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL d);
-
-void ref_arg(const Pointers<uint64_t> *CBINDGEN_NONNULL arg);
-
-void mut_ref_arg(Pointers<uint64_t> *CBINDGEN_NONNULL arg);
-
-void optional_ref_arg(const Pointers<uint64_t> *arg);
-
-void optional_mut_ref_arg(Pointers<uint64_t> *arg);
-
-void nullable_const_ptr(const Pointers<uint64_t> *arg);
-
-void nullable_mut_ptr(Pointers<uint64_t> *arg);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull_attribute.tag.compat.c b/cbindgen-0.24.5/tests/expectations/nonnull_attribute.tag.compat.c
deleted file mode 100644
index 757f572..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonnull_attribute.tag.compat.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifdef __clang__
-#define CBINDGEN_NONNULL _Nonnull
-#else
-#define CBINDGEN_NONNULL
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Opaque;
-
-struct References {
- const struct Opaque *CBINDGEN_NONNULL a;
- struct Opaque *CBINDGEN_NONNULL b;
- const struct Opaque *c;
- struct Opaque *d;
-};
-
-struct Pointers_u64 {
- float *CBINDGEN_NONNULL a;
- uint64_t *CBINDGEN_NONNULL b;
- struct Opaque *CBINDGEN_NONNULL c;
- uint64_t *CBINDGEN_NONNULL *CBINDGEN_NONNULL d;
- float *CBINDGEN_NONNULL *CBINDGEN_NONNULL e;
- struct Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL f;
- uint64_t *g;
- int32_t *h;
- int32_t *CBINDGEN_NONNULL *i;
- const uint64_t *j;
- uint64_t *k;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void value_arg(struct References arg);
-
-void mutltiple_args(int32_t *CBINDGEN_NONNULL arg,
- struct Pointers_u64 *foo,
- struct Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL d);
-
-void ref_arg(const struct Pointers_u64 *CBINDGEN_NONNULL arg);
-
-void mut_ref_arg(struct Pointers_u64 *CBINDGEN_NONNULL arg);
-
-void optional_ref_arg(const struct Pointers_u64 *arg);
-
-void optional_mut_ref_arg(struct Pointers_u64 *arg);
-
-void nullable_const_ptr(const struct Pointers_u64 *arg);
-
-void nullable_mut_ptr(struct Pointers_u64 *arg);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/nonzero.both.c b/cbindgen-0.24.5/tests/expectations/nonzero.both.c
deleted file mode 100644
index 4999765..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonzero.both.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-struct NonZeroI64;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Option_i64 Option_i64;
-
-typedef struct NonZeroTest {
- uint8_t a;
- uint16_t b;
- uint32_t c;
- uint64_t d;
- int8_t e;
- int16_t f;
- int32_t g;
- int64_t h;
- int64_t i;
- const struct Option_i64 *j;
-} NonZeroTest;
-
-void root(struct NonZeroTest test,
- uint8_t a,
- uint16_t b,
- uint32_t c,
- uint64_t d,
- int8_t e,
- int16_t f,
- int32_t g,
- int64_t h,
- int64_t i,
- const struct Option_i64 *j);
diff --git a/cbindgen-0.24.5/tests/expectations/nonzero.both.compat.c b/cbindgen-0.24.5/tests/expectations/nonzero.both.compat.c
deleted file mode 100644
index c0dba9e..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonzero.both.compat.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-struct NonZeroI64;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Option_i64 Option_i64;
-
-typedef struct NonZeroTest {
- uint8_t a;
- uint16_t b;
- uint32_t c;
- uint64_t d;
- int8_t e;
- int16_t f;
- int32_t g;
- int64_t h;
- int64_t i;
- const struct Option_i64 *j;
-} NonZeroTest;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct NonZeroTest test,
- uint8_t a,
- uint16_t b,
- uint32_t c,
- uint64_t d,
- int8_t e,
- int16_t f,
- int32_t g,
- int64_t h,
- int64_t i,
- const struct Option_i64 *j);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/nonzero.c b/cbindgen-0.24.5/tests/expectations/nonzero.c
deleted file mode 100644
index aaf47d0..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonzero.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-struct NonZeroI64;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Option_i64 Option_i64;
-
-typedef struct {
- uint8_t a;
- uint16_t b;
- uint32_t c;
- uint64_t d;
- int8_t e;
- int16_t f;
- int32_t g;
- int64_t h;
- int64_t i;
- const Option_i64 *j;
-} NonZeroTest;
-
-void root(NonZeroTest test,
- uint8_t a,
- uint16_t b,
- uint32_t c,
- uint64_t d,
- int8_t e,
- int16_t f,
- int32_t g,
- int64_t h,
- int64_t i,
- const Option_i64 *j);
diff --git a/cbindgen-0.24.5/tests/expectations/nonzero.compat.c b/cbindgen-0.24.5/tests/expectations/nonzero.compat.c
deleted file mode 100644
index 052e573..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonzero.compat.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-struct NonZeroI64;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Option_i64 Option_i64;
-
-typedef struct {
- uint8_t a;
- uint16_t b;
- uint32_t c;
- uint64_t d;
- int8_t e;
- int16_t f;
- int32_t g;
- int64_t h;
- int64_t i;
- const Option_i64 *j;
-} NonZeroTest;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(NonZeroTest test,
- uint8_t a,
- uint16_t b,
- uint32_t c,
- uint64_t d,
- int8_t e,
- int16_t f,
- int32_t g,
- int64_t h,
- int64_t i,
- const Option_i64 *j);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/nonzero.cpp b/cbindgen-0.24.5/tests/expectations/nonzero.cpp
deleted file mode 100644
index 7bae672..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonzero.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-struct NonZeroI64;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T = void>
-struct Option;
-
-struct NonZeroTest {
- uint8_t a;
- uint16_t b;
- uint32_t c;
- uint64_t d;
- int8_t e;
- int16_t f;
- int32_t g;
- int64_t h;
- int64_t i;
- const Option<int64_t> *j;
-};
-
-extern "C" {
-
-void root(NonZeroTest test,
- uint8_t a,
- uint16_t b,
- uint32_t c,
- uint64_t d,
- int8_t e,
- int16_t f,
- int32_t g,
- int64_t h,
- int64_t i,
- const Option<int64_t> *j);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/nonzero.pyx b/cbindgen-0.24.5/tests/expectations/nonzero.pyx
deleted file mode 100644
index 84b9cb9..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonzero.pyx
+++ /dev/null
@@ -1,47 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-struct NonZeroI64;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- ctypedef struct Option_i64:
- pass
-
- ctypedef struct NonZeroTest:
- uint8_t a;
- uint16_t b;
- uint32_t c;
- uint64_t d;
- int8_t e;
- int16_t f;
- int32_t g;
- int64_t h;
- int64_t i;
- const Option_i64 *j;
-
- void root(NonZeroTest test,
- uint8_t a,
- uint16_t b,
- uint32_t c,
- uint64_t d,
- int8_t e,
- int16_t f,
- int32_t g,
- int64_t h,
- int64_t i,
- const Option_i64 *j);
diff --git a/cbindgen-0.24.5/tests/expectations/nonzero.tag.c b/cbindgen-0.24.5/tests/expectations/nonzero.tag.c
deleted file mode 100644
index 7a28efd..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonzero.tag.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-struct NonZeroI64;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Option_i64;
-
-struct NonZeroTest {
- uint8_t a;
- uint16_t b;
- uint32_t c;
- uint64_t d;
- int8_t e;
- int16_t f;
- int32_t g;
- int64_t h;
- int64_t i;
- const struct Option_i64 *j;
-};
-
-void root(struct NonZeroTest test,
- uint8_t a,
- uint16_t b,
- uint32_t c,
- uint64_t d,
- int8_t e,
- int16_t f,
- int32_t g,
- int64_t h,
- int64_t i,
- const struct Option_i64 *j);
diff --git a/cbindgen-0.24.5/tests/expectations/nonzero.tag.compat.c b/cbindgen-0.24.5/tests/expectations/nonzero.tag.compat.c
deleted file mode 100644
index bf9a121..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonzero.tag.compat.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-struct NonZeroI64;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Option_i64;
-
-struct NonZeroTest {
- uint8_t a;
- uint16_t b;
- uint32_t c;
- uint64_t d;
- int8_t e;
- int16_t f;
- int32_t g;
- int64_t h;
- int64_t i;
- const struct Option_i64 *j;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct NonZeroTest test,
- uint8_t a,
- uint16_t b,
- uint32_t c,
- uint64_t d,
- int8_t e,
- int16_t f,
- int32_t g,
- int64_t h,
- int64_t i,
- const struct Option_i64 *j);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/nonzero.tag.pyx b/cbindgen-0.24.5/tests/expectations/nonzero.tag.pyx
deleted file mode 100644
index 88b309a..0000000
--- a/cbindgen-0.24.5/tests/expectations/nonzero.tag.pyx
+++ /dev/null
@@ -1,47 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-struct NonZeroI64;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- cdef struct Option_i64:
- pass
-
- cdef struct NonZeroTest:
- uint8_t a;
- uint16_t b;
- uint32_t c;
- uint64_t d;
- int8_t e;
- int16_t f;
- int32_t g;
- int64_t h;
- int64_t i;
- const Option_i64 *j;
-
- void root(NonZeroTest test,
- uint8_t a,
- uint16_t b,
- uint32_t c,
- uint64_t d,
- int8_t e,
- int16_t f,
- int32_t g,
- int64_t h,
- int64_t i,
- const Option_i64 *j);
diff --git a/cbindgen-0.24.5/tests/expectations/opaque.both.compat.c b/cbindgen-0.24.5/tests/expectations/opaque.both.compat.c
deleted file mode 100644
index 5ca0a79..0000000
--- a/cbindgen-0.24.5/tests/expectations/opaque.both.compat.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-// These could be added as opaque types I guess.
-template <typename T>
-struct BuildHasherDefault;
-
-struct DefaultHasher;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct HashMap_i32__i32__BuildHasherDefault_DefaultHasher HashMap_i32__i32__BuildHasherDefault_DefaultHasher;
-
-typedef struct Result_Foo Result_Foo;
-
-/**
- * Fast hash map used internally.
- */
-typedef struct HashMap_i32__i32__BuildHasherDefault_DefaultHasher FastHashMap_i32__i32;
-
-typedef FastHashMap_i32__i32 Foo;
-
-typedef struct Result_Foo Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const Bar *b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/opaque.compat.c b/cbindgen-0.24.5/tests/expectations/opaque.compat.c
deleted file mode 100644
index 0efe467..0000000
--- a/cbindgen-0.24.5/tests/expectations/opaque.compat.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-// These could be added as opaque types I guess.
-template <typename T>
-struct BuildHasherDefault;
-
-struct DefaultHasher;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct HashMap_i32__i32__BuildHasherDefault_DefaultHasher HashMap_i32__i32__BuildHasherDefault_DefaultHasher;
-
-typedef struct Result_Foo Result_Foo;
-
-/**
- * Fast hash map used internally.
- */
-typedef HashMap_i32__i32__BuildHasherDefault_DefaultHasher FastHashMap_i32__i32;
-
-typedef FastHashMap_i32__i32 Foo;
-
-typedef Result_Foo Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const Bar *b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/opaque.cpp b/cbindgen-0.24.5/tests/expectations/opaque.cpp
deleted file mode 100644
index ea14421..0000000
--- a/cbindgen-0.24.5/tests/expectations/opaque.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-// These could be added as opaque types I guess.
-template <typename T>
-struct BuildHasherDefault;
-
-struct DefaultHasher;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename K = void, typename V = void, typename Hasher = void>
-struct HashMap;
-
-template<typename T = void, typename E = void>
-struct Result;
-
-/// Fast hash map used internally.
-template<typename K, typename V>
-using FastHashMap = HashMap<K, V, BuildHasherDefault<DefaultHasher>>;
-
-using Foo = FastHashMap<int32_t, int32_t>;
-
-using Bar = Result<Foo>;
-
-extern "C" {
-
-void root(const Foo *a, const Bar *b);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/opaque.tag.compat.c b/cbindgen-0.24.5/tests/expectations/opaque.tag.compat.c
deleted file mode 100644
index 4fef399..0000000
--- a/cbindgen-0.24.5/tests/expectations/opaque.tag.compat.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-// These could be added as opaque types I guess.
-template <typename T>
-struct BuildHasherDefault;
-
-struct DefaultHasher;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct HashMap_i32__i32__BuildHasherDefault_DefaultHasher;
-
-struct Result_Foo;
-
-/**
- * Fast hash map used internally.
- */
-typedef struct HashMap_i32__i32__BuildHasherDefault_DefaultHasher FastHashMap_i32__i32;
-
-typedef FastHashMap_i32__i32 Foo;
-
-typedef struct Result_Foo Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Foo *a, const Bar *b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/pin.both.compat.c b/cbindgen-0.24.5/tests/expectations/pin.both.compat.c
deleted file mode 100644
index 126cb66..0000000
--- a/cbindgen-0.24.5/tests/expectations/pin.both.compat.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using Pin = T;
-template <typename T>
-using Box = T*;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct PinTest {
- int32_t *pinned_box;
- int32_t *pinned_ref;
-} PinTest;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(int32_t *s, struct PinTest p);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/pin.compat.c b/cbindgen-0.24.5/tests/expectations/pin.compat.c
deleted file mode 100644
index 2cccd3e..0000000
--- a/cbindgen-0.24.5/tests/expectations/pin.compat.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using Pin = T;
-template <typename T>
-using Box = T*;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- int32_t *pinned_box;
- int32_t *pinned_ref;
-} PinTest;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(int32_t *s, PinTest p);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/pin.cpp b/cbindgen-0.24.5/tests/expectations/pin.cpp
deleted file mode 100644
index 8a5bc2c..0000000
--- a/cbindgen-0.24.5/tests/expectations/pin.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using Pin = T;
-template <typename T>
-using Box = T*;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct PinTest {
- Pin<Box<int32_t>> pinned_box;
- Pin<int32_t*> pinned_ref;
-};
-
-extern "C" {
-
-void root(Pin<int32_t*> s, PinTest p);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/pin.tag.compat.c b/cbindgen-0.24.5/tests/expectations/pin.tag.compat.c
deleted file mode 100644
index ecaae82..0000000
--- a/cbindgen-0.24.5/tests/expectations/pin.tag.compat.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#if 0
-''' '
-#endif
-
-#ifdef __cplusplus
-template <typename T>
-using Pin = T;
-template <typename T>
-using Box = T*;
-#endif
-
-#if 0
-' '''
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct PinTest {
- int32_t *pinned_box;
- int32_t *pinned_ref;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(int32_t *s, struct PinTest p);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/pragma_once.compat.c b/cbindgen-0.24.5/tests/expectations/pragma_once.compat.c
deleted file mode 100644
index 2a6e9b1..0000000
--- a/cbindgen-0.24.5/tests/expectations/pragma_once.compat.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/pragma_once.cpp b/cbindgen-0.24.5/tests/expectations/pragma_once.cpp
deleted file mode 100644
index 4d29d96..0000000
--- a/cbindgen-0.24.5/tests/expectations/pragma_once.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#pragma once
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-void root();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/prefix.both.compat.c b/cbindgen-0.24.5/tests/expectations/prefix.both.compat.c
deleted file mode 100644
index 9f227b9..0000000
--- a/cbindgen-0.24.5/tests/expectations/prefix.both.compat.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define PREFIX_LEN 22
-
-#define PREFIX_X (22 << 22)
-
-#define PREFIX_Y (PREFIX_X + PREFIX_X)
-
-typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
-
-typedef int32_t PREFIX_ValuedLenArray[22];
-
-enum PREFIX_AbsoluteFontWeight_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Weight,
- Normal,
- Bold,
-};
-#ifndef __cplusplus
-typedef uint8_t PREFIX_AbsoluteFontWeight_Tag;
-#endif // __cplusplus
-
-typedef union PREFIX_AbsoluteFontWeight {
- PREFIX_AbsoluteFontWeight_Tag tag;
- struct {
- PREFIX_AbsoluteFontWeight_Tag weight_tag;
- float weight;
- };
-} PREFIX_AbsoluteFontWeight;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(PREFIX_NamedLenArray x, PREFIX_ValuedLenArray y, union PREFIX_AbsoluteFontWeight z);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefix.compat.c b/cbindgen-0.24.5/tests/expectations/prefix.compat.c
deleted file mode 100644
index b307000..0000000
--- a/cbindgen-0.24.5/tests/expectations/prefix.compat.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define PREFIX_LEN 22
-
-#define PREFIX_X (22 << 22)
-
-#define PREFIX_Y (PREFIX_X + PREFIX_X)
-
-typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
-
-typedef int32_t PREFIX_ValuedLenArray[22];
-
-enum PREFIX_AbsoluteFontWeight_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Weight,
- Normal,
- Bold,
-};
-#ifndef __cplusplus
-typedef uint8_t PREFIX_AbsoluteFontWeight_Tag;
-#endif // __cplusplus
-
-typedef union {
- PREFIX_AbsoluteFontWeight_Tag tag;
- struct {
- PREFIX_AbsoluteFontWeight_Tag weight_tag;
- float weight;
- };
-} PREFIX_AbsoluteFontWeight;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(PREFIX_NamedLenArray x, PREFIX_ValuedLenArray y, PREFIX_AbsoluteFontWeight z);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefix.cpp b/cbindgen-0.24.5/tests/expectations/prefix.cpp
deleted file mode 100644
index 7f2c8ba..0000000
--- a/cbindgen-0.24.5/tests/expectations/prefix.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-constexpr static const int32_t PREFIX_LEN = 22;
-
-constexpr static const int64_t PREFIX_X = (22 << 22);
-
-constexpr static const int64_t PREFIX_Y = (PREFIX_X + PREFIX_X);
-
-using PREFIX_NamedLenArray = int32_t[PREFIX_LEN];
-
-using PREFIX_ValuedLenArray = int32_t[22];
-
-union PREFIX_AbsoluteFontWeight {
- enum class Tag : uint8_t {
- Weight,
- Normal,
- Bold,
- };
-
- struct Weight_Body {
- Tag tag;
- float _0;
- };
-
- struct {
- Tag tag;
- };
- Weight_Body weight;
-};
-
-extern "C" {
-
-void root(PREFIX_NamedLenArray x, PREFIX_ValuedLenArray y, PREFIX_AbsoluteFontWeight z);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/prefix.tag.compat.c b/cbindgen-0.24.5/tests/expectations/prefix.tag.compat.c
deleted file mode 100644
index b5da340..0000000
--- a/cbindgen-0.24.5/tests/expectations/prefix.tag.compat.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define PREFIX_LEN 22
-
-#define PREFIX_X (22 << 22)
-
-#define PREFIX_Y (PREFIX_X + PREFIX_X)
-
-typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
-
-typedef int32_t PREFIX_ValuedLenArray[22];
-
-enum PREFIX_AbsoluteFontWeight_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Weight,
- Normal,
- Bold,
-};
-#ifndef __cplusplus
-typedef uint8_t PREFIX_AbsoluteFontWeight_Tag;
-#endif // __cplusplus
-
-union PREFIX_AbsoluteFontWeight {
- PREFIX_AbsoluteFontWeight_Tag tag;
- struct {
- PREFIX_AbsoluteFontWeight_Tag weight_tag;
- float weight;
- };
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(PREFIX_NamedLenArray x, PREFIX_ValuedLenArray y, union PREFIX_AbsoluteFontWeight z);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.both.compat.c b/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.both.compat.c
deleted file mode 100644
index 71168b5..0000000
--- a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.both.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct PREFIXFoo {
- int32_t a;
- uint32_t b;
-} PREFIXFoo;
-#define PREFIXFoo_FOO (PREFIXFoo){ .a = 42, .b = 47 }
-
-#define PREFIXBAR (PREFIXFoo){ .a = 42, .b = 1337 }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct PREFIXFoo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.compat.c b/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.compat.c
deleted file mode 100644
index 46ee66a..0000000
--- a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- int32_t a;
- uint32_t b;
-} PREFIXFoo;
-#define PREFIXFoo_FOO (PREFIXFoo){ .a = 42, .b = 47 }
-
-#define PREFIXBAR (PREFIXFoo){ .a = 42, .b = 1337 }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(PREFIXFoo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.cpp b/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.cpp
deleted file mode 100644
index 218d1c8..0000000
--- a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct PREFIXFoo {
- int32_t a;
- uint32_t b;
-};
-constexpr static const PREFIXFoo PREFIXFoo_FOO = PREFIXFoo{ /* .a = */ 42, /* .b = */ 47 };
-
-constexpr static const PREFIXFoo PREFIXBAR = PREFIXFoo{ /* .a = */ 42, /* .b = */ 1337 };
-
-extern "C" {
-
-void root(PREFIXFoo x);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.tag.compat.c b/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.tag.compat.c
deleted file mode 100644
index 2bd6fa8..0000000
--- a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.tag.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct PREFIXFoo {
- int32_t a;
- uint32_t b;
-};
-#define PREFIXFoo_FOO (PREFIXFoo){ .a = 42, .b = 47 }
-
-#define PREFIXBAR (PREFIXFoo){ .a = 42, .b = 1337 }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct PREFIXFoo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.both.compat.c b/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.both.compat.c
deleted file mode 100644
index f5c0156..0000000
--- a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.both.compat.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct PREFIXBar {
- int32_t a;
-} PREFIXBar;
-
-typedef struct PREFIXFoo {
- int32_t a;
- uint32_t b;
- struct PREFIXBar bar;
-} PREFIXFoo;
-
-#define PREFIXVAL (PREFIXFoo){ .a = 42, .b = 1337, .bar = (PREFIXBar){ .a = 323 } }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct PREFIXFoo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.compat.c b/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.compat.c
deleted file mode 100644
index 7d3e09e..0000000
--- a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.compat.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- int32_t a;
-} PREFIXBar;
-
-typedef struct {
- int32_t a;
- uint32_t b;
- PREFIXBar bar;
-} PREFIXFoo;
-
-#define PREFIXVAL (PREFIXFoo){ .a = 42, .b = 1337, .bar = (PREFIXBar){ .a = 323 } }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(PREFIXFoo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.cpp b/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.cpp
deleted file mode 100644
index 4dbfb7b..0000000
--- a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct PREFIXBar {
- int32_t a;
-};
-
-struct PREFIXFoo {
- int32_t a;
- uint32_t b;
- PREFIXBar bar;
-};
-
-constexpr static const PREFIXFoo PREFIXVAL = PREFIXFoo{ /* .a = */ 42, /* .b = */ 1337, /* .bar = */ PREFIXBar{ /* .a = */ 323 } };
-
-extern "C" {
-
-void root(PREFIXFoo x);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.tag.compat.c b/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.tag.compat.c
deleted file mode 100644
index 4fb7c69..0000000
--- a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.tag.compat.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct PREFIXBar {
- int32_t a;
-};
-
-struct PREFIXFoo {
- int32_t a;
- uint32_t b;
- struct PREFIXBar bar;
-};
-
-#define PREFIXVAL (PREFIXFoo){ .a = 42, .b = 1337, .bar = (PREFIXBar){ .a = 323 } }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct PREFIXFoo x);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/ptrs_as_arrays.compat.c b/cbindgen-0.24.5/tests/expectations/ptrs_as_arrays.compat.c
deleted file mode 100644
index ec6b905..0000000
--- a/cbindgen-0.24.5/tests/expectations/ptrs_as_arrays.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void ptr_as_array(uint32_t n, const uint32_t arg[3], const uint64_t *v);
-
-void ptr_as_array1(uint32_t n, const uint32_t arg[3], uint64_t v[4]);
-
-void ptr_as_array2(uint32_t n, uint32_t arg[], const uint64_t v[]);
-
-void ptr_as_array_wrong_syntax(uint32_t *arg, const uint32_t *v, const uint32_t*);
-
-void ptr_as_array_unnamed(uint32_t*, const uint32_t*);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/ptrs_as_arrays.cpp b/cbindgen-0.24.5/tests/expectations/ptrs_as_arrays.cpp
deleted file mode 100644
index a4731a0..0000000
--- a/cbindgen-0.24.5/tests/expectations/ptrs_as_arrays.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-void ptr_as_array(uint32_t n, const uint32_t arg[3], const uint64_t *v);
-
-void ptr_as_array1(uint32_t n, const uint32_t arg[3], uint64_t v[4]);
-
-void ptr_as_array2(uint32_t n, uint32_t arg[], const uint64_t v[]);
-
-void ptr_as_array_wrong_syntax(uint32_t *arg, const uint32_t *v, const uint32_t*);
-
-void ptr_as_array_unnamed(uint32_t*, const uint32_t*);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/raw_ident.both.compat.c b/cbindgen-0.24.5/tests/expectations/raw_ident.both.compat.c
deleted file mode 100644
index fcc7cdd..0000000
--- a/cbindgen-0.24.5/tests/expectations/raw_ident.both.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum Enum
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- a,
- b,
-};
-#ifndef __cplusplus
-typedef uint8_t Enum;
-#endif // __cplusplus
-
-typedef struct Struct {
- Enum field;
-} Struct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern const Enum STATIC;
-
-void fn(struct Struct arg);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/raw_ident.compat.c b/cbindgen-0.24.5/tests/expectations/raw_ident.compat.c
deleted file mode 100644
index 6ae0663..0000000
--- a/cbindgen-0.24.5/tests/expectations/raw_ident.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum Enum
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- a,
- b,
-};
-#ifndef __cplusplus
-typedef uint8_t Enum;
-#endif // __cplusplus
-
-typedef struct {
- Enum field;
-} Struct;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern const Enum STATIC;
-
-void fn(Struct arg);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/raw_ident.cpp b/cbindgen-0.24.5/tests/expectations/raw_ident.cpp
deleted file mode 100644
index 60b8e02..0000000
--- a/cbindgen-0.24.5/tests/expectations/raw_ident.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-enum class Enum : uint8_t {
- a,
- b,
-};
-
-struct Struct {
- Enum field;
-};
-
-extern "C" {
-
-extern const Enum STATIC;
-
-void fn(Struct arg);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/raw_ident.tag.compat.c b/cbindgen-0.24.5/tests/expectations/raw_ident.tag.compat.c
deleted file mode 100644
index ad38cc7..0000000
--- a/cbindgen-0.24.5/tests/expectations/raw_ident.tag.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum Enum
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- a,
- b,
-};
-#ifndef __cplusplus
-typedef uint8_t Enum;
-#endif // __cplusplus
-
-struct Struct {
- Enum field;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern const Enum STATIC;
-
-void fn(struct Struct arg);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/raw_lines.c b/cbindgen-0.24.5/tests/expectations/raw_lines.c
deleted file mode 100644
index f136292..0000000
--- a/cbindgen-0.24.5/tests/expectations/raw_lines.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef INCLUDE_GUARD_H
-#define INCLUDE_GUARD_H
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-#define VERSION 1
-
-void root(void);
-
-#endif /* INCLUDE_GUARD_H */
diff --git a/cbindgen-0.24.5/tests/expectations/raw_lines.compat.c b/cbindgen-0.24.5/tests/expectations/raw_lines.compat.c
deleted file mode 100644
index 05f4493..0000000
--- a/cbindgen-0.24.5/tests/expectations/raw_lines.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef INCLUDE_GUARD_H
-#define INCLUDE_GUARD_H
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-#define VERSION 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#endif /* INCLUDE_GUARD_H */
diff --git a/cbindgen-0.24.5/tests/expectations/raw_lines.cpp b/cbindgen-0.24.5/tests/expectations/raw_lines.cpp
deleted file mode 100644
index 3619eca..0000000
--- a/cbindgen-0.24.5/tests/expectations/raw_lines.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef INCLUDE_GUARD_H
-#define INCLUDE_GUARD_H
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-#define VERSION 1
-
-extern "C" {
-
-void root();
-
-} // extern "C"
-
-#endif // INCLUDE_GUARD_H
diff --git a/cbindgen-0.24.5/tests/expectations/rename.both.compat.c b/cbindgen-0.24.5/tests/expectations/rename.both.compat.c
deleted file mode 100644
index bc44047..0000000
--- a/cbindgen-0.24.5/tests/expectations/rename.both.compat.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define C_H 10
-
-enum C_E
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- x = 0,
- y = 1,
-};
-#ifndef __cplusplus
-typedef uint8_t C_E;
-#endif // __cplusplus
-
-typedef struct C_A C_A;
-
-typedef struct C_C C_C;
-
-typedef struct C_AwesomeB {
- int32_t x;
- float y;
-} C_AwesomeB;
-
-typedef union C_D {
- int32_t x;
- float y;
-} C_D;
-
-typedef struct C_A C_F;
-
-#define C_I (intptr_t)(C_F*)10
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern const int32_t G;
-
-void root(const struct C_A *a, struct C_AwesomeB b, struct C_C c, union C_D d, C_E e, C_F f);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/rename.compat.c b/cbindgen-0.24.5/tests/expectations/rename.compat.c
deleted file mode 100644
index 1394860..0000000
--- a/cbindgen-0.24.5/tests/expectations/rename.compat.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define C_H 10
-
-enum C_E
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- x = 0,
- y = 1,
-};
-#ifndef __cplusplus
-typedef uint8_t C_E;
-#endif // __cplusplus
-
-typedef struct C_A C_A;
-
-typedef struct C_C C_C;
-
-typedef struct {
- int32_t x;
- float y;
-} C_AwesomeB;
-
-typedef union {
- int32_t x;
- float y;
-} C_D;
-
-typedef C_A C_F;
-
-#define C_I (intptr_t)(C_F*)10
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern const int32_t G;
-
-void root(const C_A *a, C_AwesomeB b, C_C c, C_D d, C_E e, C_F f);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/rename.cpp b/cbindgen-0.24.5/tests/expectations/rename.cpp
deleted file mode 100644
index cfa3285..0000000
--- a/cbindgen-0.24.5/tests/expectations/rename.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-constexpr static const int32_t C_H = 10;
-
-enum class C_E : uint8_t {
- x = 0,
- y = 1,
-};
-
-struct C_A;
-
-struct C_C;
-
-struct C_AwesomeB {
- int32_t x;
- float y;
-};
-
-union C_D {
- int32_t x;
- float y;
-};
-
-using C_F = C_A;
-
-static const intptr_t C_I = (intptr_t)(C_F*)10;
-
-extern "C" {
-
-extern const int32_t G;
-
-void root(const C_A *a, C_AwesomeB b, C_C c, C_D d, C_E e, C_F f);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/rename.tag.compat.c b/cbindgen-0.24.5/tests/expectations/rename.tag.compat.c
deleted file mode 100644
index d7cf1c8..0000000
--- a/cbindgen-0.24.5/tests/expectations/rename.tag.compat.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define C_H 10
-
-enum C_E
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- x = 0,
- y = 1,
-};
-#ifndef __cplusplus
-typedef uint8_t C_E;
-#endif // __cplusplus
-
-struct C_A;
-
-struct C_C;
-
-struct C_AwesomeB {
- int32_t x;
- float y;
-};
-
-union C_D {
- int32_t x;
- float y;
-};
-
-typedef struct C_A C_F;
-
-#define C_I (intptr_t)(C_F*)10
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern const int32_t G;
-
-void root(const struct C_A *a, struct C_AwesomeB b, struct C_C c, union C_D d, C_E e, C_F f);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/rename_case.compat.c b/cbindgen-0.24.5/tests/expectations/rename_case.compat.c
deleted file mode 100644
index 61e3310..0000000
--- a/cbindgen-0.24.5/tests/expectations/rename_case.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void test_camel_case(int32_t fooBar);
-
-void test_pascal_case(int32_t FooBar);
-
-void test_snake_case(int32_t foo_bar);
-
-void test_screaming_snake_case(int32_t FOO_BAR);
-
-void test_gecko_case(int32_t aFooBar);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/rename_case.cpp b/cbindgen-0.24.5/tests/expectations/rename_case.cpp
deleted file mode 100644
index 794fa0c..0000000
--- a/cbindgen-0.24.5/tests/expectations/rename_case.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-void test_camel_case(int32_t fooBar);
-
-void test_pascal_case(int32_t FooBar);
-
-void test_snake_case(int32_t foo_bar);
-
-void test_screaming_snake_case(int32_t FOO_BAR);
-
-void test_gecko_case(int32_t aFooBar);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/rename_crate.both.compat.c b/cbindgen-0.24.5/tests/expectations/rename_crate.both.compat.c
deleted file mode 100644
index 49e703c..0000000
--- a/cbindgen-0.24.5/tests/expectations/rename_crate.both.compat.c
+++ /dev/null
@@ -1,49 +0,0 @@
-#if 0
-DEF DEFINE_FREEBSD = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo {
- int32_t x;
-} Foo;
-
-typedef struct RenamedTy {
- uint64_t y;
-} RenamedTy;
-
-#if !defined(DEFINE_FREEBSD)
-typedef struct NoExternTy {
- uint8_t field;
-} NoExternTy;
-#endif
-
-#if !defined(DEFINE_FREEBSD)
-typedef struct ContainsNoExternTy {
- struct NoExternTy field;
-} ContainsNoExternTy;
-#endif
-
-#if defined(DEFINE_FREEBSD)
-typedef struct ContainsNoExternTy {
- uint64_t field;
-} ContainsNoExternTy;
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo a);
-
-void renamed_func(struct RenamedTy a);
-
-void no_extern_func(struct ContainsNoExternTy a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/rename_crate.compat.c b/cbindgen-0.24.5/tests/expectations/rename_crate.compat.c
deleted file mode 100644
index 89ffcc4..0000000
--- a/cbindgen-0.24.5/tests/expectations/rename_crate.compat.c
+++ /dev/null
@@ -1,49 +0,0 @@
-#if 0
-DEF DEFINE_FREEBSD = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- int32_t x;
-} Foo;
-
-typedef struct {
- uint64_t y;
-} RenamedTy;
-
-#if !defined(DEFINE_FREEBSD)
-typedef struct {
- uint8_t field;
-} NoExternTy;
-#endif
-
-#if !defined(DEFINE_FREEBSD)
-typedef struct {
- NoExternTy field;
-} ContainsNoExternTy;
-#endif
-
-#if defined(DEFINE_FREEBSD)
-typedef struct {
- uint64_t field;
-} ContainsNoExternTy;
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Foo a);
-
-void renamed_func(RenamedTy a);
-
-void no_extern_func(ContainsNoExternTy a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/rename_crate.cpp b/cbindgen-0.24.5/tests/expectations/rename_crate.cpp
deleted file mode 100644
index 3f15d72..0000000
--- a/cbindgen-0.24.5/tests/expectations/rename_crate.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-#if 0
-DEF DEFINE_FREEBSD = 0
-#endif
-
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Foo {
- int32_t x;
-};
-
-struct RenamedTy {
- uint64_t y;
-};
-
-#if !defined(DEFINE_FREEBSD)
-struct NoExternTy {
- uint8_t field;
-};
-#endif
-
-#if !defined(DEFINE_FREEBSD)
-struct ContainsNoExternTy {
- NoExternTy field;
-};
-#endif
-
-#if defined(DEFINE_FREEBSD)
-struct ContainsNoExternTy {
- uint64_t field;
-};
-#endif
-
-extern "C" {
-
-void root(Foo a);
-
-void renamed_func(RenamedTy a);
-
-void no_extern_func(ContainsNoExternTy a);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/rename_crate.tag.compat.c b/cbindgen-0.24.5/tests/expectations/rename_crate.tag.compat.c
deleted file mode 100644
index 71bf78e..0000000
--- a/cbindgen-0.24.5/tests/expectations/rename_crate.tag.compat.c
+++ /dev/null
@@ -1,49 +0,0 @@
-#if 0
-DEF DEFINE_FREEBSD = 0
-#endif
-
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo {
- int32_t x;
-};
-
-struct RenamedTy {
- uint64_t y;
-};
-
-#if !defined(DEFINE_FREEBSD)
-struct NoExternTy {
- uint8_t field;
-};
-#endif
-
-#if !defined(DEFINE_FREEBSD)
-struct ContainsNoExternTy {
- struct NoExternTy field;
-};
-#endif
-
-#if defined(DEFINE_FREEBSD)
-struct ContainsNoExternTy {
- uint64_t field;
-};
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo a);
-
-void renamed_func(struct RenamedTy a);
-
-void no_extern_func(struct ContainsNoExternTy a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.both.compat.c b/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.both.compat.c
deleted file mode 100644
index 1fa7b8b..0000000
--- a/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.both.compat.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct StyleA StyleA;
-
-typedef struct B {
- int32_t x;
- float y;
-} B;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const struct StyleA *a, struct B b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.compat.c b/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.compat.c
deleted file mode 100644
index 5d16b2d..0000000
--- a/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.compat.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct StyleA StyleA;
-
-typedef struct {
- int32_t x;
- float y;
-} B;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const StyleA *a, B b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.cpp b/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.cpp
deleted file mode 100644
index 1a2a6d2..0000000
--- a/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct StyleA;
-
-struct B {
- int32_t x;
- float y;
-};
-
-extern "C" {
-
-void root(const StyleA *a, B b);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.tag.compat.c b/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.tag.compat.c
deleted file mode 100644
index 15d1cc8..0000000
--- a/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.tag.compat.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct StyleA;
-
-struct B {
- int32_t x;
- float y;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const struct StyleA *a, struct B b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/reserved.both.compat.c b/cbindgen-0.24.5/tests/expectations/reserved.both.compat.c
deleted file mode 100644
index 149b2a4..0000000
--- a/cbindgen-0.24.5/tests/expectations/reserved.both.compat.c
+++ /dev/null
@@ -1,101 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct A {
- int32_t namespace_;
- float float_;
-} A;
-
-typedef struct B {
- int32_t namespace_;
- float float_;
-} B;
-
-enum C_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- D,
-};
-#ifndef __cplusplus
-typedef uint8_t C_Tag;
-#endif // __cplusplus
-
-typedef struct D_Body {
- int32_t namespace_;
- float float_;
-} D_Body;
-
-typedef struct C {
- C_Tag tag;
- union {
- D_Body d;
- };
-} C;
-
-enum E_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Double,
- Float,
-};
-#ifndef __cplusplus
-typedef uint8_t E_Tag;
-#endif // __cplusplus
-
-typedef struct E {
- E_Tag tag;
- union {
- struct {
- double double_;
- };
- struct {
- float float_;
- };
- };
-} E;
-
-enum F_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- double_,
- float_,
-};
-#ifndef __cplusplus
-typedef uint8_t F_Tag;
-#endif // __cplusplus
-
-typedef struct F {
- F_Tag tag;
- union {
- struct {
- double double_;
- };
- struct {
- float float_;
- };
- };
-} F;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct A a,
- struct B b,
- struct C c,
- struct E e,
- struct F f,
- int32_t namespace_,
- float float_);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/reserved.compat.c b/cbindgen-0.24.5/tests/expectations/reserved.compat.c
deleted file mode 100644
index 8bbbdf3..0000000
--- a/cbindgen-0.24.5/tests/expectations/reserved.compat.c
+++ /dev/null
@@ -1,95 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- int32_t namespace_;
- float float_;
-} A;
-
-typedef struct {
- int32_t namespace_;
- float float_;
-} B;
-
-enum C_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- D,
-};
-#ifndef __cplusplus
-typedef uint8_t C_Tag;
-#endif // __cplusplus
-
-typedef struct {
- int32_t namespace_;
- float float_;
-} D_Body;
-
-typedef struct {
- C_Tag tag;
- union {
- D_Body d;
- };
-} C;
-
-enum E_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Double,
- Float,
-};
-#ifndef __cplusplus
-typedef uint8_t E_Tag;
-#endif // __cplusplus
-
-typedef struct {
- E_Tag tag;
- union {
- struct {
- double double_;
- };
- struct {
- float float_;
- };
- };
-} E;
-
-enum F_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- double_,
- float_,
-};
-#ifndef __cplusplus
-typedef uint8_t F_Tag;
-#endif // __cplusplus
-
-typedef struct {
- F_Tag tag;
- union {
- struct {
- double double_;
- };
- struct {
- float float_;
- };
- };
-} F;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(A a, B b, C c, E e, F f, int32_t namespace_, float float_);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/reserved.cpp b/cbindgen-0.24.5/tests/expectations/reserved.cpp
deleted file mode 100644
index c4bc9fb..0000000
--- a/cbindgen-0.24.5/tests/expectations/reserved.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct A {
- int32_t namespace_;
- float float_;
-};
-
-struct B {
- int32_t namespace_;
- float float_;
-};
-
-struct C {
- enum class Tag : uint8_t {
- D,
- };
-
- struct D_Body {
- int32_t namespace_;
- float float_;
- };
-
- Tag tag;
- union {
- D_Body d;
- };
-};
-
-struct E {
- enum class Tag : uint8_t {
- Double,
- Float,
- };
-
- struct Double_Body {
- double _0;
- };
-
- struct Float_Body {
- float _0;
- };
-
- Tag tag;
- union {
- Double_Body double_;
- Float_Body float_;
- };
-};
-
-struct F {
- enum class Tag : uint8_t {
- double_,
- float_,
- };
-
- struct double_Body {
- double _0;
- };
-
- struct float_Body {
- float _0;
- };
-
- Tag tag;
- union {
- double_Body double_;
- float_Body float_;
- };
-};
-
-extern "C" {
-
-void root(A a, B b, C c, E e, F f, int32_t namespace_, float float_);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/reserved.tag.compat.c b/cbindgen-0.24.5/tests/expectations/reserved.tag.compat.c
deleted file mode 100644
index fc6064f..0000000
--- a/cbindgen-0.24.5/tests/expectations/reserved.tag.compat.c
+++ /dev/null
@@ -1,101 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct A {
- int32_t namespace_;
- float float_;
-};
-
-struct B {
- int32_t namespace_;
- float float_;
-};
-
-enum C_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- D,
-};
-#ifndef __cplusplus
-typedef uint8_t C_Tag;
-#endif // __cplusplus
-
-struct D_Body {
- int32_t namespace_;
- float float_;
-};
-
-struct C {
- C_Tag tag;
- union {
- struct D_Body d;
- };
-};
-
-enum E_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Double,
- Float,
-};
-#ifndef __cplusplus
-typedef uint8_t E_Tag;
-#endif // __cplusplus
-
-struct E {
- E_Tag tag;
- union {
- struct {
- double double_;
- };
- struct {
- float float_;
- };
- };
-};
-
-enum F_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- double_,
- float_,
-};
-#ifndef __cplusplus
-typedef uint8_t F_Tag;
-#endif // __cplusplus
-
-struct F {
- F_Tag tag;
- union {
- struct {
- double double_;
- };
- struct {
- float float_;
- };
- };
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct A a,
- struct B b,
- struct C c,
- struct E e,
- struct F f,
- int32_t namespace_,
- float float_);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/sentinel.both.compat.c b/cbindgen-0.24.5/tests/expectations/sentinel.both.compat.c
deleted file mode 100644
index f03f998..0000000
--- a/cbindgen-0.24.5/tests/expectations/sentinel.both.compat.c
+++ /dev/null
@@ -1,81 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum A
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- A_A1,
- A_A2,
- A_A3,
- /**
- * Must be last for serialization purposes
- */
- A_Sentinel,
-};
-#ifndef __cplusplus
-typedef uint8_t A;
-#endif // __cplusplus
-
-enum B
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- B_B1,
- B_B2,
- B_B3,
- /**
- * Must be last for serialization purposes
- */
- B_Sentinel,
-};
-#ifndef __cplusplus
-typedef uint8_t B;
-#endif // __cplusplus
-
-enum C_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- C_C1,
- C_C2,
- C_C3,
- /**
- * Must be last for serialization purposes
- */
- C_Sentinel,
-};
-#ifndef __cplusplus
-typedef uint8_t C_Tag;
-#endif // __cplusplus
-
-typedef struct C_C1_Body {
- C_Tag tag;
- uint32_t a;
-} C_C1_Body;
-
-typedef struct C_C2_Body {
- C_Tag tag;
- uint32_t b;
-} C_C2_Body;
-
-typedef union C {
- C_Tag tag;
- C_C1_Body c1;
- C_C2_Body c2;
-} C;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(A a, B b, union C c);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/sentinel.compat.c b/cbindgen-0.24.5/tests/expectations/sentinel.compat.c
deleted file mode 100644
index e86d2d9..0000000
--- a/cbindgen-0.24.5/tests/expectations/sentinel.compat.c
+++ /dev/null
@@ -1,81 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum A
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- A_A1,
- A_A2,
- A_A3,
- /**
- * Must be last for serialization purposes
- */
- A_Sentinel,
-};
-#ifndef __cplusplus
-typedef uint8_t A;
-#endif // __cplusplus
-
-enum B
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- B_B1,
- B_B2,
- B_B3,
- /**
- * Must be last for serialization purposes
- */
- B_Sentinel,
-};
-#ifndef __cplusplus
-typedef uint8_t B;
-#endif // __cplusplus
-
-enum C_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- C_C1,
- C_C2,
- C_C3,
- /**
- * Must be last for serialization purposes
- */
- C_Sentinel,
-};
-#ifndef __cplusplus
-typedef uint8_t C_Tag;
-#endif // __cplusplus
-
-typedef struct {
- C_Tag tag;
- uint32_t a;
-} C_C1_Body;
-
-typedef struct {
- C_Tag tag;
- uint32_t b;
-} C_C2_Body;
-
-typedef union {
- C_Tag tag;
- C_C1_Body c1;
- C_C2_Body c2;
-} C;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(A a, B b, C c);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/sentinel.cpp b/cbindgen-0.24.5/tests/expectations/sentinel.cpp
deleted file mode 100644
index 98e353f..0000000
--- a/cbindgen-0.24.5/tests/expectations/sentinel.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-enum class A : uint8_t {
- A_A1,
- A_A2,
- A_A3,
- /// Must be last for serialization purposes
- A_Sentinel,
-};
-
-enum class B : uint8_t {
- B_B1,
- B_B2,
- B_B3,
- /// Must be last for serialization purposes
- B_Sentinel,
-};
-
-union C {
- enum class Tag : uint8_t {
- C_C1,
- C_C2,
- C_C3,
- /// Must be last for serialization purposes
- C_Sentinel,
- };
-
- struct C_C1_Body {
- Tag tag;
- uint32_t a;
- };
-
- struct C_C2_Body {
- Tag tag;
- uint32_t b;
- };
-
- struct {
- Tag tag;
- };
- C_C1_Body c1;
- C_C2_Body c2;
-};
-
-extern "C" {
-
-void root(A a, B b, C c);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/sentinel.tag.compat.c b/cbindgen-0.24.5/tests/expectations/sentinel.tag.compat.c
deleted file mode 100644
index ae7f94c..0000000
--- a/cbindgen-0.24.5/tests/expectations/sentinel.tag.compat.c
+++ /dev/null
@@ -1,81 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum A
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- A_A1,
- A_A2,
- A_A3,
- /**
- * Must be last for serialization purposes
- */
- A_Sentinel,
-};
-#ifndef __cplusplus
-typedef uint8_t A;
-#endif // __cplusplus
-
-enum B
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- B_B1,
- B_B2,
- B_B3,
- /**
- * Must be last for serialization purposes
- */
- B_Sentinel,
-};
-#ifndef __cplusplus
-typedef uint8_t B;
-#endif // __cplusplus
-
-enum C_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- C_C1,
- C_C2,
- C_C3,
- /**
- * Must be last for serialization purposes
- */
- C_Sentinel,
-};
-#ifndef __cplusplus
-typedef uint8_t C_Tag;
-#endif // __cplusplus
-
-struct C_C1_Body {
- C_Tag tag;
- uint32_t a;
-};
-
-struct C_C2_Body {
- C_Tag tag;
- uint32_t b;
-};
-
-union C {
- C_Tag tag;
- struct C_C1_Body c1;
- struct C_C2_Body c2;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(A a, B b, union C c);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.both.compat.c b/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.both.compat.c
deleted file mode 100644
index 7c6292e..0000000
--- a/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.both.compat.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Opaque Opaque;
-
-typedef struct Option_____Opaque Option_____Opaque;
-
-typedef struct Foo {
- const struct Opaque *x;
- struct Opaque *y;
- void (*z)(void);
- void (**zz)(void);
-} Foo;
-
-typedef union Bar {
- const struct Opaque *x;
- struct Opaque *y;
- void (*z)(void);
- void (**zz)(void);
-} Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const struct Opaque *a,
- struct Opaque *b,
- struct Foo c,
- union Bar d,
- struct Option_____Opaque *e,
- void (*f)(const struct Opaque*));
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.compat.c b/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.compat.c
deleted file mode 100644
index 827067c..0000000
--- a/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Opaque Opaque;
-
-typedef struct Option_____Opaque Option_____Opaque;
-
-typedef struct {
- const Opaque *x;
- Opaque *y;
- void (*z)(void);
- void (**zz)(void);
-} Foo;
-
-typedef union {
- const Opaque *x;
- Opaque *y;
- void (*z)(void);
- void (**zz)(void);
-} Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Opaque *a, Opaque *b, Foo c, Bar d, Option_____Opaque *e, void (*f)(const Opaque*));
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.cpp b/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.cpp
deleted file mode 100644
index f4b98d4..0000000
--- a/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Opaque;
-
-template<typename T = void>
-struct Option;
-
-struct Foo {
- const Opaque *x;
- Opaque *y;
- void (*z)();
- void (**zz)();
-};
-
-union Bar {
- const Opaque *x;
- Opaque *y;
- void (*z)();
- void (**zz)();
-};
-
-extern "C" {
-
-void root(const Opaque *a, Opaque *b, Foo c, Bar d, Option<Opaque*> *e, void (*f)(const Opaque*));
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.tag.compat.c b/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.tag.compat.c
deleted file mode 100644
index 79d1ce6..0000000
--- a/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.tag.compat.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Opaque;
-
-struct Option_____Opaque;
-
-struct Foo {
- const struct Opaque *x;
- struct Opaque *y;
- void (*z)(void);
- void (**zz)(void);
-};
-
-union Bar {
- const struct Opaque *x;
- struct Opaque *y;
- void (*z)(void);
- void (**zz)(void);
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const struct Opaque *a,
- struct Opaque *b,
- struct Foo c,
- union Bar d,
- struct Option_____Opaque *e,
- void (*f)(const struct Opaque*));
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/size_types.compat.c b/cbindgen-0.24.5/tests/expectations/size_types.compat.c
deleted file mode 100644
index 0a1218b..0000000
--- a/cbindgen-0.24.5/tests/expectations/size_types.compat.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-enum IE
-#ifdef __cplusplus
- : ptrdiff_t
-#endif // __cplusplus
- {
- IV,
-};
-#ifndef __cplusplus
-typedef ptrdiff_t IE;
-#endif // __cplusplus
-
-enum UE
-#ifdef __cplusplus
- : size_t
-#endif // __cplusplus
- {
- UV,
-};
-#ifndef __cplusplus
-typedef size_t UE;
-#endif // __cplusplus
-
-typedef size_t Usize;
-
-typedef ptrdiff_t Isize;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Usize, Isize, UE, IE);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/size_types.cpp b/cbindgen-0.24.5/tests/expectations/size_types.cpp
deleted file mode 100644
index d701a8d..0000000
--- a/cbindgen-0.24.5/tests/expectations/size_types.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <cstdarg>
-#include <cstddef>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-enum class IE : ptrdiff_t {
- IV,
-};
-
-enum class UE : size_t {
- UV,
-};
-
-using Usize = size_t;
-
-using Isize = ptrdiff_t;
-
-extern "C" {
-
-void root(Usize, Isize, UE, IE);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/static.both.compat.c b/cbindgen-0.24.5/tests/expectations/static.both.compat.c
deleted file mode 100644
index b06525e..0000000
--- a/cbindgen-0.24.5/tests/expectations/static.both.compat.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Bar Bar;
-
-typedef struct Foo {
-
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern const int32_t NUMBER;
-
-extern struct Foo FOO;
-
-extern const struct Bar BAR;
-
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/static.compat.c b/cbindgen-0.24.5/tests/expectations/static.compat.c
deleted file mode 100644
index e25d2f0..0000000
--- a/cbindgen-0.24.5/tests/expectations/static.compat.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Bar Bar;
-
-typedef struct {
-
-} Foo;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern const int32_t NUMBER;
-
-extern Foo FOO;
-
-extern const Bar BAR;
-
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/static.cpp b/cbindgen-0.24.5/tests/expectations/static.cpp
deleted file mode 100644
index 4695d3c..0000000
--- a/cbindgen-0.24.5/tests/expectations/static.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Bar;
-
-struct Foo {
-
-};
-
-extern "C" {
-
-extern const int32_t NUMBER;
-
-extern Foo FOO;
-
-extern const Bar BAR;
-
-void root();
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/static.tag.compat.c b/cbindgen-0.24.5/tests/expectations/static.tag.compat.c
deleted file mode 100644
index 4afafee..0000000
--- a/cbindgen-0.24.5/tests/expectations/static.tag.compat.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Bar;
-
-struct Foo {
-
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-extern const int32_t NUMBER;
-
-extern struct Foo FOO;
-
-extern const struct Bar BAR;
-
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/std_lib.both.compat.c b/cbindgen-0.24.5/tests/expectations/std_lib.both.compat.c
deleted file mode 100644
index ee4f669..0000000
--- a/cbindgen-0.24.5/tests/expectations/std_lib.both.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Option_i32 Option_i32;
-
-typedef struct Result_i32__String Result_i32__String;
-
-typedef struct Vec_String Vec_String;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const struct Vec_String *a,
- const struct Option_i32 *b,
- const struct Result_i32__String *c);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/std_lib.compat.c b/cbindgen-0.24.5/tests/expectations/std_lib.compat.c
deleted file mode 100644
index b25a57e..0000000
--- a/cbindgen-0.24.5/tests/expectations/std_lib.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Option_i32 Option_i32;
-
-typedef struct Result_i32__String Result_i32__String;
-
-typedef struct Vec_String Vec_String;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const Vec_String *a, const Option_i32 *b, const Result_i32__String *c);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/std_lib.cpp b/cbindgen-0.24.5/tests/expectations/std_lib.cpp
deleted file mode 100644
index f0cd338..0000000
--- a/cbindgen-0.24.5/tests/expectations/std_lib.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T = void>
-struct Option;
-
-template<typename T = void, typename E = void>
-struct Result;
-
-struct String;
-
-template<typename T = void>
-struct Vec;
-
-extern "C" {
-
-void root(const Vec<String> *a, const Option<int32_t> *b, const Result<int32_t, String> *c);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/std_lib.tag.compat.c b/cbindgen-0.24.5/tests/expectations/std_lib.tag.compat.c
deleted file mode 100644
index 291ee6d..0000000
--- a/cbindgen-0.24.5/tests/expectations/std_lib.tag.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Option_i32;
-
-struct Result_i32__String;
-
-struct Vec_String;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(const struct Vec_String *a,
- const struct Option_i32 *b,
- const struct Result_i32__String *c);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct.both.compat.c b/cbindgen-0.24.5/tests/expectations/struct.both.compat.c
deleted file mode 100644
index 5f080d9..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct.both.compat.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Opaque Opaque;
-
-typedef struct Normal {
- int32_t x;
- float y;
-} Normal;
-
-typedef struct NormalWithZST {
- int32_t x;
- float y;
-} NormalWithZST;
-
-typedef struct TupleRenamed {
- int32_t m0;
- float m1;
-} TupleRenamed;
-
-typedef struct TupleNamed {
- int32_t x;
- float y;
-} TupleNamed;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Opaque *a,
- struct Normal b,
- struct NormalWithZST c,
- struct TupleRenamed d,
- struct TupleNamed e);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct.compat.c b/cbindgen-0.24.5/tests/expectations/struct.compat.c
deleted file mode 100644
index 701f49b..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct.compat.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Opaque Opaque;
-
-typedef struct {
- int32_t x;
- float y;
-} Normal;
-
-typedef struct {
- int32_t x;
- float y;
-} NormalWithZST;
-
-typedef struct {
- int32_t m0;
- float m1;
-} TupleRenamed;
-
-typedef struct {
- int32_t x;
- float y;
-} TupleNamed;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Opaque *a, Normal b, NormalWithZST c, TupleRenamed d, TupleNamed e);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct.cpp b/cbindgen-0.24.5/tests/expectations/struct.cpp
deleted file mode 100644
index 2869da7..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Opaque;
-
-struct Normal {
- int32_t x;
- float y;
-};
-
-struct NormalWithZST {
- int32_t x;
- float y;
-};
-
-struct TupleRenamed {
- int32_t m0;
- float m1;
-};
-
-struct TupleNamed {
- int32_t x;
- float y;
-};
-
-extern "C" {
-
-void root(Opaque *a, Normal b, NormalWithZST c, TupleRenamed d, TupleNamed e);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/struct.tag.compat.c b/cbindgen-0.24.5/tests/expectations/struct.tag.compat.c
deleted file mode 100644
index 76ae4fc..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct.tag.compat.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Opaque;
-
-struct Normal {
- int32_t x;
- float y;
-};
-
-struct NormalWithZST {
- int32_t x;
- float y;
-};
-
-struct TupleRenamed {
- int32_t m0;
- float m1;
-};
-
-struct TupleNamed {
- int32_t x;
- float y;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Opaque *a,
- struct Normal b,
- struct NormalWithZST c,
- struct TupleRenamed d,
- struct TupleNamed e);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal.both.compat.c b/cbindgen-0.24.5/tests/expectations/struct_literal.both.compat.c
deleted file mode 100644
index bfc403d..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct_literal.both.compat.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Bar Bar;
-
-typedef struct Foo {
- int32_t a;
- uint32_t b;
-} Foo;
-#define Foo_FOO (Foo){ .a = 42, .b = 47 }
-#define Foo_FOO2 (Foo){ .a = 42, .b = 47 }
-#define Foo_FOO3 (Foo){ .a = 42, .b = 47 }
-
-
-#define BAR (Foo){ .a = 42, .b = 1337 }
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo x, struct Bar bar);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal.compat.c b/cbindgen-0.24.5/tests/expectations/struct_literal.compat.c
deleted file mode 100644
index 011f09e..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct_literal.compat.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Bar Bar;
-
-typedef struct {
- int32_t a;
- uint32_t b;
-} Foo;
-#define Foo_FOO (Foo){ .a = 42, .b = 47 }
-#define Foo_FOO2 (Foo){ .a = 42, .b = 47 }
-#define Foo_FOO3 (Foo){ .a = 42, .b = 47 }
-
-
-#define BAR (Foo){ .a = 42, .b = 1337 }
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Foo x, Bar bar);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal.cpp b/cbindgen-0.24.5/tests/expectations/struct_literal.cpp
deleted file mode 100644
index 68fa0f5..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct_literal.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Bar;
-
-struct Foo {
- int32_t a;
- uint32_t b;
-};
-constexpr static const Foo Foo_FOO = Foo{ /* .a = */ 42, /* .b = */ 47 };
-constexpr static const Foo Foo_FOO2 = Foo{ /* .a = */ 42, /* .b = */ 47 };
-constexpr static const Foo Foo_FOO3 = Foo{ /* .a = */ 42, /* .b = */ 47 };
-
-
-constexpr static const Foo BAR = Foo{ /* .a = */ 42, /* .b = */ 1337 };
-
-
-
-extern "C" {
-
-void root(Foo x, Bar bar);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal.tag.compat.c b/cbindgen-0.24.5/tests/expectations/struct_literal.tag.compat.c
deleted file mode 100644
index 23c8ac2..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct_literal.tag.compat.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Bar;
-
-struct Foo {
- int32_t a;
- uint32_t b;
-};
-#define Foo_FOO (Foo){ .a = 42, .b = 47 }
-#define Foo_FOO2 (Foo){ .a = 42, .b = 47 }
-#define Foo_FOO3 (Foo){ .a = 42, .b = 47 }
-
-
-#define BAR (Foo){ .a = 42, .b = 1337 }
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Foo x, struct Bar bar);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal_order.both.compat.c b/cbindgen-0.24.5/tests/expectations/struct_literal_order.both.compat.c
deleted file mode 100644
index 849532d..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct_literal_order.both.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct ABC {
- float a;
- uint32_t b;
- uint32_t c;
-} ABC;
-#define ABC_abc (ABC){ .a = 1.0, .b = 2, .c = 3 }
-#define ABC_bac (ABC){ .a = 1.0, .b = 2, .c = 3 }
-#define ABC_cba (ABC){ .a = 1.0, .b = 2, .c = 3 }
-
-typedef struct BAC {
- uint32_t b;
- float a;
- int32_t c;
-} BAC;
-#define BAC_abc (BAC){ .b = 1, .a = 2.0, .c = 3 }
-#define BAC_bac (BAC){ .b = 1, .a = 2.0, .c = 3 }
-#define BAC_cba (BAC){ .b = 1, .a = 2.0, .c = 3 }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct ABC a1, struct BAC a2);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal_order.compat.c b/cbindgen-0.24.5/tests/expectations/struct_literal_order.compat.c
deleted file mode 100644
index 3e8feb4..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct_literal_order.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- float a;
- uint32_t b;
- uint32_t c;
-} ABC;
-#define ABC_abc (ABC){ .a = 1.0, .b = 2, .c = 3 }
-#define ABC_bac (ABC){ .a = 1.0, .b = 2, .c = 3 }
-#define ABC_cba (ABC){ .a = 1.0, .b = 2, .c = 3 }
-
-typedef struct {
- uint32_t b;
- float a;
- int32_t c;
-} BAC;
-#define BAC_abc (BAC){ .b = 1, .a = 2.0, .c = 3 }
-#define BAC_bac (BAC){ .b = 1, .a = 2.0, .c = 3 }
-#define BAC_cba (BAC){ .b = 1, .a = 2.0, .c = 3 }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(ABC a1, BAC a2);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal_order.cpp b/cbindgen-0.24.5/tests/expectations/struct_literal_order.cpp
deleted file mode 100644
index 9f4021c..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct_literal_order.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct ABC {
- float a;
- uint32_t b;
- uint32_t c;
-};
-constexpr static const ABC ABC_abc = ABC{ /* .a = */ 1.0, /* .b = */ 2, /* .c = */ 3 };
-constexpr static const ABC ABC_bac = ABC{ /* .a = */ 1.0, /* .b = */ 2, /* .c = */ 3 };
-constexpr static const ABC ABC_cba = ABC{ /* .a = */ 1.0, /* .b = */ 2, /* .c = */ 3 };
-
-struct BAC {
- uint32_t b;
- float a;
- int32_t c;
-};
-constexpr static const BAC BAC_abc = BAC{ /* .b = */ 1, /* .a = */ 2.0, /* .c = */ 3 };
-constexpr static const BAC BAC_bac = BAC{ /* .b = */ 1, /* .a = */ 2.0, /* .c = */ 3 };
-constexpr static const BAC BAC_cba = BAC{ /* .b = */ 1, /* .a = */ 2.0, /* .c = */ 3 };
-
-extern "C" {
-
-void root(ABC a1, BAC a2);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal_order.tag.compat.c b/cbindgen-0.24.5/tests/expectations/struct_literal_order.tag.compat.c
deleted file mode 100644
index 7fd7ca6..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct_literal_order.tag.compat.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct ABC {
- float a;
- uint32_t b;
- uint32_t c;
-};
-#define ABC_abc (ABC){ .a = 1.0, .b = 2, .c = 3 }
-#define ABC_bac (ABC){ .a = 1.0, .b = 2, .c = 3 }
-#define ABC_cba (ABC){ .a = 1.0, .b = 2, .c = 3 }
-
-struct BAC {
- uint32_t b;
- float a;
- int32_t c;
-};
-#define BAC_abc (BAC){ .b = 1, .a = 2.0, .c = 3 }
-#define BAC_bac (BAC){ .b = 1, .a = 2.0, .c = 3 }
-#define BAC_cba (BAC){ .b = 1, .a = 2.0, .c = 3 }
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct ABC a1, struct BAC a2);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_self.both.compat.c b/cbindgen-0.24.5/tests/expectations/struct_self.both.compat.c
deleted file mode 100644
index 473f849..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct_self.both.compat.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo_Bar {
- const int32_t *something;
-} Foo_Bar;
-
-typedef struct Bar {
- int32_t something;
- struct Foo_Bar subexpressions;
-} Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Bar b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_self.compat.c b/cbindgen-0.24.5/tests/expectations/struct_self.compat.c
deleted file mode 100644
index 1e54375..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct_self.compat.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- const int32_t *something;
-} Foo_Bar;
-
-typedef struct {
- int32_t something;
- Foo_Bar subexpressions;
-} Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Bar b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_self.cpp b/cbindgen-0.24.5/tests/expectations/struct_self.cpp
deleted file mode 100644
index e8532ad..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct_self.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T>
-struct Foo {
- const int32_t *something;
-};
-
-struct Bar {
- int32_t something;
- Foo<Bar> subexpressions;
-};
-
-extern "C" {
-
-void root(Bar b);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/struct_self.tag.compat.c b/cbindgen-0.24.5/tests/expectations/struct_self.tag.compat.c
deleted file mode 100644
index ccb3936..0000000
--- a/cbindgen-0.24.5/tests/expectations/struct_self.tag.compat.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo_Bar {
- const int32_t *something;
-};
-
-struct Bar {
- int32_t something;
- struct Foo_Bar subexpressions;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Bar b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/swift_name.both.compat.c b/cbindgen-0.24.5/tests/expectations/swift_name.both.compat.c
deleted file mode 100644
index 4544162..0000000
--- a/cbindgen-0.24.5/tests/expectations/swift_name.both.compat.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#define CF_SWIFT_NAME(_name) __attribute__((swift_name(#_name)))
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Opaque Opaque;
-
-typedef struct SelfTypeTestStruct {
- uint8_t times;
-} SelfTypeTestStruct;
-
-typedef struct PointerToOpaque {
- struct Opaque *ptr;
-} PointerToOpaque;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void rust_print_hello_world(void) CF_SWIFT_NAME(rust_print_hello_world());
-
-void SelfTypeTestStruct_should_exist_ref(const struct SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref(self:));
-
-void SelfTypeTestStruct_should_exist_ref_mut(struct SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref_mut(self:));
-
-void SelfTypeTestStruct_should_not_exist_box(struct SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_box(self:));
-
-struct SelfTypeTestStruct *SelfTypeTestStruct_should_not_exist_return_box(void) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_return_box());
-
-void SelfTypeTestStruct_should_exist_annotated_self(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_self(self:));
-
-void SelfTypeTestStruct_should_exist_annotated_mut_self(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_self(self:));
-
-void SelfTypeTestStruct_should_exist_annotated_by_name(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_by_name(self:));
-
-void SelfTypeTestStruct_should_exist_annotated_mut_by_name(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_by_name(self:));
-
-void SelfTypeTestStruct_should_exist_unannotated(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_unannotated(self:));
-
-void SelfTypeTestStruct_should_exist_mut_unannotated(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_mut_unannotated(self:));
-
-void free_function_should_exist_ref(const struct SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref(test_struct:));
-
-void free_function_should_exist_ref_mut(struct SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref_mut(test_struct:));
-
-void unnamed_argument(struct SelfTypeTestStruct*);
-
-void free_function_should_not_exist_box(struct SelfTypeTestStruct *boxed) CF_SWIFT_NAME(free_function_should_not_exist_box(boxed:));
-
-void free_function_should_exist_annotated_by_name(struct SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_by_name(test_struct:));
-
-void free_function_should_exist_annotated_mut_by_name(struct SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_mut_by_name(test_struct:));
-
-struct PointerToOpaque PointerToOpaque_create(uint8_t times) CF_SWIFT_NAME(PointerToOpaque.create(times:));
-
-void PointerToOpaque_sayHello(struct PointerToOpaque self) CF_SWIFT_NAME(PointerToOpaque.sayHello(self:));
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/swift_name.compat.c b/cbindgen-0.24.5/tests/expectations/swift_name.compat.c
deleted file mode 100644
index 5409643..0000000
--- a/cbindgen-0.24.5/tests/expectations/swift_name.compat.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#define CF_SWIFT_NAME(_name) __attribute__((swift_name(#_name)))
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Opaque Opaque;
-
-typedef struct {
- uint8_t times;
-} SelfTypeTestStruct;
-
-typedef struct {
- Opaque *ptr;
-} PointerToOpaque;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void rust_print_hello_world(void) CF_SWIFT_NAME(rust_print_hello_world());
-
-void SelfTypeTestStruct_should_exist_ref(const SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref(self:));
-
-void SelfTypeTestStruct_should_exist_ref_mut(SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref_mut(self:));
-
-void SelfTypeTestStruct_should_not_exist_box(SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_box(self:));
-
-SelfTypeTestStruct *SelfTypeTestStruct_should_not_exist_return_box(void) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_return_box());
-
-void SelfTypeTestStruct_should_exist_annotated_self(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_self(self:));
-
-void SelfTypeTestStruct_should_exist_annotated_mut_self(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_self(self:));
-
-void SelfTypeTestStruct_should_exist_annotated_by_name(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_by_name(self:));
-
-void SelfTypeTestStruct_should_exist_annotated_mut_by_name(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_by_name(self:));
-
-void SelfTypeTestStruct_should_exist_unannotated(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_unannotated(self:));
-
-void SelfTypeTestStruct_should_exist_mut_unannotated(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_mut_unannotated(self:));
-
-void free_function_should_exist_ref(const SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref(test_struct:));
-
-void free_function_should_exist_ref_mut(SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref_mut(test_struct:));
-
-void unnamed_argument(SelfTypeTestStruct*);
-
-void free_function_should_not_exist_box(SelfTypeTestStruct *boxed) CF_SWIFT_NAME(free_function_should_not_exist_box(boxed:));
-
-void free_function_should_exist_annotated_by_name(SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_by_name(test_struct:));
-
-void free_function_should_exist_annotated_mut_by_name(SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_mut_by_name(test_struct:));
-
-PointerToOpaque PointerToOpaque_create(uint8_t times) CF_SWIFT_NAME(PointerToOpaque.create(times:));
-
-void PointerToOpaque_sayHello(PointerToOpaque self) CF_SWIFT_NAME(PointerToOpaque.sayHello(self:));
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/swift_name.cpp b/cbindgen-0.24.5/tests/expectations/swift_name.cpp
deleted file mode 100644
index 5d5ae0b..0000000
--- a/cbindgen-0.24.5/tests/expectations/swift_name.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#define CF_SWIFT_NAME(_name) __attribute__((swift_name(#_name)))
-
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T = void>
-struct Box;
-
-struct Opaque;
-
-struct SelfTypeTestStruct {
- uint8_t times;
-};
-
-struct PointerToOpaque {
- Opaque *ptr;
-};
-
-extern "C" {
-
-void rust_print_hello_world() CF_SWIFT_NAME(rust_print_hello_world());
-
-void SelfTypeTestStruct_should_exist_ref(const SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref(self:));
-
-void SelfTypeTestStruct_should_exist_ref_mut(SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref_mut(self:));
-
-void SelfTypeTestStruct_should_not_exist_box(Box<SelfTypeTestStruct> self) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_box(self:));
-
-Box<SelfTypeTestStruct> SelfTypeTestStruct_should_not_exist_return_box() CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_return_box());
-
-void SelfTypeTestStruct_should_exist_annotated_self(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_self(self:));
-
-void SelfTypeTestStruct_should_exist_annotated_mut_self(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_self(self:));
-
-void SelfTypeTestStruct_should_exist_annotated_by_name(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_by_name(self:));
-
-void SelfTypeTestStruct_should_exist_annotated_mut_by_name(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_by_name(self:));
-
-void SelfTypeTestStruct_should_exist_unannotated(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_unannotated(self:));
-
-void SelfTypeTestStruct_should_exist_mut_unannotated(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_mut_unannotated(self:));
-
-void free_function_should_exist_ref(const SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref(test_struct:));
-
-void free_function_should_exist_ref_mut(SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref_mut(test_struct:));
-
-void unnamed_argument(SelfTypeTestStruct*);
-
-void free_function_should_not_exist_box(Box<SelfTypeTestStruct> boxed) CF_SWIFT_NAME(free_function_should_not_exist_box(boxed:));
-
-void free_function_should_exist_annotated_by_name(SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_by_name(test_struct:));
-
-void free_function_should_exist_annotated_mut_by_name(SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_mut_by_name(test_struct:));
-
-PointerToOpaque PointerToOpaque_create(uint8_t times) CF_SWIFT_NAME(PointerToOpaque.create(times:));
-
-void PointerToOpaque_sayHello(PointerToOpaque self) CF_SWIFT_NAME(PointerToOpaque.sayHello(self:));
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/swift_name.tag.compat.c b/cbindgen-0.24.5/tests/expectations/swift_name.tag.compat.c
deleted file mode 100644
index 6ac6a00..0000000
--- a/cbindgen-0.24.5/tests/expectations/swift_name.tag.compat.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#define CF_SWIFT_NAME(_name) __attribute__((swift_name(#_name)))
-
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Opaque;
-
-struct SelfTypeTestStruct {
- uint8_t times;
-};
-
-struct PointerToOpaque {
- struct Opaque *ptr;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void rust_print_hello_world(void) CF_SWIFT_NAME(rust_print_hello_world());
-
-void SelfTypeTestStruct_should_exist_ref(const struct SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref(self:));
-
-void SelfTypeTestStruct_should_exist_ref_mut(struct SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref_mut(self:));
-
-void SelfTypeTestStruct_should_not_exist_box(struct SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_box(self:));
-
-struct SelfTypeTestStruct *SelfTypeTestStruct_should_not_exist_return_box(void) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_return_box());
-
-void SelfTypeTestStruct_should_exist_annotated_self(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_self(self:));
-
-void SelfTypeTestStruct_should_exist_annotated_mut_self(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_self(self:));
-
-void SelfTypeTestStruct_should_exist_annotated_by_name(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_by_name(self:));
-
-void SelfTypeTestStruct_should_exist_annotated_mut_by_name(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_by_name(self:));
-
-void SelfTypeTestStruct_should_exist_unannotated(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_unannotated(self:));
-
-void SelfTypeTestStruct_should_exist_mut_unannotated(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_mut_unannotated(self:));
-
-void free_function_should_exist_ref(const struct SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref(test_struct:));
-
-void free_function_should_exist_ref_mut(struct SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref_mut(test_struct:));
-
-void unnamed_argument(struct SelfTypeTestStruct*);
-
-void free_function_should_not_exist_box(struct SelfTypeTestStruct *boxed) CF_SWIFT_NAME(free_function_should_not_exist_box(boxed:));
-
-void free_function_should_exist_annotated_by_name(struct SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_by_name(test_struct:));
-
-void free_function_should_exist_annotated_mut_by_name(struct SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_mut_by_name(test_struct:));
-
-struct PointerToOpaque PointerToOpaque_create(uint8_t times) CF_SWIFT_NAME(PointerToOpaque.create(times:));
-
-void PointerToOpaque_sayHello(struct PointerToOpaque self) CF_SWIFT_NAME(PointerToOpaque.sayHello(self:));
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/transform_op.both.compat.c b/cbindgen-0.24.5/tests/expectations/transform_op.both.compat.c
deleted file mode 100644
index 3b7a7e3..0000000
--- a/cbindgen-0.24.5/tests/expectations/transform_op.both.compat.c
+++ /dev/null
@@ -1,170 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct StylePoint_i32 {
- int32_t x;
- int32_t y;
-} StylePoint_i32;
-
-typedef struct StylePoint_f32 {
- float x;
- float y;
-} StylePoint_f32;
-
-enum StyleFoo_i32_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Foo_i32,
- Bar_i32,
- Baz_i32,
- Bazz_i32,
-};
-#ifndef __cplusplus
-typedef uint8_t StyleFoo_i32_Tag;
-#endif // __cplusplus
-
-typedef struct StyleFoo_Body_i32 {
- StyleFoo_i32_Tag tag;
- int32_t x;
- struct StylePoint_i32 y;
- struct StylePoint_f32 z;
-} StyleFoo_Body_i32;
-
-typedef union StyleFoo_i32 {
- StyleFoo_i32_Tag tag;
- StyleFoo_Body_i32 foo;
- struct {
- StyleFoo_i32_Tag bar_tag;
- int32_t bar;
- };
- struct {
- StyleFoo_i32_Tag baz_tag;
- struct StylePoint_i32 baz;
- };
-} StyleFoo_i32;
-
-typedef enum StyleBar_i32_Tag {
- Bar1_i32,
- Bar2_i32,
- Bar3_i32,
- Bar4_i32,
-} StyleBar_i32_Tag;
-
-typedef struct StyleBar1_Body_i32 {
- int32_t x;
- struct StylePoint_i32 y;
- struct StylePoint_f32 z;
- int32_t (*u)(int32_t);
-} StyleBar1_Body_i32;
-
-typedef struct StyleBar_i32 {
- StyleBar_i32_Tag tag;
- union {
- StyleBar1_Body_i32 bar1;
- struct {
- int32_t bar2;
- };
- struct {
- struct StylePoint_i32 bar3;
- };
- };
-} StyleBar_i32;
-
-typedef struct StylePoint_u32 {
- uint32_t x;
- uint32_t y;
-} StylePoint_u32;
-
-typedef enum StyleBar_u32_Tag {
- Bar1_u32,
- Bar2_u32,
- Bar3_u32,
- Bar4_u32,
-} StyleBar_u32_Tag;
-
-typedef struct StyleBar1_Body_u32 {
- int32_t x;
- struct StylePoint_u32 y;
- struct StylePoint_f32 z;
- int32_t (*u)(int32_t);
-} StyleBar1_Body_u32;
-
-typedef struct StyleBar_u32 {
- StyleBar_u32_Tag tag;
- union {
- StyleBar1_Body_u32 bar1;
- struct {
- uint32_t bar2;
- };
- struct {
- struct StylePoint_u32 bar3;
- };
- };
-} StyleBar_u32;
-
-enum StyleBaz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Baz1,
- Baz2,
- Baz3,
-};
-#ifndef __cplusplus
-typedef uint8_t StyleBaz_Tag;
-#endif // __cplusplus
-
-typedef union StyleBaz {
- StyleBaz_Tag tag;
- struct {
- StyleBaz_Tag baz1_tag;
- struct StyleBar_u32 baz1;
- };
- struct {
- StyleBaz_Tag baz2_tag;
- struct StylePoint_i32 baz2;
- };
-} StyleBaz;
-
-enum StyleTaz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Taz1,
- Taz2,
- Taz3,
-};
-#ifndef __cplusplus
-typedef uint8_t StyleTaz_Tag;
-#endif // __cplusplus
-
-typedef struct StyleTaz {
- StyleTaz_Tag tag;
- union {
- struct {
- struct StyleBar_u32 taz1;
- };
- struct {
- union StyleBaz taz2;
- };
- };
-} StyleTaz;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void foo(const union StyleFoo_i32 *foo,
- const struct StyleBar_i32 *bar,
- const union StyleBaz *baz,
- const struct StyleTaz *taz);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/transform_op.compat.c b/cbindgen-0.24.5/tests/expectations/transform_op.compat.c
deleted file mode 100644
index ed7c3fd..0000000
--- a/cbindgen-0.24.5/tests/expectations/transform_op.compat.c
+++ /dev/null
@@ -1,170 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- int32_t x;
- int32_t y;
-} StylePoint_i32;
-
-typedef struct {
- float x;
- float y;
-} StylePoint_f32;
-
-enum StyleFoo_i32_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Foo_i32,
- Bar_i32,
- Baz_i32,
- Bazz_i32,
-};
-#ifndef __cplusplus
-typedef uint8_t StyleFoo_i32_Tag;
-#endif // __cplusplus
-
-typedef struct {
- StyleFoo_i32_Tag tag;
- int32_t x;
- StylePoint_i32 y;
- StylePoint_f32 z;
-} StyleFoo_Body_i32;
-
-typedef union {
- StyleFoo_i32_Tag tag;
- StyleFoo_Body_i32 foo;
- struct {
- StyleFoo_i32_Tag bar_tag;
- int32_t bar;
- };
- struct {
- StyleFoo_i32_Tag baz_tag;
- StylePoint_i32 baz;
- };
-} StyleFoo_i32;
-
-typedef enum {
- Bar1_i32,
- Bar2_i32,
- Bar3_i32,
- Bar4_i32,
-} StyleBar_i32_Tag;
-
-typedef struct {
- int32_t x;
- StylePoint_i32 y;
- StylePoint_f32 z;
- int32_t (*u)(int32_t);
-} StyleBar1_Body_i32;
-
-typedef struct {
- StyleBar_i32_Tag tag;
- union {
- StyleBar1_Body_i32 bar1;
- struct {
- int32_t bar2;
- };
- struct {
- StylePoint_i32 bar3;
- };
- };
-} StyleBar_i32;
-
-typedef struct {
- uint32_t x;
- uint32_t y;
-} StylePoint_u32;
-
-typedef enum {
- Bar1_u32,
- Bar2_u32,
- Bar3_u32,
- Bar4_u32,
-} StyleBar_u32_Tag;
-
-typedef struct {
- int32_t x;
- StylePoint_u32 y;
- StylePoint_f32 z;
- int32_t (*u)(int32_t);
-} StyleBar1_Body_u32;
-
-typedef struct {
- StyleBar_u32_Tag tag;
- union {
- StyleBar1_Body_u32 bar1;
- struct {
- uint32_t bar2;
- };
- struct {
- StylePoint_u32 bar3;
- };
- };
-} StyleBar_u32;
-
-enum StyleBaz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Baz1,
- Baz2,
- Baz3,
-};
-#ifndef __cplusplus
-typedef uint8_t StyleBaz_Tag;
-#endif // __cplusplus
-
-typedef union {
- StyleBaz_Tag tag;
- struct {
- StyleBaz_Tag baz1_tag;
- StyleBar_u32 baz1;
- };
- struct {
- StyleBaz_Tag baz2_tag;
- StylePoint_i32 baz2;
- };
-} StyleBaz;
-
-enum StyleTaz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Taz1,
- Taz2,
- Taz3,
-};
-#ifndef __cplusplus
-typedef uint8_t StyleTaz_Tag;
-#endif // __cplusplus
-
-typedef struct {
- StyleTaz_Tag tag;
- union {
- struct {
- StyleBar_u32 taz1;
- };
- struct {
- StyleBaz taz2;
- };
- };
-} StyleTaz;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void foo(const StyleFoo_i32 *foo,
- const StyleBar_i32 *bar,
- const StyleBaz *baz,
- const StyleTaz *taz);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/transform_op.cpp b/cbindgen-0.24.5/tests/expectations/transform_op.cpp
deleted file mode 100644
index f7726b6..0000000
--- a/cbindgen-0.24.5/tests/expectations/transform_op.cpp
+++ /dev/null
@@ -1,393 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-#include <cassert>
-
-template<typename T>
-struct StylePoint {
- T x;
- T y;
-};
-
-template<typename T>
-union StyleFoo {
- enum class Tag : uint8_t {
- Foo,
- Bar,
- Baz,
- Bazz,
- };
-
- struct Foo_Body {
- Tag tag;
- int32_t x;
- StylePoint<T> y;
- StylePoint<float> z;
- };
-
- struct Bar_Body {
- Tag tag;
- T _0;
- };
-
- struct Baz_Body {
- Tag tag;
- StylePoint<T> _0;
- };
-
- struct {
- Tag tag;
- };
- Foo_Body foo;
- Bar_Body bar;
- Baz_Body baz;
-
- static StyleFoo Foo(const int32_t &x,
- const StylePoint<T> &y,
- const StylePoint<float> &z) {
- StyleFoo result;
- ::new (&result.foo.x) (int32_t)(x);
- ::new (&result.foo.y) (StylePoint<T>)(y);
- ::new (&result.foo.z) (StylePoint<float>)(z);
- result.tag = Tag::Foo;
- return result;
- }
-
- bool IsFoo() const {
- return tag == Tag::Foo;
- }
-
- const Foo_Body& AsFoo() const {
- assert(IsFoo());
- return foo;
- }
-
- Foo_Body& AsFoo() {
- assert(IsFoo());
- return foo;
- }
-
- static StyleFoo Bar(const T &_0) {
- StyleFoo result;
- ::new (&result.bar._0) (T)(_0);
- result.tag = Tag::Bar;
- return result;
- }
-
- bool IsBar() const {
- return tag == Tag::Bar;
- }
-
- const T& AsBar() const {
- assert(IsBar());
- return bar._0;
- }
-
- T& AsBar() {
- assert(IsBar());
- return bar._0;
- }
-
- static StyleFoo Baz(const StylePoint<T> &_0) {
- StyleFoo result;
- ::new (&result.baz._0) (StylePoint<T>)(_0);
- result.tag = Tag::Baz;
- return result;
- }
-
- bool IsBaz() const {
- return tag == Tag::Baz;
- }
-
- const StylePoint<T>& AsBaz() const {
- assert(IsBaz());
- return baz._0;
- }
-
- StylePoint<T>& AsBaz() {
- assert(IsBaz());
- return baz._0;
- }
-
- static StyleFoo Bazz() {
- StyleFoo result;
- result.tag = Tag::Bazz;
- return result;
- }
-
- bool IsBazz() const {
- return tag == Tag::Bazz;
- }
-};
-
-template<typename T>
-struct StyleBar {
- enum class Tag {
- Bar1,
- Bar2,
- Bar3,
- Bar4,
- };
-
- struct StyleBar1_Body {
- int32_t x;
- StylePoint<T> y;
- StylePoint<float> z;
- int32_t (*u)(int32_t);
- };
-
- struct StyleBar2_Body {
- T _0;
- };
-
- struct StyleBar3_Body {
- StylePoint<T> _0;
- };
-
- Tag tag;
- union {
- StyleBar1_Body bar1;
- StyleBar2_Body bar2;
- StyleBar3_Body bar3;
- };
-
- static StyleBar Bar1(const int32_t &x,
- const StylePoint<T> &y,
- const StylePoint<float> &z,
- int32_t (*&u)(int32_t)) {
- StyleBar result;
- ::new (&result.bar1.x) (int32_t)(x);
- ::new (&result.bar1.y) (StylePoint<T>)(y);
- ::new (&result.bar1.z) (StylePoint<float>)(z);
- ::new (&result.bar1.u) (int32_t(*)(int32_t))(u);
- result.tag = Tag::Bar1;
- return result;
- }
-
- bool IsBar1() const {
- return tag == Tag::Bar1;
- }
-
- const StyleBar1_Body& AsBar1() const {
- assert(IsBar1());
- return bar1;
- }
-
- StyleBar1_Body& AsBar1() {
- assert(IsBar1());
- return bar1;
- }
-
- static StyleBar Bar2(const T &_0) {
- StyleBar result;
- ::new (&result.bar2._0) (T)(_0);
- result.tag = Tag::Bar2;
- return result;
- }
-
- bool IsBar2() const {
- return tag == Tag::Bar2;
- }
-
- const T& AsBar2() const {
- assert(IsBar2());
- return bar2._0;
- }
-
- T& AsBar2() {
- assert(IsBar2());
- return bar2._0;
- }
-
- static StyleBar Bar3(const StylePoint<T> &_0) {
- StyleBar result;
- ::new (&result.bar3._0) (StylePoint<T>)(_0);
- result.tag = Tag::Bar3;
- return result;
- }
-
- bool IsBar3() const {
- return tag == Tag::Bar3;
- }
-
- const StylePoint<T>& AsBar3() const {
- assert(IsBar3());
- return bar3._0;
- }
-
- StylePoint<T>& AsBar3() {
- assert(IsBar3());
- return bar3._0;
- }
-
- static StyleBar Bar4() {
- StyleBar result;
- result.tag = Tag::Bar4;
- return result;
- }
-
- bool IsBar4() const {
- return tag == Tag::Bar4;
- }
-};
-
-union StyleBaz {
- enum class Tag : uint8_t {
- Baz1,
- Baz2,
- Baz3,
- };
-
- struct Baz1_Body {
- Tag tag;
- StyleBar<uint32_t> _0;
- };
-
- struct Baz2_Body {
- Tag tag;
- StylePoint<int32_t> _0;
- };
-
- struct {
- Tag tag;
- };
- Baz1_Body baz1;
- Baz2_Body baz2;
-
- static StyleBaz Baz1(const StyleBar<uint32_t> &_0) {
- StyleBaz result;
- ::new (&result.baz1._0) (StyleBar<uint32_t>)(_0);
- result.tag = Tag::Baz1;
- return result;
- }
-
- bool IsBaz1() const {
- return tag == Tag::Baz1;
- }
-
- const StyleBar<uint32_t>& AsBaz1() const {
- assert(IsBaz1());
- return baz1._0;
- }
-
- StyleBar<uint32_t>& AsBaz1() {
- assert(IsBaz1());
- return baz1._0;
- }
-
- static StyleBaz Baz2(const StylePoint<int32_t> &_0) {
- StyleBaz result;
- ::new (&result.baz2._0) (StylePoint<int32_t>)(_0);
- result.tag = Tag::Baz2;
- return result;
- }
-
- bool IsBaz2() const {
- return tag == Tag::Baz2;
- }
-
- const StylePoint<int32_t>& AsBaz2() const {
- assert(IsBaz2());
- return baz2._0;
- }
-
- StylePoint<int32_t>& AsBaz2() {
- assert(IsBaz2());
- return baz2._0;
- }
-
- static StyleBaz Baz3() {
- StyleBaz result;
- result.tag = Tag::Baz3;
- return result;
- }
-
- bool IsBaz3() const {
- return tag == Tag::Baz3;
- }
-};
-
-struct StyleTaz {
- enum class Tag : uint8_t {
- Taz1,
- Taz2,
- Taz3,
- };
-
- struct StyleTaz1_Body {
- StyleBar<uint32_t> _0;
- };
-
- struct StyleTaz2_Body {
- StyleBaz _0;
- };
-
- Tag tag;
- union {
- StyleTaz1_Body taz1;
- StyleTaz2_Body taz2;
- };
-
- static StyleTaz Taz1(const StyleBar<uint32_t> &_0) {
- StyleTaz result;
- ::new (&result.taz1._0) (StyleBar<uint32_t>)(_0);
- result.tag = Tag::Taz1;
- return result;
- }
-
- bool IsTaz1() const {
- return tag == Tag::Taz1;
- }
-
- const StyleBar<uint32_t>& AsTaz1() const {
- assert(IsTaz1());
- return taz1._0;
- }
-
- StyleBar<uint32_t>& AsTaz1() {
- assert(IsTaz1());
- return taz1._0;
- }
-
- static StyleTaz Taz2(const StyleBaz &_0) {
- StyleTaz result;
- ::new (&result.taz2._0) (StyleBaz)(_0);
- result.tag = Tag::Taz2;
- return result;
- }
-
- bool IsTaz2() const {
- return tag == Tag::Taz2;
- }
-
- const StyleBaz& AsTaz2() const {
- assert(IsTaz2());
- return taz2._0;
- }
-
- StyleBaz& AsTaz2() {
- assert(IsTaz2());
- return taz2._0;
- }
-
- static StyleTaz Taz3() {
- StyleTaz result;
- result.tag = Tag::Taz3;
- return result;
- }
-
- bool IsTaz3() const {
- return tag == Tag::Taz3;
- }
-};
-
-extern "C" {
-
-void foo(const StyleFoo<int32_t> *foo,
- const StyleBar<int32_t> *bar,
- const StyleBaz *baz,
- const StyleTaz *taz);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/transform_op.tag.compat.c b/cbindgen-0.24.5/tests/expectations/transform_op.tag.compat.c
deleted file mode 100644
index 0c7c184..0000000
--- a/cbindgen-0.24.5/tests/expectations/transform_op.tag.compat.c
+++ /dev/null
@@ -1,170 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct StylePoint_i32 {
- int32_t x;
- int32_t y;
-};
-
-struct StylePoint_f32 {
- float x;
- float y;
-};
-
-enum StyleFoo_i32_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Foo_i32,
- Bar_i32,
- Baz_i32,
- Bazz_i32,
-};
-#ifndef __cplusplus
-typedef uint8_t StyleFoo_i32_Tag;
-#endif // __cplusplus
-
-struct StyleFoo_Body_i32 {
- StyleFoo_i32_Tag tag;
- int32_t x;
- struct StylePoint_i32 y;
- struct StylePoint_f32 z;
-};
-
-union StyleFoo_i32 {
- StyleFoo_i32_Tag tag;
- struct StyleFoo_Body_i32 foo;
- struct {
- StyleFoo_i32_Tag bar_tag;
- int32_t bar;
- };
- struct {
- StyleFoo_i32_Tag baz_tag;
- struct StylePoint_i32 baz;
- };
-};
-
-enum StyleBar_i32_Tag {
- Bar1_i32,
- Bar2_i32,
- Bar3_i32,
- Bar4_i32,
-};
-
-struct StyleBar1_Body_i32 {
- int32_t x;
- struct StylePoint_i32 y;
- struct StylePoint_f32 z;
- int32_t (*u)(int32_t);
-};
-
-struct StyleBar_i32 {
- enum StyleBar_i32_Tag tag;
- union {
- struct StyleBar1_Body_i32 bar1;
- struct {
- int32_t bar2;
- };
- struct {
- struct StylePoint_i32 bar3;
- };
- };
-};
-
-struct StylePoint_u32 {
- uint32_t x;
- uint32_t y;
-};
-
-enum StyleBar_u32_Tag {
- Bar1_u32,
- Bar2_u32,
- Bar3_u32,
- Bar4_u32,
-};
-
-struct StyleBar1_Body_u32 {
- int32_t x;
- struct StylePoint_u32 y;
- struct StylePoint_f32 z;
- int32_t (*u)(int32_t);
-};
-
-struct StyleBar_u32 {
- enum StyleBar_u32_Tag tag;
- union {
- struct StyleBar1_Body_u32 bar1;
- struct {
- uint32_t bar2;
- };
- struct {
- struct StylePoint_u32 bar3;
- };
- };
-};
-
-enum StyleBaz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Baz1,
- Baz2,
- Baz3,
-};
-#ifndef __cplusplus
-typedef uint8_t StyleBaz_Tag;
-#endif // __cplusplus
-
-union StyleBaz {
- StyleBaz_Tag tag;
- struct {
- StyleBaz_Tag baz1_tag;
- struct StyleBar_u32 baz1;
- };
- struct {
- StyleBaz_Tag baz2_tag;
- struct StylePoint_i32 baz2;
- };
-};
-
-enum StyleTaz_Tag
-#ifdef __cplusplus
- : uint8_t
-#endif // __cplusplus
- {
- Taz1,
- Taz2,
- Taz3,
-};
-#ifndef __cplusplus
-typedef uint8_t StyleTaz_Tag;
-#endif // __cplusplus
-
-struct StyleTaz {
- StyleTaz_Tag tag;
- union {
- struct {
- struct StyleBar_u32 taz1;
- };
- struct {
- union StyleBaz taz2;
- };
- };
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void foo(const union StyleFoo_i32 *foo,
- const struct StyleBar_i32 *bar,
- const union StyleBaz *baz,
- const struct StyleTaz *taz);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/transparent.both.compat.c b/cbindgen-0.24.5/tests/expectations/transparent.both.compat.c
deleted file mode 100644
index 2b760c7..0000000
--- a/cbindgen-0.24.5/tests/expectations/transparent.both.compat.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct DummyStruct DummyStruct;
-
-typedef struct EnumWithAssociatedConstantInImpl EnumWithAssociatedConstantInImpl;
-
-typedef struct DummyStruct TransparentComplexWrappingStructTuple;
-
-typedef uint32_t TransparentPrimitiveWrappingStructTuple;
-
-typedef struct DummyStruct TransparentComplexWrappingStructure;
-
-typedef uint32_t TransparentPrimitiveWrappingStructure;
-
-typedef struct DummyStruct TransparentComplexWrapper_i32;
-
-typedef uint32_t TransparentPrimitiveWrapper_i32;
-
-typedef uint32_t TransparentPrimitiveWithAssociatedConstants;
-#define TransparentPrimitiveWithAssociatedConstants_ZERO 0
-#define TransparentPrimitiveWithAssociatedConstants_ONE 1
-
-#define EnumWithAssociatedConstantInImpl_TEN 10
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(TransparentComplexWrappingStructTuple a,
- TransparentPrimitiveWrappingStructTuple b,
- TransparentComplexWrappingStructure c,
- TransparentPrimitiveWrappingStructure d,
- TransparentComplexWrapper_i32 e,
- TransparentPrimitiveWrapper_i32 f,
- TransparentPrimitiveWithAssociatedConstants g,
- struct EnumWithAssociatedConstantInImpl h);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/transparent.compat.c b/cbindgen-0.24.5/tests/expectations/transparent.compat.c
deleted file mode 100644
index 09b27fe..0000000
--- a/cbindgen-0.24.5/tests/expectations/transparent.compat.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct DummyStruct DummyStruct;
-
-typedef struct EnumWithAssociatedConstantInImpl EnumWithAssociatedConstantInImpl;
-
-typedef DummyStruct TransparentComplexWrappingStructTuple;
-
-typedef uint32_t TransparentPrimitiveWrappingStructTuple;
-
-typedef DummyStruct TransparentComplexWrappingStructure;
-
-typedef uint32_t TransparentPrimitiveWrappingStructure;
-
-typedef DummyStruct TransparentComplexWrapper_i32;
-
-typedef uint32_t TransparentPrimitiveWrapper_i32;
-
-typedef uint32_t TransparentPrimitiveWithAssociatedConstants;
-#define TransparentPrimitiveWithAssociatedConstants_ZERO 0
-#define TransparentPrimitiveWithAssociatedConstants_ONE 1
-
-#define EnumWithAssociatedConstantInImpl_TEN 10
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(TransparentComplexWrappingStructTuple a,
- TransparentPrimitiveWrappingStructTuple b,
- TransparentComplexWrappingStructure c,
- TransparentPrimitiveWrappingStructure d,
- TransparentComplexWrapper_i32 e,
- TransparentPrimitiveWrapper_i32 f,
- TransparentPrimitiveWithAssociatedConstants g,
- EnumWithAssociatedConstantInImpl h);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/transparent.cpp b/cbindgen-0.24.5/tests/expectations/transparent.cpp
deleted file mode 100644
index 4c06739..0000000
--- a/cbindgen-0.24.5/tests/expectations/transparent.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct DummyStruct;
-
-struct EnumWithAssociatedConstantInImpl;
-
-using TransparentComplexWrappingStructTuple = DummyStruct;
-
-using TransparentPrimitiveWrappingStructTuple = uint32_t;
-
-using TransparentComplexWrappingStructure = DummyStruct;
-
-using TransparentPrimitiveWrappingStructure = uint32_t;
-
-template<typename T>
-using TransparentComplexWrapper = DummyStruct;
-
-template<typename T>
-using TransparentPrimitiveWrapper = uint32_t;
-
-using TransparentPrimitiveWithAssociatedConstants = uint32_t;
-constexpr static const TransparentPrimitiveWithAssociatedConstants TransparentPrimitiveWithAssociatedConstants_ZERO = 0;
-constexpr static const TransparentPrimitiveWithAssociatedConstants TransparentPrimitiveWithAssociatedConstants_ONE = 1;
-
-constexpr static const TransparentPrimitiveWrappingStructure EnumWithAssociatedConstantInImpl_TEN = 10;
-
-extern "C" {
-
-void root(TransparentComplexWrappingStructTuple a,
- TransparentPrimitiveWrappingStructTuple b,
- TransparentComplexWrappingStructure c,
- TransparentPrimitiveWrappingStructure d,
- TransparentComplexWrapper<int32_t> e,
- TransparentPrimitiveWrapper<int32_t> f,
- TransparentPrimitiveWithAssociatedConstants g,
- EnumWithAssociatedConstantInImpl h);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/transparent.tag.compat.c b/cbindgen-0.24.5/tests/expectations/transparent.tag.compat.c
deleted file mode 100644
index 26c01e4..0000000
--- a/cbindgen-0.24.5/tests/expectations/transparent.tag.compat.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct DummyStruct;
-
-struct EnumWithAssociatedConstantInImpl;
-
-typedef struct DummyStruct TransparentComplexWrappingStructTuple;
-
-typedef uint32_t TransparentPrimitiveWrappingStructTuple;
-
-typedef struct DummyStruct TransparentComplexWrappingStructure;
-
-typedef uint32_t TransparentPrimitiveWrappingStructure;
-
-typedef struct DummyStruct TransparentComplexWrapper_i32;
-
-typedef uint32_t TransparentPrimitiveWrapper_i32;
-
-typedef uint32_t TransparentPrimitiveWithAssociatedConstants;
-#define TransparentPrimitiveWithAssociatedConstants_ZERO 0
-#define TransparentPrimitiveWithAssociatedConstants_ONE 1
-
-#define EnumWithAssociatedConstantInImpl_TEN 10
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(TransparentComplexWrappingStructTuple a,
- TransparentPrimitiveWrappingStructTuple b,
- TransparentComplexWrappingStructure c,
- TransparentPrimitiveWrappingStructure d,
- TransparentComplexWrapper_i32 e,
- TransparentPrimitiveWrapper_i32 f,
- TransparentPrimitiveWithAssociatedConstants g,
- struct EnumWithAssociatedConstantInImpl h);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/typedef.both.compat.c b/cbindgen-0.24.5/tests/expectations/typedef.both.compat.c
deleted file mode 100644
index ebb0d56..0000000
--- a/cbindgen-0.24.5/tests/expectations/typedef.both.compat.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo_i32__i32 {
- int32_t x;
- int32_t y;
-} Foo_i32__i32;
-
-typedef struct Foo_i32__i32 IntFoo_i32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(IntFoo_i32 a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/typedef.compat.c b/cbindgen-0.24.5/tests/expectations/typedef.compat.c
deleted file mode 100644
index d3e53dd..0000000
--- a/cbindgen-0.24.5/tests/expectations/typedef.compat.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- int32_t x;
- int32_t y;
-} Foo_i32__i32;
-
-typedef Foo_i32__i32 IntFoo_i32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(IntFoo_i32 a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/typedef.cpp b/cbindgen-0.24.5/tests/expectations/typedef.cpp
deleted file mode 100644
index d04eda2..0000000
--- a/cbindgen-0.24.5/tests/expectations/typedef.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T, typename U>
-struct Foo {
- T x;
- U y;
-};
-
-template<typename T>
-using IntFoo = Foo<int32_t, T>;
-
-extern "C" {
-
-void root(IntFoo<int32_t> a);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/typedef.tag.compat.c b/cbindgen-0.24.5/tests/expectations/typedef.tag.compat.c
deleted file mode 100644
index 309b4f9..0000000
--- a/cbindgen-0.24.5/tests/expectations/typedef.tag.compat.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo_i32__i32 {
- int32_t x;
- int32_t y;
-};
-
-typedef struct Foo_i32__i32 IntFoo_i32;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(IntFoo_i32 a);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/union.both.compat.c b/cbindgen-0.24.5/tests/expectations/union.both.compat.c
deleted file mode 100644
index 9c33a50..0000000
--- a/cbindgen-0.24.5/tests/expectations/union.both.compat.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Opaque Opaque;
-
-typedef union Normal {
- int32_t x;
- float y;
-} Normal;
-
-typedef union NormalWithZST {
- int32_t x;
- float y;
-} NormalWithZST;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Opaque *a, union Normal b, union NormalWithZST c);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/union.compat.c b/cbindgen-0.24.5/tests/expectations/union.compat.c
deleted file mode 100644
index b81c76c..0000000
--- a/cbindgen-0.24.5/tests/expectations/union.compat.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Opaque Opaque;
-
-typedef union {
- int32_t x;
- float y;
-} Normal;
-
-typedef union {
- int32_t x;
- float y;
-} NormalWithZST;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Opaque *a, Normal b, NormalWithZST c);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/union.cpp b/cbindgen-0.24.5/tests/expectations/union.cpp
deleted file mode 100644
index 92d1151..0000000
--- a/cbindgen-0.24.5/tests/expectations/union.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct Opaque;
-
-union Normal {
- int32_t x;
- float y;
-};
-
-union NormalWithZST {
- int32_t x;
- float y;
-};
-
-extern "C" {
-
-void root(Opaque *a, Normal b, NormalWithZST c);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/union.tag.compat.c b/cbindgen-0.24.5/tests/expectations/union.tag.compat.c
deleted file mode 100644
index 5e68956..0000000
--- a/cbindgen-0.24.5/tests/expectations/union.tag.compat.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Opaque;
-
-union Normal {
- int32_t x;
- float y;
-};
-
-union NormalWithZST {
- int32_t x;
- float y;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(struct Opaque *a, union Normal b, union NormalWithZST c);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/union_self.both.compat.c b/cbindgen-0.24.5/tests/expectations/union_self.both.compat.c
deleted file mode 100644
index be9ed8e..0000000
--- a/cbindgen-0.24.5/tests/expectations/union_self.both.compat.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct Foo_Bar {
- const int32_t *something;
-} Foo_Bar;
-
-typedef union Bar {
- int32_t something;
- struct Foo_Bar subexpressions;
-} Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(union Bar b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/union_self.compat.c b/cbindgen-0.24.5/tests/expectations/union_self.compat.c
deleted file mode 100644
index bfd26bc..0000000
--- a/cbindgen-0.24.5/tests/expectations/union_self.compat.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- const int32_t *something;
-} Foo_Bar;
-
-typedef union {
- int32_t something;
- Foo_Bar subexpressions;
-} Bar;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(Bar b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/union_self.cpp b/cbindgen-0.24.5/tests/expectations/union_self.cpp
deleted file mode 100644
index 8f0e17a..0000000
--- a/cbindgen-0.24.5/tests/expectations/union_self.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-template<typename T>
-struct Foo {
- const int32_t *something;
-};
-
-union Bar {
- int32_t something;
- Foo<Bar> subexpressions;
-};
-
-extern "C" {
-
-void root(Bar b);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/union_self.tag.compat.c b/cbindgen-0.24.5/tests/expectations/union_self.tag.compat.c
deleted file mode 100644
index a150fa1..0000000
--- a/cbindgen-0.24.5/tests/expectations/union_self.tag.compat.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct Foo_Bar {
- const int32_t *something;
-};
-
-union Bar {
- int32_t something;
- struct Foo_Bar subexpressions;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(union Bar b);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/using_namespaces.compat.c b/cbindgen-0.24.5/tests/expectations/using_namespaces.compat.c
deleted file mode 100644
index 04bd0f1..0000000
--- a/cbindgen-0.24.5/tests/expectations/using_namespaces.compat.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-namespace root {
-#endif // __cplusplus
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void root(void);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
-#ifdef __cplusplus
-} // namespace root
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/using_namespaces.cpp b/cbindgen-0.24.5/tests/expectations/using_namespaces.cpp
deleted file mode 100644
index 3c65c0c..0000000
--- a/cbindgen-0.24.5/tests/expectations/using_namespaces.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-namespace root {
-
-using namespace std;
-
-extern "C" {
-
-void root();
-
-} // extern "C"
-
-} // namespace root
diff --git a/cbindgen-0.24.5/tests/expectations/va_list.c b/cbindgen-0.24.5/tests/expectations/va_list.c
deleted file mode 100644
index 2332c27..0000000
--- a/cbindgen-0.24.5/tests/expectations/va_list.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-int32_t va_list_test(va_list ap);
diff --git a/cbindgen-0.24.5/tests/expectations/va_list.compat.c b/cbindgen-0.24.5/tests/expectations/va_list.compat.c
deleted file mode 100644
index acaae09..0000000
--- a/cbindgen-0.24.5/tests/expectations/va_list.compat.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-int32_t va_list_test(va_list ap);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/va_list.cpp b/cbindgen-0.24.5/tests/expectations/va_list.cpp
deleted file mode 100644
index 8059074..0000000
--- a/cbindgen-0.24.5/tests/expectations/va_list.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-extern "C" {
-
-int32_t va_list_test(va_list ap);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/va_list.pyx b/cbindgen-0.24.5/tests/expectations/va_list.pyx
deleted file mode 100644
index a692808..0000000
--- a/cbindgen-0.24.5/tests/expectations/va_list.pyx
+++ /dev/null
@@ -1,9 +0,0 @@
-from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
-from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
-cdef extern from *:
- ctypedef bint bool
- ctypedef struct va_list
-
-cdef extern from *:
-
- int32_t va_list_test(va_list ap);
diff --git a/cbindgen-0.24.5/tests/expectations/workspace.both.compat.c b/cbindgen-0.24.5/tests/expectations/workspace.both.compat.c
deleted file mode 100644
index d830fb1..0000000
--- a/cbindgen-0.24.5/tests/expectations/workspace.both.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define EXT_CONST 0
-
-typedef struct ExtType {
- uint32_t data;
-} ExtType;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void consume_ext(struct ExtType _ext);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/workspace.compat.c b/cbindgen-0.24.5/tests/expectations/workspace.compat.c
deleted file mode 100644
index dd8b86c..0000000
--- a/cbindgen-0.24.5/tests/expectations/workspace.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define EXT_CONST 0
-
-typedef struct {
- uint32_t data;
-} ExtType;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void consume_ext(ExtType _ext);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/workspace.cpp b/cbindgen-0.24.5/tests/expectations/workspace.cpp
deleted file mode 100644
index b7b31a1..0000000
--- a/cbindgen-0.24.5/tests/expectations/workspace.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-constexpr static const int32_t EXT_CONST = 0;
-
-struct ExtType {
- uint32_t data;
-};
-
-extern "C" {
-
-void consume_ext(ExtType _ext);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/workspace.tag.compat.c b/cbindgen-0.24.5/tests/expectations/workspace.tag.compat.c
deleted file mode 100644
index 8e4596f..0000000
--- a/cbindgen-0.24.5/tests/expectations/workspace.tag.compat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define EXT_CONST 0
-
-struct ExtType {
- uint32_t data;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void consume_ext(struct ExtType _ext);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/zst.both.compat.c b/cbindgen-0.24.5/tests/expectations/zst.both.compat.c
deleted file mode 100644
index 154f14f..0000000
--- a/cbindgen-0.24.5/tests/expectations/zst.both.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct TraitObject {
- void *data;
- void *vtable;
-} TraitObject;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void *root(const void *ptr, struct TraitObject t);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/zst.compat.c b/cbindgen-0.24.5/tests/expectations/zst.compat.c
deleted file mode 100644
index 5dbc3ea..0000000
--- a/cbindgen-0.24.5/tests/expectations/zst.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-typedef struct {
- void *data;
- void *vtable;
-} TraitObject;
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void *root(const void *ptr, TraitObject t);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/zst.cpp b/cbindgen-0.24.5/tests/expectations/zst.cpp
deleted file mode 100644
index 6d6a4e2..0000000
--- a/cbindgen-0.24.5/tests/expectations/zst.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <cstdarg>
-#include <cstdint>
-#include <cstdlib>
-#include <ostream>
-#include <new>
-
-struct TraitObject {
- void *data;
- void *vtable;
-};
-
-extern "C" {
-
-void *root(const void *ptr, TraitObject t);
-
-} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/zst.tag.compat.c b/cbindgen-0.24.5/tests/expectations/zst.tag.compat.c
deleted file mode 100644
index 8a115b7..0000000
--- a/cbindgen-0.24.5/tests/expectations/zst.tag.compat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-struct TraitObject {
- void *data;
- void *vtable;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-void *root(const void *ptr, struct TraitObject t);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/rust/bitflags.rs b/cbindgen-0.24.5/tests/rust/bitflags.rs
deleted file mode 100644
index 7e78bd8..0000000
--- a/cbindgen-0.24.5/tests/rust/bitflags.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-bitflags! {
- /// Constants shared by multiple CSS Box Alignment properties
- ///
- /// These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
- #[derive(MallocSizeOf)]
- #[repr(C)]
- pub struct AlignFlags: u8 {
- /// 'auto'
- const AUTO = 0;
- /// 'normal'
- const NORMAL = 1;
- /// 'start'
- const START = 1 << 1;
- /// 'end'
- const END = 1 << 2;
- const ALIAS = Self::END.bits;
- /// 'flex-start'
- const FLEX_START = 1 << 3;
- const MIXED = 1 << 4 | AlignFlags::FLEX_START.bits | AlignFlags::END.bits;
- const MIXED_SELF = 1 << 5 | AlignFlags::FLEX_START.bits | AlignFlags::END.bits;
- }
-}
-
-bitflags! {
- #[repr(C)]
- pub struct DebugFlags: u32 {
- /// Flag with the topmost bit set of the u32
- const BIGGEST_ALLOWED = 1 << 31;
- }
-}
-
-bitflags! {
- #[repr(C)]
- pub struct LargeFlags: u64 {
- /// Flag with a very large shift that usually would be narrowed.
- const LARGE_SHIFT = 1u64 << 44;
- const INVERTED = !Self::LARGE_SHIFT.bits;
- }
-}
-
-
-#[no_mangle]
-pub extern "C" fn root(flags: AlignFlags, bigger_flags: DebugFlags, largest_flags: LargeFlags) {}
diff --git a/cbindgen-0.24.5/tests/rust/cfg.rs b/cbindgen-0.24.5/tests/rust/cfg.rs
deleted file mode 100644
index 903c156..0000000
--- a/cbindgen-0.24.5/tests/rust/cfg.rs
+++ /dev/null
@@ -1,64 +0,0 @@
-#[cfg(all(unix, x11))]
-#[repr(u32)]
-enum FooType {
- A,
- B,
- C,
-}
-
-#[cfg(all(unix, x11))]
-#[repr(C)]
-struct FooHandle {
- ty: FooType,
- x: i32,
- y: f32,
-}
-
-#[cfg(any(windows, target_pointer_width="32"))]
-#[repr(u32)]
-enum BarType {
- A,
- B,
- C,
-}
-
-#[repr(u8)]
-pub enum C {
- C1,
- C2,
- #[cfg(windows)]
- C3,
- #[cfg(unix)]
- C5 { int: i32 },
-}
-
-#[cfg(any(windows, target_pointer_width="32"))]
-#[repr(C)]
-struct BarHandle {
- ty: BarType,
- x: i32,
- y: f32,
-}
-
-// FIXME(#634): Support deriving methods for structs with conditional fields.
-/// cbindgen:derive-eq=false
-/// cbindgen:derive-neq=false
-#[repr(C)]
-struct ConditionalField {
- #[cfg(x11)]
- field: i32,
-}
-
-#[cfg(all(unix, x11))]
-#[no_mangle]
-pub extern "C" fn root(a: FooHandle, c: C)
-{ }
-
-#[cfg(any(windows, target_pointer_width="32"))]
-#[no_mangle]
-pub extern "C" fn root(a: BarHandle, c: C)
-{ }
-
-#[no_mangle]
-pub extern "C" fn cond(a: ConditionalField)
-{ }
diff --git a/cbindgen-0.24.5/tests/rust/const_transparent.rs b/cbindgen-0.24.5/tests/rust/const_transparent.rs
deleted file mode 100644
index 7032953..0000000
--- a/cbindgen-0.24.5/tests/rust/const_transparent.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-#[repr(transparent)]
-struct Transparent { field: u8 }
-
-pub const FOO: Transparent = Transparent { field: 0 };
diff --git a/cbindgen-0.24.5/tests/rust/documentation.rs b/cbindgen-0.24.5/tests/rust/documentation.rs
deleted file mode 100644
index 56da3c3..0000000
--- a/cbindgen-0.24.5/tests/rust/documentation.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-/// The root of all evil.
-///
-/// But at least it contains some more documentation as someone would expect
-/// from a simple test case like this.
-///
-/// # Hint
-///
-/// Always ensure that everything is properly documented, even if you feel lazy.
-/// **Sometimes** it is also helpful to include some markdown formatting.
-///
-/// ////////////////////////////////////////////////////////////////////////////
-///
-/// Attention:
-///
-/// Rust is going to trim all leading `/` symbols. If you want to use them as a
-/// marker you need to add at least a single whitespace inbetween the tripple
-/// slash doc-comment marker and the rest.
-///
-#[no_mangle]
-pub extern "C" fn root() {
-}
diff --git a/cbindgen-0.24.5/tests/rust/extern.rs b/cbindgen-0.24.5/tests/rust/extern.rs
deleted file mode 100644
index 3bd83d1..0000000
--- a/cbindgen-0.24.5/tests/rust/extern.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-#[repr(C)]
-struct Normal {
- x: i32,
- y: f32,
-}
-
-extern "C" {
- fn foo() -> i32;
-
- fn bar(a: Normal);
-}
diff --git a/cbindgen-0.24.5/tests/rust/ignore.rs b/cbindgen-0.24.5/tests/rust/ignore.rs
deleted file mode 100644
index 54ade32..0000000
--- a/cbindgen-0.24.5/tests/rust/ignore.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-/// cbindgen:ignore
-#[no_mangle]
-pub extern "C" fn root() {}
-
-/// cbindgen:ignore
-///
-/// Something else.
-#[no_mangle]
-pub extern "C" fn another_root() {}
-
-#[no_mangle]
-pub extern "C" fn no_ignore_root() {}
diff --git a/cbindgen-0.24.5/tests/rust/nonzero.rs b/cbindgen-0.24.5/tests/rust/nonzero.rs
deleted file mode 100644
index 9bc2cde..0000000
--- a/cbindgen-0.24.5/tests/rust/nonzero.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-use std::num::*;
-
-#[repr(C)]
-pub struct NonZeroTest {
- pub a: NonZeroU8,
- pub b: NonZeroU16,
- pub c: NonZeroU32,
- pub d: NonZeroU64,
- pub e: NonZeroI8,
- pub f: NonZeroI16,
- pub g: NonZeroI32,
- pub h: NonZeroI64,
- pub i: Option<NonZeroI64>,
- pub j: *const Option<Option<NonZeroI64>>,
-}
-
-#[no_mangle]
-pub extern "C" fn root(
- test: NonZeroTest,
- a: NonZeroU8,
- b: NonZeroU16,
- c: NonZeroU32,
- d: NonZeroU64,
- e: NonZeroI8,
- f: NonZeroI16,
- g: NonZeroI32,
- h: NonZeroI64,
- i: Option<NonZeroI64>,
- j: *const Option<Option<NonZeroI64>>,
-) {}
diff --git a/cbindgen-0.24.5/tests/rust/va_list.rs b/cbindgen-0.24.5/tests/rust/va_list.rs
deleted file mode 100644
index 1016091..0000000
--- a/cbindgen-0.24.5/tests/rust/va_list.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-use std::ffi::VaList;
-
-#[no_mangle]
-pub unsafe extern "C" fn va_list_test(mut ap: VaList) -> int32_t {
- ap.arg()
-}
diff --git a/cbindgen-0.24.5/tests/tests.rs b/cbindgen-0.24.5/tests/tests.rs
deleted file mode 100644
index 88a1c40..0000000
--- a/cbindgen-0.24.5/tests/tests.rs
+++ /dev/null
@@ -1,299 +0,0 @@
-extern crate cbindgen;
-
-use cbindgen::*;
-use std::collections::HashSet;
-use std::path::Path;
-use std::process::Command;
-use std::{env, fs, str};
-
-fn style_str(style: Style) -> &'static str {
- match style {
- Style::Both => "both",
- Style::Tag => "tag",
- Style::Type => "type",
- }
-}
-
-fn run_cbindgen(
- cbindgen_path: &'static str,
- path: &Path,
- output: &Path,
- language: Language,
- cpp_compat: bool,
- style: Option<Style>,
-) -> Vec<u8> {
- let program = Path::new(cbindgen_path);
- let mut command = Command::new(program);
- match language {
- Language::Cxx => {}
- Language::C => {
- command.arg("--lang").arg("c");
-
- if cpp_compat {
- command.arg("--cpp-compat");
- }
- }
- Language::Cython => {
- command.arg("--lang").arg("cython");
- }
- }
-
- if let Some(style) = style {
- command.arg("--style").arg(style_str(style));
- }
-
- let config = path.with_extension("toml");
- if config.exists() {
- command.arg("--config").arg(config);
- }
-
- command.arg(path);
-
- println!("Running: {:?}", command);
- let cbindgen_output = command.output().expect("failed to execute process");
- assert!(
- cbindgen_output.status.success(),
- "cbindgen failed: {:?} with error: {}",
- output,
- str::from_utf8(&cbindgen_output.stderr).unwrap_or_default()
- );
- cbindgen_output.stdout
-}
-
-fn compile(
- cbindgen_output: &Path,
- tests_path: &Path,
- tmp_dir: &Path,
- language: Language,
- style: Option<Style>,
- skip_warning_as_error: bool,
-) {
- let cc = match language {
- Language::Cxx => env::var("CXX").unwrap_or_else(|_| "g++".to_owned()),
- Language::C => env::var("CC").unwrap_or_else(|_| "gcc".to_owned()),
- Language::Cython => env::var("CYTHON").unwrap_or_else(|_| "cython".to_owned()),
- };
-
- let file_name = cbindgen_output
- .file_name()
- .expect("cbindgen output should be a file");
- let mut object = tmp_dir.join(file_name);
- object.set_extension("o");
-
- let mut command = Command::new(cc);
- match language {
- Language::Cxx | Language::C => {
- command.arg("-D").arg("DEFINED");
- command.arg("-I").arg(tests_path);
- command.arg("-Wall");
- if !skip_warning_as_error {
- command.arg("-Werror");
- }
- // `swift_name` is not recognzied by gcc.
- command.arg("-Wno-attributes");
- // clang warns about unused const variables.
- command.arg("-Wno-unused-const-variable");
- // clang also warns about returning non-instantiated templates (they could
- // be specialized, but they're not so it's fine).
- command.arg("-Wno-return-type-c-linkage");
- if let Language::Cxx = language {
- // enum class is a c++11 extension which makes g++ on macos 10.14 error out
- // inline variables are are a c++17 extension
- command.arg("-std=c++17");
- // Prevents warnings when compiling .c files as c++.
- command.arg("-x").arg("c++");
- if let Ok(extra_flags) = env::var("CXXFLAGS") {
- command.args(extra_flags.split_whitespace());
- }
- } else if let Ok(extra_flags) = env::var("CFLAGS") {
- command.args(extra_flags.split_whitespace());
- }
-
- if let Some(style) = style {
- command.arg("-D");
- command.arg(format!(
- "CBINDGEN_STYLE_{}",
- style_str(style).to_uppercase()
- ));
- }
-
- command.arg("-o").arg(&object);
- command.arg("-c").arg(cbindgen_output);
- }
- Language::Cython => {
- command.arg("-Wextra");
- if !skip_warning_as_error {
- command.arg("-Werror");
- }
- command.arg("-3");
- command.arg("-o").arg(&object);
- command.arg(cbindgen_output);
- }
- }
-
- println!("Running: {:?}", command);
- let out = command.output().expect("failed to compile");
- assert!(out.status.success(), "Output failed to compile: {:?}", out);
-
- if object.exists() {
- fs::remove_file(object).unwrap();
- }
-}
-
-const SKIP_WARNING_AS_ERROR_SUFFIX: &str = ".skip_warning_as_error";
-
-#[allow(clippy::too_many_arguments)]
-fn run_compile_test(
- cbindgen_path: &'static str,
- name: &'static str,
- path: &Path,
- tmp_dir: &Path,
- language: Language,
- cpp_compat: bool,
- style: Option<Style>,
- cbindgen_outputs: &mut HashSet<Vec<u8>>,
-) {
- let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
- let tests_path = Path::new(&crate_dir).join("tests");
- let mut generated_file = tests_path.join("expectations");
- fs::create_dir_all(&generated_file).unwrap();
-
- let style_ext = style
- .map(|style| match style {
- Style::Both => ".both",
- Style::Tag => ".tag",
- Style::Type => "",
- })
- .unwrap_or_default();
- let lang_ext = match language {
- Language::Cxx => ".cpp",
- Language::C if cpp_compat => ".compat.c",
- Language::C => ".c",
- // cbindgen is supposed to generate declaration files (`.pxd`), but `cython` compiler
- // is extension-sensitive and won't work on them, so we use implementation files (`.pyx`)
- // in the test suite.
- Language::Cython => ".pyx",
- };
-
- let skip_warning_as_error = name.rfind(SKIP_WARNING_AS_ERROR_SUFFIX).is_some();
-
- let source_file =
- format!("{}{}{}", name, style_ext, lang_ext).replace(SKIP_WARNING_AS_ERROR_SUFFIX, "");
-
- generated_file.push(source_file);
-
- let cbindgen_output = run_cbindgen(
- cbindgen_path,
- path,
- &generated_file,
- language,
- cpp_compat,
- style,
- );
-
- if cbindgen_outputs.contains(&cbindgen_output) {
- // We already generated an identical file previously.
- if env::var_os("CBINDGEN_TEST_VERIFY").is_some() {
- assert!(!generated_file.exists());
- } else if generated_file.exists() {
- fs::remove_file(&generated_file).unwrap();
- }
- } else {
- if env::var_os("CBINDGEN_TEST_VERIFY").is_some() {
- let prev_cbindgen_output = fs::read(&generated_file).unwrap();
- assert_eq!(cbindgen_output, prev_cbindgen_output);
- } else {
- fs::write(&generated_file, &cbindgen_output).unwrap();
- }
-
- cbindgen_outputs.insert(cbindgen_output);
-
- if env::var_os("CBINDGEN_TEST_NO_COMPILE").is_some() {
- return;
- }
-
- compile(
- &generated_file,
- &tests_path,
- tmp_dir,
- language,
- style,
- skip_warning_as_error,
- );
-
- if language == Language::C && cpp_compat {
- compile(
- &generated_file,
- &tests_path,
- tmp_dir,
- Language::Cxx,
- style,
- skip_warning_as_error,
- );
- }
- }
-}
-
-fn test_file(cbindgen_path: &'static str, name: &'static str, filename: &'static str) {
- let test = Path::new(filename);
- let tmp_dir = tempfile::Builder::new()
- .prefix("cbindgen-test-output")
- .tempdir()
- .expect("Creating tmp dir failed");
- let tmp_dir = tmp_dir.path();
- // Run tests in deduplication priority order. C++ compatibility tests are run first,
- // otherwise we would lose the C++ compiler run if they were deduplicated.
- let mut cbindgen_outputs = HashSet::new();
- for cpp_compat in &[true, false] {
- for style in &[Style::Type, Style::Tag, Style::Both] {
- run_compile_test(
- cbindgen_path,
- name,
- test,
- tmp_dir,
- Language::C,
- *cpp_compat,
- Some(*style),
- &mut cbindgen_outputs,
- );
- }
- }
-
- run_compile_test(
- cbindgen_path,
- name,
- test,
- tmp_dir,
- Language::Cxx,
- /* cpp_compat = */ false,
- None,
- &mut HashSet::new(),
- );
-
- // `Style::Both` should be identical to `Style::Tag` for Cython.
- let mut cbindgen_outputs = HashSet::new();
- for style in &[Style::Type, Style::Tag] {
- run_compile_test(
- cbindgen_path,
- name,
- test,
- tmp_dir,
- Language::Cython,
- /* cpp_compat = */ false,
- Some(*style),
- &mut cbindgen_outputs,
- );
- }
-}
-
-macro_rules! test_file {
- ($cbindgen_path:expr, $test_function_name:ident, $name:expr, $file:tt) => {
- #[test]
- fn $test_function_name() {
- test_file($cbindgen_path, $name, $file);
- }
- };
-}
-
-// This file is generated by build.rs
-include!(concat!(env!("OUT_DIR"), "/tests.rs"));
diff --git a/cbindgen-0.27.0/.cargo_vcs_info.json b/cbindgen-0.27.0/.cargo_vcs_info.json
new file mode 100644
index 0000000..89dd643
--- /dev/null
+++ b/cbindgen-0.27.0/.cargo_vcs_info.json
@@ -0,0 +1,6 @@
+{
+ "git": {
+ "sha1": "58c6156b0d91e82abb03c26187b8d18fa4345ce0"
+ },
+ "path_in_vcs": ""
+}
\ No newline at end of file
diff --git a/cbindgen-0.27.0/.clippy.toml b/cbindgen-0.27.0/.clippy.toml
new file mode 100644
index 0000000..4785aed
--- /dev/null
+++ b/cbindgen-0.27.0/.clippy.toml
@@ -0,0 +1,2 @@
+# Specify the minimum supported Rust version
+msrv = "1.70"
diff --git a/cbindgen-0.24.5/.gitattributes b/cbindgen-0.27.0/.gitattributes
similarity index 100%
rename from cbindgen-0.24.5/.gitattributes
rename to cbindgen-0.27.0/.gitattributes
diff --git a/cbindgen-0.27.0/.github/workflows/cbindgen.yml b/cbindgen-0.27.0/.github/workflows/cbindgen.yml
new file mode 100644
index 0000000..b36c251
--- /dev/null
+++ b/cbindgen-0.27.0/.github/workflows/cbindgen.yml
@@ -0,0 +1,90 @@
+name: cbindgen
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ branches:
+ - master
+ merge_group:
+ types:
+ - checks_requested
+
+jobs:
+ rustfmt-clippy:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Install stable
+ uses: dtolnay/rust-toolchain@stable
+ with:
+ components: "clippy, rustfmt"
+
+ - name: Run rustfmt
+ run: |
+ cargo +stable fmt --check
+
+ - name: Run clippy
+ run: |
+ cargo +stable clippy --workspace -- -D warnings
+
+ - name: Install minimum supported Rust version
+ id: msrv
+ uses: dtolnay/rust-toolchain@1.74
+
+ - name: Build with minimum supported Rust version
+ run: |
+ cargo +${{steps.msrv.outputs.name}} test nonexistent-test --verbose
+
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Install stable Rust
+ uses: dtolnay/rust-toolchain@stable
+
+ - name: Install Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.8'
+
+ - name: Install Cython
+ run: |
+ python -m pip install --upgrade pip wheel
+ pip install Cython==3.0.2
+
+ - name: Build
+ run: |
+ cargo +stable build --verbose
+
+ - name: Build no-default-features
+ run: |
+ cargo +stable build --verbose --no-default-features
+
+ - name: Test package
+ env:
+ CBINDGEN_TEST_VERIFY: 1
+ run: |
+ cargo +stable package --verbose
+ (cd target/package/cbindgen-$(cargo +stable run -- --version | cut -d ' ' -f 2) && cargo +stable test --verbose)
+
+ - name: Install nightly Rust
+ uses: dtolnay/rust-toolchain@nightly
+
+ - name: Test
+ env:
+ CBINDGEN_TEST_VERIFY: 1
+ run: |
+ cargo +nightly test --verbose
+
+ - name: Test minimal-versions
+ run: |
+ cargo +nightly update -Zminimal-versions
+ cargo +nightly test
diff --git a/cbindgen-0.27.0/.github/workflows/deploy.yml b/cbindgen-0.27.0/.github/workflows/deploy.yml
new file mode 100644
index 0000000..670291e
--- /dev/null
+++ b/cbindgen-0.27.0/.github/workflows/deploy.yml
@@ -0,0 +1,56 @@
+name: deploy
+
+on:
+ push:
+ tags:
+ - 'v*.*.*'
+
+jobs:
+
+ linux-binaries:
+ permissions:
+ # Grant the GITHUB_TOKEN additional permissions necessary for creating a release.
+ # We only run this action for tags, so any code has already been reviewed by
+ # someone with permissions to create a tag.
+ contents: write
+
+ runs-on: ubuntu-20.04
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Install stable
+ uses: dtolnay/rust-toolchain@stable
+
+ - name: semver
+ run: |
+ cargo +stable install cargo-semver-checks --locked
+ cargo +stable semver-checks check-release
+
+ - name: Build cbindgen
+ run: |
+ cargo +stable build --release
+
+ - name: Strip cbindgen
+ run: |
+ strip target/release/cbindgen
+
+ - name: Handle release data and files
+ id: tagName
+ run: |
+ VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
+ # Steps to extract the last release notes from CHANGES:
+ # 1. Remove the first three lines
+ # 2. Stop at the next heading level
+ # 3. Remove the last line
+ # 4. Deindent the bullet points to avoid a markdown code block
+ tail -n +3 CHANGES | sed '/^##/q' |
+ sed '$ d' | awk '{$1=$1};1' > CHANGES.txt
+
+ - name: Create a release
+ run: |
+ TAG=${{ steps.tagName.outputs.version }}
+ gh release create ${TAG} --title "${TAG}" --notes-file "CHANGES.txt" --draft 'target/release/cbindgen#cbindgen-ubuntu20.04'
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/cbindgen-0.24.5/.gitignore b/cbindgen-0.27.0/.gitignore
similarity index 100%
rename from cbindgen-0.24.5/.gitignore
rename to cbindgen-0.27.0/.gitignore
diff --git a/cbindgen-0.27.0/CHANGES b/cbindgen-0.27.0/CHANGES
new file mode 100644
index 0000000..153bb2e
--- /dev/null
+++ b/cbindgen-0.27.0/CHANGES
@@ -0,0 +1,350 @@
+# unreleased
+
+# 0.27.0
+
+ * Revert: The `Config` struct now has a private member.
+ * Allow users to specify a crate version for bindings generation (#901).
+ * Update MSRV to 1.74 (#912, #987).
+ * Support #[deprecated] on enum variants (#933).
+ * Support integrating the package_version information in a header file comment (#939).
+ * Add a language backend (#942).
+ * Support generics with defaulted args (#959).
+ * Add `VaList` compatibility (#970).
+
+# 0.26.0
+
+ * Fix swapping of `>>=` and `<<=` in constants.
+ * Add support for #[deprecated] (#860).
+ * Built-in support for bitflags 2.0.
+ * Support for "C-unwind" ABI.
+ * Generate bindings for non-public extern items if they are #[no_mangle].
+
+## 0.25.0
+
+ * Re-release of yanked 0.24.6 as a major release
+ * Update MSRV to 1.57
+ * Support variadic arguments (`...`) (#805)
+ * Add --depfile option (#820)
+ * Breaking changes: The `Config` struct now has a private member.
+
+## 0.24.6 (YANKED: depfile option was breaking, see #841)
+
+ * Update MSRV to 1.57
+ * Support variadic arguments (`...`) (#805)
+ * Add --depfile option (#820)
+
+## 0.24.5
+
+ * Don't enforce tempfile version.
+
+## 0.24.4
+
+ * Move expand infinite recursion fix (#799)
+ * Add with_cpp_compat to the builder (#796)
+ * Handle never type in return position consistently (#780)
+ * Fix warnings (#816, #819)
+ * Updated documentation (#788, #791, #792, #810, #823)
+
+## 0.24.3
+
+ * Make struct expressions correctly generated through typedefs (#768).
+
+## 0.24.2
+
+ * Make bitfield operators use explicit constructors.
+
+## 0.24.1
+
+ * Add support for unary negation (#765).
+ * Make more bitfield operators constexpr (#765).
+
+## 0.24.0
+
+ * Basic const generic support (#759, #760 #762).
+ * Suffixes on integer literals are now honored to avoid narrowing (#764).
+
+## 0.23.0
+
+ * Better support for constexpr. (#756)
+ * constexpr is now enabled by default in C++ mode. You can use const.allow_constexpr=false to revert to previous behavior. (#756)
+ * Minimum syn version no longer parses old rust code. (#754)
+
+## 0.22.0
+
+ * Support rename rule for union body members (#751).
+ * constant: Add support for associated constant expressions (#752).
+ * Fix regression in CamelCase rename rule (should be lowerCamelCase) (#750).
+ * enumeration: simplify standard types in variants (#749).
+ * Avoid generating and writing bindings when called recursively (#747).
+ * Cython: Omit per-variant tags in unions generated for Rust enums (#748).
+ * Update various dependencies.
+
+## 0.21.0
+
+ * Update MSRV to 1.54.0
+ * Update clap to 3.1.
+ * Update heck to 0.4.0
+ * unraw identifiers
+ * Honor documentation_length in Cython.
+ * Add documentation_style to with short and full options
+ * Map RawFd to Int
+ * Respect remove_underscores config when prefixing name to enum
+
+## 0.20.0
+
+ * Add Builder::with_using_namespaces. (#688)
+ * Ignore PhantomPinned. (#695)
+ * Simplify Pin<T> to T. (#697)
+ * Update --pretty=expanded to -Zunpretty=expanded. (#706)
+
+## 0.19.0
+
+ * Simplify types in generics (#663)
+ * Use --profile=check for macro expansion (#671)
+ * Use exported name to prefix enum variants (#672)
+ * Fix path attribute handling in inline submodules (#679)
+ * Fix a stack overflow with some recursive typedefs (#680)
+
+## 0.18.0
+
+ * Simplify types in nested types such as pointed-to types and function signatures (#661)
+
+## 0.17.0
+
+ * Add with_parse_extra_bindings to builder. (#645)
+ * Support NonZero and fix incorrect simplification of Option<ptr> into ptr. (#647)
+ * Deal with name conflicts correctly in declaration type resolution. (#651)
+ * Support pointers to ZSTs. (#656)
+
+## 0.16.0
+
+ * Remove artificial restriction on lifetime parameters on enums (#604)
+ * Add an option for converting usize/isize into size_t/ptrdiff_t. (#606)
+ * Allow controlling the cargo profile used for expansion. (#607)
+ * Support wider range of expressions in enum discriminants (#614)
+ * Support generation of Cython bindings (#590)
+ * Fixed some issues with style=tag and recursive structs (#615)
+ * Default C style to Both (as specified in docs) (#615)
+ * Fix resolution of path dependencies from certain modules. (#629)
+ * Support inlined definitions for tuple variants with a single field in C (#631)
+
+Thanks to all the awesome contributors that contributed to this release.
+
+## 0.15.0
+
+ * Allow customizing mangling of generic parameters in C (#575)
+ * Box<T> simplifies to T* in C (4ce324c)
+ * ManuallyDrop<T> and MaybeUninit<T> simplify to T in C, and are opaque in C++ (0076a17)
+ * C++ supports a derive-ostream annotation to derive serialization of structs, unions and enums (#582)
+ * Large character constants have been fixed on Windows (#586)
+ * Constants are now generated for typedefs, etc (#589)
+ * The `sort_by` configuration option has been made to work for constants (#587)
+ * Default sort order is source order now (sort_by = "None"), and can be changed by the above option (#587)
+
+## 0.14.6
+
+ * Fixed the builds with older versions of rustc.
+
+## 0.14.5
+
+ * Add support to specify line ending style (#568)
+ * Add cbindgen:ptrs-as-arrays annotation to allow making function
+ arguments C/C++ arrays.
+
+## 0.14.4
+
+ * Allow to override the mangling separator (#502)
+
+ * cbindgen now handles better having ZSTs in template parameters, and
+ default template parameters (#563).
+
+ * Support for annotating nonnull pointers (#558)
+
+ * Fixed bitflags that overflow a signed integer (#556)
+
+ * Support for wildcard argument names (#550)
+
+ * Support for the never return type, with configurable annotation (#549)
+
+ * Properly reject arrays as function arguments (#540)
+
+## 0.14.3
+
+ * Introduce cbindgen:ignore comment annotation, to allow ignoring items or modules. (#519)
+ * Support for casts in constant expressions. (#526)
+ * Make a non-fatal error a warning message. (#535)
+ * Add a --metadata option to the CLI, to allow passing pre-computed cargo metadata. (#538)
+
+## 0.14.2
+
+ * Fixed minimal dependency versions. (#507)
+ * Add an option to write pragma once. (#511)
+ * Fix submodule scanning for implicit Rust 2018 modules. (#512)
+ * Fix dependency parsing / scanning to handle target-specific versions. (#513)
+ * Use heck for case conversion. (#514)
+ * Add support for verbatim content after includes. (#416)
+ * Allow to add attributes to most generated functions. (#515)
+
+## 0.14.1
+
+ * Handle mangling pointers. (#508)
+ * Unconditionally generate a return statement in partialeq implementations. (#509)
+
+## 0.14.0
+
+ * Minor tweak at how [export.exclude] is handled to allow excluding
+ generic instantiations in C mode. (#501)
+ * Documented cpp_compat option. (#496)
+ * Fixed a panic when parsing associated constants for a built-in type. (#494)
+
+## 0.13.2
+
+ * Constants now have suitable documentation. (#471)
+ * Fixed some C warnings by emitting void when there are no arguments. (#470)
+ * Avoids reading cargo.toml when not needed, which can cause panics in workspace situations.
+ * Only write `default` cases if the switch is not exhaustive. (#475)
+ * Some warnings have been refined. (#477)
+ * Code generation for static arrays has been fixed. (#479)
+ * Opt-in support for constexpr in constants. (#481)
+ * Fix C code generation and some warnings when extremely large constants are used. (#490)
+ * Proper escaping of enum variants and fields. (#483)
+ * Added support for RefCell (as an opaque type) and Cell. (#489)
+
+## 0.13.1
+
+ * Support `#[cfg]` on individual enum variants. (#469)
+
+## 0.13.0
+
+ * Support 'swift_name' attributes on generated functions (#449)
+ * Add [export.pre_body] to config (#452)
+ * Handle new line in doc attribute (#454)
+ * Add support for `Self` in tagged enums, structs and unions (#455, #455, #456)
+ * Make sentinel variant respect regular config (#459)
+ * Fix layout of tagged enums with size under some configurations (#463)
+ * Add an option to allow configuring the order of function names in generated headers (#466)
+
+## 0.12.2
+
+ * Fixed version detection with lockfile v2. https://github.com/mozilla/cbindgen/pull/446
+ * Added support for export_name on functions. https://github.com/mozilla/cbindgen/pull/447
+
+## 0.12.1
+
+ * Added support for #[repr*64)] on enums. https://github.com/mozilla/cbindgen/pull/441
+ * Added support to generate plain enums instead of enum classes for C++. https://github.com/mozilla/cbindgen/pull/443
+ * Fixed dependency resolution with lockfile v2. https://github.com/mozilla/cbindgen/pull/438
+
+## 0.12.0
+
+ * Added support for #[repr(align)] and #[repr(packed)] on structs and unions. https://github.com/mozilla/cbindgen/pull/431
+ * Added support to generate copy-assignment operators for enums. https://github.com/mozilla/cbindgen/pull/434
+
+## 0.11.1
+
+ * More binary operators and expressions are supported. https://github.com/mozilla/cbindgen/pull/425
+ * More built-in bitflags operators. https://github.com/mozilla/cbindgen/pull/426
+
+## 0.11.0
+
+ * Made rust char map to uint32_t. https://github.com/mozilla/cbindgen/pull/424
+
+## 0.10.1
+
+ * Improved error message for missing config file. https://github.com/mozilla/cbindgen/pull/422
+ * Add missing header for char32_t. https://github.com/mozilla/cbindgen/pull/414
+
+## 0.10.0
+
+ * Initialize struct literal with list-initializer for C++11 standard. https://github.com/mozilla/cbindgen/pull/401
+ * Surround namespace with __cplusplus ifdef in cpp_compat mode. https://github.com/mozilla/cbindgen/pull/407
+ * Add support for --quiet flag. https://github.com/mozilla/cbindgen/pull/400
+ * Map char to char32_t. https://github.com/mozilla/cbindgen/pull/396
+ * Improve binding_crate_ref() error message. https://github.com/mozilla/cbindgen/pull/395
+ * avoid prematurely returning during expansion. https://github.com/mozilla/cbindgen/pull/389
+ * Add support for adding "using namespace" statements. https://github.com/mozilla/cbindgen/pull/387
+
+## 0.9.1
+
+ * Various improvements to comment output. https://github.com/mozilla/cbindgen/pull/370 / https://github.com/mozilla/cbindgen/pull/375.
+ * Fixed expand when ran from build.rs. https://github.com/mozilla/cbindgen/pull/371
+ * More debugging output for expansion. https://github.com/mozilla/cbindgen/pull/383
+ * New option to add a default private constructor in C++ tagged enums. https://github.com/mozilla/cbindgen/pull/377
+ * Syn and related dependencies updated to 1.0. https://github.com/mozilla/cbindgen/pull/379
+
+## 0.9.0
+
+ * Support to generate C headers with C++ compatibility. https://github.com/mozilla/cbindgen/pull/349
+ * Fix include guard generation when no_includes is set. https://github.com/mozilla/cbindgen/pull/352
+ * Fix crate parsing order so that types from the binding crate are preferred in presence of conflicting names. https://github.com/mozilla/cbindgen/pull/355
+ * Add extra_bindings option to generate bindings for dependencies. https://github.com/mozilla/cbindgen/pull/362
+ * Clap dependency is optional now so it's feasible to avoid building it if cbindgen is used as a library. https://github.com/mozilla/cbindgen/pull/363
+
+## 0.8.7
+
+ * Require C++11 to run the test-suite (#341, test-only)
+ * Improve mangling error message (#340)
+ * Add the ability to automatically derive copy-constructors for tagged enums (#339)
+ * Use placement new for constructing in tagged unions' helper methods (#333)
+
+## 0.8.6
+
+ * Fixed a panic when missing a lock file
+
+## 0.8.5
+
+ * Improved support for Rust 2018 modules
+ * Add possibility to autogenerate tagged union destructors
+
+## 0.8.4
+
+ * Support for package renaming in Cargo.toml
+ * Improved error messages for |cargo metadata| failures
+ * Replaced 'test.py' harness with |cargo test|
+ * Char constants will now be escaped properly
+ * Visibility of constants will now be respected
+ * Added a C99 doc comment style
+
+## 0.8.2
+
+ * Improvements to bitflags parsing
+
+## 0.8.1
+
+ * Support for manual parsing and expanding of bitflags macros
+ * Support for optional tagged enum casts with asserts
+
+## 0.8.0
+
+ * support for 'includes' without default includes
+ * removed dependency on ancient serde_derive!
+
+## 0.7.1
+
+ * Fix for crash when unwrapping unsupported type with associated constants
+
+## 0.7.0
+
+ * support for libc::ssize_t
+ * fixed some warnings on nightly
+ * fix for transparent associated constants
+ * switched more API's to use AsRef<Path>
+ * impl std::error::Error for cbindgen::Error
+ * now support putting user-defined content in item bodies
+
+## 0.6.8
+
+ * ptrdiff_t is now a recognized primitive type
+ * named function type arguments are now propagated
+ * fixes for struct literals in constants
+ * reserved C/C++ keywords are now escaped automatically
+ * negative enum discriminants are now supported
+ * fix for prefixing and formatting variant names
+ * fix for snake_case formatter
+ * syn update
+ * doxygen style comments are now output by default
+ * VaList is now a recognized primitive type
+ * fix for comment processing
+ * constant is propagated into array types
+ * references are now supported in IR, and used for some helper method generation
+ * assignment helper functions will generate array copies if necessary
diff --git a/cbindgen-0.27.0/Cargo.lock b/cbindgen-0.27.0/Cargo.lock
new file mode 100644
index 0000000..e95120c
--- /dev/null
+++ b/cbindgen-0.27.0/Cargo.lock
@@ -0,0 +1,571 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "anstream"
+version = "0.6.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
+dependencies = [
+ "anstyle",
+ "anstyle-parse",
+ "anstyle-query",
+ "anstyle-wincon",
+ "colorchoice",
+ "is_terminal_polyfill",
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle"
+version = "1.0.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
+
+[[package]]
+name = "anstyle-parse"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
+dependencies = [
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle-query"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
+dependencies = [
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "anstyle-wincon"
+version = "3.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
+dependencies = [
+ "anstyle",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "autocfg"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
+
+[[package]]
+name = "bitflags"
+version = "2.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
+
+[[package]]
+name = "cbindgen"
+version = "0.27.0"
+dependencies = [
+ "clap",
+ "heck",
+ "indexmap",
+ "log",
+ "pretty_assertions",
+ "proc-macro2",
+ "quote",
+ "serde",
+ "serde_json",
+ "serial_test",
+ "syn",
+ "tempfile",
+ "toml",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "clap"
+version = "4.5.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11d8838454fda655dafd3accb2b6e2bea645b9e4078abe84a22ceb947235c5cc"
+dependencies = [
+ "clap_builder",
+]
+
+[[package]]
+name = "clap_builder"
+version = "4.5.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6"
+dependencies = [
+ "anstream",
+ "anstyle",
+ "clap_lex",
+ "strsim",
+]
+
+[[package]]
+name = "clap_lex"
+version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
+
+[[package]]
+name = "colorchoice"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
+
+[[package]]
+name = "dashmap"
+version = "5.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
+dependencies = [
+ "cfg-if",
+ "hashbrown",
+ "lock_api",
+ "once_cell",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "diff"
+version = "0.1.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
+
+[[package]]
+name = "equivalent"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
+
+[[package]]
+name = "errno"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
+dependencies = [
+ "libc",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "fastrand"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
+
+[[package]]
+name = "hashbrown"
+version = "0.14.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
+
+[[package]]
+name = "heck"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
+
+[[package]]
+name = "indexmap"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0"
+dependencies = [
+ "equivalent",
+ "hashbrown",
+]
+
+[[package]]
+name = "is_terminal_polyfill"
+version = "1.70.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
+
+[[package]]
+name = "itoa"
+version = "1.0.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
+
+[[package]]
+name = "lazy_static"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
+
+[[package]]
+name = "libc"
+version = "0.2.155"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.4.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
+
+[[package]]
+name = "lock_api"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
+dependencies = [
+ "autocfg",
+ "scopeguard",
+]
+
+[[package]]
+name = "log"
+version = "0.4.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
+
+[[package]]
+name = "memchr"
+version = "2.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
+
+[[package]]
+name = "once_cell"
+version = "1.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
+
+[[package]]
+name = "parking_lot"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.9.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "smallvec",
+ "windows-targets",
+]
+
+[[package]]
+name = "pretty_assertions"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66"
+dependencies = [
+ "diff",
+ "yansi",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.86"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.36"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "rustix"
+version = "0.38.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
+dependencies = [
+ "bitflags",
+ "errno",
+ "libc",
+ "linux-raw-sys",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "ryu"
+version = "1.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
+
+[[package]]
+name = "scopeguard"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+
+[[package]]
+name = "serde"
+version = "1.0.205"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.205"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.122"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da"
+dependencies = [
+ "itoa",
+ "memchr",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "serde_spanned"
+version = "0.6.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "serial_test"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0e56dd856803e253c8f298af3f4d7eb0ae5e23a737252cd90bb4f3b435033b2d"
+dependencies = [
+ "dashmap",
+ "lazy_static",
+ "parking_lot",
+ "serial_test_derive",
+]
+
+[[package]]
+name = "serial_test_derive"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "smallvec"
+version = "1.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
+
+[[package]]
+name = "strsim"
+version = "0.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
+
+[[package]]
+name = "syn"
+version = "2.0.72"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "tempfile"
+version = "3.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64"
+dependencies = [
+ "cfg-if",
+ "fastrand",
+ "once_cell",
+ "rustix",
+ "windows-sys 0.59.0",
+]
+
+[[package]]
+name = "toml"
+version = "0.8.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
+dependencies = [
+ "serde",
+ "serde_spanned",
+ "toml_datetime",
+ "toml_edit",
+]
+
+[[package]]
+name = "toml_datetime"
+version = "0.6.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.22.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d"
+dependencies = [
+ "indexmap",
+ "serde",
+ "serde_spanned",
+ "toml_datetime",
+ "winnow",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
+
+[[package]]
+name = "utf8parse"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
+
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
+[[package]]
+name = "winnow"
+version = "0.6.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "yansi"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
diff --git a/cbindgen-0.27.0/Cargo.toml b/cbindgen-0.27.0/Cargo.toml
new file mode 100644
index 0000000..6acfc5b
--- /dev/null
+++ b/cbindgen-0.27.0/Cargo.toml
@@ -0,0 +1,114 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies.
+#
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
+
+[package]
+edition = "2018"
+rust-version = "1.74"
+name = "cbindgen"
+version = "0.27.0"
+authors = [
+ "Emilio Cobos Álvarez <emilio@crisal.io>",
+ "Jeff Muizelaar <jmuizelaar@mozilla.com>",
+ "Kartikaya Gupta <kats@mozilla.com>",
+ "Ryan Hunt <rhunt@eqrion.net>",
+]
+build = "build.rs"
+exclude = ["tests/profile.rs"]
+autobins = false
+autoexamples = false
+autotests = false
+autobenches = false
+description = "A tool for generating C bindings to Rust code."
+readme = "README.md"
+keywords = [
+ "bindings",
+ "ffi",
+ "code-generation",
+]
+categories = [
+ "external-ffi-bindings",
+ "development-tools::ffi",
+]
+license = "MPL-2.0"
+repository = "https://github.com/mozilla/cbindgen"
+
+[lib]
+name = "cbindgen"
+path = "src/lib.rs"
+
+[[bin]]
+name = "cbindgen"
+path = "src/main.rs"
+doc = false
+required-features = ["clap"]
+
+[[test]]
+name = "depfile"
+path = "tests/depfile.rs"
+
+[[test]]
+name = "tests"
+path = "tests/tests.rs"
+
+[dependencies.clap]
+version = "4.3"
+optional = true
+
+[dependencies.heck]
+version = "0.4"
+
+[dependencies.indexmap]
+version = "2.1.0"
+
+[dependencies.log]
+version = "0.4"
+
+[dependencies.proc-macro2]
+version = "1.0.60"
+
+[dependencies.quote]
+version = "1"
+
+[dependencies.serde]
+version = "1.0.103"
+features = ["derive"]
+default-features = false
+
+[dependencies.serde_json]
+version = "1.0"
+
+[dependencies.syn]
+version = "2.0.64"
+features = [
+ "clone-impls",
+ "extra-traits",
+ "fold",
+ "full",
+ "parsing",
+ "printing",
+]
+default-features = false
+
+[dependencies.tempfile]
+version = "3"
+
+[dependencies.toml]
+version = "0.8.8"
+
+[dev-dependencies.pretty_assertions]
+version = "1.4.0"
+
+[dev-dependencies.serial_test]
+version = "2.0.0"
+default-features = false
+
+[features]
+default = ["clap"]
diff --git a/cbindgen-0.27.0/Cargo.toml.orig b/cbindgen-0.27.0/Cargo.toml.orig
new file mode 100644
index 0000000..7638e87
--- /dev/null
+++ b/cbindgen-0.27.0/Cargo.toml.orig
@@ -0,0 +1,86 @@
+[package]
+name = "cbindgen"
+version = "0.27.0"
+authors = [
+ "Emilio Cobos Álvarez <emilio@crisal.io>",
+ "Jeff Muizelaar <jmuizelaar@mozilla.com>",
+ "Kartikaya Gupta <kats@mozilla.com>",
+ "Ryan Hunt <rhunt@eqrion.net>"
+]
+license = "MPL-2.0"
+description = "A tool for generating C bindings to Rust code."
+keywords = ["bindings", "ffi", "code-generation"]
+categories = ["external-ffi-bindings", "development-tools::ffi"]
+repository = "https://github.com/mozilla/cbindgen"
+edition = "2018"
+rust-version = "1.74"
+exclude = [
+ "tests/profile.rs", # Test relies in a sub-crate, see https://github.com/rust-lang/cargo/issues/9017
+]
+
+[dependencies]
+clap = { version = "4.3", optional = true }
+indexmap = "2.1.0"
+log = "0.4"
+serde = { version = "1.0.103", default-features = false, features = ["derive"] }
+serde_json = "1.0"
+tempfile = "3"
+toml = "0.8.8"
+proc-macro2 = "1.0.60"
+quote = "1"
+heck = "0.4"
+
+[dependencies.syn]
+version = "2.0.64"
+default-features = false
+features = ["clone-impls", "extra-traits", "fold", "full", "parsing", "printing"]
+
+[dev-dependencies]
+serial_test = { version = "2.0.0", default-features = false }
+pretty_assertions = "1.4.0"
+
+[features]
+default = ["clap"]
+
+[[bin]]
+name = "cbindgen"
+path = "src/main.rs"
+doc = false
+required-features = ["clap"]
+
+[lib]
+name = "cbindgen"
+path = "src/lib.rs"
+
+[workspace]
+exclude = [
+ "tests/depfile/single_crate_config",
+ "tests/depfile/single_crate_default_config",
+ "tests/depfile/single_crate",
+ "tests/rust/bitfield",
+ "tests/rust/dep_v2",
+ "tests/rust/dep_v2/dep",
+ "tests/rust/derive_eq",
+ "tests/rust/expand_default_features",
+ "tests/rust/expand_dep_v2",
+ "tests/rust/expand_dep_v2/dep_v2",
+ "tests/rust/expand_dep_v2/dep",
+ "tests/rust/expand_dep",
+ "tests/rust/expand_dep/dep",
+ "tests/rust/expand_features",
+ "tests/rust/expand_no_default_features",
+ "tests/rust/expand",
+ "tests/rust/external_workspace_child",
+ "tests/rust/literal_target",
+ "tests/rust/mod_2015",
+ "tests/rust/mod_2018",
+ "tests/rust/mod_attr",
+ "tests/rust/mod_path",
+ "tests/rust/package_version",
+ "tests/rust/rename_crate",
+ "tests/rust/rename_crate/dependency",
+ "tests/rust/rename_crate/no_extern",
+ "tests/rust/rename_crate/old_dep",
+ "tests/rust/workspace",
+ "tests/rust/workspace/dep",
+]
diff --git a/cbindgen-0.24.5/LICENSE b/cbindgen-0.27.0/LICENSE
similarity index 100%
rename from cbindgen-0.24.5/LICENSE
rename to cbindgen-0.27.0/LICENSE
diff --git a/cbindgen-0.27.0/README.md b/cbindgen-0.27.0/README.md
new file mode 100644
index 0000000..9c6ed24
--- /dev/null
+++ b/cbindgen-0.27.0/README.md
@@ -0,0 +1,98 @@
+# `cbindgen`   [![Build Status]][actions] [![Latest Version]][crates.io] [![Api Rustdoc]][rustdoc] [](https://github.com/mozilla/cbindgen)
+
+[Build Status]: https://github.com/mozilla/cbindgen/workflows/cbindgen/badge.svg
+[actions]: https://github.com/mozilla/cbindgen/actions
+[Latest Version]: https://img.shields.io/crates/v/cbindgen.svg
+[crates.io]: https://crates.io/crates/cbindgen
+[Api Rustdoc]: https://img.shields.io/badge/api-rustdoc-blue.svg
+[rustdoc]: https://docs.rs/cbindgen
+
+[Read the full user docs here!](https://github.com/mozilla/cbindgen/blob/master/docs.md)
+
+cbindgen creates C/C++11 headers for Rust libraries which expose a public C API.
+
+While you could do this by hand, it's not a particularly good use of your time.
+It's also much more likely to be error-prone than machine-generated headers that
+are based on your actual Rust code. The cbindgen developers have also worked
+closely with the developers of Rust to ensure that the headers we generate
+reflect actual guarantees about Rust's type layout and ABI.
+
+C++ headers are nice because we can use operator overloads, constructors, enum
+classes, and templates to make the API more ergonomic and Rust-like. C headers
+are nice because you can be more confident that whoever you're interoperating
+with can handle them. With cbindgen *you don't need to choose*! You can just
+tell it to emit both from the same Rust library.
+
+There are two ways to use cbindgen: as a standalone program, or as a library
+(presumably in your build.rs). There isn't really much practical difference,
+because cbindgen is a simple rust library with no interesting dependencies.
+
+Using it as a program means people building your software will need it
+installed. Using it in your library means people may have to build cbindgen more
+frequently (e.g. every time they update their rust compiler).
+
+It's worth noting that the development of cbindgen has been largely adhoc, as
+features have been added to support the usecases of the maintainers. This means
+cbindgen may randomly fail to support some particular situation simply because
+no one has put in the effort to handle it yet. [Please file an issue if you run
+into such a situation](https://github.com/mozilla/cbindgen/issues/new). Although
+since we all have other jobs, you might need to do the implementation work too
+:)
+
+# Quick Start
+
+To install cbindgen, you just need to run
+
+```text
+cargo install --force cbindgen
+```
+
+(--force just makes it update to the latest cbindgen if it's already installed)
+
+Or with Homebrew, run
+
+```text
+brew install cbindgen
+```
+
+To use cbindgen you need two things:
+
+* A configuration (cbindgen.toml, which can be empty to start)
+* A Rust crate with a public C API
+
+Then all you need to do is run it:
+
+```text
+cbindgen --config cbindgen.toml --crate my_rust_library --output my_header.h
+```
+
+This produces a header file for C++. For C, add the `--lang c` switch.
+
+See `cbindgen --help` for more options.
+
+[Read the full user docs here!](docs.md)
+
+[Get a template cbindgen.toml here.](template.toml)
+
+# Examples
+
+We don't currently have a nice tailored example application, but [the
+tests](tests/rust/) contain plenty of interesting examples of our features.
+
+You may also find it interesting to browse the projects that are using cbindgen
+in production:
+
+* [milksnake](https://github.com/getsentry/milksnake)
+* [webrender](https://searchfox.org/mozilla-central/source/gfx/webrender_bindings) ([generated header](https://searchfox.org/mozilla-central/source/__GENERATED__/gfx/webrender_bindings/webrender_ffi_generated.h))
+* [stylo](https://searchfox.org/mozilla-central/source/layout/style) ([generated header](https://searchfox.org/mozilla-central/source/__GENERATED__/layout/style/ServoStyleConsts.h))
+* [maturin](https://github.com/PyO3/maturin)
+* [tquic](https://github.com/Tencent/tquic) ([generated header](https://github.com/Tencent/tquic/blob/develop/include/tquic.h))
+
+If you're using `cbindgen` and would like to be added to this list, please open
+a pull request!
+
+# Releases
+
+cbindgen doesn't have a fixed release calendar, please file an issue requesting
+a release if there's something fixed in trunk that you need released. Ping
+`@emilio` for increased effect.
diff --git a/cbindgen-0.27.0/build.rs b/cbindgen-0.27.0/build.rs
new file mode 100644
index 0000000..8390b5f
--- /dev/null
+++ b/cbindgen-0.27.0/build.rs
@@ -0,0 +1,97 @@
+fn generate_tests() {
+ use std::env;
+ use std::ffi::OsStr;
+ use std::fs::{self, File};
+ use std::io::Write;
+ use std::path::{Path, PathBuf};
+
+ let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
+ let mut dst = File::create(Path::new(&out_dir).join("tests.rs")).unwrap();
+
+ let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
+ let tests_dir = manifest_dir.join("tests").join("rust");
+ let tests = fs::read_dir(&tests_dir).unwrap();
+
+ let entries = tests.map(|t| t.expect("Couldn't read test file"));
+
+ println!("cargo:rerun-if-changed={}", tests_dir.display());
+
+ for entry in entries {
+ let path_segment = if entry.file_type().unwrap().is_file() {
+ match entry.path().extension().and_then(OsStr::to_str) {
+ Some("rs") => {}
+ _ => continue,
+ };
+
+ entry
+ .path()
+ .file_stem()
+ .unwrap()
+ .to_str()
+ .unwrap()
+ .to_owned()
+ } else {
+ entry.file_name().to_str().unwrap().to_owned()
+ };
+
+ let identifier = path_segment
+ .replace(|c| !char::is_alphanumeric(c), "_")
+ .replace("__", "_");
+
+ writeln!(
+ dst,
+ "test_file!(test_{}, {:?}, {:?});",
+ identifier,
+ path_segment,
+ entry.path(),
+ )
+ .unwrap();
+ }
+
+ dst.flush().unwrap();
+}
+
+fn generate_depfile_tests() {
+ use std::env;
+ use std::fs::{self, File};
+ use std::io::Write;
+ use std::path::{Path, PathBuf};
+
+ let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
+ let mut dst = File::create(Path::new(&out_dir).join("depfile_tests.rs")).unwrap();
+
+ let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
+ let tests_dir = manifest_dir.join("tests").join("depfile");
+ let tests = fs::read_dir(&tests_dir).unwrap();
+
+ let entries = tests.map(|t| t.expect("Couldn't read test file"));
+
+ println!("cargo:rerun-if-changed={}", tests_dir.display());
+
+ for entry in entries {
+ if entry.file_type().unwrap().is_file() {
+ continue;
+ };
+ let path_segment = entry.file_name().to_str().unwrap().to_owned();
+
+ let identifier = path_segment
+ .replace(|c| !char::is_alphanumeric(c), "_")
+ .replace("__", "_");
+
+ writeln!(
+ dst,
+ "test_file!(test_depfile_{}, {:?}, {:?});",
+ identifier,
+ path_segment,
+ entry.path(),
+ )
+ .unwrap();
+ }
+
+ dst.flush().unwrap();
+}
+
+fn main() {
+ generate_tests();
+ generate_depfile_tests();
+}
diff --git a/cbindgen-0.27.0/contributing.md b/cbindgen-0.27.0/contributing.md
new file mode 100644
index 0000000..b754ec6
--- /dev/null
+++ b/cbindgen-0.27.0/contributing.md
@@ -0,0 +1,25 @@
+# Contributing
+
+Thanks for wanting to contribute!
+
+If you want help or mentorship, please file a GitHub issue and I'll be sure to provide guidance to the best of my ability.
+
+Otherwise be sure to check out `internals.md` for an overview on the internals.
+
+## Filing a pull request
+
+Check out [Servo's GitHub workflow](https://github.com/servo/servo/wiki/Github-workflow) for an overview on creating a pull request.
+
+Don't worry about requesting code review, as there is nothing formally setup for this repository. I try and review each pull request as soon as I can.
+
+There is continuous integration setup for `cbindgen` using [GitHub Actions](https://github.com/mozilla/cbindgen/actions). It automatically runs `cargo test` which runs `cbindgen` against a series of Rust files from `tests/rust/` and checks that the output compiles using `gcc` or `g++`.
+
+In addition to a C/C++ compiler `cargo test` requires Python and Cython
+(`python -m pip install Cython`) for checking Cython bindings generated from tests (`.pyx` files).
+Note that the tests will be failed with Cython 3.x or later.
+
+Please run `cargo test` before filing a pull request to be sure that all tests pass. This will also update the test expectations.
+
+Rustfmt is also enforced by GitHub Actions. To format your code install `rustfmt-preview` using `rustup component add rustfmt-preview` and then `cargo fmt`. GitHub Actions runs with Rust nightly, so use `rustup run nightly -- cargo fmt` to guarantee consistent results.
+
+Writing new tests with your pull requests is also appreciated.
diff --git a/cbindgen-0.27.0/docs.md b/cbindgen-0.27.0/docs.md
new file mode 100644
index 0000000..c8ce9f4
--- /dev/null
+++ b/cbindgen-0.27.0/docs.md
@@ -0,0 +1,1129 @@
+# cbindgen User Guide
+
+cbindgen creates C/C++11 headers for Rust libraries which expose a public C API.
+
+While you could do this by hand, it's not a particularly good use of your time. It's also much more likely to be error-prone than machine-generated headers that are based on your actual Rust code. The cbindgen developers have also worked closely with the developers of Rust to ensure that the headers we generate reflect actual guarantees about Rust's type layout and ABI.
+
+C++ headers are nice because we can use operator overloads, constructors, enum classes, and templates to make the API more ergonomic and Rust-like. C headers are nice because you can be more confident that whoever you're interoperating with can handle them. With cbindgen *you don't need to choose*! You can just tell it to emit both from the same Rust library.
+
+There are two ways to use cbindgen: as a standalone program, or as a library (presumably in your build.rs).
+There isn't really much practical difference, because cbindgen is a simple rust library with no interesting dependencies. Using it as a program means people building your software will need it installed. Using it in your library means people may have to build cbindgen more frequently (e.g. every time they update their rust compiler).
+
+It's worth noting that the development of cbindgen has been largely adhoc, as features have been added to support the usecases of the maintainers. This means cbindgen may randomly fail to support some particular situation simply because no one has put in the effort to handle it yet. [Please file an issue if you run into such a situation][file-it]. Although since we all have other jobs, you might need to do the implementation work too :)
+
+
+
+
+
+# Quick Start
+
+To install cbindgen, you just need to run
+
+```text
+cargo install --force cbindgen
+```
+
+(--force just makes it update to the latest cbindgen if it's already installed)
+
+To use cbindgen you need two things:
+
+* A configuration (cbindgen.toml, which can be empty to start)
+* A Rust crate with a public C API
+
+Then all you need to do is run it:
+
+```text
+cbindgen --config cbindgen.toml --crate my_rust_library --output my_header.h
+```
+
+This produces a header file for C++. For C, add the `--lang c` switch. \
+`cbindgen` also supports generation of [Cython](https://cython.org) bindings,
+use `--lang cython` for that.
+
+See `cbindgen --help` for more options.
+
+[Get a template cbindgen.toml here.](template.toml)
+
+
+
+## build.rs
+
+If you don't want to use cbindgen as an application, here's an example build.rs script:
+
+```rust
+extern crate cbindgen;
+
+use std::env;
+
+fn main() {
+ let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
+
+ cbindgen::Builder::new()
+ .with_crate(crate_dir)
+ .generate()
+ .expect("Unable to generate bindings")
+ .write_to_file("bindings.h");
+}
+```
+
+You can add configuration options using the [`Builder`](https://docs.rs/cbindgen/*/cbindgen/struct.Builder.html#methods) interface.
+
+When actively working on code, you likely don't want cbindgen to fail the entire build. Instead of expect-ing the result of the header generation, you could [ignore parse errors](https://github.com/mozilla/cbindgen/issues/472#issuecomment-831439826) and let rustc or your code analysis bring up:
+
+```rust
+ // ...
+ .generate()
+ .map_or_else(
+ |error| match error {
+ cbindgen::Error::ParseSyntaxError { .. } => {}
+ e => panic!("{:?}", e),
+ },
+ |bindings| {
+ bindings.write_to_file("target/include/bindings.h");
+ },
+ );
+}
+```
+
+Be sure to add the following section to your Cargo.toml:
+
+```
+[build-dependencies]
+cbindgen = "0.24.0"
+```
+
+If you'd like to use a `build.rs` script with a `cbindgen.toml`, consider using [`cbindgen::generate()`](https://docs.rs/cbindgen/*/cbindgen/fn.generate.html) instead.
+
+
+
+
+
+# Writing Your C API
+
+cbindgen has a simple but effective strategy. It walks through your crate looking for:
+
+* `#[no_mangle] pub extern fn` ("functions")
+* `#[no_mangle] pub static` ("globals")
+* `pub const` ("constants")
+
+and generates a header declaring those items. But to declare those items, it needs to also be able to describe the layout and ABI of the types that appear in their signatures. So it will also spider through your crate (and optionally its dependencies) to try to find the definitions of every type used in your public API.
+
+> 🚨 NOTE: A major limitation of cbindgen is that it does not understand Rust's module system or namespacing. This means that if cbindgen sees that it needs the definition for `MyType` and there exists two things in your project with the type name `MyType`, it won't know what to do. Currently, cbindgen's behaviour is unspecified if this happens. However this may be ok if they have [different cfgs][section-cfgs].
+
+If a type is determined to have a guaranteed layout, a full definition will be emitted in the header. If the type doesn't have a guaranteed layout, only a forward declaration will be emitted. This may be fine if the type is intended to be passed around opaquely and by reference.
+
+
+
+
+# Examples
+
+🚧 🏗
+
+It would be really nice to have some curated and clean examples, but we don't have those yet.
+
+[The README has some useful links though](README.md#examples).
+
+
+
+# Supported Types
+
+Most things in Rust don't have a guaranteed layout by default. In most cases this is nice because it enables layout to be optimized in the majority of cases where type layout isn't that interesting. However this is problematic for our purposes. Thankfully Rust lets us opt into guaranteed layouts with the `repr` attribute.
+
+You can learn about all of the different repr attributes [by reading Rust's reference][reference], but here's a quick summary:
+
+* `#[repr(C)]`: give this struct/union/enum the same layout and ABI C would
+* `#[repr(u8, u16, ... etc)]`: give this enum the same layout and ABI as the given integer type
+* `#[repr(transparent)]`: give this single-field struct the same ABI as its field (useful for newtyping integers but keeping the integer ABI)
+
+cbindgen supports the `#[repr(align(N))]` and `#[repr(packed)]` attributes, but currently does not support `#[repr(packed(N))]`.
+
+cbindgen also supports using `repr(C)`/`repr(u8)` on non-C-like enums (enums with fields). This gives a C-compatible tagged union layout, as [defined by this RFC 2195][really-tagged-unions]. `repr(C)` will give a simpler layout that is perhaps more intuitive, while `repr(u8)` will produce a more compact layout.
+
+If you ensure everything has a guaranteed repr, then cbindgen will generate definitions for:
+
+* struct (named-style or tuple-style)
+* enum (fieldless or with fields)
+* union
+* type
+* `[T; n]` (arrays always have a guaranteed C-compatible layout)
+* `&T`, `&mut T`, `*const T`, `*mut T`, `Option<&T>`, `Option<&mut T>` (all have the same pointer ABI)
+* `fn()` (as an actual function pointer)
+* `bitflags! { ... }` (if macro_expansion.bitflags is enabled)
+
+structs, enums, unions, and type aliases may be generic, although certain generic substitutions may fail to resolve under certain configurations. In C mode generics are resolved through monomorphization and mangling, while in C++ mode generics are resolved with templates. cbindgen cannot support generic functions, as they do not actually have a single defined symbol.
+
+cbindgen sadly cannot ever support anonymous tuples `(A, B, ...)`, as there is no way to guarantee their layout. You must use a tuple struct.
+
+cbindgen also cannot support wide pointers like `&dyn Trait` or `&[T]`, as their layout and ABI is not guaranteed. In the case of slices you can at least decompose them into a pointer and length, and reconstruct them with `slice::from_raw_parts`.
+
+If cbindgen determines that a type is zero-sized, it will erase all references to that type (so fields of that type simply won't be emitted). This won't work if that type appears as a function argument because C, C++, and Rust all have different definitions of what it means for a type to be empty.
+
+Don't use the `[u64; 0]` trick to over-align a struct, we don't support this.
+
+cbindgen contains the following hardcoded mappings (again completely ignoring namespacing, literally just looking at the name of the type):
+
+
+
+
+## std types
+
+* bool => bool
+* char => uint32_t
+* u8 => uint8_t
+* u16 => uint16_t
+* u32 => uint32_t
+* u64 => uint64_t
+* usize => uintptr_t
+* i8 => int8_t
+* i16 => int16_t
+* i32 => int32_t
+* i64 => int64_t
+* isize => intptr_t
+* f32 => float
+* f64 => double
+* VaList => va_list
+* RawFd => int
+* PhantomData => *evaporates*, can only appear as the field of a type
+* PhantomPinned => *evaporates*, can only appear as the field of a type
+* () => *evaporates*, can only appear as the field of a type
+* MaybeUninit<T>, ManuallyDrop<T>, and Pin<T> => T
+
+
+
+
+## libc types
+
+* c_void => void
+* c_char => char
+* c_schar => signed char
+* c_uchar => unsigned char
+* c_float => float
+* c_double => double
+* c_short => short
+* c_int => int
+* c_long => long
+* c_longlong => long long
+* c_ushort => unsigned short
+* c_uint => unsigned int
+* c_ulong => unsigned long
+* c_ulonglong => unsigned long long
+
+
+
+## stdint types
+
+* uint8_t => uint8_t
+* uint16_t => uint16_t
+* uint32_t => uint32_t
+* uint64_t => uint64_t
+* uintptr_t => uintptr_t
+* size_t => size_t
+* int8_t => int8_t
+* int16_t => int16_t
+* int32_t => int32_t
+* int64_t => int64_t
+* intptr_t => intptr_t
+* ssize_t => ssize_t
+* ptrdiff_t => ptrdiff_t
+
+
+
+
+
+
+# Configuring Your Header
+
+cbindgen supports several different options for configuring the output of your header, including target language, styling, mangling, prefixing, includes, and defines.
+
+
+
+
+
+## Defines and Cfgs
+
+As cbindgen spiders through your crate, it will make note of all the cfgs it found on the path to every item. If it finds multiple declarations that share a single name but have different cfgs, it will then try to emit every version it found wrapped in defines that correspond to those cfgs. In this way platform-specific APIs or representations can be properly supported.
+
+However cbindgen has no way of knowing how you want to map those cfgs to defines. You will need to use the `[defines]` section in your cbindgen.toml to specify all the different mappings. It natively understands concepts like any() and all(), so you only need to tell it how you want to translate base concepts like `target_os = "freebsd"` or `feature = "serde"`.
+
+Note that because cbindgen just parses the source of your crate, you mostly don't need to worry about what crate features or what platform you're targetting. Every possible configuration should be visible to the parser. Our primitive mappings should also be completely platform agnostic (i32 is int32_t regardless of your target).
+
+While modules within a crate form a tree with uniquely defined paths to each item, and therefore uniquely defined cfgs for those items, dependencies do not. If you depend on a crate in multiple ways, and those ways produce different cfgs, one of them will be arbitrarily chosen for any types found in that crate.
+
+
+
+
+## Annotations
+
+While output configuration is primarily done through the cbindgen.toml, in some cases you need to manually override your global settings. In those cases you can add inline annotations to your types, which are doc comments that start with `cbindgen:`. Here's an example of using annotations to rename a struct's fields and opt into overloading `operator==`:
+
+```rust
+/// cbindgen:field-names=[x, y]
+/// cbindgen:derive-eq
+#[repr(C)]
+pub struct Point(pub f32, pub f32);
+```
+
+An annotation may be a bool, string (no quotes), or list of strings. If just the annotation's name is provided, `=true` is assumed. The annotation parser is currently fairly naive and lacks any capacity for escaping, so don't try to make any strings with `=`, `,`, `[` or `]`.
+
+Most annotations are just local overrides for identical settings in the cbindgen.toml, but a few are unique because they don't make sense in a global context. The set of supported annotation are as follows:
+
+### Ignore annotation
+
+cbindgen will automatically ignore any `#[test]` or `#[cfg(test)]` item it
+finds. You can manually ignore other stuff with the `ignore` annotation
+attribute:
+
+```rust
+pub mod my_interesting_mod;
+
+/// cbindgen:ignore
+pub mod my_uninteresting_mod; // This won't be scanned by cbindgen.
+```
+
+### No export annotation
+
+cbindgen will usually emit all items it finds, as instructed by the parse and export config sections. This annotation will make cbindgen skip this item from the output, while still being aware of it. This is useful for a) suppressing "Can't find" errors and b) emitting `struct my_struct` for types in a different header (rather than a bare `my_struct`).
+
+There is no equivalent config for this annotation - by comparison, the export exclude config will cause cbindgen to not be aware of the item at all.
+
+Note that cbindgen will still traverse `no-export` structs that are `repr(C)` to emit types present in the fields. You will need to manually exclude those types in your config if desired.
+
+```
+/// cbindgen:no-export
+#[repr(C)]
+pub struct Foo { .. }; // This won't be emitted by cbindgen in the header
+
+#[repr(C)]
+fn bar() -> Foo { .. } // Will be emitted as `struct foo bar();`
+```
+
+### Struct Annotations
+
+* field-names=\[field1, field2, ...\] -- sets the names of all the fields in the output struct. These names will be output verbatim, and are not eligible for renaming.
+
+The rest are just local overrides for the same options found in the cbindgen.toml:
+
+* rename-all=RenameRule
+* derive-constructor
+* derive-eq
+* derive-neq
+* derive-lt
+* derive-lte
+* derive-gt
+* derive-gte
+* {eq,neq,lt,lte,gt,gte}-attributes: Takes a single identifier which will be
+ emitted before the signature of the auto-generated `operator==` / `operator!=`
+ / etc(if any). The idea is for this to be used to annotate the operator with
+ attributes, for example:
+
+```rust
+/// cbindgen:eq-attributes=MY_ATTRIBUTES
+#[repr(C)]
+pub struct Foo { .. }
+```
+
+Will generate something like:
+
+```
+ MY_ATTRIBUTES bool operator==(const Foo& other) const {
+ ...
+ }
+```
+
+Combined with something like:
+
+```
+#define MY_ATTRIBUTES [[nodiscard]]
+```
+
+for example.
+
+### Enum Annotations
+
+* enum-trailing-values=\[variant1, variant2, ...\] -- add the following fieldless enum variants to the end of the enum's definition. These variant names *will* have the enum's renaming rules applied.
+
+WARNING: if any of these values are ever passed into Rust, behaviour will be Undefined. Rust does not know about them, and will assume they cannot happen.
+
+The rest are just local overrides for the same options found in the cbindgen.toml:
+
+* rename-all=RenameRule
+* add-sentinel
+* derive-helper-methods
+* derive-const-casts
+* derive-mut-casts
+* derive-tagged-enum-destructor
+* derive-tagged-enum-copy-constructor
+* enum-class
+* prefix-with-name
+* private-default-tagged-enum-constructor
+* {destructor,copy-constructor,copy-assignment}-attributes: See the description
+ of the struct attributes, these do the same for the respective generated code.
+
+### Enum variant annotations
+
+These apply to both tagged and untagged enum _variants_.
+
+* variant-{constructor,const-cast,mut-cast,is}-attributes: See the description
+ of the struct attributes. These do the same for the respective functions.
+
+TODO: We should allow to override the `derive-{const,mut}-casts`, helper methods
+et al. with per-variant annotations, probably.
+
+### Union Annotations
+
+* field-names=\[field1, field2, ...\] -- sets the names of all the fields in the output union. These names will be output verbatim, and are not eligible for renaming.
+
+The rest are just local overrides for the same options found in the cbindgen.toml:
+
+* rename-all=RenameRule
+
+
+
+### Function Annotations
+
+All function attributes are just local overrides for the same options found in the cbindgen.toml:
+
+* rename-all=RenameRule
+* prefix
+* postfix
+* ptrs-as-arrays=\[[ptr\_name1; array\_length1], [ptr\_name2; array\_length2], ...\] -- represents the pointer arguments of a function as arrays. Below how the mappings are performed:
+
+```
+arg: *const T --> const T arg[array_length]
+arg: *mut T ---> T arg[array_length]
+```
+
+If `array_length` is not specified:
+
+```
+arg: *const T --> const T arg[]
+arg: *mut T --> T arg[]
+```
+
+## Generating Swift Bindings
+
+In addition to parsing function names in C/C++ header files, the Swift compiler can make use of the `swift_name` attribute on functions to generate more idiomatic names for imported functions and methods.
+
+This attribute is commonly used in Objective-C/C/C++ via the `NS_SWIFT_NAME` and `CF_SWIFT_NAME` macros.
+
+Given configuration in the cbindgen.toml, `cbindgen` can generate these attributes for you by guessing an appropriate method signature based on the existing function name (and type, if it is a method in an `impl` block).
+
+This is controlled by the `swift_name_macro` option in the cbindgen.toml.
+
+## cbindgen.toml
+
+Most configuration happens through your cbindgen.toml file. Every value has a default (that is usually reasonable), so you can start with an empty cbindgen.toml and tweak it until you like the output you're getting.
+
+Note that many options defined here only apply for one of C or C++. Usually it's an option specifying whether we should try to make use of a feature in C++'s type system or generate a helper method.
+
+```toml
+# The language to output bindings in
+#
+# possible values: "C", "C++", "Cython"
+#
+# default: "C++"
+language = "C"
+
+
+
+
+# Options for wrapping the contents of the header:
+
+# An optional string of text to output at the beginning of the generated file
+# default: doesn't emit anything
+header = "/* Text to put at the beginning of the generated file. Probably a license. */"
+
+# An optional string of text to output at the end of the generated file
+# default: doesn't emit anything
+trailer = "/* Text to put at the end of the generated file */"
+
+# An optional name to use as an include guard
+# default: doesn't emit an include guard
+include_guard = "mozilla_wr_bindings_h"
+
+# Whether to add a `#pragma once` guard
+# default: doesn't emit a `#pragma once`
+pragma_once = true
+
+# An optional string of text to output between major sections of the generated
+# file as a warning against manual editing
+#
+# default: doesn't emit anything
+autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
+
+# Whether to include a comment with the version of cbindgen used to generate the file
+# default: false
+include_version = true
+
+# An optional namespace to output around the generated bindings
+# default: doesn't emit a namespace
+namespace = "ffi"
+
+# An optional list of namespaces to output around the generated bindings
+# default: []
+namespaces = ["mozilla", "wr"]
+
+# An optional list of namespaces to declare as using with "using namespace"
+# default: []
+using_namespaces = ["mozilla", "wr"]
+
+# A list of sys headers to #include (with angle brackets)
+# default: []
+sys_includes = ["stdio", "string"]
+
+# A list of headers to #include (with quotes)
+# default: []
+includes = ["my_great_lib.h"]
+
+# Whether cbindgen's default C/C++ standard imports should be suppressed. These
+# imports are included by default because our generated headers tend to require
+# them (e.g. for uint32_t). Currently, the generated imports are:
+#
+# * for C: <stdarg.h>, <stdbool.h>, <stdint.h>, <stdlib.h>, <uchar.h>
+#
+# * for C++: <cstdarg>, <cstdint>, <cstdlib>, <new>, <cassert> (depending on config)
+#
+# default: false
+no_includes = false
+
+# Whether to make a C header C++ compatible.
+# These will wrap generated functions into a `extern "C"` block, e.g.
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif // __cplusplus
+#
+# // Generated functions.
+#
+# #ifdef __cplusplus
+# } // extern "C"
+# #endif // __cplusplus
+#
+# If the language is not C this option won't have any effect.
+#
+# default: false
+cpp_compat = false
+
+# A list of lines to add verbatim after the includes block
+after_includes = "#define VERSION 1"
+
+
+
+# Code Style Options
+
+# The style to use for curly braces
+#
+# possible values: "SameLine", "NextLine"
+#
+# default: "SameLine"
+braces = "SameLine"
+
+# The desired length of a line to use when formatting lines
+# default: 100
+line_length = 80
+
+# The amount of spaces to indent by
+# default: 2
+tab_width = 3
+
+# Include doc comments from Rust as documentation
+documentation = true
+
+# How the generated documentation should be commented.
+#
+# possible values:
+# * "c": /* like this */
+# * "c99": // like this
+# * "c++": /// like this
+# * "doxy": like C, but with leading *'s on each line
+# * "auto": "c++" if that's the language, "doxy" otherwise
+#
+# default: "auto"
+documentation_style = "doxy"
+
+# How much of the documentation for each item is output.
+#
+# possible values:
+# * "short": Only the first line.
+# * "full": The full documentation.
+#
+# default: "full"
+documentation_length = "short"
+
+
+
+
+# Codegen Options
+
+# When generating a C header, the kind of declaration style to use for structs
+# or enums.
+#
+# possible values:
+# * "type": typedef struct { ... } MyType;
+# * "tag": struct MyType { ... };
+# * "both": typedef struct MyType { ... } MyType;
+#
+# default: "both"
+style = "both"
+
+# If this option is true `usize` and `isize` will be converted into `size_t` and `ptrdiff_t`
+# instead of `uintptr_t` and `intptr_t` respectively.
+usize_is_size_t = true
+
+# A list of substitutions for converting cfg's to ifdefs. cfgs which aren't
+# defined here will just be discarded.
+#
+# e.g.
+# `#[cfg(target = "freebsd")] ...`
+# becomes
+# `#if defined(DEFINE_FREEBSD) ... #endif`
+[defines]
+"target_os = freebsd" = "DEFINE_FREEBSD"
+"feature = serde" = "DEFINE_SERDE"
+
+
+
+
+
+[export]
+# A list of additional items to always include in the generated bindings if they're
+# found but otherwise don't appear to be used by the public API.
+#
+# default: []
+include = ["MyOrphanStruct", "MyGreatTypeRename"]
+
+# A list of items to not include in the generated bindings
+# default: []
+exclude = ["Bad"]
+
+# A prefix to add before the name of every item
+# default: no prefix is added
+prefix = "CAPI_"
+
+# Types of items that we'll generate. If empty, then all types of item are emitted.
+#
+# possible items: (TODO: explain these in detail)
+# * "constants":
+# * "globals":
+# * "enums":
+# * "structs":
+# * "unions":
+# * "typedefs":
+# * "opaque":
+# * "functions":
+#
+# default: []
+item_types = ["enums", "structs", "opaque", "functions"]
+
+# Whether applying rules in export.rename prevents export.prefix from applying.
+#
+# e.g. given this toml:
+#
+# [export]
+# prefix = "capi_"
+# [export.rename]
+# "MyType" = "my_cool_type"
+#
+# You get the following results:
+#
+# renaming_overrides_prefixing = true:
+# "MyType" => "my_cool_type"
+#
+# renaming_overrides_prefixing = false:
+# "MyType => capi_my_cool_type"
+#
+# default: false
+renaming_overrides_prefixing = true
+
+# Table of name conversions to apply to item names (lhs becomes rhs)
+[export.rename]
+"MyType" = "my_cool_type"
+"my_function" = "BetterFunctionName"
+
+# Table of things to prepend to the body of any struct, union, or enum that has the
+# given name. This can be used to add things like methods which don't change ABI,
+# mark fields private, etc
+[export.pre_body]
+"MyType" = """
+ MyType() = delete;
+private:
+"""
+
+# Table of things to append to the body of any struct, union, or enum that has the
+# given name. This can be used to add things like methods which don't change ABI.
+[export.body]
+"MyType" = """
+ void cppMethod() const;
+"""
+
+# Configuration for name mangling
+[export.mangle]
+# Whether the types should be renamed during mangling, for example
+# c_char -> CChar, etc.
+rename_types = "PascalCase"
+# Whether the underscores from the mangled name should be omitted.
+remove_underscores = false
+
+[layout]
+# A string that should come before the name of any type which has been marked
+# as `#[repr(packed)]`. For instance, "__attribute__((packed))" would be a
+# reasonable value if targeting gcc/clang. A more portable solution would
+# involve emitting the name of a macro which you define in a platform-specific
+# way. e.g. "PACKED"
+#
+# default: `#[repr(packed)]` types will be treated as opaque, since it would
+# be unsafe for C callers to use a incorrectly laid-out union.
+packed = "PACKED"
+
+# A string that should come before the name of any type which has been marked
+# as `#[repr(align(n))]`. This string must be a function-like macro which takes
+# a single argument (the requested alignment, `n`). For instance, a macro
+# `#define`d as `ALIGNED(n)` in `header` which translates to
+# `__attribute__((aligned(n)))` would be a reasonable value if targeting
+# gcc/clang.
+#
+# default: `#[repr(align(n))]` types will be treated as opaque, since it
+# could be unsafe for C callers to use a incorrectly-aligned union.
+aligned_n = "ALIGNED"
+
+
+[fn]
+# An optional prefix to put before every function declaration
+# default: no prefix added
+prefix = "WR_START_FUNC"
+
+# An optional postfix to put after any function declaration
+# default: no postix added
+postfix = "WR_END_FUNC"
+
+# How to format function arguments
+#
+# possible values:
+# * "horizontal": place all arguments on the same line
+# * "vertical": place each argument on its own line
+# * "auto": only use vertical if horizontal would exceed line_length
+#
+# default: "auto"
+args = "horizontal"
+
+# An optional string that should prefix function declarations which have been
+# marked as `#[must_use]`. For instance, "__attribute__((warn_unused_result))"
+# would be a reasonable value if targeting gcc/clang. A more portable solution
+# would involve emitting the name of a macro which you define in a
+# platform-specific way. e.g. "MUST_USE_FUNC"
+# default: nothing is emitted for must_use functions
+must_use = "MUST_USE_FUNC"
+
+# An optional string that should prefix function declarations which have been
+# marked as `#[deprecated]` without note. For instance, "__attribute__((deprecated))"
+# would be a reasonable value if targeting gcc/clang. A more portable solution
+# would involve emitting the name of a macro which you define in a
+# platform-specific way. e.g. "DEPRECATED_FUNC"
+# default: nothing is emitted for deprecated functions
+deprecated = "DEPRECATED_FUNC"
+
+# An optional string that should prefix function declarations which have been
+# marked as `#[deprecated(note = "reason")]`. `{}` will be replaced with the
+# double-quoted string. For instance, "__attribute__((deprecated({})))"
+# would be a reasonable value if targeting gcc/clang. A more portable solution
+# would involve emitting the name of a macro which you define in a
+# platform-specific way. e.g. "DEPRECATED_FUNC_WITH_NOTE(note)"
+# default: nothing is emitted for deprecated functions
+deprecated_with_notes = "DEPRECATED_FUNC_WITH_NOTE"
+
+# An optional string that will be used in the attribute position for functions
+# that don't return (that return `!` in Rust).
+#
+# For instance, `__attribute__((noreturn))` would be a reasonable value if
+# targeting gcc/clang.
+no_return = "NO_RETURN"
+
+# An optional string that, if present, will be used to generate Swift function
+# and method signatures for generated functions, for example "CF_SWIFT_NAME".
+# If no such macro is available in your toolchain, you can define one using the
+# `header` option in cbindgen.toml
+# default: no swift_name function attributes are generated
+swift_name_macro = "CF_SWIFT_NAME"
+
+# A rule to use to rename function argument names. The renaming assumes the input
+# is the Rust standard snake_case, however it accepts all the different rename_args
+# inputs. This means many options here are no-ops or redundant.
+#
+# possible values (that actually do something):
+# * "CamelCase": my_arg => myArg
+# * "PascalCase": my_arg => MyArg
+# * "GeckoCase": my_arg => aMyArg
+# * "ScreamingSnakeCase": my_arg => MY_ARG
+# * "None": apply no renaming
+#
+# technically possible values (that shouldn't have a purpose here):
+# * "SnakeCase": apply no renaming
+# * "LowerCase": apply no renaming (actually applies to_lowercase, is this bug?)
+# * "UpperCase": same as ScreamingSnakeCase in this context
+# * "QualifiedScreamingSnakeCase" => same as ScreamingSnakeCase in this context
+#
+# default: "None"
+rename_args = "PascalCase"
+
+# This rule specifies the order in which functions will be sorted.
+#
+# "Name": sort by the name of the function
+# "None": keep order in which the functions have been parsed
+#
+# default: "None"
+sort_by = "Name"
+
+[struct]
+# A rule to use to rename struct field names. The renaming assumes the input is
+# the Rust standard snake_case, however it acccepts all the different rename_args
+# inputs. This means many options here are no-ops or redundant.
+#
+# possible values (that actually do something):
+# * "CamelCase": my_arg => myArg
+# * "PascalCase": my_arg => MyArg
+# * "GeckoCase": my_arg => mMyArg
+# * "ScreamingSnakeCase": my_arg => MY_ARG
+# * "None": apply no renaming
+#
+# technically possible values (that shouldn't have a purpose here):
+# * "SnakeCase": apply no renaming
+# * "LowerCase": apply no renaming (actually applies to_lowercase, is this bug?)
+# * "UpperCase": same as ScreamingSnakeCase in this context
+# * "QualifiedScreamingSnakeCase" => same as ScreamingSnakeCase in this context
+#
+# default: "None"
+rename_fields = "PascalCase"
+
+# An optional string that should come before the name of any struct which has been
+# marked as `#[must_use]`. For instance, "__attribute__((warn_unused))"
+# would be a reasonable value if targeting gcc/clang. A more portable solution
+# would involve emitting the name of a macro which you define in a
+# platform-specific way. e.g. "MUST_USE_STRUCT"
+#
+# default: nothing is emitted for must_use structs
+must_use = "MUST_USE_STRUCT"
+
+# An optional string that should come before the name of any struct which has been
+# marked as `#[deprecated]` without note. For instance, "__attribute__((deprecated))"
+# would be a reasonable value if targeting gcc/clang. A more portable solution
+# would involve emitting the name of a macro which you define in a
+# platform-specific way. e.g. "DEPRECATED_STRUCT"
+# default: nothing is emitted for deprecated structs
+deprecated = "DEPRECATED_STRUCT"
+
+# An optional string that should come before the name of any struct which has been
+# marked as `#[deprecated(note = "reason")]`. `{}` will be replaced with the
+# double-quoted string. For instance, "__attribute__((deprecated({})))"
+# would be a reasonable value if targeting gcc/clang. A more portable solution
+# would involve emitting the name of a macro which you define in a
+# platform-specific way. e.g. "DEPRECATED_STRUCT_WITH_NOTE(note)"
+# default: nothing is emitted for deprecated structs
+deprecated_with_notes = "DEPRECATED_STRUCT_WITH_NOTE"
+
+# Whether a Rust type with associated consts should emit those consts inside the
+# type's body. Otherwise they will be emitted trailing and with the type's name
+# prefixed. This does nothing if the target is C, or if
+# [const]allow_static_const = false
+#
+# default: false
+# associated_constants_in_body: false
+
+# Whether to derive a simple constructor that takes a value for every field.
+# default: false
+derive_constructor = true
+
+# Whether to derive an operator== for all structs
+# default: false
+derive_eq = false
+
+# Whether to derive an operator!= for all structs
+# default: false
+derive_neq = false
+
+# Whether to derive an operator< for all structs
+# default: false
+derive_lt = false
+
+# Whether to derive an operator<= for all structs
+# default: false
+derive_lte = false
+
+# Whether to derive an operator> for all structs
+# default: false
+derive_gt = false
+
+# Whether to derive an operator>= for all structs
+# default: false
+derive_gte = false
+
+
+
+
+
+[enum]
+# A rule to use to rename enum variants, and the names of any fields those
+# variants have. This should probably be split up into two separate options, but
+# for now, they're the same! See the documentation for `[struct]rename_fields`
+# for how this applies to fields. Renaming of the variant assumes that the input
+# is the Rust standard PascalCase. In the case of QualifiedScreamingSnakeCase,
+# it also assumed that the enum's name is PascalCase.
+#
+# possible values (that actually do something):
+# * "CamelCase": MyVariant => myVariant
+# * "SnakeCase": MyVariant => my_variant
+# * "ScreamingSnakeCase": MyVariant => MY_VARIANT
+# * "QualifiedScreamingSnakeCase": MyVariant => ENUM_NAME_MY_VARIANT
+# * "LowerCase": MyVariant => myvariant
+# * "UpperCase": MyVariant => MYVARIANT
+# * "None": apply no renaming
+#
+# technically possible values (that shouldn't have a purpose for the variants):
+# * "PascalCase": apply no renaming
+# * "GeckoCase": apply no renaming
+#
+# default: "None"
+rename_variants = "None"
+
+# Whether an extra "sentinel" enum variant should be added to all generated enums.
+# Firefox uses this for their IPC serialization library.
+#
+# WARNING: if the sentinel is ever passed into Rust, behaviour will be Undefined.
+# Rust does not know about this value, and will assume it cannot happen.
+#
+# default: false
+add_sentinel = false
+
+# Whether enum variant names should be prefixed with the name of the enum.
+# default: false
+prefix_with_name = false
+
+# Whether to emit enums using "enum class" when targeting C++.
+# default: true
+enum_class = true
+
+# Whether to generate static `::MyVariant(..)` constructors and `bool IsMyVariant()`
+# methods for enums with fields.
+#
+# default: false
+derive_helper_methods = false
+
+# Whether to generate `const MyVariant& AsMyVariant() const` methods for enums with fields.
+# default: false
+derive_const_casts = false
+
+# Whether to generate `MyVariant& AsMyVariant()` methods for enums with fields
+# default: false
+derive_mut_casts = false
+
+# The name of the macro/function to use for asserting `IsMyVariant()` in the body of
+# derived `AsMyVariant()` cast methods.
+#
+# default: "assert" (but also causes `<cassert>` to be included by default)
+cast_assert_name = "MOZ_RELEASE_ASSERT"
+
+# An optional string that should come before the name of any enum which has been
+# marked as `#[must_use]`. For instance, "__attribute__((warn_unused))"
+# would be a reasonable value if targeting gcc/clang. A more portable solution
+# would involve emitting the name of a macro which you define in a
+# platform-specific way. e.g. "MUST_USE_ENUM"
+#
+# Note that this refers to the *output* type. That means this will not apply to an enum
+# with fields, as it will be emitted as a struct. `[struct]must_use` will apply there.
+#
+# default: nothing is emitted for must_use enums
+must_use = "MUST_USE_ENUM"
+
+# An optional string that should come before the name of any enum which has been
+# marked as `#[deprecated]` without note. For instance, "__attribute__((deprecated))"
+# would be a reasonable value if targeting gcc/clang. A more portable solution
+# would involve emitting the name of a macro which you define in a
+# platform-specific way. e.g. "DEPRECATED_ENUM"
+# default: nothing is emitted for deprecated enums
+deprecated = "DEPRECATED_ENUM"
+
+# An optional string that should come before the name of any enum which has been
+# marked as `#[deprecated(note = "reason")]`. `{}` will be replaced with the
+# double-quoted string. For instance, "__attribute__((deprecated({})))"
+# would be a reasonable value if targeting gcc/clang. A more portable solution
+# would involve emitting the name of a macro which you define in a
+# platform-specific way. e.g. "DEPRECATED_ENUM_WITH_NOTE(note)"
+# default: nothing is emitted for deprecated enums
+deprecated_with_notes = "DEPRECATED_ENUM_WITH_NOTE"
+
+# An optional string that should come after the name of any enum variant which has been
+# marked as `#[deprecated]` without note. For instance, "__attribute__((deprecated))"
+# would be a reasonable value if targeting gcc/clang. A more portable solution would
+# involve emitting the name of a macro which you define in a platform-specific
+# way. e.g. "DEPRECATED_ENUM_VARIANT"
+# default: nothing is emitted for deprecated enum variants
+deprecated_variant = "DEPRECATED_ENUM_VARIANT"
+
+# An optional string that should come after the name of any enum variant which has been
+# marked as `#[deprecated(note = "reason")]`. `{}` will be replaced with the
+# double-quoted string. For instance, "__attribute__((deprecated({})))" would be a
+# reasonable value if targeting gcc/clang. A more portable solution would involve
+# emitting the name of a macro which you define in a platform-specific
+# way. e.g. "DEPRECATED_ENUM_WITH_NOTE(note)"
+# default: nothing is emitted for deprecated enum variants
+deprecated_variant_with_notes = "DEPRECATED_ENUM_VARIANT_WITH_NOTE({})"
+
+# Whether enums with fields should generate destructors. This exists so that generic
+# enums can be properly instantiated with payloads that are C++ types with
+# destructors. This isn't necessary for structs because C++ has rules to
+# automatically derive the correct constructors and destructors for those types.
+#
+# Care should be taken with this option, as Rust and C++ cannot
+# properly interoperate with eachother's notions of destructors. Also, this may
+# change the ABI for the type. Either your destructor-full enums must live
+# exclusively within C++, or they must only be passed by-reference between
+# C++ and Rust.
+#
+# default: false
+derive_tagged_enum_destructor = false
+
+# Whether enums with fields should generate copy-constructor. See the discussion on
+# derive_tagged_enum_destructor for why this is both useful and very dangerous.
+#
+# default: false
+derive_tagged_enum_copy_constructor = false
+# Whether enums with fields should generate copy-assignment operators.
+#
+# This depends on also deriving copy-constructors, and it is highly encouraged
+# for this to be set to true.
+#
+# default: false
+derive_tagged_enum_copy_assignment = false
+
+# Whether enums with fields should generate an empty, private destructor.
+# This allows the auto-generated constructor functions to compile, if there are
+# non-trivially constructible members. This falls in the same family of
+# dangerousness as `derive_tagged_enum_copy_constructor` and co.
+#
+# default: false
+private_default_tagged_enum_constructor = false
+
+
+
+
+
+[const]
+# Whether a generated constant can be a static const in C++ mode. I have no
+# idea why you would turn this off.
+#
+# default: true
+allow_static_const = true
+
+# Whether a generated constant can be constexpr in C++ mode.
+#
+# default: true
+allow_constexpr = false
+
+# This rule specifies the order in which constants will be sorted.
+#
+# "Name": sort by the name of the constant
+# "None": keep order in which the constants have been parsed
+#
+# default: "None"
+sort_by = "Name"
+
+
+
+
+[macro_expansion]
+# Whether bindings should be generated for instances of the bitflags! macro.
+# default: false
+bitflags = true
+
+
+
+
+
+
+# Options for how your Rust library should be parsed
+
+[parse]
+# Whether to parse dependent crates and include their types in the output
+# default: false
+parse_deps = true
+
+# A white list of crate names that are allowed to be parsed. If this is defined,
+# only crates found in this list will ever be parsed.
+#
+# default: there is no whitelist (NOTE: this is the opposite of [])
+include = ["webrender", "webrender_traits"]
+
+# A black list of crate names that are not allowed to be parsed.
+# default: []
+exclude = ["libc"]
+
+# Whether to use a new temporary target directory when running `rustc -Zunpretty=expanded`.
+# This may be required for some build processes.
+#
+# default: false
+clean = false
+
+# Which crates other than the top-level binding crate we should generate
+# bindings for.
+#
+# default: []
+extra_bindings = ["my_awesome_dep"]
+
+[parse.expand]
+# A list of crate names that should be run through `cargo expand` before
+# parsing to expand any macros. Note that if a crate is named here, it
+# will always be parsed, even if the blacklist/whitelist says it shouldn't be.
+#
+# default: []
+crates = ["euclid"]
+
+# If enabled, use the `--all-features` option when expanding. Ignored when
+# `features` is set. For backwards-compatibility, this is forced on if
+# `expand = ["euclid"]` shorthand is used.
+#
+# default: false
+all_features = false
+
+# When `all_features` is disabled and this is also disabled, use the
+# `--no-default-features` option when expanding.
+#
+# default: true
+default_features = true
+
+# A list of feature names that should be used when running `cargo expand`. This
+# combines with `default_features` like in your `Cargo.toml`. Note that the features
+# listed here are features for the current crate being built, *not* the crates
+# being expanded. The crate's `Cargo.toml` must take care of enabling the
+# appropriate features in its dependencies
+#
+# default: []
+features = ["cbindgen"]
+
+[ptr]
+# An optional string to decorate all pointers that are
+# required to be non null. Nullability is inferred from the Rust type: `&T`,
+# `&mut T` and `NonNull<T>` all require a valid pointer value.
+non_null_attribute = "_Nonnull"
+
+# Options specific to Cython bindings.
+
+[cython]
+
+# Header specified in the top level `cdef extern from header:` declaration.
+#
+# default: *
+header = '"my_header.h"'
+
+# `from module cimport name1, name2` declarations added in the same place
+# where you'd get includes in C.
+[cython.cimports]
+module = ["name1", "name2"]
+```
+
+
+
+
+
+[reference]: https://doc.rust-lang.org/nightly/reference/type-layout.html#representations
+[really-tagged-unions]: https://github.com/rust-lang/rfcs/blob/master/text/2195-really-tagged-unions.md
+[section-cfgs]: #defines-and-cfgs
+[file-it]: https://github.com/mozilla/cbindgen/issues/new
diff --git a/cbindgen-0.24.5/internals.md b/cbindgen-0.27.0/internals.md
similarity index 100%
rename from cbindgen-0.24.5/internals.md
rename to cbindgen-0.27.0/internals.md
diff --git a/cbindgen-0.27.0/rust-toolchain.toml b/cbindgen-0.27.0/rust-toolchain.toml
new file mode 100644
index 0000000..271800c
--- /dev/null
+++ b/cbindgen-0.27.0/rust-toolchain.toml
@@ -0,0 +1,2 @@
+[toolchain]
+channel = "nightly"
\ No newline at end of file
diff --git a/cbindgen-0.27.0/src/bindgen/bindings.rs b/cbindgen-0.27.0/src/bindgen/bindings.rs
new file mode 100644
index 0000000..029cfc6
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/bindings.rs
@@ -0,0 +1,229 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::borrow::Cow;
+use std::cell::RefCell;
+use std::collections::HashMap;
+use std::fs;
+use std::fs::File;
+use std::io::{Read, Write};
+use std::path;
+use std::rc::Rc;
+
+use crate::bindgen::config::{Config, Language};
+use crate::bindgen::ir::{
+ Constant, Function, ItemContainer, ItemMap, Path as BindgenPath, Static, Struct, Type, Typedef,
+};
+use crate::bindgen::language_backend::{
+ CLikeLanguageBackend, CythonLanguageBackend, LanguageBackend,
+};
+use crate::bindgen::writer::SourceWriter;
+
+/// A bindings header that can be written.
+pub struct Bindings {
+ pub config: Config,
+ /// The map from path to struct, used to lookup whether a given type is a
+ /// transparent struct. This is needed to generate code for constants.
+ struct_map: ItemMap<Struct>,
+ typedef_map: ItemMap<Typedef>,
+ struct_fileds_memo: RefCell<HashMap<BindgenPath, Rc<Vec<String>>>>,
+ pub globals: Vec<Static>,
+ pub constants: Vec<Constant>,
+ pub items: Vec<ItemContainer>,
+ pub functions: Vec<Function>,
+ source_files: Vec<path::PathBuf>,
+ /// Bindings are generated by a recursive call to cbindgen
+ /// and shouldn't do anything when written anywhere.
+ noop: bool,
+ pub package_version: String,
+}
+
+impl Bindings {
+ #[allow(clippy::too_many_arguments)]
+ pub(crate) fn new(
+ config: Config,
+ struct_map: ItemMap<Struct>,
+ typedef_map: ItemMap<Typedef>,
+ constants: Vec<Constant>,
+ globals: Vec<Static>,
+ items: Vec<ItemContainer>,
+ functions: Vec<Function>,
+ source_files: Vec<path::PathBuf>,
+ noop: bool,
+ package_version: String,
+ ) -> Bindings {
+ Bindings {
+ config,
+ struct_map,
+ typedef_map,
+ struct_fileds_memo: Default::default(),
+ globals,
+ constants,
+ items,
+ functions,
+ source_files,
+ noop,
+ package_version,
+ }
+ }
+
+ // FIXME(emilio): What to do when the configuration doesn't match?
+ pub fn struct_is_transparent(&self, path: &BindgenPath) -> bool {
+ let mut any = false;
+ self.struct_map.for_items(path, |s| any |= s.is_transparent);
+ any
+ }
+
+ /// Peels through typedefs to allow resolving structs.
+ fn resolved_struct_path<'a>(&self, path: &'a BindgenPath) -> Cow<'a, BindgenPath> {
+ let mut resolved_path = Cow::Borrowed(path);
+ loop {
+ let mut found = None;
+ self.typedef_map.for_items(&resolved_path, |item| {
+ if let Type::Path(ref p) = item.aliased {
+ found = Some(p.path().clone());
+ }
+ });
+ resolved_path = match found {
+ Some(p) => Cow::Owned(p),
+ None => break,
+ }
+ }
+ resolved_path
+ }
+
+ pub fn struct_exists(&self, path: &BindgenPath) -> bool {
+ let mut any = false;
+ self.struct_map
+ .for_items(&self.resolved_struct_path(path), |_| any = true);
+ any
+ }
+
+ pub fn struct_field_names(&self, path: &BindgenPath) -> Rc<Vec<String>> {
+ let mut memos = self.struct_fileds_memo.borrow_mut();
+ if let Some(memo) = memos.get(path) {
+ return memo.clone();
+ }
+
+ let resolved_path = self.resolved_struct_path(path);
+
+ let mut fields = Vec::<String>::new();
+ self.struct_map.for_items(&resolved_path, |st| {
+ let mut pos: usize = 0;
+ for field in &st.fields {
+ if let Some(found_pos) = fields.iter().position(|v| *v == field.name) {
+ pos = found_pos + 1;
+ } else {
+ fields.insert(pos, field.name.clone());
+ pos += 1;
+ }
+ }
+ });
+
+ let fields = Rc::new(fields);
+ memos.insert(path.clone(), fields.clone());
+ if let Cow::Owned(p) = resolved_path {
+ memos.insert(p, fields.clone());
+ }
+ fields
+ }
+
+ pub fn generate_depfile<P: AsRef<path::Path>>(&self, header_path: P, depfile_path: P) {
+ if let Some(dir) = depfile_path.as_ref().parent() {
+ if !dir.exists() {
+ std::fs::create_dir_all(dir).unwrap()
+ }
+ }
+ let canon_header_path = header_path.as_ref().canonicalize().unwrap();
+ let mut canon_source_files: Vec<_> = self
+ .source_files
+ .iter()
+ .chain(self.config.config_path.as_ref())
+ .map(|p| p.canonicalize().unwrap())
+ .collect();
+ // Sorting makes testing easier by ensuring the output is ordered.
+ canon_source_files.sort_unstable();
+
+ // When writing the depfile we must escape whitespace in paths to avoid it being interpreted
+ // as a seperator.
+ // It is not clear how to otherwise _correctly_ replace whitespace in a non-unicode
+ // compliant slice, without knowing the encoding, so we lossy convert such cases,
+ // to avoid panics.
+ let mut depfile = File::create(depfile_path).unwrap();
+ write!(
+ &mut depfile,
+ "{}:",
+ canon_header_path.to_string_lossy().replace(' ', "\\ ")
+ )
+ .expect("Writing header name to depfile failed");
+ canon_source_files.into_iter().for_each(|source_file| {
+ // Add line-continue and line-break and then indent with 4 spaces.
+ // This makes the output more human-readable.
+ depfile.write_all(b" \\\n ").unwrap();
+ let escaped_path = source_file.to_string_lossy().replace(' ', "\\ ");
+ depfile.write_all(escaped_path.as_bytes()).unwrap();
+ });
+
+ writeln!(&mut depfile).unwrap();
+
+ depfile.flush().unwrap();
+ }
+
+ pub fn write_to_file<P: AsRef<path::Path>>(&self, path: P) -> bool {
+ if self.noop {
+ return false;
+ }
+
+ // Don't compare files if we've never written this file before
+ if !path.as_ref().is_file() {
+ if let Some(parent) = path::Path::new(path.as_ref()).parent() {
+ fs::create_dir_all(parent).unwrap();
+ }
+ self.write(File::create(path).unwrap());
+ return true;
+ }
+
+ let mut new_file_contents = Vec::new();
+ self.write(&mut new_file_contents);
+
+ let mut old_file_contents = Vec::new();
+ {
+ let mut old_file = File::open(&path).unwrap();
+ old_file.read_to_end(&mut old_file_contents).unwrap();
+ }
+
+ if old_file_contents != new_file_contents {
+ let mut new_file = File::create(&path).unwrap();
+ new_file.write_all(&new_file_contents).unwrap();
+ true
+ } else {
+ false
+ }
+ }
+
+ pub fn write<F: Write>(&self, file: F) {
+ match self.config.language {
+ Language::Cxx | Language::C => {
+ self.write_with_backend(file, &mut CLikeLanguageBackend::new(&self.config))
+ }
+ Language::Cython => {
+ self.write_with_backend(file, &mut CythonLanguageBackend::new(&self.config))
+ }
+ }
+ }
+
+ fn write_with_backend<F: Write, LB: LanguageBackend>(
+ &self,
+ file: F,
+ language_backend: &mut LB,
+ ) {
+ if self.noop {
+ return;
+ }
+
+ let mut out = SourceWriter::new(file, self);
+
+ language_backend.write_bindings(&mut out, self);
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/bitflags.rs b/cbindgen-0.27.0/src/bindgen/bitflags.rs
new file mode 100644
index 0000000..2ca0be6
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/bitflags.rs
@@ -0,0 +1,289 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use proc_macro2::TokenStream;
+use std::collections::HashSet;
+use syn::fold::Fold;
+use syn::parse::{Parse, ParseStream, Parser, Result as ParseResult};
+
+// $(#[$outer:meta])*
+// ($($vis:tt)*) $BitFlags:ident: $T:ty {
+// $(
+// $(#[$inner:ident $($args:tt)*])*
+// const $Flag:ident = $value:expr;
+// )+
+// }
+#[derive(Debug)]
+pub struct BitflagsStruct {
+ attrs: Vec<syn::Attribute>,
+ vis: syn::Visibility,
+ #[allow(dead_code)]
+ struct_token: Token![struct],
+ name: syn::Ident,
+ #[allow(dead_code)]
+ colon_token: Token![:],
+ repr: syn::Type,
+ flags: Flags,
+}
+
+// impl $BitFlags:ident: $T:ty {
+// $(
+// $(#[$inner:ident $($args:tt)*])*
+// const $Flag:ident = $value:expr;
+// )+
+// }
+#[derive(Debug)]
+pub struct BitflagsImpl {
+ #[allow(dead_code)]
+ impl_token: Token![impl],
+ name: syn::Ident,
+ #[allow(dead_code)]
+ colon_token: Token![:],
+ repr: syn::Type,
+ flags: Flags,
+}
+
+#[derive(Debug)]
+pub enum Bitflags {
+ Struct(BitflagsStruct),
+ Impl(BitflagsImpl),
+}
+
+impl Bitflags {
+ pub fn expand(&self) -> (Option<syn::ItemStruct>, syn::ItemImpl) {
+ match self {
+ Bitflags::Struct(BitflagsStruct {
+ attrs,
+ vis,
+ name,
+ repr,
+ flags,
+ ..
+ }) => {
+ let struct_ = parse_quote! {
+ #(#attrs)*
+ #vis struct #name {
+ bits: #repr,
+ }
+ };
+
+ let consts = flags.expand(name, repr, false);
+ let impl_ = parse_quote! {
+ impl #name {
+ #consts
+ }
+ };
+
+ (Some(struct_), impl_)
+ }
+ Bitflags::Impl(BitflagsImpl {
+ name, repr, flags, ..
+ }) => {
+ let consts = flags.expand(name, repr, true);
+ let impl_: syn::ItemImpl = parse_quote! {
+ impl #name {
+ #consts
+ }
+ };
+ (None, impl_)
+ }
+ }
+ }
+}
+
+impl Parse for Bitflags {
+ fn parse(input: ParseStream) -> ParseResult<Self> {
+ Ok(if input.peek(Token![impl]) {
+ Self::Impl(BitflagsImpl {
+ impl_token: input.parse()?,
+ name: input.parse()?,
+ colon_token: input.parse()?,
+ repr: input.parse()?,
+ flags: input.parse()?,
+ })
+ } else {
+ Self::Struct(BitflagsStruct {
+ attrs: input.call(syn::Attribute::parse_outer)?,
+ vis: input.parse()?,
+ struct_token: input.parse()?,
+ name: input.parse()?,
+ colon_token: input.parse()?,
+ repr: input.parse()?,
+ flags: input.parse()?,
+ })
+ })
+ }
+}
+
+// $(#[$inner:ident $($args:tt)*])*
+// const $Flag:ident = $value:expr;
+#[derive(Debug)]
+struct Flag {
+ attrs: Vec<syn::Attribute>,
+ #[allow(dead_code)]
+ const_token: Token![const],
+ name: syn::Ident,
+ #[allow(dead_code)]
+ equals_token: Token![=],
+ value: syn::Expr,
+ #[allow(dead_code)]
+ semicolon_token: Token![;],
+}
+
+struct FlagValueFold<'a> {
+ struct_name: &'a syn::Ident,
+ flag_names: &'a HashSet<String>,
+ out_of_line: bool,
+}
+
+impl<'a> FlagValueFold<'a> {
+ fn is_self(&self, ident: &syn::Ident) -> bool {
+ ident == self.struct_name || ident == "Self"
+ }
+}
+
+impl<'a> Fold for FlagValueFold<'a> {
+ fn fold_expr(&mut self, node: syn::Expr) -> syn::Expr {
+ // bitflags 2 doesn't expose `bits` publically anymore, and the documented way to
+ // combine flags is using the `bits` method, e.g.
+ // ```
+ // bitflags! {
+ // struct Flags: u8 {
+ // const A = 1;
+ // const B = 1 << 1;
+ // const AB = Flags::A.bits() | Flags::B.bits();
+ // }
+ // }
+ // ```
+ // As we're transforming the struct definition into `struct StructName { bits: T }`
+ // as far as our bindings generation is concerned, `bits` is available as a field,
+ // so by replacing `StructName::FLAG.bits()` with `StructName::FLAG.bits`, we make
+ // e.g. `Flags::AB` available in the generated bindings.
+ // For out-of-line definitions of the struct(*), where the struct is defined as a
+ // newtype, we replace it with `StructName::FLAGS.0`.
+ // * definitions like:
+ // ```
+ // struct Flags(u8);
+ // bitflags! {
+ // impl Flags: u8 {
+ // const A = 1;
+ // const B = 1 << 1;
+ // const AB = Flags::A.bits() | Flags::B.bits();
+ // }
+ // }
+ // ```
+ match node {
+ syn::Expr::MethodCall(syn::ExprMethodCall {
+ attrs,
+ receiver,
+ dot_token,
+ method,
+ args,
+ ..
+ }) if method == "bits"
+ && args.is_empty()
+ && matches!(&*receiver,
+ syn::Expr::Path(syn::ExprPath { path, .. })
+ if path.segments.len() == 2
+ && self.is_self(&path.segments.first().unwrap().ident)
+ && self
+ .flag_names
+ .contains(&path.segments.last().unwrap().ident.to_string())) =>
+ {
+ return syn::Expr::Field(syn::ExprField {
+ attrs,
+ base: receiver,
+ dot_token,
+ member: if self.out_of_line {
+ syn::Member::Unnamed(parse_quote! {0})
+ } else {
+ syn::Member::Named(method)
+ },
+ });
+ }
+ _ => {}
+ }
+ syn::fold::fold_expr(self, node)
+ }
+}
+
+impl Flag {
+ fn expand(
+ &self,
+ struct_name: &syn::Ident,
+ repr: &syn::Type,
+ flag_names: &HashSet<String>,
+ out_of_line: bool,
+ ) -> TokenStream {
+ let Flag {
+ ref attrs,
+ ref name,
+ ref value,
+ ..
+ } = *self;
+ let folded_value = FlagValueFold {
+ struct_name,
+ flag_names,
+ out_of_line,
+ }
+ .fold_expr(value.clone());
+ let value = if out_of_line {
+ quote! { ((#folded_value) as #repr) }
+ } else {
+ quote! { { bits: (#folded_value) as #repr } }
+ };
+ quote! {
+ #(#attrs)*
+ pub const #name : #struct_name = #struct_name #value;
+ }
+ }
+}
+
+impl Parse for Flag {
+ fn parse(input: ParseStream) -> ParseResult<Self> {
+ Ok(Self {
+ attrs: input.call(syn::Attribute::parse_outer)?,
+ const_token: input.parse()?,
+ name: input.parse()?,
+ equals_token: input.parse()?,
+ value: input.parse()?,
+ semicolon_token: input.parse()?,
+ })
+ }
+}
+
+#[derive(Debug)]
+struct Flags(Vec<Flag>);
+
+impl Parse for Flags {
+ fn parse(input: ParseStream) -> ParseResult<Self> {
+ let content;
+ let _ = braced!(content in input);
+ let mut flags = vec![];
+ while !content.is_empty() {
+ flags.push(content.parse()?);
+ }
+ Ok(Flags(flags))
+ }
+}
+
+impl Flags {
+ fn expand(&self, struct_name: &syn::Ident, repr: &syn::Type, out_of_line: bool) -> TokenStream {
+ let mut ts = quote! {};
+ let flag_names = self
+ .0
+ .iter()
+ .map(|flag| flag.name.to_string())
+ .collect::<HashSet<_>>();
+ for flag in &self.0 {
+ ts.extend(flag.expand(struct_name, repr, &flag_names, out_of_line));
+ }
+ ts
+ }
+}
+
+pub fn parse(tokens: TokenStream) -> ParseResult<Bitflags> {
+ let parser = Bitflags::parse;
+ parser.parse2(tokens)
+}
diff --git a/cbindgen-0.27.0/src/bindgen/builder.rs b/cbindgen-0.27.0/src/bindgen/builder.rs
new file mode 100644
index 0000000..d47919b
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/builder.rs
@@ -0,0 +1,426 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::path;
+
+use crate::bindgen::bindings::Bindings;
+use crate::bindgen::cargo::Cargo;
+use crate::bindgen::config::{Braces, Config, Language, Profile, Style};
+use crate::bindgen::error::Error;
+use crate::bindgen::library::Library;
+use crate::bindgen::parser::{self, Parse};
+
+/// A builder for generating a bindings header.
+#[derive(Debug, Clone)]
+pub struct Builder {
+ config: Config,
+ srcs: Vec<path::PathBuf>,
+ lib: Option<(path::PathBuf, Option<String>)>,
+ lib_cargo: Option<Cargo>,
+ std_types: bool,
+ lockfile: Option<path::PathBuf>,
+}
+
+impl Builder {
+ #[allow(clippy::new_without_default)]
+ pub fn new() -> Builder {
+ Builder {
+ config: Config::default(),
+ srcs: Vec::new(),
+ lib: None,
+ lib_cargo: None,
+ std_types: true,
+ lockfile: None,
+ }
+ }
+
+ #[allow(unused)]
+ pub fn with_header<S: AsRef<str>>(mut self, header: S) -> Builder {
+ self.config.header = Some(String::from(header.as_ref()));
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_no_includes(mut self) -> Builder {
+ self.config.no_includes = true;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_include<S: AsRef<str>>(mut self, include: S) -> Builder {
+ self.config.includes.push(String::from(include.as_ref()));
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_sys_include<S: AsRef<str>>(mut self, include: S) -> Builder {
+ self.config
+ .sys_includes
+ .push(String::from(include.as_ref()));
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_after_include<S: AsRef<str>>(mut self, line: S) -> Builder {
+ self.config.after_includes = Some(String::from(line.as_ref()));
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_trailer<S: AsRef<str>>(mut self, trailer: S) -> Builder {
+ self.config.trailer = Some(String::from(trailer.as_ref()));
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_include_guard<S: AsRef<str>>(mut self, include_guard: S) -> Builder {
+ self.config.include_guard = Some(String::from(include_guard.as_ref()));
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_pragma_once(mut self, pragma_once: bool) -> Builder {
+ self.config.pragma_once = pragma_once;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_autogen_warning<S: AsRef<str>>(mut self, autogen_warning: S) -> Builder {
+ self.config.autogen_warning = Some(String::from(autogen_warning.as_ref()));
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_include_version(mut self, include_version: bool) -> Builder {
+ self.config.include_version = include_version;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_namespace<S: AsRef<str>>(mut self, namespace: S) -> Builder {
+ self.config.namespace = Some(String::from(namespace.as_ref()));
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_namespaces<S: AsRef<str>>(mut self, namespaces: &[S]) -> Builder {
+ self.config.namespaces = Some(
+ namespaces
+ .iter()
+ .map(|x| String::from(x.as_ref()))
+ .collect(),
+ );
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_using_namespaces<S: AsRef<str>>(mut self, namespaces: &[S]) -> Builder {
+ self.config.using_namespaces = Some(
+ namespaces
+ .iter()
+ .map(|x| String::from(x.as_ref()))
+ .collect(),
+ );
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_braces(mut self, braces: Braces) -> Builder {
+ self.config.braces = braces;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_line_length(mut self, line_length: usize) -> Builder {
+ self.config.line_length = line_length;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_tab_width(mut self, tab_width: usize) -> Builder {
+ self.config.tab_width = tab_width;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_language(mut self, language: Language) -> Builder {
+ self.config.language = language;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_cpp_compat(mut self, cpp_compat: bool) -> Builder {
+ self.config.cpp_compat = cpp_compat;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_style(mut self, style: Style) -> Builder {
+ self.config.style = style;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn include_item<S: AsRef<str>>(mut self, item_name: S) -> Builder {
+ self.config
+ .export
+ .include
+ .push(String::from(item_name.as_ref()));
+ self
+ }
+
+ #[allow(unused)]
+ pub fn exclude_item<S: AsRef<str>>(mut self, item_name: S) -> Builder {
+ self.config
+ .export
+ .exclude
+ .push(String::from(item_name.as_ref()));
+ self
+ }
+
+ #[allow(unused)]
+ pub fn rename_item<S: AsRef<str>>(mut self, from: S, to: S) -> Builder {
+ self.config
+ .export
+ .rename
+ .insert(String::from(from.as_ref()), String::from(to.as_ref()));
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_item_prefix<S: AsRef<str>>(mut self, prefix: S) -> Builder {
+ self.config.export.prefix = Some(String::from(prefix.as_ref()));
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_parse_deps(mut self, parse_deps: bool) -> Builder {
+ self.config.parse.parse_deps = parse_deps;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_parse_include<S: AsRef<str>>(mut self, include: &[S]) -> Builder {
+ self.config.parse.include =
+ Some(include.iter().map(|x| String::from(x.as_ref())).collect());
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_parse_exclude<S: AsRef<str>>(mut self, exclude: &[S]) -> Builder {
+ self.config.parse.exclude = exclude.iter().map(|x| String::from(x.as_ref())).collect();
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_parse_expand<S: AsRef<str>>(mut self, expand: &[S]) -> Builder {
+ self.config.parse.expand.crates = expand.iter().map(|x| String::from(x.as_ref())).collect();
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_parse_expand_all_features(mut self, expand_all_features: bool) -> Builder {
+ self.config.parse.expand.all_features = expand_all_features;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_parse_expand_default_features(mut self, expand_default_features: bool) -> Builder {
+ self.config.parse.expand.default_features = expand_default_features;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_parse_expand_features<S: AsRef<str>>(mut self, expand_features: &[S]) -> Builder {
+ self.config.parse.expand.features = Some(
+ expand_features
+ .iter()
+ .map(|x| String::from(x.as_ref()))
+ .collect(),
+ );
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_parse_expand_profile(mut self, profile: Profile) -> Builder {
+ self.config.parse.expand.profile = profile;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_parse_extra_bindings<S: AsRef<str>>(mut self, extra_bindings: &[S]) -> Builder {
+ self.config.parse.extra_bindings = extra_bindings
+ .iter()
+ .map(|x| String::from(x.as_ref()))
+ .collect();
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_only_target_dependencies(mut self, only_target_dependencies: bool) -> Builder {
+ self.config.only_target_dependencies = only_target_dependencies;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_documentation(mut self, documentation: bool) -> Builder {
+ self.config.documentation = documentation;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_target_os_define(mut self, platform: &str, preprocessor_define: &str) -> Builder {
+ self.config.defines.insert(
+ format!("target_os = {}", platform),
+ preprocessor_define.to_owned(),
+ );
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_define(mut self, key: &str, value: &str, preprocessor_define: &str) -> Builder {
+ self.config.defines.insert(
+ format!("{} = {}", key, value),
+ preprocessor_define.to_owned(),
+ );
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_config(mut self, config: Config) -> Builder {
+ self.config = config;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_std_types(mut self, std_types: bool) -> Builder {
+ self.std_types = std_types;
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_src<P: AsRef<path::Path>>(mut self, src: P) -> Builder {
+ self.srcs.push(src.as_ref().to_owned());
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_crate<P: AsRef<path::Path>>(mut self, lib_dir: P) -> Builder {
+ debug_assert!(self.lib.is_none());
+ debug_assert!(self.lib_cargo.is_none());
+ self.lib = Some((path::PathBuf::from(lib_dir.as_ref()), None));
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_crate_and_name<P: AsRef<path::Path>, S: AsRef<str>>(
+ mut self,
+ lib_dir: P,
+ binding_lib_name: S,
+ ) -> Builder {
+ debug_assert!(self.lib.is_none());
+ debug_assert!(self.lib_cargo.is_none());
+ self.lib = Some((
+ path::PathBuf::from(lib_dir.as_ref()),
+ Some(String::from(binding_lib_name.as_ref())),
+ ));
+ self
+ }
+
+ #[allow(unused)]
+ pub(crate) fn with_cargo(mut self, lib: Cargo) -> Builder {
+ debug_assert!(self.lib.is_none());
+ debug_assert!(self.lib_cargo.is_none());
+ self.lib_cargo = Some(lib);
+ self
+ }
+
+ #[allow(unused)]
+ pub fn with_lockfile<P: AsRef<path::Path>>(mut self, lockfile: P) -> Builder {
+ debug_assert!(self.lockfile.is_none());
+ debug_assert!(self.lib_cargo.is_none());
+ self.lockfile = Some(path::PathBuf::from(lockfile.as_ref()));
+ self
+ }
+
+ pub fn generate(self) -> Result<Bindings, Error> {
+ // If macro expansion is enabled, then cbindgen will attempt to build the crate
+ // and will run its build script which may run cbindgen again. That second run may start
+ // infinite recursion, or overwrite previously written files with bindings.
+ // So if we are called recursively, we are skipping the whole generation
+ // and produce "noop" bindings that won't be able to overwrite anything.
+ if std::env::var("_CBINDGEN_IS_RUNNING").is_ok() {
+ return Ok(Bindings::new(
+ self.config,
+ Default::default(),
+ Default::default(),
+ Default::default(),
+ Default::default(),
+ Default::default(),
+ Default::default(),
+ Default::default(),
+ true,
+ String::new(),
+ ));
+ }
+
+ let mut result = Parse::new();
+
+ if self.std_types {
+ result.add_std_types();
+ }
+
+ for x in &self.srcs {
+ result.extend_with(&parser::parse_src(x, &self.config)?);
+ }
+
+ if let Some((lib_dir, binding_lib_name)) = self.lib.clone() {
+ let lockfile = self.lockfile.as_deref();
+
+ let cargo = Cargo::load(
+ &lib_dir,
+ lockfile,
+ binding_lib_name.as_deref(),
+ self.config.parse.parse_deps,
+ self.config.parse.clean,
+ self.config.only_target_dependencies,
+ /* existing_metadata = */ None,
+ )?;
+
+ result.extend_with(&parser::parse_lib(cargo, &self.config)?);
+ } else if let Some(cargo) = self.lib_cargo.clone() {
+ result.extend_with(&parser::parse_lib(cargo, &self.config)?);
+ }
+
+ result.source_files.extend_from_slice(self.srcs.as_slice());
+
+ Library::new(
+ self.config,
+ result.constants,
+ result.globals,
+ result.enums,
+ result.structs,
+ result.unions,
+ result.opaque_items,
+ result.typedefs,
+ result.functions,
+ result.source_files,
+ result.package_version,
+ )
+ .generate()
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn with_style() {
+ assert_eq!(
+ Style::Tag,
+ Builder::new().with_style(Style::Tag).config.style
+ );
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/cargo/cargo.rs b/cbindgen-0.27.0/src/bindgen/cargo/cargo.rs
new file mode 100644
index 0000000..d639a82
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/cargo/cargo.rs
@@ -0,0 +1,265 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::path::{Path, PathBuf};
+
+use crate::bindgen::cargo::cargo_expand;
+use crate::bindgen::cargo::cargo_lock::{self, Lock};
+pub(crate) use crate::bindgen::cargo::cargo_metadata::PackageRef;
+use crate::bindgen::cargo::cargo_metadata::{self, Metadata};
+use crate::bindgen::cargo::cargo_toml;
+use crate::bindgen::config::Profile;
+use crate::bindgen::error::Error;
+use crate::bindgen::ir::Cfg;
+
+/// Parse a dependency string used in Cargo.lock
+fn parse_dep_string(dep_string: &str) -> (&str, Option<&str>) {
+ let split: Vec<&str> = dep_string.split_whitespace().collect();
+
+ (split[0], split.get(1).cloned())
+}
+
+/// A collection of metadata for a library from cargo.
+#[derive(Clone, Debug)]
+pub(crate) struct Cargo {
+ manifest_path: PathBuf,
+ binding_crate_name: String,
+ lock: Option<Lock>,
+ metadata: Metadata,
+ clean: bool,
+}
+
+impl Cargo {
+ /// Gather metadata from cargo for a specific library and binding crate
+ /// name. If dependency finding isn't needed then Cargo.lock files don't
+ /// need to be parsed.
+ pub(crate) fn load(
+ crate_dir: &Path,
+ lock_file: Option<&Path>,
+ binding_crate_name: Option<&str>,
+ use_cargo_lock: bool,
+ clean: bool,
+ only_target_dependencies: bool,
+ existing_metadata_file: Option<&Path>,
+ ) -> Result<Cargo, Error> {
+ let toml_path = crate_dir.join("Cargo.toml");
+ let metadata =
+ cargo_metadata::metadata(&toml_path, existing_metadata_file, only_target_dependencies)
+ .map_err(|x| Error::CargoMetadata(toml_path.to_str().unwrap().to_owned(), x))?;
+ let lock_path = lock_file
+ .map(PathBuf::from)
+ .unwrap_or_else(|| Path::new(&metadata.workspace_root).join("Cargo.lock"));
+
+ let lock = if use_cargo_lock {
+ match cargo_lock::lock(&lock_path) {
+ Ok(lock) => Some(lock),
+ Err(x) => {
+ warn!("Couldn't load lock file {:?}: {:?}", lock_path, x);
+ None
+ }
+ }
+ } else {
+ None
+ };
+
+ // Use the specified binding crate name or infer it from the manifest
+ let binding_crate_name = match binding_crate_name {
+ Some(s) => s.to_owned(),
+ None => {
+ let manifest = cargo_toml::manifest(&toml_path)
+ .map_err(|x| Error::CargoToml(toml_path.to_str().unwrap().to_owned(), x))?;
+ manifest.package.name
+ }
+ };
+
+ Ok(Cargo {
+ manifest_path: toml_path,
+ binding_crate_name,
+ lock,
+ metadata,
+ clean,
+ })
+ }
+
+ pub(crate) fn binding_crate_name(&self) -> &str {
+ &self.binding_crate_name
+ }
+
+ pub(crate) fn binding_crate_ref(&self) -> PackageRef {
+ match self.find_pkg_to_generate_bindings_ref(&self.binding_crate_name) {
+ Some(pkg_ref) => pkg_ref,
+ None => panic!(
+ "Unable to find {} for {:?}",
+ self.binding_crate_name, self.manifest_path
+ ),
+ }
+ }
+
+ pub(crate) fn dependencies(&self, package: &PackageRef) -> Vec<(PackageRef, Option<Cfg>)> {
+ let lock = match self.lock {
+ Some(ref lock) => lock,
+ None => return vec![],
+ };
+
+ let mut dependencies = None;
+
+ // Find the dependencies listing in the lockfile
+ if let Some(ref root) = lock.root {
+ // If the version is not on the lockfile then it shouldn't be
+ // ambiguous.
+ if root.name == package.name
+ && package
+ .version
+ .as_ref()
+ .map_or(true, |v| *v == root.version)
+ {
+ dependencies = root.dependencies.as_ref();
+ }
+ }
+ if dependencies.is_none() {
+ if let Some(ref lock_packages) = lock.package {
+ for lock_package in lock_packages {
+ if lock_package.name == package.name
+ && package
+ .version
+ .as_ref()
+ .map_or(true, |v| *v == lock_package.version)
+ {
+ dependencies = lock_package.dependencies.as_ref();
+ break;
+ }
+ }
+ }
+ }
+ if dependencies.is_none() {
+ return vec![];
+ }
+
+ dependencies
+ .unwrap()
+ .iter()
+ .map(|dep| {
+ let (dep_name, dep_version) = parse_dep_string(dep);
+
+ // If a version was not specified find the only package with the name of the dependency
+ let dep_version = dep_version.or_else(|| {
+ let mut versions = self.metadata.packages.iter().filter_map(|package| {
+ if package.name_and_version.name != dep_name {
+ return None;
+ }
+ package.name_and_version.version.as_deref()
+ });
+
+ // If the iterator contains more items, meaning multiple versions of the same
+ // package are present, warn! amd abort.
+ let version = versions.next();
+ if versions.next().is_none() {
+ version
+ } else {
+ warn!("when looking for a version for package {}, multiple versions where found", dep_name);
+ None
+ }
+ });
+
+ // Try to find the cfgs in the Cargo.toml
+ let cfg = self
+ .metadata
+ .packages
+ .get(package)
+ .and_then(|meta_package| meta_package.dependencies.get(dep_name))
+ .and_then(Cfg::load_metadata);
+
+ let package_ref = PackageRef {
+ name: dep_name.to_owned(),
+ version: dep_version.map(|v| v.to_owned()),
+ };
+
+ (package_ref, cfg)
+ })
+ .collect()
+ }
+
+ /// Finds the package reference for which we want to generate bindings in `cargo metadata`
+ /// matching on `package_name` and verifying the manifest path matches so that we don't get a
+ /// a dependency with the same name (fix for https://github.com/mozilla/cbindgen/issues/900)
+ fn find_pkg_to_generate_bindings_ref(&self, package_name: &str) -> Option<PackageRef> {
+ // Keep a list of candidates in case the manifest check fails, so that the old behavior
+ // still applies, returning the first package that was found
+ let mut candidates = vec![];
+ for package in &self.metadata.packages {
+ if package.name_and_version.name == package_name {
+ // If we are sure it is the right package return it
+ if Path::new(package.manifest_path.as_str()) == self.manifest_path {
+ return Some(package.name_and_version.clone());
+ }
+ // Otherwise note that a package was found
+ candidates.push(package.name_and_version.clone());
+ }
+ }
+
+ // If we could not verify the manifest path but we found candidates return the first one if
+ // any, this is the old behavior which did not check for manifest path, kept for backwards
+ // compatibility
+ candidates.into_iter().next()
+ }
+
+ /// Finds the directory for a specified package reference.
+ #[allow(unused)]
+ pub(crate) fn find_crate_dir(&self, package: &PackageRef) -> Option<PathBuf> {
+ self.metadata
+ .packages
+ .get(package)
+ .and_then(|meta_package| {
+ Path::new(&meta_package.manifest_path)
+ .parent()
+ .map(|x| x.to_owned())
+ })
+ }
+
+ /// Finds `src/lib.rs` for a specified package reference.
+ pub(crate) fn find_crate_src(&self, package: &PackageRef) -> Option<PathBuf> {
+ let kind_lib = String::from("lib");
+ let kind_staticlib = String::from("staticlib");
+ let kind_rlib = String::from("rlib");
+ let kind_cdylib = String::from("cdylib");
+ let kind_dylib = String::from("dylib");
+
+ self.metadata
+ .packages
+ .get(package)
+ .and_then(|meta_package| {
+ for target in &meta_package.targets {
+ if target.kind.contains(&kind_lib)
+ || target.kind.contains(&kind_staticlib)
+ || target.kind.contains(&kind_rlib)
+ || target.kind.contains(&kind_cdylib)
+ || target.kind.contains(&kind_dylib)
+ {
+ return Some(PathBuf::from(&target.src_path));
+ }
+ }
+ None
+ })
+ }
+
+ pub(crate) fn expand_crate(
+ &self,
+ package: &PackageRef,
+ expand_all_features: bool,
+ expand_default_features: bool,
+ expand_features: &Option<Vec<String>>,
+ profile: Profile,
+ ) -> Result<String, cargo_expand::Error> {
+ cargo_expand::expand(
+ &self.manifest_path,
+ &package.name,
+ package.version.as_deref(),
+ self.clean,
+ expand_all_features,
+ expand_default_features,
+ expand_features,
+ profile,
+ )
+ }
+}
diff --git a/cbindgen-0.24.5/src/bindgen/cargo/cargo_expand.rs b/cbindgen-0.27.0/src/bindgen/cargo/cargo_expand.rs
similarity index 100%
rename from cbindgen-0.24.5/src/bindgen/cargo/cargo_expand.rs
rename to cbindgen-0.27.0/src/bindgen/cargo/cargo_expand.rs
diff --git a/cbindgen-0.27.0/src/bindgen/cargo/cargo_lock.rs b/cbindgen-0.27.0/src/bindgen/cargo/cargo_lock.rs
new file mode 100644
index 0000000..a770ede
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/cargo/cargo_lock.rs
@@ -0,0 +1,53 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::fs::File;
+use std::io;
+use std::io::Read;
+use std::path::Path;
+
+#[derive(Debug)]
+/// Possible errors that can occur during Cargo.toml parsing.
+pub enum Error {
+ /// Error during reading of Cargo.toml
+ #[allow(dead_code)]
+ Io(io::Error),
+ /// Deserialization error
+ #[allow(dead_code)]
+ Toml(toml::de::Error),
+}
+
+impl From<io::Error> for Error {
+ fn from(err: io::Error) -> Self {
+ Error::Io(err)
+ }
+}
+impl From<toml::de::Error> for Error {
+ fn from(err: toml::de::Error) -> Self {
+ Error::Toml(err)
+ }
+}
+
+#[derive(Clone, Deserialize, Debug)]
+pub struct Lock {
+ pub root: Option<Package>,
+ pub package: Option<Vec<Package>>,
+}
+
+#[derive(Clone, Deserialize, Debug)]
+pub struct Package {
+ pub name: String,
+ pub version: String,
+ /// A list of dependencies formatted like "NAME VERSION-OPT REGISTRY-OPT"
+ pub dependencies: Option<Vec<String>>,
+}
+
+/// Parse the Cargo.toml for a given path
+pub fn lock(manifest_path: &Path) -> Result<Lock, Error> {
+ let mut s = String::new();
+ let mut f = File::open(manifest_path)?;
+ f.read_to_string(&mut s)?;
+
+ toml::from_str::<Lock>(&s).map_err(|x| x.into())
+}
diff --git a/cbindgen-0.24.5/src/bindgen/cargo/cargo_metadata.rs b/cbindgen-0.27.0/src/bindgen/cargo/cargo_metadata.rs
similarity index 100%
rename from cbindgen-0.24.5/src/bindgen/cargo/cargo_metadata.rs
rename to cbindgen-0.27.0/src/bindgen/cargo/cargo_metadata.rs
diff --git a/cbindgen-0.24.5/src/bindgen/cargo/cargo_toml.rs b/cbindgen-0.27.0/src/bindgen/cargo/cargo_toml.rs
similarity index 100%
rename from cbindgen-0.24.5/src/bindgen/cargo/cargo_toml.rs
rename to cbindgen-0.27.0/src/bindgen/cargo/cargo_toml.rs
diff --git a/cbindgen-0.24.5/src/bindgen/cargo/mod.rs b/cbindgen-0.27.0/src/bindgen/cargo/mod.rs
similarity index 100%
rename from cbindgen-0.24.5/src/bindgen/cargo/mod.rs
rename to cbindgen-0.27.0/src/bindgen/cargo/mod.rs
diff --git a/cbindgen-0.27.0/src/bindgen/cdecl.rs b/cbindgen-0.27.0/src/bindgen/cdecl.rs
new file mode 100644
index 0000000..3ba543a
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/cdecl.rs
@@ -0,0 +1,401 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::io::Write;
+
+use crate::bindgen::config::Layout;
+use crate::bindgen::declarationtyperesolver::DeclarationType;
+use crate::bindgen::ir::{ConstExpr, Function, GenericArgument, Type};
+use crate::bindgen::language_backend::LanguageBackend;
+use crate::bindgen::writer::{ListType, SourceWriter};
+use crate::bindgen::{Config, Language};
+
+// This code is for translating Rust types into C declarations.
+// See Section 6.7, Declarations, in the C standard for background.
+// http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
+
+enum CDeclarator {
+ Ptr {
+ is_const: bool,
+ is_nullable: bool,
+ is_ref: bool,
+ },
+ Array(String),
+ Func {
+ args: Vec<(Option<String>, CDecl)>,
+ layout: Layout,
+ never_return: bool,
+ },
+}
+
+impl CDeclarator {
+ fn is_ptr(&self) -> bool {
+ matches!(self, CDeclarator::Ptr { .. } | CDeclarator::Func { .. })
+ }
+}
+
+struct CDecl {
+ type_qualifers: String,
+ type_name: String,
+ type_generic_args: Vec<GenericArgument>,
+ declarators: Vec<CDeclarator>,
+ type_ctype: Option<DeclarationType>,
+ deprecated: Option<String>,
+}
+
+impl CDecl {
+ fn new() -> CDecl {
+ CDecl {
+ type_qualifers: String::new(),
+ type_name: String::new(),
+ type_generic_args: Vec::new(),
+ declarators: Vec::new(),
+ type_ctype: None,
+ deprecated: None,
+ }
+ }
+
+ fn from_type(t: &Type, config: &Config) -> CDecl {
+ let mut cdecl = CDecl::new();
+ cdecl.build_type(t, false, config);
+ cdecl
+ }
+
+ fn from_func_arg(t: &Type, array_length: Option<&str>, config: &Config) -> CDecl {
+ let mut cdecl = CDecl::new();
+ let length = match array_length {
+ Some(l) => l,
+ None => return CDecl::from_type(t, config),
+ };
+ let (ty, is_const) = match t {
+ Type::Ptr { ty, is_const, .. } => (ty, is_const),
+ _ => unreachable!(
+ "Should never have an array length for a non pointer type {:?}",
+ t
+ ),
+ };
+ let ptr_as_array = Type::Array(ty.clone(), ConstExpr::Value(length.to_string()));
+ cdecl.build_type(&ptr_as_array, *is_const, config);
+ cdecl
+ }
+
+ fn from_func(f: &Function, layout: Layout, config: &Config) -> CDecl {
+ let mut cdecl = CDecl::new();
+ cdecl.build_func(f, layout, config);
+ cdecl
+ }
+
+ fn build_func(&mut self, f: &Function, layout: Layout, config: &Config) {
+ let args = f
+ .args
+ .iter()
+ .map(|arg| {
+ (
+ arg.name.clone(),
+ CDecl::from_func_arg(&arg.ty, arg.array_length.as_deref(), config),
+ )
+ })
+ .collect();
+ self.declarators.push(CDeclarator::Func {
+ args,
+ layout,
+ never_return: f.never_return,
+ });
+ self.deprecated.clone_from(&f.annotations.deprecated);
+ self.build_type(&f.ret, false, config);
+ }
+
+ fn build_type(&mut self, t: &Type, is_const: bool, config: &Config) {
+ match t {
+ Type::Path(ref generic) => {
+ if is_const {
+ assert!(
+ self.type_qualifers.is_empty(),
+ "error generating cdecl for {:?}",
+ t
+ );
+ "const".clone_into(&mut self.type_qualifers);
+ }
+
+ assert!(
+ self.type_name.is_empty(),
+ "error generating cdecl for {:?}",
+ t
+ );
+ generic.export_name().clone_into(&mut self.type_name);
+ assert!(
+ self.type_generic_args.is_empty(),
+ "error generating cdecl for {:?}",
+ t
+ );
+ generic.generics().clone_into(&mut self.type_generic_args);
+ self.type_ctype = generic.ctype().cloned();
+ }
+ Type::Primitive(ref p) => {
+ if is_const {
+ assert!(
+ self.type_qualifers.is_empty(),
+ "error generating cdecl for {:?}",
+ t
+ );
+ "const".clone_into(&mut self.type_qualifers);
+ }
+
+ assert!(
+ self.type_name.is_empty(),
+ "error generating cdecl for {:?}",
+ t
+ );
+ self.type_name = p.to_repr_c(config).to_string();
+ }
+ Type::Ptr {
+ ref ty,
+ is_nullable,
+ is_const: ptr_is_const,
+ is_ref,
+ } => {
+ self.declarators.push(CDeclarator::Ptr {
+ is_const,
+ is_nullable: *is_nullable,
+ is_ref: *is_ref,
+ });
+ self.build_type(ty, *ptr_is_const, config);
+ }
+ Type::Array(ref t, ref constant) => {
+ let len = constant.as_str().to_owned();
+ self.declarators.push(CDeclarator::Array(len));
+ self.build_type(t, is_const, config);
+ }
+ Type::FuncPtr {
+ ref ret,
+ ref args,
+ is_nullable: _,
+ never_return,
+ } => {
+ let args = args
+ .iter()
+ .map(|(ref name, ref ty)| (name.clone(), CDecl::from_type(ty, config)))
+ .collect();
+ self.declarators.push(CDeclarator::Ptr {
+ is_const: false,
+ is_nullable: true,
+ is_ref: false,
+ });
+ self.declarators.push(CDeclarator::Func {
+ args,
+ layout: config.function.args,
+ never_return: *never_return,
+ });
+ self.build_type(ret, false, config);
+ }
+ }
+ }
+
+ fn write<F: Write, LB: LanguageBackend>(
+ &self,
+ language_backend: &mut LB,
+ out: &mut SourceWriter<F>,
+ ident: Option<&str>,
+ config: &Config,
+ ) {
+ // Write the type-specifier and type-qualifier first
+ if !self.type_qualifers.is_empty() {
+ write!(out, "{} ", self.type_qualifers);
+ }
+
+ if config.language != Language::Cython {
+ if let Some(ref ctype) = self.type_ctype {
+ write!(out, "{} ", ctype.to_str());
+ }
+ }
+
+ write!(out, "{}", self.type_name);
+
+ if !self.type_generic_args.is_empty() {
+ out.write("<");
+ out.write_horizontal_source_list(
+ language_backend,
+ &self.type_generic_args,
+ ListType::Join(", "),
+ |language_backend, out, g| match *g {
+ GenericArgument::Type(ref ty) => language_backend.write_type(out, ty),
+ GenericArgument::Const(ref expr) => write!(out, "{}", expr.as_str()),
+ },
+ );
+ out.write(">");
+ }
+
+ // When we have an identifier, put a space between the type and the declarators
+ if ident.is_some() {
+ out.write(" ");
+ }
+
+ // Write the left part of declarators before the identifier
+ let mut iter_rev = self.declarators.iter().rev().peekable();
+
+ #[allow(clippy::while_let_on_iterator)]
+ while let Some(declarator) = iter_rev.next() {
+ let next_is_pointer = iter_rev.peek().map_or(false, |x| x.is_ptr());
+
+ match *declarator {
+ CDeclarator::Ptr {
+ is_const,
+ is_nullable,
+ is_ref,
+ } => {
+ out.write(if is_ref { "&" } else { "*" });
+ if is_const {
+ out.write("const ");
+ }
+ if !is_nullable && !is_ref && config.language != Language::Cython {
+ if let Some(attr) = &config.pointer.non_null_attribute {
+ write!(out, "{} ", attr);
+ }
+ }
+ }
+ CDeclarator::Array(..) => {
+ if next_is_pointer {
+ out.write("(");
+ }
+ }
+ CDeclarator::Func { .. } => {
+ if next_is_pointer {
+ out.write("(");
+ }
+ }
+ }
+ }
+
+ // Write the identifier
+ if let Some(ident) = ident {
+ write!(out, "{}", ident);
+ }
+
+ // Write the right part of declarators after the identifier
+ let mut iter = self.declarators.iter();
+ let mut last_was_pointer = false;
+
+ #[allow(clippy::while_let_on_iterator)]
+ while let Some(declarator) = iter.next() {
+ match *declarator {
+ CDeclarator::Ptr { .. } => {
+ last_was_pointer = true;
+ }
+ CDeclarator::Array(ref constant) => {
+ if last_was_pointer {
+ out.write(")");
+ }
+ write!(out, "[{}]", constant);
+
+ last_was_pointer = false;
+ }
+ CDeclarator::Func {
+ ref args,
+ ref layout,
+ never_return,
+ } => {
+ if last_was_pointer {
+ out.write(")");
+ }
+
+ out.write("(");
+ if args.is_empty() && config.language == Language::C {
+ out.write("void");
+ }
+
+ fn write_vertical<F: Write, LB: LanguageBackend>(
+ language_backend: &mut LB,
+ out: &mut SourceWriter<F>,
+ config: &Config,
+ args: &[(Option<String>, CDecl)],
+ ) {
+ let align_length = out.line_length_for_align();
+ out.push_set_spaces(align_length);
+ for (i, (arg_ident, arg_ty)) in args.iter().enumerate() {
+ if i != 0 {
+ out.write(",");
+ out.new_line();
+ }
+
+ // Convert &Option<String> to Option<&str>
+ let arg_ident = arg_ident.as_ref().map(|x| x.as_ref());
+
+ arg_ty.write(language_backend, out, arg_ident, config);
+ }
+ out.pop_tab();
+ }
+
+ fn write_horizontal<F: Write, LB: LanguageBackend>(
+ language_backend: &mut LB,
+ out: &mut SourceWriter<F>,
+ config: &Config,
+ args: &[(Option<String>, CDecl)],
+ ) {
+ for (i, (arg_ident, arg_ty)) in args.iter().enumerate() {
+ if i != 0 {
+ out.write(", ");
+ }
+
+ // Convert &Option<String> to Option<&str>
+ let arg_ident = arg_ident.as_ref().map(|x| x.as_ref());
+
+ arg_ty.write(language_backend, out, arg_ident, config);
+ }
+ }
+
+ match layout {
+ Layout::Vertical => write_vertical(language_backend, out, config, args),
+ Layout::Horizontal => write_horizontal(language_backend, out, config, args),
+ Layout::Auto => {
+ if !out.try_write(
+ |out| write_horizontal(language_backend, out, config, args),
+ config.line_length,
+ ) {
+ write_vertical(language_backend, out, config, args)
+ }
+ }
+ }
+ out.write(")");
+
+ if never_return && config.language != Language::Cython {
+ if let Some(ref no_return_attr) = config.function.no_return {
+ out.write_fmt(format_args!(" {}", no_return_attr));
+ }
+ }
+
+ last_was_pointer = true;
+ }
+ }
+ }
+ }
+}
+
+pub fn write_func<F: Write, LB: LanguageBackend>(
+ language_backend: &mut LB,
+ out: &mut SourceWriter<F>,
+ f: &Function,
+ layout: Layout,
+ config: &Config,
+) {
+ CDecl::from_func(f, layout, config).write(language_backend, out, Some(f.path().name()), config);
+}
+
+pub fn write_field<F: Write, LB: LanguageBackend>(
+ language_backend: &mut LB,
+ out: &mut SourceWriter<F>,
+ t: &Type,
+ ident: &str,
+ config: &Config,
+) {
+ CDecl::from_type(t, config).write(language_backend, out, Some(ident), config);
+}
+
+pub fn write_type<F: Write, LB: LanguageBackend>(
+ language_backend: &mut LB,
+ out: &mut SourceWriter<F>,
+ t: &Type,
+ config: &Config,
+) {
+ CDecl::from_type(t, config).write(language_backend, out, None, config);
+}
diff --git a/cbindgen-0.27.0/src/bindgen/config.rs b/cbindgen-0.27.0/src/bindgen/config.rs
new file mode 100644
index 0000000..3131650
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/config.rs
@@ -0,0 +1,1130 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::collections::{BTreeMap, HashMap};
+use std::default::Default;
+use std::str::FromStr;
+use std::{fmt, fs, path::Path as StdPath, path::PathBuf as StdPathBuf};
+
+use serde::de::value::{MapAccessDeserializer, SeqAccessDeserializer};
+use serde::de::{Deserialize, Deserializer, MapAccess, SeqAccess, Visitor};
+
+use crate::bindgen::ir::annotation::AnnotationSet;
+use crate::bindgen::ir::path::Path;
+use crate::bindgen::ir::repr::ReprAlign;
+pub use crate::bindgen::rename::RenameRule;
+
+pub const VERSION: &str = env!("CARGO_PKG_VERSION");
+
+/// A language type to generate bindings for.
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+pub enum Language {
+ Cxx,
+ C,
+ Cython,
+}
+
+impl FromStr for Language {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<Language, Self::Err> {
+ match s {
+ "cxx" => Ok(Language::Cxx),
+ "Cxx" => Ok(Language::Cxx),
+ "CXX" => Ok(Language::Cxx),
+ "cpp" => Ok(Language::Cxx),
+ "Cpp" => Ok(Language::Cxx),
+ "CPP" => Ok(Language::Cxx),
+ "c++" => Ok(Language::Cxx),
+ "C++" => Ok(Language::Cxx),
+ "c" => Ok(Language::C),
+ "C" => Ok(Language::C),
+ "cython" => Ok(Language::Cython),
+ "Cython" => Ok(Language::Cython),
+ _ => Err(format!("Unrecognized Language: '{}'.", s)),
+ }
+ }
+}
+
+deserialize_enum_str!(Language);
+
+impl Language {
+ pub(crate) fn typedef(self) -> &'static str {
+ match self {
+ Language::Cxx | Language::C => "typedef",
+ Language::Cython => "ctypedef",
+ }
+ }
+}
+
+/// Controls what type of line endings are used in the generated code.
+#[derive(Debug, Clone, Copy)]
+#[allow(clippy::upper_case_acronyms)]
+#[derive(Default)]
+pub enum LineEndingStyle {
+ /// Use Unix-style linefeed characters
+ #[default]
+ LF,
+ /// Use classic Mac-style carriage-return characters
+ CR,
+ /// Use Windows-style carriage-return and linefeed characters
+ CRLF,
+ /// Use the native mode for the platform: CRLF on Windows, LF everywhere else.
+ Native,
+}
+
+impl LineEndingStyle {
+ pub fn as_str(&self) -> &'static str {
+ match self {
+ Self::LF => "\n",
+ Self::CR => "\r",
+ Self::CRLF => "\r\n",
+ Self::Native => {
+ #[cfg(target_os = "windows")]
+ {
+ Self::CRLF.as_str()
+ }
+ #[cfg(not(target_os = "windows"))]
+ {
+ Self::LF.as_str()
+ }
+ }
+ }
+ }
+}
+
+impl FromStr for LineEndingStyle {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ match s.to_lowercase().as_ref() {
+ "native" => Ok(Self::Native),
+ "lf" => Ok(Self::LF),
+ "crlf" => Ok(Self::CRLF),
+ "cr" => Ok(Self::CR),
+ _ => Err(format!("Unrecognized line ending style: '{}'.", s)),
+ }
+ }
+}
+
+deserialize_enum_str!(LineEndingStyle);
+
+/// A style of braces to use for generating code.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub enum Braces {
+ SameLine,
+ NextLine,
+}
+
+impl FromStr for Braces {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<Braces, Self::Err> {
+ match s {
+ "SameLine" => Ok(Braces::SameLine),
+ "same_line" => Ok(Braces::SameLine),
+ "NextLine" => Ok(Braces::NextLine),
+ "next_line" => Ok(Braces::NextLine),
+ _ => Err(format!("Unrecognized Braces: '{}'.", s)),
+ }
+ }
+}
+
+deserialize_enum_str!(Braces);
+
+/// A type of layout to use when generating long lines of code.
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+pub enum Layout {
+ Horizontal,
+ Vertical,
+ Auto,
+}
+
+impl FromStr for Layout {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<Layout, Self::Err> {
+ match s {
+ "Horizontal" => Ok(Layout::Horizontal),
+ "horizontal" => Ok(Layout::Horizontal),
+ "Vertical" => Ok(Layout::Vertical),
+ "vertical" => Ok(Layout::Vertical),
+ "Auto" => Ok(Layout::Auto),
+ "auto" => Ok(Layout::Auto),
+ _ => Err(format!("Unrecognized Layout: '{}'.", s)),
+ }
+ }
+}
+
+deserialize_enum_str!(Layout);
+
+/// How the comments containing documentation should be styled.
+#[derive(Debug, Clone, PartialEq, Eq, Copy)]
+pub enum DocumentationStyle {
+ C,
+ C99,
+ Doxy,
+ Cxx,
+ Auto,
+}
+
+impl FromStr for DocumentationStyle {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<DocumentationStyle, Self::Err> {
+ match s.to_lowercase().as_ref() {
+ "c" => Ok(DocumentationStyle::C),
+ "c99" => Ok(DocumentationStyle::C99),
+ "cxx" => Ok(DocumentationStyle::Cxx),
+ "c++" => Ok(DocumentationStyle::Cxx),
+ "doxy" => Ok(DocumentationStyle::Doxy),
+ "auto" => Ok(DocumentationStyle::Auto),
+ _ => Err(format!("Unrecognized documentation style: '{}'.", s)),
+ }
+ }
+}
+
+deserialize_enum_str!(DocumentationStyle);
+
+/// How much of the documentation to include in the header file.
+#[derive(Debug, Clone, Copy)]
+pub enum DocumentationLength {
+ Short,
+ Full,
+}
+
+impl FromStr for DocumentationLength {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<DocumentationLength, Self::Err> {
+ match s.to_lowercase().as_ref() {
+ "short" => Ok(DocumentationLength::Short),
+ "full" => Ok(DocumentationLength::Full),
+ _ => Err(format!("Unrecognized documentation style: '{}'.", s)),
+ }
+ }
+}
+
+deserialize_enum_str!(DocumentationLength);
+
+/// A style of Style to use when generating structs and enums.
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
+pub enum Style {
+ #[default]
+ Both,
+ Tag,
+ Type,
+}
+
+impl Style {
+ pub fn generate_tag(self) -> bool {
+ match self {
+ Style::Both | Style::Tag => true,
+ Style::Type => false,
+ }
+ }
+
+ pub fn generate_typedef(self) -> bool {
+ match self {
+ Style::Both | Style::Type => true,
+ Style::Tag => false,
+ }
+ }
+
+ // https://cython.readthedocs.io/en/latest/src/userguide/external_C_code.html#styles-of-struct-union-and-enum-declaration
+ pub fn cython_def(self) -> &'static str {
+ if self.generate_tag() {
+ "cdef "
+ } else {
+ "ctypedef "
+ }
+ }
+}
+
+impl FromStr for Style {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<Style, Self::Err> {
+ match s {
+ "Both" => Ok(Style::Both),
+ "both" => Ok(Style::Both),
+ "Tag" => Ok(Style::Tag),
+ "tag" => Ok(Style::Tag),
+ "Type" => Ok(Style::Type),
+ "type" => Ok(Style::Type),
+ _ => Err(format!("Unrecognized Style: '{}'.", s)),
+ }
+ }
+}
+
+deserialize_enum_str!(Style);
+
+/// Different item types that we can generate and filter.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub enum ItemType {
+ Constants,
+ Globals,
+ Enums,
+ Structs,
+ Unions,
+ Typedefs,
+ OpaqueItems,
+ Functions,
+}
+
+impl FromStr for ItemType {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ use self::ItemType::*;
+ Ok(match &*s.to_lowercase() {
+ "constants" => Constants,
+ "globals" => Globals,
+ "enums" => Enums,
+ "structs" => Structs,
+ "unions" => Unions,
+ "typedefs" => Typedefs,
+ "opaque" => OpaqueItems,
+ "functions" => Functions,
+ _ => return Err(format!("Unrecognized Style: '{}'.", s)),
+ })
+ }
+}
+
+deserialize_enum_str!(ItemType);
+
+/// Type which specifies the sort order of functions
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum SortKey {
+ Name,
+ None,
+}
+
+impl FromStr for SortKey {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ use self::SortKey::*;
+ Ok(match &*s.to_lowercase() {
+ "name" => Name,
+ "none" => None,
+ _ => return Err(format!("Unrecognized sort option: '{}'.", s)),
+ })
+ }
+}
+
+deserialize_enum_str!(SortKey);
+
+/// Settings to apply when exporting items.
+#[derive(Debug, Clone, Deserialize, Default)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+#[serde(default)]
+pub struct ExportConfig {
+ /// A list of additional items not used by exported functions to include in
+ /// the generated bindings
+ pub include: Vec<String>,
+ /// A list of items to not include in the generated bindings
+ pub exclude: Vec<String>,
+ /// Table of name conversions to apply to item names
+ pub rename: HashMap<String, String>,
+ /// Table of raw strings to prepend to the body of items.
+ pub pre_body: HashMap<String, String>,
+ /// Table of raw strings to append to the body of items.
+ pub body: HashMap<String, String>,
+ /// A prefix to add before the name of every item
+ pub prefix: Option<String>,
+ /// Types of items to generate.
+ pub item_types: Vec<ItemType>,
+ /// Whether renaming overrides or extends prefixing.
+ pub renaming_overrides_prefixing: bool,
+ /// Mangling configuration.
+ pub mangle: MangleConfig,
+}
+
+/// Mangling-specific configuration.
+#[derive(Debug, Clone, Deserialize, Default)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+#[serde(default)]
+pub struct MangleConfig {
+ /// The rename rule to apply to the type names mangled.
+ pub rename_types: RenameRule,
+ /// Remove the underscores used for name mangling.
+ pub remove_underscores: bool,
+}
+
+impl ExportConfig {
+ pub(crate) fn should_generate(&self, item_type: ItemType) -> bool {
+ self.item_types.is_empty() || self.item_types.contains(&item_type)
+ }
+
+ pub(crate) fn pre_body(&self, path: &Path) -> Option<&str> {
+ self.pre_body.get(path.name()).map(|s| s.trim_matches('\n'))
+ }
+
+ pub(crate) fn post_body(&self, path: &Path) -> Option<&str> {
+ self.body.get(path.name()).map(|s| s.trim_matches('\n'))
+ }
+
+ pub(crate) fn rename(&self, item_name: &mut String) {
+ if let Some(name) = self.rename.get(item_name) {
+ item_name.clone_from(name);
+ if self.renaming_overrides_prefixing {
+ return;
+ }
+ }
+ if let Some(ref prefix) = self.prefix {
+ item_name.insert_str(0, prefix);
+ }
+ }
+}
+
+/// Settings to apply to generated types with layout modifiers.
+#[derive(Debug, Default, Clone, Deserialize)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+#[serde(default)]
+pub struct LayoutConfig {
+ /// The way to annotate C types as #[repr(packed)].
+ pub packed: Option<String>,
+ /// The way to annotate C types as #[repr(align(...))]. This is assumed to be a functional
+ /// macro which takes a single argument (the alignment).
+ pub aligned_n: Option<String>,
+}
+
+impl LayoutConfig {
+ pub(crate) fn ensure_safe_to_represent(&self, align: &ReprAlign) -> Result<(), String> {
+ match (align, &self.packed, &self.aligned_n) {
+ (ReprAlign::Packed, None, _) => Err("Cannot safely represent #[repr(packed)] type without configured 'packed' annotation.".to_string()),
+ (ReprAlign::Align(_), _, None) => Err("Cannot safely represent #[repr(aligned(...))] type without configured 'aligned_n' annotation.".to_string()),
+ _ => Ok(()),
+ }
+ }
+}
+
+/// Settings to apply to generated functions.
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+#[serde(default)]
+pub struct FunctionConfig {
+ /// Optional text to output before each function declaration
+ pub prefix: Option<String>,
+ /// Optional text to output after each function declaration
+ pub postfix: Option<String>,
+ /// The way to annotation this function as #[must_use]
+ pub must_use: Option<String>,
+ /// The way to annotation this function as #[deprecated] without notes
+ pub deprecated: Option<String>,
+ /// The way to annotation this function as #[deprecated] with notes
+ pub deprecated_with_note: Option<String>,
+ /// The style to layout the args
+ pub args: Layout,
+ /// The rename rule to apply to function args
+ pub rename_args: RenameRule,
+ /// An optional macro to use when generating Swift function name attributes
+ pub swift_name_macro: Option<String>,
+ /// Sort key for functions
+ pub sort_by: Option<SortKey>,
+ /// Optional text to output after functions which return `!`.
+ pub no_return: Option<String>,
+}
+
+impl Default for FunctionConfig {
+ fn default() -> FunctionConfig {
+ FunctionConfig {
+ prefix: None,
+ postfix: None,
+ must_use: None,
+ deprecated: None,
+ deprecated_with_note: None,
+ args: Layout::Auto,
+ rename_args: RenameRule::None,
+ swift_name_macro: None,
+ sort_by: None,
+ no_return: None,
+ }
+ }
+}
+
+impl FunctionConfig {
+ pub(crate) fn prefix(&self, annotations: &AnnotationSet) -> Option<String> {
+ if let Some(x) = annotations.atom("prefix") {
+ return x;
+ }
+ self.prefix.clone()
+ }
+
+ pub(crate) fn postfix(&self, annotations: &AnnotationSet) -> Option<String> {
+ if let Some(x) = annotations.atom("postfix") {
+ return x;
+ }
+ self.postfix.clone()
+ }
+}
+
+/// Settings to apply to generated structs.
+#[derive(Debug, Default, Clone, Deserialize)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+#[serde(default)]
+pub struct StructConfig {
+ /// The rename rule to apply to the name of struct fields
+ pub rename_fields: RenameRule,
+ /// Whether to generate a constructor for the struct (which takes
+ /// arguments to initialize all the members)
+ pub derive_constructor: bool,
+ /// Whether to generate a piecewise equality operator
+ pub derive_eq: bool,
+ /// Whether to generate a piecewise inequality operator
+ pub derive_neq: bool,
+ /// Whether to generate a less than operator on structs with one field
+ pub derive_lt: bool,
+ /// Whether to generate a less than or equal to operator on structs with one field
+ pub derive_lte: bool,
+ /// Whether to generate a greater than operator on structs with one field
+ pub derive_gt: bool,
+ /// Whether to generate a greater than or equal to operator on structs with one field
+ pub derive_gte: bool,
+ /// Whether to generate a ostream serializer for the struct
+ pub derive_ostream: bool,
+ /// Whether associated constants should be in the body. Only applicable to
+ /// non-transparent structs, and in C++-only.
+ pub associated_constants_in_body: bool,
+ /// The way to annotate this struct as #[must_use].
+ pub must_use: Option<String>,
+ /// The way to annotation this function as #[deprecated] without notes
+ pub deprecated: Option<String>,
+ /// The way to annotation this function as #[deprecated] with notes
+ pub deprecated_with_note: Option<String>,
+}
+
+impl StructConfig {
+ pub(crate) fn derive_constructor(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-constructor") {
+ return x;
+ }
+ self.derive_constructor
+ }
+ pub(crate) fn derive_eq(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-eq") {
+ return x;
+ }
+ self.derive_eq
+ }
+ pub(crate) fn derive_neq(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-neq") {
+ return x;
+ }
+ self.derive_neq
+ }
+ pub(crate) fn derive_lt(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-lt") {
+ return x;
+ }
+ self.derive_lt
+ }
+ pub(crate) fn derive_lte(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-lte") {
+ return x;
+ }
+ self.derive_lte
+ }
+ pub(crate) fn derive_gt(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-gt") {
+ return x;
+ }
+ self.derive_gt
+ }
+ pub(crate) fn derive_gte(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-gte") {
+ return x;
+ }
+ self.derive_gte
+ }
+ pub(crate) fn derive_ostream(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-ostream") {
+ return x;
+ }
+ self.derive_ostream
+ }
+}
+
+/// Settings to apply to generated enums.
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+#[serde(default)]
+pub struct EnumConfig {
+ /// The rename rule to apply to the name of enum variants
+ pub rename_variants: RenameRule,
+ /// The rename rule to apply to the names of the union fields in C/C++
+ /// generated from the Rust enum. Applied before rename_variants
+ /// rename rule. Defaults to SnakeCase.
+ pub rename_variant_name_fields: RenameRule,
+ /// Whether to add a `Sentinel` value at the end of every enum
+ /// This is useful in Gecko for IPC serialization
+ pub add_sentinel: bool,
+ /// Whether the enum variants should be prefixed with the enum name
+ pub prefix_with_name: bool,
+ /// Whether to generate static `::X(..)` constructors and `IsX()`
+ /// methods for tagged enums.
+ pub derive_helper_methods: bool,
+ /// Whether to generate `AsX() const` methods for tagged enums.
+ pub derive_const_casts: bool,
+ /// Whether to generate `AsX()` methods for tagged enums.
+ pub derive_mut_casts: bool,
+ /// The name of the macro to use for `derive_{const,mut}casts`. If custom, you're
+ /// responsible to provide the necessary header, otherwise `assert` will be
+ /// used, and `<cassert>` will be included.
+ pub cast_assert_name: Option<String>,
+ /// The way to annotation this enum as #[must_use].
+ pub must_use: Option<String>,
+ /// The way to annotation this function as #[deprecated] without notes
+ pub deprecated: Option<String>,
+ /// The way to annotation this function as #[deprecated] with notes
+ pub deprecated_with_note: Option<String>,
+ /// The way to annotate this enum variant as #[deprecated] without notes
+ pub deprecated_variant: Option<String>,
+ /// The way to annotate this enum variant as #[deprecated] with notes
+ pub deprecated_variant_with_note: Option<String>,
+ /// Whether to generate destructors of tagged enums.
+ pub derive_tagged_enum_destructor: bool,
+ /// Whether to generate copy-constructors of tagged enums.
+ pub derive_tagged_enum_copy_constructor: bool,
+ /// Whether to generate copy-assignment operators of tagged enums.
+ ///
+ /// This is only generated if a copy constructor for the same tagged enum is
+ /// generated as well.
+ pub derive_tagged_enum_copy_assignment: bool,
+ /// Whether to generate a ostream serializer for the struct
+ pub derive_ostream: bool,
+ /// Declare the enum as an enum class.
+ /// Only relevant when targeting C++.
+ pub enum_class: bool,
+ /// Whether to generate empty, private default-constructors for tagged
+ /// enums.
+ pub private_default_tagged_enum_constructor: bool,
+}
+
+impl Default for EnumConfig {
+ fn default() -> EnumConfig {
+ EnumConfig {
+ rename_variants: RenameRule::None,
+ rename_variant_name_fields: RenameRule::SnakeCase,
+ add_sentinel: false,
+ prefix_with_name: false,
+ derive_helper_methods: false,
+ derive_const_casts: false,
+ derive_mut_casts: false,
+ cast_assert_name: None,
+ must_use: None,
+ deprecated: None,
+ deprecated_with_note: None,
+ deprecated_variant: None,
+ deprecated_variant_with_note: None,
+ derive_tagged_enum_destructor: false,
+ derive_tagged_enum_copy_constructor: false,
+ derive_tagged_enum_copy_assignment: false,
+ derive_ostream: false,
+ enum_class: true,
+ private_default_tagged_enum_constructor: false,
+ }
+ }
+}
+
+impl EnumConfig {
+ pub(crate) fn add_sentinel(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("add-sentinel") {
+ return x;
+ }
+ self.add_sentinel
+ }
+ pub(crate) fn derive_helper_methods(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-helper-methods") {
+ return x;
+ }
+ self.derive_helper_methods
+ }
+ pub(crate) fn derive_const_casts(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-const-casts") {
+ return x;
+ }
+ self.derive_const_casts
+ }
+ pub(crate) fn derive_mut_casts(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-mut-casts") {
+ return x;
+ }
+ self.derive_mut_casts
+ }
+ pub(crate) fn derive_tagged_enum_destructor(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-tagged-enum-destructor") {
+ return x;
+ }
+ self.derive_tagged_enum_destructor
+ }
+ pub(crate) fn derive_tagged_enum_copy_constructor(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-tagged-enum-copy-constructor") {
+ return x;
+ }
+ self.derive_tagged_enum_copy_constructor
+ }
+ pub(crate) fn derive_tagged_enum_copy_assignment(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-tagged-enum-copy-assignment") {
+ return x;
+ }
+ self.derive_tagged_enum_copy_assignment
+ }
+ pub(crate) fn derive_ostream(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("derive-ostream") {
+ return x;
+ }
+ self.derive_ostream
+ }
+ pub(crate) fn enum_class(&self, annotations: &AnnotationSet) -> bool {
+ if let Some(x) = annotations.bool("enum-class") {
+ return x;
+ }
+ self.enum_class
+ }
+ pub(crate) fn private_default_tagged_enum_constructor(
+ &self,
+ annotations: &AnnotationSet,
+ ) -> bool {
+ if let Some(x) = annotations.bool("private-default-tagged-enum-constructor") {
+ return x;
+ }
+ self.private_default_tagged_enum_constructor
+ }
+}
+
+/// Settings to apply to generated constants.
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+#[serde(default)]
+pub struct ConstantConfig {
+ /// Whether a generated constant can be a static const in C++ mode.
+ pub allow_static_const: bool,
+ /// Whether a generated constant should be constexpr in C++ mode.
+ pub allow_constexpr: bool,
+ /// Sort key for constants
+ pub sort_by: Option<SortKey>,
+}
+
+impl Default for ConstantConfig {
+ fn default() -> ConstantConfig {
+ ConstantConfig {
+ allow_static_const: true,
+ allow_constexpr: true,
+ sort_by: None,
+ }
+ }
+}
+
+/// Settings for custom macro expansion.
+#[derive(Debug, Clone, Deserialize, Default)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+#[serde(default)]
+pub struct MacroExpansionConfig {
+ /// Whether the `bitflags` macro should be expanded.
+ pub bitflags: bool,
+}
+
+/// Controls which Cargo profile is used for macro expansion.
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+pub enum Profile {
+ Debug,
+ Release,
+}
+
+impl FromStr for Profile {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<Profile, Self::Err> {
+ match s {
+ "debug" | "Debug" => Ok(Profile::Debug),
+ "release" | "Release" => Ok(Profile::Release),
+ _ => Err(format!("Unrecognized Profile: '{}'.", s)),
+ }
+ }
+}
+
+deserialize_enum_str!(Profile);
+
+/// Settings to apply when running `rustc -Zunpretty=expanded`
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+#[serde(default)]
+pub struct ParseExpandConfig {
+ /// The names of crates to parse with `rustc -Zunpretty=expanded`
+ pub crates: Vec<String>,
+ /// Whether to enable all the features when expanding.
+ pub all_features: bool,
+ /// Whether to use the default feature set when expanding.
+ pub default_features: bool,
+ /// List of features to use when expanding. Combines with `default_features` like in
+ /// `Cargo.toml`.
+ pub features: Option<Vec<String>>,
+ /// Controls whether or not to pass `--release` when expanding.
+ pub profile: Profile,
+}
+
+impl Default for ParseExpandConfig {
+ fn default() -> ParseExpandConfig {
+ ParseExpandConfig {
+ crates: Vec::new(),
+ all_features: false,
+ default_features: true,
+ features: None,
+ profile: Profile::Debug,
+ }
+ }
+}
+
+// Backwards-compatibility deserializer for ParseExpandConfig. This allows accepting both the
+// simple `expand = ["crate"]` and the more complex `expand = {"crates": ["crate"],
+// "default_features": false}` format for the `expand` key.
+//
+// Note that one (major) difference between the two forms is that, for backwards-compatibility
+// reasons, the `expand = ["crate"]` form will enable the `--all-features` flag by default while
+// the `expand = {"crates": ["crate"]}` form will use the default feature set by default.
+fn retrocomp_parse_expand_config_deserialize<'de, D: Deserializer<'de>>(
+ deserializer: D,
+) -> Result<ParseExpandConfig, D::Error> {
+ struct ParseExpandVisitor;
+
+ impl<'de> Visitor<'de> for ParseExpandVisitor {
+ type Value = ParseExpandConfig;
+
+ fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("a map or sequence of string")
+ }
+
+ fn visit_seq<A: SeqAccess<'de>>(self, seq: A) -> Result<Self::Value, A::Error> {
+ let crates =
+ <Vec<String> as Deserialize>::deserialize(SeqAccessDeserializer::new(seq))?;
+ Ok(ParseExpandConfig {
+ crates,
+ all_features: true,
+ default_features: true,
+ features: None,
+ profile: Profile::Debug,
+ })
+ }
+
+ fn visit_map<A: MapAccess<'de>>(self, map: A) -> Result<Self::Value, A::Error> {
+ <ParseExpandConfig as Deserialize>::deserialize(MapAccessDeserializer::new(map))
+ }
+ }
+
+ deserializer.deserialize_any(ParseExpandVisitor)
+}
+
+/// Settings to apply when parsing.
+#[derive(Debug, Default, Clone, Deserialize)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+#[serde(default)]
+pub struct ParseConfig {
+ /// Whether to parse dependencies when generating bindings. When this is true,
+ /// each dependent crate is found using a combination of `cargo metadata` and
+ /// `Cargo.lock`. To further control this behavior, crates can be whitelisted or
+ /// blacklisted using `include` and `exclude` respectively. Additionally in cases
+ /// where crates have types to expose in bindings hidden in macros, a crate can
+ /// be marked in `expand` and `cargo expand` will be used to expand the macros
+ /// before parsing. A crate marked in `expand` doesn't need to be added to any
+ /// whitelist.
+ pub parse_deps: bool,
+ /// An optional whitelist of names of crates to parse
+ pub include: Option<Vec<String>>,
+ /// The names of crates to not parse
+ pub exclude: Vec<String>,
+ /// The configuration options for `rustc -Zunpretty=expanded`
+ #[serde(deserialize_with = "retrocomp_parse_expand_config_deserialize")]
+ pub expand: ParseExpandConfig,
+ /// Whether to use a new temporary target directory when running `rustc -Zunpretty=expanded`.
+ /// This may be required for some build processes.
+ pub clean: bool,
+ /// List of crate names which generate consts, statics, and fns. By default
+ /// no dependent crates generate them.
+ pub extra_bindings: Vec<String>,
+}
+
+impl ParseConfig {
+ pub(crate) fn should_generate_top_level_item(
+ &self,
+ crate_name: &str,
+ binding_crate_name: &str,
+ ) -> bool {
+ if crate_name == binding_crate_name {
+ // Always generate items for the binding crate.
+ return true;
+ }
+
+ self.extra_bindings.iter().any(|dep| dep == crate_name)
+ }
+}
+
+/// Settings to apply to pointers
+#[derive(Debug, Clone, Default, Deserialize)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+#[serde(default)]
+pub struct PtrConfig {
+ /// Optional attribute to apply to pointers that are required to not be null
+ pub non_null_attribute: Option<String>,
+}
+
+/// Settings specific to Cython bindings.
+#[derive(Debug, Clone, Default, Deserialize)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+#[serde(default)]
+pub struct CythonConfig {
+ /// Header specified in the top level `cdef extern from header:` declaration.
+ pub header: Option<String>,
+ /// `from module cimport name1, name2, ...` declarations added in the same place
+ /// where you'd get includes in C.
+ pub cimports: BTreeMap<String, Vec<String>>,
+}
+
+/// A collection of settings to customize the generated bindings.
+#[derive(Debug, Clone, Deserialize)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+#[serde(default)]
+pub struct Config {
+ /// Optional text to output at the beginning of the file
+ pub header: Option<String>,
+ /// A list of additional includes to put at the beginning of the generated header
+ pub includes: Vec<String>,
+ /// A list of additional system includes to put at the beginning of the generated header
+ pub sys_includes: Vec<String>,
+ /// Optional verbatim code added after the include blocks
+ pub after_includes: Option<String>,
+ /// Optional text to output at the end of the file
+ pub trailer: Option<String>,
+ /// Optional name to use for an include guard
+ pub include_guard: Option<String>,
+ /// Add a `#pragma once` guard
+ pub pragma_once: bool,
+ /// Generates no includes at all. Overrides all other include options
+ ///
+ /// This option is useful when using cbindgen with tools such as python's cffi which
+ /// doesn't understand include directives
+ pub no_includes: bool,
+ // Package version: True if the package version should appear as a comment in the .h file
+ pub package_version: bool,
+ /// Optional text to output at major sections to deter manual editing
+ pub autogen_warning: Option<String>,
+ /// Include a comment with the version of cbindgen used to generate the file
+ pub include_version: bool,
+ /// An optional name for the root namespace. Only applicable when language="C++"
+ pub namespace: Option<String>,
+ /// An optional list of namespaces. Only applicable when language="C++"
+ pub namespaces: Option<Vec<String>>,
+ /// An optional list of namespaces to declare as using. Only applicable when language="C++"
+ pub using_namespaces: Option<Vec<String>>,
+ /// The style to use for braces
+ pub braces: Braces,
+ /// The preferred length of a line, used for auto breaking function arguments
+ pub line_length: usize,
+ /// The amount of spaces in a tab
+ pub tab_width: usize,
+ /// The type of line endings to generate
+ pub line_endings: LineEndingStyle,
+ /// The language to output bindings for
+ pub language: Language,
+ /// Include preprocessor defines in C bindings to ensure C++ compatibility
+ pub cpp_compat: bool,
+ /// The style to declare structs, enums and unions in for C
+ pub style: Style,
+ /// Default sort key for functions and constants.
+ pub sort_by: SortKey,
+ /// If this option is true `usize` and `isize` will be converted into `size_t` and `ptrdiff_t`
+ /// instead of `uintptr_t` and `intptr_t` respectively.
+ pub usize_is_size_t: bool,
+ /// The configuration options for parsing
+ pub parse: ParseConfig,
+ /// The configuration options for exporting
+ pub export: ExportConfig,
+ /// The configuration options for macros.
+ pub macro_expansion: MacroExpansionConfig,
+ /// The configuration options for type layouts.
+ pub layout: LayoutConfig,
+ /// The configuration options for functions
+ #[serde(rename = "fn")]
+ pub function: FunctionConfig,
+ /// The configuration options for structs
+ #[serde(rename = "struct")]
+ pub structure: StructConfig,
+ /// The configuration options for enums
+ #[serde(rename = "enum")]
+ pub enumeration: EnumConfig,
+ /// The configuration options for constants
+ #[serde(rename = "const")]
+ pub constant: ConstantConfig,
+ /// Preprocessor defines to use when generating #ifdef's for #[cfg]
+ pub defines: HashMap<String, String>,
+ /// Include doc comments from Rust as documentation
+ pub documentation: bool,
+ /// How documentation comments should be styled.
+ pub documentation_style: DocumentationStyle,
+ /// How much of the documentation should be output for each item.
+ pub documentation_length: DocumentationLength,
+ /// Configuration options for pointers
+ #[serde(rename = "ptr")]
+ pub pointer: PtrConfig,
+ /// Only download sources for dependencies needed for the target platform.
+ ///
+ /// By default, cbindgen will fetch sources for dependencies used on any platform so that if a
+ /// type is defined in terms of a type from a dependency on another target (probably behind a
+ /// `#[cfg]`), cbindgen will be able to generate the appropriate binding as it can see the
+ /// nested type's definition. However, this makes calling cbindgen slower, as it may have to
+ /// download a number of additional dependencies.
+ ///
+ /// As an example, consider this Cargo.toml:
+ ///
+ /// ```toml
+ /// [target.'cfg(windows)'.dependencies]
+ /// windows = "0.7"
+ /// ```
+ ///
+ /// with this declaration in one of the `.rs` files that cbindgen is asked to generate bindings
+ /// for:
+ ///
+ /// ```rust,ignore
+ /// #[cfg(windows)]
+ /// pub struct Error(windows::ErrorCode);
+ /// ```
+ ///
+ /// With the default value (`false`), cbindgen will download the `windows` dependency even when
+ /// not compiling for Windows, and will thus be able to generate the binding for `Error`
+ /// (behind a `#define`).
+ ///
+ /// If this value is instead to `true`, cbindgen will _not_ download the `windows` dependency
+ /// if it's not compiling for Windows, but will also fail to generate a Windows binding for
+ /// `Error` as it does not know the definition for `ErrorCode`.
+ ///
+ /// The target can be chosen via the `TARGET` environment variable (if used
+ /// via the CLI, when ran from a build script cargo sets this variable
+ /// appropriately).
+ pub only_target_dependencies: bool,
+ /// Configuration options specific to Cython.
+ pub cython: CythonConfig,
+ #[doc(hidden)]
+ #[serde(skip)]
+ /// Internal field for tracking from which file the config was loaded.
+ ///
+ /// Users should not set this field explicitly. Making the field private
+ /// prevents users from filling the struct with `..Default::default()`,
+ /// and creating a new InternalConfig struct would require more breaking
+ /// changes to our public API.
+ pub config_path: Option<StdPathBuf>,
+}
+
+impl Default for Config {
+ fn default() -> Config {
+ Config {
+ header: None,
+ includes: Vec::new(),
+ sys_includes: Vec::new(),
+ after_includes: None,
+ trailer: None,
+ include_guard: None,
+ pragma_once: false,
+ autogen_warning: None,
+ include_version: false,
+ no_includes: false,
+ package_version: false,
+ namespace: None,
+ namespaces: None,
+ using_namespaces: None,
+ braces: Braces::SameLine,
+ line_length: 100,
+ tab_width: 2,
+ line_endings: LineEndingStyle::default(),
+ language: Language::Cxx,
+ cpp_compat: false,
+ style: Style::default(),
+ usize_is_size_t: false,
+ sort_by: SortKey::None,
+ macro_expansion: Default::default(),
+ parse: ParseConfig::default(),
+ export: ExportConfig::default(),
+ layout: LayoutConfig::default(),
+ function: FunctionConfig::default(),
+ structure: StructConfig::default(),
+ enumeration: EnumConfig::default(),
+ constant: ConstantConfig::default(),
+ defines: HashMap::new(),
+ documentation: true,
+ documentation_style: DocumentationStyle::Auto,
+ documentation_length: DocumentationLength::Full,
+ pointer: PtrConfig::default(),
+ only_target_dependencies: false,
+ cython: CythonConfig::default(),
+ config_path: None,
+ }
+ }
+}
+
+impl Config {
+ pub(crate) fn cpp_compatible_c(&self) -> bool {
+ self.language == Language::C && self.cpp_compat
+ }
+
+ pub(crate) fn include_guard(&self) -> Option<&str> {
+ if self.language == Language::Cython {
+ None
+ } else {
+ self.include_guard.as_deref()
+ }
+ }
+
+ pub(crate) fn includes(&self) -> &[String] {
+ if self.language == Language::Cython {
+ &[]
+ } else {
+ &self.includes
+ }
+ }
+
+ pub(crate) fn sys_includes(&self) -> &[String] {
+ if self.language == Language::Cython {
+ &[]
+ } else {
+ &self.sys_includes
+ }
+ }
+
+ pub fn from_file<P: AsRef<StdPath>>(file_name: P) -> Result<Config, String> {
+ let config_text = fs::read_to_string(file_name.as_ref()).map_err(|_| {
+ format!(
+ "Couldn't open config file: {}.",
+ file_name.as_ref().display()
+ )
+ })?;
+
+ let mut config = toml::from_str::<Config>(&config_text)
+ .map_err(|e| format!("Couldn't parse config file: {}.", e))?;
+ config.config_path = Some(StdPathBuf::from(file_name.as_ref()));
+ Ok(config)
+ }
+
+ pub fn from_root_or_default<P: AsRef<StdPath>>(root: P) -> Config {
+ let c = root.as_ref().join("cbindgen.toml");
+
+ if c.exists() {
+ Config::from_file(c).unwrap()
+ } else {
+ Config::default()
+ }
+ }
+}
diff --git a/cbindgen-0.24.5/src/bindgen/declarationtyperesolver.rs b/cbindgen-0.27.0/src/bindgen/declarationtyperesolver.rs
similarity index 100%
rename from cbindgen-0.24.5/src/bindgen/declarationtyperesolver.rs
rename to cbindgen-0.27.0/src/bindgen/declarationtyperesolver.rs
diff --git a/cbindgen-0.24.5/src/bindgen/dependencies.rs b/cbindgen-0.27.0/src/bindgen/dependencies.rs
similarity index 100%
rename from cbindgen-0.24.5/src/bindgen/dependencies.rs
rename to cbindgen-0.27.0/src/bindgen/dependencies.rs
diff --git a/cbindgen-0.24.5/src/bindgen/error.rs b/cbindgen-0.27.0/src/bindgen/error.rs
similarity index 100%
rename from cbindgen-0.24.5/src/bindgen/error.rs
rename to cbindgen-0.27.0/src/bindgen/error.rs
diff --git a/cbindgen-0.27.0/src/bindgen/ir/annotation.rs b/cbindgen-0.27.0/src/bindgen/ir/annotation.rs
new file mode 100644
index 0000000..5e66cc5
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/annotation.rs
@@ -0,0 +1,222 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::borrow::Cow;
+use std::collections::hash_map::Entry;
+use std::collections::HashMap;
+use std::str::FromStr;
+
+use crate::bindgen::config::{Config, Language};
+use crate::bindgen::utilities::SynAttributeHelpers;
+
+// A system for specifying properties on items. Annotations are
+// given through document comments and parsed by this code.
+//
+// An annotation is in the form cbindgen:PROPERTY=VALUE
+// Where PROPERTY depends on the item
+// Where VALUE can be
+// * list - [Item1, Item2, Item3, ...]
+// * atom - Foo
+// * bool - true,false
+// Examples:
+// * cbindgen:field-names=[mHandle, mNamespace]
+// * cbindgen:function-postfix=WR_DESTRUCTOR_SAFE
+
+/// A value specified by an annotation.
+#[derive(Debug, Clone)]
+pub enum AnnotationValue {
+ List(Vec<String>),
+ Atom(Option<String>),
+ Bool(bool),
+}
+
+/// A set of annotations specified by a document comment.
+#[derive(Debug, Default, Clone)]
+pub struct AnnotationSet {
+ annotations: HashMap<String, AnnotationValue>,
+ pub must_use: bool,
+ pub deprecated: Option<String>,
+}
+
+pub enum DeprecatedNoteKind {
+ Function,
+ Struct,
+ Enum,
+ EnumVariant,
+}
+
+impl AnnotationSet {
+ pub fn new() -> AnnotationSet {
+ AnnotationSet {
+ annotations: HashMap::new(),
+ must_use: false,
+ deprecated: None,
+ }
+ }
+
+ pub fn is_empty(&self) -> bool {
+ self.annotations.is_empty() && !self.must_use
+ }
+
+ pub(crate) fn must_use(&self, config: &Config) -> bool {
+ self.must_use && config.language != Language::Cython
+ }
+
+ pub(crate) fn deprecated_note<'c>(
+ &self,
+ config: &'c Config,
+ kind: DeprecatedNoteKind,
+ ) -> Option<Cow<'c, str>> {
+ let note = self.deprecated.as_deref()?;
+
+ if config.language == Language::Cython {
+ return None;
+ }
+
+ if note.is_empty() {
+ return Some(Cow::Borrowed(match kind {
+ DeprecatedNoteKind::Enum => config.enumeration.deprecated.as_deref()?,
+ DeprecatedNoteKind::EnumVariant => {
+ config.enumeration.deprecated_variant.as_deref()?
+ }
+ DeprecatedNoteKind::Function => config.function.deprecated.as_deref()?,
+ DeprecatedNoteKind::Struct => config.structure.deprecated.as_deref()?,
+ }));
+ }
+
+ let format = match kind {
+ DeprecatedNoteKind::Enum => &config.enumeration.deprecated_with_note,
+ DeprecatedNoteKind::EnumVariant => &config.enumeration.deprecated_variant_with_note,
+ DeprecatedNoteKind::Function => &config.function.deprecated_with_note,
+ DeprecatedNoteKind::Struct => &config.structure.deprecated_with_note,
+ }
+ .as_ref()?;
+ Some(Cow::Owned(format.replace("{}", &format!("{:?}", note))))
+ }
+
+ pub fn load(attrs: &[syn::Attribute]) -> Result<AnnotationSet, String> {
+ let lines = attrs.get_comment_lines();
+ let lines: Vec<&str> = lines
+ .iter()
+ .filter_map(|line| {
+ let line = line.trim_start();
+ if !line.starts_with("cbindgen:") {
+ return None;
+ }
+
+ Some(line)
+ })
+ .collect();
+
+ let must_use = attrs.has_attr_word("must_use");
+ let deprecated = attrs.find_deprecated_note();
+ let mut annotations = HashMap::new();
+
+ // Look at each line for an annotation
+ for line in lines {
+ debug_assert!(line.starts_with("cbindgen:"));
+
+ // Remove the "cbindgen:" prefix
+ let annotation = &line[9..];
+
+ // Split the annotation in two
+ let parts: Vec<&str> = annotation.split('=').map(|x| x.trim()).collect();
+
+ if parts.len() > 2 {
+ return Err(format!("Couldn't parse {}.", line));
+ }
+
+ // Grab the name that this annotation is modifying
+ let name = parts[0];
+
+ // If the annotation only has a name, assume it's setting a bool flag
+ if parts.len() == 1 {
+ annotations.insert(name.to_string(), AnnotationValue::Bool(true));
+ continue;
+ }
+
+ // Parse the value we're setting the name to
+ let value = parts[1];
+
+ if let Some(x) = parse_list(value) {
+ annotations.insert(name.to_string(), AnnotationValue::List(x));
+ continue;
+ }
+ if let Ok(x) = value.parse::<bool>() {
+ annotations.insert(name.to_string(), AnnotationValue::Bool(x));
+ continue;
+ }
+ annotations.insert(
+ name.to_string(),
+ if value.is_empty() {
+ AnnotationValue::Atom(None)
+ } else {
+ AnnotationValue::Atom(Some(value.to_string()))
+ },
+ );
+ }
+
+ Ok(AnnotationSet {
+ annotations,
+ must_use,
+ deprecated,
+ })
+ }
+
+ /// Adds an annotation value if none is specified.
+ pub fn add_default(&mut self, name: &str, value: AnnotationValue) {
+ if let Entry::Vacant(e) = self.annotations.entry(name.to_string()) {
+ e.insert(value);
+ }
+ }
+
+ pub fn list(&self, name: &str) -> Option<Vec<String>> {
+ match self.annotations.get(name) {
+ Some(AnnotationValue::List(x)) => Some(x.clone()),
+ _ => None,
+ }
+ }
+ pub fn atom(&self, name: &str) -> Option<Option<String>> {
+ match self.annotations.get(name) {
+ Some(AnnotationValue::Atom(x)) => Some(x.clone()),
+ _ => None,
+ }
+ }
+ pub fn bool(&self, name: &str) -> Option<bool> {
+ match self.annotations.get(name) {
+ Some(AnnotationValue::Bool(x)) => Some(*x),
+ _ => None,
+ }
+ }
+
+ pub fn parse_atom<T>(&self, name: &str) -> Option<T>
+ where
+ T: Default + FromStr,
+ {
+ match self.annotations.get(name) {
+ Some(AnnotationValue::Atom(x)) => Some(
+ x.as_ref()
+ .map_or(T::default(), |y| y.parse::<T>().ok().unwrap()),
+ ),
+ _ => None,
+ }
+ }
+}
+
+/// Parse lists like "[x, y, z]". This is not implemented efficiently or well.
+fn parse_list(list: &str) -> Option<Vec<String>> {
+ if list.len() < 2 {
+ return None;
+ }
+
+ match (list.chars().next(), list.chars().last()) {
+ (Some('['), Some(']')) => Some(
+ list[1..list.len() - 1]
+ .split(',')
+ .map(|x| x.trim().to_string())
+ .collect(),
+ ),
+ _ => None,
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/cfg.rs b/cbindgen-0.27.0/src/bindgen/ir/cfg.rs
new file mode 100644
index 0000000..65de1a2
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/cfg.rs
@@ -0,0 +1,360 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::fmt;
+use std::io::Write;
+
+use crate::bindgen::cargo::cargo_metadata::Dependency;
+use crate::bindgen::config::{Config, Language};
+use crate::bindgen::writer::SourceWriter;
+
+#[derive(PartialEq, Eq)]
+enum DefineKey<'a> {
+ Boolean(&'a str),
+ Named(&'a str, &'a str),
+}
+
+impl<'a> DefineKey<'a> {
+ fn load(key: &str) -> DefineKey {
+ // TODO: dirty parser
+ if !key.contains('=') {
+ return DefineKey::Boolean(key);
+ }
+
+ let mut splits = key.trim().split('=');
+
+ let name = match splits.next() {
+ Some(n) => n.trim(),
+ None => return DefineKey::Boolean(key),
+ };
+
+ let value = match splits.next() {
+ Some(v) => v.trim(),
+ None => return DefineKey::Boolean(key),
+ };
+
+ if splits.next().is_some() {
+ return DefineKey::Boolean(key);
+ }
+
+ DefineKey::Named(name, value)
+ }
+}
+
+#[derive(Debug, Clone)]
+pub enum Cfg {
+ Boolean(String),
+ Named(String, String),
+ Any(Vec<Cfg>),
+ All(Vec<Cfg>),
+ Not(Box<Cfg>),
+}
+
+impl fmt::Display for Cfg {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match self {
+ Cfg::Boolean(key) => write!(f, "{}", key),
+ Cfg::Named(key, value) => write!(f, "{} = {:?}", key, value),
+ Cfg::Any(cfgs) => {
+ write!(f, "any(")?;
+ for (index, cfg) in cfgs.iter().enumerate() {
+ if index > 0 {
+ write!(f, ", ")?;
+ }
+ write!(f, "{}", cfg)?;
+ }
+ write!(f, ")")
+ }
+ Cfg::All(cfgs) => {
+ write!(f, "all(")?;
+ for (index, cfg) in cfgs.iter().enumerate() {
+ if index > 0 {
+ write!(f, ", ")?;
+ }
+ write!(f, "{}", cfg)?;
+ }
+ write!(f, ")")
+ }
+ Cfg::Not(cfg) => write!(f, "not({})", cfg),
+ }
+ }
+}
+
+impl syn::parse::Parse for Cfg {
+ fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
+ let arg: syn::Meta = input.parse()?;
+
+ match arg {
+ syn::Meta::Path(path) => path
+ .get_ident()
+ .map(|ident| Cfg::Boolean(ident.to_string()))
+ .ok_or_else(|| input.error("path must be identifier")),
+ syn::Meta::NameValue(syn::MetaNameValue {
+ path,
+ value:
+ syn::Expr::Lit(syn::ExprLit {
+ lit: syn::Lit::Str(lit),
+ ..
+ }),
+ ..
+ }) => path
+ .get_ident()
+ .map(|ident| Cfg::Named(ident.to_string(), lit.value()))
+ .ok_or_else(|| input.error("path must be identifier")),
+ syn::Meta::List(meta) => {
+ if meta.path.is_ident("not") {
+ let cfg = meta.parse_args()?;
+ Ok(Cfg::Not(Box::new(cfg)))
+ } else if meta.path.is_ident("all") {
+ let cfgs = meta.parse_args_with(
+ syn::punctuated::Punctuated::<Cfg, syn::Token![,]>::parse_terminated,
+ )?;
+
+ Ok(Cfg::All(cfgs.into_iter().collect()))
+ } else if meta.path.is_ident("any") {
+ let cfgs = meta.parse_args_with(
+ syn::punctuated::Punctuated::<Cfg, syn::Token![,]>::parse_terminated,
+ )?;
+
+ Ok(Cfg::Any(cfgs.into_iter().collect()))
+ } else {
+ Err(input.error("invalid list argument"))
+ }
+ }
+ _ => Err(input.error("Failed to parse cfg")),
+ }
+ }
+}
+
+impl Cfg {
+ pub fn join(cfgs: &[Cfg]) -> Option<Cfg> {
+ if cfgs.is_empty() {
+ None
+ } else {
+ Some(Cfg::All(cfgs.to_owned()))
+ }
+ }
+
+ pub fn append(parent: Option<&Cfg>, child: Option<Cfg>) -> Option<Cfg> {
+ match (parent, child) {
+ (None, None) => None,
+ (None, Some(child)) => Some(child),
+ (Some(parent), None) => Some(parent.clone()),
+ (Some(parent), Some(child)) => Some(Cfg::All(vec![parent.clone(), child])),
+ }
+ }
+
+ pub fn load(attrs: &[syn::Attribute]) -> Option<Cfg> {
+ let mut configs = Vec::new();
+
+ for attr in attrs {
+ if let syn::Meta::List(meta @ syn::MetaList { path, .. }) = &attr.meta {
+ if !path.is_ident("cfg") {
+ continue;
+ }
+
+ let cfg = meta.parse_args().ok();
+
+ if let Some(config) = cfg {
+ configs.push(config);
+ }
+ }
+ }
+
+ match configs.len() {
+ 0 => None,
+ 1 => Some(configs.pop().unwrap()),
+ _ => Some(Cfg::All(configs)),
+ }
+ }
+
+ pub fn load_metadata(dependency: &Dependency) -> Option<Cfg> {
+ let target = dependency.target.as_ref()?;
+ match syn::parse_str::<syn::Meta>(target) {
+ Ok(target) => {
+ // Parsing succeeded using the #[cfg] syntax
+ if let syn::Meta::List(meta) = target {
+ if !meta.path.is_ident("cfg") {
+ return None;
+ }
+ meta.parse_args().ok()
+ } else {
+ None
+ }
+ }
+ Err(_) => {
+ // Parsing failed using #[cfg], this may be a literal target
+ // name
+ Some(Cfg::Boolean(target.clone()))
+ }
+ }
+ }
+}
+
+pub trait ToCondition: Sized {
+ fn to_condition(&self, config: &Config) -> Option<Condition>;
+}
+
+impl ToCondition for Option<Cfg> {
+ fn to_condition(&self, config: &Config) -> Option<Condition> {
+ self.as_ref()?.to_condition(config)
+ }
+}
+
+impl ToCondition for Cfg {
+ fn to_condition(&self, config: &Config) -> Option<Condition> {
+ match *self {
+ Cfg::Boolean(ref cfg_name) => {
+ let define = config
+ .defines
+ .iter()
+ .find(|(key, ..)| DefineKey::Boolean(cfg_name) == DefineKey::load(key));
+ if let Some((_, define)) = define {
+ Some(Condition::Define(define.to_owned()))
+ } else {
+ warn!(
+ "Missing `[defines]` entry for `{}` in cbindgen config.",
+ self,
+ );
+ None
+ }
+ }
+ Cfg::Named(ref cfg_name, ref cfg_value) => {
+ let define = config.defines.iter().find(|(key, ..)| {
+ DefineKey::Named(cfg_name, cfg_value) == DefineKey::load(key)
+ });
+ if let Some((_, define)) = define {
+ Some(Condition::Define(define.to_owned()))
+ } else {
+ warn!(
+ "Missing `[defines]` entry for `{}` in cbindgen config.",
+ self,
+ );
+ None
+ }
+ }
+ Cfg::Any(ref children) => {
+ let conditions: Vec<_> = children
+ .iter()
+ .filter_map(|x| x.to_condition(config))
+ .collect();
+ match conditions.len() {
+ 0 => None,
+ 1 => conditions.into_iter().next(),
+ _ => Some(Condition::Any(conditions)),
+ }
+ }
+ Cfg::All(ref children) => {
+ let cfgs: Vec<_> = children
+ .iter()
+ .filter_map(|x| x.to_condition(config))
+ .collect();
+ match cfgs.len() {
+ 0 => None,
+ 1 => cfgs.into_iter().next(),
+ _ => Some(Condition::All(cfgs)),
+ }
+ }
+ Cfg::Not(ref child) => child
+ .to_condition(config)
+ .map(|cfg| Condition::Not(Box::new(cfg))),
+ }
+ }
+}
+
+#[derive(Debug, Clone)]
+pub enum Condition {
+ Define(String),
+ Any(Vec<Condition>),
+ All(Vec<Condition>),
+ Not(Box<Condition>),
+}
+
+impl Condition {
+ fn write<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
+ match *self {
+ Condition::Define(ref define) => {
+ if config.language == Language::Cython {
+ write!(out, "{}", define);
+ } else {
+ out.write("defined(");
+ write!(out, "{}", define);
+ out.write(")");
+ }
+ }
+ Condition::Any(ref conditions) => {
+ out.write("(");
+ for (i, condition) in conditions.iter().enumerate() {
+ if i != 0 {
+ out.write(if config.language == Language::Cython {
+ " or "
+ } else {
+ " || "
+ });
+ }
+ condition.write(config, out);
+ }
+ out.write(")");
+ }
+ Condition::All(ref conditions) => {
+ out.write("(");
+ for (i, condition) in conditions.iter().enumerate() {
+ if i != 0 {
+ out.write(if config.language == Language::Cython {
+ " and "
+ } else {
+ " && "
+ });
+ }
+ condition.write(config, out);
+ }
+ out.write(")");
+ }
+ Condition::Not(ref condition) => {
+ out.write(if config.language == Language::Cython {
+ "not "
+ } else {
+ "!"
+ });
+ condition.write(config, out);
+ }
+ }
+ }
+}
+
+pub trait ConditionWrite {
+ fn write_before<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>);
+ fn write_after<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>);
+}
+
+impl ConditionWrite for Option<Condition> {
+ fn write_before<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
+ if let Some(ref cfg) = *self {
+ if config.language == Language::Cython {
+ out.write("IF ");
+ cfg.write(config, out);
+ out.open_brace();
+ } else {
+ out.push_set_spaces(0);
+ out.write("#if ");
+ cfg.write(config, out);
+ out.pop_set_spaces();
+ out.new_line();
+ }
+ }
+ }
+
+ fn write_after<F: Write>(&self, config: &Config, out: &mut SourceWriter<F>) {
+ if self.is_some() {
+ if config.language == Language::Cython {
+ out.close_brace(false);
+ } else {
+ out.new_line();
+ out.push_set_spaces(0);
+ out.write("#endif");
+ out.pop_set_spaces();
+ }
+ }
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/constant.rs b/cbindgen-0.27.0/src/bindgen/ir/constant.rs
new file mode 100644
index 0000000..2f1d3bf
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/constant.rs
@@ -0,0 +1,728 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::borrow::Cow;
+use std::collections::HashMap;
+use std::io::Write;
+
+use syn::ext::IdentExt;
+use syn::UnOp;
+
+use crate::bindgen::config::{Config, Language};
+use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
+use crate::bindgen::dependencies::Dependencies;
+use crate::bindgen::ir::{
+ AnnotationSet, Cfg, ConditionWrite, Documentation, GenericParams, Item, ItemContainer, Path,
+ Struct, ToCondition, Type,
+};
+use crate::bindgen::language_backend::LanguageBackend;
+use crate::bindgen::library::Library;
+use crate::bindgen::writer::SourceWriter;
+use crate::bindgen::Bindings;
+
+fn member_to_ident(member: &syn::Member) -> String {
+ match member {
+ syn::Member::Named(ref name) => name.unraw().to_string(),
+ syn::Member::Unnamed(ref index) => format!("_{}", index.index),
+ }
+}
+
+// TODO: Maybe add support to more std associated constants.
+pub(crate) fn to_known_assoc_constant(associated_to: &Path, name: &str) -> Option<String> {
+ use crate::bindgen::ir::{IntKind, PrimitiveType};
+
+ if name != "MAX" && name != "MIN" {
+ return None;
+ }
+
+ let prim = PrimitiveType::maybe(associated_to.name())?;
+ let prefix = match prim {
+ PrimitiveType::Integer {
+ kind,
+ signed,
+ zeroable: _,
+ } => match kind {
+ IntKind::B8 => {
+ if signed {
+ "INT8"
+ } else {
+ "UINT8"
+ }
+ }
+ IntKind::B16 => {
+ if signed {
+ "INT16"
+ } else {
+ "UINT16"
+ }
+ }
+ IntKind::B32 => {
+ if signed {
+ "INT32"
+ } else {
+ "UINT32"
+ }
+ }
+ IntKind::B64 => {
+ if signed {
+ "INT64"
+ } else {
+ "UINT64"
+ }
+ }
+ _ => return None,
+ },
+ _ => return None,
+ };
+ Some(format!("{}_{}", prefix, name))
+}
+
+#[derive(Debug, Clone)]
+pub enum Literal {
+ Expr(String),
+ Path {
+ associated_to: Option<(Path, String)>,
+ name: String,
+ },
+ PostfixUnaryOp {
+ op: &'static str,
+ value: Box<Literal>,
+ },
+ BinOp {
+ left: Box<Literal>,
+ op: &'static str,
+ right: Box<Literal>,
+ },
+ FieldAccess {
+ base: Box<Literal>,
+ field: String,
+ },
+ Struct {
+ path: Path,
+ export_name: String,
+ fields: HashMap<String, Literal>,
+ },
+ Cast {
+ ty: Type,
+ value: Box<Literal>,
+ },
+}
+
+impl Literal {
+ fn replace_self_with(&mut self, self_ty: &Path) {
+ match *self {
+ Literal::PostfixUnaryOp { ref mut value, .. } => {
+ value.replace_self_with(self_ty);
+ }
+ Literal::BinOp {
+ ref mut left,
+ ref mut right,
+ ..
+ } => {
+ left.replace_self_with(self_ty);
+ right.replace_self_with(self_ty);
+ }
+ Literal::FieldAccess { ref mut base, .. } => {
+ base.replace_self_with(self_ty);
+ }
+ Literal::Struct {
+ ref mut path,
+ ref mut export_name,
+ ref mut fields,
+ } => {
+ if path.replace_self_with(self_ty) {
+ self_ty.name().clone_into(export_name);
+ }
+ for ref mut expr in fields.values_mut() {
+ expr.replace_self_with(self_ty);
+ }
+ }
+ Literal::Cast {
+ ref mut ty,
+ ref mut value,
+ } => {
+ ty.replace_self_with(self_ty);
+ value.replace_self_with(self_ty);
+ }
+ Literal::Path {
+ ref mut associated_to,
+ ..
+ } => {
+ if let Some((ref mut path, ref mut export_name)) = *associated_to {
+ if path.replace_self_with(self_ty) {
+ self_ty.name().clone_into(export_name);
+ }
+ }
+ }
+ Literal::Expr(..) => {}
+ }
+ }
+
+ fn is_valid(&self, bindings: &Bindings) -> bool {
+ match *self {
+ Literal::Expr(..) => true,
+ Literal::Path {
+ ref associated_to,
+ ref name,
+ } => {
+ if let Some((ref path, _export_name)) = associated_to {
+ return bindings.struct_exists(path)
+ || to_known_assoc_constant(path, name).is_some();
+ }
+ true
+ }
+ Literal::PostfixUnaryOp { ref value, .. } => value.is_valid(bindings),
+ Literal::BinOp {
+ ref left,
+ ref right,
+ ..
+ } => left.is_valid(bindings) && right.is_valid(bindings),
+ Literal::FieldAccess { ref base, .. } => base.is_valid(bindings),
+ Literal::Struct { ref path, .. } => bindings.struct_exists(path),
+ Literal::Cast { ref value, .. } => value.is_valid(bindings),
+ }
+ }
+
+ fn can_be_constexpr(&self) -> bool {
+ !self.has_pointer_casts()
+ }
+
+ fn visit(&self, visitor: &mut impl FnMut(&Self) -> bool) -> bool {
+ if !visitor(self) {
+ return false;
+ }
+ match self {
+ Literal::Expr(..) | Literal::Path { .. } => true,
+ Literal::PostfixUnaryOp { ref value, .. } => value.visit(visitor),
+ Literal::BinOp {
+ ref left,
+ ref right,
+ ..
+ } => left.visit(visitor) && right.visit(visitor),
+ Literal::FieldAccess { ref base, .. } => base.visit(visitor),
+ Literal::Struct { ref fields, .. } => {
+ for (_name, field) in fields.iter() {
+ if !field.visit(visitor) {
+ return false;
+ }
+ }
+ true
+ }
+ Literal::Cast { ref value, .. } => value.visit(visitor),
+ }
+ }
+
+ fn has_pointer_casts(&self) -> bool {
+ let mut has_pointer_casts = false;
+ self.visit(&mut |lit| {
+ if let Literal::Cast { ref ty, .. } = *lit {
+ has_pointer_casts = has_pointer_casts || ty.is_ptr();
+ }
+ !has_pointer_casts
+ });
+ has_pointer_casts
+ }
+
+ pub fn uses_only_primitive_types(&self) -> bool {
+ let mut uses_only_primitive_types = true;
+ self.visit(&mut |lit| {
+ // XXX This is a bit sketchy, but alas.
+ uses_only_primitive_types = uses_only_primitive_types
+ && match *lit {
+ Literal::Struct { .. } => false,
+ Literal::Cast { ref ty, .. } => ty.is_primitive_or_ptr_primitive(),
+ _ => true,
+ };
+ uses_only_primitive_types
+ });
+ uses_only_primitive_types
+ }
+}
+
+impl Literal {
+ pub fn rename_for_config(&mut self, config: &Config) {
+ match self {
+ Literal::Struct {
+ ref mut export_name,
+ fields,
+ ..
+ } => {
+ config.export.rename(export_name);
+ for lit in fields.values_mut() {
+ lit.rename_for_config(config);
+ }
+ }
+ Literal::FieldAccess { ref mut base, .. } => {
+ base.rename_for_config(config);
+ }
+ Literal::Path {
+ ref mut associated_to,
+ ref mut name,
+ } => {
+ if let Some((_path, ref mut export_name)) = associated_to {
+ config.export.rename(export_name);
+ } else {
+ config.export.rename(name);
+ }
+ }
+ Literal::PostfixUnaryOp { ref mut value, .. } => {
+ value.rename_for_config(config);
+ }
+ Literal::BinOp {
+ ref mut left,
+ ref mut right,
+ ..
+ } => {
+ left.rename_for_config(config);
+ right.rename_for_config(config);
+ }
+ Literal::Expr(_) => {}
+ Literal::Cast {
+ ref mut ty,
+ ref mut value,
+ } => {
+ ty.rename_for_config(config, &GenericParams::default());
+ value.rename_for_config(config);
+ }
+ }
+ }
+
+ // Translate from full blown `syn::Expr` into a simpler `Literal` type
+ pub fn load(expr: &syn::Expr) -> Result<Literal, String> {
+ match *expr {
+ // Match binary expressions of the form `a * b`
+ syn::Expr::Binary(ref bin_expr) => {
+ let l = Self::load(&bin_expr.left)?;
+ let r = Self::load(&bin_expr.right)?;
+ let op = match bin_expr.op {
+ syn::BinOp::Add(..) => "+",
+ syn::BinOp::Sub(..) => "-",
+ syn::BinOp::Mul(..) => "*",
+ syn::BinOp::Div(..) => "/",
+ syn::BinOp::Rem(..) => "%",
+ syn::BinOp::And(..) => "&&",
+ syn::BinOp::Or(..) => "||",
+ syn::BinOp::BitXor(..) => "^",
+ syn::BinOp::BitAnd(..) => "&",
+ syn::BinOp::BitOr(..) => "|",
+ syn::BinOp::Shl(..) => "<<",
+ syn::BinOp::Shr(..) => ">>",
+ syn::BinOp::Eq(..) => "==",
+ syn::BinOp::Lt(..) => "<",
+ syn::BinOp::Le(..) => "<=",
+ syn::BinOp::Ne(..) => "!=",
+ syn::BinOp::Ge(..) => ">=",
+ syn::BinOp::Gt(..) => ">",
+ syn::BinOp::AddAssign(..) => "+=",
+ syn::BinOp::SubAssign(..) => "-=",
+ syn::BinOp::MulAssign(..) => "*=",
+ syn::BinOp::DivAssign(..) => "/=",
+ syn::BinOp::RemAssign(..) => "%=",
+ syn::BinOp::BitXorAssign(..) => "^=",
+ syn::BinOp::BitAndAssign(..) => "&=",
+ syn::BinOp::BitOrAssign(..) => "|=",
+ syn::BinOp::ShlAssign(..) => "<<=",
+ syn::BinOp::ShrAssign(..) => ">>=",
+ currently_unknown => {
+ return Err(format!(
+ "unsupported binary operator: {:?}",
+ currently_unknown
+ ))
+ }
+ };
+ Ok(Literal::BinOp {
+ left: Box::new(l),
+ op,
+ right: Box::new(r),
+ })
+ }
+
+ // Match literals like true, 'a', 32 etc
+ syn::Expr::Lit(syn::ExprLit { ref lit, .. }) => {
+ match lit {
+ syn::Lit::Byte(ref value) => Ok(Literal::Expr(format!("{}", value.value()))),
+ syn::Lit::Char(ref value) => Ok(Literal::Expr(match value.value() as u32 {
+ 0..=255 => format!("'{}'", value.value().escape_default()),
+ other_code => format!(r"U'\U{:08X}'", other_code),
+ })),
+ syn::Lit::Int(ref value) => {
+ let suffix = match value.suffix() {
+ "u64" => "ull",
+ "i64" => "ll",
+ "u32" => "u",
+ _ if value.base10_parse::<i64>().is_err() => "ull",
+ _ => "",
+ };
+ Ok(Literal::Expr(format!(
+ "{}{}",
+ value.base10_digits(),
+ suffix
+ )))
+ }
+ syn::Lit::Float(ref value) => {
+ Ok(Literal::Expr(value.base10_digits().to_string()))
+ }
+ syn::Lit::Bool(ref value) => Ok(Literal::Expr(format!("{}", value.value))),
+ // TODO: Add support for byte string and Verbatim
+ _ => Err(format!("Unsupported literal expression. {:?}", *lit)),
+ }
+ }
+
+ syn::Expr::Field(syn::ExprField {
+ ref base,
+ ref member,
+ ..
+ }) => Ok(Literal::FieldAccess {
+ base: Box::new(Literal::load(base)?),
+ field: member_to_ident(member),
+ }),
+
+ syn::Expr::Call(syn::ExprCall {
+ ref func, ref args, ..
+ }) => {
+ let struct_name = match Literal::load(func)? {
+ Literal::Path {
+ associated_to: None,
+ name,
+ } => name,
+ _ => return Err(format!("Unsupported call expression. {:?}", *expr)),
+ };
+ let mut fields = HashMap::<String, Literal>::default();
+ for (index, arg) in args.iter().enumerate() {
+ let ident =
+ member_to_ident(&syn::Member::Unnamed(syn::Index::from(index))).to_string();
+ let value = Literal::load(arg)?;
+ fields.insert(ident, value);
+ }
+ Ok(Literal::Struct {
+ path: Path::new(struct_name.clone()),
+ export_name: struct_name,
+ fields,
+ })
+ }
+
+ syn::Expr::Struct(syn::ExprStruct {
+ ref path,
+ ref fields,
+ ..
+ }) => {
+ let struct_name = path.segments[0].ident.unraw().to_string();
+ let mut field_map = HashMap::<String, Literal>::default();
+ for field in fields {
+ let ident = member_to_ident(&field.member).to_string();
+ let value = Literal::load(&field.expr)?;
+ field_map.insert(ident, value);
+ }
+ Ok(Literal::Struct {
+ path: Path::new(struct_name.clone()),
+ export_name: struct_name,
+ fields: field_map,
+ })
+ }
+
+ syn::Expr::Unary(syn::ExprUnary {
+ ref op, ref expr, ..
+ }) => match *op {
+ UnOp::Not(_) => {
+ let val = Self::load(expr)?;
+ Ok(Literal::PostfixUnaryOp {
+ op: "~",
+ value: Box::new(val),
+ })
+ }
+ UnOp::Neg(_) => {
+ let val = Self::load(expr)?;
+ Ok(Literal::PostfixUnaryOp {
+ op: "-",
+ value: Box::new(val),
+ })
+ }
+ _ => Err(format!("Unsupported Unary expression. {:?}", *op)),
+ },
+
+ // Match identifiers, like `5 << SHIFT`
+ syn::Expr::Path(syn::ExprPath { ref path, .. }) => {
+ // Handle only the simplest identifiers and Associated::IDENT
+ // kind of syntax.
+ Ok(match path.segments.len() {
+ 1 => Literal::Path {
+ associated_to: None,
+ name: path.segments[0].ident.to_string(),
+ },
+ 2 => {
+ let struct_name = path.segments[0].ident.to_string();
+ Literal::Path {
+ associated_to: Some((Path::new(&struct_name), struct_name)),
+ name: path.segments[1].ident.to_string(),
+ }
+ }
+ _ => return Err(format!("Unsupported path expression. {:?}", path)),
+ })
+ }
+
+ syn::Expr::Paren(syn::ExprParen { ref expr, .. }) => Self::load(expr),
+
+ syn::Expr::Cast(syn::ExprCast {
+ ref expr, ref ty, ..
+ }) => {
+ let val = Self::load(expr)?;
+ match Type::load(ty)? {
+ Some(ty) => Ok(Literal::Cast {
+ ty,
+ value: Box::new(val),
+ }),
+ None => Err("Cannot cast to zero sized type.".to_owned()),
+ }
+ }
+
+ _ => Err(format!("Unsupported expression. {:?}", *expr)),
+ }
+ }
+}
+
+#[derive(Debug, Clone)]
+pub struct Constant {
+ pub path: Path,
+ pub export_name: String,
+ pub ty: Type,
+ pub value: Literal,
+ pub cfg: Option<Cfg>,
+ pub annotations: AnnotationSet,
+ pub documentation: Documentation,
+ pub associated_to: Option<Path>,
+}
+
+impl Constant {
+ pub fn load(
+ path: Path,
+ mod_cfg: Option<&Cfg>,
+ ty: &syn::Type,
+ expr: &syn::Expr,
+ attrs: &[syn::Attribute],
+ associated_to: Option<Path>,
+ ) -> Result<Constant, String> {
+ let ty = Type::load(ty)?;
+ let mut ty = match ty {
+ Some(ty) => ty,
+ None => {
+ return Err("Cannot have a zero sized const definition.".to_owned());
+ }
+ };
+
+ let mut lit = Literal::load(expr)?;
+
+ if let Some(ref associated_to) = associated_to {
+ ty.replace_self_with(associated_to);
+ lit.replace_self_with(associated_to);
+ }
+
+ Ok(Constant::new(
+ path,
+ ty,
+ lit,
+ Cfg::append(mod_cfg, Cfg::load(attrs)),
+ AnnotationSet::load(attrs)?,
+ Documentation::load(attrs),
+ associated_to,
+ ))
+ }
+
+ pub fn new(
+ path: Path,
+ ty: Type,
+ value: Literal,
+ cfg: Option<Cfg>,
+ annotations: AnnotationSet,
+ documentation: Documentation,
+ associated_to: Option<Path>,
+ ) -> Self {
+ let export_name = path.name().to_owned();
+ Self {
+ path,
+ export_name,
+ ty,
+ value,
+ cfg,
+ annotations,
+ documentation,
+ associated_to,
+ }
+ }
+
+ pub fn uses_only_primitive_types(&self) -> bool {
+ self.value.uses_only_primitive_types() && self.ty.is_primitive_or_ptr_primitive()
+ }
+}
+
+impl Item for Constant {
+ fn path(&self) -> &Path {
+ &self.path
+ }
+
+ fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
+ self.ty.add_dependencies(library, out);
+ }
+
+ fn export_name(&self) -> &str {
+ &self.export_name
+ }
+
+ fn cfg(&self) -> Option<&Cfg> {
+ self.cfg.as_ref()
+ }
+
+ fn annotations(&self) -> &AnnotationSet {
+ &self.annotations
+ }
+
+ fn annotations_mut(&mut self) -> &mut AnnotationSet {
+ &mut self.annotations
+ }
+
+ fn documentation(&self) -> &Documentation {
+ &self.documentation
+ }
+
+ fn container(&self) -> ItemContainer {
+ ItemContainer::Constant(self.clone())
+ }
+
+ fn rename_for_config(&mut self, config: &Config) {
+ if self.associated_to.is_none() {
+ config.export.rename(&mut self.export_name);
+ }
+ self.value.rename_for_config(config);
+ self.ty.rename_for_config(config, &GenericParams::default()); // FIXME: should probably propagate something here
+ }
+
+ fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
+ self.ty.resolve_declaration_types(resolver);
+ }
+
+ fn generic_params(&self) -> &GenericParams {
+ GenericParams::empty()
+ }
+}
+
+impl Constant {
+ pub fn write_declaration<F: Write, LB: LanguageBackend>(
+ &self,
+ config: &Config,
+ language_backend: &mut LB,
+ out: &mut SourceWriter<F>,
+ associated_to_struct: &Struct,
+ ) {
+ debug_assert!(self.associated_to.is_some());
+ debug_assert!(config.language == Language::Cxx);
+ debug_assert!(!associated_to_struct.is_transparent);
+ debug_assert!(config.structure.associated_constants_in_body);
+ debug_assert!(config.constant.allow_static_const);
+
+ if let Type::Ptr { is_const: true, .. } = self.ty {
+ out.write("static ");
+ } else {
+ out.write("static const ");
+ }
+ language_backend.write_type(out, &self.ty);
+ write!(out, " {};", self.export_name())
+ }
+
+ pub fn write<F: Write, LB: LanguageBackend>(
+ &self,
+ config: &Config,
+ language_backend: &mut LB,
+ out: &mut SourceWriter<F>,
+ associated_to_struct: Option<&Struct>,
+ ) {
+ if let Some(assoc) = associated_to_struct {
+ if assoc.is_generic() {
+ return; // Not tested / implemented yet, so bail out.
+ }
+ }
+
+ if !self.value.is_valid(out.bindings()) {
+ return;
+ }
+
+ let associated_to_transparent = associated_to_struct.map_or(false, |s| s.is_transparent);
+
+ let in_body = associated_to_struct.is_some()
+ && config.language == Language::Cxx
+ && config.structure.associated_constants_in_body
+ && config.constant.allow_static_const
+ && !associated_to_transparent;
+
+ let condition = self.cfg.to_condition(config);
+ condition.write_before(config, out);
+
+ let name = if in_body {
+ Cow::Owned(format!(
+ "{}::{}",
+ associated_to_struct.unwrap().export_name(),
+ self.export_name(),
+ ))
+ } else if self.associated_to.is_none() {
+ Cow::Borrowed(self.export_name())
+ } else {
+ let associated_name = match associated_to_struct {
+ Some(s) => Cow::Borrowed(s.export_name()),
+ None => {
+ let mut name = self.associated_to.as_ref().unwrap().name().to_owned();
+ config.export.rename(&mut name);
+ Cow::Owned(name)
+ }
+ };
+
+ Cow::Owned(format!("{}_{}", associated_name, self.export_name()))
+ };
+
+ let mut value = &self.value;
+ while let Literal::Struct { path, fields, .. } = value {
+ if !out.bindings().struct_is_transparent(path) {
+ break;
+ }
+ value = fields.iter().next().unwrap().1
+ }
+
+ language_backend.write_documentation(out, self.documentation());
+
+ let allow_constexpr = config.constant.allow_constexpr && self.value.can_be_constexpr();
+ match config.language {
+ Language::Cxx if config.constant.allow_static_const || allow_constexpr => {
+ if allow_constexpr {
+ out.write("constexpr ")
+ }
+
+ if config.constant.allow_static_const {
+ out.write(if in_body { "inline " } else { "static " });
+ }
+
+ if let Type::Ptr { is_const: true, .. } = self.ty {
+ // Nothing.
+ } else {
+ out.write("const ");
+ }
+
+ language_backend.write_type(out, &self.ty);
+ write!(out, " {} = ", name);
+ language_backend.write_literal(out, value);
+ write!(out, ";");
+ }
+ Language::Cxx | Language::C => {
+ write!(out, "#define {} ", name);
+ language_backend.write_literal(out, value);
+ }
+ Language::Cython => {
+ out.write("const ");
+ language_backend.write_type(out, &self.ty);
+ // For extern Cython declarations the initializer is ignored,
+ // but still useful as documentation, so we write it as a comment.
+ write!(out, " {} # = ", name);
+ language_backend.write_literal(out, value);
+ }
+ }
+
+ condition.write_after(config, out);
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/documentation.rs b/cbindgen-0.27.0/src/bindgen/ir/documentation.rs
new file mode 100644
index 0000000..e6dba97
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/documentation.rs
@@ -0,0 +1,34 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use crate::bindgen::utilities::SynAttributeHelpers;
+
+#[derive(Debug, Clone)]
+pub struct Documentation {
+ pub doc_comment: Vec<String>,
+}
+
+impl Documentation {
+ pub fn load(attrs: &[syn::Attribute]) -> Self {
+ let doc = attrs
+ .get_comment_lines()
+ .into_iter()
+ .filter(|x| !x.trim_start().starts_with("cbindgen:"))
+ .collect();
+
+ Documentation { doc_comment: doc }
+ }
+
+ pub fn simple(line: &str) -> Self {
+ Documentation {
+ doc_comment: vec![line.to_owned()],
+ }
+ }
+
+ pub fn none() -> Self {
+ Documentation {
+ doc_comment: Vec::new(),
+ }
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/enumeration.rs b/cbindgen-0.27.0/src/bindgen/ir/enumeration.rs
new file mode 100644
index 0000000..2e633a7
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/enumeration.rs
@@ -0,0 +1,1502 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::io::Write;
+
+use syn::ext::IdentExt;
+
+use crate::bindgen::config::{Config, Language};
+use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
+use crate::bindgen::dependencies::Dependencies;
+use crate::bindgen::ir::{
+ AnnotationSet, AnnotationValue, Cfg, ConditionWrite, DeprecatedNoteKind, Documentation, Field,
+ GenericArgument, GenericParams, GenericPath, Item, ItemContainer, Literal, Path, Repr,
+ ReprStyle, Struct, ToCondition, Type,
+};
+use crate::bindgen::language_backend::LanguageBackend;
+use crate::bindgen::library::Library;
+use crate::bindgen::mangle;
+use crate::bindgen::monomorph::Monomorphs;
+use crate::bindgen::rename::{IdentifierType, RenameRule};
+use crate::bindgen::reserved;
+use crate::bindgen::writer::{ListType, SourceWriter};
+
+#[allow(clippy::large_enum_variant)]
+#[derive(Debug, Clone)]
+pub enum VariantBody {
+ Empty(AnnotationSet),
+ Body {
+ /// The variant field / export name.
+ name: String,
+ /// The struct with all the items.
+ body: Struct,
+ /// A separate named struct is not created for this variant,
+ /// an unnamed struct is inlined at the point of use instead.
+ /// This is a reasonable thing to do only for tuple variants with a single field.
+ inline: bool,
+ /// Generated cast methods return the variant's only field instead of the variant itself.
+ /// For backward compatibility casts are inlined in a slightly
+ /// larger set of cases than whole variants.
+ inline_casts: bool,
+ },
+}
+
+impl VariantBody {
+ fn empty() -> Self {
+ Self::Empty(AnnotationSet::new())
+ }
+
+ pub fn annotations(&self) -> &AnnotationSet {
+ match *self {
+ Self::Empty(ref anno) => anno,
+ Self::Body { ref body, .. } => &body.annotations,
+ }
+ }
+
+ fn is_empty(&self) -> bool {
+ match *self {
+ Self::Empty(..) => true,
+ Self::Body { .. } => false,
+ }
+ }
+
+ fn specialize(
+ &self,
+ generic_values: &[GenericArgument],
+ mappings: &[(&Path, &GenericArgument)],
+ config: &Config,
+ ) -> Self {
+ match *self {
+ Self::Empty(ref annos) => Self::Empty(annos.clone()),
+ Self::Body {
+ ref name,
+ ref body,
+ inline,
+ inline_casts,
+ } => Self::Body {
+ name: name.clone(),
+ body: body.specialize(generic_values, mappings, config),
+ inline,
+ inline_casts,
+ },
+ }
+ }
+}
+
+#[derive(Debug, Clone)]
+pub struct EnumVariant {
+ pub name: String,
+ pub export_name: String,
+ pub discriminant: Option<Literal>,
+ pub body: VariantBody,
+ pub cfg: Option<Cfg>,
+ pub documentation: Documentation,
+}
+
+impl EnumVariant {
+ fn load(
+ inline_tag_field: bool,
+ variant: &syn::Variant,
+ generic_params: GenericParams,
+ mod_cfg: Option<&Cfg>,
+ self_path: &Path,
+ enum_annotations: &AnnotationSet,
+ config: &Config,
+ ) -> Result<Self, String> {
+ let discriminant = match variant.discriminant {
+ Some((_, ref expr)) => Some(Literal::load(expr)?),
+ None => None,
+ };
+
+ fn parse_fields(
+ inline_tag_field: bool,
+ fields: &syn::punctuated::Punctuated<syn::Field, syn::token::Comma>,
+ self_path: &Path,
+ inline_name: Option<&str>,
+ ) -> Result<Vec<Field>, String> {
+ let mut res = Vec::new();
+
+ if inline_tag_field {
+ res.push(Field::from_name_and_type(
+ inline_name.map_or_else(|| "tag".to_string(), |name| format!("{}_tag", name)),
+ Type::Path(GenericPath::new(Path::new("Tag"), vec![])),
+ ));
+ }
+
+ for (i, field) in fields.iter().enumerate() {
+ if let Some(mut ty) = Type::load(&field.ty)? {
+ ty.replace_self_with(self_path);
+ res.push(Field {
+ name: inline_name.map_or_else(
+ || match field.ident {
+ Some(ref ident) => ident.unraw().to_string(),
+ None => i.to_string(),
+ },
+ |name| name.to_string(),
+ ),
+ ty,
+ cfg: Cfg::load(&field.attrs),
+ annotations: AnnotationSet::load(&field.attrs)?,
+ documentation: Documentation::load(&field.attrs),
+ });
+ }
+ }
+
+ Ok(res)
+ }
+
+ let variant_cfg = Cfg::append(mod_cfg, Cfg::load(&variant.attrs));
+ let mut annotations = AnnotationSet::load(&variant.attrs)?;
+ if let Some(b) = enum_annotations.bool("derive-ostream") {
+ annotations.add_default("derive-ostream", AnnotationValue::Bool(b));
+ }
+
+ let body_rule = enum_annotations
+ .parse_atom::<RenameRule>("rename-variant-name-fields")
+ .unwrap_or(config.enumeration.rename_variant_name_fields);
+
+ let body = match variant.fields {
+ syn::Fields::Unit => VariantBody::Empty(annotations),
+ syn::Fields::Named(ref fields) => {
+ let path = Path::new(format!("{}_Body", variant.ident));
+ let name = body_rule
+ .apply(
+ &variant.ident.unraw().to_string(),
+ IdentifierType::StructMember,
+ )
+ .into_owned();
+ VariantBody::Body {
+ body: Struct::new(
+ path,
+ generic_params,
+ parse_fields(inline_tag_field, &fields.named, self_path, None)?,
+ inline_tag_field,
+ true,
+ None,
+ false,
+ None,
+ annotations,
+ Documentation::none(),
+ ),
+ name,
+ inline: false,
+ inline_casts: false,
+ }
+ }
+ syn::Fields::Unnamed(ref fields) => {
+ let path = Path::new(format!("{}_Body", variant.ident));
+ let name = body_rule
+ .apply(
+ &variant.ident.unraw().to_string(),
+ IdentifierType::StructMember,
+ )
+ .into_owned();
+ let inline_casts = fields.unnamed.len() == 1;
+ // In C++ types with destructors cannot be put into unnamed structs like the
+ // inlining requires, and it's hard to detect such types.
+ // Besides that for C++ we generate casts/getters that can be used instead of
+ // direct field accesses and also have a benefit of being checked.
+ // As a result we don't currently inline variant definitions in C++ mode at all.
+ let inline = inline_casts && config.language != Language::Cxx;
+ let inline_name = if inline { Some(&*name) } else { None };
+ VariantBody::Body {
+ body: Struct::new(
+ path,
+ generic_params,
+ parse_fields(inline_tag_field, &fields.unnamed, self_path, inline_name)?,
+ inline_tag_field,
+ true,
+ None,
+ false,
+ None,
+ annotations,
+ Documentation::none(),
+ ),
+ name,
+ inline,
+ inline_casts,
+ }
+ }
+ };
+
+ Ok(EnumVariant::new(
+ variant.ident.unraw().to_string(),
+ discriminant,
+ body,
+ variant_cfg,
+ Documentation::load(&variant.attrs),
+ ))
+ }
+
+ pub fn new(
+ name: String,
+ discriminant: Option<Literal>,
+ body: VariantBody,
+ cfg: Option<Cfg>,
+ documentation: Documentation,
+ ) -> Self {
+ let export_name = name.clone();
+ Self {
+ name,
+ export_name,
+ discriminant,
+ body,
+ cfg,
+ documentation,
+ }
+ }
+
+ fn simplify_standard_types(&mut self, config: &Config) {
+ if let VariantBody::Body { ref mut body, .. } = self.body {
+ body.simplify_standard_types(config);
+ }
+ }
+
+ fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
+ if let VariantBody::Body { ref body, .. } = self.body {
+ body.add_dependencies(library, out);
+ }
+ }
+
+ fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
+ if let VariantBody::Body { ref mut body, .. } = self.body {
+ body.resolve_declaration_types(resolver);
+ }
+ }
+
+ fn specialize(
+ &self,
+ generic_values: &[GenericArgument],
+ mappings: &[(&Path, &GenericArgument)],
+ config: &Config,
+ ) -> Self {
+ Self::new(
+ mangle::mangle_name(&self.name, generic_values, &config.export.mangle),
+ self.discriminant.clone(),
+ self.body.specialize(generic_values, mappings, config),
+ self.cfg.clone(),
+ self.documentation.clone(),
+ )
+ }
+
+ fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
+ if let VariantBody::Body { ref body, .. } = self.body {
+ body.add_monomorphs(library, out);
+ }
+ }
+
+ fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
+ if let VariantBody::Body { ref mut body, .. } = self.body {
+ body.mangle_paths(monomorphs);
+ }
+ }
+}
+
+#[derive(Debug, Clone)]
+pub struct Enum {
+ pub path: Path,
+ pub export_name: String,
+ pub generic_params: GenericParams,
+ pub repr: Repr,
+ pub variants: Vec<EnumVariant>,
+ pub tag: Option<String>,
+ pub cfg: Option<Cfg>,
+ pub annotations: AnnotationSet,
+ pub documentation: Documentation,
+}
+
+impl Enum {
+ /// Name of the generated tag enum.
+ pub(crate) fn tag_name(&self) -> &str {
+ self.tag.as_deref().unwrap_or_else(|| self.export_name())
+ }
+
+ /// Enum with data turns into a union of structs with each struct having its own tag field.
+ pub(crate) fn inline_tag_field(repr: &Repr) -> bool {
+ repr.style != ReprStyle::C
+ }
+
+ pub fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
+ if self.is_generic() {
+ return;
+ }
+
+ for v in &self.variants {
+ v.add_monomorphs(library, out);
+ }
+ }
+
+ fn can_derive_eq(&self) -> bool {
+ if self.tag.is_none() {
+ return false;
+ }
+
+ self.variants.iter().all(|variant| match variant.body {
+ VariantBody::Empty(..) => true,
+ VariantBody::Body { ref body, .. } => body.can_derive_eq(),
+ })
+ }
+
+ pub fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
+ for variant in &mut self.variants {
+ variant.mangle_paths(monomorphs);
+ }
+ }
+
+ pub fn load(
+ item: &syn::ItemEnum,
+ mod_cfg: Option<&Cfg>,
+ config: &Config,
+ ) -> Result<Enum, String> {
+ let repr = Repr::load(&item.attrs)?;
+ if repr.style == ReprStyle::Rust && repr.ty.is_none() {
+ return Err("Enum is not marked with a valid #[repr(prim)] or #[repr(C)].".to_owned());
+ }
+ // TODO: Implement translation of aligned enums.
+ if repr.align.is_some() {
+ return Err("Enum is marked with #[repr(align(...))] or #[repr(packed)].".to_owned());
+ }
+
+ let path = Path::new(item.ident.unraw().to_string());
+ let generic_params = GenericParams::load(&item.generics)?;
+
+ let mut variants = Vec::new();
+ let mut has_data = false;
+
+ let annotations = AnnotationSet::load(&item.attrs)?;
+
+ for variant in item.variants.iter() {
+ let variant = EnumVariant::load(
+ Self::inline_tag_field(&repr),
+ variant,
+ generic_params.clone(),
+ mod_cfg,
+ &path,
+ &annotations,
+ config,
+ )?;
+ has_data = has_data || !variant.body.is_empty();
+ variants.push(variant);
+ }
+
+ if let Some(names) = annotations.list("enum-trailing-values") {
+ for name in names {
+ variants.push(EnumVariant::new(
+ name,
+ None,
+ VariantBody::empty(),
+ None,
+ Documentation::none(),
+ ));
+ }
+ }
+
+ if config.enumeration.add_sentinel(&annotations) {
+ variants.push(EnumVariant::new(
+ "Sentinel".to_owned(),
+ None,
+ VariantBody::empty(),
+ None,
+ Documentation::simple(" Must be last for serialization purposes"),
+ ));
+ }
+
+ let tag = if has_data {
+ Some("Tag".to_string())
+ } else {
+ None
+ };
+
+ Ok(Enum::new(
+ path,
+ generic_params,
+ repr,
+ variants,
+ tag,
+ Cfg::append(mod_cfg, Cfg::load(&item.attrs)),
+ annotations,
+ Documentation::load(&item.attrs),
+ ))
+ }
+
+ #[allow(clippy::too_many_arguments)]
+ pub fn new(
+ path: Path,
+ generic_params: GenericParams,
+ repr: Repr,
+ variants: Vec<EnumVariant>,
+ tag: Option<String>,
+ cfg: Option<Cfg>,
+ annotations: AnnotationSet,
+ documentation: Documentation,
+ ) -> Self {
+ let export_name = path.name().to_owned();
+ Self {
+ path,
+ export_name,
+ generic_params,
+ repr,
+ variants,
+ tag,
+ cfg,
+ annotations,
+ documentation,
+ }
+ }
+}
+
+impl Item for Enum {
+ fn path(&self) -> &Path {
+ &self.path
+ }
+
+ fn export_name(&self) -> &str {
+ &self.export_name
+ }
+
+ fn cfg(&self) -> Option<&Cfg> {
+ self.cfg.as_ref()
+ }
+
+ fn annotations(&self) -> &AnnotationSet {
+ &self.annotations
+ }
+
+ fn annotations_mut(&mut self) -> &mut AnnotationSet {
+ &mut self.annotations
+ }
+
+ fn documentation(&self) -> &Documentation {
+ &self.documentation
+ }
+
+ fn container(&self) -> ItemContainer {
+ ItemContainer::Enum(self.clone())
+ }
+
+ fn collect_declaration_types(&self, resolver: &mut DeclarationTypeResolver) {
+ if self.tag.is_some() {
+ if self.repr.style == ReprStyle::C {
+ resolver.add_struct(&self.path);
+ } else {
+ resolver.add_union(&self.path);
+ }
+ } else if self.repr.style == ReprStyle::C {
+ resolver.add_enum(&self.path);
+ } else {
+ // This is important to handle conflicting names with opaque items.
+ resolver.add_none(&self.path);
+ }
+ }
+
+ fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
+ for &mut ref mut var in &mut self.variants {
+ var.resolve_declaration_types(resolver);
+ }
+ }
+
+ fn generic_params(&self) -> &GenericParams {
+ &self.generic_params
+ }
+
+ fn rename_for_config(&mut self, config: &Config) {
+ config.export.rename(&mut self.export_name);
+
+ if config.language != Language::Cxx && self.tag.is_some() {
+ // it makes sense to always prefix Tag with type name in C
+ let new_tag = format!("{}_Tag", self.export_name);
+ if self.repr.style == ReprStyle::Rust {
+ for variant in &mut self.variants {
+ if let VariantBody::Body { ref mut body, .. } = variant.body {
+ let path = Path::new(new_tag.clone());
+ let generic_path = GenericPath::new(path, vec![]);
+ body.fields[0].ty = Type::Path(generic_path);
+ }
+ }
+ }
+ self.tag = Some(new_tag);
+ }
+
+ for variant in &mut self.variants {
+ reserved::escape(&mut variant.export_name);
+ if let Some(discriminant) = &mut variant.discriminant {
+ discriminant.rename_for_config(config);
+ }
+ if let VariantBody::Body {
+ ref mut name,
+ ref mut body,
+ ..
+ } = variant.body
+ {
+ body.rename_for_config(config);
+ reserved::escape(name);
+ }
+ }
+
+ if config.enumeration.prefix_with_name
+ || self.annotations.bool("prefix-with-name").unwrap_or(false)
+ {
+ let separator = if config.export.mangle.remove_underscores {
+ ""
+ } else {
+ "_"
+ };
+
+ for variant in &mut self.variants {
+ variant.export_name =
+ format!("{}{}{}", self.export_name, separator, variant.export_name);
+ if let VariantBody::Body { ref mut body, .. } = variant.body {
+ body.export_name =
+ format!("{}{}{}", self.export_name, separator, body.export_name());
+ }
+ }
+ }
+
+ let rules = self
+ .annotations
+ .parse_atom::<RenameRule>("rename-all")
+ .unwrap_or(config.enumeration.rename_variants);
+
+ if let Some(r) = rules.not_none() {
+ self.variants = self
+ .variants
+ .iter()
+ .map(|variant| {
+ EnumVariant::new(
+ r.apply(
+ &variant.export_name,
+ IdentifierType::EnumVariant {
+ prefix: &self.export_name,
+ },
+ )
+ .into_owned(),
+ variant.discriminant.clone(),
+ match variant.body {
+ VariantBody::Empty(..) => variant.body.clone(),
+ VariantBody::Body {
+ ref name,
+ ref body,
+ inline,
+ inline_casts,
+ } => VariantBody::Body {
+ name: r.apply(name, IdentifierType::StructMember).into_owned(),
+ body: body.clone(),
+ inline,
+ inline_casts,
+ },
+ },
+ variant.cfg.clone(),
+ variant.documentation.clone(),
+ )
+ })
+ .collect();
+ }
+ }
+
+ fn instantiate_monomorph(
+ &self,
+ generic_values: &[GenericArgument],
+ library: &Library,
+ out: &mut Monomorphs,
+ ) {
+ let mappings = self.generic_params.call(self.path.name(), generic_values);
+
+ for variant in &self.variants {
+ if let VariantBody::Body { ref body, .. } = variant.body {
+ body.instantiate_monomorph(generic_values, library, out);
+ }
+ }
+
+ let mangled_path = mangle::mangle_path(
+ &self.path,
+ generic_values,
+ &library.get_config().export.mangle,
+ );
+
+ let monomorph = Enum::new(
+ mangled_path,
+ GenericParams::default(),
+ self.repr,
+ self.variants
+ .iter()
+ .map(|v| v.specialize(generic_values, &mappings, library.get_config()))
+ .collect(),
+ self.tag.clone(),
+ self.cfg.clone(),
+ self.annotations.clone(),
+ self.documentation.clone(),
+ );
+
+ out.insert_enum(library, self, monomorph, generic_values.to_owned());
+ }
+
+ fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
+ for variant in &self.variants {
+ variant.add_dependencies(library, out);
+ }
+ }
+}
+
+impl Enum {
+ /// Emit the tag enum and convenience methods for it.
+ /// For enums with data this is only a part of the output,
+ /// but for enums without data it's the whole output (modulo doc comments etc.).
+ pub(crate) fn write_tag_enum<
+ F: Write,
+ LB: LanguageBackend,
+ WV: Fn(&mut LB, &mut SourceWriter<F>, &EnumVariant),
+ >(
+ &self,
+ config: &Config,
+ language_backend: &mut LB,
+ out: &mut SourceWriter<F>,
+ size: Option<&str>,
+ write_variant: WV,
+ ) {
+ let tag_name = self.tag_name();
+ // Open the tag enum.
+ match config.language {
+ Language::C => {
+ if let Some(prim) = size {
+ // If we need to specify size, then we have no choice but to create a typedef,
+ // so `config.style` is not respected.
+ write!(out, "enum");
+ if let Some(note) = self
+ .annotations
+ .deprecated_note(config, DeprecatedNoteKind::Enum)
+ {
+ write!(out, " {}", note);
+ }
+ write!(out, " {}", tag_name);
+
+ if config.cpp_compatible_c() {
+ out.new_line();
+ out.write("#ifdef __cplusplus");
+ out.new_line();
+ write!(out, " : {}", prim);
+ out.new_line();
+ out.write("#endif // __cplusplus");
+ out.new_line();
+ }
+ } else {
+ if config.style.generate_typedef() {
+ out.write("typedef ");
+ }
+ out.write("enum");
+ if let Some(note) = self
+ .annotations
+ .deprecated_note(config, DeprecatedNoteKind::Enum)
+ {
+ write!(out, " {}", note);
+ }
+ if config.style.generate_tag() {
+ write!(out, " {}", tag_name);
+ }
+ }
+ }
+ Language::Cxx => {
+ if config.enumeration.enum_class(&self.annotations) {
+ out.write("enum class");
+ } else {
+ out.write("enum");
+ }
+
+ if self.annotations.must_use(config) {
+ if let Some(ref anno) = config.enumeration.must_use {
+ write!(out, " {}", anno)
+ }
+ }
+
+ if let Some(note) = self
+ .annotations
+ .deprecated_note(config, DeprecatedNoteKind::Enum)
+ {
+ write!(out, " {}", note);
+ }
+
+ write!(out, " {}", tag_name);
+ if let Some(prim) = size {
+ write!(out, " : {}", prim);
+ }
+ }
+ Language::Cython => {
+ if size.is_some() {
+ // If we need to specify size, then we have no choice but to create a typedef,
+ // so `config.style` is not respected.
+ write!(out, "cdef enum");
+ } else {
+ write!(out, "{}enum {}", config.style.cython_def(), tag_name);
+ }
+ }
+ }
+ out.open_brace();
+
+ // Emit enumerators for the tag enum.
+ for (i, variant) in self.variants.iter().enumerate() {
+ if i != 0 {
+ out.new_line()
+ }
+ write_variant(language_backend, out, variant);
+ }
+
+ // Close the tag enum.
+ if config.language == Language::C && size.is_none() && config.style.generate_typedef() {
+ out.close_brace(false);
+ write!(out, " {};", tag_name);
+ } else {
+ out.close_brace(true);
+ }
+
+ // Emit typedef specifying the tag enum's size if necessary.
+ // In C++ enums can "inherit" from numeric types (`enum E: uint8_t { ... }`),
+ // but in C `typedef uint8_t E` is the only way to give a fixed size to `E`.
+ if let Some(prim) = size {
+ if config.cpp_compatible_c() {
+ out.new_line_if_not_start();
+ out.write("#ifndef __cplusplus");
+ }
+
+ if config.language != Language::Cxx {
+ out.new_line();
+ write!(out, "{} {} {};", config.language.typedef(), prim, tag_name);
+ }
+
+ if config.cpp_compatible_c() {
+ out.new_line_if_not_start();
+ out.write("#endif // __cplusplus");
+ }
+ }
+
+ // Emit convenience methods for the tag enum.
+ self.write_derived_functions_enum(config, language_backend, out);
+ }
+
+ /// The code here mirrors the beginning of `Struct::write` and `Union::write`.
+ pub(crate) fn open_struct_or_union<F: Write>(
+ &self,
+ config: &Config,
+ out: &mut SourceWriter<F>,
+ inline_tag_field: bool,
+ ) {
+ match config.language {
+ Language::C if config.style.generate_typedef() => out.write("typedef "),
+ Language::C | Language::Cxx => {}
+ Language::Cython => out.write(config.style.cython_def()),
+ }
+
+ out.write(if inline_tag_field { "union" } else { "struct" });
+
+ if self.annotations.must_use(config) {
+ if let Some(ref anno) = config.structure.must_use {
+ write!(out, " {}", anno);
+ }
+ }
+
+ if let Some(note) = self
+ .annotations
+ .deprecated_note(config, DeprecatedNoteKind::Struct)
+ {
+ write!(out, " {} ", note);
+ }
+
+ if config.language != Language::C || config.style.generate_tag() {
+ write!(out, " {}", self.export_name());
+ }
+
+ out.open_brace();
+
+ // Emit the pre_body section, if relevant.
+ if let Some(body) = config.export.pre_body(&self.path) {
+ out.write_raw_block(body);
+ out.new_line();
+ }
+ }
+
+ /// Emit struct definitions for variants having data.
+ pub(crate) fn write_variant_defs<F: Write, LB: LanguageBackend>(
+ &self,
+ config: &Config,
+ language_backend: &mut LB, // TODO probably need only one of Config/LanguageBackend
+ out: &mut SourceWriter<F>,
+ ) {
+ for variant in &self.variants {
+ if let VariantBody::Body {
+ ref body,
+ inline: false,
+ ..
+ } = variant.body
+ {
+ out.new_line();
+ out.new_line();
+ let condition = variant.cfg.to_condition(config);
+ // Cython doesn't support conditional enum variants.
+ if config.language != Language::Cython {
+ condition.write_before(config, out);
+ }
+ language_backend.write_struct(out, body);
+ if config.language != Language::Cython {
+ condition.write_after(config, out);
+ }
+ }
+ }
+ }
+
+ /// Emit tag field that is separate from all variants.
+ /// For non-inline tag scenario this is *the* tag field, and it does not exist in the variants.
+ /// For the inline tag scenario this is just a convenience and another way
+ /// to refer to the same tag that exist in all the variants.
+ pub(crate) fn write_tag_field<F: Write>(
+ &self,
+ config: &Config,
+ out: &mut SourceWriter<F>,
+ size: Option<&str>,
+ inline_tag_field: bool,
+ tag_name: &str,
+ ) {
+ // C++ allows accessing only common initial sequence of union
+ // fields so we have to wrap the tag field into an anonymous struct.
+ let wrap_tag = inline_tag_field && config.language == Language::Cxx;
+
+ if wrap_tag {
+ out.write("struct");
+ out.open_brace();
+ }
+
+ if config.language == Language::C && size.is_none() && !config.style.generate_typedef() {
+ out.write("enum ");
+ }
+
+ write!(out, "{} tag;", tag_name);
+
+ if wrap_tag {
+ out.close_brace(true);
+ }
+ }
+
+ /// Emit fields for all variants with data.
+ pub(crate) fn write_variant_fields<
+ F: Write,
+ LB: LanguageBackend,
+ WF: Fn(&mut LB, &mut SourceWriter<F>, &Field),
+ >(
+ &self,
+ config: &Config,
+ language_backend: &mut LB,
+ out: &mut SourceWriter<F>,
+ inline_tag_field: bool,
+ write_field: WF,
+ ) {
+ let mut first = true;
+ for variant in &self.variants {
+ if let VariantBody::Body {
+ name, body, inline, ..
+ } = &variant.body
+ {
+ if !first {
+ out.new_line();
+ }
+ first = false;
+ let condition = variant.cfg.to_condition(config);
+ // Cython doesn't support conditional enum variants.
+ if config.language != Language::Cython {
+ condition.write_before(config, out);
+ }
+ if *inline {
+ // Write definition of an inlined variant with data.
+ // Cython extern declarations don't manage layouts, layouts are defined entierly
+ // by the corresponding C code. So we can inline the unnamed struct and get the
+ // same observable result. Moreother we have to do it because Cython doesn't
+ // support unnamed structs.
+ // For the same reason with Cython we can omit per-variant tags (the first
+ // field) to avoid extra noise, the main `tag` is enough in this case.
+ if config.language != Language::Cython {
+ out.write("struct");
+ out.open_brace();
+ }
+ let start_field =
+ usize::from(inline_tag_field && config.language == Language::Cython);
+ out.write_vertical_source_list(
+ language_backend,
+ &body.fields[start_field..],
+ ListType::Cap(";"),
+ &write_field,
+ );
+ if config.language != Language::Cython {
+ out.close_brace(true);
+ }
+ } else if config.style.generate_typedef() || config.language == Language::Cython {
+ write!(out, "{} {};", body.export_name(), name);
+ } else {
+ write!(out, "struct {} {};", body.export_name(), name);
+ }
+ if config.language != Language::Cython {
+ condition.write_after(config, out);
+ }
+ }
+ }
+ }
+
+ // Emit convenience methods for enums themselves.
+ fn write_derived_functions_enum<F: Write, LB: LanguageBackend>(
+ &self,
+ config: &Config,
+ language_backend: &mut LB,
+ out: &mut SourceWriter<F>,
+ ) {
+ let has_data = self.tag.is_some();
+ let tag_name = self.tag_name();
+ if config.language != Language::Cxx {
+ return;
+ }
+
+ // Emit an ostream function if required.
+ if config.enumeration.derive_ostream(&self.annotations) {
+ // For enums without data, this emits the serializer function for the
+ // enum. For enums with data, this emits the serializer function for
+ // the tag enum. In the latter case we need a couple of minor changes
+ // due to the function living inside the top-level struct or enum.
+ let stream = config
+ .function
+ .rename_args
+ .apply("stream", IdentifierType::FunctionArg);
+ let instance = config
+ .function
+ .rename_args
+ .apply("instance", IdentifierType::FunctionArg);
+
+ out.new_line();
+ out.new_line();
+ // For enums without data, we mark the function inline because the
+ // header might get included into multiple compilation units that
+ // get linked together, and not marking it inline would result in
+ // multiply-defined symbol errors. For enums with data we don't have
+ // the same problem, but mark it as a friend function of the
+ // containing union/struct.
+ // Note also that for enums with data, the case labels for switch
+ // statements apparently need to be qualified to the top-level
+ // generated struct or union. This is why the generated case labels
+ // below use the A::B::C format for enums with data, with A being
+ // self.export_name(). Failure to have that qualification results
+ // in a surprising compilation failure for the generated header.
+ write!(
+ out,
+ "{} std::ostream& operator<<(std::ostream& {}, const {}& {})",
+ if has_data { "friend" } else { "inline" },
+ stream,
+ tag_name,
+ instance,
+ );
+
+ out.open_brace();
+ if has_data {
+ // C++ name resolution rules are weird.
+ write!(
+ out,
+ "using {} = {}::{};",
+ tag_name,
+ self.export_name(),
+ tag_name
+ );
+ out.new_line();
+ }
+ write!(out, "switch ({})", instance);
+ out.open_brace();
+ let vec: Vec<_> = self
+ .variants
+ .iter()
+ .map(|x| {
+ format!(
+ "case {}::{}: {} << \"{}\"; break;",
+ tag_name, x.export_name, stream, x.export_name
+ )
+ })
+ .collect();
+ out.write_vertical_source_list(
+ language_backend,
+ &vec[..],
+ ListType::Join(""),
+ |_, out, s| write!(out, "{}", s),
+ );
+ out.close_brace(false);
+ out.new_line();
+
+ write!(out, "return {};", stream);
+ out.close_brace(false);
+
+ if has_data {
+ // For enums with data, this emits the serializer function for
+ // the top-level union or struct.
+ out.new_line();
+ out.new_line();
+ write!(
+ out,
+ "friend std::ostream& operator<<(std::ostream& {}, const {}& {})",
+ stream,
+ self.export_name(),
+ instance,
+ );
+
+ out.open_brace();
+
+ // C++ name resolution rules are weird.
+ write!(
+ out,
+ "using {} = {}::{};",
+ tag_name,
+ self.export_name(),
+ tag_name
+ );
+ out.new_line();
+
+ write!(out, "switch ({}.tag)", instance);
+ out.open_brace();
+ let vec: Vec<_> = self
+ .variants
+ .iter()
+ .map(|x| {
+ let tag_str = format!("\"{}\"", x.export_name);
+ if let VariantBody::Body {
+ ref name, ref body, ..
+ } = x.body
+ {
+ format!(
+ "case {}::{}: {} << {}{}{}.{}; break;",
+ tag_name,
+ x.export_name,
+ stream,
+ if body.has_tag_field { "" } else { &tag_str },
+ if body.has_tag_field { "" } else { " << " },
+ instance,
+ name,
+ )
+ } else {
+ format!(
+ "case {}::{}: {} << {}; break;",
+ tag_name, x.export_name, stream, tag_str,
+ )
+ }
+ })
+ .collect();
+ out.write_vertical_source_list(
+ language_backend,
+ &vec[..],
+ ListType::Join(""),
+ |_, out, s| write!(out, "{}", s),
+ );
+ out.close_brace(false);
+ out.new_line();
+
+ write!(out, "return {};", stream);
+ out.close_brace(false);
+ }
+ }
+ }
+
+ // Emit convenience methods for structs or unions produced for enums with data.
+ pub(crate) fn write_derived_functions_data<
+ F: Write,
+ LB: LanguageBackend,
+ WF: Fn(&mut LB, &mut SourceWriter<F>, &Field),
+ >(
+ &self,
+ config: &Config,
+ language_backend: &mut LB,
+ out: &mut SourceWriter<F>,
+ tag_name: &str,
+ write_field: WF,
+ ) {
+ if config.language != Language::Cxx {
+ return;
+ }
+
+ if config.enumeration.derive_helper_methods(&self.annotations) {
+ for variant in &self.variants {
+ out.new_line();
+ out.new_line();
+
+ let condition = variant.cfg.to_condition(config);
+ condition.write_before(config, out);
+
+ let arg_renamer = |name: &str| {
+ config
+ .function
+ .rename_args
+ .apply(name, IdentifierType::FunctionArg)
+ .into_owned()
+ };
+
+ macro_rules! write_attrs {
+ ($op:expr) => {{
+ if let Some(Some(attrs)) =
+ variant
+ .body
+ .annotations()
+ .atom(concat!("variant-", $op, "-attributes"))
+ {
+ write!(out, "{} ", attrs);
+ }
+ }};
+ }
+
+ write_attrs!("constructor");
+ write!(out, "static {} {}(", self.export_name, variant.export_name);
+
+ if let VariantBody::Body { ref body, .. } = variant.body {
+ let skip_fields = body.has_tag_field as usize;
+ let vec: Vec<_> = body
+ .fields
+ .iter()
+ .skip(skip_fields)
+ .map(|field| {
+ Field::from_name_and_type(
+ // const-ref args to constructor
+ arg_renamer(&field.name),
+ Type::const_ref_to(&field.ty),
+ )
+ })
+ .collect();
+ out.write_vertical_source_list(
+ language_backend,
+ &vec[..],
+ ListType::Join(","),
+ &write_field,
+ );
+ }
+
+ write!(out, ")");
+ out.open_brace();
+
+ write!(out, "{} result;", self.export_name);
+
+ if let VariantBody::Body {
+ name: ref variant_name,
+ ref body,
+ ..
+ } = variant.body
+ {
+ let skip_fields = body.has_tag_field as usize;
+ for field in body.fields.iter().skip(skip_fields) {
+ out.new_line();
+ match field.ty {
+ Type::Array(ref ty, ref length) => {
+ // arrays are not assignable in C++ so we
+ // need to manually copy the elements
+ write!(out, "for (int i = 0; i < {}; i++)", length.as_str());
+ out.open_brace();
+ write!(out, "::new (&result.{}.{}[i]) (", variant_name, field.name);
+ language_backend.write_type(out, ty);
+ write!(out, ")({}[i]);", arg_renamer(&field.name));
+ out.close_brace(false);
+ }
+ ref ty => {
+ write!(out, "::new (&result.{}.{}) (", variant_name, field.name);
+ language_backend.write_type(out, ty);
+ write!(out, ")({});", arg_renamer(&field.name));
+ }
+ }
+ }
+ }
+
+ out.new_line();
+ write!(out, "result.tag = {}::{};", tag_name, variant.export_name);
+ out.new_line();
+ write!(out, "return result;");
+ out.close_brace(false);
+
+ out.new_line();
+ out.new_line();
+
+ write_attrs!("is");
+ // FIXME: create a config for method case
+ write!(out, "bool Is{}() const", variant.export_name);
+ out.open_brace();
+ write!(out, "return tag == {}::{};", tag_name, variant.export_name);
+ out.close_brace(false);
+
+ let assert_name = match config.enumeration.cast_assert_name {
+ Some(ref n) => &**n,
+ None => "assert",
+ };
+
+ let mut derive_casts = |const_casts: bool| {
+ let (member_name, body, inline_casts) = match variant.body {
+ VariantBody::Body {
+ ref name,
+ ref body,
+ inline_casts,
+ ..
+ } => (name, body, inline_casts),
+ VariantBody::Empty(..) => return,
+ };
+
+ let skip_fields = body.has_tag_field as usize;
+ let field_count = body.fields.len() - skip_fields;
+ if field_count == 0 {
+ return;
+ }
+
+ out.new_line();
+ out.new_line();
+
+ if const_casts {
+ write_attrs!("const-cast");
+ } else {
+ write_attrs!("mut-cast");
+ }
+ if inline_casts {
+ let field = body.fields.last().unwrap();
+ let return_type = field.ty.clone();
+ let return_type = Type::Ptr {
+ ty: Box::new(return_type),
+ is_const: const_casts,
+ is_ref: true,
+ is_nullable: false,
+ };
+ language_backend.write_type(out, &return_type);
+ } else if const_casts {
+ write!(out, "const {}&", body.export_name());
+ } else {
+ write!(out, "{}&", body.export_name());
+ }
+
+ write!(out, " As{}()", variant.export_name);
+ if const_casts {
+ write!(out, " const");
+ }
+ out.open_brace();
+ write!(out, "{}(Is{}());", assert_name, variant.export_name);
+ out.new_line();
+ write!(out, "return {}", member_name);
+ if inline_casts {
+ write!(out, "._0");
+ }
+ write!(out, ";");
+ out.close_brace(false);
+ };
+
+ if config.enumeration.derive_const_casts(&self.annotations) {
+ derive_casts(true)
+ }
+
+ if config.enumeration.derive_mut_casts(&self.annotations) {
+ derive_casts(false)
+ }
+
+ condition.write_after(config, out);
+ }
+ }
+
+ let other = config
+ .function
+ .rename_args
+ .apply("other", IdentifierType::FunctionArg);
+
+ macro_rules! write_attrs {
+ ($op:expr) => {{
+ if let Some(Some(attrs)) = self.annotations.atom(concat!($op, "-attributes")) {
+ write!(out, "{} ", attrs);
+ }
+ }};
+ }
+
+ if self.can_derive_eq() && config.structure.derive_eq(&self.annotations) {
+ out.new_line();
+ out.new_line();
+ write_attrs!("eq");
+ write!(
+ out,
+ "bool operator==(const {}& {}) const",
+ self.export_name, other
+ );
+ out.open_brace();
+ write!(out, "if (tag != {}.tag)", other);
+ out.open_brace();
+ write!(out, "return false;");
+ out.close_brace(false);
+ out.new_line();
+ write!(out, "switch (tag)");
+ out.open_brace();
+ let mut exhaustive = true;
+ for variant in &self.variants {
+ if let VariantBody::Body {
+ name: ref variant_name,
+ ..
+ } = variant.body
+ {
+ let condition = variant.cfg.to_condition(config);
+ condition.write_before(config, out);
+ write!(
+ out,
+ "case {}::{}: return {} == {}.{};",
+ self.tag.as_ref().unwrap(),
+ variant.export_name,
+ variant_name,
+ other,
+ variant_name
+ );
+ condition.write_after(config, out);
+ out.new_line();
+ } else {
+ exhaustive = false;
+ }
+ }
+ if !exhaustive {
+ write!(out, "default: break;");
+ }
+ out.close_brace(false);
+
+ out.new_line();
+ write!(out, "return true;");
+
+ out.close_brace(false);
+
+ if config.structure.derive_neq(&self.annotations) {
+ out.new_line();
+ out.new_line();
+ write_attrs!("neq");
+ write!(
+ out,
+ "bool operator!=(const {}& {}) const",
+ self.export_name, other
+ );
+ out.open_brace();
+ write!(out, "return !(*this == {});", other);
+ out.close_brace(false);
+ }
+ }
+
+ if config
+ .enumeration
+ .private_default_tagged_enum_constructor(&self.annotations)
+ {
+ out.new_line();
+ out.new_line();
+ write!(out, "private:");
+ out.new_line();
+ write!(out, "{}()", self.export_name);
+ out.open_brace();
+ out.close_brace(false);
+ out.new_line();
+ write!(out, "public:");
+ out.new_line();
+ }
+
+ if config
+ .enumeration
+ .derive_tagged_enum_destructor(&self.annotations)
+ {
+ out.new_line();
+ out.new_line();
+ write_attrs!("destructor");
+ write!(out, "~{}()", self.export_name);
+ out.open_brace();
+ write!(out, "switch (tag)");
+ out.open_brace();
+ let mut exhaustive = true;
+ for variant in &self.variants {
+ if let VariantBody::Body {
+ ref name, ref body, ..
+ } = variant.body
+ {
+ let condition = variant.cfg.to_condition(config);
+ condition.write_before(config, out);
+ write!(
+ out,
+ "case {}::{}: {}.~{}(); break;",
+ self.tag.as_ref().unwrap(),
+ variant.export_name,
+ name,
+ body.export_name(),
+ );
+ condition.write_after(config, out);
+ out.new_line();
+ } else {
+ exhaustive = false;
+ }
+ }
+ if !exhaustive {
+ write!(out, "default: break;");
+ }
+ out.close_brace(false);
+ out.close_brace(false);
+ }
+
+ if config
+ .enumeration
+ .derive_tagged_enum_copy_constructor(&self.annotations)
+ {
+ out.new_line();
+ out.new_line();
+ write_attrs!("copy-constructor");
+ write!(
+ out,
+ "{}(const {}& {})",
+ self.export_name, self.export_name, other
+ );
+ out.new_line();
+ write!(out, " : tag({}.tag)", other);
+ out.open_brace();
+ write!(out, "switch (tag)");
+ out.open_brace();
+ let mut exhaustive = true;
+ for variant in &self.variants {
+ if let VariantBody::Body {
+ ref name, ref body, ..
+ } = variant.body
+ {
+ let condition = variant.cfg.to_condition(config);
+ condition.write_before(config, out);
+ write!(
+ out,
+ "case {}::{}: ::new (&{}) ({})({}.{}); break;",
+ self.tag.as_ref().unwrap(),
+ variant.export_name,
+ name,
+ body.export_name(),
+ other,
+ name,
+ );
+ condition.write_after(config, out);
+ out.new_line();
+ } else {
+ exhaustive = false;
+ }
+ }
+ if !exhaustive {
+ write!(out, "default: break;");
+ }
+ out.close_brace(false);
+ out.close_brace(false);
+
+ if config
+ .enumeration
+ .derive_tagged_enum_copy_assignment(&self.annotations)
+ {
+ out.new_line();
+ write_attrs!("copy-assignment");
+ write!(
+ out,
+ "{}& operator=(const {}& {})",
+ self.export_name, self.export_name, other
+ );
+ out.open_brace();
+ write!(out, "if (this != &{})", other);
+ out.open_brace();
+ write!(out, "this->~{}();", self.export_name);
+ out.new_line();
+ write!(out, "new (this) {}({});", self.export_name, other);
+ out.close_brace(false);
+ out.new_line();
+ write!(out, "return *this;");
+ out.close_brace(false);
+ }
+ }
+ }
+
+ pub fn simplify_standard_types(&mut self, config: &Config) {
+ for variant in &mut self.variants {
+ variant.simplify_standard_types(config);
+ }
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/field.rs b/cbindgen-0.27.0/src/bindgen/ir/field.rs
new file mode 100644
index 0000000..73019ee
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/field.rs
@@ -0,0 +1,45 @@
+use syn::ext::IdentExt;
+
+use crate::bindgen::ir::{AnnotationSet, Cfg};
+use crate::bindgen::ir::{Documentation, Path, Type};
+
+#[derive(Debug, Clone)]
+pub struct Field {
+ pub name: String,
+ pub ty: Type,
+ pub cfg: Option<Cfg>,
+ pub annotations: AnnotationSet,
+ pub documentation: Documentation,
+}
+
+impl Field {
+ pub fn from_name_and_type(name: String, ty: Type) -> Field {
+ Field {
+ name,
+ ty,
+ cfg: None,
+ annotations: AnnotationSet::new(),
+ documentation: Documentation::none(),
+ }
+ }
+
+ pub fn load(field: &syn::Field, self_path: &Path) -> Result<Option<Field>, String> {
+ Ok(if let Some(mut ty) = Type::load(&field.ty)? {
+ ty.replace_self_with(self_path);
+ Some(Field {
+ name: field
+ .ident
+ .as_ref()
+ .ok_or_else(|| "field is missing identifier".to_string())?
+ .unraw()
+ .to_string(),
+ ty,
+ cfg: Cfg::load(&field.attrs),
+ annotations: AnnotationSet::load(&field.attrs)?,
+ documentation: Documentation::load(&field.attrs),
+ })
+ } else {
+ None
+ })
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/function.rs b/cbindgen-0.27.0/src/bindgen/ir/function.rs
new file mode 100644
index 0000000..79adfce
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/function.rs
@@ -0,0 +1,291 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::collections::HashMap;
+
+use syn::ext::IdentExt;
+
+use crate::bindgen::config::{Config, Language};
+use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
+use crate::bindgen::dependencies::Dependencies;
+use crate::bindgen::ir::{AnnotationSet, Cfg, Documentation, GenericPath, Path, Type};
+use crate::bindgen::library::Library;
+use crate::bindgen::monomorph::Monomorphs;
+use crate::bindgen::rename::{IdentifierType, RenameRule};
+use crate::bindgen::reserved;
+use crate::bindgen::utilities::IterHelpers;
+
+#[derive(Debug, Clone)]
+pub struct FunctionArgument {
+ pub name: Option<String>,
+ pub ty: Type,
+ pub array_length: Option<String>,
+}
+
+#[derive(Debug, Clone)]
+pub struct Function {
+ pub path: Path,
+ /// Path to the self-type of the function
+ /// If the function is a method, this will contain the path of the type in the impl block
+ pub self_type_path: Option<Path>,
+ pub ret: Type,
+ pub args: Vec<FunctionArgument>,
+ pub extern_decl: bool,
+ pub cfg: Option<Cfg>,
+ pub annotations: AnnotationSet,
+ pub documentation: Documentation,
+ pub never_return: bool,
+}
+
+impl Function {
+ pub fn load(
+ path: Path,
+ self_type_path: Option<&Path>,
+ sig: &syn::Signature,
+ extern_decl: bool,
+ attrs: &[syn::Attribute],
+ mod_cfg: Option<&Cfg>,
+ ) -> Result<Function, String> {
+ let mut args = sig.inputs.iter().try_skip_map(|x| x.as_argument())?;
+ if sig.variadic.is_some() {
+ args.push(FunctionArgument {
+ name: None,
+ ty: Type::Primitive(super::PrimitiveType::VaList),
+ array_length: None,
+ })
+ }
+
+ let (mut ret, never_return) = Type::load_from_output(&sig.output)?;
+
+ if let Some(self_path) = self_type_path {
+ for arg in &mut args {
+ arg.ty.replace_self_with(self_path);
+ }
+ ret.replace_self_with(self_path);
+ }
+
+ Ok(Function {
+ path,
+ self_type_path: self_type_path.cloned(),
+ ret,
+ args,
+ extern_decl,
+ cfg: Cfg::append(mod_cfg, Cfg::load(attrs)),
+ annotations: AnnotationSet::load(attrs)?,
+ documentation: Documentation::load(attrs),
+ never_return,
+ })
+ }
+
+ pub fn swift_name(&self, config: &Config) -> Option<String> {
+ if config.language == Language::Cython {
+ return None;
+ }
+ // If the symbol name starts with the type name, separate the two components with '.'
+ // so that Swift recognises the association between the method and the type
+ let (ref type_prefix, ref type_name) = match self.self_type_path {
+ Some(ref type_name) => {
+ let type_name = type_name.to_string();
+ if !self.path.name().starts_with(&type_name) {
+ return Some(self.path.to_string());
+ }
+ (format!("{}.", type_name), type_name)
+ }
+ None => ("".to_string(), "".to_string()),
+ };
+
+ let item_name = self
+ .path
+ .name()
+ .trim_start_matches(type_name)
+ .trim_start_matches('_');
+
+ let item_args = {
+ let mut items = Vec::with_capacity(self.args.len());
+ for arg in self.args.iter() {
+ items.push(format!("{}:", arg.name.as_ref()?.as_str()));
+ }
+ items.join("")
+ };
+ Some(format!("{}{}({})", type_prefix, item_name, item_args))
+ }
+
+ pub fn path(&self) -> &Path {
+ &self.path
+ }
+
+ pub fn simplify_standard_types(&mut self, config: &Config) {
+ self.ret.simplify_standard_types(config);
+ for arg in &mut self.args {
+ arg.ty.simplify_standard_types(config);
+ }
+ }
+
+ pub fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
+ self.ret.add_dependencies(library, out);
+ for arg in &self.args {
+ arg.ty.add_dependencies(library, out);
+ }
+ }
+
+ pub fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
+ self.ret.add_monomorphs(library, out);
+ for arg in &self.args {
+ arg.ty.add_monomorphs(library, out);
+ }
+ }
+
+ pub fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
+ self.ret.mangle_paths(monomorphs);
+ for arg in &mut self.args {
+ arg.ty.mangle_paths(monomorphs);
+ }
+ }
+
+ pub fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
+ self.ret.resolve_declaration_types(resolver);
+ for arg in &mut self.args {
+ arg.ty.resolve_declaration_types(resolver);
+ }
+ }
+
+ pub fn rename_for_config(&mut self, config: &Config) {
+ // Rename the types used in arguments
+ let generic_params = Default::default();
+ self.ret.rename_for_config(config, &generic_params);
+
+ // Apply rename rules to argument names
+ let rules = self
+ .annotations
+ .parse_atom::<RenameRule>("rename-all")
+ .unwrap_or(config.function.rename_args);
+
+ if let Some(r) = rules.not_none() {
+ let args = std::mem::take(&mut self.args);
+ self.args = args
+ .into_iter()
+ .map(|arg| {
+ let name = arg
+ .name
+ .map(|n| r.apply(&n, IdentifierType::FunctionArg).into_owned());
+ FunctionArgument {
+ name,
+ ty: arg.ty,
+ array_length: None,
+ }
+ })
+ .collect()
+ }
+
+ // Escape C/C++ reserved keywords used in argument names, and
+ // recursively rename argument types.
+ for arg in &mut self.args {
+ arg.ty.rename_for_config(config, &generic_params);
+ if let Some(ref mut name) = arg.name {
+ reserved::escape(name);
+ }
+ }
+
+ // Save the array length of the pointer arguments which need to use
+ // the C-array notation
+ if let Some(tuples) = self.annotations.list("ptrs-as-arrays") {
+ let mut ptrs_as_arrays: HashMap<String, String> = HashMap::new();
+ for str_tuple in tuples {
+ let parts: Vec<&str> = str_tuple[1..str_tuple.len() - 1]
+ .split(';')
+ .map(|x| x.trim())
+ .collect();
+ if parts.len() != 2 {
+ warn!(
+ "{:?} does not follow the correct syntax, so the annotation is being ignored",
+ parts
+ );
+ continue;
+ }
+ ptrs_as_arrays.insert(parts[0].to_string(), parts[1].to_string());
+ }
+
+ for arg in &mut self.args {
+ match arg.ty {
+ Type::Ptr { .. } => {}
+ _ => continue,
+ }
+ let name = match arg.name {
+ Some(ref name) => name,
+ None => continue,
+ };
+ arg.array_length = ptrs_as_arrays.get(name).cloned();
+ }
+ }
+ }
+}
+
+trait SynFnArgHelpers {
+ fn as_argument(&self) -> Result<Option<FunctionArgument>, String>;
+}
+
+fn gen_self_type(receiver: &syn::Receiver) -> Result<Type, String> {
+ let mut self_ty = Type::Path(GenericPath::self_path());
+
+ // Custom self type
+ if receiver.colon_token.is_some() {
+ self_ty = Type::load(receiver.ty.as_ref())?.unwrap_or(self_ty);
+ }
+
+ if receiver.reference.is_none() {
+ return Ok(self_ty);
+ }
+
+ let is_const = receiver.mutability.is_none();
+ Ok(Type::Ptr {
+ ty: Box::new(self_ty),
+ is_const,
+ is_nullable: false,
+ is_ref: false,
+ })
+}
+
+impl SynFnArgHelpers for syn::FnArg {
+ fn as_argument(&self) -> Result<Option<FunctionArgument>, String> {
+ match *self {
+ syn::FnArg::Typed(syn::PatType {
+ ref pat, ref ty, ..
+ }) => {
+ let ty = match Type::load(ty)? {
+ Some(x) => x,
+ None => return Ok(None),
+ };
+ let name = match **pat {
+ syn::Pat::Wild(..) => None,
+ syn::Pat::Ident(syn::PatIdent { ref ident, .. }) => {
+ if ty == Type::Primitive(super::PrimitiveType::VaList) {
+ None
+ } else {
+ Some(ident.unraw().to_string())
+ }
+ }
+ _ => {
+ return Err(format!(
+ "Parameter has an unsupported argument name: {:?}",
+ pat
+ ))
+ }
+ };
+ if let Type::Array(..) = ty {
+ return Err("Array as function arguments are not supported".to_owned());
+ }
+ Ok(Some(FunctionArgument {
+ name,
+ ty,
+ array_length: None,
+ }))
+ }
+ syn::FnArg::Receiver(ref receiver) => Ok(Some(FunctionArgument {
+ name: Some("self".to_string()),
+ ty: gen_self_type(receiver)?,
+ array_length: None,
+ })),
+ }
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/generic_path.rs b/cbindgen-0.27.0/src/bindgen/ir/generic_path.rs
new file mode 100644
index 0000000..4610641
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/generic_path.rs
@@ -0,0 +1,343 @@
+use std::io::Write;
+use std::ops::Deref;
+
+use syn::ext::IdentExt;
+
+use crate::bindgen::cdecl;
+use crate::bindgen::config::{Config, Language};
+use crate::bindgen::declarationtyperesolver::{DeclarationType, DeclarationTypeResolver};
+use crate::bindgen::ir::{ConstExpr, Path, Type};
+use crate::bindgen::language_backend::LanguageBackend;
+use crate::bindgen::utilities::IterHelpers;
+use crate::bindgen::writer::SourceWriter;
+
+#[derive(Debug, Clone)]
+pub enum GenericParamType {
+ Type,
+ Const(Type),
+}
+
+#[derive(Debug, Clone)]
+pub struct GenericParam {
+ name: Path,
+ ty: GenericParamType,
+ default: Option<GenericArgument>,
+}
+
+impl GenericParam {
+ pub fn new_type_param(name: &str) -> Self {
+ GenericParam {
+ name: Path::new(name),
+ ty: GenericParamType::Type,
+ default: None,
+ }
+ }
+
+ pub fn load(param: &syn::GenericParam) -> Result<Option<Self>, String> {
+ match *param {
+ syn::GenericParam::Type(syn::TypeParam {
+ ref ident,
+ ref default,
+ ..
+ }) => {
+ let default = match default.as_ref().map(Type::load).transpose()? {
+ None => None,
+ Some(None) => Err(format!("unsupported generic type default: {:?}", default))?,
+ Some(Some(ty)) => Some(GenericArgument::Type(ty)),
+ };
+ Ok(Some(GenericParam {
+ name: Path::new(ident.unraw().to_string()),
+ ty: GenericParamType::Type,
+ default,
+ }))
+ }
+
+ syn::GenericParam::Lifetime(_) => Ok(None),
+
+ syn::GenericParam::Const(syn::ConstParam {
+ ref ident,
+ ref ty,
+ ref default,
+ ..
+ }) => match Type::load(ty)? {
+ None => {
+ // A type that evaporates, like PhantomData.
+ Err(format!("unsupported const generic type: {:?}", ty))
+ }
+ Some(ty) => Ok(Some(GenericParam {
+ name: Path::new(ident.unraw().to_string()),
+ ty: GenericParamType::Const(ty),
+ default: default
+ .as_ref()
+ .map(ConstExpr::load)
+ .transpose()?
+ .map(GenericArgument::Const),
+ })),
+ },
+ }
+ }
+
+ pub fn name(&self) -> &Path {
+ &self.name
+ }
+}
+
+#[derive(Default, Debug, Clone)]
+pub struct GenericParams(pub Vec<GenericParam>);
+
+static EMPTY_GENERIC_PARAMS: GenericParams = GenericParams(Vec::new());
+impl GenericParams {
+ /// An empty generic params, for convenience.
+ pub fn empty() -> &'static Self {
+ &EMPTY_GENERIC_PARAMS
+ }
+
+ pub fn load(generics: &syn::Generics) -> Result<Self, String> {
+ let mut params = vec![];
+ for param in &generics.params {
+ if let Some(p) = GenericParam::load(param)? {
+ params.push(p);
+ }
+ }
+
+ Ok(GenericParams(params))
+ }
+
+ /// Associate each parameter with an argument.
+ pub fn call<'out>(
+ &'out self,
+ item_name: &str,
+ arguments: &'out [GenericArgument],
+ ) -> Vec<(&'out Path, &'out GenericArgument)> {
+ assert!(
+ self.len() >= arguments.len(),
+ "{} has {} params but is being instantiated with {} values",
+ item_name,
+ self.len(),
+ arguments.len(),
+ );
+ self.iter()
+ .enumerate()
+ .map(|(i, param)| {
+ // Fall back to the GenericParam default if no GenericArgument is available.
+ let arg = arguments
+ .get(i)
+ .or(param.default.as_ref())
+ .unwrap_or_else(|| {
+ panic!(
+ "{} with {} params is being instantiated with only {} values, \
+ and param {} lacks a default value",
+ item_name,
+ self.len(),
+ arguments.len(),
+ i
+ )
+ });
+ (param.name(), arg)
+ })
+ .collect()
+ }
+
+ pub(crate) fn write_internal<F: Write, LB: LanguageBackend>(
+ &self,
+ language_backend: &mut LB,
+ config: &Config,
+ out: &mut SourceWriter<F>,
+ with_default: bool,
+ ) {
+ if !self.0.is_empty() && config.language == Language::Cxx {
+ out.write("template<");
+ for (i, item) in self.0.iter().enumerate() {
+ if i != 0 {
+ out.write(", ");
+ }
+ match item.ty {
+ GenericParamType::Type => {
+ write!(out, "typename {}", item.name);
+ if let Some(GenericArgument::Type(ref ty)) = item.default {
+ write!(out, " = ");
+ cdecl::write_type(language_backend, out, ty, config);
+ } else if with_default {
+ write!(out, " = void");
+ }
+ }
+ GenericParamType::Const(ref ty) => {
+ cdecl::write_field(language_backend, out, ty, item.name.name(), config);
+ if let Some(GenericArgument::Const(ref expr)) = item.default {
+ write!(out, " = {}", expr.as_str());
+ } else if with_default {
+ write!(out, " = 0");
+ }
+ }
+ }
+ }
+ out.write(">");
+ out.new_line();
+ }
+ }
+
+ pub fn write_with_default<F: Write, LB: LanguageBackend>(
+ &self,
+ language_backend: &mut LB,
+ config: &Config,
+ out: &mut SourceWriter<F>,
+ ) {
+ self.write_internal(language_backend, config, out, true);
+ }
+}
+
+impl Deref for GenericParams {
+ type Target = [GenericParam];
+
+ fn deref(&self) -> &[GenericParam] {
+ &self.0
+ }
+}
+
+/// A (non-lifetime) argument passed to a generic, either a type or a constant expression.
+///
+/// Note: Both arguments in a type like `Array<T, N>` are represented as
+/// `GenericArgument::Type`s, even if `N` is actually the name of a const. This
+/// is a consequence of `syn::GenericArgument` doing the same thing.
+#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
+pub enum GenericArgument {
+ Type(Type),
+ Const(ConstExpr),
+}
+
+impl GenericArgument {
+ pub fn specialize(&self, mappings: &[(&Path, &GenericArgument)]) -> GenericArgument {
+ match *self {
+ GenericArgument::Type(ref ty) => {
+ if let Type::Path(ref path) = *ty {
+ if path.is_single_identifier() {
+ // See note on `GenericArgument` above: `ty` may
+ // actually be the name of a const. Check for that now.
+ for &(name, value) in mappings {
+ if *name == path.path {
+ return value.clone();
+ }
+ }
+ }
+ }
+ GenericArgument::Type(ty.specialize(mappings))
+ }
+ GenericArgument::Const(ref expr) => GenericArgument::Const(expr.clone()),
+ }
+ }
+
+ pub fn rename_for_config(&mut self, config: &Config, generic_params: &GenericParams) {
+ match *self {
+ GenericArgument::Type(ref mut ty) => ty.rename_for_config(config, generic_params),
+ GenericArgument::Const(ref mut expr) => expr.rename_for_config(config),
+ }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
+pub struct GenericPath {
+ path: Path,
+ export_name: String,
+ generics: Vec<GenericArgument>,
+ ctype: Option<DeclarationType>,
+}
+
+impl GenericPath {
+ pub fn new(path: Path, generics: Vec<GenericArgument>) -> Self {
+ let export_name = path.name().to_owned();
+ Self {
+ path,
+ export_name,
+ generics,
+ ctype: None,
+ }
+ }
+
+ pub fn self_path() -> Self {
+ Self::new(Path::new("Self"), vec![])
+ }
+
+ pub fn replace_self_with(&mut self, self_ty: &Path) {
+ if self.path.replace_self_with(self_ty) {
+ self_ty.name().clone_into(&mut self.export_name);
+ }
+ // Caller deals with generics.
+ }
+
+ pub fn path(&self) -> &Path {
+ &self.path
+ }
+
+ pub fn generics(&self) -> &[GenericArgument] {
+ &self.generics
+ }
+
+ pub fn generics_mut(&mut self) -> &mut [GenericArgument] {
+ &mut self.generics
+ }
+
+ pub fn ctype(&self) -> Option<&DeclarationType> {
+ self.ctype.as_ref()
+ }
+
+ pub fn name(&self) -> &str {
+ self.path.name()
+ }
+
+ pub fn export_name(&self) -> &str {
+ &self.export_name
+ }
+
+ pub fn is_single_identifier(&self) -> bool {
+ self.generics.is_empty()
+ }
+
+ pub fn rename_for_config(&mut self, config: &Config, generic_params: &GenericParams) {
+ for generic in &mut self.generics {
+ generic.rename_for_config(config, generic_params);
+ }
+ if !generic_params.iter().any(|param| param.name == self.path) {
+ config.export.rename(&mut self.export_name);
+ }
+ }
+
+ pub fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
+ self.ctype = resolver.type_for(&self.path);
+ }
+
+ pub fn load(path: &syn::Path) -> Result<Self, String> {
+ assert!(
+ !path.segments.is_empty(),
+ "{:?} doesn't have any segments",
+ path
+ );
+ let last_segment = path.segments.last().unwrap();
+ let name = last_segment.ident.unraw().to_string();
+
+ let path = Path::new(name);
+ let phantom_data_path = Path::new("PhantomData");
+ if path == phantom_data_path {
+ return Ok(Self::new(path, Vec::new()));
+ }
+
+ let generics = match last_segment.arguments {
+ syn::PathArguments::AngleBracketed(syn::AngleBracketedGenericArguments {
+ ref args,
+ ..
+ }) => args.iter().try_skip_map(|x| match *x {
+ syn::GenericArgument::Type(ref x) => Ok(Type::load(x)?.map(GenericArgument::Type)),
+ syn::GenericArgument::Lifetime(_) => Ok(None),
+ syn::GenericArgument::Const(ref x) => {
+ Ok(Some(GenericArgument::Const(ConstExpr::load(x)?)))
+ }
+ _ => Err(format!("can't handle generic argument {:?}", x)),
+ })?,
+ syn::PathArguments::Parenthesized(_) => {
+ return Err("Path contains parentheses.".to_owned());
+ }
+ _ => Vec::new(),
+ };
+
+ Ok(Self::new(path, generics))
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/global.rs b/cbindgen-0.27.0/src/bindgen/ir/global.rs
new file mode 100644
index 0000000..7816a29
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/global.rs
@@ -0,0 +1,115 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use crate::bindgen::config::Config;
+use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
+use crate::bindgen::dependencies::Dependencies;
+use crate::bindgen::ir::{
+ AnnotationSet, Cfg, Documentation, GenericParams, Item, ItemContainer, Path, Type,
+};
+use crate::bindgen::library::Library;
+
+#[derive(Debug, Clone)]
+pub struct Static {
+ pub path: Path,
+ pub export_name: String,
+ pub ty: Type,
+ pub mutable: bool,
+ pub cfg: Option<Cfg>,
+ pub annotations: AnnotationSet,
+ pub documentation: Documentation,
+}
+
+impl Static {
+ pub fn load(
+ path: Path,
+ item: &syn::ItemStatic,
+ mod_cfg: Option<&Cfg>,
+ ) -> Result<Static, String> {
+ let ty = Type::load(&item.ty)?;
+
+ if ty.is_none() {
+ return Err("Cannot have a zero sized static definition.".to_owned());
+ }
+
+ Ok(Static::new(
+ path,
+ ty.unwrap(),
+ matches!(item.mutability, syn::StaticMutability::Mut(_)),
+ Cfg::append(mod_cfg, Cfg::load(&item.attrs)),
+ AnnotationSet::load(&item.attrs)?,
+ Documentation::load(&item.attrs),
+ ))
+ }
+
+ pub fn new(
+ path: Path,
+ ty: Type,
+ mutable: bool,
+ cfg: Option<Cfg>,
+ annotations: AnnotationSet,
+ documentation: Documentation,
+ ) -> Self {
+ let export_name = path.name().to_owned();
+ Self {
+ path,
+ export_name,
+ ty,
+ mutable,
+ cfg,
+ annotations,
+ documentation,
+ }
+ }
+
+ pub fn simplify_standard_types(&mut self, config: &Config) {
+ self.ty.simplify_standard_types(config);
+ }
+}
+
+impl Item for Static {
+ fn path(&self) -> &Path {
+ &self.path
+ }
+
+ fn export_name(&self) -> &str {
+ &self.export_name
+ }
+
+ fn cfg(&self) -> Option<&Cfg> {
+ self.cfg.as_ref()
+ }
+
+ fn annotations(&self) -> &AnnotationSet {
+ &self.annotations
+ }
+
+ fn annotations_mut(&mut self) -> &mut AnnotationSet {
+ &mut self.annotations
+ }
+
+ fn documentation(&self) -> &Documentation {
+ &self.documentation
+ }
+
+ fn container(&self) -> ItemContainer {
+ ItemContainer::Static(self.clone())
+ }
+
+ fn rename_for_config(&mut self, config: &Config) {
+ self.ty.rename_for_config(config, &Default::default());
+ }
+
+ fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
+ self.ty.resolve_declaration_types(resolver);
+ }
+
+ fn generic_params(&self) -> &GenericParams {
+ GenericParams::empty()
+ }
+
+ fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
+ self.ty.add_dependencies(library, out);
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/item.rs b/cbindgen-0.27.0/src/bindgen/ir/item.rs
new file mode 100644
index 0000000..03e1c15
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/item.rs
@@ -0,0 +1,242 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use indexmap::IndexMap;
+use std::mem;
+
+use crate::bindgen::config::Config;
+use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
+use crate::bindgen::dependencies::Dependencies;
+use crate::bindgen::ir::{
+ AnnotationSet, Cfg, Constant, Documentation, Enum, GenericArgument, GenericParams, OpaqueItem,
+ Path, Static, Struct, Typedef, Union,
+};
+use crate::bindgen::library::Library;
+use crate::bindgen::monomorph::Monomorphs;
+
+/// An item is any type of rust item besides a function
+pub trait Item {
+ fn path(&self) -> &Path;
+ fn name(&self) -> &str {
+ self.path().name()
+ }
+ fn export_name(&self) -> &str {
+ self.name()
+ }
+ fn cfg(&self) -> Option<&Cfg>;
+ fn annotations(&self) -> &AnnotationSet;
+ fn annotations_mut(&mut self) -> &mut AnnotationSet;
+ fn documentation(&self) -> &Documentation;
+
+ fn container(&self) -> ItemContainer;
+
+ fn collect_declaration_types(&self, _resolver: &mut DeclarationTypeResolver) {
+ unimplemented!()
+ }
+ fn resolve_declaration_types(&mut self, _resolver: &DeclarationTypeResolver) {
+ unimplemented!()
+ }
+ fn generic_params(&self) -> &GenericParams;
+
+ fn is_generic(&self) -> bool {
+ !self.generic_params().is_empty()
+ }
+
+ fn rename_for_config(&mut self, _config: &Config) {}
+ fn add_dependencies(&self, _library: &Library, _out: &mut Dependencies) {}
+ fn instantiate_monomorph(
+ &self,
+ _generics: &[GenericArgument],
+ _library: &Library,
+ _out: &mut Monomorphs,
+ ) {
+ unreachable!("Cannot instantiate {} as a generic.", self.name())
+ }
+}
+
+#[derive(Debug, Clone)]
+pub enum ItemContainer {
+ Constant(Constant),
+ Static(Static),
+ OpaqueItem(OpaqueItem),
+ Struct(Struct),
+ Union(Union),
+ Enum(Enum),
+ Typedef(Typedef),
+}
+
+impl ItemContainer {
+ pub fn deref(&self) -> &dyn Item {
+ match *self {
+ ItemContainer::Constant(ref x) => x,
+ ItemContainer::Static(ref x) => x,
+ ItemContainer::OpaqueItem(ref x) => x,
+ ItemContainer::Struct(ref x) => x,
+ ItemContainer::Union(ref x) => x,
+ ItemContainer::Enum(ref x) => x,
+ ItemContainer::Typedef(ref x) => x,
+ }
+ }
+}
+
+#[derive(Debug, Clone)]
+pub enum ItemValue<T: Item> {
+ Cfg(Vec<T>),
+ Single(T),
+}
+
+#[derive(Debug, Clone)]
+pub struct ItemMap<T: Item> {
+ data: IndexMap<Path, ItemValue<T>>,
+}
+
+impl<T: Item> Default for ItemMap<T> {
+ fn default() -> ItemMap<T> {
+ ItemMap {
+ data: Default::default(),
+ }
+ }
+}
+
+impl<T: Item + Clone> ItemMap<T> {
+ pub fn rebuild(&mut self) {
+ let old = mem::take(self);
+ old.for_all_items(|x| {
+ self.try_insert(x.clone());
+ });
+ }
+
+ pub fn try_insert(&mut self, item: T) -> bool {
+ match (item.cfg().is_some(), self.data.get_mut(item.path())) {
+ (true, Some(&mut ItemValue::Cfg(ref mut items))) => {
+ items.push(item);
+ return true;
+ }
+ (false, Some(&mut ItemValue::Cfg(_))) => {
+ return false;
+ }
+ (true, Some(&mut ItemValue::Single(_))) => {
+ return false;
+ }
+ (false, Some(&mut ItemValue::Single(_))) => {
+ return false;
+ }
+ _ => {}
+ }
+
+ let path = item.path().clone();
+ if item.cfg().is_some() {
+ self.data.insert(path, ItemValue::Cfg(vec![item]));
+ } else {
+ self.data.insert(path, ItemValue::Single(item));
+ }
+
+ true
+ }
+
+ pub fn extend_with(&mut self, other: &ItemMap<T>) {
+ other.for_all_items(|x| {
+ self.try_insert(x.clone());
+ });
+ }
+
+ pub fn to_vec(&self) -> Vec<T> {
+ let mut result = Vec::with_capacity(self.data.len());
+ for container in self.data.values() {
+ match *container {
+ ItemValue::Cfg(ref items) => result.extend_from_slice(items),
+ ItemValue::Single(ref item) => {
+ result.push(item.clone());
+ }
+ }
+ }
+ result
+ }
+
+ pub fn get_items(&self, path: &Path) -> Option<Vec<ItemContainer>> {
+ Some(match *self.data.get(path)? {
+ ItemValue::Cfg(ref items) => items.iter().map(|x| x.container()).collect(),
+ ItemValue::Single(ref item) => vec![item.container()],
+ })
+ }
+
+ pub fn filter<F>(&mut self, callback: F)
+ where
+ F: Fn(&T) -> bool,
+ {
+ self.data.retain(|_, container| match *container {
+ ItemValue::Cfg(ref mut items) => {
+ items.retain(|item| !callback(item));
+ !items.is_empty()
+ }
+ ItemValue::Single(ref item) => !callback(item),
+ });
+ }
+
+ pub fn for_all_items<F>(&self, mut callback: F)
+ where
+ F: FnMut(&T),
+ {
+ for container in self.data.values() {
+ match *container {
+ ItemValue::Cfg(ref items) => {
+ for item in items {
+ callback(item);
+ }
+ }
+ ItemValue::Single(ref item) => callback(item),
+ }
+ }
+ }
+
+ pub fn for_all_items_mut<F>(&mut self, mut callback: F)
+ where
+ F: FnMut(&mut T),
+ {
+ for container in self.data.values_mut() {
+ match *container {
+ ItemValue::Cfg(ref mut items) => {
+ for item in items {
+ callback(item);
+ }
+ }
+ ItemValue::Single(ref mut item) => callback(item),
+ }
+ }
+ }
+
+ pub fn for_items<F>(&self, path: &Path, mut callback: F)
+ where
+ F: FnMut(&T),
+ {
+ match self.data.get(path) {
+ Some(ItemValue::Cfg(items)) => {
+ for item in items {
+ callback(item);
+ }
+ }
+ Some(ItemValue::Single(item)) => {
+ callback(item);
+ }
+ None => {}
+ }
+ }
+
+ pub fn for_items_mut<F>(&mut self, path: &Path, mut callback: F)
+ where
+ F: FnMut(&mut T),
+ {
+ match self.data.get_mut(path) {
+ Some(&mut ItemValue::Cfg(ref mut items)) => {
+ for item in items {
+ callback(item);
+ }
+ }
+ Some(&mut ItemValue::Single(ref mut item)) => {
+ callback(item);
+ }
+ None => {}
+ }
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/mod.rs b/cbindgen-0.27.0/src/bindgen/ir/mod.rs
new file mode 100644
index 0000000..3566f0d
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/mod.rs
@@ -0,0 +1,39 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+pub mod annotation;
+pub mod cfg;
+pub mod constant;
+pub mod documentation;
+pub mod enumeration;
+pub mod field;
+pub mod function;
+pub mod generic_path;
+pub mod global;
+pub mod item;
+pub mod opaque;
+pub mod path;
+pub mod repr;
+pub mod structure;
+pub mod ty;
+pub mod typedef;
+pub mod union;
+
+pub use self::annotation::{AnnotationSet, AnnotationValue, DeprecatedNoteKind};
+pub use self::cfg::*;
+pub use self::constant::*;
+pub use self::documentation::Documentation;
+pub use self::enumeration::*;
+pub use self::field::*;
+pub use self::function::*;
+pub use self::generic_path::*;
+pub use self::global::*;
+pub use self::item::*;
+pub use self::opaque::*;
+pub use self::path::*;
+pub use self::repr::*;
+pub use self::structure::*;
+pub use self::ty::*;
+pub use self::typedef::*;
+pub use self::union::*;
diff --git a/cbindgen-0.27.0/src/bindgen/ir/opaque.rs b/cbindgen-0.27.0/src/bindgen/ir/opaque.rs
new file mode 100644
index 0000000..4527e3c
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/opaque.rs
@@ -0,0 +1,138 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use crate::bindgen::config::Config;
+use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
+use crate::bindgen::dependencies::Dependencies;
+use crate::bindgen::ir::{
+ AnnotationSet, Cfg, Documentation, GenericArgument, GenericParams, Item, ItemContainer, Path,
+};
+use crate::bindgen::library::Library;
+use crate::bindgen::mangle;
+use crate::bindgen::monomorph::Monomorphs;
+
+#[derive(Debug, Clone)]
+pub struct OpaqueItem {
+ pub path: Path,
+ pub export_name: String,
+ pub generic_params: GenericParams,
+ pub cfg: Option<Cfg>,
+ pub annotations: AnnotationSet,
+ pub documentation: Documentation,
+}
+
+impl OpaqueItem {
+ pub fn load(
+ path: Path,
+ generics: &syn::Generics,
+ attrs: &[syn::Attribute],
+ mod_cfg: Option<&Cfg>,
+ ) -> Result<OpaqueItem, String> {
+ Ok(Self::new(
+ path,
+ GenericParams::load(generics)?,
+ Cfg::append(mod_cfg, Cfg::load(attrs)),
+ AnnotationSet::load(attrs).unwrap_or_else(|_| AnnotationSet::new()),
+ Documentation::load(attrs),
+ ))
+ }
+
+ pub fn new(
+ path: Path,
+ generic_params: GenericParams,
+ cfg: Option<Cfg>,
+ annotations: AnnotationSet,
+ documentation: Documentation,
+ ) -> OpaqueItem {
+ let export_name = path.name().to_owned();
+ Self {
+ path,
+ export_name,
+ generic_params,
+ cfg,
+ annotations,
+ documentation,
+ }
+ }
+}
+
+impl Item for OpaqueItem {
+ fn path(&self) -> &Path {
+ &self.path
+ }
+
+ fn export_name(&self) -> &str {
+ &self.export_name
+ }
+
+ fn cfg(&self) -> Option<&Cfg> {
+ self.cfg.as_ref()
+ }
+
+ fn annotations(&self) -> &AnnotationSet {
+ &self.annotations
+ }
+
+ fn annotations_mut(&mut self) -> &mut AnnotationSet {
+ &mut self.annotations
+ }
+
+ fn documentation(&self) -> &Documentation {
+ &self.documentation
+ }
+
+ fn container(&self) -> ItemContainer {
+ ItemContainer::OpaqueItem(self.clone())
+ }
+
+ fn collect_declaration_types(&self, resolver: &mut DeclarationTypeResolver) {
+ resolver.add_struct(&self.path);
+ }
+
+ fn generic_params(&self) -> &GenericParams {
+ &self.generic_params
+ }
+
+ fn rename_for_config(&mut self, config: &Config) {
+ config.export.rename(&mut self.export_name);
+ }
+
+ fn add_dependencies(&self, _: &Library, _: &mut Dependencies) {}
+
+ fn instantiate_monomorph(
+ &self,
+ generic_values: &[GenericArgument],
+ library: &Library,
+ out: &mut Monomorphs,
+ ) {
+ assert!(self.is_generic(), "{} is not generic", self.path);
+
+ // We can be instantiated with less generic params because of default
+ // template parameters, or because of empty types that we remove during
+ // parsing (`()`).
+ assert!(
+ self.generic_params.len() >= generic_values.len(),
+ "{} has {} params but is being instantiated with {} values",
+ self.path,
+ self.generic_params.len(),
+ generic_values.len(),
+ );
+
+ let mangled_path = mangle::mangle_path(
+ &self.path,
+ generic_values,
+ &library.get_config().export.mangle,
+ );
+
+ let monomorph = OpaqueItem::new(
+ mangled_path,
+ GenericParams::default(),
+ self.cfg.clone(),
+ self.annotations.clone(),
+ self.documentation.clone(),
+ );
+
+ out.insert_opaque(self, monomorph, generic_values.to_owned());
+ }
+}
diff --git a/cbindgen-0.24.5/src/bindgen/ir/path.rs b/cbindgen-0.27.0/src/bindgen/ir/path.rs
similarity index 100%
rename from cbindgen-0.24.5/src/bindgen/ir/path.rs
rename to cbindgen-0.27.0/src/bindgen/ir/path.rs
diff --git a/cbindgen-0.27.0/src/bindgen/ir/repr.rs b/cbindgen-0.27.0/src/bindgen/ir/repr.rs
new file mode 100644
index 0000000..71c4b58
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/repr.rs
@@ -0,0 +1,175 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use crate::bindgen::ir::ty::{IntKind, PrimitiveType};
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
+pub enum ReprStyle {
+ #[default]
+ Rust,
+ C,
+ Transparent,
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+pub struct ReprType {
+ kind: IntKind,
+ signed: bool,
+}
+
+impl ReprType {
+ pub(crate) fn to_primitive(self) -> PrimitiveType {
+ PrimitiveType::Integer {
+ kind: self.kind,
+ signed: self.signed,
+ zeroable: true,
+ }
+ }
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+pub enum ReprAlign {
+ Packed,
+ Align(u64),
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
+pub struct Repr {
+ pub style: ReprStyle,
+ pub ty: Option<ReprType>,
+ pub align: Option<ReprAlign>,
+}
+
+impl Repr {
+ pub fn load(attrs: &[syn::Attribute]) -> Result<Repr, String> {
+ let mut ids = Vec::new();
+
+ // We want only the `repr` attributes
+ let iter = attrs.iter().filter(|attr| attr.path().is_ident("repr"));
+
+ for repr_attr in iter {
+ let reprs = repr_attr
+ .parse_args_with(
+ syn::punctuated::Punctuated::<syn::Meta, syn::Token![,]>::parse_terminated,
+ )
+ .map_err(|err| format!("Invalid `#[repr]` attribute: {err}"))?;
+
+ for meta in reprs {
+ match meta {
+ // #[repr(C)] and #[repr(transparent)] and #[repr(INT)]
+ syn::Meta::Path(path) => {
+ if let Some(ident) = path.get_ident() {
+ let ident_s = ident.to_string();
+ ids.push((ident_s, None))
+ } else {
+ return Err("Invalid `repr` attribute".to_string());
+ }
+ }
+ // #[repr(align(N))]
+ syn::Meta::List(meta) if meta.path.is_ident("align") => {
+ let lit: syn::LitInt = meta
+ .parse_args()
+ .map_err(|err| format!("Invalid align argument: {err}"))?;
+ ids.push(("align".to_string(), Some(lit.to_string())))
+ }
+ // #[repr(packed(N))]
+ syn::Meta::List(meta) if meta.path.is_ident("packed") => {
+ // no arguments
+ if meta.tokens.is_empty() {
+ ids.push(("packed".to_string(), None))
+ } else {
+ let lit: syn::LitInt = meta
+ .parse_args()
+ .map_err(|err| format!("Invalid packed argument: {err}"))?;
+ ids.push(("packed".to_string(), Some(lit.to_string())))
+ }
+ }
+ _ => return Err("Invalid `repr` attribute".to_string()),
+ }
+ }
+ }
+
+ let mut repr = Repr::default();
+ for id in ids {
+ let (int_kind, signed) = match (id.0.as_ref(), id.1) {
+ ("u8", None) => (IntKind::B8, false),
+ ("u16", None) => (IntKind::B16, false),
+ ("u32", None) => (IntKind::B32, false),
+ ("u64", None) => (IntKind::B64, false),
+ ("usize", None) => (IntKind::Size, false),
+ ("i8", None) => (IntKind::B8, true),
+ ("i16", None) => (IntKind::B16, true),
+ ("i32", None) => (IntKind::B32, true),
+ ("i64", None) => (IntKind::B64, true),
+ ("isize", None) => (IntKind::Size, true),
+ ("C", None) => {
+ repr.style = ReprStyle::C;
+ continue;
+ }
+ ("transparent", None) => {
+ repr.style = ReprStyle::Transparent;
+ continue;
+ }
+ ("packed", args) => {
+ // #[repr(packed(n))] not supported because of some open questions about how
+ // to calculate the native alignment of types. See mozilla/cbindgen#433.
+ if args.is_some() {
+ return Err(
+ "Not-yet-implemented #[repr(packed(...))] encountered.".to_string()
+ );
+ }
+ let align = ReprAlign::Packed;
+ // Only permit a single alignment-setting repr.
+ if let Some(old_align) = repr.align {
+ return Err(format!(
+ "Conflicting #[repr(align(...))] type hints {:?} and {:?}.",
+ old_align, align
+ ));
+ }
+ repr.align = Some(align);
+ continue;
+ }
+ ("align", Some(arg)) => {
+ // Must be a positive integer.
+ let align = match arg.parse::<u64>() {
+ Ok(align) => align,
+ Err(_) => return Err(format!("Non-unsigned #[repr(align({}))].", arg)),
+ };
+ // Must be a power of 2.
+ if !align.is_power_of_two() || align == 0 {
+ return Err(format!("Invalid alignment to #[repr(align({}))].", align));
+ }
+ // Only permit a single alignment-setting repr.
+ if let Some(old_align) = repr.align {
+ return Err(format!(
+ "Conflicting #[repr(align(...))] type hints {:?} and {:?}.",
+ old_align,
+ ReprAlign::Align(align)
+ ));
+ }
+ repr.align = Some(ReprAlign::Align(align));
+ continue;
+ }
+ (path, arg) => match arg {
+ None => return Err(format!("Unsupported #[repr({})].", path)),
+ Some(arg) => {
+ return Err(format!("Unsupported #[repr({}({}))].", path, arg));
+ }
+ },
+ };
+ let ty = ReprType {
+ kind: int_kind,
+ signed,
+ };
+ if let Some(old_ty) = repr.ty {
+ return Err(format!(
+ "Conflicting #[repr(...)] type hints {:?} and {:?}.",
+ old_ty, ty
+ ));
+ }
+ repr.ty = Some(ty);
+ }
+ Ok(repr)
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/structure.rs b/cbindgen-0.27.0/src/bindgen/ir/structure.rs
new file mode 100644
index 0000000..49ae5da
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/structure.rs
@@ -0,0 +1,380 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::io::Write;
+
+use syn::ext::IdentExt;
+
+use crate::bindgen::config::{Config, Language, LayoutConfig};
+use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
+use crate::bindgen::dependencies::Dependencies;
+use crate::bindgen::ir::{
+ AnnotationSet, Cfg, Constant, Documentation, Field, GenericArgument, GenericParams, Item,
+ ItemContainer, Path, Repr, ReprAlign, ReprStyle, Type,
+};
+use crate::bindgen::library::Library;
+use crate::bindgen::mangle;
+use crate::bindgen::monomorph::Monomorphs;
+use crate::bindgen::rename::{IdentifierType, RenameRule};
+use crate::bindgen::reserved;
+use crate::bindgen::utilities::IterHelpers;
+use crate::bindgen::writer::SourceWriter;
+
+#[derive(Debug, Clone)]
+pub struct Struct {
+ pub path: Path,
+ pub export_name: String,
+ pub generic_params: GenericParams,
+ pub fields: Vec<Field>,
+ /// Whether there's a tag field on the body of this struct. When this is
+ /// true, is_enum_variant_body is also guaranteed to be true.
+ pub has_tag_field: bool,
+ /// Whether this is an enum variant body.
+ pub is_enum_variant_body: bool,
+ pub alignment: Option<ReprAlign>,
+ pub is_transparent: bool,
+ pub cfg: Option<Cfg>,
+ pub annotations: AnnotationSet,
+ pub documentation: Documentation,
+ pub associated_constants: Vec<Constant>,
+}
+
+impl Struct {
+ /// Whether this struct can derive operator== / operator!=.
+ pub fn can_derive_eq(&self) -> bool {
+ !self.fields.is_empty() && self.fields.iter().all(|x| x.ty.can_cmp_eq())
+ }
+
+ pub fn add_associated_constant(&mut self, c: Constant) {
+ self.associated_constants.push(c);
+ }
+
+ pub fn load(
+ layout_config: &LayoutConfig,
+ item: &syn::ItemStruct,
+ mod_cfg: Option<&Cfg>,
+ ) -> Result<Self, String> {
+ let repr = Repr::load(&item.attrs)?;
+ let is_transparent = match repr.style {
+ ReprStyle::C => false,
+ ReprStyle::Transparent => true,
+ _ => {
+ return Err("Struct is not marked #[repr(C)] or #[repr(transparent)].".to_owned());
+ }
+ };
+
+ let path = Path::new(item.ident.unraw().to_string());
+
+ // Ensure we can safely represent the struct given the configuration.
+ if let Some(align) = repr.align {
+ layout_config.ensure_safe_to_represent(&align)?;
+ }
+
+ let fields = match item.fields {
+ syn::Fields::Unit => Vec::new(),
+ syn::Fields::Named(ref fields) => fields
+ .named
+ .iter()
+ .try_skip_map(|field| Field::load(field, &path))?,
+ syn::Fields::Unnamed(ref fields) => {
+ let mut out = Vec::new();
+ let mut current = 0;
+ for field in fields.unnamed.iter() {
+ if let Some(mut ty) = Type::load(&field.ty)? {
+ ty.replace_self_with(&path);
+ out.push(Field {
+ name: format!("{}", current),
+ ty,
+ cfg: Cfg::load(&field.attrs),
+ annotations: AnnotationSet::load(&field.attrs)?,
+ documentation: Documentation::load(&field.attrs),
+ });
+ current += 1;
+ }
+ }
+ out
+ }
+ };
+
+ let has_tag_field = false;
+ let is_enum_variant_body = false;
+
+ Ok(Struct::new(
+ path,
+ GenericParams::load(&item.generics)?,
+ fields,
+ has_tag_field,
+ is_enum_variant_body,
+ repr.align,
+ is_transparent,
+ Cfg::append(mod_cfg, Cfg::load(&item.attrs)),
+ AnnotationSet::load(&item.attrs)?,
+ Documentation::load(&item.attrs),
+ ))
+ }
+
+ #[allow(clippy::too_many_arguments)]
+ pub fn new(
+ path: Path,
+ generic_params: GenericParams,
+ fields: Vec<Field>,
+ has_tag_field: bool,
+ is_enum_variant_body: bool,
+ alignment: Option<ReprAlign>,
+ is_transparent: bool,
+ cfg: Option<Cfg>,
+ annotations: AnnotationSet,
+ documentation: Documentation,
+ ) -> Self {
+ let export_name = path.name().to_owned();
+ Self {
+ path,
+ export_name,
+ generic_params,
+ fields,
+ has_tag_field,
+ is_enum_variant_body,
+ alignment,
+ is_transparent,
+ cfg,
+ annotations,
+ documentation,
+ associated_constants: vec![],
+ }
+ }
+
+ pub fn simplify_standard_types(&mut self, config: &Config) {
+ for field in &mut self.fields {
+ field.ty.simplify_standard_types(config);
+ }
+ }
+
+ pub fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
+ // Generic structs can instantiate monomorphs only once they've been
+ // instantiated. See `instantiate_monomorph` for more details.
+ if self.is_generic() {
+ return;
+ }
+
+ for field in &self.fields {
+ field.ty.add_monomorphs(library, out);
+ }
+ }
+
+ pub fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
+ for field in &mut self.fields {
+ field.ty.mangle_paths(monomorphs);
+ }
+ }
+
+ pub fn specialize(
+ &self,
+ generic_values: &[GenericArgument],
+ mappings: &[(&Path, &GenericArgument)],
+ config: &Config,
+ ) -> Self {
+ let mangled_path = mangle::mangle_path(&self.path, generic_values, &config.export.mangle);
+ Struct::new(
+ mangled_path,
+ GenericParams::default(),
+ self.fields
+ .iter()
+ .map(|field| Field {
+ name: field.name.clone(),
+ ty: field.ty.specialize(mappings),
+ cfg: field.cfg.clone(),
+ annotations: field.annotations.clone(),
+ documentation: field.documentation.clone(),
+ })
+ .collect(),
+ self.has_tag_field,
+ self.is_enum_variant_body,
+ self.alignment,
+ self.is_transparent,
+ self.cfg.clone(),
+ self.annotations.clone(),
+ self.documentation.clone(),
+ )
+ }
+
+ pub(crate) fn emit_bitflags_binop<F: Write>(
+ &self,
+ constexpr_prefix: &str,
+ operator: char,
+ other: &str,
+ out: &mut SourceWriter<F>,
+ ) {
+ let bits = &self.fields[0].name;
+ out.new_line();
+ write!(
+ out,
+ "{}{} operator{}(const {}& {}) const",
+ constexpr_prefix,
+ self.export_name(),
+ operator,
+ self.export_name(),
+ other
+ );
+ out.open_brace();
+ write!(
+ out,
+ "return {} {{ static_cast<decltype({bits})>(this->{bits} {operator} {other}.{bits}) }};",
+ self.export_name()
+ );
+ out.close_brace(false);
+
+ out.new_line();
+ write!(
+ out,
+ "{}& operator{}=(const {}& {})",
+ self.export_name(),
+ operator,
+ self.export_name(),
+ other
+ );
+ out.open_brace();
+ write!(out, "*this = (*this {} {});", operator, other);
+ out.new_line();
+ write!(out, "return *this;");
+ out.close_brace(false);
+ }
+}
+
+impl Item for Struct {
+ fn path(&self) -> &Path {
+ &self.path
+ }
+
+ fn export_name(&self) -> &str {
+ &self.export_name
+ }
+
+ fn cfg(&self) -> Option<&Cfg> {
+ self.cfg.as_ref()
+ }
+
+ fn annotations(&self) -> &AnnotationSet {
+ &self.annotations
+ }
+
+ fn annotations_mut(&mut self) -> &mut AnnotationSet {
+ &mut self.annotations
+ }
+
+ fn documentation(&self) -> &Documentation {
+ &self.documentation
+ }
+
+ fn container(&self) -> ItemContainer {
+ ItemContainer::Struct(self.clone())
+ }
+
+ fn collect_declaration_types(&self, resolver: &mut DeclarationTypeResolver) {
+ if self.is_transparent {
+ resolver.add_none(&self.path);
+ } else {
+ resolver.add_struct(&self.path);
+ }
+ }
+
+ fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
+ for field in &mut self.fields {
+ field.ty.resolve_declaration_types(resolver);
+ }
+ }
+
+ fn generic_params(&self) -> &GenericParams {
+ &self.generic_params
+ }
+
+ fn rename_for_config(&mut self, config: &Config) {
+ // Rename the name of the struct
+ if !(self.has_tag_field && config.language == Language::Cxx) {
+ config.export.rename(&mut self.export_name);
+ }
+
+ // Rename the types used in fields
+ {
+ let fields = self.fields.iter_mut().skip(self.has_tag_field as usize);
+ for field in fields {
+ field.ty.rename_for_config(config, &self.generic_params);
+ }
+ }
+
+ // Apply renaming rules to fields in the following order
+ // 1. `cbindgen::field-names` annotation
+ // 2. `cbindgen::rename-all` annotation
+ // 3. config struct rename rule
+ // If the struct is a tuple struct and we have not renamed the
+ // fields, then prefix each of them with an underscore.
+ // If any field is a reserved keyword, then postfix it with an
+ // underscore.
+
+ // Scope for mutable borrow of fields
+ {
+ let names = self.fields.iter_mut().map(|field| &mut field.name);
+
+ let field_rules = self
+ .annotations
+ .parse_atom::<RenameRule>("rename-all")
+ .unwrap_or(config.structure.rename_fields);
+
+ if let Some(o) = self.annotations.list("field-names") {
+ for (dest, src) in names.zip(o) {
+ *dest = src;
+ }
+ } else if let Some(r) = field_rules.not_none() {
+ for name in names {
+ *name = r.apply(name, IdentifierType::StructMember).into_owned();
+ }
+ } else {
+ // If we don't have any rules for a tuple struct, prefix them with
+ // an underscore so it still compiles.
+ for name in names {
+ if name.starts_with(|c: char| c.is_ascii_digit()) {
+ name.insert(0, '_');
+ }
+ }
+ }
+ }
+
+ for field in &mut self.fields {
+ reserved::escape(&mut field.name);
+ }
+
+ for c in self.associated_constants.iter_mut() {
+ c.rename_for_config(config);
+ }
+ }
+
+ fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
+ let mut fields = self.fields.iter();
+
+ // If there is a tag field, skip it
+ if self.has_tag_field {
+ fields.next();
+ }
+
+ for field in fields {
+ field
+ .ty
+ .add_dependencies_ignoring_generics(&self.generic_params, library, out);
+ }
+
+ for c in &self.associated_constants {
+ c.add_dependencies(library, out);
+ }
+ }
+
+ fn instantiate_monomorph(
+ &self,
+ generic_values: &[GenericArgument],
+ library: &Library,
+ out: &mut Monomorphs,
+ ) {
+ let mappings = self.generic_params.call(self.path.name(), generic_values);
+ let monomorph = self.specialize(generic_values, &mappings, library.get_config());
+ out.insert_struct(library, self, monomorph, generic_values.to_owned());
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/ty.rs b/cbindgen-0.27.0/src/bindgen/ir/ty.rs
new file mode 100644
index 0000000..4a41d4c
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/ty.rs
@@ -0,0 +1,882 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::borrow::Cow;
+
+use syn::ext::IdentExt;
+
+use crate::bindgen::config::{Config, Language};
+use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
+use crate::bindgen::dependencies::Dependencies;
+use crate::bindgen::ir::{GenericArgument, GenericParams, GenericPath, Path};
+use crate::bindgen::library::Library;
+use crate::bindgen::monomorph::Monomorphs;
+use crate::bindgen::utilities::IterHelpers;
+
+#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
+pub enum PrimitiveType {
+ Void,
+ Bool,
+ Char,
+ SChar,
+ UChar,
+ Char32,
+ Float,
+ Double,
+ VaList,
+ PtrDiffT,
+ Integer {
+ zeroable: bool,
+ signed: bool,
+ kind: IntKind,
+ },
+}
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
+pub enum IntKind {
+ Short,
+ Int,
+ Long,
+ LongLong,
+ SizeT,
+ Size,
+ B8,
+ B16,
+ B32,
+ B64,
+}
+
+impl PrimitiveType {
+ pub fn maybe(path: &str) -> Option<PrimitiveType> {
+ Some(match path {
+ "c_void" => PrimitiveType::Void,
+ "c_char" => PrimitiveType::Char,
+ "c_schar" => PrimitiveType::SChar,
+ "c_uchar" => PrimitiveType::UChar,
+ "c_float" => PrimitiveType::Float,
+ "c_double" => PrimitiveType::Double,
+ "ptrdiff_t" => PrimitiveType::PtrDiffT,
+ "VaList" => PrimitiveType::VaList,
+ "bool" => PrimitiveType::Bool,
+ "char" => PrimitiveType::Char32,
+
+ "f32" => PrimitiveType::Float,
+ "f64" => PrimitiveType::Double,
+
+ _ => return Self::maybe_integer(path),
+ })
+ }
+
+ // Converts well-known integral types to their respective `PrimitiveType`
+ fn maybe_integer(path: &str) -> Option<PrimitiveType> {
+ let (kind, signed) = match path {
+ "c_short" => (IntKind::Short, true),
+ "c_int" => (IntKind::Int, true),
+ "c_long" => (IntKind::Long, true),
+ "c_longlong" => (IntKind::LongLong, true),
+ "ssize_t" => (IntKind::SizeT, true),
+ "c_ushort" => (IntKind::Short, false),
+ "c_uint" => (IntKind::Int, false),
+ "c_ulong" => (IntKind::Long, false),
+ "c_ulonglong" => (IntKind::LongLong, false),
+ "size_t" => (IntKind::SizeT, false),
+ "RawFd" => (IntKind::Int, true),
+
+ "isize" | "intptr_t" => (IntKind::Size, true),
+ "usize" | "uintptr_t" => (IntKind::Size, false),
+
+ "u8" | "uint8_t" => (IntKind::B8, false),
+ "u16" | "uint16_t" => (IntKind::B16, false),
+ "u32" | "uint32_t" => (IntKind::B32, false),
+ "u64" | "uint64_t" => (IntKind::B64, false),
+ "i8" | "int8_t" => (IntKind::B8, true),
+ "i16" | "int16_t" => (IntKind::B16, true),
+ "i32" | "int32_t" => (IntKind::B32, true),
+ "i64" | "int64_t" => (IntKind::B64, true),
+
+ _ => return Self::maybe_nonzero_integer(path),
+ };
+ Some(PrimitiveType::Integer {
+ zeroable: true,
+ signed,
+ kind,
+ })
+ }
+
+ // Converts well-known typedefs for [`NonZero`] to their respective `PrimitiveType`.
+ //
+ // NOTE: This performs the type erasure directly, as if `NonZero<T>` had been specified, because
+ // it's actually more code to register an erased typedef instead.
+ fn maybe_nonzero_integer(path: &str) -> Option<PrimitiveType> {
+ let (kind, signed) = match path {
+ "NonZeroU8" => (IntKind::B8, false),
+ "NonZeroU16" => (IntKind::B16, false),
+ "NonZeroU32" => (IntKind::B32, false),
+ "NonZeroU64" => (IntKind::B64, false),
+ "NonZeroUSize" => (IntKind::Size, false),
+ "NonZeroI8" => (IntKind::B8, true),
+ "NonZeroI16" => (IntKind::B16, true),
+ "NonZeroI32" => (IntKind::B32, true),
+ "NonZeroI64" => (IntKind::B64, true),
+ "NonZeroISize" => (IntKind::Size, true),
+
+ _ => return None,
+ };
+ Some(PrimitiveType::Integer {
+ zeroable: false,
+ signed,
+ kind,
+ })
+ }
+
+ pub fn to_repr_rust(&self) -> &'static str {
+ match *self {
+ PrimitiveType::Bool => "bool",
+ PrimitiveType::Void => "c_void",
+ PrimitiveType::Char => "c_char",
+ PrimitiveType::SChar => "c_schar",
+ PrimitiveType::UChar => "c_uchar",
+ PrimitiveType::Char32 => "char",
+ PrimitiveType::Integer {
+ kind,
+ signed,
+ zeroable: _,
+ } => match (kind, signed) {
+ (IntKind::Short, true) => "c_short",
+ (IntKind::Short, false) => "c_ushort",
+ (IntKind::Int, true) => "c_int",
+ (IntKind::Int, false) => "c_uint",
+ (IntKind::Long, true) => "c_long",
+ (IntKind::Long, false) => "c_ulong",
+ (IntKind::LongLong, true) => "c_longlong",
+ (IntKind::LongLong, false) => "c_ulonglong",
+ (IntKind::SizeT, true) => "ssize_t",
+ (IntKind::SizeT, false) => "size_t",
+ (IntKind::Size, true) => "isize",
+ (IntKind::Size, false) => "usize",
+ (IntKind::B8, true) => "i8",
+ (IntKind::B8, false) => "u8",
+ (IntKind::B16, true) => "i16",
+ (IntKind::B16, false) => "u16",
+ (IntKind::B32, true) => "i32",
+ (IntKind::B32, false) => "u32",
+ (IntKind::B64, true) => "i64",
+ (IntKind::B64, false) => "u64",
+ },
+ PrimitiveType::Float => "f32",
+ PrimitiveType::Double => "f64",
+ PrimitiveType::PtrDiffT => "ptrdiff_t",
+ PrimitiveType::VaList => "va_list",
+ }
+ }
+
+ pub fn to_repr_c(&self, config: &Config) -> &'static str {
+ match *self {
+ PrimitiveType::Void => "void",
+ PrimitiveType::Bool => "bool",
+ PrimitiveType::Char => "char",
+ PrimitiveType::SChar => "signed char",
+ PrimitiveType::UChar => "unsigned char",
+ // NOTE: It'd be nice to use a char32_t, but:
+ //
+ // * uchar.h is not present on mac (see #423).
+ //
+ // * char32_t isn't required to be compatible with Rust's char, as
+ // the C++ spec only requires it to be the same size as
+ // uint_least32_t, which is _not_ guaranteed to be 4-bytes.
+ //
+ PrimitiveType::Char32 => "uint32_t",
+ PrimitiveType::Integer {
+ kind,
+ signed,
+ zeroable: _,
+ } => match (kind, signed) {
+ (IntKind::Short, true) => "short",
+ (IntKind::Short, false) => "unsigned short",
+ (IntKind::Int, true) => "int",
+ (IntKind::Int, false) => "unsigned int",
+ (IntKind::Long, true) => "long",
+ (IntKind::Long, false) => "unsigned long",
+ (IntKind::LongLong, true) => "long long",
+ (IntKind::LongLong, false) => "unsigned long long",
+ (IntKind::SizeT, true) => "ssize_t",
+ (IntKind::SizeT, false) => "size_t",
+ (IntKind::Size, true) if config.usize_is_size_t => "ptrdiff_t",
+ (IntKind::Size, false) if config.usize_is_size_t => "size_t",
+ (IntKind::Size, true) => "intptr_t",
+ (IntKind::Size, false) => "uintptr_t",
+ (IntKind::B8, true) => "int8_t",
+ (IntKind::B8, false) => "uint8_t",
+ (IntKind::B16, true) => "int16_t",
+ (IntKind::B16, false) => "uint16_t",
+ (IntKind::B32, true) => "int32_t",
+ (IntKind::B32, false) => "uint32_t",
+ (IntKind::B64, true) => "int64_t",
+ (IntKind::B64, false) => "uint64_t",
+ },
+ PrimitiveType::Float => "float",
+ PrimitiveType::Double => "double",
+ PrimitiveType::PtrDiffT => "ptrdiff_t",
+ PrimitiveType::VaList => "...",
+ }
+ }
+
+ fn can_cmp_order(&self) -> bool {
+ !matches!(*self, PrimitiveType::Bool)
+ }
+
+ fn can_cmp_eq(&self) -> bool {
+ true
+ }
+}
+
+/// Constant expressions.
+///
+/// Used for the `U` part of `[T; U]` and const generics. We support a very
+/// limited vocabulary here: only identifiers and literals.
+#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
+pub enum ConstExpr {
+ Name(String),
+ Value(String),
+}
+
+impl ConstExpr {
+ pub fn as_str(&self) -> &str {
+ match *self {
+ ConstExpr::Name(ref string) | ConstExpr::Value(ref string) => string,
+ }
+ }
+
+ pub fn rename_for_config(&mut self, config: &Config) {
+ if let ConstExpr::Name(ref mut name) = self {
+ config.export.rename(name);
+ }
+ }
+
+ pub fn load(expr: &syn::Expr) -> Result<Self, String> {
+ match *expr {
+ syn::Expr::Lit(syn::ExprLit { ref lit, .. }) => {
+ let val = match *lit {
+ syn::Lit::Bool(syn::LitBool { value, .. }) => value.to_string(),
+ syn::Lit::Int(ref len) => len.base10_digits().to_string(),
+ syn::Lit::Byte(ref byte) => u8::to_string(&byte.value()),
+ syn::Lit::Char(ref ch) => u32::to_string(&ch.value().into()),
+ _ => return Err(format!("can't handle const expression {:?}", lit)),
+ };
+ Ok(ConstExpr::Value(val))
+ }
+ syn::Expr::Path(ref path) => {
+ let generic_path = GenericPath::load(&path.path)?;
+ Ok(ConstExpr::Name(generic_path.export_name().to_owned()))
+ }
+ _ => Err(format!("can't handle const expression {:?}", expr)),
+ }
+ }
+
+ pub fn specialize(&self, mappings: &[(&Path, &GenericArgument)]) -> ConstExpr {
+ match *self {
+ ConstExpr::Name(ref name) => {
+ let path = Path::new(name);
+ for &(param, value) in mappings {
+ if path == *param {
+ match *value {
+ GenericArgument::Type(Type::Path(ref path))
+ if path.is_single_identifier() =>
+ {
+ // This happens when the generic argument is a path.
+ return ConstExpr::Name(path.name().to_string());
+ }
+ GenericArgument::Const(ref expr) => {
+ return expr.clone();
+ }
+ _ => {
+ // unsupported argument type - really should be an error
+ }
+ }
+ }
+ }
+ }
+ ConstExpr::Value(_) => {}
+ }
+ self.clone()
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
+pub enum Type {
+ Ptr {
+ ty: Box<Type>,
+ is_const: bool,
+ is_nullable: bool,
+ // FIXME: This is a bit of a hack, this is only to get us to codegen
+ // `T&` / `const T&`, but we should probably pass that down as an option
+ // to code generation or something.
+ is_ref: bool,
+ },
+ Path(GenericPath),
+ Primitive(PrimitiveType),
+ Array(Box<Type>, ConstExpr),
+ FuncPtr {
+ ret: Box<Type>,
+ args: Vec<(Option<String>, Type)>,
+ is_nullable: bool,
+ never_return: bool,
+ },
+}
+
+impl Type {
+ pub fn const_ref_to(ty: &Self) -> Self {
+ Type::Ptr {
+ ty: Box::new(ty.clone()),
+ is_const: true,
+ is_nullable: false,
+ is_ref: true,
+ }
+ }
+
+ pub fn load_from_output(output: &syn::ReturnType) -> Result<(Type, bool), String> {
+ let mut never_return = false;
+ let ty = match output {
+ syn::ReturnType::Default => Type::Primitive(PrimitiveType::Void),
+ syn::ReturnType::Type(_, ref ty) => {
+ if let syn::Type::Never(_) = ty.as_ref() {
+ never_return = true;
+ Type::Primitive(PrimitiveType::Void)
+ } else {
+ Type::load(ty)?.unwrap_or(Type::Primitive(PrimitiveType::Void))
+ }
+ }
+ };
+ Ok((ty, never_return))
+ }
+
+ pub fn load(ty: &syn::Type) -> Result<Option<Type>, String> {
+ let converted = match *ty {
+ syn::Type::Reference(ref reference) => {
+ let converted = Type::load(&reference.elem)?;
+
+ let converted = match converted {
+ Some(converted) => converted,
+ None => Type::Primitive(PrimitiveType::Void),
+ };
+
+ // TODO(emilio): we could make these use is_ref: true.
+ let is_const = reference.mutability.is_none();
+ Type::Ptr {
+ ty: Box::new(converted),
+ is_const,
+ is_nullable: false,
+ is_ref: false,
+ }
+ }
+ syn::Type::Ptr(ref pointer) => {
+ let converted = Type::load(&pointer.elem)?;
+
+ let converted = match converted {
+ Some(converted) => converted,
+ None => Type::Primitive(PrimitiveType::Void),
+ };
+
+ let is_const = pointer.mutability.is_none();
+ Type::Ptr {
+ ty: Box::new(converted),
+ is_const,
+ is_nullable: true,
+ is_ref: false,
+ }
+ }
+ syn::Type::Path(ref path) => {
+ let generic_path = GenericPath::load(&path.path)?;
+
+ if generic_path.name() == "PhantomData" || generic_path.name() == "PhantomPinned" {
+ return Ok(None);
+ }
+
+ if let Some(prim) = PrimitiveType::maybe(generic_path.name()) {
+ if !generic_path.generics().is_empty() {
+ return Err("Primitive has generics.".to_owned());
+ }
+ Type::Primitive(prim)
+ } else {
+ Type::Path(generic_path)
+ }
+ }
+ syn::Type::Array(syn::TypeArray {
+ ref elem, ref len, ..
+ }) => {
+ let converted = Type::load(elem)?;
+
+ let converted = match converted {
+ Some(converted) => converted,
+ None => return Err("Cannot have an array of zero sized types.".to_owned()),
+ };
+
+ let len = ConstExpr::load(len)?;
+ Type::Array(Box::new(converted), len)
+ }
+ syn::Type::BareFn(ref function) => {
+ let mut wildcard_counter = 0;
+ let mut args = function.inputs.iter().try_skip_map(|x| {
+ Type::load(&x.ty).map(|opt_ty| {
+ opt_ty.map(|ty| {
+ (
+ x.name.as_ref().map(|(ref ident, _)| {
+ if ident == "_" {
+ wildcard_counter += 1;
+ if wildcard_counter == 1 {
+ "_".to_owned()
+ } else {
+ format!("_{}", wildcard_counter - 1)
+ }
+ } else {
+ ident.unraw().to_string()
+ }
+ }),
+ ty,
+ )
+ })
+ })
+ })?;
+ if function.variadic.is_some() {
+ args.push((None, Type::Primitive(super::PrimitiveType::VaList)))
+ }
+ let (ret, never_return) = Type::load_from_output(&function.output)?;
+ Type::FuncPtr {
+ ret: Box::new(ret),
+ args,
+ is_nullable: false,
+ never_return,
+ }
+ }
+ syn::Type::Tuple(ref tuple) => {
+ if tuple.elems.is_empty() {
+ return Ok(None);
+ }
+ return Err("Tuples are not supported types.".to_owned());
+ }
+ syn::Type::Verbatim(ref tokens) if tokens.to_string() == "..." => {
+ Type::Primitive(PrimitiveType::VaList)
+ }
+ _ => return Err(format!("Unsupported type: {:?}", ty)),
+ };
+
+ Ok(Some(converted))
+ }
+
+ pub fn is_ptr(&self) -> bool {
+ matches!(*self, Type::Ptr { .. } | Type::FuncPtr { .. })
+ }
+
+ pub fn is_primitive_or_ptr_primitive(&self) -> bool {
+ match *self {
+ Type::Primitive(..) => true,
+ Type::Ptr { ref ty, .. } => matches!(ty.as_ref(), Type::Primitive(..)),
+ _ => false,
+ }
+ }
+
+ pub fn make_zeroable(&self, new_zeroable: bool) -> Option<Self> {
+ match *self {
+ Type::Primitive(PrimitiveType::Integer {
+ zeroable: old_zeroable,
+ kind,
+ signed,
+ }) if old_zeroable != new_zeroable => Some(Type::Primitive(PrimitiveType::Integer {
+ kind,
+ signed,
+ zeroable: new_zeroable,
+ })),
+ _ => None,
+ }
+ }
+
+ pub fn make_nullable(&self) -> Option<Self> {
+ match *self {
+ Type::Ptr {
+ ref ty,
+ is_const,
+ is_ref,
+ is_nullable: false,
+ } => Some(Type::Ptr {
+ ty: ty.clone(),
+ is_const,
+ is_ref,
+ is_nullable: true,
+ }),
+ Type::FuncPtr {
+ ref ret,
+ ref args,
+ is_nullable: false,
+ never_return,
+ } => Some(Type::FuncPtr {
+ ret: ret.clone(),
+ args: args.clone(),
+ is_nullable: true,
+ never_return,
+ }),
+ _ => None,
+ }
+ }
+
+ fn simplified_type(&self, config: &Config) -> Option<Self> {
+ let path = match *self {
+ Type::Path(ref p) => p,
+ _ => return None,
+ };
+
+ if path.generics().is_empty() {
+ return None;
+ }
+
+ if path.generics().len() != 1 {
+ return None;
+ }
+
+ let unsimplified_generic = match path.generics()[0] {
+ GenericArgument::Type(ref ty) => ty,
+ GenericArgument::Const(_) => return None,
+ };
+
+ let generic = match unsimplified_generic.simplified_type(config) {
+ Some(generic) => Cow::Owned(generic),
+ None => Cow::Borrowed(unsimplified_generic),
+ };
+ match path.name() {
+ "Option" => generic
+ .make_nullable()
+ .or_else(|| generic.make_zeroable(true)),
+ "NonNull" => Some(Type::Ptr {
+ ty: Box::new(generic.into_owned()),
+ is_const: false,
+ is_nullable: false,
+ is_ref: false,
+ }),
+ "NonZero" => generic.make_zeroable(false),
+ "Box" if config.language != Language::Cxx => Some(Type::Ptr {
+ ty: Box::new(generic.into_owned()),
+ is_const: false,
+ is_nullable: false,
+ is_ref: false,
+ }),
+ "Cell" => Some(generic.into_owned()),
+ "ManuallyDrop" | "MaybeUninit" | "Pin" if config.language != Language::Cxx => {
+ Some(generic.into_owned())
+ }
+ _ => None,
+ }
+ }
+
+ pub fn simplify_standard_types(&mut self, config: &Config) {
+ self.visit_types(|ty| ty.simplify_standard_types(config));
+ if let Some(ty) = self.simplified_type(config) {
+ *self = ty;
+ }
+ }
+
+ pub fn replace_self_with(&mut self, self_ty: &Path) {
+ if let Type::Path(ref mut generic_path) = *self {
+ generic_path.replace_self_with(self_ty);
+ }
+ self.visit_types(|ty| ty.replace_self_with(self_ty))
+ }
+
+ fn visit_types(&mut self, mut visitor: impl FnMut(&mut Type)) {
+ match *self {
+ Type::Array(ref mut ty, ..) | Type::Ptr { ref mut ty, .. } => visitor(ty),
+ Type::Path(ref mut path) => {
+ for generic in path.generics_mut() {
+ match *generic {
+ GenericArgument::Type(ref mut ty) => visitor(ty),
+ GenericArgument::Const(_) => {}
+ }
+ }
+ }
+ Type::Primitive(..) => {}
+ Type::FuncPtr {
+ ref mut ret,
+ ref mut args,
+ ..
+ } => {
+ visitor(ret);
+ for arg in args {
+ visitor(&mut arg.1)
+ }
+ }
+ }
+ }
+
+ pub fn get_root_path(&self) -> Option<Path> {
+ let mut current = self;
+ loop {
+ match *current {
+ Type::Ptr { ref ty, .. } => current = ty,
+ Type::Path(ref generic) => {
+ return Some(generic.path().clone());
+ }
+ Type::Primitive(..) => {
+ return None;
+ }
+ Type::Array(..) => {
+ return None;
+ }
+ Type::FuncPtr { .. } => {
+ return None;
+ }
+ };
+ }
+ }
+
+ pub fn specialize(&self, mappings: &[(&Path, &GenericArgument)]) -> Type {
+ match *self {
+ Type::Ptr {
+ ref ty,
+ is_const,
+ is_nullable,
+ is_ref,
+ } => Type::Ptr {
+ ty: Box::new(ty.specialize(mappings)),
+ is_const,
+ is_nullable,
+ is_ref,
+ },
+ Type::Path(ref generic_path) => {
+ for &(param, value) in mappings {
+ if generic_path.path() == param {
+ if let GenericArgument::Type(ref ty) = *value {
+ return ty.clone();
+ }
+ }
+ }
+
+ let specialized = GenericPath::new(
+ generic_path.path().clone(),
+ generic_path
+ .generics()
+ .iter()
+ .map(|x| x.specialize(mappings))
+ .collect(),
+ );
+ Type::Path(specialized)
+ }
+ Type::Primitive(ref primitive) => Type::Primitive(primitive.clone()),
+ Type::Array(ref ty, ref constant) => Type::Array(
+ Box::new(ty.specialize(mappings)),
+ constant.specialize(mappings),
+ ),
+ Type::FuncPtr {
+ ref ret,
+ ref args,
+ is_nullable,
+ never_return,
+ } => Type::FuncPtr {
+ ret: Box::new(ret.specialize(mappings)),
+ args: args
+ .iter()
+ .cloned()
+ .map(|(name, ty)| (name, ty.specialize(mappings)))
+ .collect(),
+ is_nullable,
+ never_return,
+ },
+ }
+ }
+
+ pub fn add_dependencies_ignoring_generics(
+ &self,
+ generic_params: &GenericParams,
+ library: &Library,
+ out: &mut Dependencies,
+ ) {
+ match *self {
+ Type::Ptr { ref ty, .. } => {
+ ty.add_dependencies_ignoring_generics(generic_params, library, out);
+ }
+ Type::Path(ref generic) => {
+ for generic_value in generic.generics() {
+ if let GenericArgument::Type(ref ty) = *generic_value {
+ ty.add_dependencies_ignoring_generics(generic_params, library, out);
+ }
+ }
+ let path = generic.path();
+ if !generic_params.iter().any(|param| param.name() == path) {
+ if let Some(items) = library.get_items(path) {
+ if !out.items.contains(path) {
+ out.items.insert(path.clone());
+
+ for item in &items {
+ item.deref().add_dependencies(library, out);
+ }
+ for item in items {
+ out.order.push(item);
+ }
+ }
+ } else {
+ warn!(
+ "Can't find {}. This usually means that this type was incompatible or \
+ not found.",
+ path
+ );
+ }
+ }
+ }
+ Type::Primitive(_) => {}
+ Type::Array(ref ty, _) => {
+ ty.add_dependencies_ignoring_generics(generic_params, library, out);
+ }
+ Type::FuncPtr {
+ ref ret, ref args, ..
+ } => {
+ ret.add_dependencies_ignoring_generics(generic_params, library, out);
+ for (_, ref arg) in args {
+ arg.add_dependencies_ignoring_generics(generic_params, library, out);
+ }
+ }
+ }
+ }
+
+ pub fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
+ self.add_dependencies_ignoring_generics(&GenericParams::default(), library, out)
+ }
+
+ pub fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
+ match *self {
+ Type::Ptr { ref ty, .. } => {
+ ty.add_monomorphs(library, out);
+ }
+ Type::Path(ref generic) => {
+ if generic.generics().is_empty() || out.contains(generic) {
+ return;
+ }
+ let path = generic.path();
+ if let Some(items) = library.get_items(path) {
+ for item in items {
+ item.deref()
+ .instantiate_monomorph(generic.generics(), library, out);
+ }
+ }
+ }
+ Type::Primitive(_) => {}
+ Type::Array(ref ty, _) => {
+ ty.add_monomorphs(library, out);
+ }
+ Type::FuncPtr {
+ ref ret, ref args, ..
+ } => {
+ ret.add_monomorphs(library, out);
+ for (_, ref arg) in args {
+ arg.add_monomorphs(library, out);
+ }
+ }
+ }
+ }
+
+ pub fn rename_for_config(&mut self, config: &Config, generic_params: &GenericParams) {
+ match *self {
+ Type::Ptr { ref mut ty, .. } => {
+ ty.rename_for_config(config, generic_params);
+ }
+ Type::Path(ref mut ty) => {
+ ty.rename_for_config(config, generic_params);
+ }
+ Type::Primitive(_) => {}
+ Type::Array(ref mut ty, ref mut len) => {
+ ty.rename_for_config(config, generic_params);
+ len.rename_for_config(config);
+ }
+ Type::FuncPtr {
+ ref mut ret,
+ ref mut args,
+ ..
+ } => {
+ ret.rename_for_config(config, generic_params);
+ for (_, arg) in args {
+ arg.rename_for_config(config, generic_params);
+ }
+ }
+ }
+ }
+
+ pub fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
+ match *self {
+ Type::Ptr { ref mut ty, .. } => {
+ ty.resolve_declaration_types(resolver);
+ }
+ Type::Path(ref mut generic_path) => {
+ generic_path.resolve_declaration_types(resolver);
+ }
+ Type::Primitive(_) => {}
+ Type::Array(ref mut ty, _) => {
+ ty.resolve_declaration_types(resolver);
+ }
+ Type::FuncPtr {
+ ref mut ret,
+ ref mut args,
+ ..
+ } => {
+ ret.resolve_declaration_types(resolver);
+ for (_, ref mut arg) in args {
+ arg.resolve_declaration_types(resolver);
+ }
+ }
+ }
+ }
+
+ pub fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
+ match *self {
+ Type::Ptr { ref mut ty, .. } => {
+ ty.mangle_paths(monomorphs);
+ }
+ Type::Path(ref mut generic_path) => {
+ if generic_path.generics().is_empty() {
+ return;
+ }
+
+ if let Some(mangled_path) = monomorphs.mangle_path(generic_path) {
+ *generic_path = GenericPath::new(mangled_path.clone(), vec![]);
+ } else {
+ warn!(
+ "Cannot find a mangling for generic path {:?}. This usually means that a \
+ type referenced by this generic was incompatible or not found.",
+ generic_path
+ );
+ }
+ }
+ Type::Primitive(_) => {}
+ Type::Array(ref mut ty, _) => {
+ ty.mangle_paths(monomorphs);
+ }
+ Type::FuncPtr {
+ ref mut ret,
+ ref mut args,
+ ..
+ } => {
+ ret.mangle_paths(monomorphs);
+ for (_, ref mut arg) in args {
+ arg.mangle_paths(monomorphs);
+ }
+ }
+ }
+ }
+
+ pub fn can_cmp_order(&self) -> bool {
+ match *self {
+ // FIXME: Shouldn't this look at ty.can_cmp_order() as well?
+ Type::Ptr { is_ref, .. } => !is_ref,
+ Type::Path(..) => true,
+ Type::Primitive(ref p) => p.can_cmp_order(),
+ Type::Array(..) => false,
+ Type::FuncPtr { .. } => false,
+ }
+ }
+
+ pub fn can_cmp_eq(&self) -> bool {
+ match *self {
+ Type::Ptr { ref ty, is_ref, .. } => !is_ref || ty.can_cmp_eq(),
+ Type::Path(..) => true,
+ Type::Primitive(ref p) => p.can_cmp_eq(),
+ Type::Array(..) => false,
+ Type::FuncPtr { .. } => true,
+ }
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/typedef.rs b/cbindgen-0.27.0/src/bindgen/ir/typedef.rs
new file mode 100644
index 0000000..5809587
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/typedef.rs
@@ -0,0 +1,181 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::collections::HashMap;
+
+use syn::ext::IdentExt;
+
+use crate::bindgen::config::Config;
+use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
+use crate::bindgen::dependencies::Dependencies;
+use crate::bindgen::ir::{
+ AnnotationSet, Cfg, Documentation, GenericArgument, GenericParams, Item, ItemContainer, Path,
+ Type,
+};
+use crate::bindgen::library::Library;
+use crate::bindgen::mangle;
+use crate::bindgen::monomorph::Monomorphs;
+
+/// A type alias that is represented as a C typedef
+#[derive(Debug, Clone)]
+pub struct Typedef {
+ pub path: Path,
+ pub export_name: String,
+ pub generic_params: GenericParams,
+ pub aliased: Type,
+ pub cfg: Option<Cfg>,
+ pub annotations: AnnotationSet,
+ pub documentation: Documentation,
+}
+
+impl Typedef {
+ pub fn load(item: &syn::ItemType, mod_cfg: Option<&Cfg>) -> Result<Typedef, String> {
+ if let Some(x) = Type::load(&item.ty)? {
+ let path = Path::new(item.ident.unraw().to_string());
+ Ok(Typedef::new(
+ path,
+ GenericParams::load(&item.generics)?,
+ x,
+ Cfg::append(mod_cfg, Cfg::load(&item.attrs)),
+ AnnotationSet::load(&item.attrs)?,
+ Documentation::load(&item.attrs),
+ ))
+ } else {
+ Err("Cannot have a typedef of a zero sized type.".to_owned())
+ }
+ }
+
+ pub fn new(
+ path: Path,
+ generic_params: GenericParams,
+ aliased: Type,
+ cfg: Option<Cfg>,
+ annotations: AnnotationSet,
+ documentation: Documentation,
+ ) -> Self {
+ let export_name = path.name().to_owned();
+ Self {
+ path,
+ export_name,
+ generic_params,
+ aliased,
+ cfg,
+ annotations,
+ documentation,
+ }
+ }
+
+ pub fn simplify_standard_types(&mut self, config: &Config) {
+ self.aliased.simplify_standard_types(config);
+ }
+
+ pub fn transfer_annotations(&mut self, out: &mut HashMap<Path, AnnotationSet>) {
+ if self.annotations.is_empty() {
+ return;
+ }
+
+ if let Some(alias_path) = self.aliased.get_root_path() {
+ if out.contains_key(&alias_path) {
+ warn!(
+ "Multiple typedef's with annotations for {}. Ignoring annotations from {}.",
+ alias_path, self.path
+ );
+ return;
+ }
+
+ out.insert(alias_path, self.annotations.clone());
+ self.annotations = AnnotationSet::new();
+ }
+ }
+
+ pub fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
+ // Generic structs can instantiate monomorphs only once they've been
+ // instantiated. See `instantiate_monomorph` for more details.
+ if !self.is_generic() {
+ self.aliased.add_monomorphs(library, out);
+ }
+ }
+
+ pub fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
+ self.aliased.mangle_paths(monomorphs);
+ }
+}
+
+impl Item for Typedef {
+ fn path(&self) -> &Path {
+ &self.path
+ }
+
+ fn export_name(&self) -> &str {
+ &self.export_name
+ }
+
+ fn cfg(&self) -> Option<&Cfg> {
+ self.cfg.as_ref()
+ }
+
+ fn annotations(&self) -> &AnnotationSet {
+ &self.annotations
+ }
+
+ fn annotations_mut(&mut self) -> &mut AnnotationSet {
+ &mut self.annotations
+ }
+
+ fn documentation(&self) -> &Documentation {
+ &self.documentation
+ }
+
+ fn container(&self) -> ItemContainer {
+ ItemContainer::Typedef(self.clone())
+ }
+
+ fn collect_declaration_types(&self, resolver: &mut DeclarationTypeResolver) {
+ resolver.add_none(&self.path);
+ }
+
+ fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
+ self.aliased.resolve_declaration_types(resolver);
+ }
+
+ fn generic_params(&self) -> &GenericParams {
+ &self.generic_params
+ }
+
+ fn rename_for_config(&mut self, config: &Config) {
+ config.export.rename(&mut self.export_name);
+ self.aliased.rename_for_config(config, &self.generic_params);
+ }
+
+ fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
+ self.aliased
+ .add_dependencies_ignoring_generics(&self.generic_params, library, out);
+ }
+
+ fn instantiate_monomorph(
+ &self,
+ generic_values: &[GenericArgument],
+ library: &Library,
+ out: &mut Monomorphs,
+ ) {
+ let mappings = self.generic_params.call(self.path.name(), generic_values);
+
+ let mangled_path = mangle::mangle_path(
+ &self.path,
+ generic_values,
+ &library.get_config().export.mangle,
+ );
+
+ let monomorph = Typedef::new(
+ mangled_path,
+ GenericParams::default(),
+ self.aliased.specialize(&mappings),
+ self.cfg.clone(),
+ self.annotations.clone(),
+ self.documentation.clone(),
+ );
+
+ out.insert_typedef(library, self, monomorph, generic_values.to_owned());
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/ir/union.rs b/cbindgen-0.27.0/src/bindgen/ir/union.rs
new file mode 100644
index 0000000..410e21a
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/ir/union.rs
@@ -0,0 +1,261 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use syn::ext::IdentExt;
+
+use crate::bindgen::config::{Config, LayoutConfig};
+use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
+use crate::bindgen::dependencies::Dependencies;
+use crate::bindgen::ir::{
+ AnnotationSet, Cfg, Documentation, Field, GenericArgument, GenericParams, Item, ItemContainer,
+ Path, Repr, ReprAlign, ReprStyle,
+};
+use crate::bindgen::library::Library;
+use crate::bindgen::mangle;
+use crate::bindgen::monomorph::Monomorphs;
+use crate::bindgen::rename::{IdentifierType, RenameRule};
+use crate::bindgen::utilities::IterHelpers;
+
+#[derive(Debug, Clone)]
+pub struct Union {
+ pub path: Path,
+ pub export_name: String,
+ pub generic_params: GenericParams,
+ pub fields: Vec<Field>,
+ pub tuple_union: bool,
+ pub alignment: Option<ReprAlign>,
+ pub cfg: Option<Cfg>,
+ pub annotations: AnnotationSet,
+ pub documentation: Documentation,
+}
+
+impl Union {
+ pub fn load(
+ layout_config: &LayoutConfig,
+ item: &syn::ItemUnion,
+ mod_cfg: Option<&Cfg>,
+ ) -> Result<Union, String> {
+ let repr = Repr::load(&item.attrs)?;
+ if repr.style != ReprStyle::C {
+ return Err("Union is not marked #[repr(C)].".to_owned());
+ }
+
+ // Ensure we can safely represent the union given the configuration.
+ if let Some(align) = repr.align {
+ layout_config.ensure_safe_to_represent(&align)?;
+ }
+
+ let path = Path::new(item.ident.unraw().to_string());
+
+ let (fields, tuple_union) = {
+ let out = item
+ .fields
+ .named
+ .iter()
+ .try_skip_map(|field| Field::load(field, &path))?;
+ (out, false)
+ };
+
+ Ok(Union::new(
+ path,
+ GenericParams::load(&item.generics)?,
+ fields,
+ repr.align,
+ tuple_union,
+ Cfg::append(mod_cfg, Cfg::load(&item.attrs)),
+ AnnotationSet::load(&item.attrs)?,
+ Documentation::load(&item.attrs),
+ ))
+ }
+
+ #[allow(clippy::too_many_arguments)]
+ pub fn new(
+ path: Path,
+ generic_params: GenericParams,
+ fields: Vec<Field>,
+ alignment: Option<ReprAlign>,
+ tuple_union: bool,
+ cfg: Option<Cfg>,
+ annotations: AnnotationSet,
+ documentation: Documentation,
+ ) -> Self {
+ let export_name = path.name().to_owned();
+ Self {
+ path,
+ export_name,
+ generic_params,
+ fields,
+ tuple_union,
+ alignment,
+ cfg,
+ annotations,
+ documentation,
+ }
+ }
+
+ pub fn simplify_standard_types(&mut self, config: &Config) {
+ for field in &mut self.fields {
+ field.ty.simplify_standard_types(config);
+ }
+ }
+
+ pub fn add_monomorphs(&self, library: &Library, out: &mut Monomorphs) {
+ // Generic unions can instantiate monomorphs only once they've been
+ // instantiated. See `instantiate_monomorph` for more details.
+ if self.is_generic() {
+ return;
+ }
+
+ for field in &self.fields {
+ field.ty.add_monomorphs(library, out);
+ }
+ }
+
+ pub fn mangle_paths(&mut self, monomorphs: &Monomorphs) {
+ for field in &mut self.fields {
+ field.ty.mangle_paths(monomorphs);
+ }
+ }
+}
+
+impl Item for Union {
+ fn path(&self) -> &Path {
+ &self.path
+ }
+
+ fn export_name(&self) -> &str {
+ &self.export_name
+ }
+
+ fn cfg(&self) -> Option<&Cfg> {
+ self.cfg.as_ref()
+ }
+
+ fn annotations(&self) -> &AnnotationSet {
+ &self.annotations
+ }
+
+ fn annotations_mut(&mut self) -> &mut AnnotationSet {
+ &mut self.annotations
+ }
+
+ fn documentation(&self) -> &Documentation {
+ &self.documentation
+ }
+
+ fn container(&self) -> ItemContainer {
+ ItemContainer::Union(self.clone())
+ }
+
+ fn collect_declaration_types(&self, resolver: &mut DeclarationTypeResolver) {
+ resolver.add_union(&self.path);
+ }
+
+ fn resolve_declaration_types(&mut self, resolver: &DeclarationTypeResolver) {
+ for field in &mut self.fields {
+ field.ty.resolve_declaration_types(resolver);
+ }
+ }
+
+ fn generic_params(&self) -> &GenericParams {
+ &self.generic_params
+ }
+
+ fn rename_for_config(&mut self, config: &Config) {
+ config.export.rename(&mut self.export_name);
+ for field in &mut self.fields {
+ field.ty.rename_for_config(config, &self.generic_params);
+ }
+
+ let rules = self
+ .annotations
+ .parse_atom::<RenameRule>("rename-all")
+ .unwrap_or(config.structure.rename_fields);
+
+ if let Some(o) = self.annotations.list("field-names") {
+ let mut overriden_fields = Vec::new();
+
+ for (i, field) in self.fields.iter().enumerate() {
+ if i >= o.len() {
+ overriden_fields.push(field.clone());
+ } else {
+ overriden_fields.push(Field {
+ name: o[i].clone(),
+ ty: field.ty.clone(),
+ cfg: field.cfg.clone(),
+ annotations: field.annotations.clone(),
+ documentation: field.documentation.clone(),
+ });
+ }
+ }
+
+ self.fields = overriden_fields;
+ } else if let Some(r) = rules.not_none() {
+ self.fields = self
+ .fields
+ .iter()
+ .map(|field| Field {
+ name: r
+ .apply(&field.name, IdentifierType::StructMember)
+ .into_owned(),
+ ty: field.ty.clone(),
+ cfg: field.cfg.clone(),
+ annotations: field.annotations.clone(),
+ documentation: field.documentation.clone(),
+ })
+ .collect();
+ } else if self.tuple_union {
+ // If we don't have any rules for a tuple union, prefix them with
+ // an underscore so it still compiles
+ for field in &mut self.fields {
+ field.name.insert(0, '_');
+ }
+ }
+ }
+
+ fn add_dependencies(&self, library: &Library, out: &mut Dependencies) {
+ for field in &self.fields {
+ field
+ .ty
+ .add_dependencies_ignoring_generics(&self.generic_params, library, out);
+ }
+ }
+
+ fn instantiate_monomorph(
+ &self,
+ generic_values: &[GenericArgument],
+ library: &Library,
+ out: &mut Monomorphs,
+ ) {
+ let mappings = self.generic_params.call(self.path.name(), generic_values);
+
+ let mangled_path = mangle::mangle_path(
+ &self.path,
+ generic_values,
+ &library.get_config().export.mangle,
+ );
+
+ let monomorph = Union::new(
+ mangled_path,
+ GenericParams::default(),
+ self.fields
+ .iter()
+ .map(|field| Field {
+ name: field.name.clone(),
+ ty: field.ty.specialize(&mappings),
+ cfg: field.cfg.clone(),
+ annotations: field.annotations.clone(),
+ documentation: field.documentation.clone(),
+ })
+ .collect(),
+ self.alignment,
+ self.tuple_union,
+ self.cfg.clone(),
+ self.annotations.clone(),
+ self.documentation.clone(),
+ );
+
+ out.insert_union(library, self, monomorph, generic_values.to_owned());
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/language_backend/clike.rs b/cbindgen-0.27.0/src/bindgen/language_backend/clike.rs
new file mode 100644
index 0000000..5da079c
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/language_backend/clike.rs
@@ -0,0 +1,1002 @@
+use crate::bindgen::ir::{
+ to_known_assoc_constant, ConditionWrite, DeprecatedNoteKind, Documentation, Enum, EnumVariant,
+ Field, GenericParams, Item, Literal, OpaqueItem, ReprAlign, Static, Struct, ToCondition, Type,
+ Typedef, Union,
+};
+use crate::bindgen::language_backend::LanguageBackend;
+use crate::bindgen::rename::IdentifierType;
+use crate::bindgen::writer::{ListType, SourceWriter};
+use crate::bindgen::{cdecl, Bindings, Config, Language};
+use crate::bindgen::{DocumentationLength, DocumentationStyle};
+use std::io::Write;
+
+pub struct CLikeLanguageBackend<'a> {
+ config: &'a Config,
+}
+
+impl<'a> CLikeLanguageBackend<'a> {
+ pub fn new(config: &'a Config) -> Self {
+ Self { config }
+ }
+
+ fn write_enum_variant<W: Write>(&mut self, out: &mut SourceWriter<W>, u: &EnumVariant) {
+ let condition = u.cfg.to_condition(self.config);
+
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &u.documentation);
+ write!(out, "{}", u.export_name);
+ if let Some(note) = u
+ .body
+ .annotations()
+ .deprecated_note(self.config, DeprecatedNoteKind::EnumVariant)
+ {
+ write!(out, " {}", note);
+ }
+ if let Some(discriminant) = &u.discriminant {
+ out.write(" = ");
+
+ self.write_literal(out, discriminant);
+ }
+ out.write(",");
+ condition.write_after(self.config, out);
+ }
+
+ fn write_field<W: Write>(&mut self, out: &mut SourceWriter<W>, f: &Field) {
+ let condition = f.cfg.to_condition(self.config);
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &f.documentation);
+ cdecl::write_field(self, out, &f.ty, &f.name, self.config);
+
+ if let Some(bitfield) = f.annotations.atom("bitfield") {
+ write!(out, ": {}", bitfield.unwrap_or_default());
+ }
+
+ condition.write_after(self.config, out);
+ // FIXME(#634): `write_vertical_source_list` should support
+ // configuring list elements natively. For now we print a newline
+ // here to avoid printing `#endif;` with semicolon.
+ if condition.is_some() {
+ out.new_line();
+ }
+ }
+
+ fn write_generic_param<W: Write>(&mut self, out: &mut SourceWriter<W>, g: &GenericParams) {
+ g.write_internal(self, self.config, out, false);
+ }
+
+ fn open_close_namespaces<W: Write>(&mut self, out: &mut SourceWriter<W>, open: bool) {
+ let mut namespaces =
+ if self.config.language != Language::Cxx && !self.config.cpp_compatible_c() {
+ vec![]
+ } else {
+ let mut ret = vec![];
+ if let Some(ref namespace) = self.config.namespace {
+ ret.push(&**namespace);
+ }
+ if let Some(ref namespaces) = self.config.namespaces {
+ for namespace in namespaces {
+ ret.push(&**namespace);
+ }
+ }
+ ret
+ };
+
+ if namespaces.is_empty() {
+ return;
+ }
+
+ if !open {
+ namespaces.reverse();
+ }
+
+ if self.config.cpp_compatible_c() {
+ out.new_line_if_not_start();
+ out.write("#ifdef __cplusplus");
+ }
+
+ for namespace in namespaces {
+ out.new_line();
+ if open {
+ write!(out, "namespace {} {{", namespace)
+ } else {
+ write!(out, "}} // namespace {}", namespace)
+ }
+ }
+
+ out.new_line();
+ if self.config.cpp_compatible_c() {
+ out.write("#endif // __cplusplus");
+ out.new_line();
+ }
+ }
+
+ fn generate_typedef(&self) -> bool {
+ self.config.language == Language::C && self.config.style.generate_typedef()
+ }
+
+ fn write_derived_cpp_ops<W: Write>(&mut self, out: &mut SourceWriter<W>, s: &Struct) {
+ let mut wrote_start_newline = false;
+
+ if self.config.structure.derive_constructor(&s.annotations) && !s.fields.is_empty() {
+ if !wrote_start_newline {
+ wrote_start_newline = true;
+ out.new_line();
+ }
+
+ out.new_line();
+
+ let renamed_fields: Vec<_> = s
+ .fields
+ .iter()
+ .map(|field| {
+ self.config
+ .function
+ .rename_args
+ .apply(&field.name, IdentifierType::FunctionArg)
+ .into_owned()
+ })
+ .collect();
+ write!(out, "{}(", s.export_name());
+ let vec: Vec<_> = s
+ .fields
+ .iter()
+ .zip(&renamed_fields)
+ .map(|(field, renamed)| {
+ Field::from_name_and_type(
+ // const-ref args to constructor
+ format!("const& {}", renamed),
+ field.ty.clone(),
+ )
+ })
+ .collect();
+ out.write_vertical_source_list(self, &vec[..], ListType::Join(","), Self::write_field);
+ write!(out, ")");
+ out.new_line();
+ write!(out, " : ");
+ let vec: Vec<_> = s
+ .fields
+ .iter()
+ .zip(&renamed_fields)
+ .map(|(field, renamed)| format!("{}({})", field.name, renamed))
+ .collect();
+ out.write_vertical_source_list(self, &vec[..], ListType::Join(","), |_, out, s| {
+ write!(out, "{}", s)
+ });
+ out.new_line();
+ write!(out, "{{}}");
+ out.new_line();
+ }
+
+ let other = self
+ .config
+ .function
+ .rename_args
+ .apply("other", IdentifierType::FunctionArg);
+
+ if s.annotations
+ .bool("internal-derive-bitflags")
+ .unwrap_or(false)
+ {
+ assert_eq!(s.fields.len(), 1);
+ let bits = &s.fields[0].name;
+ if !wrote_start_newline {
+ wrote_start_newline = true;
+ out.new_line();
+ }
+ let constexpr_prefix = if self.config.constant.allow_constexpr {
+ "constexpr "
+ } else {
+ ""
+ };
+
+ out.new_line();
+ write!(out, "{}explicit operator bool() const", constexpr_prefix);
+ out.open_brace();
+ write!(out, "return !!{bits};");
+ out.close_brace(false);
+
+ out.new_line();
+ write!(
+ out,
+ "{}{} operator~() const",
+ constexpr_prefix,
+ s.export_name()
+ );
+ out.open_brace();
+ write!(
+ out,
+ "return {} {{ static_cast<decltype({bits})>(~{bits}) }};",
+ s.export_name()
+ );
+ out.close_brace(false);
+ s.emit_bitflags_binop(constexpr_prefix, '|', &other, out);
+ s.emit_bitflags_binop(constexpr_prefix, '&', &other, out);
+ s.emit_bitflags_binop(constexpr_prefix, '^', &other, out);
+ }
+
+ // Generate a serializer function that allows dumping this struct
+ // to an std::ostream. It's defined as a friend function inside the
+ // struct definition, and doesn't need the `inline` keyword even
+ // though it's implemented right in the generated header file.
+ if self.config.structure.derive_ostream(&s.annotations) {
+ if !wrote_start_newline {
+ wrote_start_newline = true;
+ out.new_line();
+ }
+
+ out.new_line();
+ let stream = self
+ .config
+ .function
+ .rename_args
+ .apply("stream", IdentifierType::FunctionArg);
+ let instance = self
+ .config
+ .function
+ .rename_args
+ .apply("instance", IdentifierType::FunctionArg);
+ write!(
+ out,
+ "friend std::ostream& operator<<(std::ostream& {}, const {}& {})",
+ stream,
+ s.export_name(),
+ instance,
+ );
+ out.open_brace();
+ write!(out, "return {} << \"{{ \"", stream);
+ let vec: Vec<_> = s
+ .fields
+ .iter()
+ .map(|x| format!(" << \"{}=\" << {}.{}", x.name, instance, x.name))
+ .collect();
+ out.write_vertical_source_list(
+ self,
+ &vec[..],
+ ListType::Join(" << \", \""),
+ |_, out, s| write!(out, "{}", s),
+ );
+ out.write(" << \" }\";");
+ out.close_brace(false);
+ }
+
+ let skip_fields = s.has_tag_field as usize;
+
+ macro_rules! emit_op {
+ ($op_name:expr, $op:expr, $conjuc:expr) => {{
+ if !wrote_start_newline {
+ #[allow(unused_assignments)]
+ {
+ wrote_start_newline = true;
+ }
+ out.new_line();
+ }
+
+ out.new_line();
+
+ if let Some(Some(attrs)) = s.annotations.atom(concat!($op_name, "-attributes")) {
+ write!(out, "{} ", attrs);
+ }
+
+ write!(
+ out,
+ "bool operator{}(const {}& {}) const",
+ $op,
+ s.export_name(),
+ other
+ );
+ out.open_brace();
+ out.write("return ");
+ let vec: Vec<_> = s
+ .fields
+ .iter()
+ .skip(skip_fields)
+ .map(|field| format!("{} {} {}.{}", field.name, $op, other, field.name))
+ .collect();
+ out.write_vertical_source_list(
+ self,
+ &vec[..],
+ ListType::Join(&format!(" {}", $conjuc)),
+ |_, out, s| write!(out, "{}", s),
+ );
+ out.write(";");
+ out.close_brace(false);
+ }};
+ }
+
+ if self.config.structure.derive_eq(&s.annotations) && s.can_derive_eq() {
+ emit_op!("eq", "==", "&&");
+ }
+ if self.config.structure.derive_neq(&s.annotations) && s.can_derive_eq() {
+ emit_op!("neq", "!=", "||");
+ }
+ if self.config.structure.derive_lt(&s.annotations)
+ && s.fields.len() == 1
+ && s.fields[0].ty.can_cmp_order()
+ {
+ emit_op!("lt", "<", "&&");
+ }
+ if self.config.structure.derive_lte(&s.annotations)
+ && s.fields.len() == 1
+ && s.fields[0].ty.can_cmp_order()
+ {
+ emit_op!("lte", "<=", "&&");
+ }
+ if self.config.structure.derive_gt(&s.annotations)
+ && s.fields.len() == 1
+ && s.fields[0].ty.can_cmp_order()
+ {
+ emit_op!("gt", ">", "&&");
+ }
+ if self.config.structure.derive_gte(&s.annotations)
+ && s.fields.len() == 1
+ && s.fields[0].ty.can_cmp_order()
+ {
+ emit_op!("gte", ">=", "&&");
+ }
+ }
+}
+
+impl LanguageBackend for CLikeLanguageBackend<'_> {
+ fn write_headers<W: Write>(&self, out: &mut SourceWriter<W>, package_version: &str) {
+ if self.config.package_version {
+ write!(out, "/* Package version: {} */", package_version);
+ out.new_line();
+ }
+ if let Some(ref f) = self.config.header {
+ out.new_line_if_not_start();
+ write!(out, "{}", f);
+ out.new_line();
+ }
+ if let Some(f) = self.config.include_guard() {
+ out.new_line_if_not_start();
+ write!(out, "#ifndef {}", f);
+ out.new_line();
+ write!(out, "#define {}", f);
+ out.new_line();
+ }
+ if self.config.pragma_once {
+ out.new_line_if_not_start();
+ write!(out, "#pragma once");
+ out.new_line();
+ }
+ if self.config.include_version {
+ out.new_line_if_not_start();
+ write!(
+ out,
+ "/* Generated with cbindgen:{} */",
+ crate::bindgen::config::VERSION
+ );
+ out.new_line();
+ }
+ if let Some(ref f) = self.config.autogen_warning {
+ out.new_line_if_not_start();
+ write!(out, "{}", f);
+ out.new_line();
+ }
+
+ if self.config.no_includes
+ && self.config.sys_includes().is_empty()
+ && self.config.includes().is_empty()
+ && self.config.after_includes.is_none()
+ {
+ return;
+ }
+
+ out.new_line_if_not_start();
+
+ if !self.config.no_includes {
+ match self.config.language {
+ Language::C => {
+ out.write("#include <stdarg.h>");
+ out.new_line();
+ out.write("#include <stdbool.h>");
+ out.new_line();
+ if self.config.usize_is_size_t {
+ out.write("#include <stddef.h>");
+ out.new_line();
+ }
+ out.write("#include <stdint.h>");
+ out.new_line();
+ out.write("#include <stdlib.h>");
+ out.new_line();
+ }
+ Language::Cxx => {
+ out.write("#include <cstdarg>");
+ out.new_line();
+ if self.config.usize_is_size_t {
+ out.write("#include <cstddef>");
+ out.new_line();
+ }
+ out.write("#include <cstdint>");
+ out.new_line();
+ out.write("#include <cstdlib>");
+ out.new_line();
+ out.write("#include <ostream>");
+ out.new_line();
+ out.write("#include <new>");
+ out.new_line();
+ if self.config.enumeration.cast_assert_name.is_none()
+ && (self.config.enumeration.derive_mut_casts
+ || self.config.enumeration.derive_const_casts)
+ {
+ out.write("#include <cassert>");
+ out.new_line();
+ }
+ }
+ _ => {}
+ }
+ }
+
+ for include in self.config.sys_includes() {
+ write!(out, "#include <{}>", include);
+ out.new_line();
+ }
+
+ for include in self.config.includes() {
+ write!(out, "#include \"{}\"", include);
+ out.new_line();
+ }
+
+ if let Some(ref line) = self.config.after_includes {
+ write!(out, "{}", line);
+ out.new_line();
+ }
+ }
+
+ fn open_namespaces<W: Write>(&mut self, out: &mut SourceWriter<W>) {
+ self.open_close_namespaces(out, true);
+ }
+
+ fn close_namespaces<W: Write>(&mut self, out: &mut SourceWriter<W>) {
+ self.open_close_namespaces(out, false)
+ }
+
+ fn write_footers<W: Write>(&mut self, out: &mut SourceWriter<W>) {
+ if let Some(f) = self.config.include_guard() {
+ out.new_line_if_not_start();
+ if self.config.language == Language::C {
+ write!(out, "#endif /* {} */", f);
+ } else {
+ write!(out, "#endif // {}", f);
+ }
+ out.new_line();
+ }
+ }
+
+ fn write_enum<W: Write>(&mut self, out: &mut SourceWriter<W>, e: &Enum) {
+ let size = e.repr.ty.map(|ty| ty.to_primitive().to_repr_c(self.config));
+ let has_data = e.tag.is_some();
+ let inline_tag_field = Enum::inline_tag_field(&e.repr);
+ let tag_name = e.tag_name();
+
+ let condition = e.cfg.to_condition(self.config);
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &e.documentation);
+ self.write_generic_param(out, &e.generic_params);
+
+ // If the enum has data, we need to emit a struct or union for the data
+ // and enum for the tag. C++ supports nested type definitions, so we open
+ // the struct or union here and define the tag enum inside it (*).
+ if has_data && self.config.language == Language::Cxx {
+ e.open_struct_or_union(self.config, out, inline_tag_field);
+ }
+
+ // Emit the tag enum and everything related to it.
+ e.write_tag_enum(self.config, self, out, size, Self::write_enum_variant);
+
+ // If the enum has data, we need to emit structs for the variants and gather them together.
+ if has_data {
+ e.write_variant_defs(self.config, self, out);
+ out.new_line();
+ out.new_line();
+
+ // Open the struct or union for the data (**), gathering all the variants with data
+ // together, unless it's C++, then we have already opened that struct/union at (*) and
+ // are currently inside it.
+ if self.config.language != Language::Cxx {
+ e.open_struct_or_union(self.config, out, inline_tag_field);
+ }
+
+ // Emit tag field that is separate from all variants.
+ e.write_tag_field(self.config, out, size, inline_tag_field, tag_name);
+ out.new_line();
+
+ // Open union of all variants with data, only in the non-inline tag scenario.
+ if !inline_tag_field {
+ out.write("union");
+ out.open_brace();
+ }
+
+ // Emit fields for all variants with data.
+ e.write_variant_fields(self.config, self, out, inline_tag_field, Self::write_field);
+
+ // Close union of all variants with data, only in the non-inline tag scenario.
+ if !inline_tag_field {
+ out.close_brace(true);
+ }
+
+ // Emit convenience methods for the struct or enum for the data.
+ e.write_derived_functions_data(self.config, self, out, tag_name, Self::write_field);
+
+ // Emit the post_body section, if relevant.
+ if let Some(body) = self.config.export.post_body(&e.path) {
+ out.new_line();
+ out.write_raw_block(body);
+ }
+
+ // Close the struct or union opened either at (*) or at (**).
+ if self.generate_typedef() {
+ out.close_brace(false);
+ write!(out, " {};", e.export_name);
+ } else {
+ out.close_brace(true);
+ }
+ }
+
+ condition.write_after(self.config, out);
+ }
+
+ fn write_struct<W: Write>(&mut self, out: &mut SourceWriter<W>, s: &Struct) {
+ if s.is_transparent {
+ let typedef = Typedef {
+ path: s.path.clone(),
+ export_name: s.export_name.to_owned(),
+ generic_params: s.generic_params.clone(),
+ aliased: s.fields[0].ty.clone(),
+ cfg: s.cfg.clone(),
+ annotations: s.annotations.clone(),
+ documentation: s.documentation.clone(),
+ };
+ self.write_type_def(out, &typedef);
+ for constant in &s.associated_constants {
+ out.new_line();
+ constant.write(self.config, self, out, Some(s));
+ }
+ return;
+ }
+
+ let condition = s.cfg.to_condition(self.config);
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &s.documentation);
+
+ if !s.is_enum_variant_body {
+ self.write_generic_param(out, &s.generic_params);
+ }
+
+ // The following results in
+ // C++ or C with Tag as style:
+ // struct Name {
+ // C with Type only style:
+ // typedef struct {
+ // C with Both as style:
+ // typedef struct Name {
+ if self.generate_typedef() {
+ out.write("typedef ");
+ }
+
+ out.write("struct");
+
+ if let Some(align) = s.alignment {
+ match align {
+ ReprAlign::Packed => {
+ if let Some(ref anno) = self.config.layout.packed {
+ write!(out, " {}", anno);
+ }
+ }
+ ReprAlign::Align(n) => {
+ if let Some(ref anno) = self.config.layout.aligned_n {
+ write!(out, " {}({})", anno, n);
+ }
+ }
+ }
+ }
+
+ if s.annotations.must_use(self.config) {
+ if let Some(ref anno) = self.config.structure.must_use {
+ write!(out, " {}", anno);
+ }
+ }
+
+ if let Some(note) = s
+ .annotations
+ .deprecated_note(self.config, DeprecatedNoteKind::Struct)
+ {
+ write!(out, " {}", note);
+ }
+
+ if self.config.language != Language::C || self.config.style.generate_tag() {
+ write!(out, " {}", s.export_name());
+ }
+
+ out.open_brace();
+
+ // Emit the pre_body section, if relevant
+ if let Some(body) = self.config.export.pre_body(&s.path) {
+ out.write_raw_block(body);
+ out.new_line();
+ }
+
+ out.write_vertical_source_list(self, &s.fields, ListType::Cap(";"), Self::write_field);
+
+ if self.config.language == Language::Cxx {
+ self.write_derived_cpp_ops(out, s);
+ }
+
+ // Emit the post_body section, if relevant
+ if let Some(body) = self.config.export.post_body(&s.path) {
+ out.new_line();
+ out.write_raw_block(body);
+ }
+
+ if self.config.language == Language::Cxx
+ && self.config.structure.associated_constants_in_body
+ && self.config.constant.allow_static_const
+ {
+ for constant in &s.associated_constants {
+ out.new_line();
+ constant.write_declaration(self.config, self, out, s);
+ }
+ }
+
+ if self.generate_typedef() {
+ out.close_brace(false);
+ write!(out, " {};", s.export_name());
+ } else {
+ out.close_brace(true);
+ }
+
+ for constant in &s.associated_constants {
+ out.new_line();
+ constant.write(self.config, self, out, Some(s));
+ }
+
+ condition.write_after(self.config, out);
+ }
+
+ fn write_union<W: Write>(&mut self, out: &mut SourceWriter<W>, u: &Union) {
+ let condition = u.cfg.to_condition(self.config);
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &u.documentation);
+
+ self.write_generic_param(out, &u.generic_params);
+
+ // The following results in
+ // C++ or C with Tag as style:
+ // union Name {
+ // C with Type only style:
+ // typedef union {
+ // C with Both as style:
+ // typedef union Name {
+ if self.generate_typedef() {
+ out.write("typedef ");
+ }
+
+ out.write("union");
+
+ if let Some(align) = u.alignment {
+ match align {
+ ReprAlign::Packed => {
+ if let Some(ref anno) = self.config.layout.packed {
+ write!(out, " {}", anno);
+ }
+ }
+ ReprAlign::Align(n) => {
+ if let Some(ref anno) = self.config.layout.aligned_n {
+ write!(out, " {}({})", anno, n);
+ }
+ }
+ }
+ }
+
+ if self.config.language != Language::C || self.config.style.generate_tag() {
+ write!(out, " {}", u.export_name);
+ }
+
+ out.open_brace();
+
+ // Emit the pre_body section, if relevant
+ if let Some(body) = self.config.export.pre_body(&u.path) {
+ out.write_raw_block(body);
+ out.new_line();
+ }
+
+ out.write_vertical_source_list(self, &u.fields, ListType::Cap(";"), Self::write_field);
+
+ // Emit the post_body section, if relevant
+ if let Some(body) = self.config.export.post_body(&u.path) {
+ out.new_line();
+ out.write_raw_block(body);
+ }
+
+ if self.generate_typedef() {
+ out.close_brace(false);
+ write!(out, " {};", u.export_name);
+ } else {
+ out.close_brace(true);
+ }
+
+ condition.write_after(self.config, out);
+ }
+
+ fn write_opaque_item<W: Write>(&mut self, out: &mut SourceWriter<W>, o: &OpaqueItem) {
+ let condition = o.cfg.to_condition(self.config);
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &o.documentation);
+
+ o.generic_params.write_with_default(self, self.config, out);
+
+ if self.generate_typedef() {
+ write!(
+ out,
+ "typedef struct {} {};",
+ o.export_name(),
+ o.export_name()
+ );
+ } else {
+ write!(out, "struct {};", o.export_name());
+ }
+
+ condition.write_after(self.config, out);
+ }
+
+ fn write_type_def<W: Write>(&mut self, out: &mut SourceWriter<W>, t: &Typedef) {
+ let condition = t.cfg.to_condition(self.config);
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &t.documentation);
+
+ self.write_generic_param(out, &t.generic_params);
+
+ if self.config.language == Language::Cxx {
+ write!(out, "using {} = ", t.export_name());
+ self.write_type(out, &t.aliased);
+ } else {
+ write!(out, "{} ", self.config.language.typedef());
+ self.write_field(
+ out,
+ &Field::from_name_and_type(t.export_name().to_owned(), t.aliased.clone()),
+ );
+ }
+
+ out.write(";");
+
+ condition.write_after(self.config, out);
+ }
+
+ fn write_static<W: Write>(&mut self, out: &mut SourceWriter<W>, s: &Static) {
+ let condition = s.cfg.to_condition(self.config);
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &s.documentation);
+ out.write("extern ");
+ if let Type::Ptr { is_const: true, .. } = s.ty {
+ } else if !s.mutable {
+ out.write("const ");
+ }
+ cdecl::write_field(self, out, &s.ty, &s.export_name, self.config);
+ out.write(";");
+
+ condition.write_after(self.config, out);
+ }
+
+ fn write_type<W: Write>(&mut self, out: &mut SourceWriter<W>, t: &Type) {
+ cdecl::write_type(self, out, t, self.config);
+ }
+
+ fn write_documentation<W: Write>(&mut self, out: &mut SourceWriter<W>, d: &Documentation) {
+ if d.doc_comment.is_empty() || !self.config.documentation {
+ return;
+ }
+
+ let end = match self.config.documentation_length {
+ DocumentationLength::Short => 1,
+ DocumentationLength::Full => d.doc_comment.len(),
+ };
+
+ let style = match self.config.documentation_style {
+ DocumentationStyle::Auto if self.config.language == Language::C => {
+ DocumentationStyle::Doxy
+ }
+ DocumentationStyle::Auto if self.config.language == Language::Cxx => {
+ DocumentationStyle::Cxx
+ }
+ DocumentationStyle::Auto => DocumentationStyle::C, // Fallback if `Language` gets extended.
+ other => other,
+ };
+
+ // Following these documents for style conventions:
+ // https://en.wikibooks.org/wiki/C++_Programming/Code/Style_Conventions/Comments
+ // https://www.cs.cmu.edu/~410/doc/doxygen.html
+ match style {
+ DocumentationStyle::C => {
+ out.write("/*");
+ out.new_line();
+ }
+
+ DocumentationStyle::Doxy => {
+ out.write("/**");
+ out.new_line();
+ }
+
+ _ => (),
+ }
+
+ for line in &d.doc_comment[..end] {
+ match style {
+ DocumentationStyle::C => out.write(""),
+ DocumentationStyle::Doxy => out.write(" *"),
+ DocumentationStyle::C99 => out.write("//"),
+ DocumentationStyle::Cxx => out.write("///"),
+ DocumentationStyle::Auto => unreachable!(), // Auto case should always be covered
+ }
+
+ write!(out, "{}", line);
+ out.new_line();
+ }
+
+ match style {
+ DocumentationStyle::C => {
+ out.write(" */");
+ out.new_line();
+ }
+
+ DocumentationStyle::Doxy => {
+ out.write(" */");
+ out.new_line();
+ }
+
+ _ => (),
+ }
+ }
+
+ fn write_literal<W: Write>(&mut self, out: &mut SourceWriter<W>, l: &Literal) {
+ match l {
+ Literal::Expr(v) => write!(out, "{}", v),
+ Literal::Path {
+ ref associated_to,
+ ref name,
+ } => {
+ if let Some((ref path, ref export_name)) = associated_to {
+ if let Some(known) = to_known_assoc_constant(path, name) {
+ return write!(out, "{}", known);
+ }
+ let path_separator = if self.config.language == Language::C {
+ "_"
+ } else if self.config.structure.associated_constants_in_body {
+ "::"
+ } else {
+ "_"
+ };
+ write!(out, "{}{}", export_name, path_separator)
+ }
+ write!(out, "{}", name)
+ }
+ Literal::FieldAccess {
+ ref base,
+ ref field,
+ } => {
+ write!(out, "(");
+ self.write_literal(out, base);
+ write!(out, ").{}", field);
+ }
+ Literal::PostfixUnaryOp { op, ref value } => {
+ write!(out, "{}", op);
+ self.write_literal(out, value);
+ }
+ Literal::BinOp {
+ ref left,
+ op,
+ ref right,
+ } => {
+ write!(out, "(");
+ self.write_literal(out, left);
+ write!(out, " {} ", op);
+ self.write_literal(out, right);
+ write!(out, ")");
+ }
+ Literal::Cast { ref ty, ref value } => {
+ out.write("(");
+ self.write_type(out, ty);
+ out.write(")");
+ self.write_literal(out, value);
+ }
+ Literal::Struct {
+ export_name,
+ fields,
+ path,
+ } => {
+ if self.config.language == Language::C {
+ write!(out, "({})", export_name);
+ } else {
+ write!(out, "{}", export_name);
+ }
+
+ write!(out, "{{ ");
+ let mut is_first_field = true;
+ // In C++, same order as defined is required.
+ let ordered_fields = out.bindings().struct_field_names(path);
+ for ordered_key in ordered_fields.iter() {
+ if let Some(lit) = fields.get(ordered_key) {
+ if !is_first_field {
+ write!(out, ", ");
+ }
+ is_first_field = false;
+ if self.config.language == Language::Cxx {
+ // TODO: Some C++ versions (c++20?) now support designated
+ // initializers, consider generating them.
+ write!(out, "/* .{} = */ ", ordered_key);
+ } else {
+ write!(out, ".{} = ", ordered_key);
+ }
+ self.write_literal(out, lit);
+ }
+ }
+ write!(out, " }}");
+ }
+ }
+ }
+
+ fn write_globals<W: Write>(&mut self, out: &mut SourceWriter<W>, b: &Bindings) {
+ // Override default method to open various blocs containing both globals and functions
+ // these blocks are closed in [`write_functions`] that is also overridden
+ if !b.functions.is_empty() || !b.globals.is_empty() {
+ if b.config.cpp_compatible_c() {
+ out.new_line_if_not_start();
+ out.write("#ifdef __cplusplus");
+ }
+
+ if b.config.language == Language::Cxx {
+ if let Some(ref using_namespaces) = b.config.using_namespaces {
+ for namespace in using_namespaces {
+ out.new_line();
+ write!(out, "using namespace {};", namespace);
+ }
+ out.new_line();
+ }
+ }
+
+ if b.config.language == Language::Cxx || b.config.cpp_compatible_c() {
+ out.new_line();
+ out.write("extern \"C\" {");
+ out.new_line();
+ }
+
+ if b.config.cpp_compatible_c() {
+ out.write("#endif // __cplusplus");
+ out.new_line();
+ }
+
+ self.write_globals_default(out, b);
+ }
+ }
+
+ fn write_functions<W: Write>(&mut self, out: &mut SourceWriter<W>, b: &Bindings) {
+ // Override default method to close various blocks containing both globals and functions
+ // these blocks are opened in [`write_globals`] that is also overridden
+ if !b.functions.is_empty() || !b.globals.is_empty() {
+ self.write_functions_default(out, b);
+
+ if b.config.cpp_compatible_c() {
+ out.new_line();
+ out.write("#ifdef __cplusplus");
+ }
+
+ if b.config.language == Language::Cxx || b.config.cpp_compatible_c() {
+ out.new_line();
+ out.write("} // extern \"C\"");
+ out.new_line();
+ }
+
+ if b.config.cpp_compatible_c() {
+ out.write("#endif // __cplusplus");
+ out.new_line();
+ }
+ }
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/language_backend/cython.rs b/cbindgen-0.27.0/src/bindgen/language_backend/cython.rs
new file mode 100644
index 0000000..5c85b2d
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/language_backend/cython.rs
@@ -0,0 +1,439 @@
+use crate::bindgen::ir::{
+ to_known_assoc_constant, ConditionWrite, DeprecatedNoteKind, Documentation, Enum, EnumVariant,
+ Field, Item, Literal, OpaqueItem, ReprAlign, Static, Struct, ToCondition, Type, Typedef, Union,
+};
+use crate::bindgen::language_backend::LanguageBackend;
+use crate::bindgen::writer::{ListType, SourceWriter};
+use crate::bindgen::DocumentationLength;
+use crate::bindgen::{cdecl, Bindings, Config};
+use std::io::Write;
+
+pub struct CythonLanguageBackend<'a> {
+ config: &'a Config,
+}
+
+impl<'a> CythonLanguageBackend<'a> {
+ pub fn new(config: &'a Config) -> Self {
+ Self { config }
+ }
+
+ fn write_enum_variant<W: Write>(&mut self, out: &mut SourceWriter<W>, u: &EnumVariant) {
+ self.write_documentation(out, &u.documentation);
+ write!(out, "{}", u.export_name);
+ if let Some(discriminant) = &u.discriminant {
+ // For extern Cython declarations the enumerator value is ignored,
+ // but still useful as documentation, so we write it as a comment.
+ out.write(" # = ");
+ self.write_literal(out, discriminant);
+ }
+ out.write(",");
+ }
+
+ fn write_field<W: Write>(&mut self, out: &mut SourceWriter<W>, f: &Field) {
+ // Cython doesn't support conditional fields.
+ // let condition = f.cfg.to_condition(self.config);
+
+ self.write_documentation(out, &f.documentation);
+ cdecl::write_field(self, out, &f.ty, &f.name, self.config);
+
+ // Cython extern declarations don't manage layouts, layouts are defined entierly by the
+ // corresponding C code. So we can omit bitfield sizes which are not supported by Cython.
+ }
+}
+
+impl LanguageBackend for CythonLanguageBackend<'_> {
+ fn write_headers<W: Write>(&self, out: &mut SourceWriter<W>, package_version: &str) {
+ if self.config.package_version {
+ write!(out, "''' Package version: {} '''", package_version);
+ out.new_line();
+ }
+ if let Some(ref f) = self.config.header {
+ out.new_line_if_not_start();
+ write!(out, "{}", f);
+ out.new_line();
+ }
+
+ if self.config.include_version {
+ out.new_line_if_not_start();
+ write!(
+ out,
+ "/* Generated with cbindgen:{} */",
+ crate::bindgen::config::VERSION
+ );
+ out.new_line();
+ }
+ if let Some(ref f) = &self.config.autogen_warning {
+ out.new_line_if_not_start();
+ write!(out, "{}", f);
+ out.new_line();
+ }
+
+ if self.config.no_includes
+ && self.config.sys_includes().is_empty()
+ && self.config.includes().is_empty()
+ && (self.config.cython.cimports.is_empty())
+ && self.config.after_includes.is_none()
+ {
+ return;
+ }
+
+ out.new_line_if_not_start();
+
+ if !&self.config.no_includes {
+ out.write("from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t");
+ out.new_line();
+ out.write("from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t");
+ out.new_line();
+ out.write("cdef extern from *");
+ out.open_brace();
+ out.write("ctypedef bint bool");
+ out.new_line();
+ out.write("ctypedef struct va_list");
+ out.new_line();
+ out.close_brace(false);
+ }
+
+ for (module, names) in &self.config.cython.cimports {
+ write!(out, "from {} cimport {}", module, names.join(", "));
+ out.new_line();
+ }
+
+ if let Some(ref line) = &self.config.after_includes {
+ write!(out, "{}", line);
+ out.new_line();
+ }
+ }
+
+ fn open_namespaces<W: Write>(&mut self, out: &mut SourceWriter<W>) {
+ out.new_line();
+ let header = &self.config.cython.header.as_deref().unwrap_or("*");
+ write!(out, "cdef extern from {}", header);
+ out.open_brace();
+ }
+
+ fn close_namespaces<W: Write>(&mut self, out: &mut SourceWriter<W>) {
+ out.close_brace(false);
+ }
+
+ fn write_footers<W: Write>(&mut self, _out: &mut SourceWriter<W>) {}
+
+ fn write_enum<W: Write>(&mut self, out: &mut SourceWriter<W>, e: &Enum) {
+ let size = e.repr.ty.map(|ty| ty.to_primitive().to_repr_c(self.config));
+ let has_data = e.tag.is_some();
+ let inline_tag_field = Enum::inline_tag_field(&e.repr);
+ let tag_name = e.tag_name();
+
+ let condition = e.cfg.to_condition(self.config);
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &e.documentation);
+
+ // Emit the tag enum and everything related to it.
+ e.write_tag_enum(self.config, self, out, size, Self::write_enum_variant);
+
+ // If the enum has data, we need to emit structs for the variants and gather them together.
+ if has_data {
+ e.write_variant_defs(self.config, self, out);
+ out.new_line();
+ out.new_line();
+
+ e.open_struct_or_union(self.config, out, inline_tag_field);
+
+ // Emit tag field that is separate from all variants.
+ e.write_tag_field(self.config, out, size, inline_tag_field, tag_name);
+ out.new_line();
+
+ // Emit fields for all variants with data.
+ e.write_variant_fields(self.config, self, out, inline_tag_field, Self::write_field);
+
+ // Emit the post_body section, if relevant.
+ if let Some(body) = &self.config.export.post_body(&e.path) {
+ out.new_line();
+ out.write_raw_block(body);
+ }
+
+ out.close_brace(true);
+ }
+
+ condition.write_after(self.config, out);
+ }
+
+ fn write_struct<W: Write>(&mut self, out: &mut SourceWriter<W>, s: &Struct) {
+ if s.is_transparent {
+ let typedef = Typedef {
+ path: s.path.clone(),
+ export_name: s.export_name.to_owned(),
+ generic_params: s.generic_params.clone(),
+ aliased: s.fields[0].ty.clone(),
+ cfg: s.cfg.clone(),
+ annotations: s.annotations.clone(),
+ documentation: s.documentation.clone(),
+ };
+ self.write_type_def(out, &typedef);
+ for constant in &s.associated_constants {
+ out.new_line();
+ constant.write(self.config, self, out, Some(s));
+ }
+ return;
+ }
+
+ let condition = s.cfg.to_condition(self.config);
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &s.documentation);
+
+ out.write(self.config.style.cython_def());
+
+ // Cython extern declarations don't manage layouts, layouts are defined entierly by the
+ // corresponding C code. So this `packed` is only for documentation, and missing
+ // `aligned(n)` is also not a problem.
+ if let Some(align) = s.alignment {
+ match align {
+ ReprAlign::Packed => out.write("packed "),
+ ReprAlign::Align(_) => {} // Not supported
+ }
+ }
+
+ out.write("struct");
+
+ if s.annotations.must_use(self.config) {
+ if let Some(ref anno) = &self.config.structure.must_use {
+ write!(out, " {}", anno);
+ }
+ }
+
+ if let Some(note) = s
+ .annotations
+ .deprecated_note(self.config, DeprecatedNoteKind::Struct)
+ {
+ write!(out, " {}", note);
+ }
+
+ write!(out, " {}", s.export_name());
+
+ out.open_brace();
+
+ // Emit the pre_body section, if relevant
+ if let Some(body) = &self.config.export.pre_body(&s.path) {
+ out.write_raw_block(body);
+ out.new_line();
+ }
+
+ out.write_vertical_source_list(self, &s.fields, ListType::Cap(";"), Self::write_field);
+ if s.fields.is_empty() {
+ out.write("pass");
+ }
+
+ // Emit the post_body section, if relevant
+ if let Some(body) = &self.config.export.post_body(&s.path) {
+ out.new_line();
+ out.write_raw_block(body);
+ }
+ out.close_brace(true);
+
+ for constant in &s.associated_constants {
+ out.new_line();
+ constant.write(self.config, self, out, Some(s));
+ }
+
+ condition.write_after(self.config, out);
+ }
+
+ fn write_union<W: Write>(&mut self, out: &mut SourceWriter<W>, u: &Union) {
+ let condition = u.cfg.to_condition(self.config);
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &u.documentation);
+
+ out.write(self.config.style.cython_def());
+
+ out.write("union");
+
+ write!(out, " {}", u.export_name);
+
+ out.open_brace();
+
+ // Emit the pre_body section, if relevant
+ if let Some(body) = &self.config.export.pre_body(&u.path) {
+ out.write_raw_block(body);
+ out.new_line();
+ }
+
+ out.write_vertical_source_list(self, &u.fields, ListType::Cap(";"), Self::write_field);
+ if u.fields.is_empty() {
+ out.write("pass");
+ }
+
+ // Emit the post_body section, if relevant
+ if let Some(body) = &self.config.export.post_body(&u.path) {
+ out.new_line();
+ out.write_raw_block(body);
+ }
+
+ out.close_brace(true);
+
+ condition.write_after(self.config, out);
+ }
+
+ fn write_opaque_item<W: Write>(&mut self, out: &mut SourceWriter<W>, o: &OpaqueItem) {
+ let condition = o.cfg.to_condition(self.config);
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &o.documentation);
+
+ o.generic_params.write_with_default(self, self.config, out);
+
+ write!(
+ out,
+ "{}struct {}",
+ &self.config.style.cython_def(),
+ o.export_name()
+ );
+ out.open_brace();
+ out.write("pass");
+ out.close_brace(false);
+
+ condition.write_after(self.config, out);
+ }
+
+ fn write_type_def<W: Write>(&mut self, out: &mut SourceWriter<W>, t: &Typedef) {
+ let condition = t.cfg.to_condition(self.config);
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &t.documentation);
+
+ write!(out, "{} ", &self.config.language.typedef());
+
+ self.write_field(
+ out,
+ &Field::from_name_and_type(t.export_name().to_owned(), t.aliased.clone()),
+ );
+
+ out.write(";");
+
+ condition.write_after(self.config, out);
+ }
+
+ fn write_static<W: Write>(&mut self, out: &mut SourceWriter<W>, s: &Static) {
+ let condition = s.cfg.to_condition(self.config);
+ condition.write_before(self.config, out);
+
+ self.write_documentation(out, &s.documentation);
+ out.write("extern ");
+ if let Type::Ptr { is_const: true, .. } = s.ty {
+ } else if !s.mutable {
+ out.write("const ");
+ }
+ cdecl::write_field(self, out, &s.ty, &s.export_name, self.config);
+ out.write(";");
+
+ condition.write_after(self.config, out);
+ }
+
+ fn write_type<W: Write>(&mut self, out: &mut SourceWriter<W>, t: &Type) {
+ cdecl::write_type(self, out, t, self.config);
+ }
+
+ fn write_documentation<W: Write>(&mut self, out: &mut SourceWriter<W>, d: &Documentation) {
+ if d.doc_comment.is_empty() || !&self.config.documentation {
+ return;
+ }
+
+ let end = match &self.config.documentation_length {
+ DocumentationLength::Short => 1,
+ DocumentationLength::Full => d.doc_comment.len(),
+ };
+
+ // Cython uses Python-style comments, so `documentation_style` is not relevant.
+ for line in &d.doc_comment[..end] {
+ write!(out, "#{}", line);
+ out.new_line();
+ }
+ }
+
+ fn write_literal<W: Write>(&mut self, out: &mut SourceWriter<W>, l: &Literal) {
+ match l {
+ Literal::Expr(v) => match &**v {
+ "true" => write!(out, "True"),
+ "false" => write!(out, "False"),
+ v => write!(out, "{}", v),
+ },
+ Literal::Path {
+ ref associated_to,
+ ref name,
+ } => {
+ if let Some((ref path, ref export_name)) = associated_to {
+ if let Some(known) = to_known_assoc_constant(path, name) {
+ return write!(out, "{}", known);
+ }
+ write!(out, "{}_", export_name)
+ }
+ write!(out, "{}", name)
+ }
+ Literal::FieldAccess {
+ ref base,
+ ref field,
+ } => {
+ write!(out, "(");
+ self.write_literal(out, base);
+ write!(out, ").{}", field);
+ }
+ Literal::PostfixUnaryOp { op, ref value } => {
+ write!(out, "{}", op);
+ self.write_literal(out, value);
+ }
+ Literal::BinOp {
+ ref left,
+ op,
+ ref right,
+ } => {
+ write!(out, "(");
+ self.write_literal(out, left);
+ write!(out, " {} ", op);
+ self.write_literal(out, right);
+ write!(out, ")");
+ }
+ Literal::Cast { ref ty, ref value } => {
+ out.write("<");
+ self.write_type(out, ty);
+ out.write(">");
+ self.write_literal(out, value);
+ }
+ Literal::Struct {
+ export_name,
+ fields,
+ path,
+ } => {
+ write!(out, "<{}>", export_name);
+
+ write!(out, "{{ ");
+ let mut is_first_field = true;
+ // In C++, same order as defined is required.
+ let ordered_fields = out.bindings().struct_field_names(path);
+ for ordered_key in ordered_fields.iter() {
+ if let Some(lit) = fields.get(ordered_key) {
+ if !is_first_field {
+ write!(out, ", ");
+ } else {
+ is_first_field = false;
+ }
+ self.write_literal(out, lit);
+ }
+ }
+ write!(out, " }}");
+ }
+ }
+ }
+
+ fn write_functions<W: Write>(&mut self, out: &mut SourceWriter<W>, b: &Bindings) {
+ self.write_functions_default(out, b);
+
+ if b.globals.is_empty()
+ && b.constants.is_empty()
+ && b.items.is_empty()
+ && b.functions.is_empty()
+ {
+ out.write("pass");
+ }
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/language_backend/mod.rs b/cbindgen-0.27.0/src/bindgen/language_backend/mod.rs
new file mode 100644
index 0000000..adb7d85
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/language_backend/mod.rs
@@ -0,0 +1,210 @@
+use crate::bindgen::ir::{
+ cfg::ConditionWrite, DeprecatedNoteKind, Documentation, Enum, Function, ItemContainer, Literal,
+ OpaqueItem, Static, Struct, ToCondition, Type, Typedef, Union,
+};
+use crate::bindgen::writer::SourceWriter;
+use crate::bindgen::{cdecl, Bindings, Layout};
+use crate::Config;
+
+use std::io::Write;
+
+mod clike;
+mod cython;
+
+pub use clike::CLikeLanguageBackend;
+pub use cython::CythonLanguageBackend;
+
+pub trait LanguageBackend: Sized {
+ fn open_namespaces<W: Write>(&mut self, out: &mut SourceWriter<W>);
+ fn close_namespaces<W: Write>(&mut self, out: &mut SourceWriter<W>);
+ fn write_headers<W: Write>(&self, out: &mut SourceWriter<W>, package_version: &str);
+ fn write_footers<W: Write>(&mut self, out: &mut SourceWriter<W>);
+ fn write_enum<W: Write>(&mut self, out: &mut SourceWriter<W>, e: &Enum);
+ fn write_struct<W: Write>(&mut self, out: &mut SourceWriter<W>, s: &Struct);
+ fn write_union<W: Write>(&mut self, out: &mut SourceWriter<W>, u: &Union);
+ fn write_opaque_item<W: Write>(&mut self, out: &mut SourceWriter<W>, o: &OpaqueItem);
+ fn write_type_def<W: Write>(&mut self, out: &mut SourceWriter<W>, t: &Typedef);
+ fn write_static<W: Write>(&mut self, out: &mut SourceWriter<W>, s: &Static);
+
+ fn write_function<W: Write>(
+ &mut self,
+ config: &Config,
+ out: &mut SourceWriter<W>,
+ f: &Function,
+ ) {
+ match config.function.args {
+ Layout::Horizontal => {
+ self.write_function_with_layout(config, out, f, Layout::Horizontal)
+ }
+ Layout::Vertical => self.write_function_with_layout(config, out, f, Layout::Vertical),
+ Layout::Auto => {
+ let max_line_length = config.line_length;
+ if !out.try_write(
+ |out| self.write_function_with_layout(config, out, f, Layout::Horizontal),
+ max_line_length,
+ ) {
+ self.write_function_with_layout(config, out, f, Layout::Vertical);
+ }
+ }
+ }
+ }
+
+ fn write_function_with_layout<W: Write>(
+ &mut self,
+ config: &Config,
+ out: &mut SourceWriter<W>,
+ func: &Function,
+ layout: Layout,
+ ) {
+ let prefix = config.function.prefix(&func.annotations);
+ let postfix = config.function.postfix(&func.annotations);
+
+ let condition = func.cfg.to_condition(config);
+ condition.write_before(config, out);
+
+ self.write_documentation(out, &func.documentation);
+
+ fn write_space<W: Write>(layout: Layout, out: &mut SourceWriter<W>) {
+ if layout == Layout::Vertical {
+ out.new_line();
+ } else {
+ out.write(" ")
+ }
+ }
+ if func.extern_decl {
+ out.write("extern ");
+ } else {
+ if let Some(ref prefix) = prefix {
+ write!(out, "{}", prefix);
+ write_space(layout, out);
+ }
+ if func.annotations.must_use(config) {
+ if let Some(ref anno) = config.function.must_use {
+ write!(out, "{}", anno);
+ write_space(layout, out);
+ }
+ }
+ if let Some(note) = func
+ .annotations
+ .deprecated_note(config, DeprecatedNoteKind::Function)
+ {
+ write!(out, "{}", note);
+ write_space(layout, out);
+ }
+ }
+ cdecl::write_func(self, out, func, layout, config);
+
+ if !func.extern_decl {
+ if let Some(ref postfix) = postfix {
+ write_space(layout, out);
+ write!(out, "{}", postfix);
+ }
+ }
+
+ if let Some(ref swift_name_macro) = config.function.swift_name_macro {
+ if let Some(swift_name) = func.swift_name(config) {
+ // XXX Should this account for `layout`?
+ write!(out, " {}({})", swift_name_macro, swift_name);
+ }
+ }
+
+ out.write(";");
+ condition.write_after(config, out);
+ }
+
+ fn write_type<W: Write>(&mut self, out: &mut SourceWriter<W>, t: &Type);
+ fn write_documentation<W: Write>(&mut self, out: &mut SourceWriter<W>, d: &Documentation);
+ fn write_literal<W: Write>(&mut self, out: &mut SourceWriter<W>, l: &Literal);
+
+ fn write_bindings<W: Write>(&mut self, out: &mut SourceWriter<W>, b: &Bindings) {
+ self.write_headers(out, &b.package_version);
+ self.open_namespaces(out);
+ self.write_primitive_constants(out, b);
+ self.write_items(out, b);
+ self.write_non_primitive_constants(out, b);
+ self.write_globals(out, b);
+ self.write_functions(out, b);
+ self.close_namespaces(out);
+ self.write_footers(out);
+ self.write_trailer(out, b);
+ }
+
+ fn write_primitive_constants<W: Write>(&mut self, out: &mut SourceWriter<W>, b: &Bindings) {
+ for constant in &b.constants {
+ if constant.uses_only_primitive_types() {
+ out.new_line_if_not_start();
+ constant.write(&b.config, self, out, None);
+ out.new_line();
+ }
+ }
+ }
+
+ fn write_items<W: Write>(&mut self, out: &mut SourceWriter<W>, b: &Bindings) {
+ for item in &b.items {
+ if item
+ .deref()
+ .annotations()
+ .bool("no-export")
+ .unwrap_or(false)
+ {
+ continue;
+ }
+
+ out.new_line_if_not_start();
+ match *item {
+ ItemContainer::Constant(..) => unreachable!(),
+ ItemContainer::Static(..) => unreachable!(),
+ ItemContainer::Enum(ref x) => self.write_enum(out, x),
+ ItemContainer::Struct(ref x) => self.write_struct(out, x),
+ ItemContainer::Union(ref x) => self.write_union(out, x),
+ ItemContainer::OpaqueItem(ref x) => self.write_opaque_item(out, x),
+ ItemContainer::Typedef(ref x) => self.write_type_def(out, x),
+ }
+ out.new_line();
+ }
+ }
+
+ fn write_non_primitive_constants<W: Write>(&mut self, out: &mut SourceWriter<W>, b: &Bindings) {
+ for constant in &b.constants {
+ if !constant.uses_only_primitive_types() {
+ out.new_line_if_not_start();
+ constant.write(&b.config, self, out, None);
+ out.new_line();
+ }
+ }
+ }
+
+ fn write_globals<W: Write>(&mut self, out: &mut SourceWriter<W>, b: &Bindings) {
+ self.write_globals_default(out, b)
+ }
+
+ fn write_globals_default<W: Write>(&mut self, out: &mut SourceWriter<W>, b: &Bindings) {
+ for global in &b.globals {
+ out.new_line_if_not_start();
+ self.write_static(out, global);
+ out.new_line();
+ }
+ }
+
+ fn write_functions<W: Write>(&mut self, out: &mut SourceWriter<W>, b: &Bindings) {
+ self.write_functions_default(out, b)
+ }
+
+ fn write_functions_default<W: Write>(&mut self, out: &mut SourceWriter<W>, b: &Bindings) {
+ for function in &b.functions {
+ out.new_line_if_not_start();
+ self.write_function(&b.config, out, function);
+ out.new_line();
+ }
+ }
+
+ fn write_trailer<W: Write>(&mut self, out: &mut SourceWriter<W>, b: &Bindings) {
+ if let Some(ref f) = b.config.trailer {
+ out.new_line_if_not_start();
+ write!(out, "{}", f);
+ if !f.ends_with('\n') {
+ out.new_line();
+ }
+ }
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/library.rs b/cbindgen-0.27.0/src/bindgen/library.rs
new file mode 100644
index 0000000..9d61257
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/library.rs
@@ -0,0 +1,450 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::collections::HashMap;
+use std::path::PathBuf;
+
+use crate::bindgen::bindings::Bindings;
+use crate::bindgen::config::{Config, Language, SortKey};
+use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
+use crate::bindgen::dependencies::Dependencies;
+use crate::bindgen::error::Error;
+use crate::bindgen::ir::{Constant, Enum, Function, Item, ItemContainer, ItemMap};
+use crate::bindgen::ir::{OpaqueItem, Path, Static, Struct, Typedef, Union};
+use crate::bindgen::monomorph::Monomorphs;
+use crate::bindgen::ItemType;
+
+#[derive(Debug, Clone)]
+pub struct Library {
+ config: Config,
+ constants: ItemMap<Constant>,
+ globals: ItemMap<Static>,
+ enums: ItemMap<Enum>,
+ structs: ItemMap<Struct>,
+ unions: ItemMap<Union>,
+ opaque_items: ItemMap<OpaqueItem>,
+ typedefs: ItemMap<Typedef>,
+ functions: Vec<Function>,
+ source_files: Vec<PathBuf>,
+ package_version: String,
+}
+
+impl Library {
+ #[allow(clippy::too_many_arguments)]
+ pub fn new(
+ config: Config,
+ constants: ItemMap<Constant>,
+ globals: ItemMap<Static>,
+ enums: ItemMap<Enum>,
+ structs: ItemMap<Struct>,
+ unions: ItemMap<Union>,
+ opaque_items: ItemMap<OpaqueItem>,
+ typedefs: ItemMap<Typedef>,
+ functions: Vec<Function>,
+ source_files: Vec<PathBuf>,
+ package_version: String,
+ ) -> Library {
+ Library {
+ config,
+ constants,
+ globals,
+ enums,
+ structs,
+ unions,
+ opaque_items,
+ typedefs,
+ functions,
+ source_files,
+ package_version,
+ }
+ }
+
+ pub fn generate(mut self) -> Result<Bindings, Error> {
+ self.transfer_annotations();
+ self.simplify_standard_types();
+
+ match self.config.function.sort_by.unwrap_or(self.config.sort_by) {
+ SortKey::Name => self.functions.sort_by(|x, y| x.path.cmp(&y.path)),
+ SortKey::None => { /* keep input order */ }
+ }
+
+ if self.config.language != Language::Cxx {
+ self.instantiate_monomorphs();
+ }
+ self.remove_excluded();
+ if self.config.language == Language::C {
+ self.resolve_declaration_types();
+ }
+
+ self.rename_items();
+
+ let mut dependencies = Dependencies::new();
+
+ for function in &self.functions {
+ function.add_dependencies(&self, &mut dependencies);
+ }
+ self.globals.for_all_items(|global| {
+ global.add_dependencies(&self, &mut dependencies);
+ });
+ self.constants.for_all_items(|constant| {
+ constant.add_dependencies(&self, &mut dependencies);
+ });
+ for name in &self.config.export.include {
+ let path = Path::new(name.clone());
+ if let Some(items) = self.get_items(&path) {
+ if dependencies.items.insert(path) {
+ for item in &items {
+ item.deref().add_dependencies(&self, &mut dependencies);
+ }
+ for item in items {
+ dependencies.order.push(item);
+ }
+ }
+ }
+ }
+
+ dependencies.sort();
+
+ let items = dependencies.order;
+ let constants = if self.config.export.should_generate(ItemType::Constants) {
+ let mut constants = self.constants.to_vec();
+ match self.config.constant.sort_by.unwrap_or(self.config.sort_by) {
+ SortKey::Name => constants.sort_by(|x, y| x.path.cmp(&y.path)),
+ SortKey::None => { /* keep input order */ }
+ }
+ constants
+ } else {
+ vec![]
+ };
+
+ let globals = if self.config.export.should_generate(ItemType::Globals) {
+ let mut globals = self.globals.to_vec();
+ match self.config.constant.sort_by.unwrap_or(self.config.sort_by) {
+ SortKey::Name => globals.sort_by(|x, y| x.path.cmp(&y.path)),
+ SortKey::None => { /* keep input order */ }
+ }
+ globals
+ } else {
+ vec![]
+ };
+ let functions = if self.config.export.should_generate(ItemType::Functions) {
+ self.functions
+ } else {
+ vec![]
+ };
+
+ Ok(Bindings::new(
+ self.config,
+ self.structs,
+ self.typedefs,
+ constants,
+ globals,
+ items,
+ functions,
+ self.source_files,
+ false,
+ self.package_version,
+ ))
+ }
+
+ pub fn get_items(&self, p: &Path) -> Option<Vec<ItemContainer>> {
+ macro_rules! find {
+ ($field:ident, $kind:ident) => {
+ if self.config.export.should_generate(ItemType::$kind) {
+ if let Some(x) = self.$field.get_items(p) {
+ return Some(x);
+ }
+ }
+ };
+ }
+
+ find!(enums, Enums);
+ find!(structs, Structs);
+ find!(unions, Unions);
+ find!(opaque_items, OpaqueItems);
+ find!(typedefs, Typedefs);
+
+ None
+ }
+
+ pub fn get_config(&self) -> &Config {
+ &self.config
+ }
+
+ fn remove_excluded(&mut self) {
+ let config = &self.config;
+ // FIXME: interpret `config.export.exclude` as `Path`s.
+ self.functions
+ .retain(|x| !config.export.exclude.iter().any(|y| y == x.path().name()));
+ self.enums
+ .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
+ self.structs
+ .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
+ self.unions
+ .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
+ self.opaque_items
+ .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
+ self.typedefs
+ .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
+ self.globals
+ .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
+ self.constants
+ .filter(|x| config.export.exclude.iter().any(|y| y == x.path().name()));
+ }
+
+ fn transfer_annotations(&mut self) {
+ let mut annotations = HashMap::new();
+
+ self.typedefs.for_all_items_mut(|x| {
+ x.transfer_annotations(&mut annotations);
+ });
+
+ for (alias_path, annotations) in annotations {
+ // TODO
+ let mut transferred = false;
+
+ self.enums.for_items_mut(&alias_path, |x| {
+ if x.annotations().is_empty() {
+ *x.annotations_mut() = annotations.clone();
+ transferred = true;
+ } else {
+ warn!(
+ "Can't transfer annotations from typedef to alias ({}) \
+ that already has annotations.",
+ alias_path
+ );
+ }
+ });
+ if transferred {
+ continue;
+ }
+ self.structs.for_items_mut(&alias_path, |x| {
+ if x.annotations().is_empty() {
+ *x.annotations_mut() = annotations.clone();
+ transferred = true;
+ } else {
+ warn!(
+ "Can't transfer annotations from typedef to alias ({}) \
+ that already has annotations.",
+ alias_path
+ );
+ }
+ });
+ if transferred {
+ continue;
+ }
+ self.unions.for_items_mut(&alias_path, |x| {
+ if x.annotations().is_empty() {
+ *x.annotations_mut() = annotations.clone();
+ transferred = true;
+ } else {
+ warn!(
+ "Can't transfer annotations from typedef to alias ({}) \
+ that already has annotations.",
+ alias_path
+ );
+ }
+ });
+ if transferred {
+ continue;
+ }
+ self.opaque_items.for_items_mut(&alias_path, |x| {
+ if x.annotations().is_empty() {
+ *x.annotations_mut() = annotations.clone();
+ transferred = true;
+ } else {
+ warn!(
+ "Can't transfer annotations from typedef to alias ({}) \
+ that already has annotations.",
+ alias_path
+ );
+ }
+ });
+ if transferred {
+ continue;
+ }
+ self.typedefs.for_items_mut(&alias_path, |x| {
+ if x.annotations().is_empty() {
+ *x.annotations_mut() = annotations.clone();
+ transferred = true;
+ } else {
+ warn!(
+ "Can't transfer annotations from typedef to alias ({}) \
+ that already has annotations.",
+ alias_path
+ );
+ }
+ });
+ if transferred {
+ continue;
+ }
+ }
+ }
+
+ fn rename_items(&mut self) {
+ let config = &self.config;
+
+ self.globals
+ .for_all_items_mut(|x| x.rename_for_config(config));
+ self.globals.rebuild();
+
+ self.constants
+ .for_all_items_mut(|x| x.rename_for_config(config));
+ self.constants.rebuild();
+
+ self.structs
+ .for_all_items_mut(|x| x.rename_for_config(config));
+ self.structs.rebuild();
+
+ self.unions
+ .for_all_items_mut(|x| x.rename_for_config(config));
+ self.unions.rebuild();
+
+ self.enums
+ .for_all_items_mut(|x| x.rename_for_config(config));
+ self.enums.rebuild();
+
+ self.opaque_items
+ .for_all_items_mut(|x| x.rename_for_config(config));
+ self.opaque_items.rebuild();
+
+ self.typedefs
+ .for_all_items_mut(|x| x.rename_for_config(config));
+ self.typedefs.rebuild();
+
+ for item in &mut self.functions {
+ item.rename_for_config(&self.config);
+ }
+ }
+
+ fn resolve_declaration_types(&mut self) {
+ if !self.config.style.generate_tag() {
+ return;
+ }
+
+ let mut resolver = DeclarationTypeResolver::default();
+
+ self.structs.for_all_items(|x| {
+ x.collect_declaration_types(&mut resolver);
+ });
+
+ self.enums.for_all_items(|x| {
+ x.collect_declaration_types(&mut resolver);
+ });
+
+ self.unions.for_all_items(|x| {
+ x.collect_declaration_types(&mut resolver);
+ });
+
+ self.typedefs.for_all_items(|x| {
+ x.collect_declaration_types(&mut resolver);
+ });
+
+ // NOTE: Intentionally last, so that in case there's an opaque type
+ // which is conflicting with a non-opaque one, the later wins.
+ self.opaque_items.for_all_items(|x| {
+ x.collect_declaration_types(&mut resolver);
+ });
+
+ self.enums
+ .for_all_items_mut(|x| x.resolve_declaration_types(&resolver));
+
+ self.structs
+ .for_all_items_mut(|x| x.resolve_declaration_types(&resolver));
+
+ self.unions
+ .for_all_items_mut(|x| x.resolve_declaration_types(&resolver));
+
+ self.typedefs
+ .for_all_items_mut(|x| x.resolve_declaration_types(&resolver));
+
+ self.globals
+ .for_all_items_mut(|x| x.resolve_declaration_types(&resolver));
+
+ for item in &mut self.functions {
+ item.resolve_declaration_types(&resolver);
+ }
+ }
+
+ fn simplify_standard_types(&mut self) {
+ let config = &self.config;
+
+ self.structs.for_all_items_mut(|x| {
+ x.simplify_standard_types(config);
+ });
+ self.enums.for_all_items_mut(|x| {
+ x.simplify_standard_types(config);
+ });
+ self.unions.for_all_items_mut(|x| {
+ x.simplify_standard_types(config);
+ });
+ self.globals.for_all_items_mut(|x| {
+ x.simplify_standard_types(config);
+ });
+ self.typedefs.for_all_items_mut(|x| {
+ x.simplify_standard_types(config);
+ });
+ for x in &mut self.functions {
+ x.simplify_standard_types(config);
+ }
+ }
+
+ fn instantiate_monomorphs(&mut self) {
+ // Collect a list of monomorphs
+ let mut monomorphs = Monomorphs::default();
+
+ self.structs.for_all_items(|x| {
+ x.add_monomorphs(self, &mut monomorphs);
+ });
+ self.unions.for_all_items(|x| {
+ x.add_monomorphs(self, &mut monomorphs);
+ });
+ self.enums.for_all_items(|x| {
+ x.add_monomorphs(self, &mut monomorphs);
+ });
+ self.typedefs.for_all_items(|x| {
+ x.add_monomorphs(self, &mut monomorphs);
+ });
+ for x in &self.functions {
+ x.add_monomorphs(self, &mut monomorphs);
+ }
+
+ // Insert the monomorphs into self
+ for monomorph in monomorphs.drain_structs() {
+ self.structs.try_insert(monomorph);
+ }
+ for monomorph in monomorphs.drain_unions() {
+ self.unions.try_insert(monomorph);
+ }
+ for monomorph in monomorphs.drain_opaques() {
+ self.opaque_items.try_insert(monomorph);
+ }
+ for monomorph in monomorphs.drain_typedefs() {
+ self.typedefs.try_insert(monomorph);
+ }
+ for monomorph in monomorphs.drain_enums() {
+ self.enums.try_insert(monomorph);
+ }
+
+ // Remove structs and opaque items that are generic
+ self.opaque_items.filter(|x| x.is_generic());
+ self.structs.filter(|x| x.is_generic());
+ self.unions.filter(|x| x.is_generic());
+ self.enums.filter(|x| x.is_generic());
+ self.typedefs.filter(|x| x.is_generic());
+
+ // Mangle the paths that remain
+ self.unions
+ .for_all_items_mut(|x| x.mangle_paths(&monomorphs));
+ self.structs
+ .for_all_items_mut(|x| x.mangle_paths(&monomorphs));
+ self.enums
+ .for_all_items_mut(|x| x.mangle_paths(&monomorphs));
+ self.typedefs
+ .for_all_items_mut(|x| x.mangle_paths(&monomorphs));
+ for x in &mut self.functions {
+ x.mangle_paths(&monomorphs);
+ }
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/mangle.rs b/cbindgen-0.27.0/src/bindgen/mangle.rs
new file mode 100644
index 0000000..52c3be9
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/mangle.rs
@@ -0,0 +1,348 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use crate::bindgen::config::MangleConfig;
+use crate::bindgen::ir::{ConstExpr, GenericArgument, GenericPath, Path, Type};
+use crate::bindgen::rename::IdentifierType;
+
+pub fn mangle_path(path: &Path, generic_values: &[GenericArgument], config: &MangleConfig) -> Path {
+ Path::new(mangle_name(path.name(), generic_values, config))
+}
+
+pub fn mangle_name(
+ name: &str,
+ generic_values: &[GenericArgument],
+ config: &MangleConfig,
+) -> String {
+ Mangler::new(name, generic_values, /* last = */ true, config).mangle()
+}
+
+enum Separator {
+ OpeningAngleBracket = 1,
+ Comma,
+ ClosingAngleBracket,
+ BeginMutPtr,
+ BeginConstPtr,
+ BeginFn,
+ BetweenFnArg,
+ EndFn,
+}
+
+struct Mangler<'a> {
+ input: &'a str,
+ generic_values: &'a [GenericArgument],
+ output: String,
+ last: bool,
+ config: &'a MangleConfig,
+}
+
+impl<'a> Mangler<'a> {
+ fn new(
+ input: &'a str,
+ generic_values: &'a [GenericArgument],
+ last: bool,
+ config: &'a MangleConfig,
+ ) -> Self {
+ Self {
+ input,
+ generic_values,
+ output: String::new(),
+ last,
+ config,
+ }
+ }
+
+ fn mangle(mut self) -> String {
+ self.mangle_internal();
+ self.output
+ }
+
+ fn push(&mut self, id: Separator) {
+ let count = id as usize;
+ let separator = if self.config.remove_underscores {
+ ""
+ } else {
+ "_"
+ };
+ self.output.extend(std::iter::repeat(separator).take(count));
+ }
+
+ fn append_mangled_argument(&mut self, arg: &GenericArgument, last: bool) {
+ match *arg {
+ GenericArgument::Type(ref ty) => self.append_mangled_type(ty, last),
+ GenericArgument::Const(ConstExpr::Name(ref name)) => {
+ // This must behave the same as a GenericArgument::Type,
+ // because const arguments are commonly represented as Types;
+ // see the comment on `enum GenericArgument`.
+ let fake_ty = Type::Path(GenericPath::new(Path::new(name), vec![]));
+ self.append_mangled_type(&fake_ty, last);
+ }
+ GenericArgument::Const(ConstExpr::Value(ref val)) => self.output.push_str(val),
+ }
+ }
+
+ fn append_mangled_type(&mut self, ty: &Type, last: bool) {
+ match *ty {
+ Type::Path(ref generic) => {
+ let sub_path =
+ Mangler::new(generic.export_name(), generic.generics(), last, self.config)
+ .mangle();
+
+ self.output.push_str(
+ &self
+ .config
+ .rename_types
+ .apply(&sub_path, IdentifierType::Type),
+ );
+ }
+ Type::Primitive(ref primitive) => {
+ self.output.push_str(
+ &self
+ .config
+ .rename_types
+ .apply(primitive.to_repr_rust(), IdentifierType::Type),
+ );
+ }
+ Type::Ptr {
+ ref ty, is_const, ..
+ } => {
+ self.push(if is_const {
+ Separator::BeginConstPtr
+ } else {
+ Separator::BeginMutPtr
+ });
+ self.append_mangled_type(ty, last);
+ }
+ Type::FuncPtr {
+ ref ret, ref args, ..
+ } => {
+ self.push(Separator::BeginFn);
+ self.append_mangled_type(ret, args.is_empty());
+ for (i, arg) in args.iter().enumerate() {
+ self.push(Separator::BetweenFnArg);
+ let last = last && i == args.len() - 1;
+ self.append_mangled_type(&arg.1, last);
+ }
+ if !self.last {
+ self.push(Separator::EndFn);
+ }
+ }
+ Type::Array(..) => {
+ unimplemented!(
+ "Unable to mangle generic parameter {:?} for '{}'",
+ ty,
+ self.input
+ );
+ }
+ }
+ }
+
+ fn mangle_internal(&mut self) {
+ debug_assert!(self.output.is_empty());
+ self.input.clone_into(&mut self.output);
+ if self.generic_values.is_empty() {
+ return;
+ }
+
+ self.push(Separator::OpeningAngleBracket);
+ for (i, arg) in self.generic_values.iter().enumerate() {
+ if i != 0 {
+ self.push(Separator::Comma);
+ }
+ let last = self.last && i == self.generic_values.len() - 1;
+ self.append_mangled_argument(arg, last);
+ }
+
+ // Skip writing the trailing '>' mangling when possible
+ if !self.last {
+ self.push(Separator::ClosingAngleBracket)
+ }
+ }
+}
+
+#[test]
+fn generics() {
+ use crate::bindgen::ir::{GenericPath, PrimitiveType};
+ use crate::bindgen::rename::RenameRule::{self, PascalCase};
+
+ fn float() -> GenericArgument {
+ GenericArgument::Type(Type::Primitive(PrimitiveType::Float))
+ }
+
+ fn c_char() -> GenericArgument {
+ GenericArgument::Type(Type::Primitive(PrimitiveType::Char))
+ }
+
+ fn path(path: &str) -> GenericArgument {
+ generic_path(path, &[])
+ }
+
+ fn generic_path(path: &str, arguments: &[GenericArgument]) -> GenericArgument {
+ let path = Path::new(path);
+ let generic_path = GenericPath::new(path, arguments.to_owned());
+ GenericArgument::Type(Type::Path(generic_path))
+ }
+
+ // Foo<f32> => Foo_f32
+ assert_eq!(
+ mangle_path(&Path::new("Foo"), &[float()], &MangleConfig::default()),
+ Path::new("Foo_f32")
+ );
+
+ // Foo<Bar<f32>> => Foo_Bar_f32
+ assert_eq!(
+ mangle_path(
+ &Path::new("Foo"),
+ &[generic_path("Bar", &[float()])],
+ &MangleConfig::default(),
+ ),
+ Path::new("Foo_Bar_f32")
+ );
+
+ // Foo<Bar> => Foo_Bar
+ assert_eq!(
+ mangle_path(&Path::new("Foo"), &[path("Bar")], &MangleConfig::default()),
+ Path::new("Foo_Bar")
+ );
+
+ // Foo<Bar> => FooBar
+ assert_eq!(
+ mangle_path(
+ &Path::new("Foo"),
+ &[path("Bar")],
+ &MangleConfig {
+ remove_underscores: true,
+ rename_types: RenameRule::None,
+ }
+ ),
+ Path::new("FooBar")
+ );
+
+ // Foo<Bar<f32>> => FooBarF32
+ assert_eq!(
+ mangle_path(
+ &Path::new("Foo"),
+ &[generic_path("Bar", &[float()])],
+ &MangleConfig {
+ remove_underscores: true,
+ rename_types: PascalCase,
+ },
+ ),
+ Path::new("FooBarF32")
+ );
+
+ // Foo<Bar<c_char>> => FooBarCChar
+ assert_eq!(
+ mangle_path(
+ &Path::new("Foo"),
+ &[generic_path("Bar", &[c_char()])],
+ &MangleConfig {
+ remove_underscores: true,
+ rename_types: PascalCase,
+ },
+ ),
+ Path::new("FooBarCChar")
+ );
+
+ // Foo<Bar<T>> => Foo_Bar_T
+ assert_eq!(
+ mangle_path(
+ &Path::new("Foo"),
+ &[generic_path("Bar", &[path("T")])],
+ &MangleConfig::default(),
+ ),
+ Path::new("Foo_Bar_T")
+ );
+
+ // Foo<Bar<T>, E> => Foo_Bar_T_____E
+ assert_eq!(
+ mangle_path(
+ &Path::new("Foo"),
+ &[generic_path("Bar", &[path("T")]), path("E")],
+ &MangleConfig::default(),
+ ),
+ Path::new("Foo_Bar_T_____E")
+ );
+
+ // Foo<Bar<T>, Bar<E>> => Foo_Bar_T_____Bar_E
+ assert_eq!(
+ mangle_path(
+ &Path::new("Foo"),
+ &[
+ generic_path("Bar", &[path("T")]),
+ generic_path("Bar", &[path("E")]),
+ ],
+ &MangleConfig::default(),
+ ),
+ Path::new("Foo_Bar_T_____Bar_E")
+ );
+
+ // Foo<Bar<T>, E> => FooBarTE
+ assert_eq!(
+ mangle_path(
+ &Path::new("Foo"),
+ &[generic_path("Bar", &[path("T")]), path("E")],
+ &MangleConfig {
+ remove_underscores: true,
+ rename_types: PascalCase,
+ },
+ ),
+ Path::new("FooBarTE")
+ );
+
+ // Foo<Bar<T>, Bar<E>> => FooBarTBarE
+ assert_eq!(
+ mangle_path(
+ &Path::new("Foo"),
+ &[
+ generic_path("Bar", &[path("T")]),
+ generic_path("Bar", &[path("E")]),
+ ],
+ &MangleConfig {
+ remove_underscores: true,
+ rename_types: PascalCase,
+ },
+ ),
+ Path::new("FooBarTBarE")
+ );
+
+ assert_eq!(
+ mangle_path(
+ &Path::new("Top"),
+ &[GenericArgument::Const(ConstExpr::Value("40".to_string()))],
+ &MangleConfig::default(),
+ ),
+ Path::new("Top_40")
+ );
+
+ assert_eq!(
+ mangle_path(
+ &Path::new("Top"),
+ &[GenericArgument::Const(ConstExpr::Name("N".to_string()))],
+ &MangleConfig::default(),
+ ),
+ Path::new("Top_N")
+ );
+
+ assert_eq!(
+ mangle_path(
+ &Path::new("Top"),
+ &[generic_path("N", &[])],
+ &MangleConfig::default(),
+ ),
+ Path::new("Top_N")
+ );
+
+ assert_eq!(
+ mangle_path(
+ &Path::new("Foo"),
+ &[
+ float(),
+ GenericArgument::Const(ConstExpr::Value("40".to_string()))
+ ],
+ &MangleConfig::default(),
+ ),
+ Path::new("Foo_f32__40")
+ );
+}
diff --git a/cbindgen-0.27.0/src/bindgen/mod.rs b/cbindgen-0.27.0/src/bindgen/mod.rs
new file mode 100644
index 0000000..5d78821
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/mod.rs
@@ -0,0 +1,66 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/// A helper macro for deriving deserialize for an enum to be used in toml-rs.
+/// This macro works be relying on an existing FromStr implementation for the
+/// desired type.
+macro_rules! deserialize_enum_str {
+ ($name:ident) => {
+ impl<'de> ::serde::Deserialize<'de> for $name {
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where
+ D: ::serde::Deserializer<'de>,
+ {
+ struct Visitor;
+ impl<'de> ::serde::de::Visitor<'de> for Visitor {
+ type Value = $name;
+
+ fn expecting(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ f.write_str("$name")
+ }
+
+ fn visit_str<E>(self, v: &str) -> Result<$name, E>
+ where
+ E: ::serde::de::Error,
+ {
+ match v.parse::<$name>() {
+ Ok(v) => Ok(v),
+ Err(m) => Err(E::custom(m)),
+ }
+ }
+ }
+ deserializer.deserialize_str(Visitor)
+ }
+ }
+ };
+}
+
+mod bindings;
+mod bitflags;
+mod builder;
+mod cargo;
+mod cdecl;
+mod config;
+mod declarationtyperesolver;
+mod dependencies;
+mod error;
+mod ir;
+mod language_backend;
+mod library;
+mod mangle;
+mod monomorph;
+mod parser;
+mod rename;
+mod reserved;
+mod utilities;
+mod writer;
+
+#[allow(unused)]
+pub(crate) use self::cargo::*;
+
+pub use self::bindings::Bindings;
+pub use self::builder::Builder;
+pub use self::config::Profile; // disambiguate with cargo::Profile
+pub use self::config::*;
+pub use self::error::Error;
diff --git a/cbindgen-0.27.0/src/bindgen/monomorph.rs b/cbindgen-0.27.0/src/bindgen/monomorph.rs
new file mode 100644
index 0000000..2dab9cf
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/monomorph.rs
@@ -0,0 +1,147 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::collections::HashMap;
+use std::mem;
+
+use crate::bindgen::ir::{
+ Enum, GenericArgument, GenericPath, Item, OpaqueItem, Path, Struct, Typedef, Union,
+};
+use crate::bindgen::library::Library;
+
+#[derive(Default, Clone, Debug)]
+pub struct Monomorphs {
+ replacements: HashMap<GenericPath, Path>,
+ opaques: Vec<OpaqueItem>,
+ structs: Vec<Struct>,
+ unions: Vec<Union>,
+ typedefs: Vec<Typedef>,
+ enums: Vec<Enum>,
+}
+
+impl Monomorphs {
+ pub fn contains(&self, path: &GenericPath) -> bool {
+ self.replacements.contains_key(path)
+ }
+
+ pub fn insert_struct(
+ &mut self,
+ library: &Library,
+ generic: &Struct,
+ monomorph: Struct,
+ arguments: Vec<GenericArgument>,
+ ) {
+ let replacement_path = GenericPath::new(generic.path.clone(), arguments);
+
+ debug_assert!(generic.is_generic());
+ debug_assert!(!self.contains(&replacement_path));
+
+ self.replacements
+ .insert(replacement_path, monomorph.path.clone());
+
+ monomorph.add_monomorphs(library, self);
+
+ self.structs.push(monomorph);
+ }
+
+ pub fn insert_enum(
+ &mut self,
+ library: &Library,
+ generic: &Enum,
+ monomorph: Enum,
+ arguments: Vec<GenericArgument>,
+ ) {
+ let replacement_path = GenericPath::new(generic.path.clone(), arguments);
+
+ debug_assert!(generic.is_generic());
+ debug_assert!(!self.contains(&replacement_path));
+
+ self.replacements
+ .insert(replacement_path, monomorph.path.clone());
+
+ monomorph.add_monomorphs(library, self);
+
+ self.enums.push(monomorph);
+ }
+
+ pub fn insert_union(
+ &mut self,
+ library: &Library,
+ generic: &Union,
+ monomorph: Union,
+ arguments: Vec<GenericArgument>,
+ ) {
+ let replacement_path = GenericPath::new(generic.path.clone(), arguments);
+
+ debug_assert!(generic.is_generic());
+ debug_assert!(!self.contains(&replacement_path));
+
+ self.replacements
+ .insert(replacement_path, monomorph.path.clone());
+
+ monomorph.add_monomorphs(library, self);
+
+ self.unions.push(monomorph);
+ }
+
+ pub fn insert_opaque(
+ &mut self,
+ generic: &OpaqueItem,
+ monomorph: OpaqueItem,
+ arguments: Vec<GenericArgument>,
+ ) {
+ let replacement_path = GenericPath::new(generic.path.clone(), arguments);
+
+ debug_assert!(generic.is_generic());
+ debug_assert!(!self.contains(&replacement_path));
+
+ self.replacements
+ .insert(replacement_path, monomorph.path.clone());
+ self.opaques.push(monomorph);
+ }
+
+ pub fn insert_typedef(
+ &mut self,
+ library: &Library,
+ generic: &Typedef,
+ monomorph: Typedef,
+ arguments: Vec<GenericArgument>,
+ ) {
+ let replacement_path = GenericPath::new(generic.path.clone(), arguments);
+
+ debug_assert!(generic.is_generic());
+ debug_assert!(!self.contains(&replacement_path));
+
+ self.replacements
+ .insert(replacement_path, monomorph.path.clone());
+
+ monomorph.add_monomorphs(library, self);
+
+ self.typedefs.push(monomorph);
+ }
+
+ pub fn mangle_path(&self, path: &GenericPath) -> Option<&Path> {
+ self.replacements.get(path)
+ }
+
+ pub fn drain_opaques(&mut self) -> Vec<OpaqueItem> {
+ mem::take(&mut self.opaques)
+ }
+
+ pub fn drain_structs(&mut self) -> Vec<Struct> {
+ mem::take(&mut self.structs)
+ }
+
+ pub fn drain_unions(&mut self) -> Vec<Union> {
+ mem::take(&mut self.unions)
+ }
+
+ pub fn drain_typedefs(&mut self) -> Vec<Typedef> {
+ mem::take(&mut self.typedefs)
+ }
+
+ pub fn drain_enums(&mut self) -> Vec<Enum> {
+ mem::take(&mut self.enums)
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/parser.rs b/cbindgen-0.27.0/src/bindgen/parser.rs
new file mode 100644
index 0000000..eb2ef2d
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/parser.rs
@@ -0,0 +1,1038 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::collections::hash_map::Entry;
+use std::collections::{HashMap, HashSet};
+use std::fs::File;
+use std::io::Read;
+use std::path::{Path as FilePath, PathBuf as FilePathBuf};
+
+use syn::ext::IdentExt;
+
+use crate::bindgen::bitflags;
+use crate::bindgen::cargo::{Cargo, PackageRef};
+use crate::bindgen::config::{Config, ParseConfig};
+use crate::bindgen::error::Error;
+use crate::bindgen::ir::{
+ AnnotationSet, AnnotationValue, Cfg, Constant, Documentation, Enum, Function, GenericParam,
+ GenericParams, ItemMap, OpaqueItem, Path, Static, Struct, Type, Typedef, Union,
+};
+use crate::bindgen::utilities::{SynAbiHelpers, SynAttributeHelpers, SynItemHelpers};
+
+const STD_CRATES: &[&str] = &[
+ "std",
+ "std_unicode",
+ "alloc",
+ "collections",
+ "core",
+ "proc_macro",
+];
+
+type ParseResult = Result<Parse, Error>;
+
+/// Parses a single rust source file, not following `mod` or `extern crate`.
+pub fn parse_src(src_file: &FilePath, config: &Config) -> ParseResult {
+ let mod_name = src_file.file_stem().unwrap().to_str().unwrap();
+ let mut config = config.clone();
+ config.parse = ParseConfig {
+ parse_deps: true,
+ ..ParseConfig::default()
+ };
+
+ let mut context = Parser {
+ binding_crate_name: mod_name.to_owned(),
+ config: &config,
+ lib: None,
+ parsed_crates: HashSet::new(),
+ cache_src: HashMap::new(),
+ cache_expanded_crate: HashMap::new(),
+ cfg_stack: Vec::new(),
+ out: Parse::new(),
+ };
+
+ let pkg_ref = PackageRef {
+ name: mod_name.to_owned(),
+ version: None,
+ };
+
+ context.parse_mod(&pkg_ref, src_file, 0)?;
+ context.out.source_files = context.cache_src.keys().map(|k| k.to_owned()).collect();
+ Ok(context.out)
+}
+
+/// Recursively parses a rust library starting at the root crate's directory.
+///
+/// Inside a crate, `mod` and `extern crate` declarations are followed
+/// and parsed. To find an external crate, the parser uses the `cargo metadata`
+/// command to find the location of dependencies.
+pub(crate) fn parse_lib(lib: Cargo, config: &Config) -> ParseResult {
+ let mut context = Parser {
+ binding_crate_name: lib.binding_crate_name().to_owned(),
+ config,
+ lib: Some(lib),
+ parsed_crates: HashSet::new(),
+ cache_src: HashMap::new(),
+ cache_expanded_crate: HashMap::new(),
+ cfg_stack: Vec::new(),
+ out: Parse::new(),
+ };
+
+ let binding_crate = context.lib.as_ref().unwrap().binding_crate_ref();
+ context.parse_crate(&binding_crate)?;
+ context.out.source_files = context.cache_src.keys().map(|k| k.to_owned()).collect();
+ context.out.package_version = context
+ .lib
+ .as_ref()
+ .unwrap()
+ .binding_crate_ref()
+ .version
+ .unwrap();
+ Ok(context.out)
+}
+
+#[derive(Debug, Clone)]
+struct Parser<'a> {
+ binding_crate_name: String,
+ lib: Option<Cargo>,
+ config: &'a Config,
+
+ parsed_crates: HashSet<String>,
+ cache_src: HashMap<FilePathBuf, Vec<syn::Item>>,
+ cache_expanded_crate: HashMap<String, Vec<syn::Item>>,
+
+ cfg_stack: Vec<Cfg>,
+
+ out: Parse,
+}
+
+impl<'a> Parser<'a> {
+ fn should_parse_dependency(&self, pkg_name: &str) -> bool {
+ if self.parsed_crates.contains(pkg_name) {
+ return false;
+ }
+
+ if !self.config.parse.parse_deps {
+ return false;
+ }
+
+ // Skip any whitelist or blacklist for expand
+ if self
+ .config
+ .parse
+ .expand
+ .crates
+ .iter()
+ .any(|name| name == pkg_name)
+ {
+ return true;
+ }
+
+ // If we have a whitelist, check it
+ if let Some(ref include) = self.config.parse.include {
+ if !include.iter().any(|name| name == pkg_name) {
+ debug!("Excluding crate {}", pkg_name);
+ return false;
+ }
+ }
+
+ // Check the blacklist
+ !STD_CRATES.contains(&pkg_name)
+ && !self
+ .config
+ .parse
+ .exclude
+ .iter()
+ .any(|name| name == pkg_name)
+ }
+
+ fn parse_crate(&mut self, pkg: &PackageRef) -> Result<(), Error> {
+ assert!(self.lib.is_some());
+ debug!("Parsing crate {}", pkg.name);
+ self.parsed_crates.insert(pkg.name.clone());
+
+ // Check if we should use cargo expand for this crate
+ if self.config.parse.expand.crates.contains(&pkg.name) {
+ self.parse_expand_crate(pkg)?;
+ } else {
+ // Parse the crate before the dependencies otherwise the same-named idents we
+ // want to generate bindings for would be replaced by the ones provided
+ // by the first dependency containing it.
+ let crate_src = self.lib.as_ref().unwrap().find_crate_src(pkg);
+
+ match crate_src {
+ Some(crate_src) => self.parse_mod(pkg, crate_src.as_path(), 0)?,
+ None => {
+ // This should be an error, but is common enough to just elicit a warning
+ warn!(
+ "Parsing crate `{}`: can't find lib.rs with `cargo metadata`. \
+ The crate may be available only on a particular platform, \
+ so consider setting `fetch_all_dependencies` in your cbindgen configuration.",
+ pkg.name
+ );
+ }
+ }
+ }
+
+ for (dep_pkg, cfg) in self.lib.as_ref().unwrap().dependencies(pkg) {
+ if !self.should_parse_dependency(&dep_pkg.name) {
+ continue;
+ }
+
+ if let Some(ref cfg) = cfg {
+ self.cfg_stack.push(cfg.clone());
+ }
+
+ self.parse_crate(&dep_pkg)?;
+
+ if cfg.is_some() {
+ self.cfg_stack.pop();
+ }
+ }
+
+ Ok(())
+ }
+
+ fn parse_expand_crate(&mut self, pkg: &PackageRef) -> Result<(), Error> {
+ assert!(self.lib.is_some());
+
+ let mod_items = {
+ if !self.cache_expanded_crate.contains_key(&pkg.name) {
+ let s = self
+ .lib
+ .as_ref()
+ .unwrap()
+ .expand_crate(
+ pkg,
+ self.config.parse.expand.all_features,
+ self.config.parse.expand.default_features,
+ &self.config.parse.expand.features,
+ self.config.parse.expand.profile,
+ )
+ .map_err(|x| Error::CargoExpand(pkg.name.clone(), x))?;
+ let i = syn::parse_file(&s).map_err(|x| Error::ParseSyntaxError {
+ crate_name: pkg.name.clone(),
+ src_path: "".to_owned(),
+ error: x,
+ })?;
+ self.cache_expanded_crate.insert(pkg.name.clone(), i.items);
+ }
+
+ self.cache_expanded_crate.get(&pkg.name).unwrap().clone()
+ };
+
+ self.process_mod(
+ pkg, None, None, &mod_items, 0, /* is_mod_rs = */ true,
+ /* is_inline = */ false,
+ )
+ }
+
+ fn parse_mod(
+ &mut self,
+ pkg: &PackageRef,
+ mod_path: &FilePath,
+ depth: usize,
+ ) -> Result<(), Error> {
+ let mod_items = match self.cache_src.entry(mod_path.to_path_buf()) {
+ Entry::Vacant(vacant_entry) => {
+ let mut s = String::new();
+ let mut f = File::open(mod_path).map_err(|_| Error::ParseCannotOpenFile {
+ crate_name: pkg.name.clone(),
+ src_path: mod_path.to_str().unwrap().to_owned(),
+ })?;
+
+ f.read_to_string(&mut s)
+ .map_err(|_| Error::ParseCannotOpenFile {
+ crate_name: pkg.name.clone(),
+ src_path: mod_path.to_str().unwrap().to_owned(),
+ })?;
+
+ let i = syn::parse_file(&s).map_err(|x| Error::ParseSyntaxError {
+ crate_name: pkg.name.clone(),
+ src_path: mod_path.to_string_lossy().into(),
+ error: x,
+ })?;
+
+ vacant_entry.insert(i.items).clone()
+ }
+ Entry::Occupied(occupied_entry) => occupied_entry.get().clone(),
+ };
+
+ // Compute module directory according to Rust 2018 rules
+ let submod_dir_2018;
+
+ let mod_dir = mod_path.parent().unwrap();
+
+ let is_mod_rs = depth == 0 || mod_path.ends_with("mod.rs");
+ let submod_dir = if is_mod_rs {
+ mod_dir
+ } else {
+ submod_dir_2018 = mod_path
+ .parent()
+ .unwrap()
+ .join(mod_path.file_stem().unwrap());
+ &submod_dir_2018
+ };
+
+ self.process_mod(
+ pkg,
+ Some(mod_dir),
+ Some(submod_dir),
+ &mod_items,
+ depth,
+ /* is_inline = */ false,
+ is_mod_rs,
+ )
+ }
+
+ /// `mod_dir` is the path to the current directory of the module. It may be
+ /// `None` for pre-expanded modules.
+ ///
+ /// `submod_dir` is the path to search submodules in by default, which might
+ /// be different for rust 2018 for example.
+ #[allow(clippy::too_many_arguments)]
+ fn process_mod(
+ &mut self,
+ pkg: &PackageRef,
+ mod_dir: Option<&FilePath>,
+ submod_dir: Option<&FilePath>,
+ items: &[syn::Item],
+ depth: usize,
+ is_inline: bool,
+ is_in_mod_rs: bool,
+ ) -> Result<(), Error> {
+ debug_assert_eq!(mod_dir.is_some(), submod_dir.is_some());
+ // We process the items first then the nested modules.
+ let nested_modules = self.out.load_syn_crate_mod(
+ self.config,
+ &self.binding_crate_name,
+ &pkg.name,
+ Cfg::join(&self.cfg_stack).as_ref(),
+ items,
+ );
+
+ for item in nested_modules {
+ let next_mod_name = item.ident.unraw().to_string();
+ let cfg = Cfg::load(&item.attrs);
+ if let Some(ref cfg) = cfg {
+ self.cfg_stack.push(cfg.clone());
+ }
+
+ if let Some((_, ref inline_items)) = item.content {
+ // TODO(emilio): This should use #[path] attribute if present,
+ // rather than next_mod_name.
+ let next_submod_dir = submod_dir.map(|dir| dir.join(&next_mod_name));
+ let next_mod_dir = mod_dir.map(|dir| dir.join(&next_mod_name));
+ self.process_mod(
+ pkg,
+ next_mod_dir.as_deref(),
+ next_submod_dir.as_deref(),
+ inline_items,
+ depth,
+ /* is_inline = */ true,
+ is_in_mod_rs,
+ )?;
+ } else if let Some(mod_dir) = mod_dir {
+ let submod_dir = submod_dir.unwrap();
+ let next_mod_path1 = submod_dir.join(next_mod_name.clone() + ".rs");
+ let next_mod_path2 = submod_dir.join(next_mod_name.clone()).join("mod.rs");
+
+ if next_mod_path1.exists() {
+ self.parse_mod(pkg, next_mod_path1.as_path(), depth + 1)?;
+ } else if next_mod_path2.exists() {
+ self.parse_mod(pkg, next_mod_path2.as_path(), depth + 1)?;
+ } else {
+ // Last chance to find a module path
+ let mut path_attr_found = false;
+ for attr in &item.attrs {
+ if let syn::Meta::NameValue(syn::MetaNameValue {
+ path,
+ value: syn::Expr::Lit(syn::ExprLit { lit, .. }),
+ ..
+ }) = &attr.meta
+ {
+ match lit {
+ syn::Lit::Str(ref path_lit) if path.is_ident("path") => {
+ path_attr_found = true;
+ // https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute
+ //
+ // For path attributes on modules not inside inline module blocks, the file path
+ // is relative to the directory the source file is located.
+ //
+ // For path attributes inside inline module blocks, the relative location of the
+ // file path depends on the kind of source file the path attribute is located
+ // in. "mod-rs" source files are root modules (such as lib.rs or main.rs) and
+ // modules with files named mod.rs. "non-mod-rs" source files are all other
+ // module files.
+ //
+ // Paths for path attributes inside inline module blocks in a mod-rs file are
+ // relative to the directory of the mod-rs file including the inline module
+ // components as directories. For non-mod-rs files, it is the same except the
+ // path starts with a directory with the name of the non-mod-rs module.
+ //
+ let base = if is_inline && !is_in_mod_rs {
+ submod_dir
+ } else {
+ mod_dir
+ };
+ self.parse_mod(pkg, &base.join(path_lit.value()), depth + 1)?;
+ break;
+ }
+ _ => (),
+ }
+ }
+ }
+
+ // This should be an error, but it's common enough to
+ // just elicit a warning
+ if !path_attr_found {
+ warn!(
+ "Parsing crate `{}`: can't find mod {}`.",
+ pkg.name, next_mod_name
+ );
+ }
+ }
+ } else {
+ warn!(
+ "Parsing expanded crate `{}`: can't find mod {}`.",
+ pkg.name, next_mod_name
+ );
+ }
+
+ if cfg.is_some() {
+ self.cfg_stack.pop();
+ }
+ }
+
+ Ok(())
+ }
+}
+
+#[derive(Debug, Clone)]
+pub struct Parse {
+ pub constants: ItemMap<Constant>,
+ pub globals: ItemMap<Static>,
+ pub enums: ItemMap<Enum>,
+ pub structs: ItemMap<Struct>,
+ pub unions: ItemMap<Union>,
+ pub opaque_items: ItemMap<OpaqueItem>,
+ pub typedefs: ItemMap<Typedef>,
+ pub functions: Vec<Function>,
+ pub source_files: Vec<FilePathBuf>,
+ pub package_version: String,
+}
+
+impl Parse {
+ pub fn new() -> Parse {
+ Parse {
+ constants: ItemMap::default(),
+ globals: ItemMap::default(),
+ enums: ItemMap::default(),
+ structs: ItemMap::default(),
+ unions: ItemMap::default(),
+ opaque_items: ItemMap::default(),
+ typedefs: ItemMap::default(),
+ functions: Vec::new(),
+ source_files: Vec::new(),
+ package_version: String::new(),
+ }
+ }
+
+ pub fn add_std_types(&mut self) {
+ let mut add_opaque = |path: &str, generic_params: Vec<&str>| {
+ let path = Path::new(path);
+ let generic_params: Vec<_> = generic_params
+ .into_iter()
+ .map(GenericParam::new_type_param)
+ .collect();
+ self.opaque_items.try_insert(OpaqueItem::new(
+ path,
+ GenericParams(generic_params),
+ None,
+ AnnotationSet::new(),
+ Documentation::none(),
+ ))
+ };
+
+ add_opaque("String", vec![]);
+ add_opaque("Box", vec!["T"]);
+ add_opaque("RefCell", vec!["T"]);
+ add_opaque("Rc", vec!["T"]);
+ add_opaque("Arc", vec!["T"]);
+ add_opaque("Result", vec!["T", "E"]);
+ add_opaque("Option", vec!["T"]);
+ add_opaque("NonNull", vec!["T"]);
+ add_opaque("Vec", vec!["T"]);
+ add_opaque("HashMap", vec!["K", "V", "Hasher"]);
+ add_opaque("BTreeMap", vec!["K", "V"]);
+ add_opaque("HashSet", vec!["T"]);
+ add_opaque("BTreeSet", vec!["T"]);
+ add_opaque("LinkedList", vec!["T"]);
+ add_opaque("VecDeque", vec!["T"]);
+ add_opaque("ManuallyDrop", vec!["T"]);
+ add_opaque("MaybeUninit", vec!["T"]);
+ }
+
+ pub fn extend_with(&mut self, other: &Parse) {
+ self.constants.extend_with(&other.constants);
+ self.globals.extend_with(&other.globals);
+ self.enums.extend_with(&other.enums);
+ self.structs.extend_with(&other.structs);
+ self.unions.extend_with(&other.unions);
+ self.opaque_items.extend_with(&other.opaque_items);
+ self.typedefs.extend_with(&other.typedefs);
+ self.functions.extend_from_slice(&other.functions);
+ self.source_files.extend_from_slice(&other.source_files);
+ self.package_version.clone_from(&other.package_version);
+ }
+
+ fn load_syn_crate_mod<'a>(
+ &mut self,
+ config: &Config,
+ binding_crate_name: &str,
+ crate_name: &str,
+ mod_cfg: Option<&Cfg>,
+ items: &'a [syn::Item],
+ ) -> Vec<&'a syn::ItemMod> {
+ let mut impls_with_assoc_consts = Vec::new();
+ let mut nested_modules = Vec::new();
+
+ for item in items {
+ if item.should_skip_parsing() {
+ continue;
+ }
+ match item {
+ syn::Item::ForeignMod(ref item) => {
+ self.load_syn_foreign_mod(
+ config,
+ binding_crate_name,
+ crate_name,
+ mod_cfg,
+ item,
+ );
+ }
+ syn::Item::Fn(ref item) => {
+ self.load_syn_fn(config, binding_crate_name, crate_name, mod_cfg, item);
+ }
+ syn::Item::Const(ref item) => {
+ self.load_syn_const(config, binding_crate_name, crate_name, mod_cfg, item);
+ }
+ syn::Item::Static(ref item) => {
+ self.load_syn_static(config, binding_crate_name, crate_name, mod_cfg, item);
+ }
+ syn::Item::Struct(ref item) => {
+ self.load_syn_struct(config, crate_name, mod_cfg, item);
+ }
+ syn::Item::Union(ref item) => {
+ self.load_syn_union(config, crate_name, mod_cfg, item);
+ }
+ syn::Item::Enum(ref item) => {
+ self.load_syn_enum(config, crate_name, mod_cfg, item);
+ }
+ syn::Item::Type(ref item) => {
+ self.load_syn_ty(crate_name, mod_cfg, item);
+ }
+ syn::Item::Impl(ref item_impl) => {
+ let has_assoc_const = item_impl
+ .items
+ .iter()
+ .any(|item| matches!(item, syn::ImplItem::Const(_)));
+ if has_assoc_const {
+ impls_with_assoc_consts.push(item_impl);
+ }
+
+ if let syn::Type::Path(ref path) = *item_impl.self_ty {
+ if let Some(type_name) = path.path.get_ident() {
+ for method in item_impl.items.iter().filter_map(|item| match item {
+ syn::ImplItem::Fn(method) if !method.should_skip_parsing() => {
+ Some(method)
+ }
+ _ => None,
+ }) {
+ self.load_syn_method(
+ config,
+ binding_crate_name,
+ crate_name,
+ mod_cfg,
+ &Path::new(type_name.unraw().to_string()),
+ method,
+ )
+ }
+ }
+ }
+ }
+ syn::Item::Macro(ref item) => {
+ self.load_builtin_macro(config, crate_name, mod_cfg, item);
+ }
+ syn::Item::Mod(ref item) => {
+ nested_modules.push(item);
+ }
+ _ => {}
+ }
+ }
+
+ for item_impl in impls_with_assoc_consts {
+ self.load_syn_assoc_consts_from_impl(crate_name, mod_cfg, item_impl)
+ }
+
+ nested_modules
+ }
+
+ fn load_syn_assoc_consts_from_impl(
+ &mut self,
+ crate_name: &str,
+ mod_cfg: Option<&Cfg>,
+ item_impl: &syn::ItemImpl,
+ ) {
+ let associated_constants = item_impl.items.iter().filter_map(|item| match item {
+ syn::ImplItem::Const(ref associated_constant)
+ if !associated_constant.should_skip_parsing() =>
+ {
+ Some(associated_constant)
+ }
+ _ => None,
+ });
+ self.load_syn_assoc_consts(
+ crate_name,
+ mod_cfg,
+ &item_impl.self_ty,
+ associated_constants,
+ );
+ }
+
+ /// Enters a `extern "C" { }` declaration and loads function declarations.
+ fn load_syn_foreign_mod(
+ &mut self,
+ config: &Config,
+ binding_crate_name: &str,
+ crate_name: &str,
+ mod_cfg: Option<&Cfg>,
+ item: &syn::ItemForeignMod,
+ ) {
+ if !item.abi.is_c() && !item.abi.is_omitted() {
+ info!("Skip {} - (extern block must be extern C).", crate_name);
+ return;
+ }
+
+ let mod_cfg = Cfg::append(mod_cfg, Cfg::load(&item.attrs));
+ for foreign_item in &item.items {
+ if let syn::ForeignItem::Fn(ref function) = *foreign_item {
+ if !config
+ .parse
+ .should_generate_top_level_item(crate_name, binding_crate_name)
+ {
+ info!(
+ "Skip {}::{} - (fn's outside of the binding crate are not used).",
+ crate_name, &function.sig.ident
+ );
+ return;
+ }
+ let path = Path::new(function.sig.ident.unraw().to_string());
+ match Function::load(
+ path,
+ None,
+ &function.sig,
+ true,
+ &function.attrs,
+ mod_cfg.as_ref(),
+ ) {
+ Ok(func) => {
+ info!("Take {}::{}.", crate_name, &function.sig.ident);
+
+ self.functions.push(func);
+ }
+ Err(msg) => {
+ error!(
+ "Cannot use fn {}::{} ({}).",
+ crate_name, &function.sig.ident, msg
+ );
+ }
+ }
+ }
+ }
+ }
+
+ /// Loads a `fn` declaration inside an `impl` block, if the type is a simple identifier
+ fn load_syn_method(
+ &mut self,
+ config: &Config,
+ binding_crate_name: &str,
+ crate_name: &str,
+ mod_cfg: Option<&Cfg>,
+ self_type: &Path,
+ item: &syn::ImplItemFn,
+ ) {
+ self.load_fn_declaration(
+ config,
+ binding_crate_name,
+ crate_name,
+ mod_cfg,
+ item,
+ Some(self_type),
+ &item.sig,
+ &item.attrs,
+ )
+ }
+
+ /// Loads a `fn` declaration
+ fn load_syn_fn(
+ &mut self,
+ config: &Config,
+ binding_crate_name: &str,
+ crate_name: &str,
+ mod_cfg: Option<&Cfg>,
+ item: &syn::ItemFn,
+ ) {
+ self.load_fn_declaration(
+ config,
+ binding_crate_name,
+ crate_name,
+ mod_cfg,
+ item,
+ None,
+ &item.sig,
+ &item.attrs,
+ );
+ }
+
+ #[allow(clippy::too_many_arguments)]
+ fn load_fn_declaration(
+ &mut self,
+ config: &Config,
+ binding_crate_name: &str,
+ crate_name: &str,
+ mod_cfg: Option<&Cfg>,
+ named_symbol: &dyn SynItemHelpers,
+ self_type: Option<&Path>,
+ sig: &syn::Signature,
+ attrs: &[syn::Attribute],
+ ) {
+ if !config
+ .parse
+ .should_generate_top_level_item(crate_name, binding_crate_name)
+ {
+ info!(
+ "Skip {}::{} - (fn's outside of the binding crate are not used).",
+ crate_name, &sig.ident
+ );
+ return;
+ }
+
+ let loggable_item_name = || {
+ let mut items = Vec::with_capacity(3);
+ items.push(crate_name.to_owned());
+ if let Some(ref self_type) = self_type {
+ items.push(self_type.to_string());
+ }
+ items.push(sig.ident.unraw().to_string());
+ items.join("::")
+ };
+
+ let is_extern_c = sig.abi.is_omitted() || sig.abi.is_c();
+ let exported_name = named_symbol.exported_name();
+
+ match (is_extern_c, exported_name) {
+ (true, Some(exported_name)) => {
+ let path = Path::new(exported_name);
+ match Function::load(path, self_type, sig, false, attrs, mod_cfg) {
+ Ok(func) => {
+ info!("Take {}.", loggable_item_name());
+ self.functions.push(func);
+ }
+ Err(msg) => {
+ error!("Cannot use fn {} ({}).", loggable_item_name(), msg);
+ }
+ }
+ }
+ (true, None) => {
+ warn!(
+ "Skipping {} - (not `no_mangle`, and has no `export_name` attribute)",
+ loggable_item_name()
+ );
+ }
+ (false, Some(_exported_name)) => {
+ warn!("Skipping {} - (not `extern \"C\"`)", loggable_item_name());
+ }
+ (false, None) => {}
+ }
+ }
+
+ /// Loads associated `const` declarations
+ fn load_syn_assoc_consts<'a, I>(
+ &mut self,
+ crate_name: &str,
+ mod_cfg: Option<&Cfg>,
+ impl_ty: &syn::Type,
+ items: I,
+ ) where
+ I: IntoIterator<Item = &'a syn::ImplItemConst>,
+ {
+ let ty = match Type::load(impl_ty) {
+ Ok(ty) => ty,
+ Err(e) => {
+ warn!("Skipping associated constants for {:?}: {:?}", impl_ty, e);
+ return;
+ }
+ };
+
+ let ty = match ty {
+ Some(ty) => ty,
+ None => return,
+ };
+
+ let impl_path = match ty.get_root_path() {
+ Some(p) => p,
+ None => {
+ warn!(
+ "Couldn't find path for {:?}, skipping associated constants",
+ ty
+ );
+ return;
+ }
+ };
+
+ for item in items.into_iter() {
+ if let syn::Visibility::Public(_) = item.vis {
+ } else {
+ warn!("Skip {}::{} - (not `pub`).", crate_name, &item.ident);
+ return;
+ }
+
+ let path = Path::new(item.ident.unraw().to_string());
+ match Constant::load(
+ path,
+ mod_cfg,
+ &item.ty,
+ &item.expr,
+ &item.attrs,
+ Some(impl_path.clone()),
+ ) {
+ Ok(constant) => {
+ info!("Take {}::{}::{}.", crate_name, impl_path, &item.ident);
+ let mut any = false;
+ self.structs.for_items_mut(&impl_path, |item| {
+ any = true;
+ item.add_associated_constant(constant.clone());
+ });
+ // Handle associated constants to other item types that are
+ // not structs like enums or such as regular constants.
+ if !any && !self.constants.try_insert(constant) {
+ error!(
+ "Conflicting name for constant {}::{}::{}.",
+ crate_name, impl_path, &item.ident,
+ );
+ }
+ }
+ Err(msg) => {
+ warn!("Skip {}::{} - ({})", crate_name, &item.ident, msg);
+ }
+ }
+ }
+ }
+
+ /// Loads a `const` declaration
+ fn load_syn_const(
+ &mut self,
+ config: &Config,
+ binding_crate_name: &str,
+ crate_name: &str,
+ mod_cfg: Option<&Cfg>,
+ item: &syn::ItemConst,
+ ) {
+ if !config
+ .parse
+ .should_generate_top_level_item(crate_name, binding_crate_name)
+ {
+ info!(
+ "Skip {}::{} - (const's outside of the binding crate are not used).",
+ crate_name, &item.ident
+ );
+ return;
+ }
+
+ if let syn::Visibility::Public(_) = item.vis {
+ } else {
+ warn!("Skip {}::{} - (not `pub`).", crate_name, &item.ident);
+ return;
+ }
+
+ let path = Path::new(item.ident.unraw().to_string());
+ match Constant::load(path, mod_cfg, &item.ty, &item.expr, &item.attrs, None) {
+ Ok(constant) => {
+ info!("Take {}::{}.", crate_name, &item.ident);
+
+ let full_name = constant.path.clone();
+ if !self.constants.try_insert(constant) {
+ error!("Conflicting name for constant {}", full_name);
+ }
+ }
+ Err(msg) => {
+ warn!("Skip {}::{} - ({})", crate_name, &item.ident, msg);
+ }
+ }
+ }
+
+ /// Loads a `static` declaration
+ fn load_syn_static(
+ &mut self,
+ config: &Config,
+ binding_crate_name: &str,
+ crate_name: &str,
+ mod_cfg: Option<&Cfg>,
+ item: &syn::ItemStatic,
+ ) {
+ if !config
+ .parse
+ .should_generate_top_level_item(crate_name, binding_crate_name)
+ {
+ info!(
+ "Skip {}::{} - (static's outside of the binding crate are not used).",
+ crate_name, &item.ident
+ );
+ return;
+ }
+
+ if let Some(exported_name) = item.exported_name() {
+ let path = Path::new(exported_name);
+ match Static::load(path, item, mod_cfg) {
+ Ok(constant) => {
+ info!("Take {}::{}.", crate_name, &item.ident);
+ self.globals.try_insert(constant);
+ }
+ Err(msg) => {
+ warn!("Skip {}::{} - ({})", crate_name, &item.ident, msg);
+ }
+ }
+ } else {
+ warn!("Skip {}::{} - (not `no_mangle`).", crate_name, &item.ident);
+ }
+ }
+
+ /// Loads a `struct` declaration
+ fn load_syn_struct(
+ &mut self,
+ config: &Config,
+ crate_name: &str,
+ mod_cfg: Option<&Cfg>,
+ item: &syn::ItemStruct,
+ ) {
+ match Struct::load(&config.layout, item, mod_cfg) {
+ Ok(st) => {
+ info!("Take {}::{}.", crate_name, &item.ident);
+ self.structs.try_insert(st);
+ }
+ Err(msg) => {
+ info!("Take {}::{} - opaque ({}).", crate_name, &item.ident, msg);
+ let path = Path::new(item.ident.unraw().to_string());
+ self.opaque_items.try_insert(
+ OpaqueItem::load(path, &item.generics, &item.attrs, mod_cfg).unwrap(),
+ );
+ }
+ }
+ }
+
+ /// Loads a `union` declaration
+ fn load_syn_union(
+ &mut self,
+ config: &Config,
+ crate_name: &str,
+ mod_cfg: Option<&Cfg>,
+ item: &syn::ItemUnion,
+ ) {
+ match Union::load(&config.layout, item, mod_cfg) {
+ Ok(st) => {
+ info!("Take {}::{}.", crate_name, &item.ident);
+
+ self.unions.try_insert(st);
+ }
+ Err(msg) => {
+ info!("Take {}::{} - opaque ({}).", crate_name, &item.ident, msg);
+ let path = Path::new(item.ident.unraw().to_string());
+ self.opaque_items.try_insert(
+ OpaqueItem::load(path, &item.generics, &item.attrs, mod_cfg).unwrap(),
+ );
+ }
+ }
+ }
+
+ /// Loads a `enum` declaration
+ fn load_syn_enum(
+ &mut self,
+ config: &Config,
+ crate_name: &str,
+ mod_cfg: Option<&Cfg>,
+ item: &syn::ItemEnum,
+ ) {
+ match Enum::load(item, mod_cfg, config) {
+ Ok(en) => {
+ info!("Take {}::{}.", crate_name, &item.ident);
+ self.enums.try_insert(en);
+ }
+ Err(msg) => {
+ info!("Take {}::{} - opaque ({}).", crate_name, &item.ident, msg);
+ let path = Path::new(item.ident.unraw().to_string());
+ self.opaque_items.try_insert(
+ OpaqueItem::load(path, &item.generics, &item.attrs, mod_cfg).unwrap(),
+ );
+ }
+ }
+ }
+
+ /// Loads a `type` declaration
+ fn load_syn_ty(&mut self, crate_name: &str, mod_cfg: Option<&Cfg>, item: &syn::ItemType) {
+ match Typedef::load(item, mod_cfg) {
+ Ok(st) => {
+ info!("Take {}::{}.", crate_name, &item.ident);
+
+ self.typedefs.try_insert(st);
+ }
+ Err(msg) => {
+ info!("Take {}::{} - opaque ({}).", crate_name, &item.ident, msg);
+ let path = Path::new(item.ident.unraw().to_string());
+ self.opaque_items.try_insert(
+ OpaqueItem::load(path, &item.generics, &item.attrs, mod_cfg).unwrap(),
+ );
+ }
+ }
+ }
+
+ fn load_builtin_macro(
+ &mut self,
+ config: &Config,
+ crate_name: &str,
+ mod_cfg: Option<&Cfg>,
+ item: &syn::ItemMacro,
+ ) {
+ let name = match item.mac.path.segments.last() {
+ Some(n) => n.ident.unraw().to_string(),
+ None => return,
+ };
+
+ if name != "bitflags" || !config.macro_expansion.bitflags {
+ return;
+ }
+
+ let bitflags = match bitflags::parse(item.mac.tokens.clone()) {
+ Ok(bf) => bf,
+ Err(e) => {
+ warn!("Failed to parse bitflags invocation: {:?}", e);
+ return;
+ }
+ };
+
+ let (struct_, impl_) = bitflags.expand();
+ if let Some(struct_) = struct_ {
+ self.load_syn_struct(config, crate_name, mod_cfg, &struct_);
+ }
+ if let syn::Type::Path(ref path) = *impl_.self_ty {
+ if let Some(type_name) = path.path.get_ident() {
+ self.structs
+ .for_items_mut(&Path::new(type_name.unraw().to_string()), |item| {
+ item.annotations
+ .add_default("internal-derive-bitflags", AnnotationValue::Bool(true));
+ });
+ }
+ }
+ self.load_syn_assoc_consts_from_impl(crate_name, mod_cfg, &impl_)
+ }
+}
diff --git a/cbindgen-0.27.0/src/bindgen/rename.rs b/cbindgen-0.27.0/src/bindgen/rename.rs
new file mode 100644
index 0000000..f594939
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/rename.rs
@@ -0,0 +1,140 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::borrow::Cow;
+use std::str::FromStr;
+
+/// The type of identifier to be renamed.
+#[derive(Debug, Clone, Copy)]
+pub enum IdentifierType<'a> {
+ StructMember,
+ EnumVariant { prefix: &'a str },
+ FunctionArg,
+ Type,
+ Enum,
+}
+
+impl<'a> IdentifierType<'a> {
+ fn to_str(self) -> &'static str {
+ match self {
+ IdentifierType::StructMember => "m",
+ IdentifierType::EnumVariant { .. } => "",
+ IdentifierType::FunctionArg => "a",
+ IdentifierType::Type => "",
+ IdentifierType::Enum => "",
+ }
+ }
+}
+
+/// A rule to apply to an identifier when generating bindings.
+#[derive(Debug, Clone, Copy, Default)]
+pub enum RenameRule {
+ /// Do not apply any renaming. The default.
+ #[default]
+ None,
+ /// Converts the identifier to PascalCase and adds a context dependent prefix
+ GeckoCase,
+ /// Converts the identifier to lower case.
+ LowerCase,
+ /// Converts the identifier to upper case.
+ UpperCase,
+ /// Converts the identifier to PascalCase.
+ PascalCase,
+ /// Converts the identifier to camelCase.
+ CamelCase,
+ /// Converts the identifier to snake_case.
+ SnakeCase,
+ /// Converts the identifier to SCREAMING_SNAKE_CASE.
+ ScreamingSnakeCase,
+ /// Converts the identifier to SCREAMING_SNAKE_CASE and prefixes enum variants
+ /// with the enum name.
+ QualifiedScreamingSnakeCase,
+}
+
+impl RenameRule {
+ pub(crate) fn not_none(self) -> Option<Self> {
+ match self {
+ RenameRule::None => None,
+ other => Some(other),
+ }
+ }
+
+ /// Applies the rename rule to a string
+ pub fn apply<'a>(self, text: &'a str, context: IdentifierType) -> Cow<'a, str> {
+ use heck::*;
+
+ if text.is_empty() {
+ return Cow::Borrowed(text);
+ }
+
+ Cow::Owned(match self {
+ RenameRule::None => return Cow::Borrowed(text),
+ RenameRule::GeckoCase => context.to_str().to_owned() + &text.to_upper_camel_case(),
+ RenameRule::LowerCase => text.to_lowercase(),
+ RenameRule::UpperCase => text.to_uppercase(),
+ RenameRule::PascalCase => text.to_pascal_case(),
+ RenameRule::CamelCase => text.to_lower_camel_case(),
+ RenameRule::SnakeCase => text.to_snake_case(),
+ RenameRule::ScreamingSnakeCase => text.to_shouty_snake_case(),
+ RenameRule::QualifiedScreamingSnakeCase => {
+ let mut result = String::new();
+
+ if let IdentifierType::EnumVariant { prefix } = context {
+ result.push_str(
+ &RenameRule::ScreamingSnakeCase.apply(prefix, IdentifierType::Enum),
+ );
+ result.push('_');
+ }
+
+ result.push_str(&RenameRule::ScreamingSnakeCase.apply(text, context));
+ result
+ }
+ })
+ }
+}
+
+impl FromStr for RenameRule {
+ type Err = String;
+
+ fn from_str(s: &str) -> Result<RenameRule, Self::Err> {
+ match s {
+ "none" => Ok(RenameRule::None),
+ "None" => Ok(RenameRule::None),
+
+ "mGeckoCase" => Ok(RenameRule::GeckoCase),
+ "GeckoCase" => Ok(RenameRule::GeckoCase),
+ "gecko_case" => Ok(RenameRule::GeckoCase),
+
+ "lowercase" => Ok(RenameRule::LowerCase),
+ "LowerCase" => Ok(RenameRule::LowerCase),
+ "lower_case" => Ok(RenameRule::LowerCase),
+
+ "UPPERCASE" => Ok(RenameRule::UpperCase),
+ "UpperCase" => Ok(RenameRule::UpperCase),
+ "upper_case" => Ok(RenameRule::UpperCase),
+
+ "PascalCase" => Ok(RenameRule::PascalCase),
+ "pascal_case" => Ok(RenameRule::PascalCase),
+
+ "camelCase" => Ok(RenameRule::CamelCase),
+ "CamelCase" => Ok(RenameRule::CamelCase),
+ "camel_case" => Ok(RenameRule::CamelCase),
+
+ "snake_case" => Ok(RenameRule::SnakeCase),
+ "SnakeCase" => Ok(RenameRule::SnakeCase),
+
+ "SCREAMING_SNAKE_CASE" => Ok(RenameRule::ScreamingSnakeCase),
+ "ScreamingSnakeCase" => Ok(RenameRule::ScreamingSnakeCase),
+ "screaming_snake_case" => Ok(RenameRule::ScreamingSnakeCase),
+
+ "QUALIFIED_SCREAMING_SNAKE_CASE" => Ok(RenameRule::QualifiedScreamingSnakeCase),
+ "QualifiedScreamingSnakeCase" => Ok(RenameRule::QualifiedScreamingSnakeCase),
+ "qualified_screaming_snake_case" => Ok(RenameRule::QualifiedScreamingSnakeCase),
+
+ _ => Err(format!("Unrecognized RenameRule: '{}'.", s)),
+ }
+ }
+}
+
+deserialize_enum_str!(RenameRule);
diff --git a/cbindgen-0.24.5/src/bindgen/reserved.rs b/cbindgen-0.27.0/src/bindgen/reserved.rs
similarity index 100%
rename from cbindgen-0.24.5/src/bindgen/reserved.rs
rename to cbindgen-0.27.0/src/bindgen/reserved.rs
diff --git a/cbindgen-0.27.0/src/bindgen/utilities.rs b/cbindgen-0.27.0/src/bindgen/utilities.rs
new file mode 100644
index 0000000..5cab65b
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/utilities.rs
@@ -0,0 +1,374 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#![allow(clippy::redundant_closure_call)]
+
+use syn::ext::IdentExt;
+
+pub trait IterHelpers: Iterator {
+ fn try_skip_map<F, T, E>(&mut self, f: F) -> Result<Vec<T>, E>
+ where
+ F: FnMut(&Self::Item) -> Result<Option<T>, E>;
+}
+
+impl<I> IterHelpers for I
+where
+ I: Iterator,
+{
+ fn try_skip_map<F, T, E>(&mut self, mut f: F) -> Result<Vec<T>, E>
+ where
+ F: FnMut(&Self::Item) -> Result<Option<T>, E>,
+ {
+ let mut out = Vec::new();
+ for item in self {
+ if let Some(x) = f(&item)? {
+ out.push(x);
+ }
+ }
+ Ok(out)
+ }
+}
+
+pub trait SynItemHelpers: SynAttributeHelpers {
+ fn exported_name(&self) -> Option<String>;
+}
+
+impl SynItemHelpers for syn::ItemFn {
+ fn exported_name(&self) -> Option<String> {
+ self.attrs
+ .attr_name_value_lookup("export_name")
+ .or_else(|| {
+ if self.is_no_mangle() {
+ Some(self.sig.ident.unraw().to_string())
+ } else {
+ None
+ }
+ })
+ }
+}
+
+impl SynItemHelpers for syn::ImplItemFn {
+ fn exported_name(&self) -> Option<String> {
+ self.attrs
+ .attr_name_value_lookup("export_name")
+ .or_else(|| {
+ if self.is_no_mangle() {
+ Some(self.sig.ident.unraw().to_string())
+ } else {
+ None
+ }
+ })
+ }
+}
+
+impl SynItemHelpers for syn::ItemStatic {
+ fn exported_name(&self) -> Option<String> {
+ self.attrs
+ .attr_name_value_lookup("export_name")
+ .or_else(|| {
+ if self.is_no_mangle() {
+ Some(self.ident.unraw().to_string())
+ } else {
+ None
+ }
+ })
+ }
+}
+
+/// Returns whether this attribute causes us to skip at item. This basically
+/// checks for `#[cfg(test)]`, `#[test]`, `/// cbindgen::ignore` and
+/// variations thereof.
+fn is_skip_item_attr(attr: &syn::Meta) -> bool {
+ match *attr {
+ syn::Meta::Path(ref path) => {
+ // TODO(emilio): It'd be great if rustc allowed us to use a syntax
+ // like `#[cbindgen::ignore]` or such.
+ path.is_ident("test")
+ }
+ syn::Meta::List(ref list) => {
+ if !list.path.is_ident("cfg") {
+ return false;
+ }
+
+ // Remove commas of the question by parsing
+ let parser = syn::punctuated::Punctuated::<proc_macro2::TokenStream, syn::Token![,]>::parse_terminated;
+ let Ok(tokens) = list.parse_args_with(parser) else {
+ // cfg attr is a list separated by comma, if that fails, that is probably a malformed cfg attribute
+ return false;
+ };
+
+ for token in tokens {
+ let Ok(path) = syn::parse2::<syn::Path>(token) else {
+ // we are looking for `test`, that should always happen only as path
+ return false;
+ };
+
+ if path.is_ident("test") {
+ return true;
+ }
+ }
+ false
+ // list.nested.iter().any(|nested| match *nested {
+ // syn::NestedMeta::Meta(ref meta) => is_skip_item_attr(meta),
+ // syn::NestedMeta::Lit(..) => false,
+ // })
+ }
+ syn::Meta::NameValue(ref name_value) => {
+ if name_value.path.is_ident("doc") {
+ if let syn::Expr::Lit(syn::ExprLit {
+ lit: syn::Lit::Str(ref content),
+ ..
+ }) = name_value.value
+ {
+ // FIXME(emilio): Maybe should use the general annotation
+ // mechanism, but it seems overkill for this.
+ if content.value().trim() == "cbindgen:ignore" {
+ return true;
+ }
+ }
+ }
+ false
+ }
+ }
+}
+
+pub trait SynAttributeHelpers {
+ /// Returns the list of attributes for an item.
+ fn attrs(&self) -> &[syn::Attribute];
+
+ /// Searches for attributes like `#[test]`.
+ /// Example:
+ /// - `item.has_attr_word("test")` => `#[test]`
+ fn has_attr_word(&self, name: &str) -> bool {
+ self.attrs().iter().any(|attr| {
+ if let syn::Meta::Path(ref path) = &attr.meta {
+ path.is_ident(name)
+ } else {
+ false
+ }
+ })
+ }
+
+ fn find_deprecated_note(&self) -> Option<String> {
+ let attrs = self.attrs();
+ // #[deprecated = ""]
+ if let Some(note) = attrs.attr_name_value_lookup("deprecated") {
+ return Some(note);
+ }
+
+ // #[deprecated]
+ if attrs.has_attr_word("deprecated") {
+ return Some(String::new());
+ }
+
+ // #[deprecated(note = "")]
+ let attr = attrs.iter().find(|attr| {
+ if let syn::Meta::List(list) = &attr.meta {
+ list.path.is_ident("deprecated")
+ } else {
+ false
+ }
+ })?;
+
+ let args: syn::punctuated::Punctuated<syn::MetaNameValue, Token![,]> =
+ match attr.parse_args_with(syn::punctuated::Punctuated::parse_terminated) {
+ Ok(args) => args,
+ Err(_) => {
+ warn!("couldn't parse deprecated attribute");
+ return None;
+ }
+ };
+
+ let arg = args.iter().find(|arg| arg.path.is_ident("note"))?;
+ if let syn::Expr::Lit(syn::ExprLit {
+ lit: syn::Lit::Str(ref lit),
+ ..
+ }) = arg.value
+ {
+ Some(lit.value())
+ } else {
+ warn!("deprecated attribute must be a string");
+ None
+ }
+ }
+
+ fn is_no_mangle(&self) -> bool {
+ self.has_attr_word("no_mangle")
+ }
+
+ /// Sees whether we should skip parsing a given item.
+ fn should_skip_parsing(&self) -> bool {
+ for attr in self.attrs() {
+ if is_skip_item_attr(&attr.meta) {
+ return true;
+ }
+ }
+
+ false
+ }
+
+ fn attr_name_value_lookup(&self, name: &str) -> Option<String> {
+ self.attrs()
+ .iter()
+ .filter_map(|attr| {
+ if let syn::Meta::NameValue(syn::MetaNameValue {
+ path,
+ value:
+ syn::Expr::Lit(syn::ExprLit {
+ lit: syn::Lit::Str(lit),
+ ..
+ }),
+ ..
+ }) = &attr.meta
+ {
+ if path.is_ident(name) {
+ return Some(lit.value());
+ }
+ }
+ None
+ })
+ .next()
+ }
+
+ fn get_comment_lines(&self) -> Vec<String> {
+ let mut comment = Vec::new();
+
+ for attr in self.attrs() {
+ if attr.style == syn::AttrStyle::Outer {
+ if let syn::Meta::NameValue(syn::MetaNameValue {
+ path,
+ value:
+ syn::Expr::Lit(syn::ExprLit {
+ lit: syn::Lit::Str(content),
+ ..
+ }),
+ ..
+ }) = &attr.meta
+ {
+ if path.is_ident("doc") {
+ comment.extend(split_doc_attr(&content.value()));
+ }
+ }
+ }
+ }
+
+ comment
+ }
+}
+
+macro_rules! syn_item_match_helper {
+ ($s:ident => has_attrs: |$i:ident| $a:block, otherwise: || $b:block) => {
+ match *$s {
+ syn::Item::Const(ref $i) => $a,
+ syn::Item::Enum(ref $i) => $a,
+ syn::Item::ExternCrate(ref $i) => $a,
+ syn::Item::Fn(ref $i) => $a,
+ syn::Item::ForeignMod(ref $i) => $a,
+ syn::Item::Impl(ref $i) => $a,
+ syn::Item::Macro(ref $i) => $a,
+ syn::Item::Mod(ref $i) => $a,
+ syn::Item::Static(ref $i) => $a,
+ syn::Item::Struct(ref $i) => $a,
+ syn::Item::Trait(ref $i) => $a,
+ syn::Item::Type(ref $i) => $a,
+ syn::Item::Union(ref $i) => $a,
+ syn::Item::Use(ref $i) => $a,
+ syn::Item::TraitAlias(ref $i) => $a,
+ syn::Item::Verbatim(_) => $b,
+ _ => panic!("Unhandled syn::Item: {:?}", $s),
+ }
+ };
+}
+
+impl SynAttributeHelpers for syn::Item {
+ fn attrs(&self) -> &[syn::Attribute] {
+ syn_item_match_helper!(self =>
+ has_attrs: |item| { &item.attrs },
+ otherwise: || { &[] }
+ )
+ }
+}
+
+macro_rules! impl_syn_item_helper {
+ ($t:ty) => {
+ impl SynAttributeHelpers for $t {
+ fn attrs(&self) -> &[syn::Attribute] {
+ &self.attrs
+ }
+ }
+ };
+}
+
+impl_syn_item_helper!(syn::ItemExternCrate);
+impl_syn_item_helper!(syn::ItemUse);
+impl_syn_item_helper!(syn::ItemStatic);
+impl_syn_item_helper!(syn::ItemConst);
+impl_syn_item_helper!(syn::ItemFn);
+impl_syn_item_helper!(syn::ImplItemConst);
+impl_syn_item_helper!(syn::ImplItemFn);
+impl_syn_item_helper!(syn::ItemMod);
+impl_syn_item_helper!(syn::ItemForeignMod);
+impl_syn_item_helper!(syn::ItemType);
+impl_syn_item_helper!(syn::ItemStruct);
+impl_syn_item_helper!(syn::ItemEnum);
+impl_syn_item_helper!(syn::ItemUnion);
+impl_syn_item_helper!(syn::ItemTrait);
+impl_syn_item_helper!(syn::ItemImpl);
+impl_syn_item_helper!(syn::ItemMacro);
+impl_syn_item_helper!(syn::ItemTraitAlias);
+
+/// Helper function for accessing Abi information
+pub trait SynAbiHelpers {
+ fn is_c(&self) -> bool;
+ fn is_omitted(&self) -> bool;
+}
+
+impl SynAbiHelpers for Option<syn::Abi> {
+ fn is_c(&self) -> bool {
+ if let Some(ref abi) = *self {
+ if let Some(ref lit_string) = abi.name {
+ return matches!(lit_string.value().as_str(), "C" | "C-unwind");
+ }
+ }
+ false
+ }
+ fn is_omitted(&self) -> bool {
+ if let Some(ref abi) = *self {
+ abi.name.is_none()
+ } else {
+ false
+ }
+ }
+}
+
+impl SynAbiHelpers for syn::Abi {
+ fn is_c(&self) -> bool {
+ if let Some(ref lit_string) = self.name {
+ matches!(lit_string.value().as_str(), "C" | "C-unwind")
+ } else {
+ false
+ }
+ }
+ fn is_omitted(&self) -> bool {
+ self.name.is_none()
+ }
+}
+
+impl SynAttributeHelpers for [syn::Attribute] {
+ fn attrs(&self) -> &[syn::Attribute] {
+ self
+ }
+}
+
+fn split_doc_attr(input: &str) -> Vec<String> {
+ input
+ // Convert two newline (indicate "new paragraph") into two line break.
+ .replace("\n\n", " \n \n")
+ // Convert newline after two spaces (indicate "line break") into line break.
+ .split(" \n")
+ // Convert single newline (indicate hard-wrapped) into space.
+ .map(|s| s.replace('\n', " "))
+ .map(|s| s.trim_end().to_string())
+ .collect()
+}
diff --git a/cbindgen-0.27.0/src/bindgen/writer.rs b/cbindgen-0.27.0/src/bindgen/writer.rs
new file mode 100644
index 0000000..f36757d
--- /dev/null
+++ b/cbindgen-0.27.0/src/bindgen/writer.rs
@@ -0,0 +1,271 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::cmp;
+use std::io;
+use std::io::Write;
+
+use crate::bindgen::config::{Braces, Language};
+use crate::bindgen::language_backend::LanguageBackend;
+use crate::bindgen::Bindings;
+
+/// A type of way to format a list.
+pub enum ListType<'a> {
+ /// Join each adjacent item with a str.
+ Join(&'a str),
+ /// End each item with a str.
+ Cap(&'a str),
+}
+
+/// A utility wrapper to write unbuffered data and correctly adjust positions.
+struct InnerWriter<'a, 'b: 'a, F: 'a + Write>(&'a mut SourceWriter<'b, F>);
+
+impl<'a, 'b, F: Write> Write for InnerWriter<'a, 'b, F> {
+ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+ let writer = &mut self.0;
+
+ if !writer.line_started {
+ for _ in 0..writer.spaces() {
+ write!(writer.out, " ").unwrap();
+ }
+ writer.line_started = true;
+ writer.line_length += writer.spaces();
+ }
+
+ let written = writer.out.write(buf)?;
+ writer.line_length += written;
+ writer.max_line_length = cmp::max(writer.max_line_length, writer.line_length);
+ Ok(written)
+ }
+
+ fn flush(&mut self) -> io::Result<()> {
+ self.0.out.flush()
+ }
+}
+
+/// A utility writer for generating code easier.
+pub struct SourceWriter<'a, F: Write> {
+ out: F,
+ bindings: &'a Bindings,
+ spaces: Vec<usize>,
+ line_started: bool,
+ line_length: usize,
+ line_number: usize,
+ max_line_length: usize,
+}
+
+pub type MeasureWriter<'a> = SourceWriter<'a, &'a mut Vec<u8>>;
+
+impl<'a, F: Write> SourceWriter<'a, F> {
+ pub fn new(out: F, bindings: &'a Bindings) -> Self {
+ SourceWriter {
+ out,
+ bindings,
+ spaces: vec![0],
+ line_started: false,
+ line_length: 0,
+ line_number: 1,
+ max_line_length: 0,
+ }
+ }
+
+ pub fn bindings(&self) -> &Bindings {
+ self.bindings
+ }
+
+ /// Takes a function that writes source and returns the maximum line length
+ /// written.
+ pub fn try_write<T>(&mut self, func: T, max_line_length: usize) -> bool
+ where
+ T: FnOnce(&mut MeasureWriter),
+ {
+ if self.line_length > max_line_length {
+ return false;
+ }
+
+ let mut buffer = Vec::new();
+ let line_length = {
+ let mut measurer = SourceWriter {
+ out: &mut buffer,
+ bindings: self.bindings,
+ spaces: self.spaces.clone(),
+ line_started: self.line_started,
+ line_length: self.line_length,
+ line_number: self.line_number,
+ max_line_length: self.line_length,
+ };
+
+ func(&mut measurer);
+
+ measurer.max_line_length
+ };
+
+ if line_length > max_line_length {
+ return false;
+ }
+ // We don't want the extra alignment, it's already accounted for by the
+ // measurer.
+ self.line_started = true;
+ InnerWriter(self).write_all(&buffer).unwrap();
+ true
+ }
+
+ fn spaces(&self) -> usize {
+ *self.spaces.last().unwrap()
+ }
+
+ pub fn push_set_spaces(&mut self, spaces: usize) {
+ self.spaces.push(spaces);
+ }
+
+ pub fn pop_set_spaces(&mut self) {
+ self.pop_tab()
+ }
+
+ pub fn line_length_for_align(&self) -> usize {
+ if self.line_started {
+ self.line_length
+ } else {
+ self.line_length + self.spaces()
+ }
+ }
+
+ pub fn push_tab(&mut self) {
+ let spaces = self.spaces() - (self.spaces() % self.bindings.config.tab_width)
+ + self.bindings.config.tab_width;
+ self.spaces.push(spaces);
+ }
+
+ pub fn pop_tab(&mut self) {
+ assert!(!self.spaces.is_empty());
+ self.spaces.pop();
+ }
+
+ pub fn new_line(&mut self) {
+ self.out
+ .write_all(self.bindings.config.line_endings.as_str().as_bytes())
+ .unwrap();
+ self.line_started = false;
+ self.line_length = 0;
+ self.line_number += 1;
+ }
+
+ pub fn new_line_if_not_start(&mut self) {
+ if self.line_number != 1 {
+ self.new_line();
+ }
+ }
+
+ pub fn open_brace(&mut self) {
+ match self.bindings.config.language {
+ Language::Cxx | Language::C => match self.bindings.config.braces {
+ Braces::SameLine => {
+ self.write(" {");
+ self.push_tab();
+ self.new_line();
+ }
+ Braces::NextLine => {
+ self.new_line();
+ self.write("{");
+ self.push_tab();
+ self.new_line();
+ }
+ },
+ Language::Cython => {
+ self.write(":");
+ self.new_line();
+ self.push_tab();
+ }
+ }
+ }
+
+ pub fn close_brace(&mut self, semicolon: bool) {
+ self.pop_tab();
+ match self.bindings.config.language {
+ Language::Cxx | Language::C => {
+ self.new_line();
+ if semicolon {
+ self.write("};");
+ } else {
+ self.write("}");
+ }
+ }
+ Language::Cython => {}
+ }
+ }
+
+ pub fn write(&mut self, text: &'static str) {
+ write!(self, "{}", text);
+ }
+
+ pub fn write_raw_block(&mut self, block: &str) {
+ self.line_started = true;
+ write!(self, "{}", block);
+ }
+
+ pub fn write_fmt(&mut self, fmt: ::std::fmt::Arguments) {
+ InnerWriter(self).write_fmt(fmt).unwrap();
+ }
+
+ pub fn write_horizontal_source_list<
+ LB: LanguageBackend,
+ S,
+ WF: Fn(&mut LB, &mut SourceWriter<F>, &S),
+ >(
+ &mut self,
+ language_backend: &mut LB,
+ items: &[S],
+ list_type: ListType<'_>,
+ writer: WF,
+ ) {
+ for (i, item) in items.iter().enumerate() {
+ writer(language_backend, self, item);
+
+ match list_type {
+ ListType::Join(text) => {
+ if i != items.len() - 1 {
+ write!(self, "{}", text);
+ }
+ }
+ ListType::Cap(text) => {
+ write!(self, "{}", text);
+ }
+ }
+ }
+ }
+
+ pub fn write_vertical_source_list<
+ LB: LanguageBackend,
+ S,
+ WF: Fn(&mut LB, &mut SourceWriter<F>, &S),
+ >(
+ &mut self,
+ language_backend: &mut LB,
+ items: &[S],
+ list_type: ListType<'_>,
+ writer: WF,
+ ) {
+ let align_length = self.line_length_for_align();
+ self.push_set_spaces(align_length);
+ for (i, item) in items.iter().enumerate() {
+ writer(language_backend, self, item);
+
+ match list_type {
+ ListType::Join(text) => {
+ if i != items.len() - 1 {
+ write!(self, "{}", text);
+ }
+ }
+ ListType::Cap(text) => {
+ write!(self, "{}", text);
+ }
+ }
+
+ if i != items.len() - 1 {
+ self.new_line();
+ }
+ }
+ self.pop_tab();
+ }
+}
diff --git a/cbindgen-0.24.5/src/lib.rs b/cbindgen-0.27.0/src/lib.rs
similarity index 100%
rename from cbindgen-0.24.5/src/lib.rs
rename to cbindgen-0.27.0/src/lib.rs
diff --git a/cbindgen-0.27.0/src/logging.rs b/cbindgen-0.27.0/src/logging.rs
new file mode 100644
index 0000000..0b49ce2
--- /dev/null
+++ b/cbindgen-0.27.0/src/logging.rs
@@ -0,0 +1,105 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::io;
+use std::io::Write;
+
+use log::*;
+
+pub struct TraceLogger;
+pub struct WarnLogger;
+pub struct InfoLogger;
+pub struct ErrorLogger;
+
+impl TraceLogger {
+ pub fn init() -> Result<(), SetLoggerError> {
+ log::set_logger(&TraceLogger)?;
+ log::set_max_level(LevelFilter::Trace);
+ Ok(())
+ }
+}
+impl log::Log for TraceLogger {
+ fn enabled(&self, metadata: &Metadata) -> bool {
+ metadata.level() <= Level::Trace
+ }
+
+ fn log(&self, record: &Record) {
+ if self.enabled(record.metadata()) {
+ eprintln!("{}: {}", record.level(), record.args());
+ }
+ }
+
+ fn flush(&self) {
+ io::stderr().flush().unwrap();
+ }
+}
+
+impl WarnLogger {
+ pub fn init() -> Result<(), SetLoggerError> {
+ log::set_logger(&WarnLogger)?;
+ log::set_max_level(LevelFilter::Warn);
+ Ok(())
+ }
+}
+impl log::Log for WarnLogger {
+ fn enabled(&self, metadata: &Metadata) -> bool {
+ metadata.level() <= Level::Warn
+ }
+
+ fn log(&self, record: &Record) {
+ if self.enabled(record.metadata()) {
+ eprintln!("{}: {}", record.level(), record.args());
+ }
+ }
+
+ fn flush(&self) {
+ io::stderr().flush().unwrap();
+ }
+}
+
+impl ErrorLogger {
+ pub fn init() -> Result<(), SetLoggerError> {
+ log::set_logger(&ErrorLogger)?;
+ log::set_max_level(LevelFilter::Error);
+ Ok(())
+ }
+}
+impl log::Log for ErrorLogger {
+ fn enabled(&self, metadata: &Metadata) -> bool {
+ metadata.level() <= Level::Error
+ }
+
+ fn log(&self, record: &Record) {
+ if self.enabled(record.metadata()) {
+ eprintln!("{}: {}", record.level(), record.args());
+ }
+ }
+
+ fn flush(&self) {
+ io::stderr().flush().unwrap();
+ }
+}
+
+impl InfoLogger {
+ pub fn init() -> Result<(), SetLoggerError> {
+ log::set_logger(&InfoLogger)?;
+ log::set_max_level(LevelFilter::Info);
+ Ok(())
+ }
+}
+impl log::Log for InfoLogger {
+ fn enabled(&self, metadata: &Metadata) -> bool {
+ metadata.level() <= Level::Info
+ }
+
+ fn log(&self, record: &Record) {
+ if self.enabled(record.metadata()) {
+ eprintln!("{}: {}", record.level(), record.args());
+ }
+ }
+
+ fn flush(&self) {
+ io::stderr().flush().unwrap();
+ }
+}
diff --git a/cbindgen-0.27.0/src/main.rs b/cbindgen-0.27.0/src/main.rs
new file mode 100644
index 0000000..a6a1852
--- /dev/null
+++ b/cbindgen-0.27.0/src/main.rs
@@ -0,0 +1,353 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::env;
+use std::io;
+use std::path::{Path, PathBuf};
+use std::str::FromStr;
+
+extern crate clap;
+#[macro_use]
+extern crate log;
+extern crate proc_macro2;
+#[macro_use]
+extern crate serde;
+extern crate serde_json;
+#[macro_use]
+extern crate quote;
+#[macro_use]
+extern crate syn;
+extern crate toml;
+
+use clap::{value_parser, Arg, ArgAction, ArgMatches, Command};
+
+mod bindgen;
+mod logging;
+
+use bindgen::{Bindings, Builder, Cargo, Config, Error};
+
+fn apply_config_overrides(config: &mut Config, matches: &ArgMatches) {
+ // We allow specifying a language to override the config default. This is
+ // used by compile-tests.
+ match matches.try_get_one::<String>("lang") {
+ Ok(Some(lang)) => {
+ config.language = bindgen::Language::from_str(lang).unwrap();
+ }
+ Err(reason) => {
+ error!("{}", reason);
+ return;
+ }
+ _ => (),
+ }
+
+ if matches.get_flag("cpp-compat") {
+ config.cpp_compat = true;
+ }
+
+ if matches.get_flag("only-target-dependencies") {
+ config.only_target_dependencies = true;
+ }
+
+ if matches.get_flag("package-version") {
+ config.package_version = true;
+ }
+
+ match matches.try_get_one::<String>("style") {
+ Ok(Some(style)) => {
+ config.style = bindgen::Style::from_str(style).unwrap();
+ }
+ Err(_) => {
+ error!("Unknown style specified.");
+ return;
+ }
+ _ => (),
+ }
+
+ match matches.try_get_one::<String>("profile") {
+ Ok(Some(profile)) => {
+ config.parse.expand.profile = bindgen::Profile::from_str(profile).unwrap();
+ }
+ Err(e) => {
+ error!("{}", e);
+ return;
+ }
+ _ => (),
+ }
+
+ if matches.get_flag("d") {
+ config.parse.parse_deps = true;
+ }
+}
+
+fn load_bindings(input: &Path, matches: &ArgMatches) -> Result<Bindings, Error> {
+ // If a file is specified then we load it as a single source
+ if !input.is_dir() {
+ // Load any config specified or search in the input directory
+ let mut config = match matches.get_one::<PathBuf>("config") {
+ Some(c) => Config::from_file(c).unwrap(),
+ None => Config::from_root_or_default(
+ input
+ .parent()
+ .expect("All files should have a parent directory"),
+ ),
+ };
+
+ apply_config_overrides(&mut config, matches);
+
+ return Builder::new()
+ .with_config(config)
+ .with_src(input)
+ .generate();
+ }
+
+ // We have to load a whole crate, so we use cargo to gather metadata
+ let lib = Cargo::load(
+ input,
+ matches.get_one::<PathBuf>("lockfile").map(|s| s.as_path()),
+ matches.get_one::<String>("crate").map(|s| s.as_str()),
+ true,
+ matches.get_flag("clean"),
+ matches.get_flag("only-target-dependencies"),
+ matches.get_one::<PathBuf>("metadata").map(|p| p.as_path()),
+ )?;
+
+ // Load any config specified or search in the binding crate directory
+ let mut config = match matches.get_one::<PathBuf>("config") {
+ Some(c) => Config::from_file(c).unwrap(),
+ None => {
+ let binding_crate_dir = lib.find_crate_dir(&lib.binding_crate_ref());
+
+ if let Some(binding_crate_dir) = binding_crate_dir {
+ Config::from_root_or_default(binding_crate_dir)
+ } else {
+ // This shouldn't happen
+ Config::from_root_or_default(input)
+ }
+ }
+ };
+
+ apply_config_overrides(&mut config, matches);
+
+ Builder::new()
+ .with_config(config)
+ .with_cargo(lib)
+ .generate()
+}
+
+fn main() {
+ let matches = Command::new("cbindgen")
+ .version(bindgen::VERSION)
+ .about("Generate C bindings for a Rust library")
+ .arg(
+ Arg::new("v")
+ .short('v')
+ .action(ArgAction::Count)
+ .help("Enable verbose logging"),
+ )
+ .arg(
+ Arg::new("verify")
+ .long("verify")
+ .action(ArgAction::SetTrue)
+ .help("Generate bindings and compare it to the existing bindings file and error if they are different"),
+ )
+ .arg(
+ Arg::new("config")
+ .short('c')
+ .long("config")
+ .value_name("PATH")
+ .value_parser(value_parser!(PathBuf))
+ .help("Specify path to a `cbindgen.toml` config to use"),
+ )
+ .arg(
+ Arg::new("lang")
+ .short('l')
+ .long("lang")
+ .value_name("LANGUAGE")
+ .help("Specify the language to output bindings in")
+ .value_parser(["c++", "C++", "c", "C", "cython", "Cython"]),
+ )
+ .arg(
+ Arg::new("package-version")
+ .long("package-version")
+ .action(ArgAction::SetTrue)
+ .help("Include the package version in the header comment")
+ )
+ .arg(
+ Arg::new("cpp-compat")
+ .long("cpp-compat")
+ .action(ArgAction::SetTrue)
+ .help("Whether to add C++ compatibility to generated C bindings")
+ )
+ .arg(
+ Arg::new("only-target-dependencies")
+ .long("only-target-dependencies")
+ .action(ArgAction::SetTrue)
+ .help("Only fetch dependencies needed by the target platform. \
+ The target platform defaults to the host platform; set TARGET to override.")
+ )
+ .arg(
+ Arg::new("style")
+ .short('s')
+ .long("style")
+ .value_name("STYLE")
+ .help("Specify the declaration style to use for bindings")
+ .value_parser(["Both", "both", "Tag", "tag", "Type", "type"]),
+ )
+ .arg(
+ Arg::new("d")
+ .short('d')
+ .long("parse-dependencies")
+ .action(ArgAction::SetTrue)
+ .help("Whether to parse dependencies when generating bindings"),
+ )
+ .arg(
+ Arg::new("clean")
+ .long("clean")
+ .action(ArgAction::SetTrue)
+ .help(
+ "Whether to use a new temporary directory for expanding macros. \
+ Affects performance, but might be required in certain build processes.")
+ .required(false)
+ )
+ .arg(
+ Arg::new("INPUT")
+ .help(
+ "A crate directory or source file to generate bindings for. \
+ In general this is the folder where the Cargo.toml file of \
+ source Rust library resides.")
+ .required(false)
+ .value_parser(value_parser!(PathBuf))
+ .index(1),
+ )
+ .arg(
+ Arg::new("crate")
+ .long("crate")
+ .value_name("CRATE_NAME")
+ .help(
+ "If generating bindings for a crate, \
+ the specific crate to generate bindings for",
+ )
+ .required(false),
+ )
+ .arg(
+ Arg::new("out")
+ .short('o')
+ .long("output")
+ .value_name("PATH")
+ .help("The file to output the bindings to")
+ .value_parser(value_parser!(PathBuf))
+ .required(false),
+ )
+ .arg(
+ Arg::new("lockfile")
+ .long("lockfile")
+ .value_name("PATH")
+ .help(
+ "Specify the path to the Cargo.lock file explicitly. If this \
+ is not specified, the Cargo.lock file is searched for in the \
+ same folder as the Cargo.toml file. This option is useful for \
+ projects that use workspaces.")
+ .value_parser(value_parser!(PathBuf))
+ .required(false),
+ )
+ .arg(
+ Arg::new("metadata")
+ .long("metadata")
+ .value_name("PATH")
+ .help(
+ "Specify the path to the output of a `cargo metadata` \
+ command that allows to get dependency information. \
+ This is useful because cargo metadata may be the longest \
+ part of cbindgen runtime, and you may want to share it \
+ across cbindgen invocations. By default cbindgen will run \
+ `cargo metadata --all-features --format-version 1 \
+ --manifest-path <path/to/crate/Cargo.toml>"
+ )
+ .value_parser(value_parser!(PathBuf))
+ .required(false),
+ )
+ .arg(
+ Arg::new("profile")
+ .long("profile")
+ .value_name("PROFILE")
+ .help(
+ "Specify the profile to use when expanding macros. \
+ Has no effect otherwise."
+ )
+ .value_parser(["Debug", "debug", "Release", "release"]),
+ )
+ .arg(
+ Arg::new("quiet")
+ .short('q')
+ .long("quiet")
+ .action(ArgAction::SetTrue)
+ .help("Report errors only (overrides verbosity options).")
+ .required(false),
+ )
+ .arg(
+ Arg::new("depfile")
+ .value_name("PATH")
+ .long("depfile")
+ .num_args(1)
+ .required(false)
+ .value_parser(value_parser!(PathBuf))
+ .help("Generate a depfile at the given Path listing the source files \
+ cbindgen traversed when generating the bindings. Useful when \
+ integrating cbindgen into 3rd party build-systems. \
+ This option is ignored if `--out` is missing."
+ )
+ )
+ .get_matches();
+
+ if matches.get_flag("verify") && !matches.contains_id("out") {
+ error!(
+ "Cannot verify bindings against `stdout`, please specify a file to compare against."
+ );
+ std::process::exit(2);
+ }
+
+ // Initialize logging
+ if matches.get_flag("quiet") {
+ logging::ErrorLogger::init().unwrap();
+ } else {
+ match matches.get_count("v") {
+ 0 => logging::WarnLogger::init().unwrap(),
+ 1 => logging::InfoLogger::init().unwrap(),
+ _ => logging::TraceLogger::init().unwrap(),
+ }
+ }
+
+ // Find the input directory
+ let input: PathBuf = matches
+ .get_one("INPUT")
+ .cloned()
+ .unwrap_or_else(|| env::current_dir().unwrap());
+
+ let bindings = match load_bindings(&input, &matches) {
+ Ok(bindings) => bindings,
+ Err(msg) => {
+ error!("{}", msg);
+ error!("Couldn't generate bindings for {}.", input.display());
+ std::process::exit(1);
+ }
+ };
+
+ // Write the bindings file
+ match matches.get_one::<PathBuf>("out") {
+ Some(file) => {
+ let changed = bindings.write_to_file(file);
+
+ if matches.get_flag("verify") && changed {
+ error!("Bindings changed: {}", file.display());
+ std::process::exit(2);
+ }
+ if let Some(depfile) = matches.get_one("depfile") {
+ bindings.generate_depfile(file, depfile)
+ }
+ }
+ _ => {
+ bindings.write(io::stdout());
+ }
+ }
+}
diff --git a/cbindgen-0.27.0/template.toml b/cbindgen-0.27.0/template.toml
new file mode 100644
index 0000000..a2f18a6
--- /dev/null
+++ b/cbindgen-0.27.0/template.toml
@@ -0,0 +1,159 @@
+# This is a template cbindgen.toml file with all of the default values.
+# Some values are commented out because their absence is the real default.
+#
+# See https://github.com/mozilla/cbindgen/blob/master/docs.md#cbindgentoml
+# for detailed documentation of every option here.
+
+
+
+language = "C++"
+
+
+
+############## Options for Wrapping the Contents of the Header #################
+
+# header = "/* Text to put at the beginning of the generated file. Probably a license. */"
+# trailer = "/* Text to put at the end of the generated file */"
+# include_guard = "my_bindings_h"
+# pragma_once = true
+# autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
+include_version = false
+# namespace = "my_namespace"
+namespaces = []
+using_namespaces = []
+sys_includes = []
+includes = []
+no_includes = false
+# cpp_compat = true
+after_includes = ""
+
+
+
+
+############################ Code Style Options ################################
+
+braces = "SameLine"
+line_length = 100
+tab_width = 2
+documentation = true
+documentation_style = "auto"
+documentation_length = "full"
+line_endings = "LF" # also "CR", "CRLF", "Native"
+
+
+
+
+############################# Codegen Options ##################################
+
+style = "both"
+sort_by = "Name" # default for `fn.sort_by` and `const.sort_by`
+usize_is_size_t = true
+
+
+
+[defines]
+# "target_os = freebsd" = "DEFINE_FREEBSD"
+# "feature = serde" = "DEFINE_SERDE"
+
+
+
+[export]
+include = []
+exclude = []
+# prefix = "CAPI_"
+item_types = []
+renaming_overrides_prefixing = false
+
+
+
+[export.rename]
+
+
+
+[export.body]
+
+
+[export.mangle]
+
+
+[fn]
+rename_args = "None"
+# must_use = "MUST_USE_FUNC"
+# deprecated = "DEPRECATED_FUNC"
+# deprecated_with_note = "DEPRECATED_FUNC_WITH_NOTE"
+# no_return = "NO_RETURN"
+# prefix = "START_FUNC"
+# postfix = "END_FUNC"
+args = "auto"
+sort_by = "Name"
+
+
+
+
+[struct]
+rename_fields = "None"
+# must_use = "MUST_USE_STRUCT"
+# deprecated = "DEPRECATED_STRUCT"
+# deprecated_with_note = "DEPRECATED_STRUCT_WITH_NOTE"
+derive_constructor = false
+derive_eq = false
+derive_neq = false
+derive_lt = false
+derive_lte = false
+derive_gt = false
+derive_gte = false
+
+
+
+
+[enum]
+rename_variants = "None"
+# must_use = "MUST_USE_ENUM"
+# deprecated = "DEPRECATED_ENUM"
+# deprecated_with_note = "DEPRECATED_ENUM_WITH_NOTE"
+add_sentinel = false
+prefix_with_name = false
+derive_helper_methods = false
+derive_const_casts = false
+derive_mut_casts = false
+# cast_assert_name = "ASSERT"
+derive_tagged_enum_destructor = false
+derive_tagged_enum_copy_constructor = false
+enum_class = true
+private_default_tagged_enum_constructor = false
+
+
+
+
+[const]
+allow_static_const = true
+allow_constexpr = false
+sort_by = "Name"
+
+
+
+
+[macro_expansion]
+bitflags = false
+
+
+
+
+
+
+############## Options for How Your Rust library Should Be Parsed ##############
+
+[parse]
+parse_deps = false
+# include = []
+exclude = []
+clean = false
+extra_bindings = []
+
+
+
+[parse.expand]
+crates = []
+all_features = false
+default_features = true
+features = []
diff --git a/cbindgen-0.27.0/tests/depfile.rs b/cbindgen-0.27.0/tests/depfile.rs
new file mode 100644
index 0000000..512f69b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/depfile.rs
@@ -0,0 +1,116 @@
+use std::fs::read_to_string;
+use std::path::PathBuf;
+use std::process::Command;
+
+static CBINDGEN_PATH: &str = env!("CARGO_BIN_EXE_cbindgen");
+
+fn test_project(project_path: &str) {
+ let mut cmake_cmd = Command::new("cmake");
+ cmake_cmd.arg("--version");
+ cmake_cmd
+ .output()
+ .expect("CMake --version failed - Is CMake installed?");
+
+ let mut cmake_configure = Command::new("cmake");
+ let build_dir = PathBuf::from(project_path).join("build");
+ if build_dir.exists() {
+ std::fs::remove_dir_all(&build_dir).expect("Failed to remove old build directory");
+ }
+ let project_dir = PathBuf::from(project_path);
+
+ let cbindgen_define = format!("-DCBINDGEN_PATH={}", CBINDGEN_PATH);
+ cmake_configure
+ .arg("-S")
+ .arg(project_path)
+ .arg("-B")
+ .arg(&build_dir)
+ .arg(cbindgen_define);
+ let output = cmake_configure.output().expect("Failed to execute process");
+ let stdout_str = String::from_utf8(output.stdout).unwrap();
+ let stderr_str = String::from_utf8(output.stderr).unwrap();
+ assert!(
+ output.status.success(),
+ "Configuring test project failed: stdout: `{}`, stderr: `{}`",
+ stdout_str,
+ stderr_str
+ );
+ let depfile_path = build_dir.join("depfile.d");
+ assert!(
+ !depfile_path.exists(),
+ "depfile should not exist before building"
+ );
+
+ // Do the clean first build
+ let mut cmake_build = Command::new("cmake");
+ cmake_build.arg("--build").arg(&build_dir);
+ let output = cmake_build.output().expect("Failed to execute process");
+ assert!(
+ output.status.success(),
+ "Building test project failed: {:?}",
+ output
+ );
+ let out_str = String::from_utf8(output.stdout).unwrap();
+ assert!(
+ out_str.contains("Running cbindgen"),
+ "cbindgen rule did not run. Output: {}",
+ out_str
+ );
+
+ assert!(
+ depfile_path.exists(),
+ "depfile does not exist after building"
+ );
+
+ let expected_dependencies_filepath = PathBuf::from(project_path)
+ .join("expectations")
+ .join("dependencies");
+ assert!(
+ expected_dependencies_filepath.exists(),
+ "Test did not define expected dependencies. Please read the Readme.md"
+ );
+ let expected_deps =
+ read_to_string(expected_dependencies_filepath).expect("Failed to read dependencies");
+ let depinfo = read_to_string(depfile_path).expect("Failed to read dependencies");
+ // Assumes a single rule in the file - all deps are listed to the rhs of the `:`.
+ let actual_deps = depinfo.split(':').collect::<Vec<_>>()[1];
+ // Strip the line breaks.
+ let actual_deps = actual_deps.replace("\\\n", " ");
+ // I don't want to deal with supporting escaped whitespace when splitting at whitespace,
+ // so the tests don't support being run in a directory containing whitespace.
+ assert!(
+ !actual_deps.contains("\\ "),
+ "The tests directory may not contain any whitespace"
+ );
+ let dep_list: Vec<&str> = actual_deps.split_ascii_whitespace().collect();
+ let expected_dep_list: Vec<String> = expected_deps
+ .lines()
+ .map(|dep| project_dir.join(dep).to_str().unwrap().to_string())
+ .collect();
+ assert_eq!(dep_list, expected_dep_list);
+
+ let output = cmake_build.output().expect("Failed to execute process");
+ assert!(
+ output.status.success(),
+ "Building test project failed: {:?}",
+ output
+ );
+ let out_str = String::from_utf8(output.stdout).unwrap();
+ assert!(
+ !out_str.contains("Running cbindgen"),
+ "cbindgen rule ran on second build"
+ );
+
+ std::fs::remove_dir_all(build_dir).expect("Failed to remove old build directory");
+}
+
+macro_rules! test_file {
+ ($test_function_name:ident, $name:expr, $file:tt) => {
+ #[test]
+ fn $test_function_name() {
+ test_project($file);
+ }
+ };
+}
+
+// This file is generated by build.rs
+include!(concat!(env!("OUT_DIR"), "/depfile_tests.rs"));
diff --git a/cbindgen-0.27.0/tests/depfile/Readme.md b/cbindgen-0.27.0/tests/depfile/Readme.md
new file mode 100644
index 0000000..d7f8b1a
--- /dev/null
+++ b/cbindgen-0.27.0/tests/depfile/Readme.md
@@ -0,0 +1,11 @@
+This a folder containing tests for `--depfile` parameter.
+Each test is in a subfolder and defines a minimum CMake project,
+which uses cbindgen to generate Rust bindings and the `--depfile`
+parameter to determine when to regenerate.
+The outer test can the build the project, assert that rebuilding does not regenerate the
+bindings, and then assert that touching the files involved does trigger rebuilding.
+
+The test project must contain an `expectations` folder, containing a file `dependencies`.
+This `dependencies` should list all files that should be listed as dependencies in the generated
+depfile. The paths should be relative to the project folder (i.e. to the folder containing
+`expectations`).
diff --git a/cbindgen-0.27.0/tests/depfile/cbindgen_test.cmake b/cbindgen-0.27.0/tests/depfile/cbindgen_test.cmake
new file mode 100644
index 0000000..752c3c3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/depfile/cbindgen_test.cmake
@@ -0,0 +1,27 @@
+# Common code used across the different tests
+
+if(NOT DEFINED CBINDGEN_PATH)
+ message(FATAL_ERROR "Path to cbindgen not specified")
+endif()
+
+# Promote to cache
+set(CBINDGEN_PATH "${CBINDGEN_PATH}" CACHE INTERNAL "")
+
+function(add_cbindgen_command custom_target_name header_destination)
+ # Place the depfile always at the same location, so the outer test framework can locate the file easily
+ set(depfile_destination "${CMAKE_BINARY_DIR}/depfile.d")
+ add_custom_command(
+ OUTPUT
+ "${header_destination}" "${depfile_destination}"
+ COMMAND
+ "${CBINDGEN_PATH}"
+ --output "${header_destination}"
+ --depfile "${depfile_destination}"
+ ${ARGN}
+ DEPFILE "${depfile_destination}"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ COMMENT "Running cbindgen"
+ COMMAND_EXPAND_LISTS
+ )
+ add_custom_target("${custom_target_name}" ALL DEPENDS "${header_destination}")
+endfunction()
\ No newline at end of file
diff --git a/cbindgen-0.27.0/tests/expectations/abi_string.c b/cbindgen-0.27.0/tests/expectations/abi_string.c
new file mode 100644
index 0000000..6a7a590
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/abi_string.c
@@ -0,0 +1,8 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+void c(void);
+
+void c_unwind(void);
diff --git a/cbindgen-0.27.0/tests/expectations/abi_string.compat.c b/cbindgen-0.27.0/tests/expectations/abi_string.compat.c
new file mode 100644
index 0000000..a69e63c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/abi_string.compat.c
@@ -0,0 +1,16 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void c(void);
+
+void c_unwind(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/abi_string.cpp b/cbindgen-0.27.0/tests/expectations/abi_string.cpp
new file mode 100644
index 0000000..dfebc85
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/abi_string.cpp
@@ -0,0 +1,13 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+void c();
+
+void c_unwind();
+
+} // extern "C"
diff --git a/cbindgen-0.27.0/tests/expectations/abi_string.pyx b/cbindgen-0.27.0/tests/expectations/abi_string.pyx
new file mode 100644
index 0000000..59a83d3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/abi_string.pyx
@@ -0,0 +1,11 @@
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ void c();
+
+ void c_unwind();
diff --git a/cbindgen-0.24.5/tests/expectations/alias.c b/cbindgen-0.27.0/tests/expectations/alias.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/alias.c
rename to cbindgen-0.27.0/tests/expectations/alias.c
diff --git a/cbindgen-0.27.0/tests/expectations/alias.compat.c b/cbindgen-0.27.0/tests/expectations/alias.compat.c
new file mode 100644
index 0000000..565fb53
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/alias.compat.c
@@ -0,0 +1,51 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum Status
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ Ok,
+ Err,
+};
+#ifndef __cplusplus
+typedef uint32_t Status;
+#endif // __cplusplus
+
+typedef struct {
+ int32_t a;
+ float b;
+} Dep;
+
+typedef struct {
+ int32_t a;
+ int32_t b;
+ Dep c;
+} Foo_i32;
+
+typedef Foo_i32 IntFoo;
+
+typedef struct {
+ double a;
+ double b;
+ Dep c;
+} Foo_f64;
+
+typedef Foo_f64 DoubleFoo;
+
+typedef int32_t Unit;
+
+typedef Status SpecialStatus;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/alias.cpp b/cbindgen-0.27.0/tests/expectations/alias.cpp
new file mode 100644
index 0000000..38dd760
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/alias.cpp
@@ -0,0 +1,36 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+enum class Status : uint32_t {
+ Ok,
+ Err,
+};
+
+struct Dep {
+ int32_t a;
+ float b;
+};
+
+template<typename X>
+struct Foo {
+ X a;
+ X b;
+ Dep c;
+};
+
+using IntFoo = Foo<int32_t>;
+
+using DoubleFoo = Foo<double>;
+
+using Unit = int32_t;
+
+using SpecialStatus = Status;
+
+extern "C" {
+
+void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/alias.pyx b/cbindgen-0.27.0/tests/expectations/alias.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/alias.pyx
rename to cbindgen-0.27.0/tests/expectations/alias.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/alias.both.c b/cbindgen-0.27.0/tests/expectations/alias_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/alias.both.c
rename to cbindgen-0.27.0/tests/expectations/alias_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/alias_both.compat.c b/cbindgen-0.27.0/tests/expectations/alias_both.compat.c
new file mode 100644
index 0000000..a48b899
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/alias_both.compat.c
@@ -0,0 +1,51 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum Status
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ Ok,
+ Err,
+};
+#ifndef __cplusplus
+typedef uint32_t Status;
+#endif // __cplusplus
+
+typedef struct Dep {
+ int32_t a;
+ float b;
+} Dep;
+
+typedef struct Foo_i32 {
+ int32_t a;
+ int32_t b;
+ struct Dep c;
+} Foo_i32;
+
+typedef struct Foo_i32 IntFoo;
+
+typedef struct Foo_f64 {
+ double a;
+ double b;
+ struct Dep c;
+} Foo_f64;
+
+typedef struct Foo_f64 DoubleFoo;
+
+typedef int32_t Unit;
+
+typedef Status SpecialStatus;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/alias.tag.c b/cbindgen-0.27.0/tests/expectations/alias_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/alias.tag.c
rename to cbindgen-0.27.0/tests/expectations/alias_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/alias_tag.compat.c b/cbindgen-0.27.0/tests/expectations/alias_tag.compat.c
new file mode 100644
index 0000000..9f04708
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/alias_tag.compat.c
@@ -0,0 +1,51 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum Status
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ Ok,
+ Err,
+};
+#ifndef __cplusplus
+typedef uint32_t Status;
+#endif // __cplusplus
+
+struct Dep {
+ int32_t a;
+ float b;
+};
+
+struct Foo_i32 {
+ int32_t a;
+ int32_t b;
+ struct Dep c;
+};
+
+typedef struct Foo_i32 IntFoo;
+
+struct Foo_f64 {
+ double a;
+ double b;
+ struct Dep c;
+};
+
+typedef struct Foo_f64 DoubleFoo;
+
+typedef int32_t Unit;
+
+typedef Status SpecialStatus;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/alias.tag.pyx b/cbindgen-0.27.0/tests/expectations/alias_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/alias.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/alias_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/annotation.c b/cbindgen-0.27.0/tests/expectations/annotation.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/annotation.c
rename to cbindgen-0.27.0/tests/expectations/annotation.c
diff --git a/cbindgen-0.27.0/tests/expectations/annotation.compat.c b/cbindgen-0.27.0/tests/expectations/annotation.compat.c
new file mode 100644
index 0000000..4a90fca
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/annotation.compat.c
@@ -0,0 +1,91 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum C
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ X = 2,
+ Y,
+};
+#ifndef __cplusplus
+typedef uint32_t C;
+#endif // __cplusplus
+
+typedef struct {
+ int32_t m0;
+} A;
+
+typedef struct {
+ int32_t x;
+ float y;
+} B;
+
+enum F_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo,
+ Bar,
+ Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t F_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ F_Tag tag;
+ uint8_t x;
+ int16_t y;
+} Bar_Body;
+
+typedef union {
+ F_Tag tag;
+ struct {
+ F_Tag foo_tag;
+ int16_t foo;
+ };
+ Bar_Body bar;
+} F;
+
+enum H_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Hello,
+ There,
+ Everyone,
+};
+#ifndef __cplusplus
+typedef uint8_t H_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ uint8_t x;
+ int16_t y;
+} There_Body;
+
+typedef struct {
+ H_Tag tag;
+ union {
+ struct {
+ int16_t hello;
+ };
+ There_Body there;
+ };
+} H;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(A x, B y, C z, F f, H h);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/annotation.cpp b/cbindgen-0.27.0/tests/expectations/annotation.cpp
new file mode 100644
index 0000000..1197f45
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/annotation.cpp
@@ -0,0 +1,152 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+enum class C : uint32_t {
+ X = 2,
+ Y,
+};
+
+struct A {
+ int32_t m0;
+
+ A(int32_t const& m0)
+ : m0(m0)
+ {}
+
+ bool operator<(const A& other) const {
+ return m0 < other.m0;
+ }
+ bool operator<=(const A& other) const {
+ return m0 <= other.m0;
+ }
+};
+
+struct B {
+ int32_t x;
+ float y;
+};
+
+union F {
+ enum class Tag : uint8_t {
+ Foo,
+ Bar,
+ Baz,
+ };
+
+ struct Foo_Body {
+ Tag tag;
+ int16_t _0;
+ };
+
+ struct Bar_Body {
+ Tag tag;
+ uint8_t x;
+ int16_t y;
+ };
+
+ struct {
+ Tag tag;
+ };
+ Foo_Body foo;
+ Bar_Body bar;
+
+ static F Foo(const int16_t &_0) {
+ F result;
+ ::new (&result.foo._0) (int16_t)(_0);
+ result.tag = Tag::Foo;
+ return result;
+ }
+
+ bool IsFoo() const {
+ return tag == Tag::Foo;
+ }
+
+ static F Bar(const uint8_t &x,
+ const int16_t &y) {
+ F result;
+ ::new (&result.bar.x) (uint8_t)(x);
+ ::new (&result.bar.y) (int16_t)(y);
+ result.tag = Tag::Bar;
+ return result;
+ }
+
+ bool IsBar() const {
+ return tag == Tag::Bar;
+ }
+
+ static F Baz() {
+ F result;
+ result.tag = Tag::Baz;
+ return result;
+ }
+
+ bool IsBaz() const {
+ return tag == Tag::Baz;
+ }
+};
+
+struct H {
+ enum class Tag : uint8_t {
+ Hello,
+ There,
+ Everyone,
+ };
+
+ struct Hello_Body {
+ int16_t _0;
+ };
+
+ struct There_Body {
+ uint8_t x;
+ int16_t y;
+ };
+
+ Tag tag;
+ union {
+ Hello_Body hello;
+ There_Body there;
+ };
+
+ static H Hello(const int16_t &_0) {
+ H result;
+ ::new (&result.hello._0) (int16_t)(_0);
+ result.tag = Tag::Hello;
+ return result;
+ }
+
+ bool IsHello() const {
+ return tag == Tag::Hello;
+ }
+
+ static H There(const uint8_t &x,
+ const int16_t &y) {
+ H result;
+ ::new (&result.there.x) (uint8_t)(x);
+ ::new (&result.there.y) (int16_t)(y);
+ result.tag = Tag::There;
+ return result;
+ }
+
+ bool IsThere() const {
+ return tag == Tag::There;
+ }
+
+ static H Everyone() {
+ H result;
+ result.tag = Tag::Everyone;
+ return result;
+ }
+
+ bool IsEveryone() const {
+ return tag == Tag::Everyone;
+ }
+};
+
+extern "C" {
+
+void root(A x, B y, C z, F f, H h);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/annotation.pyx b/cbindgen-0.27.0/tests/expectations/annotation.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/annotation.pyx
rename to cbindgen-0.27.0/tests/expectations/annotation.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/annotation.both.c b/cbindgen-0.27.0/tests/expectations/annotation_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/annotation.both.c
rename to cbindgen-0.27.0/tests/expectations/annotation_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/annotation_both.compat.c b/cbindgen-0.27.0/tests/expectations/annotation_both.compat.c
new file mode 100644
index 0000000..57d9f29
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/annotation_both.compat.c
@@ -0,0 +1,91 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum C
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ X = 2,
+ Y,
+};
+#ifndef __cplusplus
+typedef uint32_t C;
+#endif // __cplusplus
+
+typedef struct A {
+ int32_t m0;
+} A;
+
+typedef struct B {
+ int32_t x;
+ float y;
+} B;
+
+enum F_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo,
+ Bar,
+ Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t F_Tag;
+#endif // __cplusplus
+
+typedef struct Bar_Body {
+ F_Tag tag;
+ uint8_t x;
+ int16_t y;
+} Bar_Body;
+
+typedef union F {
+ F_Tag tag;
+ struct {
+ F_Tag foo_tag;
+ int16_t foo;
+ };
+ Bar_Body bar;
+} F;
+
+enum H_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Hello,
+ There,
+ Everyone,
+};
+#ifndef __cplusplus
+typedef uint8_t H_Tag;
+#endif // __cplusplus
+
+typedef struct There_Body {
+ uint8_t x;
+ int16_t y;
+} There_Body;
+
+typedef struct H {
+ H_Tag tag;
+ union {
+ struct {
+ int16_t hello;
+ };
+ There_Body there;
+ };
+} H;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct A x, struct B y, C z, union F f, struct H h);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/annotation.tag.c b/cbindgen-0.27.0/tests/expectations/annotation_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/annotation.tag.c
rename to cbindgen-0.27.0/tests/expectations/annotation_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/annotation_tag.compat.c b/cbindgen-0.27.0/tests/expectations/annotation_tag.compat.c
new file mode 100644
index 0000000..ab02261
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/annotation_tag.compat.c
@@ -0,0 +1,91 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum C
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ X = 2,
+ Y,
+};
+#ifndef __cplusplus
+typedef uint32_t C;
+#endif // __cplusplus
+
+struct A {
+ int32_t m0;
+};
+
+struct B {
+ int32_t x;
+ float y;
+};
+
+enum F_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo,
+ Bar,
+ Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t F_Tag;
+#endif // __cplusplus
+
+struct Bar_Body {
+ F_Tag tag;
+ uint8_t x;
+ int16_t y;
+};
+
+union F {
+ F_Tag tag;
+ struct {
+ F_Tag foo_tag;
+ int16_t foo;
+ };
+ struct Bar_Body bar;
+};
+
+enum H_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Hello,
+ There,
+ Everyone,
+};
+#ifndef __cplusplus
+typedef uint8_t H_Tag;
+#endif // __cplusplus
+
+struct There_Body {
+ uint8_t x;
+ int16_t y;
+};
+
+struct H {
+ H_Tag tag;
+ union {
+ struct {
+ int16_t hello;
+ };
+ struct There_Body there;
+ };
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct A x, struct B y, C z, union F f, struct H h);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/annotation.tag.pyx b/cbindgen-0.27.0/tests/expectations/annotation_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/annotation.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/annotation_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/array.c b/cbindgen-0.27.0/tests/expectations/array.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/array.c
rename to cbindgen-0.27.0/tests/expectations/array.c
diff --git a/cbindgen-0.27.0/tests/expectations/array.compat.c b/cbindgen-0.27.0/tests/expectations/array.compat.c
new file mode 100644
index 0000000..6a829e1
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/array.compat.c
@@ -0,0 +1,27 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef enum {
+ A,
+} Foo_Tag;
+
+typedef struct {
+ Foo_Tag tag;
+ union {
+ struct {
+ float a[20];
+ };
+ };
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/array.cpp b/cbindgen-0.27.0/tests/expectations/array.cpp
new file mode 100644
index 0000000..7e34fe9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/array.cpp
@@ -0,0 +1,39 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Foo {
+ enum class Tag {
+ A,
+ };
+
+ struct A_Body {
+ float _0[20];
+ };
+
+ Tag tag;
+ union {
+ A_Body a;
+ };
+
+ static Foo A(const float (&_0)[20]) {
+ Foo result;
+ for (int i = 0; i < 20; i++) {
+ ::new (&result.a._0[i]) (float)(_0[i]);
+ }
+ result.tag = Tag::A;
+ return result;
+ }
+
+ bool IsA() const {
+ return tag == Tag::A;
+ }
+};
+
+extern "C" {
+
+void root(Foo a);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/array.pyx b/cbindgen-0.27.0/tests/expectations/array.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/array.pyx
rename to cbindgen-0.27.0/tests/expectations/array.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/array.both.c b/cbindgen-0.27.0/tests/expectations/array_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/array.both.c
rename to cbindgen-0.27.0/tests/expectations/array_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/array_both.compat.c b/cbindgen-0.27.0/tests/expectations/array_both.compat.c
new file mode 100644
index 0000000..ef3a791
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/array_both.compat.c
@@ -0,0 +1,27 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef enum Foo_Tag {
+ A,
+} Foo_Tag;
+
+typedef struct Foo {
+ Foo_Tag tag;
+ union {
+ struct {
+ float a[20];
+ };
+ };
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/array.tag.c b/cbindgen-0.27.0/tests/expectations/array_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/array.tag.c
rename to cbindgen-0.27.0/tests/expectations/array_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/array_tag.compat.c b/cbindgen-0.27.0/tests/expectations/array_tag.compat.c
new file mode 100644
index 0000000..0a9a531
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/array_tag.compat.c
@@ -0,0 +1,27 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum Foo_Tag {
+ A,
+};
+
+struct Foo {
+ enum Foo_Tag tag;
+ union {
+ struct {
+ float a[20];
+ };
+ };
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/array.tag.pyx b/cbindgen-0.27.0/tests/expectations/array_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/array.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/array_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/asserted_cast.c b/cbindgen-0.27.0/tests/expectations/asserted_cast.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/asserted_cast.c
rename to cbindgen-0.27.0/tests/expectations/asserted_cast.c
diff --git a/cbindgen-0.27.0/tests/expectations/asserted_cast.compat.c b/cbindgen-0.27.0/tests/expectations/asserted_cast.compat.c
new file mode 100644
index 0000000..2d75731
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/asserted_cast.compat.c
@@ -0,0 +1,104 @@
+#define MY_ASSERT(...) do { } while (0)
+#define MY_ATTRS __attribute((noinline))
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct I I;
+
+enum H_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ H_Foo,
+ H_Bar,
+ H_Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t H_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ uint8_t x;
+ int16_t y;
+} H_Bar_Body;
+
+typedef struct {
+ H_Tag tag;
+ union {
+ struct {
+ int16_t foo;
+ };
+ H_Bar_Body bar;
+ };
+} H;
+
+enum J_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ J_Foo,
+ J_Bar,
+ J_Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t J_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ uint8_t x;
+ int16_t y;
+} J_Bar_Body;
+
+typedef struct {
+ J_Tag tag;
+ union {
+ struct {
+ int16_t foo;
+ };
+ J_Bar_Body bar;
+ };
+} J;
+
+enum K_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ K_Foo,
+ K_Bar,
+ K_Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t K_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ K_Tag tag;
+ uint8_t x;
+ int16_t y;
+} K_Bar_Body;
+
+typedef union {
+ K_Tag tag;
+ struct {
+ K_Tag foo_tag;
+ int16_t foo;
+ };
+ K_Bar_Body bar;
+} K;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void foo(H h, I i, J j, K k);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/asserted_cast.cpp b/cbindgen-0.27.0/tests/expectations/asserted_cast.cpp
new file mode 100644
index 0000000..3dfe520
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/asserted_cast.cpp
@@ -0,0 +1,250 @@
+#define MY_ASSERT(...) do { } while (0)
+#define MY_ATTRS __attribute((noinline))
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct I;
+
+struct H {
+ enum class Tag : uint8_t {
+ H_Foo,
+ H_Bar,
+ H_Baz,
+ };
+
+ struct H_Foo_Body {
+ int16_t _0;
+ };
+
+ struct H_Bar_Body {
+ uint8_t x;
+ int16_t y;
+ };
+
+ Tag tag;
+ union {
+ H_Foo_Body foo;
+ H_Bar_Body bar;
+ };
+
+ static H H_Foo(const int16_t &_0) {
+ H result;
+ ::new (&result.foo._0) (int16_t)(_0);
+ result.tag = Tag::H_Foo;
+ return result;
+ }
+
+ bool IsH_Foo() const {
+ return tag == Tag::H_Foo;
+ }
+
+ const int16_t& AsH_Foo() const {
+ MY_ASSERT(IsH_Foo());
+ return foo._0;
+ }
+
+ MY_ATTRS int16_t& AsH_Foo() {
+ MY_ASSERT(IsH_Foo());
+ return foo._0;
+ }
+
+ static H H_Bar(const uint8_t &x,
+ const int16_t &y) {
+ H result;
+ ::new (&result.bar.x) (uint8_t)(x);
+ ::new (&result.bar.y) (int16_t)(y);
+ result.tag = Tag::H_Bar;
+ return result;
+ }
+
+ bool IsH_Bar() const {
+ return tag == Tag::H_Bar;
+ }
+
+ MY_ATTRS const H_Bar_Body& AsH_Bar() const {
+ MY_ASSERT(IsH_Bar());
+ return bar;
+ }
+
+ H_Bar_Body& AsH_Bar() {
+ MY_ASSERT(IsH_Bar());
+ return bar;
+ }
+
+ static H H_Baz() {
+ H result;
+ result.tag = Tag::H_Baz;
+ return result;
+ }
+
+ MY_ATTRS bool IsH_Baz() const {
+ return tag == Tag::H_Baz;
+ }
+};
+
+struct J {
+ enum class Tag : uint8_t {
+ J_Foo,
+ J_Bar,
+ J_Baz,
+ };
+
+ struct J_Foo_Body {
+ int16_t _0;
+ };
+
+ struct J_Bar_Body {
+ uint8_t x;
+ int16_t y;
+ };
+
+ Tag tag;
+ union {
+ J_Foo_Body foo;
+ J_Bar_Body bar;
+ };
+
+ static J J_Foo(const int16_t &_0) {
+ J result;
+ ::new (&result.foo._0) (int16_t)(_0);
+ result.tag = Tag::J_Foo;
+ return result;
+ }
+
+ bool IsJ_Foo() const {
+ return tag == Tag::J_Foo;
+ }
+
+ const int16_t& AsJ_Foo() const {
+ MY_ASSERT(IsJ_Foo());
+ return foo._0;
+ }
+
+ int16_t& AsJ_Foo() {
+ MY_ASSERT(IsJ_Foo());
+ return foo._0;
+ }
+
+ static J J_Bar(const uint8_t &x,
+ const int16_t &y) {
+ J result;
+ ::new (&result.bar.x) (uint8_t)(x);
+ ::new (&result.bar.y) (int16_t)(y);
+ result.tag = Tag::J_Bar;
+ return result;
+ }
+
+ bool IsJ_Bar() const {
+ return tag == Tag::J_Bar;
+ }
+
+ const J_Bar_Body& AsJ_Bar() const {
+ MY_ASSERT(IsJ_Bar());
+ return bar;
+ }
+
+ J_Bar_Body& AsJ_Bar() {
+ MY_ASSERT(IsJ_Bar());
+ return bar;
+ }
+
+ static J J_Baz() {
+ J result;
+ result.tag = Tag::J_Baz;
+ return result;
+ }
+
+ bool IsJ_Baz() const {
+ return tag == Tag::J_Baz;
+ }
+};
+
+union K {
+ enum class Tag : uint8_t {
+ K_Foo,
+ K_Bar,
+ K_Baz,
+ };
+
+ struct K_Foo_Body {
+ Tag tag;
+ int16_t _0;
+ };
+
+ struct K_Bar_Body {
+ Tag tag;
+ uint8_t x;
+ int16_t y;
+ };
+
+ struct {
+ Tag tag;
+ };
+ K_Foo_Body foo;
+ K_Bar_Body bar;
+
+ static K K_Foo(const int16_t &_0) {
+ K result;
+ ::new (&result.foo._0) (int16_t)(_0);
+ result.tag = Tag::K_Foo;
+ return result;
+ }
+
+ bool IsK_Foo() const {
+ return tag == Tag::K_Foo;
+ }
+
+ const int16_t& AsK_Foo() const {
+ MY_ASSERT(IsK_Foo());
+ return foo._0;
+ }
+
+ int16_t& AsK_Foo() {
+ MY_ASSERT(IsK_Foo());
+ return foo._0;
+ }
+
+ static K K_Bar(const uint8_t &x,
+ const int16_t &y) {
+ K result;
+ ::new (&result.bar.x) (uint8_t)(x);
+ ::new (&result.bar.y) (int16_t)(y);
+ result.tag = Tag::K_Bar;
+ return result;
+ }
+
+ bool IsK_Bar() const {
+ return tag == Tag::K_Bar;
+ }
+
+ const K_Bar_Body& AsK_Bar() const {
+ MY_ASSERT(IsK_Bar());
+ return bar;
+ }
+
+ K_Bar_Body& AsK_Bar() {
+ MY_ASSERT(IsK_Bar());
+ return bar;
+ }
+
+ static K K_Baz() {
+ K result;
+ result.tag = Tag::K_Baz;
+ return result;
+ }
+
+ bool IsK_Baz() const {
+ return tag == Tag::K_Baz;
+ }
+};
+
+extern "C" {
+
+void foo(H h, I i, J j, K k);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/asserted_cast.pyx b/cbindgen-0.27.0/tests/expectations/asserted_cast.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/asserted_cast.pyx
rename to cbindgen-0.27.0/tests/expectations/asserted_cast.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/asserted_cast.both.c b/cbindgen-0.27.0/tests/expectations/asserted_cast_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/asserted_cast.both.c
rename to cbindgen-0.27.0/tests/expectations/asserted_cast_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/asserted_cast_both.compat.c b/cbindgen-0.27.0/tests/expectations/asserted_cast_both.compat.c
new file mode 100644
index 0000000..815190b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/asserted_cast_both.compat.c
@@ -0,0 +1,104 @@
+#define MY_ASSERT(...) do { } while (0)
+#define MY_ATTRS __attribute((noinline))
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct I I;
+
+enum H_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ H_Foo,
+ H_Bar,
+ H_Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t H_Tag;
+#endif // __cplusplus
+
+typedef struct H_Bar_Body {
+ uint8_t x;
+ int16_t y;
+} H_Bar_Body;
+
+typedef struct H {
+ H_Tag tag;
+ union {
+ struct {
+ int16_t foo;
+ };
+ H_Bar_Body bar;
+ };
+} H;
+
+enum J_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ J_Foo,
+ J_Bar,
+ J_Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t J_Tag;
+#endif // __cplusplus
+
+typedef struct J_Bar_Body {
+ uint8_t x;
+ int16_t y;
+} J_Bar_Body;
+
+typedef struct J {
+ J_Tag tag;
+ union {
+ struct {
+ int16_t foo;
+ };
+ J_Bar_Body bar;
+ };
+} J;
+
+enum K_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ K_Foo,
+ K_Bar,
+ K_Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t K_Tag;
+#endif // __cplusplus
+
+typedef struct K_Bar_Body {
+ K_Tag tag;
+ uint8_t x;
+ int16_t y;
+} K_Bar_Body;
+
+typedef union K {
+ K_Tag tag;
+ struct {
+ K_Tag foo_tag;
+ int16_t foo;
+ };
+ K_Bar_Body bar;
+} K;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void foo(struct H h, struct I i, struct J j, union K k);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/asserted_cast.tag.c b/cbindgen-0.27.0/tests/expectations/asserted_cast_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/asserted_cast.tag.c
rename to cbindgen-0.27.0/tests/expectations/asserted_cast_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/asserted_cast_tag.compat.c b/cbindgen-0.27.0/tests/expectations/asserted_cast_tag.compat.c
new file mode 100644
index 0000000..005aadc
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/asserted_cast_tag.compat.c
@@ -0,0 +1,104 @@
+#define MY_ASSERT(...) do { } while (0)
+#define MY_ATTRS __attribute((noinline))
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct I;
+
+enum H_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ H_Foo,
+ H_Bar,
+ H_Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t H_Tag;
+#endif // __cplusplus
+
+struct H_Bar_Body {
+ uint8_t x;
+ int16_t y;
+};
+
+struct H {
+ H_Tag tag;
+ union {
+ struct {
+ int16_t foo;
+ };
+ struct H_Bar_Body bar;
+ };
+};
+
+enum J_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ J_Foo,
+ J_Bar,
+ J_Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t J_Tag;
+#endif // __cplusplus
+
+struct J_Bar_Body {
+ uint8_t x;
+ int16_t y;
+};
+
+struct J {
+ J_Tag tag;
+ union {
+ struct {
+ int16_t foo;
+ };
+ struct J_Bar_Body bar;
+ };
+};
+
+enum K_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ K_Foo,
+ K_Bar,
+ K_Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t K_Tag;
+#endif // __cplusplus
+
+struct K_Bar_Body {
+ K_Tag tag;
+ uint8_t x;
+ int16_t y;
+};
+
+union K {
+ K_Tag tag;
+ struct {
+ K_Tag foo_tag;
+ int16_t foo;
+ };
+ struct K_Bar_Body bar;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void foo(struct H h, struct I i, struct J j, union K k);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/asserted_cast.tag.pyx b/cbindgen-0.27.0/tests/expectations/asserted_cast_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/asserted_cast.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/asserted_cast_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/assoc_const_conflict.compat.c b/cbindgen-0.27.0/tests/expectations/assoc_const_conflict.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/assoc_const_conflict.compat.c
rename to cbindgen-0.27.0/tests/expectations/assoc_const_conflict.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/assoc_const_conflict.cpp b/cbindgen-0.27.0/tests/expectations/assoc_const_conflict.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/assoc_const_conflict.cpp
rename to cbindgen-0.27.0/tests/expectations/assoc_const_conflict.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/assoc_const_conflict.pyx b/cbindgen-0.27.0/tests/expectations/assoc_const_conflict.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/assoc_const_conflict.pyx
rename to cbindgen-0.27.0/tests/expectations/assoc_const_conflict.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/assoc_constant.c b/cbindgen-0.27.0/tests/expectations/assoc_constant.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/assoc_constant.c
rename to cbindgen-0.27.0/tests/expectations/assoc_constant.c
diff --git a/cbindgen-0.27.0/tests/expectations/assoc_constant.compat.c b/cbindgen-0.27.0/tests/expectations/assoc_constant.compat.c
new file mode 100644
index 0000000..711ed8d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/assoc_constant.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+
+} Foo;
+#define Foo_GA 10
+#define Foo_ZO 3.14
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Foo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/assoc_constant.cpp b/cbindgen-0.27.0/tests/expectations/assoc_constant.cpp
new file mode 100644
index 0000000..5993229
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/assoc_constant.cpp
@@ -0,0 +1,17 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Foo {
+
+};
+constexpr static const int32_t Foo_GA = 10;
+constexpr static const float Foo_ZO = 3.14;
+
+extern "C" {
+
+void root(Foo x);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/assoc_constant.pyx b/cbindgen-0.27.0/tests/expectations/assoc_constant.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/assoc_constant.pyx
rename to cbindgen-0.27.0/tests/expectations/assoc_constant.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/assoc_constant.both.c b/cbindgen-0.27.0/tests/expectations/assoc_constant_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/assoc_constant.both.c
rename to cbindgen-0.27.0/tests/expectations/assoc_constant_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/assoc_constant_both.compat.c b/cbindgen-0.27.0/tests/expectations/assoc_constant_both.compat.c
new file mode 100644
index 0000000..c137cce
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/assoc_constant_both.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo {
+
+} Foo;
+#define Foo_GA 10
+#define Foo_ZO 3.14
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/assoc_constant.tag.c b/cbindgen-0.27.0/tests/expectations/assoc_constant_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/assoc_constant.tag.c
rename to cbindgen-0.27.0/tests/expectations/assoc_constant_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/assoc_constant_tag.compat.c b/cbindgen-0.27.0/tests/expectations/assoc_constant_tag.compat.c
new file mode 100644
index 0000000..3ce582d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/assoc_constant_tag.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo {
+
+};
+#define Foo_GA 10
+#define Foo_ZO 3.14
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/assoc_constant.tag.pyx b/cbindgen-0.27.0/tests/expectations/assoc_constant_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/assoc_constant.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/assoc_constant_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/associated_constant_panic.compat.c b/cbindgen-0.27.0/tests/expectations/associated_constant_panic.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/associated_constant_panic.compat.c
rename to cbindgen-0.27.0/tests/expectations/associated_constant_panic.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/associated_constant_panic.cpp b/cbindgen-0.27.0/tests/expectations/associated_constant_panic.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/associated_constant_panic.cpp
rename to cbindgen-0.27.0/tests/expectations/associated_constant_panic.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/associated_constant_panic.pyx b/cbindgen-0.27.0/tests/expectations/associated_constant_panic.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/associated_constant_panic.pyx
rename to cbindgen-0.27.0/tests/expectations/associated_constant_panic.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/associated_in_body.c b/cbindgen-0.27.0/tests/expectations/associated_in_body.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/associated_in_body.c
rename to cbindgen-0.27.0/tests/expectations/associated_in_body.c
diff --git a/cbindgen-0.27.0/tests/expectations/associated_in_body.compat.c b/cbindgen-0.27.0/tests/expectations/associated_in_body.compat.c
new file mode 100644
index 0000000..095ed21
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/associated_in_body.compat.c
@@ -0,0 +1,67 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/**
+ * Constants shared by multiple CSS Box Alignment properties
+ *
+ * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+ */
+typedef struct {
+ uint8_t bits;
+} StyleAlignFlags;
+/**
+ * 'auto'
+ */
+#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = (uint8_t)0 }
+/**
+ * 'normal'
+ */
+#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = (uint8_t)1 }
+/**
+ * 'start'
+ */
+#define StyleAlignFlags_START (StyleAlignFlags){ .bits = (uint8_t)(1 << 1) }
+/**
+ * 'end'
+ */
+#define StyleAlignFlags_END (StyleAlignFlags){ .bits = (uint8_t)(1 << 2) }
+#define StyleAlignFlags_ALIAS (StyleAlignFlags){ .bits = (uint8_t)(StyleAlignFlags_END).bits }
+/**
+ * 'flex-start'
+ */
+#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = (uint8_t)(1 << 3) }
+#define StyleAlignFlags_MIXED (StyleAlignFlags){ .bits = (uint8_t)(((1 << 4) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
+#define StyleAlignFlags_MIXED_SELF (StyleAlignFlags){ .bits = (uint8_t)(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
+
+/**
+ * An arbitrary identifier for a native (OS compositor) surface
+ */
+typedef struct {
+ uint64_t _0;
+} StyleNativeSurfaceId;
+/**
+ * A special id for the native surface that is used for debug / profiler overlays.
+ */
+#define StyleNativeSurfaceId_DEBUG_OVERLAY (StyleNativeSurfaceId){ ._0 = UINT64_MAX }
+
+typedef struct {
+ StyleNativeSurfaceId surface_id;
+ int32_t x;
+ int32_t y;
+} StyleNativeTileId;
+/**
+ * A special id for the native surface that is used for debug / profiler overlays.
+ */
+#define StyleNativeTileId_DEBUG_OVERLAY (StyleNativeTileId){ .surface_id = StyleNativeSurfaceId_DEBUG_OVERLAY, .x = 0, .y = 0 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(StyleAlignFlags flags, StyleNativeTileId tile);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/associated_in_body.cpp b/cbindgen-0.27.0/tests/expectations/associated_in_body.cpp
new file mode 100644
index 0000000..edbcbea
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/associated_in_body.cpp
@@ -0,0 +1,84 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+/// Constants shared by multiple CSS Box Alignment properties
+///
+/// These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+struct StyleAlignFlags {
+ uint8_t bits;
+
+ constexpr explicit operator bool() const {
+ return !!bits;
+ }
+ constexpr StyleAlignFlags operator~() const {
+ return StyleAlignFlags { static_cast<decltype(bits)>(~bits) };
+ }
+ constexpr StyleAlignFlags operator|(const StyleAlignFlags& other) const {
+ return StyleAlignFlags { static_cast<decltype(bits)>(this->bits | other.bits) };
+ }
+ StyleAlignFlags& operator|=(const StyleAlignFlags& other) {
+ *this = (*this | other);
+ return *this;
+ }
+ constexpr StyleAlignFlags operator&(const StyleAlignFlags& other) const {
+ return StyleAlignFlags { static_cast<decltype(bits)>(this->bits & other.bits) };
+ }
+ StyleAlignFlags& operator&=(const StyleAlignFlags& other) {
+ *this = (*this & other);
+ return *this;
+ }
+ constexpr StyleAlignFlags operator^(const StyleAlignFlags& other) const {
+ return StyleAlignFlags { static_cast<decltype(bits)>(this->bits ^ other.bits) };
+ }
+ StyleAlignFlags& operator^=(const StyleAlignFlags& other) {
+ *this = (*this ^ other);
+ return *this;
+ }
+ static const StyleAlignFlags AUTO;
+ static const StyleAlignFlags NORMAL;
+ static const StyleAlignFlags START;
+ static const StyleAlignFlags END;
+ static const StyleAlignFlags ALIAS;
+ static const StyleAlignFlags FLEX_START;
+ static const StyleAlignFlags MIXED;
+ static const StyleAlignFlags MIXED_SELF;
+};
+/// 'auto'
+constexpr inline const StyleAlignFlags StyleAlignFlags::AUTO = StyleAlignFlags{ /* .bits = */ (uint8_t)0 };
+/// 'normal'
+constexpr inline const StyleAlignFlags StyleAlignFlags::NORMAL = StyleAlignFlags{ /* .bits = */ (uint8_t)1 };
+/// 'start'
+constexpr inline const StyleAlignFlags StyleAlignFlags::START = StyleAlignFlags{ /* .bits = */ (uint8_t)(1 << 1) };
+/// 'end'
+constexpr inline const StyleAlignFlags StyleAlignFlags::END = StyleAlignFlags{ /* .bits = */ (uint8_t)(1 << 2) };
+constexpr inline const StyleAlignFlags StyleAlignFlags::ALIAS = StyleAlignFlags{ /* .bits = */ (uint8_t)(StyleAlignFlags::END).bits };
+/// 'flex-start'
+constexpr inline const StyleAlignFlags StyleAlignFlags::FLEX_START = StyleAlignFlags{ /* .bits = */ (uint8_t)(1 << 3) };
+constexpr inline const StyleAlignFlags StyleAlignFlags::MIXED = StyleAlignFlags{ /* .bits = */ (uint8_t)(((1 << 4) | (StyleAlignFlags::FLEX_START).bits) | (StyleAlignFlags::END).bits) };
+constexpr inline const StyleAlignFlags StyleAlignFlags::MIXED_SELF = StyleAlignFlags{ /* .bits = */ (uint8_t)(((1 << 5) | (StyleAlignFlags::FLEX_START).bits) | (StyleAlignFlags::END).bits) };
+
+/// An arbitrary identifier for a native (OS compositor) surface
+struct StyleNativeSurfaceId {
+ uint64_t _0;
+ static const StyleNativeSurfaceId DEBUG_OVERLAY;
+};
+/// A special id for the native surface that is used for debug / profiler overlays.
+constexpr inline const StyleNativeSurfaceId StyleNativeSurfaceId::DEBUG_OVERLAY = StyleNativeSurfaceId{ /* ._0 = */ UINT64_MAX };
+
+struct StyleNativeTileId {
+ StyleNativeSurfaceId surface_id;
+ int32_t x;
+ int32_t y;
+ static const StyleNativeTileId DEBUG_OVERLAY;
+};
+/// A special id for the native surface that is used for debug / profiler overlays.
+constexpr inline const StyleNativeTileId StyleNativeTileId::DEBUG_OVERLAY = StyleNativeTileId{ /* .surface_id = */ StyleNativeSurfaceId::DEBUG_OVERLAY, /* .x = */ 0, /* .y = */ 0 };
+
+extern "C" {
+
+void root(StyleAlignFlags flags, StyleNativeTileId tile);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/associated_in_body.pyx b/cbindgen-0.27.0/tests/expectations/associated_in_body.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/associated_in_body.pyx
rename to cbindgen-0.27.0/tests/expectations/associated_in_body.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/associated_in_body.both.c b/cbindgen-0.27.0/tests/expectations/associated_in_body_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/associated_in_body.both.c
rename to cbindgen-0.27.0/tests/expectations/associated_in_body_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/associated_in_body_both.compat.c b/cbindgen-0.27.0/tests/expectations/associated_in_body_both.compat.c
new file mode 100644
index 0000000..3187ea3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/associated_in_body_both.compat.c
@@ -0,0 +1,67 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/**
+ * Constants shared by multiple CSS Box Alignment properties
+ *
+ * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+ */
+typedef struct StyleAlignFlags {
+ uint8_t bits;
+} StyleAlignFlags;
+/**
+ * 'auto'
+ */
+#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = (uint8_t)0 }
+/**
+ * 'normal'
+ */
+#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = (uint8_t)1 }
+/**
+ * 'start'
+ */
+#define StyleAlignFlags_START (StyleAlignFlags){ .bits = (uint8_t)(1 << 1) }
+/**
+ * 'end'
+ */
+#define StyleAlignFlags_END (StyleAlignFlags){ .bits = (uint8_t)(1 << 2) }
+#define StyleAlignFlags_ALIAS (StyleAlignFlags){ .bits = (uint8_t)(StyleAlignFlags_END).bits }
+/**
+ * 'flex-start'
+ */
+#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = (uint8_t)(1 << 3) }
+#define StyleAlignFlags_MIXED (StyleAlignFlags){ .bits = (uint8_t)(((1 << 4) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
+#define StyleAlignFlags_MIXED_SELF (StyleAlignFlags){ .bits = (uint8_t)(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
+
+/**
+ * An arbitrary identifier for a native (OS compositor) surface
+ */
+typedef struct StyleNativeSurfaceId {
+ uint64_t _0;
+} StyleNativeSurfaceId;
+/**
+ * A special id for the native surface that is used for debug / profiler overlays.
+ */
+#define StyleNativeSurfaceId_DEBUG_OVERLAY (StyleNativeSurfaceId){ ._0 = UINT64_MAX }
+
+typedef struct StyleNativeTileId {
+ struct StyleNativeSurfaceId surface_id;
+ int32_t x;
+ int32_t y;
+} StyleNativeTileId;
+/**
+ * A special id for the native surface that is used for debug / profiler overlays.
+ */
+#define StyleNativeTileId_DEBUG_OVERLAY (StyleNativeTileId){ .surface_id = StyleNativeSurfaceId_DEBUG_OVERLAY, .x = 0, .y = 0 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct StyleAlignFlags flags, struct StyleNativeTileId tile);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/associated_in_body.tag.c b/cbindgen-0.27.0/tests/expectations/associated_in_body_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/associated_in_body.tag.c
rename to cbindgen-0.27.0/tests/expectations/associated_in_body_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/associated_in_body_tag.compat.c b/cbindgen-0.27.0/tests/expectations/associated_in_body_tag.compat.c
new file mode 100644
index 0000000..7f4c486
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/associated_in_body_tag.compat.c
@@ -0,0 +1,67 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/**
+ * Constants shared by multiple CSS Box Alignment properties
+ *
+ * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+ */
+struct StyleAlignFlags {
+ uint8_t bits;
+};
+/**
+ * 'auto'
+ */
+#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = (uint8_t)0 }
+/**
+ * 'normal'
+ */
+#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = (uint8_t)1 }
+/**
+ * 'start'
+ */
+#define StyleAlignFlags_START (StyleAlignFlags){ .bits = (uint8_t)(1 << 1) }
+/**
+ * 'end'
+ */
+#define StyleAlignFlags_END (StyleAlignFlags){ .bits = (uint8_t)(1 << 2) }
+#define StyleAlignFlags_ALIAS (StyleAlignFlags){ .bits = (uint8_t)(StyleAlignFlags_END).bits }
+/**
+ * 'flex-start'
+ */
+#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = (uint8_t)(1 << 3) }
+#define StyleAlignFlags_MIXED (StyleAlignFlags){ .bits = (uint8_t)(((1 << 4) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
+#define StyleAlignFlags_MIXED_SELF (StyleAlignFlags){ .bits = (uint8_t)(((1 << 5) | (StyleAlignFlags_FLEX_START).bits) | (StyleAlignFlags_END).bits) }
+
+/**
+ * An arbitrary identifier for a native (OS compositor) surface
+ */
+struct StyleNativeSurfaceId {
+ uint64_t _0;
+};
+/**
+ * A special id for the native surface that is used for debug / profiler overlays.
+ */
+#define StyleNativeSurfaceId_DEBUG_OVERLAY (StyleNativeSurfaceId){ ._0 = UINT64_MAX }
+
+struct StyleNativeTileId {
+ struct StyleNativeSurfaceId surface_id;
+ int32_t x;
+ int32_t y;
+};
+/**
+ * A special id for the native surface that is used for debug / profiler overlays.
+ */
+#define StyleNativeTileId_DEBUG_OVERLAY (StyleNativeTileId){ .surface_id = StyleNativeSurfaceId_DEBUG_OVERLAY, .x = 0, .y = 0 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct StyleAlignFlags flags, struct StyleNativeTileId tile);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/associated_in_body.tag.pyx b/cbindgen-0.27.0/tests/expectations/associated_in_body_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/associated_in_body.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/associated_in_body_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/bitfield.c b/cbindgen-0.27.0/tests/expectations/bitfield.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/bitfield.c
rename to cbindgen-0.27.0/tests/expectations/bitfield.c
diff --git a/cbindgen-0.27.0/tests/expectations/bitfield.compat.c b/cbindgen-0.27.0/tests/expectations/bitfield.compat.c
new file mode 100644
index 0000000..208f889
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/bitfield.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ uint64_t foo: 8;
+ uint64_t bar: 56;
+} HasBitfields;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const HasBitfields*);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/bitfield.cpp b/cbindgen-0.27.0/tests/expectations/bitfield.cpp
new file mode 100644
index 0000000..640efb0
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/bitfield.cpp
@@ -0,0 +1,16 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct HasBitfields {
+ uint64_t foo: 8;
+ uint64_t bar: 56;
+};
+
+extern "C" {
+
+void root(const HasBitfields*);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/bitfield.pyx b/cbindgen-0.27.0/tests/expectations/bitfield.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/bitfield.pyx
rename to cbindgen-0.27.0/tests/expectations/bitfield.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/bitfield.both.c b/cbindgen-0.27.0/tests/expectations/bitfield_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/bitfield.both.c
rename to cbindgen-0.27.0/tests/expectations/bitfield_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/bitfield_both.compat.c b/cbindgen-0.27.0/tests/expectations/bitfield_both.compat.c
new file mode 100644
index 0000000..4d4df0e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/bitfield_both.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct HasBitfields {
+ uint64_t foo: 8;
+ uint64_t bar: 56;
+} HasBitfields;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const struct HasBitfields*);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/bitfield.tag.c b/cbindgen-0.27.0/tests/expectations/bitfield_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/bitfield.tag.c
rename to cbindgen-0.27.0/tests/expectations/bitfield_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/bitfield_tag.compat.c b/cbindgen-0.27.0/tests/expectations/bitfield_tag.compat.c
new file mode 100644
index 0000000..630ed74
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/bitfield_tag.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct HasBitfields {
+ uint64_t foo: 8;
+ uint64_t bar: 56;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const struct HasBitfields*);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/bitfield.tag.pyx b/cbindgen-0.27.0/tests/expectations/bitfield_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/bitfield.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/bitfield_tag.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/bitflags.c b/cbindgen-0.27.0/tests/expectations/bitflags.c
new file mode 100644
index 0000000..2d212c1
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/bitflags.c
@@ -0,0 +1,65 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/**
+ * Constants shared by multiple CSS Box Alignment properties
+ *
+ * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+ */
+typedef struct {
+ uint8_t bits;
+} AlignFlags;
+/**
+ * 'auto'
+ */
+#define AlignFlags_AUTO (AlignFlags){ .bits = (uint8_t)0 }
+/**
+ * 'normal'
+ */
+#define AlignFlags_NORMAL (AlignFlags){ .bits = (uint8_t)1 }
+/**
+ * 'start'
+ */
+#define AlignFlags_START (AlignFlags){ .bits = (uint8_t)(1 << 1) }
+/**
+ * 'end'
+ */
+#define AlignFlags_END (AlignFlags){ .bits = (uint8_t)(1 << 2) }
+#define AlignFlags_ALIAS (AlignFlags){ .bits = (uint8_t)(AlignFlags_END).bits }
+/**
+ * 'flex-start'
+ */
+#define AlignFlags_FLEX_START (AlignFlags){ .bits = (uint8_t)(1 << 3) }
+#define AlignFlags_MIXED (AlignFlags){ .bits = (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+#define AlignFlags_MIXED_SELF (AlignFlags){ .bits = (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+
+typedef struct {
+ uint32_t bits;
+} DebugFlags;
+/**
+ * Flag with the topmost bit set of the u32
+ */
+#define DebugFlags_BIGGEST_ALLOWED (DebugFlags){ .bits = (uint32_t)(1 << 31) }
+
+typedef struct {
+ uint64_t bits;
+} LargeFlags;
+/**
+ * Flag with a very large shift that usually would be narrowed.
+ */
+#define LargeFlags_LARGE_SHIFT (LargeFlags){ .bits = (uint64_t)(1ull << 44) }
+#define LargeFlags_INVERTED (LargeFlags){ .bits = (uint64_t)~(LargeFlags_LARGE_SHIFT).bits }
+
+typedef struct {
+ uint32_t _0;
+} OutOfLine;
+#define OutOfLine_A (OutOfLine){ ._0 = (uint32_t)1 }
+#define OutOfLine_B (OutOfLine){ ._0 = (uint32_t)2 }
+#define OutOfLine_AB (OutOfLine){ ._0 = (uint32_t)((OutOfLine_A)._0 | (OutOfLine_B)._0) }
+
+void root(AlignFlags flags,
+ DebugFlags bigger_flags,
+ LargeFlags largest_flags,
+ OutOfLine out_of_line);
diff --git a/cbindgen-0.27.0/tests/expectations/bitflags.compat.c b/cbindgen-0.27.0/tests/expectations/bitflags.compat.c
new file mode 100644
index 0000000..1a372e6
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/bitflags.compat.c
@@ -0,0 +1,73 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/**
+ * Constants shared by multiple CSS Box Alignment properties
+ *
+ * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+ */
+typedef struct {
+ uint8_t bits;
+} AlignFlags;
+/**
+ * 'auto'
+ */
+#define AlignFlags_AUTO (AlignFlags){ .bits = (uint8_t)0 }
+/**
+ * 'normal'
+ */
+#define AlignFlags_NORMAL (AlignFlags){ .bits = (uint8_t)1 }
+/**
+ * 'start'
+ */
+#define AlignFlags_START (AlignFlags){ .bits = (uint8_t)(1 << 1) }
+/**
+ * 'end'
+ */
+#define AlignFlags_END (AlignFlags){ .bits = (uint8_t)(1 << 2) }
+#define AlignFlags_ALIAS (AlignFlags){ .bits = (uint8_t)(AlignFlags_END).bits }
+/**
+ * 'flex-start'
+ */
+#define AlignFlags_FLEX_START (AlignFlags){ .bits = (uint8_t)(1 << 3) }
+#define AlignFlags_MIXED (AlignFlags){ .bits = (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+#define AlignFlags_MIXED_SELF (AlignFlags){ .bits = (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+
+typedef struct {
+ uint32_t bits;
+} DebugFlags;
+/**
+ * Flag with the topmost bit set of the u32
+ */
+#define DebugFlags_BIGGEST_ALLOWED (DebugFlags){ .bits = (uint32_t)(1 << 31) }
+
+typedef struct {
+ uint64_t bits;
+} LargeFlags;
+/**
+ * Flag with a very large shift that usually would be narrowed.
+ */
+#define LargeFlags_LARGE_SHIFT (LargeFlags){ .bits = (uint64_t)(1ull << 44) }
+#define LargeFlags_INVERTED (LargeFlags){ .bits = (uint64_t)~(LargeFlags_LARGE_SHIFT).bits }
+
+typedef struct {
+ uint32_t _0;
+} OutOfLine;
+#define OutOfLine_A (OutOfLine){ ._0 = (uint32_t)1 }
+#define OutOfLine_B (OutOfLine){ ._0 = (uint32_t)2 }
+#define OutOfLine_AB (OutOfLine){ ._0 = (uint32_t)((OutOfLine_A)._0 | (OutOfLine_B)._0) }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(AlignFlags flags,
+ DebugFlags bigger_flags,
+ LargeFlags largest_flags,
+ OutOfLine out_of_line);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/bitflags.cpp b/cbindgen-0.27.0/tests/expectations/bitflags.cpp
new file mode 100644
index 0000000..13bc3c5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/bitflags.cpp
@@ -0,0 +1,166 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+/// Constants shared by multiple CSS Box Alignment properties
+///
+/// These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+struct AlignFlags {
+ uint8_t bits;
+
+ constexpr explicit operator bool() const {
+ return !!bits;
+ }
+ constexpr AlignFlags operator~() const {
+ return AlignFlags { static_cast<decltype(bits)>(~bits) };
+ }
+ constexpr AlignFlags operator|(const AlignFlags& other) const {
+ return AlignFlags { static_cast<decltype(bits)>(this->bits | other.bits) };
+ }
+ AlignFlags& operator|=(const AlignFlags& other) {
+ *this = (*this | other);
+ return *this;
+ }
+ constexpr AlignFlags operator&(const AlignFlags& other) const {
+ return AlignFlags { static_cast<decltype(bits)>(this->bits & other.bits) };
+ }
+ AlignFlags& operator&=(const AlignFlags& other) {
+ *this = (*this & other);
+ return *this;
+ }
+ constexpr AlignFlags operator^(const AlignFlags& other) const {
+ return AlignFlags { static_cast<decltype(bits)>(this->bits ^ other.bits) };
+ }
+ AlignFlags& operator^=(const AlignFlags& other) {
+ *this = (*this ^ other);
+ return *this;
+ }
+};
+/// 'auto'
+constexpr static const AlignFlags AlignFlags_AUTO = AlignFlags{ /* .bits = */ (uint8_t)0 };
+/// 'normal'
+constexpr static const AlignFlags AlignFlags_NORMAL = AlignFlags{ /* .bits = */ (uint8_t)1 };
+/// 'start'
+constexpr static const AlignFlags AlignFlags_START = AlignFlags{ /* .bits = */ (uint8_t)(1 << 1) };
+/// 'end'
+constexpr static const AlignFlags AlignFlags_END = AlignFlags{ /* .bits = */ (uint8_t)(1 << 2) };
+constexpr static const AlignFlags AlignFlags_ALIAS = AlignFlags{ /* .bits = */ (uint8_t)(AlignFlags_END).bits };
+/// 'flex-start'
+constexpr static const AlignFlags AlignFlags_FLEX_START = AlignFlags{ /* .bits = */ (uint8_t)(1 << 3) };
+constexpr static const AlignFlags AlignFlags_MIXED = AlignFlags{ /* .bits = */ (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) };
+constexpr static const AlignFlags AlignFlags_MIXED_SELF = AlignFlags{ /* .bits = */ (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) };
+
+struct DebugFlags {
+ uint32_t bits;
+
+ constexpr explicit operator bool() const {
+ return !!bits;
+ }
+ constexpr DebugFlags operator~() const {
+ return DebugFlags { static_cast<decltype(bits)>(~bits) };
+ }
+ constexpr DebugFlags operator|(const DebugFlags& other) const {
+ return DebugFlags { static_cast<decltype(bits)>(this->bits | other.bits) };
+ }
+ DebugFlags& operator|=(const DebugFlags& other) {
+ *this = (*this | other);
+ return *this;
+ }
+ constexpr DebugFlags operator&(const DebugFlags& other) const {
+ return DebugFlags { static_cast<decltype(bits)>(this->bits & other.bits) };
+ }
+ DebugFlags& operator&=(const DebugFlags& other) {
+ *this = (*this & other);
+ return *this;
+ }
+ constexpr DebugFlags operator^(const DebugFlags& other) const {
+ return DebugFlags { static_cast<decltype(bits)>(this->bits ^ other.bits) };
+ }
+ DebugFlags& operator^=(const DebugFlags& other) {
+ *this = (*this ^ other);
+ return *this;
+ }
+};
+/// Flag with the topmost bit set of the u32
+constexpr static const DebugFlags DebugFlags_BIGGEST_ALLOWED = DebugFlags{ /* .bits = */ (uint32_t)(1 << 31) };
+
+struct LargeFlags {
+ uint64_t bits;
+
+ constexpr explicit operator bool() const {
+ return !!bits;
+ }
+ constexpr LargeFlags operator~() const {
+ return LargeFlags { static_cast<decltype(bits)>(~bits) };
+ }
+ constexpr LargeFlags operator|(const LargeFlags& other) const {
+ return LargeFlags { static_cast<decltype(bits)>(this->bits | other.bits) };
+ }
+ LargeFlags& operator|=(const LargeFlags& other) {
+ *this = (*this | other);
+ return *this;
+ }
+ constexpr LargeFlags operator&(const LargeFlags& other) const {
+ return LargeFlags { static_cast<decltype(bits)>(this->bits & other.bits) };
+ }
+ LargeFlags& operator&=(const LargeFlags& other) {
+ *this = (*this & other);
+ return *this;
+ }
+ constexpr LargeFlags operator^(const LargeFlags& other) const {
+ return LargeFlags { static_cast<decltype(bits)>(this->bits ^ other.bits) };
+ }
+ LargeFlags& operator^=(const LargeFlags& other) {
+ *this = (*this ^ other);
+ return *this;
+ }
+};
+/// Flag with a very large shift that usually would be narrowed.
+constexpr static const LargeFlags LargeFlags_LARGE_SHIFT = LargeFlags{ /* .bits = */ (uint64_t)(1ull << 44) };
+constexpr static const LargeFlags LargeFlags_INVERTED = LargeFlags{ /* .bits = */ (uint64_t)~(LargeFlags_LARGE_SHIFT).bits };
+
+struct OutOfLine {
+ uint32_t _0;
+
+ constexpr explicit operator bool() const {
+ return !!_0;
+ }
+ constexpr OutOfLine operator~() const {
+ return OutOfLine { static_cast<decltype(_0)>(~_0) };
+ }
+ constexpr OutOfLine operator|(const OutOfLine& other) const {
+ return OutOfLine { static_cast<decltype(_0)>(this->_0 | other._0) };
+ }
+ OutOfLine& operator|=(const OutOfLine& other) {
+ *this = (*this | other);
+ return *this;
+ }
+ constexpr OutOfLine operator&(const OutOfLine& other) const {
+ return OutOfLine { static_cast<decltype(_0)>(this->_0 & other._0) };
+ }
+ OutOfLine& operator&=(const OutOfLine& other) {
+ *this = (*this & other);
+ return *this;
+ }
+ constexpr OutOfLine operator^(const OutOfLine& other) const {
+ return OutOfLine { static_cast<decltype(_0)>(this->_0 ^ other._0) };
+ }
+ OutOfLine& operator^=(const OutOfLine& other) {
+ *this = (*this ^ other);
+ return *this;
+ }
+};
+constexpr static const OutOfLine OutOfLine_A = OutOfLine{ /* ._0 = */ (uint32_t)1 };
+constexpr static const OutOfLine OutOfLine_B = OutOfLine{ /* ._0 = */ (uint32_t)2 };
+constexpr static const OutOfLine OutOfLine_AB = OutOfLine{ /* ._0 = */ (uint32_t)((OutOfLine_A)._0 | (OutOfLine_B)._0) };
+
+extern "C" {
+
+void root(AlignFlags flags,
+ DebugFlags bigger_flags,
+ LargeFlags largest_flags,
+ OutOfLine out_of_line);
+
+} // extern "C"
diff --git a/cbindgen-0.27.0/tests/expectations/bitflags.pyx b/cbindgen-0.27.0/tests/expectations/bitflags.pyx
new file mode 100644
index 0000000..5137b53
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/bitflags.pyx
@@ -0,0 +1,48 @@
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ # Constants shared by multiple CSS Box Alignment properties
+ #
+ # These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+ ctypedef struct AlignFlags:
+ uint8_t bits;
+ # 'auto'
+ const AlignFlags AlignFlags_AUTO # = <AlignFlags>{ <uint8_t>0 }
+ # 'normal'
+ const AlignFlags AlignFlags_NORMAL # = <AlignFlags>{ <uint8_t>1 }
+ # 'start'
+ const AlignFlags AlignFlags_START # = <AlignFlags>{ <uint8_t>(1 << 1) }
+ # 'end'
+ const AlignFlags AlignFlags_END # = <AlignFlags>{ <uint8_t>(1 << 2) }
+ const AlignFlags AlignFlags_ALIAS # = <AlignFlags>{ <uint8_t>(AlignFlags_END).bits }
+ # 'flex-start'
+ const AlignFlags AlignFlags_FLEX_START # = <AlignFlags>{ <uint8_t>(1 << 3) }
+ const AlignFlags AlignFlags_MIXED # = <AlignFlags>{ <uint8_t>(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+ const AlignFlags AlignFlags_MIXED_SELF # = <AlignFlags>{ <uint8_t>(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+
+ ctypedef struct DebugFlags:
+ uint32_t bits;
+ # Flag with the topmost bit set of the u32
+ const DebugFlags DebugFlags_BIGGEST_ALLOWED # = <DebugFlags>{ <uint32_t>(1 << 31) }
+
+ ctypedef struct LargeFlags:
+ uint64_t bits;
+ # Flag with a very large shift that usually would be narrowed.
+ const LargeFlags LargeFlags_LARGE_SHIFT # = <LargeFlags>{ <uint64_t>(1ull << 44) }
+ const LargeFlags LargeFlags_INVERTED # = <LargeFlags>{ <uint64_t>~(LargeFlags_LARGE_SHIFT).bits }
+
+ ctypedef struct OutOfLine:
+ uint32_t _0;
+ const OutOfLine OutOfLine_A # = <OutOfLine>{ <uint32_t>1 }
+ const OutOfLine OutOfLine_B # = <OutOfLine>{ <uint32_t>2 }
+ const OutOfLine OutOfLine_AB # = <OutOfLine>{ <uint32_t>((OutOfLine_A)._0 | (OutOfLine_B)._0) }
+
+ void root(AlignFlags flags,
+ DebugFlags bigger_flags,
+ LargeFlags largest_flags,
+ OutOfLine out_of_line);
diff --git a/cbindgen-0.27.0/tests/expectations/bitflags_both.c b/cbindgen-0.27.0/tests/expectations/bitflags_both.c
new file mode 100644
index 0000000..2baed98
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/bitflags_both.c
@@ -0,0 +1,65 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/**
+ * Constants shared by multiple CSS Box Alignment properties
+ *
+ * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+ */
+typedef struct AlignFlags {
+ uint8_t bits;
+} AlignFlags;
+/**
+ * 'auto'
+ */
+#define AlignFlags_AUTO (AlignFlags){ .bits = (uint8_t)0 }
+/**
+ * 'normal'
+ */
+#define AlignFlags_NORMAL (AlignFlags){ .bits = (uint8_t)1 }
+/**
+ * 'start'
+ */
+#define AlignFlags_START (AlignFlags){ .bits = (uint8_t)(1 << 1) }
+/**
+ * 'end'
+ */
+#define AlignFlags_END (AlignFlags){ .bits = (uint8_t)(1 << 2) }
+#define AlignFlags_ALIAS (AlignFlags){ .bits = (uint8_t)(AlignFlags_END).bits }
+/**
+ * 'flex-start'
+ */
+#define AlignFlags_FLEX_START (AlignFlags){ .bits = (uint8_t)(1 << 3) }
+#define AlignFlags_MIXED (AlignFlags){ .bits = (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+#define AlignFlags_MIXED_SELF (AlignFlags){ .bits = (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+
+typedef struct DebugFlags {
+ uint32_t bits;
+} DebugFlags;
+/**
+ * Flag with the topmost bit set of the u32
+ */
+#define DebugFlags_BIGGEST_ALLOWED (DebugFlags){ .bits = (uint32_t)(1 << 31) }
+
+typedef struct LargeFlags {
+ uint64_t bits;
+} LargeFlags;
+/**
+ * Flag with a very large shift that usually would be narrowed.
+ */
+#define LargeFlags_LARGE_SHIFT (LargeFlags){ .bits = (uint64_t)(1ull << 44) }
+#define LargeFlags_INVERTED (LargeFlags){ .bits = (uint64_t)~(LargeFlags_LARGE_SHIFT).bits }
+
+typedef struct OutOfLine {
+ uint32_t _0;
+} OutOfLine;
+#define OutOfLine_A (OutOfLine){ ._0 = (uint32_t)1 }
+#define OutOfLine_B (OutOfLine){ ._0 = (uint32_t)2 }
+#define OutOfLine_AB (OutOfLine){ ._0 = (uint32_t)((OutOfLine_A)._0 | (OutOfLine_B)._0) }
+
+void root(struct AlignFlags flags,
+ struct DebugFlags bigger_flags,
+ struct LargeFlags largest_flags,
+ struct OutOfLine out_of_line);
diff --git a/cbindgen-0.27.0/tests/expectations/bitflags_both.compat.c b/cbindgen-0.27.0/tests/expectations/bitflags_both.compat.c
new file mode 100644
index 0000000..35513e6
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/bitflags_both.compat.c
@@ -0,0 +1,73 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/**
+ * Constants shared by multiple CSS Box Alignment properties
+ *
+ * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+ */
+typedef struct AlignFlags {
+ uint8_t bits;
+} AlignFlags;
+/**
+ * 'auto'
+ */
+#define AlignFlags_AUTO (AlignFlags){ .bits = (uint8_t)0 }
+/**
+ * 'normal'
+ */
+#define AlignFlags_NORMAL (AlignFlags){ .bits = (uint8_t)1 }
+/**
+ * 'start'
+ */
+#define AlignFlags_START (AlignFlags){ .bits = (uint8_t)(1 << 1) }
+/**
+ * 'end'
+ */
+#define AlignFlags_END (AlignFlags){ .bits = (uint8_t)(1 << 2) }
+#define AlignFlags_ALIAS (AlignFlags){ .bits = (uint8_t)(AlignFlags_END).bits }
+/**
+ * 'flex-start'
+ */
+#define AlignFlags_FLEX_START (AlignFlags){ .bits = (uint8_t)(1 << 3) }
+#define AlignFlags_MIXED (AlignFlags){ .bits = (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+#define AlignFlags_MIXED_SELF (AlignFlags){ .bits = (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+
+typedef struct DebugFlags {
+ uint32_t bits;
+} DebugFlags;
+/**
+ * Flag with the topmost bit set of the u32
+ */
+#define DebugFlags_BIGGEST_ALLOWED (DebugFlags){ .bits = (uint32_t)(1 << 31) }
+
+typedef struct LargeFlags {
+ uint64_t bits;
+} LargeFlags;
+/**
+ * Flag with a very large shift that usually would be narrowed.
+ */
+#define LargeFlags_LARGE_SHIFT (LargeFlags){ .bits = (uint64_t)(1ull << 44) }
+#define LargeFlags_INVERTED (LargeFlags){ .bits = (uint64_t)~(LargeFlags_LARGE_SHIFT).bits }
+
+typedef struct OutOfLine {
+ uint32_t _0;
+} OutOfLine;
+#define OutOfLine_A (OutOfLine){ ._0 = (uint32_t)1 }
+#define OutOfLine_B (OutOfLine){ ._0 = (uint32_t)2 }
+#define OutOfLine_AB (OutOfLine){ ._0 = (uint32_t)((OutOfLine_A)._0 | (OutOfLine_B)._0) }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct AlignFlags flags,
+ struct DebugFlags bigger_flags,
+ struct LargeFlags largest_flags,
+ struct OutOfLine out_of_line);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/bitflags_tag.c b/cbindgen-0.27.0/tests/expectations/bitflags_tag.c
new file mode 100644
index 0000000..874ac17
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/bitflags_tag.c
@@ -0,0 +1,65 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/**
+ * Constants shared by multiple CSS Box Alignment properties
+ *
+ * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+ */
+struct AlignFlags {
+ uint8_t bits;
+};
+/**
+ * 'auto'
+ */
+#define AlignFlags_AUTO (AlignFlags){ .bits = (uint8_t)0 }
+/**
+ * 'normal'
+ */
+#define AlignFlags_NORMAL (AlignFlags){ .bits = (uint8_t)1 }
+/**
+ * 'start'
+ */
+#define AlignFlags_START (AlignFlags){ .bits = (uint8_t)(1 << 1) }
+/**
+ * 'end'
+ */
+#define AlignFlags_END (AlignFlags){ .bits = (uint8_t)(1 << 2) }
+#define AlignFlags_ALIAS (AlignFlags){ .bits = (uint8_t)(AlignFlags_END).bits }
+/**
+ * 'flex-start'
+ */
+#define AlignFlags_FLEX_START (AlignFlags){ .bits = (uint8_t)(1 << 3) }
+#define AlignFlags_MIXED (AlignFlags){ .bits = (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+#define AlignFlags_MIXED_SELF (AlignFlags){ .bits = (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+
+struct DebugFlags {
+ uint32_t bits;
+};
+/**
+ * Flag with the topmost bit set of the u32
+ */
+#define DebugFlags_BIGGEST_ALLOWED (DebugFlags){ .bits = (uint32_t)(1 << 31) }
+
+struct LargeFlags {
+ uint64_t bits;
+};
+/**
+ * Flag with a very large shift that usually would be narrowed.
+ */
+#define LargeFlags_LARGE_SHIFT (LargeFlags){ .bits = (uint64_t)(1ull << 44) }
+#define LargeFlags_INVERTED (LargeFlags){ .bits = (uint64_t)~(LargeFlags_LARGE_SHIFT).bits }
+
+struct OutOfLine {
+ uint32_t _0;
+};
+#define OutOfLine_A (OutOfLine){ ._0 = (uint32_t)1 }
+#define OutOfLine_B (OutOfLine){ ._0 = (uint32_t)2 }
+#define OutOfLine_AB (OutOfLine){ ._0 = (uint32_t)((OutOfLine_A)._0 | (OutOfLine_B)._0) }
+
+void root(struct AlignFlags flags,
+ struct DebugFlags bigger_flags,
+ struct LargeFlags largest_flags,
+ struct OutOfLine out_of_line);
diff --git a/cbindgen-0.27.0/tests/expectations/bitflags_tag.compat.c b/cbindgen-0.27.0/tests/expectations/bitflags_tag.compat.c
new file mode 100644
index 0000000..fe8e746
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/bitflags_tag.compat.c
@@ -0,0 +1,73 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/**
+ * Constants shared by multiple CSS Box Alignment properties
+ *
+ * These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+ */
+struct AlignFlags {
+ uint8_t bits;
+};
+/**
+ * 'auto'
+ */
+#define AlignFlags_AUTO (AlignFlags){ .bits = (uint8_t)0 }
+/**
+ * 'normal'
+ */
+#define AlignFlags_NORMAL (AlignFlags){ .bits = (uint8_t)1 }
+/**
+ * 'start'
+ */
+#define AlignFlags_START (AlignFlags){ .bits = (uint8_t)(1 << 1) }
+/**
+ * 'end'
+ */
+#define AlignFlags_END (AlignFlags){ .bits = (uint8_t)(1 << 2) }
+#define AlignFlags_ALIAS (AlignFlags){ .bits = (uint8_t)(AlignFlags_END).bits }
+/**
+ * 'flex-start'
+ */
+#define AlignFlags_FLEX_START (AlignFlags){ .bits = (uint8_t)(1 << 3) }
+#define AlignFlags_MIXED (AlignFlags){ .bits = (uint8_t)(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+#define AlignFlags_MIXED_SELF (AlignFlags){ .bits = (uint8_t)(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+
+struct DebugFlags {
+ uint32_t bits;
+};
+/**
+ * Flag with the topmost bit set of the u32
+ */
+#define DebugFlags_BIGGEST_ALLOWED (DebugFlags){ .bits = (uint32_t)(1 << 31) }
+
+struct LargeFlags {
+ uint64_t bits;
+};
+/**
+ * Flag with a very large shift that usually would be narrowed.
+ */
+#define LargeFlags_LARGE_SHIFT (LargeFlags){ .bits = (uint64_t)(1ull << 44) }
+#define LargeFlags_INVERTED (LargeFlags){ .bits = (uint64_t)~(LargeFlags_LARGE_SHIFT).bits }
+
+struct OutOfLine {
+ uint32_t _0;
+};
+#define OutOfLine_A (OutOfLine){ ._0 = (uint32_t)1 }
+#define OutOfLine_B (OutOfLine){ ._0 = (uint32_t)2 }
+#define OutOfLine_AB (OutOfLine){ ._0 = (uint32_t)((OutOfLine_A)._0 | (OutOfLine_B)._0) }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct AlignFlags flags,
+ struct DebugFlags bigger_flags,
+ struct LargeFlags largest_flags,
+ struct OutOfLine out_of_line);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/bitflags_tag.pyx b/cbindgen-0.27.0/tests/expectations/bitflags_tag.pyx
new file mode 100644
index 0000000..4420708
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/bitflags_tag.pyx
@@ -0,0 +1,48 @@
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ # Constants shared by multiple CSS Box Alignment properties
+ #
+ # These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+ cdef struct AlignFlags:
+ uint8_t bits;
+ # 'auto'
+ const AlignFlags AlignFlags_AUTO # = <AlignFlags>{ <uint8_t>0 }
+ # 'normal'
+ const AlignFlags AlignFlags_NORMAL # = <AlignFlags>{ <uint8_t>1 }
+ # 'start'
+ const AlignFlags AlignFlags_START # = <AlignFlags>{ <uint8_t>(1 << 1) }
+ # 'end'
+ const AlignFlags AlignFlags_END # = <AlignFlags>{ <uint8_t>(1 << 2) }
+ const AlignFlags AlignFlags_ALIAS # = <AlignFlags>{ <uint8_t>(AlignFlags_END).bits }
+ # 'flex-start'
+ const AlignFlags AlignFlags_FLEX_START # = <AlignFlags>{ <uint8_t>(1 << 3) }
+ const AlignFlags AlignFlags_MIXED # = <AlignFlags>{ <uint8_t>(((1 << 4) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+ const AlignFlags AlignFlags_MIXED_SELF # = <AlignFlags>{ <uint8_t>(((1 << 5) | (AlignFlags_FLEX_START).bits) | (AlignFlags_END).bits) }
+
+ cdef struct DebugFlags:
+ uint32_t bits;
+ # Flag with the topmost bit set of the u32
+ const DebugFlags DebugFlags_BIGGEST_ALLOWED # = <DebugFlags>{ <uint32_t>(1 << 31) }
+
+ cdef struct LargeFlags:
+ uint64_t bits;
+ # Flag with a very large shift that usually would be narrowed.
+ const LargeFlags LargeFlags_LARGE_SHIFT # = <LargeFlags>{ <uint64_t>(1ull << 44) }
+ const LargeFlags LargeFlags_INVERTED # = <LargeFlags>{ <uint64_t>~(LargeFlags_LARGE_SHIFT).bits }
+
+ cdef struct OutOfLine:
+ uint32_t _0;
+ const OutOfLine OutOfLine_A # = <OutOfLine>{ <uint32_t>1 }
+ const OutOfLine OutOfLine_B # = <OutOfLine>{ <uint32_t>2 }
+ const OutOfLine OutOfLine_AB # = <OutOfLine>{ <uint32_t>((OutOfLine_A)._0 | (OutOfLine_B)._0) }
+
+ void root(AlignFlags flags,
+ DebugFlags bigger_flags,
+ LargeFlags largest_flags,
+ OutOfLine out_of_line);
diff --git a/cbindgen-0.24.5/tests/expectations/body.c b/cbindgen-0.27.0/tests/expectations/body.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/body.c
rename to cbindgen-0.27.0/tests/expectations/body.c
diff --git a/cbindgen-0.27.0/tests/expectations/body.compat.c b/cbindgen-0.27.0/tests/expectations/body.compat.c
new file mode 100644
index 0000000..f61ccd0
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/body.compat.c
@@ -0,0 +1,101 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef enum {
+ Foo1,
+ Bar1,
+ Baz1,
+} MyCLikeEnum;
+
+typedef enum {
+ Foo1_Prepended,
+ Bar1_Prepended,
+ Baz1_Prepended,
+} MyCLikeEnum_Prepended;
+
+typedef struct {
+ int32_t i;
+#ifdef __cplusplus
+ inline void foo();
+#endif
+} MyFancyStruct;
+
+typedef enum {
+ Foo,
+ Bar,
+ Baz,
+} MyFancyEnum_Tag;
+
+typedef struct {
+ MyFancyEnum_Tag tag;
+ union {
+ struct {
+ int32_t bar;
+ };
+ struct {
+ int32_t baz;
+ };
+ };
+#ifdef __cplusplus
+ inline void wohoo();
+#endif
+} MyFancyEnum;
+
+typedef union {
+ float f;
+ uint32_t u;
+ int32_t extra_member;
+} MyUnion;
+
+typedef struct {
+#ifdef __cplusplus
+ inline void prepended_wohoo();
+#endif
+ int32_t i;
+} MyFancyStruct_Prepended;
+
+typedef enum {
+ Foo_Prepended,
+ Bar_Prepended,
+ Baz_Prepended,
+} MyFancyEnum_Prepended_Tag;
+
+typedef struct {
+#ifdef __cplusplus
+ inline void wohoo();
+#endif
+ MyFancyEnum_Prepended_Tag tag;
+ union {
+ struct {
+ int32_t bar_prepended;
+ };
+ struct {
+ int32_t baz_prepended;
+ };
+ };
+} MyFancyEnum_Prepended;
+
+typedef union {
+ int32_t extra_member;
+ float f;
+ uint32_t u;
+} MyUnion_Prepended;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(MyFancyStruct s,
+ MyFancyEnum e,
+ MyCLikeEnum c,
+ MyUnion u,
+ MyFancyStruct_Prepended sp,
+ MyFancyEnum_Prepended ep,
+ MyCLikeEnum_Prepended cp,
+ MyUnion_Prepended up);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/body.cpp b/cbindgen-0.27.0/tests/expectations/body.cpp
new file mode 100644
index 0000000..ba974db
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/body.cpp
@@ -0,0 +1,106 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+enum class MyCLikeEnum {
+ Foo1,
+ Bar1,
+ Baz1,
+};
+
+enum class MyCLikeEnum_Prepended {
+ Foo1_Prepended,
+ Bar1_Prepended,
+ Baz1_Prepended,
+};
+
+struct MyFancyStruct {
+ int32_t i;
+#ifdef __cplusplus
+ inline void foo();
+#endif
+};
+
+struct MyFancyEnum {
+ enum class Tag {
+ Foo,
+ Bar,
+ Baz,
+ };
+
+ struct Bar_Body {
+ int32_t _0;
+ };
+
+ struct Baz_Body {
+ int32_t _0;
+ };
+
+ Tag tag;
+ union {
+ Bar_Body bar;
+ Baz_Body baz;
+ };
+#ifdef __cplusplus
+ inline void wohoo();
+#endif
+};
+
+union MyUnion {
+ float f;
+ uint32_t u;
+ int32_t extra_member;
+};
+
+struct MyFancyStruct_Prepended {
+#ifdef __cplusplus
+ inline void prepended_wohoo();
+#endif
+ int32_t i;
+};
+
+struct MyFancyEnum_Prepended {
+#ifdef __cplusplus
+ inline void wohoo();
+#endif
+ enum class Tag {
+ Foo_Prepended,
+ Bar_Prepended,
+ Baz_Prepended,
+ };
+
+ struct Bar_Prepended_Body {
+ int32_t _0;
+ };
+
+ struct Baz_Prepended_Body {
+ int32_t _0;
+ };
+
+ Tag tag;
+ union {
+ Bar_Prepended_Body bar_prepended;
+ Baz_Prepended_Body baz_prepended;
+ };
+};
+
+union MyUnion_Prepended {
+ int32_t extra_member;
+ float f;
+ uint32_t u;
+};
+
+extern "C" {
+
+void root(MyFancyStruct s,
+ MyFancyEnum e,
+ MyCLikeEnum c,
+ MyUnion u,
+ MyFancyStruct_Prepended sp,
+ MyFancyEnum_Prepended ep,
+ MyCLikeEnum_Prepended cp,
+ MyUnion_Prepended up);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/body.pyx b/cbindgen-0.27.0/tests/expectations/body.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/body.pyx
rename to cbindgen-0.27.0/tests/expectations/body.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/body.both.c b/cbindgen-0.27.0/tests/expectations/body_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/body.both.c
rename to cbindgen-0.27.0/tests/expectations/body_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/body_both.compat.c b/cbindgen-0.27.0/tests/expectations/body_both.compat.c
new file mode 100644
index 0000000..7b6c7d9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/body_both.compat.c
@@ -0,0 +1,101 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef enum MyCLikeEnum {
+ Foo1,
+ Bar1,
+ Baz1,
+} MyCLikeEnum;
+
+typedef enum MyCLikeEnum_Prepended {
+ Foo1_Prepended,
+ Bar1_Prepended,
+ Baz1_Prepended,
+} MyCLikeEnum_Prepended;
+
+typedef struct MyFancyStruct {
+ int32_t i;
+#ifdef __cplusplus
+ inline void foo();
+#endif
+} MyFancyStruct;
+
+typedef enum MyFancyEnum_Tag {
+ Foo,
+ Bar,
+ Baz,
+} MyFancyEnum_Tag;
+
+typedef struct MyFancyEnum {
+ MyFancyEnum_Tag tag;
+ union {
+ struct {
+ int32_t bar;
+ };
+ struct {
+ int32_t baz;
+ };
+ };
+#ifdef __cplusplus
+ inline void wohoo();
+#endif
+} MyFancyEnum;
+
+typedef union MyUnion {
+ float f;
+ uint32_t u;
+ int32_t extra_member;
+} MyUnion;
+
+typedef struct MyFancyStruct_Prepended {
+#ifdef __cplusplus
+ inline void prepended_wohoo();
+#endif
+ int32_t i;
+} MyFancyStruct_Prepended;
+
+typedef enum MyFancyEnum_Prepended_Tag {
+ Foo_Prepended,
+ Bar_Prepended,
+ Baz_Prepended,
+} MyFancyEnum_Prepended_Tag;
+
+typedef struct MyFancyEnum_Prepended {
+#ifdef __cplusplus
+ inline void wohoo();
+#endif
+ MyFancyEnum_Prepended_Tag tag;
+ union {
+ struct {
+ int32_t bar_prepended;
+ };
+ struct {
+ int32_t baz_prepended;
+ };
+ };
+} MyFancyEnum_Prepended;
+
+typedef union MyUnion_Prepended {
+ int32_t extra_member;
+ float f;
+ uint32_t u;
+} MyUnion_Prepended;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct MyFancyStruct s,
+ struct MyFancyEnum e,
+ enum MyCLikeEnum c,
+ union MyUnion u,
+ struct MyFancyStruct_Prepended sp,
+ struct MyFancyEnum_Prepended ep,
+ enum MyCLikeEnum_Prepended cp,
+ union MyUnion_Prepended up);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/body.tag.c b/cbindgen-0.27.0/tests/expectations/body_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/body.tag.c
rename to cbindgen-0.27.0/tests/expectations/body_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/body_tag.compat.c b/cbindgen-0.27.0/tests/expectations/body_tag.compat.c
new file mode 100644
index 0000000..4810d01
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/body_tag.compat.c
@@ -0,0 +1,101 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum MyCLikeEnum {
+ Foo1,
+ Bar1,
+ Baz1,
+};
+
+enum MyCLikeEnum_Prepended {
+ Foo1_Prepended,
+ Bar1_Prepended,
+ Baz1_Prepended,
+};
+
+struct MyFancyStruct {
+ int32_t i;
+#ifdef __cplusplus
+ inline void foo();
+#endif
+};
+
+enum MyFancyEnum_Tag {
+ Foo,
+ Bar,
+ Baz,
+};
+
+struct MyFancyEnum {
+ enum MyFancyEnum_Tag tag;
+ union {
+ struct {
+ int32_t bar;
+ };
+ struct {
+ int32_t baz;
+ };
+ };
+#ifdef __cplusplus
+ inline void wohoo();
+#endif
+};
+
+union MyUnion {
+ float f;
+ uint32_t u;
+ int32_t extra_member;
+};
+
+struct MyFancyStruct_Prepended {
+#ifdef __cplusplus
+ inline void prepended_wohoo();
+#endif
+ int32_t i;
+};
+
+enum MyFancyEnum_Prepended_Tag {
+ Foo_Prepended,
+ Bar_Prepended,
+ Baz_Prepended,
+};
+
+struct MyFancyEnum_Prepended {
+#ifdef __cplusplus
+ inline void wohoo();
+#endif
+ enum MyFancyEnum_Prepended_Tag tag;
+ union {
+ struct {
+ int32_t bar_prepended;
+ };
+ struct {
+ int32_t baz_prepended;
+ };
+ };
+};
+
+union MyUnion_Prepended {
+ int32_t extra_member;
+ float f;
+ uint32_t u;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct MyFancyStruct s,
+ struct MyFancyEnum e,
+ enum MyCLikeEnum c,
+ union MyUnion u,
+ struct MyFancyStruct_Prepended sp,
+ struct MyFancyEnum_Prepended ep,
+ enum MyCLikeEnum_Prepended cp,
+ union MyUnion_Prepended up);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/body.tag.pyx b/cbindgen-0.27.0/tests/expectations/body_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/body.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/body_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/box.c b/cbindgen-0.27.0/tests/expectations/box.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/box.c
rename to cbindgen-0.27.0/tests/expectations/box.c
diff --git a/cbindgen-0.27.0/tests/expectations/box.compat.c b/cbindgen-0.27.0/tests/expectations/box.compat.c
new file mode 100644
index 0000000..686d2a3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/box.compat.c
@@ -0,0 +1,40 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using Box = T*;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct NotReprC_____i32 NotReprC_____i32;
+
+typedef NotReprC_____i32 Foo;
+
+typedef struct {
+ int32_t *number;
+} MyStruct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const MyStruct *with_box);
+
+void drop_box(int32_t *x);
+
+void drop_box_opt(int32_t *x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/box.cpp b/cbindgen-0.27.0/tests/expectations/box.cpp
new file mode 100644
index 0000000..76a5ef7
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/box.cpp
@@ -0,0 +1,41 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using Box = T*;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T = void>
+struct NotReprC;
+
+template<typename T = void>
+struct Option;
+
+using Foo = NotReprC<Box<int32_t>>;
+
+struct MyStruct {
+ Box<int32_t> number;
+};
+
+extern "C" {
+
+void root(const Foo *a, const MyStruct *with_box);
+
+void drop_box(Box<int32_t> x);
+
+void drop_box_opt(Option<Box<int32_t>> x);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/box.pyx b/cbindgen-0.27.0/tests/expectations/box.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/box.pyx
rename to cbindgen-0.27.0/tests/expectations/box.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/box.both.c b/cbindgen-0.27.0/tests/expectations/box_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/box.both.c
rename to cbindgen-0.27.0/tests/expectations/box_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/box_both.compat.c b/cbindgen-0.27.0/tests/expectations/box_both.compat.c
new file mode 100644
index 0000000..dc8c3cb
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/box_both.compat.c
@@ -0,0 +1,40 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using Box = T*;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct NotReprC_____i32 NotReprC_____i32;
+
+typedef struct NotReprC_____i32 Foo;
+
+typedef struct MyStruct {
+ int32_t *number;
+} MyStruct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const struct MyStruct *with_box);
+
+void drop_box(int32_t *x);
+
+void drop_box_opt(int32_t *x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/box.tag.c b/cbindgen-0.27.0/tests/expectations/box_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/box.tag.c
rename to cbindgen-0.27.0/tests/expectations/box_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/box_tag.compat.c b/cbindgen-0.27.0/tests/expectations/box_tag.compat.c
new file mode 100644
index 0000000..2290dc3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/box_tag.compat.c
@@ -0,0 +1,40 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using Box = T*;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct NotReprC_____i32;
+
+typedef struct NotReprC_____i32 Foo;
+
+struct MyStruct {
+ int32_t *number;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const struct MyStruct *with_box);
+
+void drop_box(int32_t *x);
+
+void drop_box_opt(int32_t *x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/box.tag.pyx b/cbindgen-0.27.0/tests/expectations/box_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/box.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/box_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/cdecl.c b/cbindgen-0.27.0/tests/expectations/cdecl.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cdecl.c
rename to cbindgen-0.27.0/tests/expectations/cdecl.c
diff --git a/cbindgen-0.27.0/tests/expectations/cdecl.compat.c b/cbindgen-0.27.0/tests/expectations/cdecl.compat.c
new file mode 100644
index 0000000..1b89fbd
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cdecl.compat.c
@@ -0,0 +1,46 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef void (*A)(void);
+
+typedef void (*B)(void);
+
+typedef bool (*C)(int32_t, int32_t);
+
+typedef bool (*(*D)(int32_t))(float);
+
+typedef const int32_t (*(*E)(void))[16];
+
+typedef const int32_t *F;
+
+typedef const int32_t *const *G;
+
+typedef int32_t *const *H;
+
+typedef const int32_t (*I)[16];
+
+typedef double (**J)(float);
+
+typedef int32_t K[16];
+
+typedef const int32_t *L[16];
+
+typedef bool (*M[16])(int32_t, int32_t);
+
+typedef void (*N[16])(int32_t, int32_t);
+
+typedef void (*P)(int32_t named1st, bool, bool named3rd, int32_t _);
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void (*O(void))(void);
+
+void root(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, P p);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/cdecl.cpp b/cbindgen-0.27.0/tests/expectations/cdecl.cpp
new file mode 100644
index 0000000..e4c9268
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cdecl.cpp
@@ -0,0 +1,43 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+using A = void(*)();
+
+using B = void(*)();
+
+using C = bool(*)(int32_t, int32_t);
+
+using D = bool(*(*)(int32_t))(float);
+
+using E = const int32_t(*(*)())[16];
+
+using F = const int32_t*;
+
+using G = const int32_t*const *;
+
+using H = int32_t*const *;
+
+using I = const int32_t(*)[16];
+
+using J = double(**)(float);
+
+using K = int32_t[16];
+
+using L = const int32_t*[16];
+
+using M = bool(*[16])(int32_t, int32_t);
+
+using N = void(*[16])(int32_t, int32_t);
+
+using P = void(*)(int32_t named1st, bool, bool named3rd, int32_t _);
+
+extern "C" {
+
+void (*O())();
+
+void root(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, P p);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/cdecl.pyx b/cbindgen-0.27.0/tests/expectations/cdecl.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cdecl.pyx
rename to cbindgen-0.27.0/tests/expectations/cdecl.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/cell.c b/cbindgen-0.27.0/tests/expectations/cell.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cell.c
rename to cbindgen-0.27.0/tests/expectations/cell.c
diff --git a/cbindgen-0.27.0/tests/expectations/cell.compat.c b/cbindgen-0.27.0/tests/expectations/cell.compat.c
new file mode 100644
index 0000000..8cf35ca
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cell.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
+
+typedef NotReprC_RefCell_i32 Foo;
+
+typedef struct {
+ int32_t number;
+} MyStruct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const MyStruct *with_cell);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/cell.cpp b/cbindgen-0.27.0/tests/expectations/cell.cpp
new file mode 100644
index 0000000..f863e79
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cell.cpp
@@ -0,0 +1,23 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T = void>
+struct NotReprC;
+
+template<typename T = void>
+struct RefCell;
+
+using Foo = NotReprC<RefCell<int32_t>>;
+
+struct MyStruct {
+ int32_t number;
+};
+
+extern "C" {
+
+void root(const Foo *a, const MyStruct *with_cell);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/cell.pyx b/cbindgen-0.27.0/tests/expectations/cell.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cell.pyx
rename to cbindgen-0.27.0/tests/expectations/cell.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/cell.both.c b/cbindgen-0.27.0/tests/expectations/cell_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cell.both.c
rename to cbindgen-0.27.0/tests/expectations/cell_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/cell_both.compat.c b/cbindgen-0.27.0/tests/expectations/cell_both.compat.c
new file mode 100644
index 0000000..53ea3ef
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cell_both.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
+
+typedef struct NotReprC_RefCell_i32 Foo;
+
+typedef struct MyStruct {
+ int32_t number;
+} MyStruct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const struct MyStruct *with_cell);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cell.tag.c b/cbindgen-0.27.0/tests/expectations/cell_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cell.tag.c
rename to cbindgen-0.27.0/tests/expectations/cell_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/cell_tag.compat.c b/cbindgen-0.27.0/tests/expectations/cell_tag.compat.c
new file mode 100644
index 0000000..ed26a79
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cell_tag.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct NotReprC_RefCell_i32;
+
+typedef struct NotReprC_RefCell_i32 Foo;
+
+struct MyStruct {
+ int32_t number;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const struct MyStruct *with_cell);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cell.tag.pyx b/cbindgen-0.27.0/tests/expectations/cell_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cell.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/cell_tag.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/cfg.c b/cbindgen-0.27.0/tests/expectations/cfg.c
new file mode 100644
index 0000000..9285f30
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cfg.c
@@ -0,0 +1,110 @@
+#if 0
+DEF PLATFORM_UNIX = 0
+DEF PLATFORM_WIN = 0
+DEF X11 = 0
+DEF M_32 = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+enum BarType {
+ A,
+ B,
+ C,
+};
+typedef uint32_t BarType;
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+enum FooType {
+ A,
+ B,
+ C,
+};
+typedef uint32_t FooType;
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+typedef struct {
+ FooType ty;
+ int32_t x;
+ float y;
+} FooHandle;
+#endif
+
+enum C_Tag {
+ C1,
+ C2,
+#if defined(PLATFORM_WIN)
+ C3,
+#endif
+#if defined(PLATFORM_UNIX)
+ C5,
+#endif
+};
+typedef uint8_t C_Tag;
+
+#if defined(PLATFORM_UNIX)
+typedef struct {
+ C_Tag tag;
+ int32_t int_;
+} C5_Body;
+#endif
+
+typedef union {
+ C_Tag tag;
+#if defined(PLATFORM_UNIX)
+ C5_Body c5;
+#endif
+} C;
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+typedef struct {
+ BarType ty;
+ int32_t x;
+ float y;
+} BarHandle;
+#endif
+
+typedef struct {
+#if defined(X11)
+ int32_t field
+#endif
+ ;
+} ConditionalField;
+
+typedef struct {
+ int32_t x;
+ float y;
+} Normal;
+
+#if defined(PLATFORM_WIN)
+extern int32_t global_array_with_different_sizes[2];
+#endif
+
+#if defined(PLATFORM_UNIX)
+extern int32_t global_array_with_different_sizes[1];
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+void root(FooHandle a, C c);
+#endif
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+void root(BarHandle a, C c);
+#endif
+
+void cond(ConditionalField a);
+
+#if defined(PLATFORM_WIN)
+extern int32_t foo(void);
+#endif
+
+#if defined(PLATFORM_WIN)
+extern void bar(Normal a);
+#endif
diff --git a/cbindgen-0.27.0/tests/expectations/cfg.compat.c b/cbindgen-0.27.0/tests/expectations/cfg.compat.c
new file mode 100644
index 0000000..053c405
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cfg.compat.c
@@ -0,0 +1,136 @@
+#if 0
+DEF PLATFORM_UNIX = 0
+DEF PLATFORM_WIN = 0
+DEF X11 = 0
+DEF M_32 = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+enum BarType
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ A,
+ B,
+ C,
+};
+#ifndef __cplusplus
+typedef uint32_t BarType;
+#endif // __cplusplus
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+enum FooType
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ A,
+ B,
+ C,
+};
+#ifndef __cplusplus
+typedef uint32_t FooType;
+#endif // __cplusplus
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+typedef struct {
+ FooType ty;
+ int32_t x;
+ float y;
+} FooHandle;
+#endif
+
+enum C_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ C1,
+ C2,
+#if defined(PLATFORM_WIN)
+ C3,
+#endif
+#if defined(PLATFORM_UNIX)
+ C5,
+#endif
+};
+#ifndef __cplusplus
+typedef uint8_t C_Tag;
+#endif // __cplusplus
+
+#if defined(PLATFORM_UNIX)
+typedef struct {
+ C_Tag tag;
+ int32_t int_;
+} C5_Body;
+#endif
+
+typedef union {
+ C_Tag tag;
+#if defined(PLATFORM_UNIX)
+ C5_Body c5;
+#endif
+} C;
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+typedef struct {
+ BarType ty;
+ int32_t x;
+ float y;
+} BarHandle;
+#endif
+
+typedef struct {
+#if defined(X11)
+ int32_t field
+#endif
+ ;
+} ConditionalField;
+
+typedef struct {
+ int32_t x;
+ float y;
+} Normal;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#if defined(PLATFORM_WIN)
+extern int32_t global_array_with_different_sizes[2];
+#endif
+
+#if defined(PLATFORM_UNIX)
+extern int32_t global_array_with_different_sizes[1];
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+void root(FooHandle a, C c);
+#endif
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+void root(BarHandle a, C c);
+#endif
+
+void cond(ConditionalField a);
+
+#if defined(PLATFORM_WIN)
+extern int32_t foo(void);
+#endif
+
+#if defined(PLATFORM_WIN)
+extern void bar(Normal a);
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/cfg.cpp b/cbindgen-0.27.0/tests/expectations/cfg.cpp
new file mode 100644
index 0000000..d7b6250
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cfg.cpp
@@ -0,0 +1,247 @@
+#if 0
+DEF PLATFORM_UNIX = 0
+DEF PLATFORM_WIN = 0
+DEF X11 = 0
+DEF M_32 = 0
+#endif
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+enum class BarType : uint32_t {
+ A,
+ B,
+ C,
+};
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+enum class FooType : uint32_t {
+ A,
+ B,
+ C,
+};
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+struct FooHandle {
+ FooType ty;
+ int32_t x;
+ float y;
+
+ bool operator==(const FooHandle& other) const {
+ return ty == other.ty &&
+ x == other.x &&
+ y == other.y;
+ }
+ bool operator!=(const FooHandle& other) const {
+ return ty != other.ty ||
+ x != other.x ||
+ y != other.y;
+ }
+};
+#endif
+
+union C {
+ enum class Tag : uint8_t {
+ C1,
+ C2,
+#if defined(PLATFORM_WIN)
+ C3,
+#endif
+#if defined(PLATFORM_UNIX)
+ C5,
+#endif
+ };
+
+#if defined(PLATFORM_UNIX)
+ struct C5_Body {
+ Tag tag;
+ int32_t int_;
+
+ bool operator==(const C5_Body& other) const {
+ return int_ == other.int_;
+ }
+ bool operator!=(const C5_Body& other) const {
+ return int_ != other.int_;
+ }
+ };
+#endif
+
+ struct {
+ Tag tag;
+ };
+#if defined(PLATFORM_UNIX)
+ C5_Body c5;
+#endif
+
+ static C C1() {
+ C result;
+ result.tag = Tag::C1;
+ return result;
+ }
+
+ bool IsC1() const {
+ return tag == Tag::C1;
+ }
+
+ static C C2() {
+ C result;
+ result.tag = Tag::C2;
+ return result;
+ }
+
+ bool IsC2() const {
+ return tag == Tag::C2;
+ }
+
+#if defined(PLATFORM_WIN)
+ static C C3() {
+ C result;
+ result.tag = Tag::C3;
+ return result;
+ }
+
+ bool IsC3() const {
+ return tag == Tag::C3;
+ }
+#endif
+
+#if defined(PLATFORM_UNIX)
+ static C C5(const int32_t &int_) {
+ C result;
+ ::new (&result.c5.int_) (int32_t)(int_);
+ result.tag = Tag::C5;
+ return result;
+ }
+
+ bool IsC5() const {
+ return tag == Tag::C5;
+ }
+#endif
+
+ bool operator==(const C& other) const {
+ if (tag != other.tag) {
+ return false;
+ }
+ switch (tag) {
+#if defined(PLATFORM_UNIX)
+ case Tag::C5: return c5 == other.c5;
+#endif
+ default: break;
+ }
+ return true;
+ }
+
+ bool operator!=(const C& other) const {
+ return !(*this == other);
+ }
+
+ private:
+ C() {
+
+ }
+ public:
+
+
+ ~C() {
+ switch (tag) {
+#if defined(PLATFORM_UNIX)
+ case Tag::C5: c5.~C5_Body(); break;
+#endif
+ default: break;
+ }
+ }
+
+ C(const C& other)
+ : tag(other.tag) {
+ switch (tag) {
+#if defined(PLATFORM_UNIX)
+ case Tag::C5: ::new (&c5) (C5_Body)(other.c5); break;
+#endif
+ default: break;
+ }
+ }
+ C& operator=(const C& other) {
+ if (this != &other) {
+ this->~C();
+ new (this) C(other);
+ }
+ return *this;
+ }
+};
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+struct BarHandle {
+ BarType ty;
+ int32_t x;
+ float y;
+
+ bool operator==(const BarHandle& other) const {
+ return ty == other.ty &&
+ x == other.x &&
+ y == other.y;
+ }
+ bool operator!=(const BarHandle& other) const {
+ return ty != other.ty ||
+ x != other.x ||
+ y != other.y;
+ }
+};
+#endif
+
+struct ConditionalField {
+#if defined(X11)
+ int32_t field
+#endif
+ ;
+};
+
+struct Normal {
+ int32_t x;
+ float y;
+
+ bool operator==(const Normal& other) const {
+ return x == other.x &&
+ y == other.y;
+ }
+ bool operator!=(const Normal& other) const {
+ return x != other.x ||
+ y != other.y;
+ }
+};
+
+extern "C" {
+
+#if defined(PLATFORM_WIN)
+extern int32_t global_array_with_different_sizes[2];
+#endif
+
+#if defined(PLATFORM_UNIX)
+extern int32_t global_array_with_different_sizes[1];
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+void root(FooHandle a, C c);
+#endif
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+void root(BarHandle a, C c);
+#endif
+
+void cond(ConditionalField a);
+
+#if defined(PLATFORM_WIN)
+extern int32_t foo();
+#endif
+
+#if defined(PLATFORM_WIN)
+extern void bar(Normal a);
+#endif
+
+} // extern "C"
diff --git a/cbindgen-0.27.0/tests/expectations/cfg.pyx b/cbindgen-0.27.0/tests/expectations/cfg.pyx
new file mode 100644
index 0000000..e23fc70
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cfg.pyx
@@ -0,0 +1,83 @@
+#if 0
+DEF PLATFORM_UNIX = 0
+DEF PLATFORM_WIN = 0
+DEF X11 = 0
+DEF M_32 = 0
+#endif
+
+
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ IF (PLATFORM_WIN or M_32):
+ cdef enum:
+ A,
+ B,
+ C,
+ ctypedef uint32_t BarType;
+
+ IF (PLATFORM_UNIX and X11):
+ cdef enum:
+ A,
+ B,
+ C,
+ ctypedef uint32_t FooType;
+
+ IF (PLATFORM_UNIX and X11):
+ ctypedef struct FooHandle:
+ FooType ty;
+ int32_t x;
+ float y;
+
+ cdef enum:
+ C1,
+ C2,
+ C3,
+ C5,
+ ctypedef uint8_t C_Tag;
+
+ ctypedef struct C5_Body:
+ C_Tag tag;
+ int32_t int_;
+
+ ctypedef union C:
+ C_Tag tag;
+ C5_Body c5;
+
+ IF (PLATFORM_WIN or M_32):
+ ctypedef struct BarHandle:
+ BarType ty;
+ int32_t x;
+ float y;
+
+ ctypedef struct ConditionalField:
+ int32_t field;
+
+ ctypedef struct Normal:
+ int32_t x;
+ float y;
+
+ IF PLATFORM_WIN:
+ extern int32_t global_array_with_different_sizes[2];
+
+ IF PLATFORM_UNIX:
+ extern int32_t global_array_with_different_sizes[1];
+
+ IF (PLATFORM_UNIX and X11):
+ void root(FooHandle a, C c);
+
+ IF (PLATFORM_WIN or M_32):
+ void root(BarHandle a, C c);
+
+ void cond(ConditionalField a);
+
+ IF PLATFORM_WIN:
+ extern int32_t foo();
+
+ IF PLATFORM_WIN:
+ extern void bar(Normal a);
diff --git a/cbindgen-0.24.5/tests/expectations/cfg_2.c b/cbindgen-0.27.0/tests/expectations/cfg_2.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cfg_2.c
rename to cbindgen-0.27.0/tests/expectations/cfg_2.c
diff --git a/cbindgen-0.27.0/tests/expectations/cfg_2.compat.c b/cbindgen-0.27.0/tests/expectations/cfg_2.compat.c
new file mode 100644
index 0000000..5f9a0ad
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cfg_2.compat.c
@@ -0,0 +1,50 @@
+#if 0
+DEF DEFINED = 1
+DEF NOT_DEFINED = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if defined(NOT_DEFINED)
+#define DEFAULT_X 8
+#endif
+
+#if defined(DEFINED)
+#define DEFAULT_X 42
+#endif
+
+#if (defined(NOT_DEFINED) || defined(DEFINED))
+typedef struct {
+ int32_t x;
+} Foo;
+#endif
+
+#if defined(NOT_DEFINED)
+typedef struct {
+ Foo y;
+} Bar;
+#endif
+
+#if defined(DEFINED)
+typedef struct {
+ Foo z;
+} Bar;
+#endif
+
+typedef struct {
+ Bar w;
+} Root;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Root a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/cfg_2.cpp b/cbindgen-0.27.0/tests/expectations/cfg_2.cpp
new file mode 100644
index 0000000..32ebc24
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cfg_2.cpp
@@ -0,0 +1,47 @@
+#if 0
+DEF DEFINED = 1
+DEF NOT_DEFINED = 0
+#endif
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+#if defined(NOT_DEFINED)
+constexpr static const int32_t DEFAULT_X = 8;
+#endif
+
+#if defined(DEFINED)
+constexpr static const int32_t DEFAULT_X = 42;
+#endif
+
+#if (defined(NOT_DEFINED) || defined(DEFINED))
+struct Foo {
+ int32_t x;
+};
+#endif
+
+#if defined(NOT_DEFINED)
+struct Bar {
+ Foo y;
+};
+#endif
+
+#if defined(DEFINED)
+struct Bar {
+ Foo z;
+};
+#endif
+
+struct Root {
+ Bar w;
+};
+
+extern "C" {
+
+void root(Root a);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/cfg_2.pyx b/cbindgen-0.27.0/tests/expectations/cfg_2.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cfg_2.pyx
rename to cbindgen-0.27.0/tests/expectations/cfg_2.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/cfg_2.both.c b/cbindgen-0.27.0/tests/expectations/cfg_2_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cfg_2.both.c
rename to cbindgen-0.27.0/tests/expectations/cfg_2_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/cfg_2_both.compat.c b/cbindgen-0.27.0/tests/expectations/cfg_2_both.compat.c
new file mode 100644
index 0000000..08b471d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cfg_2_both.compat.c
@@ -0,0 +1,50 @@
+#if 0
+DEF DEFINED = 1
+DEF NOT_DEFINED = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if defined(NOT_DEFINED)
+#define DEFAULT_X 8
+#endif
+
+#if defined(DEFINED)
+#define DEFAULT_X 42
+#endif
+
+#if (defined(NOT_DEFINED) || defined(DEFINED))
+typedef struct Foo {
+ int32_t x;
+} Foo;
+#endif
+
+#if defined(NOT_DEFINED)
+typedef struct Bar {
+ struct Foo y;
+} Bar;
+#endif
+
+#if defined(DEFINED)
+typedef struct Bar {
+ struct Foo z;
+} Bar;
+#endif
+
+typedef struct Root {
+ struct Bar w;
+} Root;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Root a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cfg_2.tag.c b/cbindgen-0.27.0/tests/expectations/cfg_2_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cfg_2.tag.c
rename to cbindgen-0.27.0/tests/expectations/cfg_2_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/cfg_2_tag.compat.c b/cbindgen-0.27.0/tests/expectations/cfg_2_tag.compat.c
new file mode 100644
index 0000000..8930fe8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cfg_2_tag.compat.c
@@ -0,0 +1,50 @@
+#if 0
+DEF DEFINED = 1
+DEF NOT_DEFINED = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if defined(NOT_DEFINED)
+#define DEFAULT_X 8
+#endif
+
+#if defined(DEFINED)
+#define DEFAULT_X 42
+#endif
+
+#if (defined(NOT_DEFINED) || defined(DEFINED))
+struct Foo {
+ int32_t x;
+};
+#endif
+
+#if defined(NOT_DEFINED)
+struct Bar {
+ struct Foo y;
+};
+#endif
+
+#if defined(DEFINED)
+struct Bar {
+ struct Foo z;
+};
+#endif
+
+struct Root {
+ struct Bar w;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Root a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cfg_2.tag.pyx b/cbindgen-0.27.0/tests/expectations/cfg_2_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cfg_2.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/cfg_2_tag.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/cfg_both.c b/cbindgen-0.27.0/tests/expectations/cfg_both.c
new file mode 100644
index 0000000..510e34e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cfg_both.c
@@ -0,0 +1,110 @@
+#if 0
+DEF PLATFORM_UNIX = 0
+DEF PLATFORM_WIN = 0
+DEF X11 = 0
+DEF M_32 = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+enum BarType {
+ A,
+ B,
+ C,
+};
+typedef uint32_t BarType;
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+enum FooType {
+ A,
+ B,
+ C,
+};
+typedef uint32_t FooType;
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+typedef struct FooHandle {
+ FooType ty;
+ int32_t x;
+ float y;
+} FooHandle;
+#endif
+
+enum C_Tag {
+ C1,
+ C2,
+#if defined(PLATFORM_WIN)
+ C3,
+#endif
+#if defined(PLATFORM_UNIX)
+ C5,
+#endif
+};
+typedef uint8_t C_Tag;
+
+#if defined(PLATFORM_UNIX)
+typedef struct C5_Body {
+ C_Tag tag;
+ int32_t int_;
+} C5_Body;
+#endif
+
+typedef union C {
+ C_Tag tag;
+#if defined(PLATFORM_UNIX)
+ C5_Body c5;
+#endif
+} C;
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+typedef struct BarHandle {
+ BarType ty;
+ int32_t x;
+ float y;
+} BarHandle;
+#endif
+
+typedef struct ConditionalField {
+#if defined(X11)
+ int32_t field
+#endif
+ ;
+} ConditionalField;
+
+typedef struct Normal {
+ int32_t x;
+ float y;
+} Normal;
+
+#if defined(PLATFORM_WIN)
+extern int32_t global_array_with_different_sizes[2];
+#endif
+
+#if defined(PLATFORM_UNIX)
+extern int32_t global_array_with_different_sizes[1];
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+void root(struct FooHandle a, union C c);
+#endif
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+void root(struct BarHandle a, union C c);
+#endif
+
+void cond(struct ConditionalField a);
+
+#if defined(PLATFORM_WIN)
+extern int32_t foo(void);
+#endif
+
+#if defined(PLATFORM_WIN)
+extern void bar(struct Normal a);
+#endif
diff --git a/cbindgen-0.27.0/tests/expectations/cfg_both.compat.c b/cbindgen-0.27.0/tests/expectations/cfg_both.compat.c
new file mode 100644
index 0000000..2377824
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cfg_both.compat.c
@@ -0,0 +1,136 @@
+#if 0
+DEF PLATFORM_UNIX = 0
+DEF PLATFORM_WIN = 0
+DEF X11 = 0
+DEF M_32 = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+enum BarType
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ A,
+ B,
+ C,
+};
+#ifndef __cplusplus
+typedef uint32_t BarType;
+#endif // __cplusplus
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+enum FooType
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ A,
+ B,
+ C,
+};
+#ifndef __cplusplus
+typedef uint32_t FooType;
+#endif // __cplusplus
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+typedef struct FooHandle {
+ FooType ty;
+ int32_t x;
+ float y;
+} FooHandle;
+#endif
+
+enum C_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ C1,
+ C2,
+#if defined(PLATFORM_WIN)
+ C3,
+#endif
+#if defined(PLATFORM_UNIX)
+ C5,
+#endif
+};
+#ifndef __cplusplus
+typedef uint8_t C_Tag;
+#endif // __cplusplus
+
+#if defined(PLATFORM_UNIX)
+typedef struct C5_Body {
+ C_Tag tag;
+ int32_t int_;
+} C5_Body;
+#endif
+
+typedef union C {
+ C_Tag tag;
+#if defined(PLATFORM_UNIX)
+ C5_Body c5;
+#endif
+} C;
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+typedef struct BarHandle {
+ BarType ty;
+ int32_t x;
+ float y;
+} BarHandle;
+#endif
+
+typedef struct ConditionalField {
+#if defined(X11)
+ int32_t field
+#endif
+ ;
+} ConditionalField;
+
+typedef struct Normal {
+ int32_t x;
+ float y;
+} Normal;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#if defined(PLATFORM_WIN)
+extern int32_t global_array_with_different_sizes[2];
+#endif
+
+#if defined(PLATFORM_UNIX)
+extern int32_t global_array_with_different_sizes[1];
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+void root(struct FooHandle a, union C c);
+#endif
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+void root(struct BarHandle a, union C c);
+#endif
+
+void cond(struct ConditionalField a);
+
+#if defined(PLATFORM_WIN)
+extern int32_t foo(void);
+#endif
+
+#if defined(PLATFORM_WIN)
+extern void bar(struct Normal a);
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/cfg_field.compat.c b/cbindgen-0.27.0/tests/expectations/cfg_field.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cfg_field.compat.c
rename to cbindgen-0.27.0/tests/expectations/cfg_field.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/cfg_field.cpp b/cbindgen-0.27.0/tests/expectations/cfg_field.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cfg_field.cpp
rename to cbindgen-0.27.0/tests/expectations/cfg_field.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/cfg_field.pyx b/cbindgen-0.27.0/tests/expectations/cfg_field.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cfg_field.pyx
rename to cbindgen-0.27.0/tests/expectations/cfg_field.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/cfg_tag.c b/cbindgen-0.27.0/tests/expectations/cfg_tag.c
new file mode 100644
index 0000000..8cc8853
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cfg_tag.c
@@ -0,0 +1,110 @@
+#if 0
+DEF PLATFORM_UNIX = 0
+DEF PLATFORM_WIN = 0
+DEF X11 = 0
+DEF M_32 = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+enum BarType {
+ A,
+ B,
+ C,
+};
+typedef uint32_t BarType;
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+enum FooType {
+ A,
+ B,
+ C,
+};
+typedef uint32_t FooType;
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+struct FooHandle {
+ FooType ty;
+ int32_t x;
+ float y;
+};
+#endif
+
+enum C_Tag {
+ C1,
+ C2,
+#if defined(PLATFORM_WIN)
+ C3,
+#endif
+#if defined(PLATFORM_UNIX)
+ C5,
+#endif
+};
+typedef uint8_t C_Tag;
+
+#if defined(PLATFORM_UNIX)
+struct C5_Body {
+ C_Tag tag;
+ int32_t int_;
+};
+#endif
+
+union C {
+ C_Tag tag;
+#if defined(PLATFORM_UNIX)
+ struct C5_Body c5;
+#endif
+};
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+struct BarHandle {
+ BarType ty;
+ int32_t x;
+ float y;
+};
+#endif
+
+struct ConditionalField {
+#if defined(X11)
+ int32_t field
+#endif
+ ;
+};
+
+struct Normal {
+ int32_t x;
+ float y;
+};
+
+#if defined(PLATFORM_WIN)
+extern int32_t global_array_with_different_sizes[2];
+#endif
+
+#if defined(PLATFORM_UNIX)
+extern int32_t global_array_with_different_sizes[1];
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+void root(struct FooHandle a, union C c);
+#endif
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+void root(struct BarHandle a, union C c);
+#endif
+
+void cond(struct ConditionalField a);
+
+#if defined(PLATFORM_WIN)
+extern int32_t foo(void);
+#endif
+
+#if defined(PLATFORM_WIN)
+extern void bar(struct Normal a);
+#endif
diff --git a/cbindgen-0.27.0/tests/expectations/cfg_tag.compat.c b/cbindgen-0.27.0/tests/expectations/cfg_tag.compat.c
new file mode 100644
index 0000000..ec97635
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cfg_tag.compat.c
@@ -0,0 +1,136 @@
+#if 0
+DEF PLATFORM_UNIX = 0
+DEF PLATFORM_WIN = 0
+DEF X11 = 0
+DEF M_32 = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+enum BarType
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ A,
+ B,
+ C,
+};
+#ifndef __cplusplus
+typedef uint32_t BarType;
+#endif // __cplusplus
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+enum FooType
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ A,
+ B,
+ C,
+};
+#ifndef __cplusplus
+typedef uint32_t FooType;
+#endif // __cplusplus
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+struct FooHandle {
+ FooType ty;
+ int32_t x;
+ float y;
+};
+#endif
+
+enum C_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ C1,
+ C2,
+#if defined(PLATFORM_WIN)
+ C3,
+#endif
+#if defined(PLATFORM_UNIX)
+ C5,
+#endif
+};
+#ifndef __cplusplus
+typedef uint8_t C_Tag;
+#endif // __cplusplus
+
+#if defined(PLATFORM_UNIX)
+struct C5_Body {
+ C_Tag tag;
+ int32_t int_;
+};
+#endif
+
+union C {
+ C_Tag tag;
+#if defined(PLATFORM_UNIX)
+ struct C5_Body c5;
+#endif
+};
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+struct BarHandle {
+ BarType ty;
+ int32_t x;
+ float y;
+};
+#endif
+
+struct ConditionalField {
+#if defined(X11)
+ int32_t field
+#endif
+ ;
+};
+
+struct Normal {
+ int32_t x;
+ float y;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#if defined(PLATFORM_WIN)
+extern int32_t global_array_with_different_sizes[2];
+#endif
+
+#if defined(PLATFORM_UNIX)
+extern int32_t global_array_with_different_sizes[1];
+#endif
+
+#if (defined(PLATFORM_UNIX) && defined(X11))
+void root(struct FooHandle a, union C c);
+#endif
+
+#if (defined(PLATFORM_WIN) || defined(M_32))
+void root(struct BarHandle a, union C c);
+#endif
+
+void cond(struct ConditionalField a);
+
+#if defined(PLATFORM_WIN)
+extern int32_t foo(void);
+#endif
+
+#if defined(PLATFORM_WIN)
+extern void bar(struct Normal a);
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/cfg_tag.pyx b/cbindgen-0.27.0/tests/expectations/cfg_tag.pyx
new file mode 100644
index 0000000..e508bb3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/cfg_tag.pyx
@@ -0,0 +1,83 @@
+#if 0
+DEF PLATFORM_UNIX = 0
+DEF PLATFORM_WIN = 0
+DEF X11 = 0
+DEF M_32 = 0
+#endif
+
+
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ IF (PLATFORM_WIN or M_32):
+ cdef enum:
+ A,
+ B,
+ C,
+ ctypedef uint32_t BarType;
+
+ IF (PLATFORM_UNIX and X11):
+ cdef enum:
+ A,
+ B,
+ C,
+ ctypedef uint32_t FooType;
+
+ IF (PLATFORM_UNIX and X11):
+ cdef struct FooHandle:
+ FooType ty;
+ int32_t x;
+ float y;
+
+ cdef enum:
+ C1,
+ C2,
+ C3,
+ C5,
+ ctypedef uint8_t C_Tag;
+
+ cdef struct C5_Body:
+ C_Tag tag;
+ int32_t int_;
+
+ cdef union C:
+ C_Tag tag;
+ C5_Body c5;
+
+ IF (PLATFORM_WIN or M_32):
+ cdef struct BarHandle:
+ BarType ty;
+ int32_t x;
+ float y;
+
+ cdef struct ConditionalField:
+ int32_t field;
+
+ cdef struct Normal:
+ int32_t x;
+ float y;
+
+ IF PLATFORM_WIN:
+ extern int32_t global_array_with_different_sizes[2];
+
+ IF PLATFORM_UNIX:
+ extern int32_t global_array_with_different_sizes[1];
+
+ IF (PLATFORM_UNIX and X11):
+ void root(FooHandle a, C c);
+
+ IF (PLATFORM_WIN or M_32):
+ void root(BarHandle a, C c);
+
+ void cond(ConditionalField a);
+
+ IF PLATFORM_WIN:
+ extern int32_t foo();
+
+ IF PLATFORM_WIN:
+ extern void bar(Normal a);
diff --git a/cbindgen-0.24.5/tests/expectations/char.c b/cbindgen-0.27.0/tests/expectations/char.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/char.c
rename to cbindgen-0.27.0/tests/expectations/char.c
diff --git a/cbindgen-0.27.0/tests/expectations/char.compat.c b/cbindgen-0.27.0/tests/expectations/char.compat.c
new file mode 100644
index 0000000..b6ea86e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/char.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ uint32_t a;
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/char.cpp b/cbindgen-0.27.0/tests/expectations/char.cpp
new file mode 100644
index 0000000..354541d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/char.cpp
@@ -0,0 +1,15 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Foo {
+ uint32_t a;
+};
+
+extern "C" {
+
+void root(Foo a);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/char.pyx b/cbindgen-0.27.0/tests/expectations/char.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/char.pyx
rename to cbindgen-0.27.0/tests/expectations/char.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/char.both.c b/cbindgen-0.27.0/tests/expectations/char_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/char.both.c
rename to cbindgen-0.27.0/tests/expectations/char_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/char_both.compat.c b/cbindgen-0.27.0/tests/expectations/char_both.compat.c
new file mode 100644
index 0000000..974f228
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/char_both.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo {
+ uint32_t a;
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/char.tag.c b/cbindgen-0.27.0/tests/expectations/char_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/char.tag.c
rename to cbindgen-0.27.0/tests/expectations/char_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/char_tag.compat.c b/cbindgen-0.27.0/tests/expectations/char_tag.compat.c
new file mode 100644
index 0000000..e68ba35
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/char_tag.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo {
+ uint32_t a;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/char.tag.pyx b/cbindgen-0.27.0/tests/expectations/char_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/char.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/char_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_conflict.compat.c b/cbindgen-0.27.0/tests/expectations/const_conflict.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_conflict.compat.c
rename to cbindgen-0.27.0/tests/expectations/const_conflict.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/const_conflict.cpp b/cbindgen-0.27.0/tests/expectations/const_conflict.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_conflict.cpp
rename to cbindgen-0.27.0/tests/expectations/const_conflict.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/const_conflict.pyx b/cbindgen-0.27.0/tests/expectations/const_conflict.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_conflict.pyx
rename to cbindgen-0.27.0/tests/expectations/const_conflict.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics.c b/cbindgen-0.27.0/tests/expectations/const_generics.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics.c
rename to cbindgen-0.27.0/tests/expectations/const_generics.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics.compat.c
new file mode 100644
index 0000000..5d149c3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics.compat.c
@@ -0,0 +1,25 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define TITLE_SIZE 80
+
+typedef int8_t CArrayString_TITLE_SIZE[TITLE_SIZE];
+
+typedef int8_t CArrayString_40[40];
+
+typedef struct {
+ CArrayString_TITLE_SIZE title;
+ CArrayString_40 author;
+} Book;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Book *a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics.cpp b/cbindgen-0.27.0/tests/expectations/const_generics.cpp
new file mode 100644
index 0000000..68a0ae7
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics.cpp
@@ -0,0 +1,21 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+constexpr static const uintptr_t TITLE_SIZE = 80;
+
+template<uintptr_t CAP>
+using CArrayString = int8_t[CAP];
+
+struct Book {
+ CArrayString<TITLE_SIZE> title;
+ CArrayString<40> author;
+};
+
+extern "C" {
+
+void root(Book *a);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics.pyx b/cbindgen-0.27.0/tests/expectations/const_generics.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.c b/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_arrayvec.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec.compat.c
new file mode 100644
index 0000000..c5267b2
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ uint8_t *xs[100];
+ uint32_t len;
+} ArrayVec_____u8__100;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+int32_t push(ArrayVec_____u8__100 *v, uint8_t *elem);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec.cpp b/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec.cpp
new file mode 100644
index 0000000..73e797f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec.cpp
@@ -0,0 +1,17 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T, uintptr_t CAP>
+struct ArrayVec {
+ T xs[CAP];
+ uint32_t len;
+};
+
+extern "C" {
+
+int32_t push(ArrayVec<uint8_t*, 100> *v, uint8_t *elem);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.pyx b/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics_arrayvec.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.both.c b/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.both.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_arrayvec_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec_both.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec_both.compat.c
new file mode 100644
index 0000000..313d761
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec_both.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct ArrayVec_____u8__100 {
+ uint8_t *xs[100];
+ uint32_t len;
+} ArrayVec_____u8__100;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+int32_t push(struct ArrayVec_____u8__100 *v, uint8_t *elem);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.tag.c b/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.tag.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_arrayvec_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec_tag.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec_tag.compat.c
new file mode 100644
index 0000000..019aaa5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec_tag.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct ArrayVec_____u8__100 {
+ uint8_t *xs[100];
+ uint32_t len;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+int32_t push(struct ArrayVec_____u8__100 *v, uint8_t *elem);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.tag.pyx b/cbindgen-0.27.0/tests/expectations/const_generics_arrayvec_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_arrayvec.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics_arrayvec_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_bool.c b/cbindgen-0.27.0/tests/expectations/const_generics_bool.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_bool.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_bool.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_bool.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_bool.compat.c
new file mode 100644
index 0000000..9110e22
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_bool.compat.c
@@ -0,0 +1,44 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef const char *Str;
+
+typedef struct {
+ uintptr_t num_buckets;
+ uintptr_t capacity;
+ uint8_t *occupied;
+ Str *keys;
+ char *vals;
+} HashTable_Str__c_char__false;
+
+typedef HashTable_Str__c_char__false MySet;
+
+typedef void (*SetCallback)(Str key);
+
+typedef struct {
+ uintptr_t num_buckets;
+ uintptr_t capacity;
+ uint8_t *occupied;
+ Str *keys;
+ uint64_t *vals;
+} HashTable_Str__u64__true;
+
+typedef void (*MapCallback)(Str key, uint64_t val);
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+MySet *new_set(void);
+
+void set_for_each(const MySet *set, SetCallback callback);
+
+HashTable_Str__u64__true *new_map(void);
+
+void map_for_each(const HashTable_Str__u64__true *map, MapCallback callback);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_bool.cpp b/cbindgen-0.27.0/tests/expectations/const_generics_bool.cpp
new file mode 100644
index 0000000..90b594d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_bool.cpp
@@ -0,0 +1,37 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T = void>
+struct MaybeUninit;
+
+using Str = const char*;
+
+template<typename K, typename V, bool IS_MAP>
+struct HashTable {
+ uintptr_t num_buckets;
+ uintptr_t capacity;
+ uint8_t *occupied;
+ MaybeUninit<K> *keys;
+ MaybeUninit<V> *vals;
+};
+
+using MySet = HashTable<Str, char, false>;
+
+using SetCallback = void(*)(Str key);
+
+using MapCallback = void(*)(Str key, uint64_t val);
+
+extern "C" {
+
+MySet *new_set();
+
+void set_for_each(const MySet *set, SetCallback callback);
+
+HashTable<Str, uint64_t, true> *new_map();
+
+void map_for_each(const HashTable<Str, uint64_t, true> *map, MapCallback callback);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_bool.pyx b/cbindgen-0.27.0/tests/expectations/const_generics_bool.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_bool.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics_bool.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_bool.both.c b/cbindgen-0.27.0/tests/expectations/const_generics_bool_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_bool.both.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_bool_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_bool_both.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_bool_both.compat.c
new file mode 100644
index 0000000..c1a44cd
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_bool_both.compat.c
@@ -0,0 +1,44 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef const char *Str;
+
+typedef struct HashTable_Str__c_char__false {
+ uintptr_t num_buckets;
+ uintptr_t capacity;
+ uint8_t *occupied;
+ Str *keys;
+ char *vals;
+} HashTable_Str__c_char__false;
+
+typedef struct HashTable_Str__c_char__false MySet;
+
+typedef void (*SetCallback)(Str key);
+
+typedef struct HashTable_Str__u64__true {
+ uintptr_t num_buckets;
+ uintptr_t capacity;
+ uint8_t *occupied;
+ Str *keys;
+ uint64_t *vals;
+} HashTable_Str__u64__true;
+
+typedef void (*MapCallback)(Str key, uint64_t val);
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+MySet *new_set(void);
+
+void set_for_each(const MySet *set, SetCallback callback);
+
+struct HashTable_Str__u64__true *new_map(void);
+
+void map_for_each(const struct HashTable_Str__u64__true *map, MapCallback callback);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_bool.tag.c b/cbindgen-0.27.0/tests/expectations/const_generics_bool_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_bool.tag.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_bool_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_bool_tag.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_bool_tag.compat.c
new file mode 100644
index 0000000..87faa6d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_bool_tag.compat.c
@@ -0,0 +1,44 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef const char *Str;
+
+struct HashTable_Str__c_char__false {
+ uintptr_t num_buckets;
+ uintptr_t capacity;
+ uint8_t *occupied;
+ Str *keys;
+ char *vals;
+};
+
+typedef struct HashTable_Str__c_char__false MySet;
+
+typedef void (*SetCallback)(Str key);
+
+struct HashTable_Str__u64__true {
+ uintptr_t num_buckets;
+ uintptr_t capacity;
+ uint8_t *occupied;
+ Str *keys;
+ uint64_t *vals;
+};
+
+typedef void (*MapCallback)(Str key, uint64_t val);
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+MySet *new_set(void);
+
+void set_for_each(const MySet *set, SetCallback callback);
+
+struct HashTable_Str__u64__true *new_map(void);
+
+void map_for_each(const struct HashTable_Str__u64__true *map, MapCallback callback);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_bool.tag.pyx b/cbindgen-0.27.0/tests/expectations/const_generics_bool_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_bool.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics_bool_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics.both.c b/cbindgen-0.27.0/tests/expectations/const_generics_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics.both.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_both.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_both.compat.c
new file mode 100644
index 0000000..245cc46
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_both.compat.c
@@ -0,0 +1,25 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define TITLE_SIZE 80
+
+typedef int8_t CArrayString_TITLE_SIZE[TITLE_SIZE];
+
+typedef int8_t CArrayString_40[40];
+
+typedef struct Book {
+ CArrayString_TITLE_SIZE title;
+ CArrayString_40 author;
+} Book;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Book *a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_byte.c b/cbindgen-0.27.0/tests/expectations/const_generics_byte.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_byte.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_byte.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_byte.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_byte.compat.c
new file mode 100644
index 0000000..edfa9dd
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_byte.compat.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ uint8_t *buf;
+ uintptr_t len;
+} Parser_40__41;
+
+typedef struct {
+ uint8_t *buf;
+ uintptr_t len;
+} Parser_123__125;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void init_parens_parser(Parser_40__41 *p, uint8_t *buf, uintptr_t len);
+
+void destroy_parens_parser(Parser_40__41 *p);
+
+void init_braces_parser(Parser_123__125 *p, uint8_t *buf, uintptr_t len);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_byte.cpp b/cbindgen-0.27.0/tests/expectations/const_generics_byte.cpp
new file mode 100644
index 0000000..411f9fd
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_byte.cpp
@@ -0,0 +1,21 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<uint8_t OPEN, uint8_t CLOSE>
+struct Parser {
+ uint8_t *buf;
+ uintptr_t len;
+};
+
+extern "C" {
+
+void init_parens_parser(Parser<40, 41> *p, uint8_t *buf, uintptr_t len);
+
+void destroy_parens_parser(Parser<40, 41> *p);
+
+void init_braces_parser(Parser<123, 125> *p, uint8_t *buf, uintptr_t len);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_byte.pyx b/cbindgen-0.27.0/tests/expectations/const_generics_byte.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_byte.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics_byte.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_byte.both.c b/cbindgen-0.27.0/tests/expectations/const_generics_byte_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_byte.both.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_byte_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_byte_both.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_byte_both.compat.c
new file mode 100644
index 0000000..c3ae14b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_byte_both.compat.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Parser_40__41 {
+ uint8_t *buf;
+ uintptr_t len;
+} Parser_40__41;
+
+typedef struct Parser_123__125 {
+ uint8_t *buf;
+ uintptr_t len;
+} Parser_123__125;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void init_parens_parser(struct Parser_40__41 *p, uint8_t *buf, uintptr_t len);
+
+void destroy_parens_parser(struct Parser_40__41 *p);
+
+void init_braces_parser(struct Parser_123__125 *p, uint8_t *buf, uintptr_t len);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_byte.tag.c b/cbindgen-0.27.0/tests/expectations/const_generics_byte_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_byte.tag.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_byte_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_byte_tag.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_byte_tag.compat.c
new file mode 100644
index 0000000..a25480e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_byte_tag.compat.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Parser_40__41 {
+ uint8_t *buf;
+ uintptr_t len;
+};
+
+struct Parser_123__125 {
+ uint8_t *buf;
+ uintptr_t len;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void init_parens_parser(struct Parser_40__41 *p, uint8_t *buf, uintptr_t len);
+
+void destroy_parens_parser(struct Parser_40__41 *p);
+
+void init_braces_parser(struct Parser_123__125 *p, uint8_t *buf, uintptr_t len);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_byte.tag.pyx b/cbindgen-0.27.0/tests/expectations/const_generics_byte_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_byte.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics_byte_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_char.c b/cbindgen-0.27.0/tests/expectations/const_generics_char.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_char.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_char.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_char.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_char.compat.c
new file mode 100644
index 0000000..57d64ac
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_char.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ const uint8_t *start;
+ uintptr_t len;
+ uintptr_t point;
+} TakeUntil_0;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+TakeUntil_0 until_nul(const uint8_t *start, uintptr_t len);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_char.cpp b/cbindgen-0.27.0/tests/expectations/const_generics_char.cpp
new file mode 100644
index 0000000..7c5108c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_char.cpp
@@ -0,0 +1,18 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<uint32_t V>
+struct TakeUntil {
+ const uint8_t *start;
+ uintptr_t len;
+ uintptr_t point;
+};
+
+extern "C" {
+
+TakeUntil<0> until_nul(const uint8_t *start, uintptr_t len);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_char.pyx b/cbindgen-0.27.0/tests/expectations/const_generics_char.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_char.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics_char.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_char.both.c b/cbindgen-0.27.0/tests/expectations/const_generics_char_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_char.both.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_char_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_char_both.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_char_both.compat.c
new file mode 100644
index 0000000..a265c72
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_char_both.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct TakeUntil_0 {
+ const uint8_t *start;
+ uintptr_t len;
+ uintptr_t point;
+} TakeUntil_0;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+struct TakeUntil_0 until_nul(const uint8_t *start, uintptr_t len);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_char.tag.c b/cbindgen-0.27.0/tests/expectations/const_generics_char_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_char.tag.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_char_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_char_tag.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_char_tag.compat.c
new file mode 100644
index 0000000..7492706
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_char_tag.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct TakeUntil_0 {
+ const uint8_t *start;
+ uintptr_t len;
+ uintptr_t point;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+struct TakeUntil_0 until_nul(const uint8_t *start, uintptr_t len);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_char.tag.pyx b/cbindgen-0.27.0/tests/expectations/const_generics_char_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_char.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics_char_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_constant.c b/cbindgen-0.27.0/tests/expectations/const_generics_constant.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_constant.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_constant.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_constant.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_constant.compat.c
new file mode 100644
index 0000000..e40eeca
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_constant.compat.c
@@ -0,0 +1,27 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define FONT_WEIGHT_FRACTION_BITS 6
+
+typedef struct {
+ uint16_t value;
+} FixedPoint_FONT_WEIGHT_FRACTION_BITS;
+
+typedef FixedPoint_FONT_WEIGHT_FRACTION_BITS FontWeightFixedPoint;
+
+typedef struct {
+ FontWeightFixedPoint _0;
+} FontWeight;
+#define FontWeight_NORMAL (FontWeight){ ._0 = (FontWeightFixedPoint){ .value = (400 << FONT_WEIGHT_FRACTION_BITS) } }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(FontWeight w);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_constant.cpp b/cbindgen-0.27.0/tests/expectations/const_generics_constant.cpp
new file mode 100644
index 0000000..f0dd5fd
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_constant.cpp
@@ -0,0 +1,25 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+constexpr static const uint16_t FONT_WEIGHT_FRACTION_BITS = 6;
+
+template<uint16_t FRACTION_BITS>
+struct FixedPoint {
+ uint16_t value;
+};
+
+using FontWeightFixedPoint = FixedPoint<FONT_WEIGHT_FRACTION_BITS>;
+
+struct FontWeight {
+ FontWeightFixedPoint _0;
+};
+constexpr static const FontWeight FontWeight_NORMAL = FontWeight{ /* ._0 = */ FontWeightFixedPoint{ /* .value = */ (400 << FONT_WEIGHT_FRACTION_BITS) } };
+
+extern "C" {
+
+void root(FontWeight w);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_constant.pyx b/cbindgen-0.27.0/tests/expectations/const_generics_constant.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_constant.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics_constant.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_constant.both.c b/cbindgen-0.27.0/tests/expectations/const_generics_constant_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_constant.both.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_constant_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_constant_both.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_constant_both.compat.c
new file mode 100644
index 0000000..23f6e6c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_constant_both.compat.c
@@ -0,0 +1,27 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define FONT_WEIGHT_FRACTION_BITS 6
+
+typedef struct FixedPoint_FONT_WEIGHT_FRACTION_BITS {
+ uint16_t value;
+} FixedPoint_FONT_WEIGHT_FRACTION_BITS;
+
+typedef struct FixedPoint_FONT_WEIGHT_FRACTION_BITS FontWeightFixedPoint;
+
+typedef struct FontWeight {
+ FontWeightFixedPoint _0;
+} FontWeight;
+#define FontWeight_NORMAL (FontWeight){ ._0 = (FontWeightFixedPoint){ .value = (400 << FONT_WEIGHT_FRACTION_BITS) } }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct FontWeight w);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_constant.tag.c b/cbindgen-0.27.0/tests/expectations/const_generics_constant_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_constant.tag.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_constant_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_constant_tag.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_constant_tag.compat.c
new file mode 100644
index 0000000..cd8dab3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_constant_tag.compat.c
@@ -0,0 +1,27 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define FONT_WEIGHT_FRACTION_BITS 6
+
+struct FixedPoint_FONT_WEIGHT_FRACTION_BITS {
+ uint16_t value;
+};
+
+typedef struct FixedPoint_FONT_WEIGHT_FRACTION_BITS FontWeightFixedPoint;
+
+struct FontWeight {
+ FontWeightFixedPoint _0;
+};
+#define FontWeight_NORMAL (FontWeight){ ._0 = (FontWeightFixedPoint){ .value = (400 << FONT_WEIGHT_FRACTION_BITS) } }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct FontWeight w);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_constant.tag.pyx b/cbindgen-0.27.0/tests/expectations/const_generics_constant_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_constant.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics_constant_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics.tag.c b/cbindgen-0.27.0/tests/expectations/const_generics_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics.tag.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_tag.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_tag.compat.c
new file mode 100644
index 0000000..1d9b90d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_tag.compat.c
@@ -0,0 +1,25 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define TITLE_SIZE 80
+
+typedef int8_t CArrayString_TITLE_SIZE[TITLE_SIZE];
+
+typedef int8_t CArrayString_40[40];
+
+struct Book {
+ CArrayString_TITLE_SIZE title;
+ CArrayString_40 author;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Book *a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics.tag.pyx b/cbindgen-0.27.0/tests/expectations/const_generics_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_thru.c b/cbindgen-0.27.0/tests/expectations/const_generics_thru.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_thru.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_thru.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_thru.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_thru.compat.c
new file mode 100644
index 0000000..b17b95b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_thru.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ uint8_t bytes[1];
+} Inner_1;
+
+typedef struct {
+ Inner_1 inner;
+} Outer_1;
+
+typedef struct {
+ uint8_t bytes[2];
+} Inner_2;
+
+typedef struct {
+ Inner_2 inner;
+} Outer_2;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+Outer_1 one(void);
+
+Outer_2 two(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_thru.cpp b/cbindgen-0.27.0/tests/expectations/const_generics_thru.cpp
new file mode 100644
index 0000000..de646d9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_thru.cpp
@@ -0,0 +1,23 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<uintptr_t N>
+struct Inner {
+ uint8_t bytes[N];
+};
+
+template<uintptr_t N>
+struct Outer {
+ Inner<N> inner;
+};
+
+extern "C" {
+
+Outer<1> one();
+
+Outer<2> two();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_thru.pyx b/cbindgen-0.27.0/tests/expectations/const_generics_thru.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_thru.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics_thru.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_thru.both.c b/cbindgen-0.27.0/tests/expectations/const_generics_thru_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_thru.both.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_thru_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_thru_both.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_thru_both.compat.c
new file mode 100644
index 0000000..6237dcf
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_thru_both.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Inner_1 {
+ uint8_t bytes[1];
+} Inner_1;
+
+typedef struct Outer_1 {
+ struct Inner_1 inner;
+} Outer_1;
+
+typedef struct Inner_2 {
+ uint8_t bytes[2];
+} Inner_2;
+
+typedef struct Outer_2 {
+ struct Inner_2 inner;
+} Outer_2;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+struct Outer_1 one(void);
+
+struct Outer_2 two(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_thru.tag.c b/cbindgen-0.27.0/tests/expectations/const_generics_thru_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_thru.tag.c
rename to cbindgen-0.27.0/tests/expectations/const_generics_thru_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/const_generics_thru_tag.compat.c b/cbindgen-0.27.0/tests/expectations/const_generics_thru_tag.compat.c
new file mode 100644
index 0000000..abc5f99
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_generics_thru_tag.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Inner_1 {
+ uint8_t bytes[1];
+};
+
+struct Outer_1 {
+ struct Inner_1 inner;
+};
+
+struct Inner_2 {
+ uint8_t bytes[2];
+};
+
+struct Outer_2 {
+ struct Inner_2 inner;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+struct Outer_1 one(void);
+
+struct Outer_2 two(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/const_generics_thru.tag.pyx b/cbindgen-0.27.0/tests/expectations/const_generics_thru_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/const_generics_thru.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/const_generics_thru_tag.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/const_transparent.compat.c b/cbindgen-0.27.0/tests/expectations/const_transparent.compat.c
new file mode 100644
index 0000000..62100f7
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_transparent.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef uint8_t TransparentStruct;
+#define TransparentStruct_ASSOC_STRUCT_FOO 1
+#define TransparentStruct_ASSOC_STRUCT_BAR 2
+
+
+typedef uint8_t TransparentTupleStruct;
+
+#define STRUCT_FOO 4
+
+#define STRUCT_BAR 5
+
+
+
+
diff --git a/cbindgen-0.27.0/tests/expectations/const_transparent.cpp b/cbindgen-0.27.0/tests/expectations/const_transparent.cpp
new file mode 100644
index 0000000..963ee7f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_transparent.cpp
@@ -0,0 +1,26 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T>
+using Wrapper = T;
+
+using TransparentStruct = uint8_t;
+constexpr static const int64_t TransparentStruct_ASSOC_STRUCT_FOO = 1;
+constexpr static const TransparentStruct TransparentStruct_ASSOC_STRUCT_BAR = 2;
+constexpr static const Wrapper<TransparentStruct> TransparentStruct_ASSOC_STRUCT_BAZ = 3;
+
+using TransparentTupleStruct = uint8_t;
+
+template<typename T>
+using TransparentStructWithErasedField = Wrapper<T>;
+
+constexpr static const TransparentStruct STRUCT_FOO = 4;
+
+constexpr static const TransparentTupleStruct STRUCT_BAR = 5;
+
+constexpr static const Wrapper<TransparentStruct> STRUCT_BAZ = 6;
+
+constexpr static const TransparentStructWithErasedField<TransparentStruct> COMPLEX = 7;
diff --git a/cbindgen-0.27.0/tests/expectations/const_transparent.pyx b/cbindgen-0.27.0/tests/expectations/const_transparent.pyx
new file mode 100644
index 0000000..c0993a3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/const_transparent.pyx
@@ -0,0 +1,22 @@
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ ctypedef uint8_t TransparentStruct;
+ const int64_t TransparentStruct_ASSOC_STRUCT_FOO # = 1
+ const TransparentStruct TransparentStruct_ASSOC_STRUCT_BAR # = 2
+
+
+ ctypedef uint8_t TransparentTupleStruct;
+
+ const TransparentStruct STRUCT_FOO # = 4
+
+ const TransparentTupleStruct STRUCT_BAR # = 5
+
+
+
+
diff --git a/cbindgen-0.24.5/tests/expectations/constant.c b/cbindgen-0.27.0/tests/expectations/constant.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant.c
rename to cbindgen-0.27.0/tests/expectations/constant.c
diff --git a/cbindgen-0.27.0/tests/expectations/constant.compat.c b/cbindgen-0.27.0/tests/expectations/constant.compat.c
new file mode 100644
index 0000000..2906a06
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/constant.compat.c
@@ -0,0 +1,61 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define FOO 10
+
+#define DELIMITER ':'
+
+#define LEFTCURLY '{'
+
+#define QUOTE '\''
+
+#define TAB '\t'
+
+#define NEWLINE '\n'
+
+#define HEART U'\U00002764'
+
+#define EQUID U'\U00010083'
+
+#define ZOM 3.14
+
+/**
+ * A single-line doc comment.
+ */
+#define POS_ONE 1
+
+/**
+ * A
+ * multi-line
+ * doc
+ * comment.
+ */
+#define NEG_ONE -1
+
+#define SHIFT 3
+
+#define XBOOL 1
+
+#define XFALSE ((0 << SHIFT) | XBOOL)
+
+#define XTRUE (1 << (SHIFT | XBOOL))
+
+#define CAST (uint8_t)'A'
+
+#define DOUBLE_CAST (uint32_t)(float)1
+
+typedef struct {
+ int32_t x[FOO];
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Foo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/constant.cpp b/cbindgen-0.27.0/tests/expectations/constant.cpp
new file mode 100644
index 0000000..b72206b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/constant.cpp
@@ -0,0 +1,54 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+constexpr static const int32_t FOO = 10;
+
+constexpr static const uint32_t DELIMITER = ':';
+
+constexpr static const uint32_t LEFTCURLY = '{';
+
+constexpr static const uint32_t QUOTE = '\'';
+
+constexpr static const uint32_t TAB = '\t';
+
+constexpr static const uint32_t NEWLINE = '\n';
+
+constexpr static const uint32_t HEART = U'\U00002764';
+
+constexpr static const uint32_t EQUID = U'\U00010083';
+
+constexpr static const float ZOM = 3.14;
+
+/// A single-line doc comment.
+constexpr static const int8_t POS_ONE = 1;
+
+/// A
+/// multi-line
+/// doc
+/// comment.
+constexpr static const int8_t NEG_ONE = -1;
+
+constexpr static const int64_t SHIFT = 3;
+
+constexpr static const int64_t XBOOL = 1;
+
+constexpr static const int64_t XFALSE = ((0 << SHIFT) | XBOOL);
+
+constexpr static const int64_t XTRUE = (1 << (SHIFT | XBOOL));
+
+constexpr static const uint8_t CAST = (uint8_t)'A';
+
+constexpr static const uint32_t DOUBLE_CAST = (uint32_t)(float)1;
+
+struct Foo {
+ int32_t x[FOO];
+};
+
+extern "C" {
+
+void root(Foo x);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/constant.pyx b/cbindgen-0.27.0/tests/expectations/constant.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant.pyx
rename to cbindgen-0.27.0/tests/expectations/constant.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/constant_big.compat.c b/cbindgen-0.27.0/tests/expectations/constant_big.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_big.compat.c
rename to cbindgen-0.27.0/tests/expectations/constant_big.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/constant_big.cpp b/cbindgen-0.27.0/tests/expectations/constant_big.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_big.cpp
rename to cbindgen-0.27.0/tests/expectations/constant_big.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/constant_big.pyx b/cbindgen-0.27.0/tests/expectations/constant_big.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_big.pyx
rename to cbindgen-0.27.0/tests/expectations/constant_big.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/constant.both.c b/cbindgen-0.27.0/tests/expectations/constant_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant.both.c
rename to cbindgen-0.27.0/tests/expectations/constant_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/constant_both.compat.c b/cbindgen-0.27.0/tests/expectations/constant_both.compat.c
new file mode 100644
index 0000000..467fd70
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/constant_both.compat.c
@@ -0,0 +1,61 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define FOO 10
+
+#define DELIMITER ':'
+
+#define LEFTCURLY '{'
+
+#define QUOTE '\''
+
+#define TAB '\t'
+
+#define NEWLINE '\n'
+
+#define HEART U'\U00002764'
+
+#define EQUID U'\U00010083'
+
+#define ZOM 3.14
+
+/**
+ * A single-line doc comment.
+ */
+#define POS_ONE 1
+
+/**
+ * A
+ * multi-line
+ * doc
+ * comment.
+ */
+#define NEG_ONE -1
+
+#define SHIFT 3
+
+#define XBOOL 1
+
+#define XFALSE ((0 << SHIFT) | XBOOL)
+
+#define XTRUE (1 << (SHIFT | XBOOL))
+
+#define CAST (uint8_t)'A'
+
+#define DOUBLE_CAST (uint32_t)(float)1
+
+typedef struct Foo {
+ int32_t x[FOO];
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/constant_constexpr.compat.c b/cbindgen-0.27.0/tests/expectations/constant_constexpr.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_constexpr.compat.c
rename to cbindgen-0.27.0/tests/expectations/constant_constexpr.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/constant_constexpr.cpp b/cbindgen-0.27.0/tests/expectations/constant_constexpr.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_constexpr.cpp
rename to cbindgen-0.27.0/tests/expectations/constant_constexpr.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/constant_constexpr.pyx b/cbindgen-0.27.0/tests/expectations/constant_constexpr.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_constexpr.pyx
rename to cbindgen-0.27.0/tests/expectations/constant_constexpr.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/constant_constexpr.both.compat.c b/cbindgen-0.27.0/tests/expectations/constant_constexpr_both.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_constexpr.both.compat.c
rename to cbindgen-0.27.0/tests/expectations/constant_constexpr_both.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/constant_constexpr.tag.compat.c b/cbindgen-0.27.0/tests/expectations/constant_constexpr_tag.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_constexpr.tag.compat.c
rename to cbindgen-0.27.0/tests/expectations/constant_constexpr_tag.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/constant_constexpr.tag.pyx b/cbindgen-0.27.0/tests/expectations/constant_constexpr_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_constexpr.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/constant_constexpr_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/constant_sort_name.c b/cbindgen-0.27.0/tests/expectations/constant_sort_name.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_sort_name.c
rename to cbindgen-0.27.0/tests/expectations/constant_sort_name.c
diff --git a/cbindgen-0.27.0/tests/expectations/constant_sort_name.compat.c b/cbindgen-0.27.0/tests/expectations/constant_sort_name.compat.c
new file mode 100644
index 0000000..2090b6c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/constant_sort_name.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define A 0
+
+#define B 0
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern const uint8_t C;
+
+extern const uint8_t D;
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/constant_sort_name.cpp b/cbindgen-0.27.0/tests/expectations/constant_sort_name.cpp
new file mode 100644
index 0000000..d0cd07a
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/constant_sort_name.cpp
@@ -0,0 +1,17 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+constexpr static const uint8_t A = 0;
+
+constexpr static const uint8_t B = 0;
+
+extern "C" {
+
+extern const uint8_t C;
+
+extern const uint8_t D;
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/constant_sort_name.pyx b/cbindgen-0.27.0/tests/expectations/constant_sort_name.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_sort_name.pyx
rename to cbindgen-0.27.0/tests/expectations/constant_sort_name.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/constant_sort_none.c b/cbindgen-0.27.0/tests/expectations/constant_sort_none.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_sort_none.c
rename to cbindgen-0.27.0/tests/expectations/constant_sort_none.c
diff --git a/cbindgen-0.27.0/tests/expectations/constant_sort_none.compat.c b/cbindgen-0.27.0/tests/expectations/constant_sort_none.compat.c
new file mode 100644
index 0000000..a61fa15
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/constant_sort_none.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define B 0
+
+#define A 0
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern const uint8_t D;
+
+extern const uint8_t C;
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/constant_sort_none.cpp b/cbindgen-0.27.0/tests/expectations/constant_sort_none.cpp
new file mode 100644
index 0000000..17113a9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/constant_sort_none.cpp
@@ -0,0 +1,17 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+constexpr static const uint8_t B = 0;
+
+constexpr static const uint8_t A = 0;
+
+extern "C" {
+
+extern const uint8_t D;
+
+extern const uint8_t C;
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/constant_sort_none.pyx b/cbindgen-0.27.0/tests/expectations/constant_sort_none.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_sort_none.pyx
rename to cbindgen-0.27.0/tests/expectations/constant_sort_none.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/constant.tag.c b/cbindgen-0.27.0/tests/expectations/constant_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant.tag.c
rename to cbindgen-0.27.0/tests/expectations/constant_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/constant_tag.compat.c b/cbindgen-0.27.0/tests/expectations/constant_tag.compat.c
new file mode 100644
index 0000000..d406f5e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/constant_tag.compat.c
@@ -0,0 +1,61 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define FOO 10
+
+#define DELIMITER ':'
+
+#define LEFTCURLY '{'
+
+#define QUOTE '\''
+
+#define TAB '\t'
+
+#define NEWLINE '\n'
+
+#define HEART U'\U00002764'
+
+#define EQUID U'\U00010083'
+
+#define ZOM 3.14
+
+/**
+ * A single-line doc comment.
+ */
+#define POS_ONE 1
+
+/**
+ * A
+ * multi-line
+ * doc
+ * comment.
+ */
+#define NEG_ONE -1
+
+#define SHIFT 3
+
+#define XBOOL 1
+
+#define XFALSE ((0 << SHIFT) | XBOOL)
+
+#define XTRUE (1 << (SHIFT | XBOOL))
+
+#define CAST (uint8_t)'A'
+
+#define DOUBLE_CAST (uint32_t)(float)1
+
+struct Foo {
+ int32_t x[FOO];
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/constant.tag.pyx b/cbindgen-0.27.0/tests/expectations/constant_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/constant_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/constant_user_defined_type.compat.c b/cbindgen-0.27.0/tests/expectations/constant_user_defined_type.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_user_defined_type.compat.c
rename to cbindgen-0.27.0/tests/expectations/constant_user_defined_type.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/constant_user_defined_type.cpp b/cbindgen-0.27.0/tests/expectations/constant_user_defined_type.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_user_defined_type.cpp
rename to cbindgen-0.27.0/tests/expectations/constant_user_defined_type.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/constant_user_defined_type.pyx b/cbindgen-0.27.0/tests/expectations/constant_user_defined_type.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_user_defined_type.pyx
rename to cbindgen-0.27.0/tests/expectations/constant_user_defined_type.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/constant_user_defined_type.both.compat.c b/cbindgen-0.27.0/tests/expectations/constant_user_defined_type_both.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_user_defined_type.both.compat.c
rename to cbindgen-0.27.0/tests/expectations/constant_user_defined_type_both.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/constant_user_defined_type.tag.compat.c b/cbindgen-0.27.0/tests/expectations/constant_user_defined_type_tag.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_user_defined_type.tag.compat.c
rename to cbindgen-0.27.0/tests/expectations/constant_user_defined_type_tag.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/constant_user_defined_type.tag.pyx b/cbindgen-0.27.0/tests/expectations/constant_user_defined_type_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/constant_user_defined_type.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/constant_user_defined_type_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/custom_header.c b/cbindgen-0.27.0/tests/expectations/custom_header.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/custom_header.c
rename to cbindgen-0.27.0/tests/expectations/custom_header.c
diff --git a/cbindgen-0.27.0/tests/expectations/custom_header.compat.c b/cbindgen-0.27.0/tests/expectations/custom_header.compat.c
new file mode 100644
index 0000000..9b99752
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/custom_header.compat.c
@@ -0,0 +1,18 @@
+#if 0
+# This file is generated by cbindgen. DO NOT EDIT
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#if 0
+# This is a simple test to ensure that trailers do not cause extra newlines in files
+#endif
diff --git a/cbindgen-0.27.0/tests/expectations/custom_header.cpp b/cbindgen-0.27.0/tests/expectations/custom_header.cpp
new file mode 100644
index 0000000..a4d445a
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/custom_header.cpp
@@ -0,0 +1,14 @@
+#if 0
+# This file is generated by cbindgen. DO NOT EDIT
+#endif
+
+
+extern "C" {
+
+void root();
+
+} // extern "C"
+
+#if 0
+# This is a simple test to ensure that trailers do not cause extra newlines in files
+#endif
diff --git a/cbindgen-0.24.5/tests/expectations/custom_header.pyx b/cbindgen-0.27.0/tests/expectations/custom_header.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/custom_header.pyx
rename to cbindgen-0.27.0/tests/expectations/custom_header.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/cython_options.compat.c b/cbindgen-0.27.0/tests/expectations/cython_options.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cython_options.compat.c
rename to cbindgen-0.27.0/tests/expectations/cython_options.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/cython_options.cpp b/cbindgen-0.27.0/tests/expectations/cython_options.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cython_options.cpp
rename to cbindgen-0.27.0/tests/expectations/cython_options.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/cython_options.pyx b/cbindgen-0.27.0/tests/expectations/cython_options.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/cython_options.pyx
rename to cbindgen-0.27.0/tests/expectations/cython_options.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.c b/cbindgen-0.27.0/tests/expectations/decl_name_conflicting.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/decl_name_conflicting.c
rename to cbindgen-0.27.0/tests/expectations/decl_name_conflicting.c
diff --git a/cbindgen-0.27.0/tests/expectations/decl_name_conflicting.compat.c b/cbindgen-0.27.0/tests/expectations/decl_name_conflicting.compat.c
new file mode 100644
index 0000000..6866bb8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/decl_name_conflicting.compat.c
@@ -0,0 +1,30 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum BindingType
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ Buffer = 0,
+ NotBuffer = 1,
+};
+#ifndef __cplusplus
+typedef uint32_t BindingType;
+#endif // __cplusplus
+
+typedef struct {
+ BindingType ty;
+} BindGroupLayoutEntry;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(BindGroupLayoutEntry entry);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/decl_name_conflicting.cpp b/cbindgen-0.27.0/tests/expectations/decl_name_conflicting.cpp
new file mode 100644
index 0000000..bc675c1
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/decl_name_conflicting.cpp
@@ -0,0 +1,20 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+enum class BindingType : uint32_t {
+ Buffer = 0,
+ NotBuffer = 1,
+};
+
+struct BindGroupLayoutEntry {
+ BindingType ty;
+};
+
+extern "C" {
+
+void root(BindGroupLayoutEntry entry);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.pyx b/cbindgen-0.27.0/tests/expectations/decl_name_conflicting.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/decl_name_conflicting.pyx
rename to cbindgen-0.27.0/tests/expectations/decl_name_conflicting.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.both.c b/cbindgen-0.27.0/tests/expectations/decl_name_conflicting_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/decl_name_conflicting.both.c
rename to cbindgen-0.27.0/tests/expectations/decl_name_conflicting_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/decl_name_conflicting_both.compat.c b/cbindgen-0.27.0/tests/expectations/decl_name_conflicting_both.compat.c
new file mode 100644
index 0000000..143f0d1
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/decl_name_conflicting_both.compat.c
@@ -0,0 +1,30 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum BindingType
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ Buffer = 0,
+ NotBuffer = 1,
+};
+#ifndef __cplusplus
+typedef uint32_t BindingType;
+#endif // __cplusplus
+
+typedef struct BindGroupLayoutEntry {
+ BindingType ty;
+} BindGroupLayoutEntry;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct BindGroupLayoutEntry entry);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.tag.c b/cbindgen-0.27.0/tests/expectations/decl_name_conflicting_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/decl_name_conflicting.tag.c
rename to cbindgen-0.27.0/tests/expectations/decl_name_conflicting_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/decl_name_conflicting_tag.compat.c b/cbindgen-0.27.0/tests/expectations/decl_name_conflicting_tag.compat.c
new file mode 100644
index 0000000..df722be
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/decl_name_conflicting_tag.compat.c
@@ -0,0 +1,30 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum BindingType
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ Buffer = 0,
+ NotBuffer = 1,
+};
+#ifndef __cplusplus
+typedef uint32_t BindingType;
+#endif // __cplusplus
+
+struct BindGroupLayoutEntry {
+ BindingType ty;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct BindGroupLayoutEntry entry);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/decl_name_conflicting.tag.pyx b/cbindgen-0.27.0/tests/expectations/decl_name_conflicting_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/decl_name_conflicting.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/decl_name_conflicting_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.c b/cbindgen-0.27.0/tests/expectations/dep_v2.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/dep_v2.c
rename to cbindgen-0.27.0/tests/expectations/dep_v2.c
diff --git a/cbindgen-0.27.0/tests/expectations/dep_v2.compat.c b/cbindgen-0.27.0/tests/expectations/dep_v2.compat.c
new file mode 100644
index 0000000..52d47f8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/dep_v2.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ uint32_t x;
+ double y;
+} dep_struct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+uint32_t get_x(const dep_struct *dep_struct);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/dep_v2.cpp b/cbindgen-0.27.0/tests/expectations/dep_v2.cpp
new file mode 100644
index 0000000..1190c29
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/dep_v2.cpp
@@ -0,0 +1,16 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct dep_struct {
+ uint32_t x;
+ double y;
+};
+
+extern "C" {
+
+uint32_t get_x(const dep_struct *dep_struct);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.pyx b/cbindgen-0.27.0/tests/expectations/dep_v2.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/dep_v2.pyx
rename to cbindgen-0.27.0/tests/expectations/dep_v2.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.both.c b/cbindgen-0.27.0/tests/expectations/dep_v2_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/dep_v2.both.c
rename to cbindgen-0.27.0/tests/expectations/dep_v2_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/dep_v2_both.compat.c b/cbindgen-0.27.0/tests/expectations/dep_v2_both.compat.c
new file mode 100644
index 0000000..9b6c2e3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/dep_v2_both.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct dep_struct {
+ uint32_t x;
+ double y;
+} dep_struct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+uint32_t get_x(const struct dep_struct *dep_struct);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.tag.c b/cbindgen-0.27.0/tests/expectations/dep_v2_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/dep_v2.tag.c
rename to cbindgen-0.27.0/tests/expectations/dep_v2_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/dep_v2_tag.compat.c b/cbindgen-0.27.0/tests/expectations/dep_v2_tag.compat.c
new file mode 100644
index 0000000..51aee8f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/dep_v2_tag.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct dep_struct {
+ uint32_t x;
+ double y;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+uint32_t get_x(const struct dep_struct *dep_struct);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.tag.pyx b/cbindgen-0.27.0/tests/expectations/dep_v2_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/dep_v2.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/dep_v2_tag.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/deprecated.c b/cbindgen-0.27.0/tests/expectations/deprecated.c
new file mode 100644
index 0000000..48f5574
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/deprecated.c
@@ -0,0 +1,87 @@
+#define DEPRECATED_FUNC __attribute__((deprecated))
+#define DEPRECATED_STRUCT __attribute__((deprecated))
+#define DEPRECATED_ENUM __attribute__((deprecated))
+#define DEPRECATED_ENUM_VARIANT __attribute__((deprecated))
+#define DEPRECATED_FUNC_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_STRUCT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_VARIANT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum DEPRECATED_ENUM DeprecatedEnum {
+ A = 0,
+};
+typedef int32_t DeprecatedEnum;
+
+enum DEPRECATED_ENUM_WITH_NOTE("This is a note") DeprecatedEnumWithNote {
+ B = 0,
+};
+typedef int32_t DeprecatedEnumWithNote;
+
+enum EnumWithDeprecatedVariants {
+ C = 0,
+ D DEPRECATED_ENUM_VARIANT = 1,
+ E DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 2,
+ F DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 3,
+};
+typedef int32_t EnumWithDeprecatedVariants;
+
+typedef struct DEPRECATED_STRUCT {
+ int32_t a;
+} DeprecatedStruct;
+
+typedef struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") {
+ int32_t a;
+} DeprecatedStructWithNote;
+
+enum EnumWithDeprecatedStructVariants_Tag {
+ Foo,
+ Bar DEPRECATED_ENUM_VARIANT,
+ Baz DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note"),
+};
+typedef uint8_t EnumWithDeprecatedStructVariants_Tag;
+
+typedef struct DEPRECATED_STRUCT {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ int16_t y;
+} Bar_Body;
+
+typedef struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ uint8_t y;
+} Baz_Body;
+
+typedef union {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ struct {
+ EnumWithDeprecatedStructVariants_Tag foo_tag;
+ int16_t foo;
+ };
+ Bar_Body bar;
+ Baz_Body baz;
+} EnumWithDeprecatedStructVariants;
+
+DEPRECATED_FUNC void deprecated_without_note(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_without_bracket(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note_and_since(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This quote \" requires to be quoted, and this [\n] requires to be escaped")
+void deprecated_with_note_which_requires_to_be_escaped(void);
+
+void dummy(DeprecatedEnum a,
+ DeprecatedEnumWithNote b,
+ EnumWithDeprecatedVariants c,
+ DeprecatedStruct d,
+ DeprecatedStructWithNote e,
+ EnumWithDeprecatedStructVariants f);
diff --git a/cbindgen-0.27.0/tests/expectations/deprecated.compat.c b/cbindgen-0.27.0/tests/expectations/deprecated.compat.c
new file mode 100644
index 0000000..dcdede4
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/deprecated.compat.c
@@ -0,0 +1,119 @@
+#define DEPRECATED_FUNC __attribute__((deprecated))
+#define DEPRECATED_STRUCT __attribute__((deprecated))
+#define DEPRECATED_ENUM __attribute__((deprecated))
+#define DEPRECATED_ENUM_VARIANT __attribute__((deprecated))
+#define DEPRECATED_FUNC_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_STRUCT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_VARIANT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum DEPRECATED_ENUM DeprecatedEnum
+#ifdef __cplusplus
+ : int32_t
+#endif // __cplusplus
+ {
+ A = 0,
+};
+#ifndef __cplusplus
+typedef int32_t DeprecatedEnum;
+#endif // __cplusplus
+
+enum DEPRECATED_ENUM_WITH_NOTE("This is a note") DeprecatedEnumWithNote
+#ifdef __cplusplus
+ : int32_t
+#endif // __cplusplus
+ {
+ B = 0,
+};
+#ifndef __cplusplus
+typedef int32_t DeprecatedEnumWithNote;
+#endif // __cplusplus
+
+enum EnumWithDeprecatedVariants
+#ifdef __cplusplus
+ : int32_t
+#endif // __cplusplus
+ {
+ C = 0,
+ D DEPRECATED_ENUM_VARIANT = 1,
+ E DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 2,
+ F DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 3,
+};
+#ifndef __cplusplus
+typedef int32_t EnumWithDeprecatedVariants;
+#endif // __cplusplus
+
+typedef struct DEPRECATED_STRUCT {
+ int32_t a;
+} DeprecatedStruct;
+
+typedef struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") {
+ int32_t a;
+} DeprecatedStructWithNote;
+
+enum EnumWithDeprecatedStructVariants_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo,
+ Bar DEPRECATED_ENUM_VARIANT,
+ Baz DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note"),
+};
+#ifndef __cplusplus
+typedef uint8_t EnumWithDeprecatedStructVariants_Tag;
+#endif // __cplusplus
+
+typedef struct DEPRECATED_STRUCT {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ int16_t y;
+} Bar_Body;
+
+typedef struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ uint8_t y;
+} Baz_Body;
+
+typedef union {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ struct {
+ EnumWithDeprecatedStructVariants_Tag foo_tag;
+ int16_t foo;
+ };
+ Bar_Body bar;
+ Baz_Body baz;
+} EnumWithDeprecatedStructVariants;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+DEPRECATED_FUNC void deprecated_without_note(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_without_bracket(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note_and_since(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This quote \" requires to be quoted, and this [\n] requires to be escaped")
+void deprecated_with_note_which_requires_to_be_escaped(void);
+
+void dummy(DeprecatedEnum a,
+ DeprecatedEnumWithNote b,
+ EnumWithDeprecatedVariants c,
+ DeprecatedStruct d,
+ DeprecatedStructWithNote e,
+ EnumWithDeprecatedStructVariants f);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/deprecated.cpp b/cbindgen-0.27.0/tests/expectations/deprecated.cpp
new file mode 100644
index 0000000..d7bd3d6
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/deprecated.cpp
@@ -0,0 +1,92 @@
+#define DEPRECATED_FUNC __attribute__((deprecated))
+#define DEPRECATED_STRUCT __attribute__((deprecated))
+#define DEPRECATED_ENUM __attribute__((deprecated))
+#define DEPRECATED_ENUM_VARIANT __attribute__((deprecated))
+#define DEPRECATED_FUNC_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_STRUCT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_VARIANT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+enum class DEPRECATED_ENUM DeprecatedEnum : int32_t {
+ A = 0,
+};
+
+enum class DEPRECATED_ENUM_WITH_NOTE("This is a note") DeprecatedEnumWithNote : int32_t {
+ B = 0,
+};
+
+enum class EnumWithDeprecatedVariants : int32_t {
+ C = 0,
+ D DEPRECATED_ENUM_VARIANT = 1,
+ E DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 2,
+ F DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 3,
+};
+
+struct DEPRECATED_STRUCT DeprecatedStruct {
+ int32_t a;
+};
+
+struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") DeprecatedStructWithNote {
+ int32_t a;
+};
+
+union EnumWithDeprecatedStructVariants {
+ enum class Tag : uint8_t {
+ Foo,
+ Bar DEPRECATED_ENUM_VARIANT,
+ Baz DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note"),
+ };
+
+ struct Foo_Body {
+ Tag tag;
+ int16_t _0;
+ };
+
+ struct DEPRECATED_STRUCT Bar_Body {
+ Tag tag;
+ uint8_t x;
+ int16_t y;
+ };
+
+ struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") Baz_Body {
+ Tag tag;
+ uint8_t x;
+ uint8_t y;
+ };
+
+ struct {
+ Tag tag;
+ };
+ Foo_Body foo;
+ Bar_Body bar;
+ Baz_Body baz;
+};
+
+extern "C" {
+
+DEPRECATED_FUNC void deprecated_without_note();
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_without_bracket();
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note();
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note_and_since();
+
+DEPRECATED_FUNC_WITH_NOTE("This quote \" requires to be quoted, and this [\n] requires to be escaped")
+void deprecated_with_note_which_requires_to_be_escaped();
+
+void dummy(DeprecatedEnum a,
+ DeprecatedEnumWithNote b,
+ EnumWithDeprecatedVariants c,
+ DeprecatedStruct d,
+ DeprecatedStructWithNote e,
+ EnumWithDeprecatedStructVariants f);
+
+} // extern "C"
diff --git a/cbindgen-0.27.0/tests/expectations/deprecated.pyx b/cbindgen-0.27.0/tests/expectations/deprecated.pyx
new file mode 100644
index 0000000..6f362ae
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/deprecated.pyx
@@ -0,0 +1,77 @@
+#define DEPRECATED_FUNC __attribute__((deprecated))
+#define DEPRECATED_STRUCT __attribute__((deprecated))
+#define DEPRECATED_ENUM __attribute__((deprecated))
+#define DEPRECATED_ENUM_VARIANT __attribute__((deprecated))
+#define DEPRECATED_FUNC_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_STRUCT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_VARIANT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+
+
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ cdef enum:
+ A # = 0,
+ ctypedef int32_t DeprecatedEnum;
+
+ cdef enum:
+ B # = 0,
+ ctypedef int32_t DeprecatedEnumWithNote;
+
+ cdef enum:
+ C # = 0,
+ D # = 1,
+ E # = 2,
+ F # = 3,
+ ctypedef int32_t EnumWithDeprecatedVariants;
+
+ ctypedef struct DeprecatedStruct:
+ int32_t a;
+
+ ctypedef struct DeprecatedStructWithNote:
+ int32_t a;
+
+ cdef enum:
+ Foo,
+ Bar,
+ Baz,
+ ctypedef uint8_t EnumWithDeprecatedStructVariants_Tag;
+
+ ctypedef struct Bar_Body:
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ int16_t y;
+
+ ctypedef struct Baz_Body:
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ uint8_t y;
+
+ ctypedef union EnumWithDeprecatedStructVariants:
+ EnumWithDeprecatedStructVariants_Tag tag;
+ int16_t foo;
+ Bar_Body bar;
+ Baz_Body baz;
+
+ void deprecated_without_note();
+
+ void deprecated_without_bracket();
+
+ void deprecated_with_note();
+
+ void deprecated_with_note_and_since();
+
+ void deprecated_with_note_which_requires_to_be_escaped();
+
+ void dummy(DeprecatedEnum a,
+ DeprecatedEnumWithNote b,
+ EnumWithDeprecatedVariants c,
+ DeprecatedStruct d,
+ DeprecatedStructWithNote e,
+ EnumWithDeprecatedStructVariants f);
diff --git a/cbindgen-0.27.0/tests/expectations/deprecated_both.c b/cbindgen-0.27.0/tests/expectations/deprecated_both.c
new file mode 100644
index 0000000..e2713c4
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/deprecated_both.c
@@ -0,0 +1,87 @@
+#define DEPRECATED_FUNC __attribute__((deprecated))
+#define DEPRECATED_STRUCT __attribute__((deprecated))
+#define DEPRECATED_ENUM __attribute__((deprecated))
+#define DEPRECATED_ENUM_VARIANT __attribute__((deprecated))
+#define DEPRECATED_FUNC_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_STRUCT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_VARIANT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum DEPRECATED_ENUM DeprecatedEnum {
+ A = 0,
+};
+typedef int32_t DeprecatedEnum;
+
+enum DEPRECATED_ENUM_WITH_NOTE("This is a note") DeprecatedEnumWithNote {
+ B = 0,
+};
+typedef int32_t DeprecatedEnumWithNote;
+
+enum EnumWithDeprecatedVariants {
+ C = 0,
+ D DEPRECATED_ENUM_VARIANT = 1,
+ E DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 2,
+ F DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 3,
+};
+typedef int32_t EnumWithDeprecatedVariants;
+
+typedef struct DEPRECATED_STRUCT DeprecatedStruct {
+ int32_t a;
+} DeprecatedStruct;
+
+typedef struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") DeprecatedStructWithNote {
+ int32_t a;
+} DeprecatedStructWithNote;
+
+enum EnumWithDeprecatedStructVariants_Tag {
+ Foo,
+ Bar DEPRECATED_ENUM_VARIANT,
+ Baz DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note"),
+};
+typedef uint8_t EnumWithDeprecatedStructVariants_Tag;
+
+typedef struct DEPRECATED_STRUCT Bar_Body {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ int16_t y;
+} Bar_Body;
+
+typedef struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") Baz_Body {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ uint8_t y;
+} Baz_Body;
+
+typedef union EnumWithDeprecatedStructVariants {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ struct {
+ EnumWithDeprecatedStructVariants_Tag foo_tag;
+ int16_t foo;
+ };
+ Bar_Body bar;
+ Baz_Body baz;
+} EnumWithDeprecatedStructVariants;
+
+DEPRECATED_FUNC void deprecated_without_note(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_without_bracket(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note_and_since(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This quote \" requires to be quoted, and this [\n] requires to be escaped")
+void deprecated_with_note_which_requires_to_be_escaped(void);
+
+void dummy(DeprecatedEnum a,
+ DeprecatedEnumWithNote b,
+ EnumWithDeprecatedVariants c,
+ struct DeprecatedStruct d,
+ struct DeprecatedStructWithNote e,
+ union EnumWithDeprecatedStructVariants f);
diff --git a/cbindgen-0.27.0/tests/expectations/deprecated_both.compat.c b/cbindgen-0.27.0/tests/expectations/deprecated_both.compat.c
new file mode 100644
index 0000000..479aa73
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/deprecated_both.compat.c
@@ -0,0 +1,119 @@
+#define DEPRECATED_FUNC __attribute__((deprecated))
+#define DEPRECATED_STRUCT __attribute__((deprecated))
+#define DEPRECATED_ENUM __attribute__((deprecated))
+#define DEPRECATED_ENUM_VARIANT __attribute__((deprecated))
+#define DEPRECATED_FUNC_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_STRUCT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_VARIANT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum DEPRECATED_ENUM DeprecatedEnum
+#ifdef __cplusplus
+ : int32_t
+#endif // __cplusplus
+ {
+ A = 0,
+};
+#ifndef __cplusplus
+typedef int32_t DeprecatedEnum;
+#endif // __cplusplus
+
+enum DEPRECATED_ENUM_WITH_NOTE("This is a note") DeprecatedEnumWithNote
+#ifdef __cplusplus
+ : int32_t
+#endif // __cplusplus
+ {
+ B = 0,
+};
+#ifndef __cplusplus
+typedef int32_t DeprecatedEnumWithNote;
+#endif // __cplusplus
+
+enum EnumWithDeprecatedVariants
+#ifdef __cplusplus
+ : int32_t
+#endif // __cplusplus
+ {
+ C = 0,
+ D DEPRECATED_ENUM_VARIANT = 1,
+ E DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 2,
+ F DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 3,
+};
+#ifndef __cplusplus
+typedef int32_t EnumWithDeprecatedVariants;
+#endif // __cplusplus
+
+typedef struct DEPRECATED_STRUCT DeprecatedStruct {
+ int32_t a;
+} DeprecatedStruct;
+
+typedef struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") DeprecatedStructWithNote {
+ int32_t a;
+} DeprecatedStructWithNote;
+
+enum EnumWithDeprecatedStructVariants_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo,
+ Bar DEPRECATED_ENUM_VARIANT,
+ Baz DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note"),
+};
+#ifndef __cplusplus
+typedef uint8_t EnumWithDeprecatedStructVariants_Tag;
+#endif // __cplusplus
+
+typedef struct DEPRECATED_STRUCT Bar_Body {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ int16_t y;
+} Bar_Body;
+
+typedef struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") Baz_Body {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ uint8_t y;
+} Baz_Body;
+
+typedef union EnumWithDeprecatedStructVariants {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ struct {
+ EnumWithDeprecatedStructVariants_Tag foo_tag;
+ int16_t foo;
+ };
+ Bar_Body bar;
+ Baz_Body baz;
+} EnumWithDeprecatedStructVariants;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+DEPRECATED_FUNC void deprecated_without_note(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_without_bracket(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note_and_since(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This quote \" requires to be quoted, and this [\n] requires to be escaped")
+void deprecated_with_note_which_requires_to_be_escaped(void);
+
+void dummy(DeprecatedEnum a,
+ DeprecatedEnumWithNote b,
+ EnumWithDeprecatedVariants c,
+ struct DeprecatedStruct d,
+ struct DeprecatedStructWithNote e,
+ union EnumWithDeprecatedStructVariants f);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/deprecated_tag.c b/cbindgen-0.27.0/tests/expectations/deprecated_tag.c
new file mode 100644
index 0000000..982cdc5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/deprecated_tag.c
@@ -0,0 +1,87 @@
+#define DEPRECATED_FUNC __attribute__((deprecated))
+#define DEPRECATED_STRUCT __attribute__((deprecated))
+#define DEPRECATED_ENUM __attribute__((deprecated))
+#define DEPRECATED_ENUM_VARIANT __attribute__((deprecated))
+#define DEPRECATED_FUNC_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_STRUCT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_VARIANT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum DEPRECATED_ENUM DeprecatedEnum {
+ A = 0,
+};
+typedef int32_t DeprecatedEnum;
+
+enum DEPRECATED_ENUM_WITH_NOTE("This is a note") DeprecatedEnumWithNote {
+ B = 0,
+};
+typedef int32_t DeprecatedEnumWithNote;
+
+enum EnumWithDeprecatedVariants {
+ C = 0,
+ D DEPRECATED_ENUM_VARIANT = 1,
+ E DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 2,
+ F DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 3,
+};
+typedef int32_t EnumWithDeprecatedVariants;
+
+struct DEPRECATED_STRUCT DeprecatedStruct {
+ int32_t a;
+};
+
+struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") DeprecatedStructWithNote {
+ int32_t a;
+};
+
+enum EnumWithDeprecatedStructVariants_Tag {
+ Foo,
+ Bar DEPRECATED_ENUM_VARIANT,
+ Baz DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note"),
+};
+typedef uint8_t EnumWithDeprecatedStructVariants_Tag;
+
+struct DEPRECATED_STRUCT Bar_Body {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ int16_t y;
+};
+
+struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") Baz_Body {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ uint8_t y;
+};
+
+union EnumWithDeprecatedStructVariants {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ struct {
+ EnumWithDeprecatedStructVariants_Tag foo_tag;
+ int16_t foo;
+ };
+ struct Bar_Body bar;
+ struct Baz_Body baz;
+};
+
+DEPRECATED_FUNC void deprecated_without_note(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_without_bracket(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note_and_since(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This quote \" requires to be quoted, and this [\n] requires to be escaped")
+void deprecated_with_note_which_requires_to_be_escaped(void);
+
+void dummy(DeprecatedEnum a,
+ DeprecatedEnumWithNote b,
+ EnumWithDeprecatedVariants c,
+ struct DeprecatedStruct d,
+ struct DeprecatedStructWithNote e,
+ union EnumWithDeprecatedStructVariants f);
diff --git a/cbindgen-0.27.0/tests/expectations/deprecated_tag.compat.c b/cbindgen-0.27.0/tests/expectations/deprecated_tag.compat.c
new file mode 100644
index 0000000..322b79d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/deprecated_tag.compat.c
@@ -0,0 +1,119 @@
+#define DEPRECATED_FUNC __attribute__((deprecated))
+#define DEPRECATED_STRUCT __attribute__((deprecated))
+#define DEPRECATED_ENUM __attribute__((deprecated))
+#define DEPRECATED_ENUM_VARIANT __attribute__((deprecated))
+#define DEPRECATED_FUNC_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_STRUCT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_VARIANT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum DEPRECATED_ENUM DeprecatedEnum
+#ifdef __cplusplus
+ : int32_t
+#endif // __cplusplus
+ {
+ A = 0,
+};
+#ifndef __cplusplus
+typedef int32_t DeprecatedEnum;
+#endif // __cplusplus
+
+enum DEPRECATED_ENUM_WITH_NOTE("This is a note") DeprecatedEnumWithNote
+#ifdef __cplusplus
+ : int32_t
+#endif // __cplusplus
+ {
+ B = 0,
+};
+#ifndef __cplusplus
+typedef int32_t DeprecatedEnumWithNote;
+#endif // __cplusplus
+
+enum EnumWithDeprecatedVariants
+#ifdef __cplusplus
+ : int32_t
+#endif // __cplusplus
+ {
+ C = 0,
+ D DEPRECATED_ENUM_VARIANT = 1,
+ E DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 2,
+ F DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note") = 3,
+};
+#ifndef __cplusplus
+typedef int32_t EnumWithDeprecatedVariants;
+#endif // __cplusplus
+
+struct DEPRECATED_STRUCT DeprecatedStruct {
+ int32_t a;
+};
+
+struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") DeprecatedStructWithNote {
+ int32_t a;
+};
+
+enum EnumWithDeprecatedStructVariants_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo,
+ Bar DEPRECATED_ENUM_VARIANT,
+ Baz DEPRECATED_ENUM_VARIANT_WITH_NOTE("This is a note"),
+};
+#ifndef __cplusplus
+typedef uint8_t EnumWithDeprecatedStructVariants_Tag;
+#endif // __cplusplus
+
+struct DEPRECATED_STRUCT Bar_Body {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ int16_t y;
+};
+
+struct DEPRECATED_STRUCT_WITH_NOTE("This is a note") Baz_Body {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ uint8_t y;
+};
+
+union EnumWithDeprecatedStructVariants {
+ EnumWithDeprecatedStructVariants_Tag tag;
+ struct {
+ EnumWithDeprecatedStructVariants_Tag foo_tag;
+ int16_t foo;
+ };
+ struct Bar_Body bar;
+ struct Baz_Body baz;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+DEPRECATED_FUNC void deprecated_without_note(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_without_bracket(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This is a note") void deprecated_with_note_and_since(void);
+
+DEPRECATED_FUNC_WITH_NOTE("This quote \" requires to be quoted, and this [\n] requires to be escaped")
+void deprecated_with_note_which_requires_to_be_escaped(void);
+
+void dummy(DeprecatedEnum a,
+ DeprecatedEnumWithNote b,
+ EnumWithDeprecatedVariants c,
+ struct DeprecatedStruct d,
+ struct DeprecatedStructWithNote e,
+ union EnumWithDeprecatedStructVariants f);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/deprecated_tag.pyx b/cbindgen-0.27.0/tests/expectations/deprecated_tag.pyx
new file mode 100644
index 0000000..767da95
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/deprecated_tag.pyx
@@ -0,0 +1,77 @@
+#define DEPRECATED_FUNC __attribute__((deprecated))
+#define DEPRECATED_STRUCT __attribute__((deprecated))
+#define DEPRECATED_ENUM __attribute__((deprecated))
+#define DEPRECATED_ENUM_VARIANT __attribute__((deprecated))
+#define DEPRECATED_FUNC_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_STRUCT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_VARIANT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+
+
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ cdef enum:
+ A # = 0,
+ ctypedef int32_t DeprecatedEnum;
+
+ cdef enum:
+ B # = 0,
+ ctypedef int32_t DeprecatedEnumWithNote;
+
+ cdef enum:
+ C # = 0,
+ D # = 1,
+ E # = 2,
+ F # = 3,
+ ctypedef int32_t EnumWithDeprecatedVariants;
+
+ cdef struct DeprecatedStruct:
+ int32_t a;
+
+ cdef struct DeprecatedStructWithNote:
+ int32_t a;
+
+ cdef enum:
+ Foo,
+ Bar,
+ Baz,
+ ctypedef uint8_t EnumWithDeprecatedStructVariants_Tag;
+
+ cdef struct Bar_Body:
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ int16_t y;
+
+ cdef struct Baz_Body:
+ EnumWithDeprecatedStructVariants_Tag tag;
+ uint8_t x;
+ uint8_t y;
+
+ cdef union EnumWithDeprecatedStructVariants:
+ EnumWithDeprecatedStructVariants_Tag tag;
+ int16_t foo;
+ Bar_Body bar;
+ Baz_Body baz;
+
+ void deprecated_without_note();
+
+ void deprecated_without_bracket();
+
+ void deprecated_with_note();
+
+ void deprecated_with_note_and_since();
+
+ void deprecated_with_note_which_requires_to_be_escaped();
+
+ void dummy(DeprecatedEnum a,
+ DeprecatedEnumWithNote b,
+ EnumWithDeprecatedVariants c,
+ DeprecatedStruct d,
+ DeprecatedStructWithNote e,
+ EnumWithDeprecatedStructVariants f);
diff --git a/cbindgen-0.24.5/tests/expectations/derive_eq.c b/cbindgen-0.27.0/tests/expectations/derive_eq.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/derive_eq.c
rename to cbindgen-0.27.0/tests/expectations/derive_eq.c
diff --git a/cbindgen-0.27.0/tests/expectations/derive_eq.compat.c b/cbindgen-0.27.0/tests/expectations/derive_eq.compat.c
new file mode 100644
index 0000000..d3037f8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/derive_eq.compat.c
@@ -0,0 +1,57 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ bool a;
+ int32_t b;
+} Foo;
+
+enum Bar_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Baz,
+ Bazz,
+ FooNamed,
+ FooParen,
+};
+#ifndef __cplusplus
+typedef uint8_t Bar_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ Bar_Tag tag;
+ Foo named;
+} Bazz_Body;
+
+typedef struct {
+ Bar_Tag tag;
+ int32_t different;
+ uint32_t fields;
+} FooNamed_Body;
+
+typedef struct {
+ Bar_Tag tag;
+ int32_t _0;
+ Foo _1;
+} FooParen_Body;
+
+typedef union {
+ Bar_Tag tag;
+ Bazz_Body bazz;
+ FooNamed_Body foo_named;
+ FooParen_Body foo_paren;
+} Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+Foo root(Bar aBar);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/derive_eq.cpp b/cbindgen-0.27.0/tests/expectations/derive_eq.cpp
new file mode 100644
index 0000000..355fbd9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/derive_eq.cpp
@@ -0,0 +1,100 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Foo {
+ bool a;
+ int32_t b;
+
+ bool operator==(const Foo& aOther) const {
+ return a == aOther.a &&
+ b == aOther.b;
+ }
+ bool operator!=(const Foo& aOther) const {
+ return a != aOther.a ||
+ b != aOther.b;
+ }
+};
+
+union Bar {
+ enum class Tag : uint8_t {
+ Baz,
+ Bazz,
+ FooNamed,
+ FooParen,
+ };
+
+ struct Bazz_Body {
+ Tag tag;
+ Foo named;
+
+ bool operator==(const Bazz_Body& aOther) const {
+ return named == aOther.named;
+ }
+ bool operator!=(const Bazz_Body& aOther) const {
+ return named != aOther.named;
+ }
+ };
+
+ struct FooNamed_Body {
+ Tag tag;
+ int32_t different;
+ uint32_t fields;
+
+ bool operator==(const FooNamed_Body& aOther) const {
+ return different == aOther.different &&
+ fields == aOther.fields;
+ }
+ bool operator!=(const FooNamed_Body& aOther) const {
+ return different != aOther.different ||
+ fields != aOther.fields;
+ }
+ };
+
+ struct FooParen_Body {
+ Tag tag;
+ int32_t _0;
+ Foo _1;
+
+ bool operator==(const FooParen_Body& aOther) const {
+ return _0 == aOther._0 &&
+ _1 == aOther._1;
+ }
+ bool operator!=(const FooParen_Body& aOther) const {
+ return _0 != aOther._0 ||
+ _1 != aOther._1;
+ }
+ };
+
+ struct {
+ Tag tag;
+ };
+ Bazz_Body bazz;
+ FooNamed_Body foo_named;
+ FooParen_Body foo_paren;
+
+ bool operator==(const Bar& aOther) const {
+ if (tag != aOther.tag) {
+ return false;
+ }
+ switch (tag) {
+ case Tag::Bazz: return bazz == aOther.bazz;
+ case Tag::FooNamed: return foo_named == aOther.foo_named;
+ case Tag::FooParen: return foo_paren == aOther.foo_paren;
+ default: break;
+ }
+ return true;
+ }
+
+ bool operator!=(const Bar& aOther) const {
+ return !(*this == aOther);
+ }
+};
+
+extern "C" {
+
+Foo root(Bar aBar);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/derive_eq.pyx b/cbindgen-0.27.0/tests/expectations/derive_eq.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/derive_eq.pyx
rename to cbindgen-0.27.0/tests/expectations/derive_eq.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/derive_eq.both.c b/cbindgen-0.27.0/tests/expectations/derive_eq_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/derive_eq.both.c
rename to cbindgen-0.27.0/tests/expectations/derive_eq_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/derive_eq_both.compat.c b/cbindgen-0.27.0/tests/expectations/derive_eq_both.compat.c
new file mode 100644
index 0000000..1a0a366
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/derive_eq_both.compat.c
@@ -0,0 +1,57 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo {
+ bool a;
+ int32_t b;
+} Foo;
+
+enum Bar_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Baz,
+ Bazz,
+ FooNamed,
+ FooParen,
+};
+#ifndef __cplusplus
+typedef uint8_t Bar_Tag;
+#endif // __cplusplus
+
+typedef struct Bazz_Body {
+ Bar_Tag tag;
+ struct Foo named;
+} Bazz_Body;
+
+typedef struct FooNamed_Body {
+ Bar_Tag tag;
+ int32_t different;
+ uint32_t fields;
+} FooNamed_Body;
+
+typedef struct FooParen_Body {
+ Bar_Tag tag;
+ int32_t _0;
+ struct Foo _1;
+} FooParen_Body;
+
+typedef union Bar {
+ Bar_Tag tag;
+ Bazz_Body bazz;
+ FooNamed_Body foo_named;
+ FooParen_Body foo_paren;
+} Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+struct Foo root(union Bar aBar);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/derive_eq.tag.c b/cbindgen-0.27.0/tests/expectations/derive_eq_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/derive_eq.tag.c
rename to cbindgen-0.27.0/tests/expectations/derive_eq_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/derive_eq_tag.compat.c b/cbindgen-0.27.0/tests/expectations/derive_eq_tag.compat.c
new file mode 100644
index 0000000..66f02ae
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/derive_eq_tag.compat.c
@@ -0,0 +1,57 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo {
+ bool a;
+ int32_t b;
+};
+
+enum Bar_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Baz,
+ Bazz,
+ FooNamed,
+ FooParen,
+};
+#ifndef __cplusplus
+typedef uint8_t Bar_Tag;
+#endif // __cplusplus
+
+struct Bazz_Body {
+ Bar_Tag tag;
+ struct Foo named;
+};
+
+struct FooNamed_Body {
+ Bar_Tag tag;
+ int32_t different;
+ uint32_t fields;
+};
+
+struct FooParen_Body {
+ Bar_Tag tag;
+ int32_t _0;
+ struct Foo _1;
+};
+
+union Bar {
+ Bar_Tag tag;
+ struct Bazz_Body bazz;
+ struct FooNamed_Body foo_named;
+ struct FooParen_Body foo_paren;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+struct Foo root(union Bar aBar);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/derive_eq.tag.pyx b/cbindgen-0.27.0/tests/expectations/derive_eq_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/derive_eq.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/derive_eq_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/derive_ostream.c b/cbindgen-0.27.0/tests/expectations/derive_ostream.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/derive_ostream.c
rename to cbindgen-0.27.0/tests/expectations/derive_ostream.c
diff --git a/cbindgen-0.27.0/tests/expectations/derive_ostream.compat.c b/cbindgen-0.27.0/tests/expectations/derive_ostream.compat.c
new file mode 100644
index 0000000..e235353
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/derive_ostream.compat.c
@@ -0,0 +1,121 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum C
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ X = 2,
+ Y,
+};
+#ifndef __cplusplus
+typedef uint32_t C;
+#endif // __cplusplus
+
+typedef struct {
+ int32_t _0;
+} A;
+
+typedef struct {
+ int32_t x;
+ float y;
+} B;
+
+typedef struct {
+ uint8_t List;
+ uintptr_t Of;
+ B Things;
+} D;
+
+enum F_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo,
+ Bar,
+ Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t F_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ F_Tag tag;
+ uint8_t x;
+ int16_t y;
+} Bar_Body;
+
+typedef union {
+ F_Tag tag;
+ struct {
+ F_Tag foo_tag;
+ int16_t foo;
+ };
+ Bar_Body bar;
+} F;
+
+enum H_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Hello,
+ There,
+ Everyone,
+};
+#ifndef __cplusplus
+typedef uint8_t H_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ uint8_t x;
+ int16_t y;
+} There_Body;
+
+typedef struct {
+ H_Tag tag;
+ union {
+ struct {
+ int16_t hello;
+ };
+ There_Body there;
+ };
+} H;
+
+enum I_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ ThereAgain,
+ SomethingElse,
+};
+#ifndef __cplusplus
+typedef uint8_t I_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ uint8_t x;
+ int16_t y;
+} ThereAgain_Body;
+
+typedef struct {
+ I_Tag tag;
+ union {
+ ThereAgain_Body there_again;
+ };
+} I;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(A a, B b, C c, D d, F f, H h, I i);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/derive_ostream.cpp b/cbindgen-0.27.0/tests/expectations/derive_ostream.cpp
new file mode 100644
index 0000000..447a27d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/derive_ostream.cpp
@@ -0,0 +1,184 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+enum class C : uint32_t {
+ X = 2,
+ Y,
+};
+
+inline std::ostream& operator<<(std::ostream& stream, const C& instance) {
+ switch (instance) {
+ case C::X: stream << "X"; break;
+ case C::Y: stream << "Y"; break;
+ }
+ return stream;
+}
+
+struct A {
+ int32_t _0;
+
+ friend std::ostream& operator<<(std::ostream& stream, const A& instance) {
+ return stream << "{ " << "_0=" << instance._0 << " }";
+ }
+};
+
+struct B {
+ int32_t x;
+ float y;
+
+ friend std::ostream& operator<<(std::ostream& stream, const B& instance) {
+ return stream << "{ " << "x=" << instance.x << ", "
+ << "y=" << instance.y << " }";
+ }
+};
+
+struct D {
+ uint8_t List;
+ uintptr_t Of;
+ B Things;
+
+ friend std::ostream& operator<<(std::ostream& stream, const D& instance) {
+ return stream << "{ " << "List=" << instance.List << ", "
+ << "Of=" << instance.Of << ", "
+ << "Things=" << instance.Things << " }";
+ }
+};
+
+union F {
+ enum class Tag : uint8_t {
+ Foo,
+ Bar,
+ Baz,
+ };
+
+ friend std::ostream& operator<<(std::ostream& stream, const Tag& instance) {
+ using Tag = F::Tag;
+ switch (instance) {
+ case Tag::Foo: stream << "Foo"; break;
+ case Tag::Bar: stream << "Bar"; break;
+ case Tag::Baz: stream << "Baz"; break;
+ }
+ return stream;
+ }
+
+ friend std::ostream& operator<<(std::ostream& stream, const F& instance) {
+ using Tag = F::Tag;
+ switch (instance.tag) {
+ case Tag::Foo: stream << instance.foo; break;
+ case Tag::Bar: stream << instance.bar; break;
+ case Tag::Baz: stream << "Baz"; break;
+ }
+ return stream;
+ }
+
+ struct Foo_Body {
+ Tag tag;
+ int16_t _0;
+
+ friend std::ostream& operator<<(std::ostream& stream, const Foo_Body& instance) {
+ return stream << "{ " << "tag=" << instance.tag << ", "
+ << "_0=" << instance._0 << " }";
+ }
+ };
+
+ struct Bar_Body {
+ Tag tag;
+ uint8_t x;
+ int16_t y;
+
+ friend std::ostream& operator<<(std::ostream& stream, const Bar_Body& instance) {
+ return stream << "{ " << "tag=" << instance.tag << ", "
+ << "x=" << instance.x << ", "
+ << "y=" << instance.y << " }";
+ }
+ };
+
+ struct {
+ Tag tag;
+ };
+ Foo_Body foo;
+ Bar_Body bar;
+};
+
+struct H {
+ enum class Tag : uint8_t {
+ Hello,
+ There,
+ Everyone,
+ };
+
+ friend std::ostream& operator<<(std::ostream& stream, const Tag& instance) {
+ using Tag = H::Tag;
+ switch (instance) {
+ case Tag::Hello: stream << "Hello"; break;
+ case Tag::There: stream << "There"; break;
+ case Tag::Everyone: stream << "Everyone"; break;
+ }
+ return stream;
+ }
+
+ friend std::ostream& operator<<(std::ostream& stream, const H& instance) {
+ using Tag = H::Tag;
+ switch (instance.tag) {
+ case Tag::Hello: stream << "Hello" << instance.hello; break;
+ case Tag::There: stream << "There" << instance.there; break;
+ case Tag::Everyone: stream << "Everyone"; break;
+ }
+ return stream;
+ }
+
+ struct Hello_Body {
+ int16_t _0;
+
+ friend std::ostream& operator<<(std::ostream& stream, const Hello_Body& instance) {
+ return stream << "{ " << "_0=" << instance._0 << " }";
+ }
+ };
+
+ struct There_Body {
+ uint8_t x;
+ int16_t y;
+
+ friend std::ostream& operator<<(std::ostream& stream, const There_Body& instance) {
+ return stream << "{ " << "x=" << instance.x << ", "
+ << "y=" << instance.y << " }";
+ }
+ };
+
+ Tag tag;
+ union {
+ Hello_Body hello;
+ There_Body there;
+ };
+};
+
+struct I {
+ enum class Tag : uint8_t {
+ ThereAgain,
+ SomethingElse,
+ };
+
+ struct ThereAgain_Body {
+ uint8_t x;
+ int16_t y;
+
+ friend std::ostream& operator<<(std::ostream& stream, const ThereAgain_Body& instance) {
+ return stream << "{ " << "x=" << instance.x << ", "
+ << "y=" << instance.y << " }";
+ }
+ };
+
+ Tag tag;
+ union {
+ ThereAgain_Body there_again;
+ };
+};
+
+extern "C" {
+
+void root(A a, B b, C c, D d, F f, H h, I i);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/derive_ostream.pyx b/cbindgen-0.27.0/tests/expectations/derive_ostream.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/derive_ostream.pyx
rename to cbindgen-0.27.0/tests/expectations/derive_ostream.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/derive_ostream.both.c b/cbindgen-0.27.0/tests/expectations/derive_ostream_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/derive_ostream.both.c
rename to cbindgen-0.27.0/tests/expectations/derive_ostream_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/derive_ostream_both.compat.c b/cbindgen-0.27.0/tests/expectations/derive_ostream_both.compat.c
new file mode 100644
index 0000000..69165d1
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/derive_ostream_both.compat.c
@@ -0,0 +1,121 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum C
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ X = 2,
+ Y,
+};
+#ifndef __cplusplus
+typedef uint32_t C;
+#endif // __cplusplus
+
+typedef struct A {
+ int32_t _0;
+} A;
+
+typedef struct B {
+ int32_t x;
+ float y;
+} B;
+
+typedef struct D {
+ uint8_t List;
+ uintptr_t Of;
+ struct B Things;
+} D;
+
+enum F_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo,
+ Bar,
+ Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t F_Tag;
+#endif // __cplusplus
+
+typedef struct Bar_Body {
+ F_Tag tag;
+ uint8_t x;
+ int16_t y;
+} Bar_Body;
+
+typedef union F {
+ F_Tag tag;
+ struct {
+ F_Tag foo_tag;
+ int16_t foo;
+ };
+ Bar_Body bar;
+} F;
+
+enum H_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Hello,
+ There,
+ Everyone,
+};
+#ifndef __cplusplus
+typedef uint8_t H_Tag;
+#endif // __cplusplus
+
+typedef struct There_Body {
+ uint8_t x;
+ int16_t y;
+} There_Body;
+
+typedef struct H {
+ H_Tag tag;
+ union {
+ struct {
+ int16_t hello;
+ };
+ There_Body there;
+ };
+} H;
+
+enum I_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ ThereAgain,
+ SomethingElse,
+};
+#ifndef __cplusplus
+typedef uint8_t I_Tag;
+#endif // __cplusplus
+
+typedef struct ThereAgain_Body {
+ uint8_t x;
+ int16_t y;
+} ThereAgain_Body;
+
+typedef struct I {
+ I_Tag tag;
+ union {
+ ThereAgain_Body there_again;
+ };
+} I;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct A a, struct B b, C c, struct D d, union F f, struct H h, struct I i);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/derive_ostream.tag.c b/cbindgen-0.27.0/tests/expectations/derive_ostream_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/derive_ostream.tag.c
rename to cbindgen-0.27.0/tests/expectations/derive_ostream_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/derive_ostream_tag.compat.c b/cbindgen-0.27.0/tests/expectations/derive_ostream_tag.compat.c
new file mode 100644
index 0000000..f7b1b77
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/derive_ostream_tag.compat.c
@@ -0,0 +1,121 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum C
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ X = 2,
+ Y,
+};
+#ifndef __cplusplus
+typedef uint32_t C;
+#endif // __cplusplus
+
+struct A {
+ int32_t _0;
+};
+
+struct B {
+ int32_t x;
+ float y;
+};
+
+struct D {
+ uint8_t List;
+ uintptr_t Of;
+ struct B Things;
+};
+
+enum F_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo,
+ Bar,
+ Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t F_Tag;
+#endif // __cplusplus
+
+struct Bar_Body {
+ F_Tag tag;
+ uint8_t x;
+ int16_t y;
+};
+
+union F {
+ F_Tag tag;
+ struct {
+ F_Tag foo_tag;
+ int16_t foo;
+ };
+ struct Bar_Body bar;
+};
+
+enum H_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Hello,
+ There,
+ Everyone,
+};
+#ifndef __cplusplus
+typedef uint8_t H_Tag;
+#endif // __cplusplus
+
+struct There_Body {
+ uint8_t x;
+ int16_t y;
+};
+
+struct H {
+ H_Tag tag;
+ union {
+ struct {
+ int16_t hello;
+ };
+ struct There_Body there;
+ };
+};
+
+enum I_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ ThereAgain,
+ SomethingElse,
+};
+#ifndef __cplusplus
+typedef uint8_t I_Tag;
+#endif // __cplusplus
+
+struct ThereAgain_Body {
+ uint8_t x;
+ int16_t y;
+};
+
+struct I {
+ I_Tag tag;
+ union {
+ struct ThereAgain_Body there_again;
+ };
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct A a, struct B b, C c, struct D d, union F f, struct H h, struct I i);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/derive_ostream.tag.pyx b/cbindgen-0.27.0/tests/expectations/derive_ostream_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/derive_ostream.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/derive_ostream_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.c b/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.c
rename to cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor.c
diff --git a/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor.compat.c b/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor.compat.c
new file mode 100644
index 0000000..f12119b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor.compat.c
@@ -0,0 +1,266 @@
+#define NOINLINE __attribute__((noinline))
+#define NODISCARD [[nodiscard]]
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum FillRule
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ A,
+ B,
+};
+#ifndef __cplusplus
+typedef uint8_t FillRule;
+#endif // __cplusplus
+
+/**
+ * This will have a destructor manually implemented via variant_body, and
+ * similarly a Drop impl in Rust.
+ */
+typedef struct {
+ uintptr_t len;
+ uint32_t *ptr;
+} OwnedSlice_u32;
+
+typedef struct {
+ FillRule fill;
+ OwnedSlice_u32 coordinates;
+} Polygon_u32;
+
+/**
+ * This will have a destructor manually implemented via variant_body, and
+ * similarly a Drop impl in Rust.
+ */
+typedef struct {
+ uintptr_t len;
+ int32_t *ptr;
+} OwnedSlice_i32;
+
+enum Foo_u32_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar_u32,
+ Polygon1_u32,
+ Slice1_u32,
+ Slice2_u32,
+ Slice3_u32,
+ Slice4_u32,
+};
+#ifndef __cplusplus
+typedef uint8_t Foo_u32_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ FillRule fill;
+ OwnedSlice_u32 coords;
+} Slice3_Body_u32;
+
+typedef struct {
+ FillRule fill;
+ OwnedSlice_i32 coords;
+} Slice4_Body_u32;
+
+typedef struct {
+ Foo_u32_Tag tag;
+ union {
+ struct {
+ Polygon_u32 polygon1;
+ };
+ struct {
+ OwnedSlice_u32 slice1;
+ };
+ struct {
+ OwnedSlice_i32 slice2;
+ };
+ Slice3_Body_u32 slice3;
+ Slice4_Body_u32 slice4;
+ };
+} Foo_u32;
+
+typedef struct {
+ FillRule fill;
+ OwnedSlice_i32 coordinates;
+} Polygon_i32;
+
+enum Baz_i32_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar2_i32,
+ Polygon21_i32,
+ Slice21_i32,
+ Slice22_i32,
+ Slice23_i32,
+ Slice24_i32,
+};
+#ifndef __cplusplus
+typedef uint8_t Baz_i32_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ Baz_i32_Tag tag;
+ FillRule fill;
+ OwnedSlice_i32 coords;
+} Slice23_Body_i32;
+
+typedef struct {
+ Baz_i32_Tag tag;
+ FillRule fill;
+ OwnedSlice_i32 coords;
+} Slice24_Body_i32;
+
+typedef union {
+ Baz_i32_Tag tag;
+ struct {
+ Baz_i32_Tag polygon21_tag;
+ Polygon_i32 polygon21;
+ };
+ struct {
+ Baz_i32_Tag slice21_tag;
+ OwnedSlice_i32 slice21;
+ };
+ struct {
+ Baz_i32_Tag slice22_tag;
+ OwnedSlice_i32 slice22;
+ };
+ Slice23_Body_i32 slice23;
+ Slice24_Body_i32 slice24;
+} Baz_i32;
+
+enum Taz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar3,
+ Taz1,
+ Taz3,
+};
+#ifndef __cplusplus
+typedef uint8_t Taz_Tag;
+#endif // __cplusplus
+
+typedef union {
+ Taz_Tag tag;
+ struct {
+ Taz_Tag taz1_tag;
+ int32_t taz1;
+ };
+ struct {
+ Taz_Tag taz3_tag;
+ OwnedSlice_i32 taz3;
+ };
+} Taz;
+
+enum Tazz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar4,
+ Taz2,
+};
+#ifndef __cplusplus
+typedef uint8_t Tazz_Tag;
+#endif // __cplusplus
+
+typedef union {
+ Tazz_Tag tag;
+ struct {
+ Tazz_Tag taz2_tag;
+ int32_t taz2;
+ };
+} Tazz;
+
+enum Tazzz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar5,
+ Taz5,
+};
+#ifndef __cplusplus
+typedef uint8_t Tazzz_Tag;
+#endif // __cplusplus
+
+typedef union {
+ Tazzz_Tag tag;
+ struct {
+ Tazzz_Tag taz5_tag;
+ int32_t taz5;
+ };
+} Tazzz;
+
+enum Tazzzz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Taz6,
+ Taz7,
+};
+#ifndef __cplusplus
+typedef uint8_t Tazzzz_Tag;
+#endif // __cplusplus
+
+typedef union {
+ Tazzzz_Tag tag;
+ struct {
+ Tazzzz_Tag taz6_tag;
+ int32_t taz6;
+ };
+ struct {
+ Tazzzz_Tag taz7_tag;
+ uint32_t taz7;
+ };
+} Tazzzz;
+
+enum Qux_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Qux1,
+ Qux2,
+};
+#ifndef __cplusplus
+typedef uint8_t Qux_Tag;
+#endif // __cplusplus
+
+typedef union {
+ Qux_Tag tag;
+ struct {
+ Qux_Tag qux1_tag;
+ int32_t qux1;
+ };
+ struct {
+ Qux_Tag qux2_tag;
+ uint32_t qux2;
+ };
+} Qux;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo_u32 *a,
+ const Baz_i32 *b,
+ const Taz *c,
+ Tazz d,
+ const Tazzz *e,
+ const Tazzzz *f,
+ const Qux *g);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor.cpp b/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor.cpp
new file mode 100644
index 0000000..005b086
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor.cpp
@@ -0,0 +1,712 @@
+#define NOINLINE __attribute__((noinline))
+#define NODISCARD [[nodiscard]]
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+enum class FillRule : uint8_t {
+ A,
+ B,
+};
+
+/// This will have a destructor manually implemented via variant_body, and
+/// similarly a Drop impl in Rust.
+template<typename T>
+struct OwnedSlice {
+ uintptr_t len;
+ T *ptr;
+ ~OwnedSlice() {}
+};
+
+template<typename LengthPercentage>
+struct Polygon {
+ FillRule fill;
+ OwnedSlice<LengthPercentage> coordinates;
+};
+
+template<typename T>
+struct Foo {
+ enum class Tag : uint8_t {
+ Bar,
+ Polygon1,
+ Slice1,
+ Slice2,
+ Slice3,
+ Slice4,
+ };
+
+ struct Polygon1_Body {
+ Polygon<T> _0;
+ };
+
+ struct Slice1_Body {
+ OwnedSlice<T> _0;
+ };
+
+ struct Slice2_Body {
+ OwnedSlice<int32_t> _0;
+ };
+
+ struct Slice3_Body {
+ FillRule fill;
+ OwnedSlice<T> coords;
+ };
+
+ struct Slice4_Body {
+ FillRule fill;
+ OwnedSlice<int32_t> coords;
+ };
+
+ Tag tag;
+ union {
+ Polygon1_Body polygon1;
+ Slice1_Body slice1;
+ Slice2_Body slice2;
+ Slice3_Body slice3;
+ Slice4_Body slice4;
+ };
+
+ static Foo Bar() {
+ Foo result;
+ result.tag = Tag::Bar;
+ return result;
+ }
+
+ bool IsBar() const {
+ return tag == Tag::Bar;
+ }
+
+ static Foo Polygon1(const Polygon<T> &_0) {
+ Foo result;
+ ::new (&result.polygon1._0) (Polygon<T>)(_0);
+ result.tag = Tag::Polygon1;
+ return result;
+ }
+
+ bool IsPolygon1() const {
+ return tag == Tag::Polygon1;
+ }
+
+ static Foo Slice1(const OwnedSlice<T> &_0) {
+ Foo result;
+ ::new (&result.slice1._0) (OwnedSlice<T>)(_0);
+ result.tag = Tag::Slice1;
+ return result;
+ }
+
+ bool IsSlice1() const {
+ return tag == Tag::Slice1;
+ }
+
+ static Foo Slice2(const OwnedSlice<int32_t> &_0) {
+ Foo result;
+ ::new (&result.slice2._0) (OwnedSlice<int32_t>)(_0);
+ result.tag = Tag::Slice2;
+ return result;
+ }
+
+ bool IsSlice2() const {
+ return tag == Tag::Slice2;
+ }
+
+ static Foo Slice3(const FillRule &fill,
+ const OwnedSlice<T> &coords) {
+ Foo result;
+ ::new (&result.slice3.fill) (FillRule)(fill);
+ ::new (&result.slice3.coords) (OwnedSlice<T>)(coords);
+ result.tag = Tag::Slice3;
+ return result;
+ }
+
+ bool IsSlice3() const {
+ return tag == Tag::Slice3;
+ }
+
+ static Foo Slice4(const FillRule &fill,
+ const OwnedSlice<int32_t> &coords) {
+ Foo result;
+ ::new (&result.slice4.fill) (FillRule)(fill);
+ ::new (&result.slice4.coords) (OwnedSlice<int32_t>)(coords);
+ result.tag = Tag::Slice4;
+ return result;
+ }
+
+ bool IsSlice4() const {
+ return tag == Tag::Slice4;
+ }
+
+ private:
+ Foo() {
+
+ }
+ public:
+
+
+ ~Foo() {
+ switch (tag) {
+ case Tag::Polygon1: polygon1.~Polygon1_Body(); break;
+ case Tag::Slice1: slice1.~Slice1_Body(); break;
+ case Tag::Slice2: slice2.~Slice2_Body(); break;
+ case Tag::Slice3: slice3.~Slice3_Body(); break;
+ case Tag::Slice4: slice4.~Slice4_Body(); break;
+ default: break;
+ }
+ }
+
+ Foo(const Foo& other)
+ : tag(other.tag) {
+ switch (tag) {
+ case Tag::Polygon1: ::new (&polygon1) (Polygon1_Body)(other.polygon1); break;
+ case Tag::Slice1: ::new (&slice1) (Slice1_Body)(other.slice1); break;
+ case Tag::Slice2: ::new (&slice2) (Slice2_Body)(other.slice2); break;
+ case Tag::Slice3: ::new (&slice3) (Slice3_Body)(other.slice3); break;
+ case Tag::Slice4: ::new (&slice4) (Slice4_Body)(other.slice4); break;
+ default: break;
+ }
+ }
+ Foo& operator=(const Foo& other) {
+ if (this != &other) {
+ this->~Foo();
+ new (this) Foo(other);
+ }
+ return *this;
+ }
+};
+
+template<typename T>
+union Baz {
+ enum class Tag : uint8_t {
+ Bar2,
+ Polygon21,
+ Slice21,
+ Slice22,
+ Slice23,
+ Slice24,
+ };
+
+ struct Polygon21_Body {
+ Tag tag;
+ Polygon<T> _0;
+ };
+
+ struct Slice21_Body {
+ Tag tag;
+ OwnedSlice<T> _0;
+ };
+
+ struct Slice22_Body {
+ Tag tag;
+ OwnedSlice<int32_t> _0;
+ };
+
+ struct Slice23_Body {
+ Tag tag;
+ FillRule fill;
+ OwnedSlice<T> coords;
+ };
+
+ struct Slice24_Body {
+ Tag tag;
+ FillRule fill;
+ OwnedSlice<int32_t> coords;
+ };
+
+ struct {
+ Tag tag;
+ };
+ Polygon21_Body polygon21;
+ Slice21_Body slice21;
+ Slice22_Body slice22;
+ Slice23_Body slice23;
+ Slice24_Body slice24;
+
+ static Baz Bar2() {
+ Baz result;
+ result.tag = Tag::Bar2;
+ return result;
+ }
+
+ bool IsBar2() const {
+ return tag == Tag::Bar2;
+ }
+
+ static Baz Polygon21(const Polygon<T> &_0) {
+ Baz result;
+ ::new (&result.polygon21._0) (Polygon<T>)(_0);
+ result.tag = Tag::Polygon21;
+ return result;
+ }
+
+ bool IsPolygon21() const {
+ return tag == Tag::Polygon21;
+ }
+
+ static Baz Slice21(const OwnedSlice<T> &_0) {
+ Baz result;
+ ::new (&result.slice21._0) (OwnedSlice<T>)(_0);
+ result.tag = Tag::Slice21;
+ return result;
+ }
+
+ bool IsSlice21() const {
+ return tag == Tag::Slice21;
+ }
+
+ static Baz Slice22(const OwnedSlice<int32_t> &_0) {
+ Baz result;
+ ::new (&result.slice22._0) (OwnedSlice<int32_t>)(_0);
+ result.tag = Tag::Slice22;
+ return result;
+ }
+
+ bool IsSlice22() const {
+ return tag == Tag::Slice22;
+ }
+
+ static Baz Slice23(const FillRule &fill,
+ const OwnedSlice<T> &coords) {
+ Baz result;
+ ::new (&result.slice23.fill) (FillRule)(fill);
+ ::new (&result.slice23.coords) (OwnedSlice<T>)(coords);
+ result.tag = Tag::Slice23;
+ return result;
+ }
+
+ bool IsSlice23() const {
+ return tag == Tag::Slice23;
+ }
+
+ static Baz Slice24(const FillRule &fill,
+ const OwnedSlice<int32_t> &coords) {
+ Baz result;
+ ::new (&result.slice24.fill) (FillRule)(fill);
+ ::new (&result.slice24.coords) (OwnedSlice<int32_t>)(coords);
+ result.tag = Tag::Slice24;
+ return result;
+ }
+
+ bool IsSlice24() const {
+ return tag == Tag::Slice24;
+ }
+
+ private:
+ Baz() {
+
+ }
+ public:
+
+
+ ~Baz() {
+ switch (tag) {
+ case Tag::Polygon21: polygon21.~Polygon21_Body(); break;
+ case Tag::Slice21: slice21.~Slice21_Body(); break;
+ case Tag::Slice22: slice22.~Slice22_Body(); break;
+ case Tag::Slice23: slice23.~Slice23_Body(); break;
+ case Tag::Slice24: slice24.~Slice24_Body(); break;
+ default: break;
+ }
+ }
+
+ Baz(const Baz& other)
+ : tag(other.tag) {
+ switch (tag) {
+ case Tag::Polygon21: ::new (&polygon21) (Polygon21_Body)(other.polygon21); break;
+ case Tag::Slice21: ::new (&slice21) (Slice21_Body)(other.slice21); break;
+ case Tag::Slice22: ::new (&slice22) (Slice22_Body)(other.slice22); break;
+ case Tag::Slice23: ::new (&slice23) (Slice23_Body)(other.slice23); break;
+ case Tag::Slice24: ::new (&slice24) (Slice24_Body)(other.slice24); break;
+ default: break;
+ }
+ }
+ Baz& operator=(const Baz& other) {
+ if (this != &other) {
+ this->~Baz();
+ new (this) Baz(other);
+ }
+ return *this;
+ }
+};
+
+union Taz {
+ enum class Tag : uint8_t {
+ Bar3,
+ Taz1,
+ Taz3,
+ };
+
+ struct Taz1_Body {
+ Tag tag;
+ int32_t _0;
+ };
+
+ struct Taz3_Body {
+ Tag tag;
+ OwnedSlice<int32_t> _0;
+ };
+
+ struct {
+ Tag tag;
+ };
+ Taz1_Body taz1;
+ Taz3_Body taz3;
+
+ static Taz Bar3() {
+ Taz result;
+ result.tag = Tag::Bar3;
+ return result;
+ }
+
+ bool IsBar3() const {
+ return tag == Tag::Bar3;
+ }
+
+ static Taz Taz1(const int32_t &_0) {
+ Taz result;
+ ::new (&result.taz1._0) (int32_t)(_0);
+ result.tag = Tag::Taz1;
+ return result;
+ }
+
+ bool IsTaz1() const {
+ return tag == Tag::Taz1;
+ }
+
+ static Taz Taz3(const OwnedSlice<int32_t> &_0) {
+ Taz result;
+ ::new (&result.taz3._0) (OwnedSlice<int32_t>)(_0);
+ result.tag = Tag::Taz3;
+ return result;
+ }
+
+ bool IsTaz3() const {
+ return tag == Tag::Taz3;
+ }
+
+ private:
+ Taz() {
+
+ }
+ public:
+
+
+ ~Taz() {
+ switch (tag) {
+ case Tag::Taz1: taz1.~Taz1_Body(); break;
+ case Tag::Taz3: taz3.~Taz3_Body(); break;
+ default: break;
+ }
+ }
+
+ Taz(const Taz& other)
+ : tag(other.tag) {
+ switch (tag) {
+ case Tag::Taz1: ::new (&taz1) (Taz1_Body)(other.taz1); break;
+ case Tag::Taz3: ::new (&taz3) (Taz3_Body)(other.taz3); break;
+ default: break;
+ }
+ }
+ Taz& operator=(const Taz& other) {
+ if (this != &other) {
+ this->~Taz();
+ new (this) Taz(other);
+ }
+ return *this;
+ }
+};
+
+union Tazz {
+ enum class Tag : uint8_t {
+ Bar4,
+ Taz2,
+ };
+
+ struct Taz2_Body {
+ Tag tag;
+ int32_t _0;
+ };
+
+ struct {
+ Tag tag;
+ };
+ Taz2_Body taz2;
+
+ static Tazz Bar4() {
+ Tazz result;
+ result.tag = Tag::Bar4;
+ return result;
+ }
+
+ bool IsBar4() const {
+ return tag == Tag::Bar4;
+ }
+
+ static Tazz Taz2(const int32_t &_0) {
+ Tazz result;
+ ::new (&result.taz2._0) (int32_t)(_0);
+ result.tag = Tag::Taz2;
+ return result;
+ }
+
+ bool IsTaz2() const {
+ return tag == Tag::Taz2;
+ }
+
+ private:
+ Tazz() {
+
+ }
+ public:
+
+};
+
+union Tazzz {
+ enum class Tag : uint8_t {
+ Bar5,
+ Taz5,
+ };
+
+ struct Taz5_Body {
+ Tag tag;
+ int32_t _0;
+ };
+
+ struct {
+ Tag tag;
+ };
+ Taz5_Body taz5;
+
+ static Tazzz Bar5() {
+ Tazzz result;
+ result.tag = Tag::Bar5;
+ return result;
+ }
+
+ bool IsBar5() const {
+ return tag == Tag::Bar5;
+ }
+
+ static Tazzz Taz5(const int32_t &_0) {
+ Tazzz result;
+ ::new (&result.taz5._0) (int32_t)(_0);
+ result.tag = Tag::Taz5;
+ return result;
+ }
+
+ bool IsTaz5() const {
+ return tag == Tag::Taz5;
+ }
+
+ private:
+ Tazzz() {
+
+ }
+ public:
+
+
+ ~Tazzz() {
+ switch (tag) {
+ case Tag::Taz5: taz5.~Taz5_Body(); break;
+ default: break;
+ }
+ }
+
+ Tazzz(const Tazzz& other)
+ : tag(other.tag) {
+ switch (tag) {
+ case Tag::Taz5: ::new (&taz5) (Taz5_Body)(other.taz5); break;
+ default: break;
+ }
+ }
+};
+
+union Tazzzz {
+ enum class Tag : uint8_t {
+ Taz6,
+ Taz7,
+ };
+
+ struct Taz6_Body {
+ Tag tag;
+ int32_t _0;
+ };
+
+ struct Taz7_Body {
+ Tag tag;
+ uint32_t _0;
+ };
+
+ struct {
+ Tag tag;
+ };
+ Taz6_Body taz6;
+ Taz7_Body taz7;
+
+ static Tazzzz Taz6(const int32_t &_0) {
+ Tazzzz result;
+ ::new (&result.taz6._0) (int32_t)(_0);
+ result.tag = Tag::Taz6;
+ return result;
+ }
+
+ bool IsTaz6() const {
+ return tag == Tag::Taz6;
+ }
+
+ static Tazzzz Taz7(const uint32_t &_0) {
+ Tazzzz result;
+ ::new (&result.taz7._0) (uint32_t)(_0);
+ result.tag = Tag::Taz7;
+ return result;
+ }
+
+ bool IsTaz7() const {
+ return tag == Tag::Taz7;
+ }
+
+ private:
+ Tazzzz() {
+
+ }
+ public:
+
+
+ ~Tazzzz() {
+ switch (tag) {
+ case Tag::Taz6: taz6.~Taz6_Body(); break;
+ case Tag::Taz7: taz7.~Taz7_Body(); break;
+
+ }
+ }
+
+ Tazzzz(const Tazzzz& other)
+ : tag(other.tag) {
+ switch (tag) {
+ case Tag::Taz6: ::new (&taz6) (Taz6_Body)(other.taz6); break;
+ case Tag::Taz7: ::new (&taz7) (Taz7_Body)(other.taz7); break;
+
+ }
+ }
+ Tazzzz& operator=(const Tazzzz& other) {
+ if (this != &other) {
+ this->~Tazzzz();
+ new (this) Tazzzz(other);
+ }
+ return *this;
+ }
+};
+
+union Qux {
+ enum class Tag : uint8_t {
+ Qux1,
+ Qux2,
+ };
+
+ struct Qux1_Body {
+ Tag tag;
+ int32_t _0;
+
+ bool operator==(const Qux1_Body& other) const {
+ return _0 == other._0;
+ }
+ };
+
+ struct Qux2_Body {
+ Tag tag;
+ uint32_t _0;
+
+ bool operator==(const Qux2_Body& other) const {
+ return _0 == other._0;
+ }
+ };
+
+ struct {
+ Tag tag;
+ };
+ Qux1_Body qux1;
+ Qux2_Body qux2;
+
+ static Qux Qux1(const int32_t &_0) {
+ Qux result;
+ ::new (&result.qux1._0) (int32_t)(_0);
+ result.tag = Tag::Qux1;
+ return result;
+ }
+
+ bool IsQux1() const {
+ return tag == Tag::Qux1;
+ }
+
+ static Qux Qux2(const uint32_t &_0) {
+ Qux result;
+ ::new (&result.qux2._0) (uint32_t)(_0);
+ result.tag = Tag::Qux2;
+ return result;
+ }
+
+ bool IsQux2() const {
+ return tag == Tag::Qux2;
+ }
+
+ NODISCARD bool operator==(const Qux& other) const {
+ if (tag != other.tag) {
+ return false;
+ }
+ switch (tag) {
+ case Tag::Qux1: return qux1 == other.qux1;
+ case Tag::Qux2: return qux2 == other.qux2;
+
+ }
+ return true;
+ }
+
+ NODISCARD bool operator!=(const Qux& other) const {
+ return !(*this == other);
+ }
+
+ private:
+ Qux() {
+
+ }
+ public:
+
+
+ NOINLINE ~Qux() {
+ switch (tag) {
+ case Tag::Qux1: qux1.~Qux1_Body(); break;
+ case Tag::Qux2: qux2.~Qux2_Body(); break;
+
+ }
+ }
+
+ NOINLINE Qux(const Qux& other)
+ : tag(other.tag) {
+ switch (tag) {
+ case Tag::Qux1: ::new (&qux1) (Qux1_Body)(other.qux1); break;
+ case Tag::Qux2: ::new (&qux2) (Qux2_Body)(other.qux2); break;
+
+ }
+ }
+ NOINLINE Qux& operator=(const Qux& other) {
+ if (this != &other) {
+ this->~Qux();
+ new (this) Qux(other);
+ }
+ return *this;
+ }
+};
+
+extern "C" {
+
+void root(const Foo<uint32_t> *a,
+ const Baz<int32_t> *b,
+ const Taz *c,
+ Tazz d,
+ const Tazzz *e,
+ const Tazzzz *f,
+ const Qux *g);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.pyx b/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.pyx
rename to cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.both.c b/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.both.c
rename to cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor_both.compat.c b/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor_both.compat.c
new file mode 100644
index 0000000..d151c7d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor_both.compat.c
@@ -0,0 +1,266 @@
+#define NOINLINE __attribute__((noinline))
+#define NODISCARD [[nodiscard]]
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum FillRule
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ A,
+ B,
+};
+#ifndef __cplusplus
+typedef uint8_t FillRule;
+#endif // __cplusplus
+
+/**
+ * This will have a destructor manually implemented via variant_body, and
+ * similarly a Drop impl in Rust.
+ */
+typedef struct OwnedSlice_u32 {
+ uintptr_t len;
+ uint32_t *ptr;
+} OwnedSlice_u32;
+
+typedef struct Polygon_u32 {
+ FillRule fill;
+ struct OwnedSlice_u32 coordinates;
+} Polygon_u32;
+
+/**
+ * This will have a destructor manually implemented via variant_body, and
+ * similarly a Drop impl in Rust.
+ */
+typedef struct OwnedSlice_i32 {
+ uintptr_t len;
+ int32_t *ptr;
+} OwnedSlice_i32;
+
+enum Foo_u32_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar_u32,
+ Polygon1_u32,
+ Slice1_u32,
+ Slice2_u32,
+ Slice3_u32,
+ Slice4_u32,
+};
+#ifndef __cplusplus
+typedef uint8_t Foo_u32_Tag;
+#endif // __cplusplus
+
+typedef struct Slice3_Body_u32 {
+ FillRule fill;
+ struct OwnedSlice_u32 coords;
+} Slice3_Body_u32;
+
+typedef struct Slice4_Body_u32 {
+ FillRule fill;
+ struct OwnedSlice_i32 coords;
+} Slice4_Body_u32;
+
+typedef struct Foo_u32 {
+ Foo_u32_Tag tag;
+ union {
+ struct {
+ struct Polygon_u32 polygon1;
+ };
+ struct {
+ struct OwnedSlice_u32 slice1;
+ };
+ struct {
+ struct OwnedSlice_i32 slice2;
+ };
+ Slice3_Body_u32 slice3;
+ Slice4_Body_u32 slice4;
+ };
+} Foo_u32;
+
+typedef struct Polygon_i32 {
+ FillRule fill;
+ struct OwnedSlice_i32 coordinates;
+} Polygon_i32;
+
+enum Baz_i32_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar2_i32,
+ Polygon21_i32,
+ Slice21_i32,
+ Slice22_i32,
+ Slice23_i32,
+ Slice24_i32,
+};
+#ifndef __cplusplus
+typedef uint8_t Baz_i32_Tag;
+#endif // __cplusplus
+
+typedef struct Slice23_Body_i32 {
+ Baz_i32_Tag tag;
+ FillRule fill;
+ struct OwnedSlice_i32 coords;
+} Slice23_Body_i32;
+
+typedef struct Slice24_Body_i32 {
+ Baz_i32_Tag tag;
+ FillRule fill;
+ struct OwnedSlice_i32 coords;
+} Slice24_Body_i32;
+
+typedef union Baz_i32 {
+ Baz_i32_Tag tag;
+ struct {
+ Baz_i32_Tag polygon21_tag;
+ struct Polygon_i32 polygon21;
+ };
+ struct {
+ Baz_i32_Tag slice21_tag;
+ struct OwnedSlice_i32 slice21;
+ };
+ struct {
+ Baz_i32_Tag slice22_tag;
+ struct OwnedSlice_i32 slice22;
+ };
+ Slice23_Body_i32 slice23;
+ Slice24_Body_i32 slice24;
+} Baz_i32;
+
+enum Taz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar3,
+ Taz1,
+ Taz3,
+};
+#ifndef __cplusplus
+typedef uint8_t Taz_Tag;
+#endif // __cplusplus
+
+typedef union Taz {
+ Taz_Tag tag;
+ struct {
+ Taz_Tag taz1_tag;
+ int32_t taz1;
+ };
+ struct {
+ Taz_Tag taz3_tag;
+ struct OwnedSlice_i32 taz3;
+ };
+} Taz;
+
+enum Tazz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar4,
+ Taz2,
+};
+#ifndef __cplusplus
+typedef uint8_t Tazz_Tag;
+#endif // __cplusplus
+
+typedef union Tazz {
+ Tazz_Tag tag;
+ struct {
+ Tazz_Tag taz2_tag;
+ int32_t taz2;
+ };
+} Tazz;
+
+enum Tazzz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar5,
+ Taz5,
+};
+#ifndef __cplusplus
+typedef uint8_t Tazzz_Tag;
+#endif // __cplusplus
+
+typedef union Tazzz {
+ Tazzz_Tag tag;
+ struct {
+ Tazzz_Tag taz5_tag;
+ int32_t taz5;
+ };
+} Tazzz;
+
+enum Tazzzz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Taz6,
+ Taz7,
+};
+#ifndef __cplusplus
+typedef uint8_t Tazzzz_Tag;
+#endif // __cplusplus
+
+typedef union Tazzzz {
+ Tazzzz_Tag tag;
+ struct {
+ Tazzzz_Tag taz6_tag;
+ int32_t taz6;
+ };
+ struct {
+ Tazzzz_Tag taz7_tag;
+ uint32_t taz7;
+ };
+} Tazzzz;
+
+enum Qux_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Qux1,
+ Qux2,
+};
+#ifndef __cplusplus
+typedef uint8_t Qux_Tag;
+#endif // __cplusplus
+
+typedef union Qux {
+ Qux_Tag tag;
+ struct {
+ Qux_Tag qux1_tag;
+ int32_t qux1;
+ };
+ struct {
+ Qux_Tag qux2_tag;
+ uint32_t qux2;
+ };
+} Qux;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const struct Foo_u32 *a,
+ const union Baz_i32 *b,
+ const union Taz *c,
+ union Tazz d,
+ const union Tazzz *e,
+ const union Tazzzz *f,
+ const union Qux *g);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.tag.c b/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.tag.c
rename to cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor_tag.compat.c b/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor_tag.compat.c
new file mode 100644
index 0000000..e623326
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor_tag.compat.c
@@ -0,0 +1,266 @@
+#define NOINLINE __attribute__((noinline))
+#define NODISCARD [[nodiscard]]
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum FillRule
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ A,
+ B,
+};
+#ifndef __cplusplus
+typedef uint8_t FillRule;
+#endif // __cplusplus
+
+/**
+ * This will have a destructor manually implemented via variant_body, and
+ * similarly a Drop impl in Rust.
+ */
+struct OwnedSlice_u32 {
+ uintptr_t len;
+ uint32_t *ptr;
+};
+
+struct Polygon_u32 {
+ FillRule fill;
+ struct OwnedSlice_u32 coordinates;
+};
+
+/**
+ * This will have a destructor manually implemented via variant_body, and
+ * similarly a Drop impl in Rust.
+ */
+struct OwnedSlice_i32 {
+ uintptr_t len;
+ int32_t *ptr;
+};
+
+enum Foo_u32_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar_u32,
+ Polygon1_u32,
+ Slice1_u32,
+ Slice2_u32,
+ Slice3_u32,
+ Slice4_u32,
+};
+#ifndef __cplusplus
+typedef uint8_t Foo_u32_Tag;
+#endif // __cplusplus
+
+struct Slice3_Body_u32 {
+ FillRule fill;
+ struct OwnedSlice_u32 coords;
+};
+
+struct Slice4_Body_u32 {
+ FillRule fill;
+ struct OwnedSlice_i32 coords;
+};
+
+struct Foo_u32 {
+ Foo_u32_Tag tag;
+ union {
+ struct {
+ struct Polygon_u32 polygon1;
+ };
+ struct {
+ struct OwnedSlice_u32 slice1;
+ };
+ struct {
+ struct OwnedSlice_i32 slice2;
+ };
+ struct Slice3_Body_u32 slice3;
+ struct Slice4_Body_u32 slice4;
+ };
+};
+
+struct Polygon_i32 {
+ FillRule fill;
+ struct OwnedSlice_i32 coordinates;
+};
+
+enum Baz_i32_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar2_i32,
+ Polygon21_i32,
+ Slice21_i32,
+ Slice22_i32,
+ Slice23_i32,
+ Slice24_i32,
+};
+#ifndef __cplusplus
+typedef uint8_t Baz_i32_Tag;
+#endif // __cplusplus
+
+struct Slice23_Body_i32 {
+ Baz_i32_Tag tag;
+ FillRule fill;
+ struct OwnedSlice_i32 coords;
+};
+
+struct Slice24_Body_i32 {
+ Baz_i32_Tag tag;
+ FillRule fill;
+ struct OwnedSlice_i32 coords;
+};
+
+union Baz_i32 {
+ Baz_i32_Tag tag;
+ struct {
+ Baz_i32_Tag polygon21_tag;
+ struct Polygon_i32 polygon21;
+ };
+ struct {
+ Baz_i32_Tag slice21_tag;
+ struct OwnedSlice_i32 slice21;
+ };
+ struct {
+ Baz_i32_Tag slice22_tag;
+ struct OwnedSlice_i32 slice22;
+ };
+ struct Slice23_Body_i32 slice23;
+ struct Slice24_Body_i32 slice24;
+};
+
+enum Taz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar3,
+ Taz1,
+ Taz3,
+};
+#ifndef __cplusplus
+typedef uint8_t Taz_Tag;
+#endif // __cplusplus
+
+union Taz {
+ Taz_Tag tag;
+ struct {
+ Taz_Tag taz1_tag;
+ int32_t taz1;
+ };
+ struct {
+ Taz_Tag taz3_tag;
+ struct OwnedSlice_i32 taz3;
+ };
+};
+
+enum Tazz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar4,
+ Taz2,
+};
+#ifndef __cplusplus
+typedef uint8_t Tazz_Tag;
+#endif // __cplusplus
+
+union Tazz {
+ Tazz_Tag tag;
+ struct {
+ Tazz_Tag taz2_tag;
+ int32_t taz2;
+ };
+};
+
+enum Tazzz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Bar5,
+ Taz5,
+};
+#ifndef __cplusplus
+typedef uint8_t Tazzz_Tag;
+#endif // __cplusplus
+
+union Tazzz {
+ Tazzz_Tag tag;
+ struct {
+ Tazzz_Tag taz5_tag;
+ int32_t taz5;
+ };
+};
+
+enum Tazzzz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Taz6,
+ Taz7,
+};
+#ifndef __cplusplus
+typedef uint8_t Tazzzz_Tag;
+#endif // __cplusplus
+
+union Tazzzz {
+ Tazzzz_Tag tag;
+ struct {
+ Tazzzz_Tag taz6_tag;
+ int32_t taz6;
+ };
+ struct {
+ Tazzzz_Tag taz7_tag;
+ uint32_t taz7;
+ };
+};
+
+enum Qux_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Qux1,
+ Qux2,
+};
+#ifndef __cplusplus
+typedef uint8_t Qux_Tag;
+#endif // __cplusplus
+
+union Qux {
+ Qux_Tag tag;
+ struct {
+ Qux_Tag qux1_tag;
+ int32_t qux1;
+ };
+ struct {
+ Qux_Tag qux2_tag;
+ uint32_t qux2;
+ };
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const struct Foo_u32 *a,
+ const union Baz_i32 *b,
+ const union Taz *c,
+ union Tazz d,
+ const union Tazzz *e,
+ const union Tazzzz *f,
+ const union Qux *g);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.tag.pyx b/cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/destructor_and_copy_ctor.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/destructor_and_copy_ctor_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/display_list.c b/cbindgen-0.27.0/tests/expectations/display_list.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/display_list.c
rename to cbindgen-0.27.0/tests/expectations/display_list.c
diff --git a/cbindgen-0.27.0/tests/expectations/display_list.compat.c b/cbindgen-0.27.0/tests/expectations/display_list.compat.c
new file mode 100644
index 0000000..79c7470
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/display_list.compat.c
@@ -0,0 +1,59 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ float x;
+ float y;
+ float w;
+ float h;
+} Rect;
+
+typedef struct {
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ uint8_t a;
+} Color;
+
+enum DisplayItem_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Fill,
+ Image,
+ ClearScreen,
+};
+#ifndef __cplusplus
+typedef uint8_t DisplayItem_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ DisplayItem_Tag tag;
+ Rect _0;
+ Color _1;
+} Fill_Body;
+
+typedef struct {
+ DisplayItem_Tag tag;
+ uint32_t id;
+ Rect bounds;
+} Image_Body;
+
+typedef union {
+ DisplayItem_Tag tag;
+ Fill_Body fill;
+ Image_Body image;
+} DisplayItem;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+bool push_item(DisplayItem item);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/display_list.cpp b/cbindgen-0.27.0/tests/expectations/display_list.cpp
new file mode 100644
index 0000000..09957fc
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/display_list.cpp
@@ -0,0 +1,51 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Rect {
+ float x;
+ float y;
+ float w;
+ float h;
+};
+
+struct Color {
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ uint8_t a;
+};
+
+union DisplayItem {
+ enum class Tag : uint8_t {
+ Fill,
+ Image,
+ ClearScreen,
+ };
+
+ struct Fill_Body {
+ Tag tag;
+ Rect _0;
+ Color _1;
+ };
+
+ struct Image_Body {
+ Tag tag;
+ uint32_t id;
+ Rect bounds;
+ };
+
+ struct {
+ Tag tag;
+ };
+ Fill_Body fill;
+ Image_Body image;
+};
+
+extern "C" {
+
+bool push_item(DisplayItem item);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/display_list.pyx b/cbindgen-0.27.0/tests/expectations/display_list.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/display_list.pyx
rename to cbindgen-0.27.0/tests/expectations/display_list.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/display_list.both.c b/cbindgen-0.27.0/tests/expectations/display_list_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/display_list.both.c
rename to cbindgen-0.27.0/tests/expectations/display_list_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/display_list_both.compat.c b/cbindgen-0.27.0/tests/expectations/display_list_both.compat.c
new file mode 100644
index 0000000..8dfd522
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/display_list_both.compat.c
@@ -0,0 +1,59 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Rect {
+ float x;
+ float y;
+ float w;
+ float h;
+} Rect;
+
+typedef struct Color {
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ uint8_t a;
+} Color;
+
+enum DisplayItem_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Fill,
+ Image,
+ ClearScreen,
+};
+#ifndef __cplusplus
+typedef uint8_t DisplayItem_Tag;
+#endif // __cplusplus
+
+typedef struct Fill_Body {
+ DisplayItem_Tag tag;
+ struct Rect _0;
+ struct Color _1;
+} Fill_Body;
+
+typedef struct Image_Body {
+ DisplayItem_Tag tag;
+ uint32_t id;
+ struct Rect bounds;
+} Image_Body;
+
+typedef union DisplayItem {
+ DisplayItem_Tag tag;
+ Fill_Body fill;
+ Image_Body image;
+} DisplayItem;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+bool push_item(union DisplayItem item);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/display_list.tag.c b/cbindgen-0.27.0/tests/expectations/display_list_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/display_list.tag.c
rename to cbindgen-0.27.0/tests/expectations/display_list_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/display_list_tag.compat.c b/cbindgen-0.27.0/tests/expectations/display_list_tag.compat.c
new file mode 100644
index 0000000..ec7c2cd
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/display_list_tag.compat.c
@@ -0,0 +1,59 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Rect {
+ float x;
+ float y;
+ float w;
+ float h;
+};
+
+struct Color {
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ uint8_t a;
+};
+
+enum DisplayItem_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Fill,
+ Image,
+ ClearScreen,
+};
+#ifndef __cplusplus
+typedef uint8_t DisplayItem_Tag;
+#endif // __cplusplus
+
+struct Fill_Body {
+ DisplayItem_Tag tag;
+ struct Rect _0;
+ struct Color _1;
+};
+
+struct Image_Body {
+ DisplayItem_Tag tag;
+ uint32_t id;
+ struct Rect bounds;
+};
+
+union DisplayItem {
+ DisplayItem_Tag tag;
+ struct Fill_Body fill;
+ struct Image_Body image;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+bool push_item(union DisplayItem item);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/display_list.tag.pyx b/cbindgen-0.27.0/tests/expectations/display_list_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/display_list.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/display_list_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/doclength_short.c b/cbindgen-0.27.0/tests/expectations/doclength_short.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/doclength_short.c
rename to cbindgen-0.27.0/tests/expectations/doclength_short.c
diff --git a/cbindgen-0.27.0/tests/expectations/doclength_short.compat.c b/cbindgen-0.27.0/tests/expectations/doclength_short.compat.c
new file mode 100644
index 0000000..a1d883b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/doclength_short.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+/**
+ * The root of all evil.
+ */
+void root(void);
+
+/**
+ * A little above the root, and a lot more visible, with a run-on sentence
+ */
+void trunk(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/doclength_short.cpp b/cbindgen-0.27.0/tests/expectations/doclength_short.cpp
new file mode 100644
index 0000000..9ea102e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/doclength_short.cpp
@@ -0,0 +1,15 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+/// The root of all evil.
+void root();
+
+/// A little above the root, and a lot more visible, with a run-on sentence
+void trunk();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/doclength_short.pyx b/cbindgen-0.27.0/tests/expectations/doclength_short.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/doclength_short.pyx
rename to cbindgen-0.27.0/tests/expectations/doclength_short.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/docstyle_auto.c b/cbindgen-0.27.0/tests/expectations/docstyle_auto.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/docstyle_auto.c
rename to cbindgen-0.27.0/tests/expectations/docstyle_auto.c
diff --git a/cbindgen-0.27.0/tests/expectations/docstyle_auto.compat.c b/cbindgen-0.27.0/tests/expectations/docstyle_auto.compat.c
new file mode 100644
index 0000000..5900aef
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/docstyle_auto.compat.c
@@ -0,0 +1,17 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+/**
+ * The root of all evil.
+ */
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/docstyle_auto.cpp b/cbindgen-0.27.0/tests/expectations/docstyle_auto.cpp
new file mode 100644
index 0000000..bf814c1
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/docstyle_auto.cpp
@@ -0,0 +1,12 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+/// The root of all evil.
+void root();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/docstyle_auto.pyx b/cbindgen-0.27.0/tests/expectations/docstyle_auto.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/docstyle_auto.pyx
rename to cbindgen-0.27.0/tests/expectations/docstyle_auto.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/docstyle_c99.c b/cbindgen-0.27.0/tests/expectations/docstyle_c99.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/docstyle_c99.c
rename to cbindgen-0.27.0/tests/expectations/docstyle_c99.c
diff --git a/cbindgen-0.27.0/tests/expectations/docstyle_c99.compat.c b/cbindgen-0.27.0/tests/expectations/docstyle_c99.compat.c
new file mode 100644
index 0000000..bf3028d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/docstyle_c99.compat.c
@@ -0,0 +1,15 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+// The root of all evil.
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/docstyle_c99.cpp b/cbindgen-0.27.0/tests/expectations/docstyle_c99.cpp
new file mode 100644
index 0000000..f32ff0d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/docstyle_c99.cpp
@@ -0,0 +1,12 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+// The root of all evil.
+void root();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/docstyle_c99.pyx b/cbindgen-0.27.0/tests/expectations/docstyle_c99.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/docstyle_c99.pyx
rename to cbindgen-0.27.0/tests/expectations/docstyle_c99.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/docstyle_doxy.c b/cbindgen-0.27.0/tests/expectations/docstyle_doxy.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/docstyle_doxy.c
rename to cbindgen-0.27.0/tests/expectations/docstyle_doxy.c
diff --git a/cbindgen-0.27.0/tests/expectations/docstyle_doxy.compat.c b/cbindgen-0.27.0/tests/expectations/docstyle_doxy.compat.c
new file mode 100644
index 0000000..5900aef
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/docstyle_doxy.compat.c
@@ -0,0 +1,17 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+/**
+ * The root of all evil.
+ */
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/docstyle_doxy.cpp b/cbindgen-0.27.0/tests/expectations/docstyle_doxy.cpp
new file mode 100644
index 0000000..314c33b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/docstyle_doxy.cpp
@@ -0,0 +1,14 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+/**
+ * The root of all evil.
+ */
+void root();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/docstyle_doxy.pyx b/cbindgen-0.27.0/tests/expectations/docstyle_doxy.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/docstyle_doxy.pyx
rename to cbindgen-0.27.0/tests/expectations/docstyle_doxy.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/documentation.c b/cbindgen-0.27.0/tests/expectations/documentation.c
new file mode 100644
index 0000000..81768b0
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/documentation.c
@@ -0,0 +1,31 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/**
+ * Some docs.
+ */
+extern const uint32_t FOO;
+
+/**
+ * The root of all evil.
+ *
+ * But at least it contains some more documentation as someone would expect
+ * from a simple test case like this.
+ *
+ * # Hint
+ *
+ * Always ensure that everything is properly documented, even if you feel lazy.
+ * **Sometimes** it is also helpful to include some markdown formatting.
+ *
+ * ////////////////////////////////////////////////////////////////////////////
+ *
+ * Attention:
+ *
+ * Rust is going to trim all leading `/` symbols. If you want to use them as a
+ * marker you need to add at least a single whitespace inbetween the tripple
+ * slash doc-comment marker and the rest.
+ *
+ */
+void root(void);
diff --git a/cbindgen-0.27.0/tests/expectations/documentation.compat.c b/cbindgen-0.27.0/tests/expectations/documentation.compat.c
new file mode 100644
index 0000000..76b4e6e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/documentation.compat.c
@@ -0,0 +1,39 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+/**
+ * Some docs.
+ */
+extern const uint32_t FOO;
+
+/**
+ * The root of all evil.
+ *
+ * But at least it contains some more documentation as someone would expect
+ * from a simple test case like this.
+ *
+ * # Hint
+ *
+ * Always ensure that everything is properly documented, even if you feel lazy.
+ * **Sometimes** it is also helpful to include some markdown formatting.
+ *
+ * ////////////////////////////////////////////////////////////////////////////
+ *
+ * Attention:
+ *
+ * Rust is going to trim all leading `/` symbols. If you want to use them as a
+ * marker you need to add at least a single whitespace inbetween the tripple
+ * slash doc-comment marker and the rest.
+ *
+ */
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/documentation.cpp b/cbindgen-0.27.0/tests/expectations/documentation.cpp
new file mode 100644
index 0000000..3b01097
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/documentation.cpp
@@ -0,0 +1,32 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+/// Some docs.
+extern const uint32_t FOO;
+
+/// The root of all evil.
+///
+/// But at least it contains some more documentation as someone would expect
+/// from a simple test case like this.
+///
+/// # Hint
+///
+/// Always ensure that everything is properly documented, even if you feel lazy.
+/// **Sometimes** it is also helpful to include some markdown formatting.
+///
+/// ////////////////////////////////////////////////////////////////////////////
+///
+/// Attention:
+///
+/// Rust is going to trim all leading `/` symbols. If you want to use them as a
+/// marker you need to add at least a single whitespace inbetween the tripple
+/// slash doc-comment marker and the rest.
+///
+void root();
+
+} // extern "C"
diff --git a/cbindgen-0.27.0/tests/expectations/documentation.pyx b/cbindgen-0.27.0/tests/expectations/documentation.pyx
new file mode 100644
index 0000000..1d0743b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/documentation.pyx
@@ -0,0 +1,30 @@
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ # Some docs.
+ extern const uint32_t FOO;
+
+ # The root of all evil.
+ #
+ # But at least it contains some more documentation as someone would expect
+ # from a simple test case like this.
+ #
+ # # Hint
+ #
+ # Always ensure that everything is properly documented, even if you feel lazy.
+ # **Sometimes** it is also helpful to include some markdown formatting.
+ #
+ # ////////////////////////////////////////////////////////////////////////////
+ #
+ # Attention:
+ #
+ # Rust is going to trim all leading `/` symbols. If you want to use them as a
+ # marker you need to add at least a single whitespace inbetween the tripple
+ # slash doc-comment marker and the rest.
+ #
+ void root();
diff --git a/cbindgen-0.24.5/tests/expectations/documentation_attr.c b/cbindgen-0.27.0/tests/expectations/documentation_attr.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/documentation_attr.c
rename to cbindgen-0.27.0/tests/expectations/documentation_attr.c
diff --git a/cbindgen-0.27.0/tests/expectations/documentation_attr.compat.c b/cbindgen-0.27.0/tests/expectations/documentation_attr.compat.c
new file mode 100644
index 0000000..7c31c66
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/documentation_attr.compat.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+/**
+ *With doc attr, each attr contribute to one line of document
+ *like this one with a new line character at its end
+ *and this one as well. So they are in the same paragraph
+ *
+ *Line ends with one new line should not break
+ *
+ *Line ends with two spaces and a new line
+ *should break to next line
+ *
+ *Line ends with two new lines
+ *
+ *Should break to next paragraph
+ */
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/documentation_attr.cpp b/cbindgen-0.27.0/tests/expectations/documentation_attr.cpp
new file mode 100644
index 0000000..5daa98c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/documentation_attr.cpp
@@ -0,0 +1,23 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+///With doc attr, each attr contribute to one line of document
+///like this one with a new line character at its end
+///and this one as well. So they are in the same paragraph
+///
+///Line ends with one new line should not break
+///
+///Line ends with two spaces and a new line
+///should break to next line
+///
+///Line ends with two new lines
+///
+///Should break to next paragraph
+void root();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/documentation_attr.pyx b/cbindgen-0.27.0/tests/expectations/documentation_attr.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/documentation_attr.pyx
rename to cbindgen-0.27.0/tests/expectations/documentation_attr.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/enum.c b/cbindgen-0.27.0/tests/expectations/enum.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/enum.c
rename to cbindgen-0.27.0/tests/expectations/enum.c
diff --git a/cbindgen-0.27.0/tests/expectations/enum.compat.c b/cbindgen-0.27.0/tests/expectations/enum.compat.c
new file mode 100644
index 0000000..86cedb9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/enum.compat.c
@@ -0,0 +1,335 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using Box = T*;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum A
+#ifdef __cplusplus
+ : uint64_t
+#endif // __cplusplus
+ {
+ a1 = 0,
+ a2 = 2,
+ a3,
+ a4 = 5,
+};
+#ifndef __cplusplus
+typedef uint64_t A;
+#endif // __cplusplus
+
+enum B
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ b1 = 0,
+ b2 = 2,
+ b3,
+ b4 = 5,
+};
+#ifndef __cplusplus
+typedef uint32_t B;
+#endif // __cplusplus
+
+enum C
+#ifdef __cplusplus
+ : uint16_t
+#endif // __cplusplus
+ {
+ c1 = 0,
+ c2 = 2,
+ c3,
+ c4 = 5,
+};
+#ifndef __cplusplus
+typedef uint16_t C;
+#endif // __cplusplus
+
+enum D
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ d1 = 0,
+ d2 = 2,
+ d3,
+ d4 = 5,
+};
+#ifndef __cplusplus
+typedef uint8_t D;
+#endif // __cplusplus
+
+enum E
+#ifdef __cplusplus
+ : uintptr_t
+#endif // __cplusplus
+ {
+ e1 = 0,
+ e2 = 2,
+ e3,
+ e4 = 5,
+};
+#ifndef __cplusplus
+typedef uintptr_t E;
+#endif // __cplusplus
+
+enum F
+#ifdef __cplusplus
+ : intptr_t
+#endif // __cplusplus
+ {
+ f1 = 0,
+ f2 = 2,
+ f3,
+ f4 = 5,
+};
+#ifndef __cplusplus
+typedef intptr_t F;
+#endif // __cplusplus
+
+typedef enum {
+ l1,
+ l2,
+ l3,
+ l4,
+} L;
+
+enum M
+#ifdef __cplusplus
+ : int8_t
+#endif // __cplusplus
+ {
+ m1 = -1,
+ m2 = 0,
+ m3 = 1,
+};
+#ifndef __cplusplus
+typedef int8_t M;
+#endif // __cplusplus
+
+typedef enum {
+ n1,
+ n2,
+ n3,
+ n4,
+} N;
+
+enum O
+#ifdef __cplusplus
+ : int8_t
+#endif // __cplusplus
+ {
+ o1,
+ o2,
+ o3,
+ o4,
+};
+#ifndef __cplusplus
+typedef int8_t O;
+#endif // __cplusplus
+
+typedef struct J J;
+
+typedef struct K K;
+
+typedef struct Opaque Opaque;
+
+enum G_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo,
+ Bar,
+ Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t G_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ G_Tag tag;
+ uint8_t x;
+ int16_t y;
+} Bar_Body;
+
+typedef union {
+ G_Tag tag;
+ struct {
+ G_Tag foo_tag;
+ int16_t foo;
+ };
+ Bar_Body bar;
+} G;
+
+typedef enum {
+ H_Foo,
+ H_Bar,
+ H_Baz,
+} H_Tag;
+
+typedef struct {
+ uint8_t x;
+ int16_t y;
+} H_Bar_Body;
+
+typedef struct {
+ H_Tag tag;
+ union {
+ struct {
+ int16_t foo;
+ };
+ H_Bar_Body bar;
+ };
+} H;
+
+enum ExI_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ ExI_Foo,
+ ExI_Bar,
+ ExI_Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t ExI_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ uint8_t x;
+ int16_t y;
+} ExI_Bar_Body;
+
+typedef struct {
+ ExI_Tag tag;
+ union {
+ struct {
+ int16_t foo;
+ };
+ ExI_Bar_Body bar;
+ };
+} ExI;
+
+enum P_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ P0,
+ P1,
+};
+#ifndef __cplusplus
+typedef uint8_t P_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ uint8_t _0;
+ uint8_t _1;
+ uint8_t _2;
+} P1_Body;
+
+typedef struct {
+ P_Tag tag;
+ union {
+ struct {
+ uint8_t p0;
+ };
+ P1_Body p1;
+ };
+} P;
+
+typedef enum {
+ Ok,
+ Err,
+} Q_Tag;
+
+typedef struct {
+ Q_Tag tag;
+ union {
+ struct {
+ uint32_t *ok;
+ };
+ struct {
+ uint32_t err;
+ };
+ };
+} Q;
+
+typedef enum {
+ IRFoo,
+ IRBar,
+ IRBaz,
+} R_Tag;
+
+typedef struct {
+ uint8_t x;
+ int16_t y;
+} IRBar_Body;
+
+typedef struct {
+ R_Tag tag;
+ union {
+ struct {
+ int16_t IRFoo;
+ };
+ IRBar_Body IRBar;
+ };
+} R;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Opaque *opaque,
+ A a,
+ B b,
+ C c,
+ D d,
+ E e,
+ F f,
+ G g,
+ H h,
+ ExI i,
+ J j,
+ K k,
+ L l,
+ M m,
+ N n,
+ O o,
+ P p,
+ Q q,
+ R r);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#if 0
+''' '
+#endif
+
+#include <stddef.h>
+#include "testing-helpers.h"
+static_assert(offsetof(CBINDGEN_STRUCT(P), tag) == 0, "unexpected offset for tag");
+static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p0");
+static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p1");
+static_assert(sizeof(CBINDGEN_STRUCT(P)) == 4, "unexpected size for P");
+
+#if 0
+' '''
+#endif
diff --git a/cbindgen-0.27.0/tests/expectations/enum.cpp b/cbindgen-0.27.0/tests/expectations/enum.cpp
new file mode 100644
index 0000000..66d9209
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/enum.cpp
@@ -0,0 +1,271 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using Box = T*;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+enum class A : uint64_t {
+ a1 = 0,
+ a2 = 2,
+ a3,
+ a4 = 5,
+};
+
+enum class B : uint32_t {
+ b1 = 0,
+ b2 = 2,
+ b3,
+ b4 = 5,
+};
+
+enum class C : uint16_t {
+ c1 = 0,
+ c2 = 2,
+ c3,
+ c4 = 5,
+};
+
+enum class D : uint8_t {
+ d1 = 0,
+ d2 = 2,
+ d3,
+ d4 = 5,
+};
+
+enum class E : uintptr_t {
+ e1 = 0,
+ e2 = 2,
+ e3,
+ e4 = 5,
+};
+
+enum class F : intptr_t {
+ f1 = 0,
+ f2 = 2,
+ f3,
+ f4 = 5,
+};
+
+enum class L {
+ l1,
+ l2,
+ l3,
+ l4,
+};
+
+enum class M : int8_t {
+ m1 = -1,
+ m2 = 0,
+ m3 = 1,
+};
+
+enum N {
+ n1,
+ n2,
+ n3,
+ n4,
+};
+
+enum O : int8_t {
+ o1,
+ o2,
+ o3,
+ o4,
+};
+
+struct J;
+
+struct K;
+
+struct Opaque;
+
+union G {
+ enum class Tag : uint8_t {
+ Foo,
+ Bar,
+ Baz,
+ };
+
+ struct Foo_Body {
+ Tag tag;
+ int16_t _0;
+ };
+
+ struct Bar_Body {
+ Tag tag;
+ uint8_t x;
+ int16_t y;
+ };
+
+ struct {
+ Tag tag;
+ };
+ Foo_Body foo;
+ Bar_Body bar;
+};
+
+struct H {
+ enum class Tag {
+ H_Foo,
+ H_Bar,
+ H_Baz,
+ };
+
+ struct H_Foo_Body {
+ int16_t _0;
+ };
+
+ struct H_Bar_Body {
+ uint8_t x;
+ int16_t y;
+ };
+
+ Tag tag;
+ union {
+ H_Foo_Body foo;
+ H_Bar_Body bar;
+ };
+};
+
+struct ExI {
+ enum class Tag : uint8_t {
+ ExI_Foo,
+ ExI_Bar,
+ ExI_Baz,
+ };
+
+ struct ExI_Foo_Body {
+ int16_t _0;
+ };
+
+ struct ExI_Bar_Body {
+ uint8_t x;
+ int16_t y;
+ };
+
+ Tag tag;
+ union {
+ ExI_Foo_Body foo;
+ ExI_Bar_Body bar;
+ };
+};
+
+struct P {
+ enum class Tag : uint8_t {
+ P0,
+ P1,
+ };
+
+ struct P0_Body {
+ uint8_t _0;
+ };
+
+ struct P1_Body {
+ uint8_t _0;
+ uint8_t _1;
+ uint8_t _2;
+ };
+
+ Tag tag;
+ union {
+ P0_Body p0;
+ P1_Body p1;
+ };
+};
+
+struct Q {
+ enum class Tag {
+ Ok,
+ Err,
+ };
+
+ struct Ok_Body {
+ Box<uint32_t> _0;
+ };
+
+ struct Err_Body {
+ uint32_t _0;
+ };
+
+ Tag tag;
+ union {
+ Ok_Body ok;
+ Err_Body err;
+ };
+};
+
+struct R {
+ enum class Tag {
+ IRFoo,
+ IRBar,
+ IRBaz,
+ };
+
+ struct IRFoo_Body {
+ int16_t _0;
+ };
+
+ struct IRBar_Body {
+ uint8_t x;
+ int16_t y;
+ };
+
+ Tag tag;
+ union {
+ IRFoo_Body IRFoo;
+ IRBar_Body IRBar;
+ };
+};
+
+extern "C" {
+
+void root(Opaque *opaque,
+ A a,
+ B b,
+ C c,
+ D d,
+ E e,
+ F f,
+ G g,
+ H h,
+ ExI i,
+ J j,
+ K k,
+ L l,
+ M m,
+ N n,
+ O o,
+ P p,
+ Q q,
+ R r);
+
+} // extern "C"
+
+#if 0
+''' '
+#endif
+
+#include <stddef.h>
+#include "testing-helpers.h"
+static_assert(offsetof(CBINDGEN_STRUCT(P), tag) == 0, "unexpected offset for tag");
+static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p0");
+static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p1");
+static_assert(sizeof(CBINDGEN_STRUCT(P)) == 4, "unexpected size for P");
+
+#if 0
+' '''
+#endif
diff --git a/cbindgen-0.24.5/tests/expectations/enum.pyx b/cbindgen-0.27.0/tests/expectations/enum.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/enum.pyx
rename to cbindgen-0.27.0/tests/expectations/enum.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/enum.both.c b/cbindgen-0.27.0/tests/expectations/enum_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/enum.both.c
rename to cbindgen-0.27.0/tests/expectations/enum_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/enum_both.compat.c b/cbindgen-0.27.0/tests/expectations/enum_both.compat.c
new file mode 100644
index 0000000..3548825
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/enum_both.compat.c
@@ -0,0 +1,335 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using Box = T*;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum A
+#ifdef __cplusplus
+ : uint64_t
+#endif // __cplusplus
+ {
+ a1 = 0,
+ a2 = 2,
+ a3,
+ a4 = 5,
+};
+#ifndef __cplusplus
+typedef uint64_t A;
+#endif // __cplusplus
+
+enum B
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ b1 = 0,
+ b2 = 2,
+ b3,
+ b4 = 5,
+};
+#ifndef __cplusplus
+typedef uint32_t B;
+#endif // __cplusplus
+
+enum C
+#ifdef __cplusplus
+ : uint16_t
+#endif // __cplusplus
+ {
+ c1 = 0,
+ c2 = 2,
+ c3,
+ c4 = 5,
+};
+#ifndef __cplusplus
+typedef uint16_t C;
+#endif // __cplusplus
+
+enum D
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ d1 = 0,
+ d2 = 2,
+ d3,
+ d4 = 5,
+};
+#ifndef __cplusplus
+typedef uint8_t D;
+#endif // __cplusplus
+
+enum E
+#ifdef __cplusplus
+ : uintptr_t
+#endif // __cplusplus
+ {
+ e1 = 0,
+ e2 = 2,
+ e3,
+ e4 = 5,
+};
+#ifndef __cplusplus
+typedef uintptr_t E;
+#endif // __cplusplus
+
+enum F
+#ifdef __cplusplus
+ : intptr_t
+#endif // __cplusplus
+ {
+ f1 = 0,
+ f2 = 2,
+ f3,
+ f4 = 5,
+};
+#ifndef __cplusplus
+typedef intptr_t F;
+#endif // __cplusplus
+
+typedef enum L {
+ l1,
+ l2,
+ l3,
+ l4,
+} L;
+
+enum M
+#ifdef __cplusplus
+ : int8_t
+#endif // __cplusplus
+ {
+ m1 = -1,
+ m2 = 0,
+ m3 = 1,
+};
+#ifndef __cplusplus
+typedef int8_t M;
+#endif // __cplusplus
+
+typedef enum N {
+ n1,
+ n2,
+ n3,
+ n4,
+} N;
+
+enum O
+#ifdef __cplusplus
+ : int8_t
+#endif // __cplusplus
+ {
+ o1,
+ o2,
+ o3,
+ o4,
+};
+#ifndef __cplusplus
+typedef int8_t O;
+#endif // __cplusplus
+
+typedef struct J J;
+
+typedef struct K K;
+
+typedef struct Opaque Opaque;
+
+enum G_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo,
+ Bar,
+ Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t G_Tag;
+#endif // __cplusplus
+
+typedef struct Bar_Body {
+ G_Tag tag;
+ uint8_t x;
+ int16_t y;
+} Bar_Body;
+
+typedef union G {
+ G_Tag tag;
+ struct {
+ G_Tag foo_tag;
+ int16_t foo;
+ };
+ Bar_Body bar;
+} G;
+
+typedef enum H_Tag {
+ H_Foo,
+ H_Bar,
+ H_Baz,
+} H_Tag;
+
+typedef struct H_Bar_Body {
+ uint8_t x;
+ int16_t y;
+} H_Bar_Body;
+
+typedef struct H {
+ H_Tag tag;
+ union {
+ struct {
+ int16_t foo;
+ };
+ H_Bar_Body bar;
+ };
+} H;
+
+enum ExI_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ ExI_Foo,
+ ExI_Bar,
+ ExI_Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t ExI_Tag;
+#endif // __cplusplus
+
+typedef struct ExI_Bar_Body {
+ uint8_t x;
+ int16_t y;
+} ExI_Bar_Body;
+
+typedef struct ExI {
+ ExI_Tag tag;
+ union {
+ struct {
+ int16_t foo;
+ };
+ ExI_Bar_Body bar;
+ };
+} ExI;
+
+enum P_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ P0,
+ P1,
+};
+#ifndef __cplusplus
+typedef uint8_t P_Tag;
+#endif // __cplusplus
+
+typedef struct P1_Body {
+ uint8_t _0;
+ uint8_t _1;
+ uint8_t _2;
+} P1_Body;
+
+typedef struct P {
+ P_Tag tag;
+ union {
+ struct {
+ uint8_t p0;
+ };
+ P1_Body p1;
+ };
+} P;
+
+typedef enum Q_Tag {
+ Ok,
+ Err,
+} Q_Tag;
+
+typedef struct Q {
+ Q_Tag tag;
+ union {
+ struct {
+ uint32_t *ok;
+ };
+ struct {
+ uint32_t err;
+ };
+ };
+} Q;
+
+typedef enum R_Tag {
+ IRFoo,
+ IRBar,
+ IRBaz,
+} R_Tag;
+
+typedef struct IRBar_Body {
+ uint8_t x;
+ int16_t y;
+} IRBar_Body;
+
+typedef struct R {
+ R_Tag tag;
+ union {
+ struct {
+ int16_t IRFoo;
+ };
+ IRBar_Body IRBar;
+ };
+} R;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Opaque *opaque,
+ A a,
+ B b,
+ C c,
+ D d,
+ E e,
+ F f,
+ union G g,
+ struct H h,
+ struct ExI i,
+ struct J j,
+ struct K k,
+ enum L l,
+ M m,
+ enum N n,
+ O o,
+ struct P p,
+ struct Q q,
+ struct R r);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#if 0
+''' '
+#endif
+
+#include <stddef.h>
+#include "testing-helpers.h"
+static_assert(offsetof(CBINDGEN_STRUCT(P), tag) == 0, "unexpected offset for tag");
+static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p0");
+static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p1");
+static_assert(sizeof(CBINDGEN_STRUCT(P)) == 4, "unexpected size for P");
+
+#if 0
+' '''
+#endif
diff --git a/cbindgen-0.24.5/tests/expectations/enum_discriminant.c b/cbindgen-0.27.0/tests/expectations/enum_discriminant.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/enum_discriminant.c
rename to cbindgen-0.27.0/tests/expectations/enum_discriminant.c
diff --git a/cbindgen-0.27.0/tests/expectations/enum_discriminant.compat.c b/cbindgen-0.27.0/tests/expectations/enum_discriminant.compat.c
new file mode 100644
index 0000000..381ee4b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/enum_discriminant.compat.c
@@ -0,0 +1,33 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define FOURTY_FOUR 4
+
+enum E
+#ifdef __cplusplus
+ : int8_t
+#endif // __cplusplus
+ {
+ A = 1,
+ B = -1,
+ C = (1 + 2),
+ D = FOURTY_FOUR,
+ F = 5,
+ G = (int8_t)54,
+ H = (int8_t)false,
+};
+#ifndef __cplusplus
+typedef int8_t E;
+#endif // __cplusplus
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const E*);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/enum_discriminant.cpp b/cbindgen-0.27.0/tests/expectations/enum_discriminant.cpp
new file mode 100644
index 0000000..68edbf6
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/enum_discriminant.cpp
@@ -0,0 +1,23 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+constexpr static const int8_t FOURTY_FOUR = 4;
+
+enum class E : int8_t {
+ A = 1,
+ B = -1,
+ C = (1 + 2),
+ D = FOURTY_FOUR,
+ F = 5,
+ G = (int8_t)54,
+ H = (int8_t)false,
+};
+
+extern "C" {
+
+void root(const E*);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/enum_discriminant.pyx b/cbindgen-0.27.0/tests/expectations/enum_discriminant.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/enum_discriminant.pyx
rename to cbindgen-0.27.0/tests/expectations/enum_discriminant.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/enum_self.c b/cbindgen-0.27.0/tests/expectations/enum_self.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/enum_self.c
rename to cbindgen-0.27.0/tests/expectations/enum_self.c
diff --git a/cbindgen-0.27.0/tests/expectations/enum_self.compat.c b/cbindgen-0.27.0/tests/expectations/enum_self.compat.c
new file mode 100644
index 0000000..0b5472d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/enum_self.compat.c
@@ -0,0 +1,43 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ const int32_t *something;
+} Foo_Bar;
+
+enum Bar_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Min,
+ Max,
+ Other,
+};
+#ifndef __cplusplus
+typedef uint8_t Bar_Tag;
+#endif // __cplusplus
+
+typedef union {
+ Bar_Tag tag;
+ struct {
+ Bar_Tag min_tag;
+ Foo_Bar min;
+ };
+ struct {
+ Bar_Tag max_tag;
+ Foo_Bar max;
+ };
+} Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Bar b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/enum_self.cpp b/cbindgen-0.27.0/tests/expectations/enum_self.cpp
new file mode 100644
index 0000000..37be086
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/enum_self.cpp
@@ -0,0 +1,40 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T>
+struct Foo {
+ const int32_t *something;
+};
+
+union Bar {
+ enum class Tag : uint8_t {
+ Min,
+ Max,
+ Other,
+ };
+
+ struct Min_Body {
+ Tag tag;
+ Foo<Bar> _0;
+ };
+
+ struct Max_Body {
+ Tag tag;
+ Foo<Bar> _0;
+ };
+
+ struct {
+ Tag tag;
+ };
+ Min_Body min;
+ Max_Body max;
+};
+
+extern "C" {
+
+void root(Bar b);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/enum_self.pyx b/cbindgen-0.27.0/tests/expectations/enum_self.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/enum_self.pyx
rename to cbindgen-0.27.0/tests/expectations/enum_self.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/enum_self.both.c b/cbindgen-0.27.0/tests/expectations/enum_self_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/enum_self.both.c
rename to cbindgen-0.27.0/tests/expectations/enum_self_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/enum_self_both.compat.c b/cbindgen-0.27.0/tests/expectations/enum_self_both.compat.c
new file mode 100644
index 0000000..34d08e2
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/enum_self_both.compat.c
@@ -0,0 +1,43 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo_Bar {
+ const int32_t *something;
+} Foo_Bar;
+
+enum Bar_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Min,
+ Max,
+ Other,
+};
+#ifndef __cplusplus
+typedef uint8_t Bar_Tag;
+#endif // __cplusplus
+
+typedef union Bar {
+ Bar_Tag tag;
+ struct {
+ Bar_Tag min_tag;
+ struct Foo_Bar min;
+ };
+ struct {
+ Bar_Tag max_tag;
+ struct Foo_Bar max;
+ };
+} Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(union Bar b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/enum_self.tag.c b/cbindgen-0.27.0/tests/expectations/enum_self_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/enum_self.tag.c
rename to cbindgen-0.27.0/tests/expectations/enum_self_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/enum_self_tag.compat.c b/cbindgen-0.27.0/tests/expectations/enum_self_tag.compat.c
new file mode 100644
index 0000000..77f5a38
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/enum_self_tag.compat.c
@@ -0,0 +1,43 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo_Bar {
+ const int32_t *something;
+};
+
+enum Bar_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Min,
+ Max,
+ Other,
+};
+#ifndef __cplusplus
+typedef uint8_t Bar_Tag;
+#endif // __cplusplus
+
+union Bar {
+ Bar_Tag tag;
+ struct {
+ Bar_Tag min_tag;
+ struct Foo_Bar min;
+ };
+ struct {
+ Bar_Tag max_tag;
+ struct Foo_Bar max;
+ };
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(union Bar b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/enum_self.tag.pyx b/cbindgen-0.27.0/tests/expectations/enum_self_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/enum_self.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/enum_self_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/enum.tag.c b/cbindgen-0.27.0/tests/expectations/enum_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/enum.tag.c
rename to cbindgen-0.27.0/tests/expectations/enum_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/enum_tag.compat.c b/cbindgen-0.27.0/tests/expectations/enum_tag.compat.c
new file mode 100644
index 0000000..9662a65
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/enum_tag.compat.c
@@ -0,0 +1,335 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using Box = T*;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum A
+#ifdef __cplusplus
+ : uint64_t
+#endif // __cplusplus
+ {
+ a1 = 0,
+ a2 = 2,
+ a3,
+ a4 = 5,
+};
+#ifndef __cplusplus
+typedef uint64_t A;
+#endif // __cplusplus
+
+enum B
+#ifdef __cplusplus
+ : uint32_t
+#endif // __cplusplus
+ {
+ b1 = 0,
+ b2 = 2,
+ b3,
+ b4 = 5,
+};
+#ifndef __cplusplus
+typedef uint32_t B;
+#endif // __cplusplus
+
+enum C
+#ifdef __cplusplus
+ : uint16_t
+#endif // __cplusplus
+ {
+ c1 = 0,
+ c2 = 2,
+ c3,
+ c4 = 5,
+};
+#ifndef __cplusplus
+typedef uint16_t C;
+#endif // __cplusplus
+
+enum D
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ d1 = 0,
+ d2 = 2,
+ d3,
+ d4 = 5,
+};
+#ifndef __cplusplus
+typedef uint8_t D;
+#endif // __cplusplus
+
+enum E
+#ifdef __cplusplus
+ : uintptr_t
+#endif // __cplusplus
+ {
+ e1 = 0,
+ e2 = 2,
+ e3,
+ e4 = 5,
+};
+#ifndef __cplusplus
+typedef uintptr_t E;
+#endif // __cplusplus
+
+enum F
+#ifdef __cplusplus
+ : intptr_t
+#endif // __cplusplus
+ {
+ f1 = 0,
+ f2 = 2,
+ f3,
+ f4 = 5,
+};
+#ifndef __cplusplus
+typedef intptr_t F;
+#endif // __cplusplus
+
+enum L {
+ l1,
+ l2,
+ l3,
+ l4,
+};
+
+enum M
+#ifdef __cplusplus
+ : int8_t
+#endif // __cplusplus
+ {
+ m1 = -1,
+ m2 = 0,
+ m3 = 1,
+};
+#ifndef __cplusplus
+typedef int8_t M;
+#endif // __cplusplus
+
+enum N {
+ n1,
+ n2,
+ n3,
+ n4,
+};
+
+enum O
+#ifdef __cplusplus
+ : int8_t
+#endif // __cplusplus
+ {
+ o1,
+ o2,
+ o3,
+ o4,
+};
+#ifndef __cplusplus
+typedef int8_t O;
+#endif // __cplusplus
+
+struct J;
+
+struct K;
+
+struct Opaque;
+
+enum G_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo,
+ Bar,
+ Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t G_Tag;
+#endif // __cplusplus
+
+struct Bar_Body {
+ G_Tag tag;
+ uint8_t x;
+ int16_t y;
+};
+
+union G {
+ G_Tag tag;
+ struct {
+ G_Tag foo_tag;
+ int16_t foo;
+ };
+ struct Bar_Body bar;
+};
+
+enum H_Tag {
+ H_Foo,
+ H_Bar,
+ H_Baz,
+};
+
+struct H_Bar_Body {
+ uint8_t x;
+ int16_t y;
+};
+
+struct H {
+ enum H_Tag tag;
+ union {
+ struct {
+ int16_t foo;
+ };
+ struct H_Bar_Body bar;
+ };
+};
+
+enum ExI_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ ExI_Foo,
+ ExI_Bar,
+ ExI_Baz,
+};
+#ifndef __cplusplus
+typedef uint8_t ExI_Tag;
+#endif // __cplusplus
+
+struct ExI_Bar_Body {
+ uint8_t x;
+ int16_t y;
+};
+
+struct ExI {
+ ExI_Tag tag;
+ union {
+ struct {
+ int16_t foo;
+ };
+ struct ExI_Bar_Body bar;
+ };
+};
+
+enum P_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ P0,
+ P1,
+};
+#ifndef __cplusplus
+typedef uint8_t P_Tag;
+#endif // __cplusplus
+
+struct P1_Body {
+ uint8_t _0;
+ uint8_t _1;
+ uint8_t _2;
+};
+
+struct P {
+ P_Tag tag;
+ union {
+ struct {
+ uint8_t p0;
+ };
+ struct P1_Body p1;
+ };
+};
+
+enum Q_Tag {
+ Ok,
+ Err,
+};
+
+struct Q {
+ enum Q_Tag tag;
+ union {
+ struct {
+ uint32_t *ok;
+ };
+ struct {
+ uint32_t err;
+ };
+ };
+};
+
+enum R_Tag {
+ IRFoo,
+ IRBar,
+ IRBaz,
+};
+
+struct IRBar_Body {
+ uint8_t x;
+ int16_t y;
+};
+
+struct R {
+ enum R_Tag tag;
+ union {
+ struct {
+ int16_t IRFoo;
+ };
+ struct IRBar_Body IRBar;
+ };
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Opaque *opaque,
+ A a,
+ B b,
+ C c,
+ D d,
+ E e,
+ F f,
+ union G g,
+ struct H h,
+ struct ExI i,
+ struct J j,
+ struct K k,
+ enum L l,
+ M m,
+ enum N n,
+ O o,
+ struct P p,
+ struct Q q,
+ struct R r);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#if 0
+''' '
+#endif
+
+#include <stddef.h>
+#include "testing-helpers.h"
+static_assert(offsetof(CBINDGEN_STRUCT(P), tag) == 0, "unexpected offset for tag");
+static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p0");
+static_assert(offsetof(CBINDGEN_STRUCT(P), p0) == 1, "unexpected offset for p1");
+static_assert(sizeof(CBINDGEN_STRUCT(P)) == 4, "unexpected size for P");
+
+#if 0
+' '''
+#endif
diff --git a/cbindgen-0.24.5/tests/expectations/enum.tag.pyx b/cbindgen-0.27.0/tests/expectations/enum_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/enum.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/enum_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/euclid.c b/cbindgen-0.27.0/tests/expectations/euclid.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/euclid.c
rename to cbindgen-0.27.0/tests/expectations/euclid.c
diff --git a/cbindgen-0.27.0/tests/expectations/euclid.compat.c b/cbindgen-0.27.0/tests/expectations/euclid.compat.c
new file mode 100644
index 0000000..9dc764c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/euclid.compat.c
@@ -0,0 +1,125 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ float _0;
+} TypedLength_f32__UnknownUnit;
+
+typedef struct {
+ float _0;
+} TypedLength_f32__LayoutUnit;
+
+typedef TypedLength_f32__UnknownUnit Length_f32;
+
+typedef TypedLength_f32__LayoutUnit LayoutLength;
+
+typedef struct {
+ float top;
+ float right;
+ float bottom;
+ float left;
+} TypedSideOffsets2D_f32__UnknownUnit;
+
+typedef struct {
+ float top;
+ float right;
+ float bottom;
+ float left;
+} TypedSideOffsets2D_f32__LayoutUnit;
+
+typedef TypedSideOffsets2D_f32__UnknownUnit SideOffsets2D_f32;
+
+typedef TypedSideOffsets2D_f32__LayoutUnit LayoutSideOffsets2D;
+
+typedef struct {
+ float width;
+ float height;
+} TypedSize2D_f32__UnknownUnit;
+
+typedef struct {
+ float width;
+ float height;
+} TypedSize2D_f32__LayoutUnit;
+
+typedef TypedSize2D_f32__UnknownUnit Size2D_f32;
+
+typedef TypedSize2D_f32__LayoutUnit LayoutSize2D;
+
+typedef struct {
+ float x;
+ float y;
+} TypedPoint2D_f32__UnknownUnit;
+
+typedef struct {
+ float x;
+ float y;
+} TypedPoint2D_f32__LayoutUnit;
+
+typedef TypedPoint2D_f32__UnknownUnit Point2D_f32;
+
+typedef TypedPoint2D_f32__LayoutUnit LayoutPoint2D;
+
+typedef struct {
+ TypedPoint2D_f32__UnknownUnit origin;
+ TypedSize2D_f32__UnknownUnit size;
+} TypedRect_f32__UnknownUnit;
+
+typedef struct {
+ TypedPoint2D_f32__LayoutUnit origin;
+ TypedSize2D_f32__LayoutUnit size;
+} TypedRect_f32__LayoutUnit;
+
+typedef TypedRect_f32__UnknownUnit Rect_f32;
+
+typedef TypedRect_f32__LayoutUnit LayoutRect;
+
+typedef struct {
+ float m11;
+ float m12;
+ float m21;
+ float m22;
+ float m31;
+ float m32;
+} TypedTransform2D_f32__UnknownUnit__LayoutUnit;
+
+typedef struct {
+ float m11;
+ float m12;
+ float m21;
+ float m22;
+ float m31;
+ float m32;
+} TypedTransform2D_f32__LayoutUnit__UnknownUnit;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(TypedLength_f32__UnknownUnit length_a,
+ TypedLength_f32__LayoutUnit length_b,
+ Length_f32 length_c,
+ LayoutLength length_d,
+ TypedSideOffsets2D_f32__UnknownUnit side_offsets_a,
+ TypedSideOffsets2D_f32__LayoutUnit side_offsets_b,
+ SideOffsets2D_f32 side_offsets_c,
+ LayoutSideOffsets2D side_offsets_d,
+ TypedSize2D_f32__UnknownUnit size_a,
+ TypedSize2D_f32__LayoutUnit size_b,
+ Size2D_f32 size_c,
+ LayoutSize2D size_d,
+ TypedPoint2D_f32__UnknownUnit point_a,
+ TypedPoint2D_f32__LayoutUnit point_b,
+ Point2D_f32 point_c,
+ LayoutPoint2D point_d,
+ TypedRect_f32__UnknownUnit rect_a,
+ TypedRect_f32__LayoutUnit rect_b,
+ Rect_f32 rect_c,
+ LayoutRect rect_d,
+ TypedTransform2D_f32__UnknownUnit__LayoutUnit transform_a,
+ TypedTransform2D_f32__LayoutUnit__UnknownUnit transform_b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/euclid.cpp b/cbindgen-0.27.0/tests/expectations/euclid.cpp
new file mode 100644
index 0000000..25f71a1
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/euclid.cpp
@@ -0,0 +1,102 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct LayoutUnit;
+
+struct UnknownUnit;
+
+template<typename T, typename Unit>
+struct TypedLength {
+ T _0;
+};
+
+template<typename T>
+using Length = TypedLength<T, UnknownUnit>;
+
+using LayoutLength = TypedLength<float, LayoutUnit>;
+
+template<typename T, typename U>
+struct TypedSideOffsets2D {
+ T top;
+ T right;
+ T bottom;
+ T left;
+};
+
+template<typename T>
+using SideOffsets2D = TypedSideOffsets2D<T, UnknownUnit>;
+
+using LayoutSideOffsets2D = TypedSideOffsets2D<float, LayoutUnit>;
+
+template<typename T, typename U>
+struct TypedSize2D {
+ T width;
+ T height;
+};
+
+template<typename T>
+using Size2D = TypedSize2D<T, UnknownUnit>;
+
+using LayoutSize2D = TypedSize2D<float, LayoutUnit>;
+
+template<typename T, typename U>
+struct TypedPoint2D {
+ T x;
+ T y;
+};
+
+template<typename T>
+using Point2D = TypedPoint2D<T, UnknownUnit>;
+
+using LayoutPoint2D = TypedPoint2D<float, LayoutUnit>;
+
+template<typename T, typename U>
+struct TypedRect {
+ TypedPoint2D<T, U> origin;
+ TypedSize2D<T, U> size;
+};
+
+template<typename T>
+using Rect = TypedRect<T, UnknownUnit>;
+
+using LayoutRect = TypedRect<float, LayoutUnit>;
+
+template<typename T, typename Src, typename Dst>
+struct TypedTransform2D {
+ T m11;
+ T m12;
+ T m21;
+ T m22;
+ T m31;
+ T m32;
+};
+
+extern "C" {
+
+void root(TypedLength<float, UnknownUnit> length_a,
+ TypedLength<float, LayoutUnit> length_b,
+ Length<float> length_c,
+ LayoutLength length_d,
+ TypedSideOffsets2D<float, UnknownUnit> side_offsets_a,
+ TypedSideOffsets2D<float, LayoutUnit> side_offsets_b,
+ SideOffsets2D<float> side_offsets_c,
+ LayoutSideOffsets2D side_offsets_d,
+ TypedSize2D<float, UnknownUnit> size_a,
+ TypedSize2D<float, LayoutUnit> size_b,
+ Size2D<float> size_c,
+ LayoutSize2D size_d,
+ TypedPoint2D<float, UnknownUnit> point_a,
+ TypedPoint2D<float, LayoutUnit> point_b,
+ Point2D<float> point_c,
+ LayoutPoint2D point_d,
+ TypedRect<float, UnknownUnit> rect_a,
+ TypedRect<float, LayoutUnit> rect_b,
+ Rect<float> rect_c,
+ LayoutRect rect_d,
+ TypedTransform2D<float, UnknownUnit, LayoutUnit> transform_a,
+ TypedTransform2D<float, LayoutUnit, UnknownUnit> transform_b);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/euclid.pyx b/cbindgen-0.27.0/tests/expectations/euclid.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/euclid.pyx
rename to cbindgen-0.27.0/tests/expectations/euclid.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/euclid.both.c b/cbindgen-0.27.0/tests/expectations/euclid_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/euclid.both.c
rename to cbindgen-0.27.0/tests/expectations/euclid_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/euclid_both.compat.c b/cbindgen-0.27.0/tests/expectations/euclid_both.compat.c
new file mode 100644
index 0000000..239efdc
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/euclid_both.compat.c
@@ -0,0 +1,125 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct TypedLength_f32__UnknownUnit {
+ float _0;
+} TypedLength_f32__UnknownUnit;
+
+typedef struct TypedLength_f32__LayoutUnit {
+ float _0;
+} TypedLength_f32__LayoutUnit;
+
+typedef struct TypedLength_f32__UnknownUnit Length_f32;
+
+typedef struct TypedLength_f32__LayoutUnit LayoutLength;
+
+typedef struct TypedSideOffsets2D_f32__UnknownUnit {
+ float top;
+ float right;
+ float bottom;
+ float left;
+} TypedSideOffsets2D_f32__UnknownUnit;
+
+typedef struct TypedSideOffsets2D_f32__LayoutUnit {
+ float top;
+ float right;
+ float bottom;
+ float left;
+} TypedSideOffsets2D_f32__LayoutUnit;
+
+typedef struct TypedSideOffsets2D_f32__UnknownUnit SideOffsets2D_f32;
+
+typedef struct TypedSideOffsets2D_f32__LayoutUnit LayoutSideOffsets2D;
+
+typedef struct TypedSize2D_f32__UnknownUnit {
+ float width;
+ float height;
+} TypedSize2D_f32__UnknownUnit;
+
+typedef struct TypedSize2D_f32__LayoutUnit {
+ float width;
+ float height;
+} TypedSize2D_f32__LayoutUnit;
+
+typedef struct TypedSize2D_f32__UnknownUnit Size2D_f32;
+
+typedef struct TypedSize2D_f32__LayoutUnit LayoutSize2D;
+
+typedef struct TypedPoint2D_f32__UnknownUnit {
+ float x;
+ float y;
+} TypedPoint2D_f32__UnknownUnit;
+
+typedef struct TypedPoint2D_f32__LayoutUnit {
+ float x;
+ float y;
+} TypedPoint2D_f32__LayoutUnit;
+
+typedef struct TypedPoint2D_f32__UnknownUnit Point2D_f32;
+
+typedef struct TypedPoint2D_f32__LayoutUnit LayoutPoint2D;
+
+typedef struct TypedRect_f32__UnknownUnit {
+ struct TypedPoint2D_f32__UnknownUnit origin;
+ struct TypedSize2D_f32__UnknownUnit size;
+} TypedRect_f32__UnknownUnit;
+
+typedef struct TypedRect_f32__LayoutUnit {
+ struct TypedPoint2D_f32__LayoutUnit origin;
+ struct TypedSize2D_f32__LayoutUnit size;
+} TypedRect_f32__LayoutUnit;
+
+typedef struct TypedRect_f32__UnknownUnit Rect_f32;
+
+typedef struct TypedRect_f32__LayoutUnit LayoutRect;
+
+typedef struct TypedTransform2D_f32__UnknownUnit__LayoutUnit {
+ float m11;
+ float m12;
+ float m21;
+ float m22;
+ float m31;
+ float m32;
+} TypedTransform2D_f32__UnknownUnit__LayoutUnit;
+
+typedef struct TypedTransform2D_f32__LayoutUnit__UnknownUnit {
+ float m11;
+ float m12;
+ float m21;
+ float m22;
+ float m31;
+ float m32;
+} TypedTransform2D_f32__LayoutUnit__UnknownUnit;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct TypedLength_f32__UnknownUnit length_a,
+ struct TypedLength_f32__LayoutUnit length_b,
+ Length_f32 length_c,
+ LayoutLength length_d,
+ struct TypedSideOffsets2D_f32__UnknownUnit side_offsets_a,
+ struct TypedSideOffsets2D_f32__LayoutUnit side_offsets_b,
+ SideOffsets2D_f32 side_offsets_c,
+ LayoutSideOffsets2D side_offsets_d,
+ struct TypedSize2D_f32__UnknownUnit size_a,
+ struct TypedSize2D_f32__LayoutUnit size_b,
+ Size2D_f32 size_c,
+ LayoutSize2D size_d,
+ struct TypedPoint2D_f32__UnknownUnit point_a,
+ struct TypedPoint2D_f32__LayoutUnit point_b,
+ Point2D_f32 point_c,
+ LayoutPoint2D point_d,
+ struct TypedRect_f32__UnknownUnit rect_a,
+ struct TypedRect_f32__LayoutUnit rect_b,
+ Rect_f32 rect_c,
+ LayoutRect rect_d,
+ struct TypedTransform2D_f32__UnknownUnit__LayoutUnit transform_a,
+ struct TypedTransform2D_f32__LayoutUnit__UnknownUnit transform_b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/euclid.tag.c b/cbindgen-0.27.0/tests/expectations/euclid_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/euclid.tag.c
rename to cbindgen-0.27.0/tests/expectations/euclid_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/euclid_tag.compat.c b/cbindgen-0.27.0/tests/expectations/euclid_tag.compat.c
new file mode 100644
index 0000000..f4238da
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/euclid_tag.compat.c
@@ -0,0 +1,125 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct TypedLength_f32__UnknownUnit {
+ float _0;
+};
+
+struct TypedLength_f32__LayoutUnit {
+ float _0;
+};
+
+typedef struct TypedLength_f32__UnknownUnit Length_f32;
+
+typedef struct TypedLength_f32__LayoutUnit LayoutLength;
+
+struct TypedSideOffsets2D_f32__UnknownUnit {
+ float top;
+ float right;
+ float bottom;
+ float left;
+};
+
+struct TypedSideOffsets2D_f32__LayoutUnit {
+ float top;
+ float right;
+ float bottom;
+ float left;
+};
+
+typedef struct TypedSideOffsets2D_f32__UnknownUnit SideOffsets2D_f32;
+
+typedef struct TypedSideOffsets2D_f32__LayoutUnit LayoutSideOffsets2D;
+
+struct TypedSize2D_f32__UnknownUnit {
+ float width;
+ float height;
+};
+
+struct TypedSize2D_f32__LayoutUnit {
+ float width;
+ float height;
+};
+
+typedef struct TypedSize2D_f32__UnknownUnit Size2D_f32;
+
+typedef struct TypedSize2D_f32__LayoutUnit LayoutSize2D;
+
+struct TypedPoint2D_f32__UnknownUnit {
+ float x;
+ float y;
+};
+
+struct TypedPoint2D_f32__LayoutUnit {
+ float x;
+ float y;
+};
+
+typedef struct TypedPoint2D_f32__UnknownUnit Point2D_f32;
+
+typedef struct TypedPoint2D_f32__LayoutUnit LayoutPoint2D;
+
+struct TypedRect_f32__UnknownUnit {
+ struct TypedPoint2D_f32__UnknownUnit origin;
+ struct TypedSize2D_f32__UnknownUnit size;
+};
+
+struct TypedRect_f32__LayoutUnit {
+ struct TypedPoint2D_f32__LayoutUnit origin;
+ struct TypedSize2D_f32__LayoutUnit size;
+};
+
+typedef struct TypedRect_f32__UnknownUnit Rect_f32;
+
+typedef struct TypedRect_f32__LayoutUnit LayoutRect;
+
+struct TypedTransform2D_f32__UnknownUnit__LayoutUnit {
+ float m11;
+ float m12;
+ float m21;
+ float m22;
+ float m31;
+ float m32;
+};
+
+struct TypedTransform2D_f32__LayoutUnit__UnknownUnit {
+ float m11;
+ float m12;
+ float m21;
+ float m22;
+ float m31;
+ float m32;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct TypedLength_f32__UnknownUnit length_a,
+ struct TypedLength_f32__LayoutUnit length_b,
+ Length_f32 length_c,
+ LayoutLength length_d,
+ struct TypedSideOffsets2D_f32__UnknownUnit side_offsets_a,
+ struct TypedSideOffsets2D_f32__LayoutUnit side_offsets_b,
+ SideOffsets2D_f32 side_offsets_c,
+ LayoutSideOffsets2D side_offsets_d,
+ struct TypedSize2D_f32__UnknownUnit size_a,
+ struct TypedSize2D_f32__LayoutUnit size_b,
+ Size2D_f32 size_c,
+ LayoutSize2D size_d,
+ struct TypedPoint2D_f32__UnknownUnit point_a,
+ struct TypedPoint2D_f32__LayoutUnit point_b,
+ Point2D_f32 point_c,
+ LayoutPoint2D point_d,
+ struct TypedRect_f32__UnknownUnit rect_a,
+ struct TypedRect_f32__LayoutUnit rect_b,
+ Rect_f32 rect_c,
+ LayoutRect rect_d,
+ struct TypedTransform2D_f32__UnknownUnit__LayoutUnit transform_a,
+ struct TypedTransform2D_f32__LayoutUnit__UnknownUnit transform_b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/euclid.tag.pyx b/cbindgen-0.27.0/tests/expectations/euclid_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/euclid.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/euclid_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.c b/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.c
rename to cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph.c
diff --git a/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph.compat.c b/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph.compat.c
new file mode 100644
index 0000000..a026322
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph.compat.c
@@ -0,0 +1,36 @@
+#include <stdint.h>
+
+#if 0
+''' '
+#endif
+
+typedef uint64_t Option_Foo;
+
+#if 0
+' '''
+#endif
+
+#if 0
+from libc.stdint cimport uint64_t
+ctypedef uint64_t Option_Foo
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ Option_Foo foo;
+} Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Bar f);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.cpp b/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.cpp
rename to cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.pyx b/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.pyx
rename to cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.both.c b/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.both.c
rename to cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph_both.compat.c b/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph_both.compat.c
new file mode 100644
index 0000000..2447ac4
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph_both.compat.c
@@ -0,0 +1,36 @@
+#include <stdint.h>
+
+#if 0
+''' '
+#endif
+
+typedef uint64_t Option_Foo;
+
+#if 0
+' '''
+#endif
+
+#if 0
+from libc.stdint cimport uint64_t
+ctypedef uint64_t Option_Foo
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Bar {
+ Option_Foo foo;
+} Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Bar f);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.tag.c b/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.tag.c
rename to cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph_tag.compat.c b/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph_tag.compat.c
new file mode 100644
index 0000000..73d9650
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph_tag.compat.c
@@ -0,0 +1,36 @@
+#include <stdint.h>
+
+#if 0
+''' '
+#endif
+
+typedef uint64_t Option_Foo;
+
+#if 0
+' '''
+#endif
+
+#if 0
+from libc.stdint cimport uint64_t
+ctypedef uint64_t Option_Foo
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Bar {
+ Option_Foo foo;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Bar f);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.tag.pyx b/cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/exclude_generic_monomorph.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/exclude_generic_monomorph_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/expand.c b/cbindgen-0.27.0/tests/expectations/expand.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand.c
rename to cbindgen-0.27.0/tests/expectations/expand.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand.compat.c b/cbindgen-0.27.0/tests/expectations/expand.compat.c
new file mode 100644
index 0000000..4251572
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/expand.cpp b/cbindgen-0.27.0/tests/expectations/expand.cpp
new file mode 100644
index 0000000..94cbd71
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand.cpp
@@ -0,0 +1,15 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Foo {
+
+};
+
+extern "C" {
+
+void root(Foo a);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/expand.pyx b/cbindgen-0.27.0/tests/expectations/expand.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand.pyx
rename to cbindgen-0.27.0/tests/expectations/expand.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/expand.both.c b/cbindgen-0.27.0/tests/expectations/expand_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand.both.c
rename to cbindgen-0.27.0/tests/expectations/expand_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_both.compat.c b/cbindgen-0.27.0/tests/expectations/expand_both.compat.c
new file mode 100644
index 0000000..adb1db9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_both.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo {
+
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_default_features.c b/cbindgen-0.27.0/tests/expectations/expand_default_features.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_default_features.c
rename to cbindgen-0.27.0/tests/expectations/expand_default_features.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_default_features.compat.c b/cbindgen-0.27.0/tests/expectations/expand_default_features.compat.c
new file mode 100644
index 0000000..69c3a06
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_default_features.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void extra_debug_fn(void);
+
+void root(Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/expand_default_features.cpp b/cbindgen-0.27.0/tests/expectations/expand_default_features.cpp
new file mode 100644
index 0000000..fd72681
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_default_features.cpp
@@ -0,0 +1,17 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Foo {
+
+};
+
+extern "C" {
+
+void extra_debug_fn();
+
+void root(Foo a);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/expand_default_features.pyx b/cbindgen-0.27.0/tests/expectations/expand_default_features.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_default_features.pyx
rename to cbindgen-0.27.0/tests/expectations/expand_default_features.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/expand_default_features.both.c b/cbindgen-0.27.0/tests/expectations/expand_default_features_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_default_features.both.c
rename to cbindgen-0.27.0/tests/expectations/expand_default_features_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_default_features_both.compat.c b/cbindgen-0.27.0/tests/expectations/expand_default_features_both.compat.c
new file mode 100644
index 0000000..4ef30c0
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_default_features_both.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo {
+
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void extra_debug_fn(void);
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_default_features.tag.c b/cbindgen-0.27.0/tests/expectations/expand_default_features_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_default_features.tag.c
rename to cbindgen-0.27.0/tests/expectations/expand_default_features_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_default_features_tag.compat.c b/cbindgen-0.27.0/tests/expectations/expand_default_features_tag.compat.c
new file mode 100644
index 0000000..5af397f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_default_features_tag.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo {
+
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void extra_debug_fn(void);
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_default_features.tag.pyx b/cbindgen-0.27.0/tests/expectations/expand_default_features_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_default_features.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/expand_default_features_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep.c b/cbindgen-0.27.0/tests/expectations/expand_dep.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_dep.c
rename to cbindgen-0.27.0/tests/expectations/expand_dep.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_dep.compat.c b/cbindgen-0.27.0/tests/expectations/expand_dep.compat.c
new file mode 100644
index 0000000..52d47f8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_dep.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ uint32_t x;
+ double y;
+} dep_struct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+uint32_t get_x(const dep_struct *dep_struct);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/expand_dep.cpp b/cbindgen-0.27.0/tests/expectations/expand_dep.cpp
new file mode 100644
index 0000000..1190c29
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_dep.cpp
@@ -0,0 +1,16 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct dep_struct {
+ uint32_t x;
+ double y;
+};
+
+extern "C" {
+
+uint32_t get_x(const dep_struct *dep_struct);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep.pyx b/cbindgen-0.27.0/tests/expectations/expand_dep.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_dep.pyx
rename to cbindgen-0.27.0/tests/expectations/expand_dep.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.both.c b/cbindgen-0.27.0/tests/expectations/expand_dep_both.c
similarity index 100%
copy from cbindgen-0.24.5/tests/expectations/dep_v2.both.c
copy to cbindgen-0.27.0/tests/expectations/expand_dep_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_dep_both.compat.c b/cbindgen-0.27.0/tests/expectations/expand_dep_both.compat.c
new file mode 100644
index 0000000..9b6c2e3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_dep_both.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct dep_struct {
+ uint32_t x;
+ double y;
+} dep_struct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+uint32_t get_x(const struct dep_struct *dep_struct);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.tag.c b/cbindgen-0.27.0/tests/expectations/expand_dep_tag.c
similarity index 100%
copy from cbindgen-0.24.5/tests/expectations/dep_v2.tag.c
copy to cbindgen-0.27.0/tests/expectations/expand_dep_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_dep_tag.compat.c b/cbindgen-0.27.0/tests/expectations/expand_dep_tag.compat.c
new file mode 100644
index 0000000..51aee8f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_dep_tag.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct dep_struct {
+ uint32_t x;
+ double y;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+uint32_t get_x(const struct dep_struct *dep_struct);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.tag.pyx b/cbindgen-0.27.0/tests/expectations/expand_dep_tag.pyx
similarity index 100%
copy from cbindgen-0.24.5/tests/expectations/dep_v2.tag.pyx
copy to cbindgen-0.27.0/tests/expectations/expand_dep_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.c b/cbindgen-0.27.0/tests/expectations/expand_dep_v2.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_dep_v2.c
rename to cbindgen-0.27.0/tests/expectations/expand_dep_v2.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_dep_v2.compat.c b/cbindgen-0.27.0/tests/expectations/expand_dep_v2.compat.c
new file mode 100644
index 0000000..52d47f8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_dep_v2.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ uint32_t x;
+ double y;
+} dep_struct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+uint32_t get_x(const dep_struct *dep_struct);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/expand_dep_v2.cpp b/cbindgen-0.27.0/tests/expectations/expand_dep_v2.cpp
new file mode 100644
index 0000000..1190c29
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_dep_v2.cpp
@@ -0,0 +1,16 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct dep_struct {
+ uint32_t x;
+ double y;
+};
+
+extern "C" {
+
+uint32_t get_x(const dep_struct *dep_struct);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/expand_dep_v2.pyx b/cbindgen-0.27.0/tests/expectations/expand_dep_v2.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_dep_v2.pyx
rename to cbindgen-0.27.0/tests/expectations/expand_dep_v2.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.both.c b/cbindgen-0.27.0/tests/expectations/expand_dep_v2_both.c
similarity index 100%
copy from cbindgen-0.24.5/tests/expectations/dep_v2.both.c
copy to cbindgen-0.27.0/tests/expectations/expand_dep_v2_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_dep_v2_both.compat.c b/cbindgen-0.27.0/tests/expectations/expand_dep_v2_both.compat.c
new file mode 100644
index 0000000..9b6c2e3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_dep_v2_both.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct dep_struct {
+ uint32_t x;
+ double y;
+} dep_struct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+uint32_t get_x(const struct dep_struct *dep_struct);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.tag.c b/cbindgen-0.27.0/tests/expectations/expand_dep_v2_tag.c
similarity index 100%
copy from cbindgen-0.24.5/tests/expectations/dep_v2.tag.c
copy to cbindgen-0.27.0/tests/expectations/expand_dep_v2_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_dep_v2_tag.compat.c b/cbindgen-0.27.0/tests/expectations/expand_dep_v2_tag.compat.c
new file mode 100644
index 0000000..51aee8f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_dep_v2_tag.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct dep_struct {
+ uint32_t x;
+ double y;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+uint32_t get_x(const struct dep_struct *dep_struct);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/dep_v2.tag.pyx b/cbindgen-0.27.0/tests/expectations/expand_dep_v2_tag.pyx
similarity index 100%
copy from cbindgen-0.24.5/tests/expectations/dep_v2.tag.pyx
copy to cbindgen-0.27.0/tests/expectations/expand_dep_v2_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/expand_features.c b/cbindgen-0.27.0/tests/expectations/expand_features.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_features.c
rename to cbindgen-0.27.0/tests/expectations/expand_features.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_features.compat.c b/cbindgen-0.27.0/tests/expectations/expand_features.compat.c
new file mode 100644
index 0000000..4ef3d04
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_features.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void extra_debug_fn(void);
+
+void cbindgen(void);
+
+void root(Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/expand_features.cpp b/cbindgen-0.27.0/tests/expectations/expand_features.cpp
new file mode 100644
index 0000000..2afa941
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_features.cpp
@@ -0,0 +1,19 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Foo {
+
+};
+
+extern "C" {
+
+void extra_debug_fn();
+
+void cbindgen();
+
+void root(Foo a);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/expand_features.pyx b/cbindgen-0.27.0/tests/expectations/expand_features.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_features.pyx
rename to cbindgen-0.27.0/tests/expectations/expand_features.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/expand_features.both.c b/cbindgen-0.27.0/tests/expectations/expand_features_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_features.both.c
rename to cbindgen-0.27.0/tests/expectations/expand_features_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_features_both.compat.c b/cbindgen-0.27.0/tests/expectations/expand_features_both.compat.c
new file mode 100644
index 0000000..2e8ebd0
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_features_both.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo {
+
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void extra_debug_fn(void);
+
+void cbindgen(void);
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_features.tag.c b/cbindgen-0.27.0/tests/expectations/expand_features_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_features.tag.c
rename to cbindgen-0.27.0/tests/expectations/expand_features_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_features_tag.compat.c b/cbindgen-0.27.0/tests/expectations/expand_features_tag.compat.c
new file mode 100644
index 0000000..033f164
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_features_tag.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo {
+
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void extra_debug_fn(void);
+
+void cbindgen(void);
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand_features.tag.pyx b/cbindgen-0.27.0/tests/expectations/expand_features_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_features.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/expand_features_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.c b/cbindgen-0.27.0/tests/expectations/expand_no_default_features.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_no_default_features.c
rename to cbindgen-0.27.0/tests/expectations/expand_no_default_features.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_no_default_features.compat.c b/cbindgen-0.27.0/tests/expectations/expand_no_default_features.compat.c
new file mode 100644
index 0000000..4251572
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_no_default_features.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/expand_no_default_features.cpp b/cbindgen-0.27.0/tests/expectations/expand_no_default_features.cpp
new file mode 100644
index 0000000..94cbd71
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_no_default_features.cpp
@@ -0,0 +1,15 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Foo {
+
+};
+
+extern "C" {
+
+void root(Foo a);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/expand_no_default_features.pyx b/cbindgen-0.27.0/tests/expectations/expand_no_default_features.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand_no_default_features.pyx
rename to cbindgen-0.27.0/tests/expectations/expand_no_default_features.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/expand.both.c b/cbindgen-0.27.0/tests/expectations/expand_no_default_features_both.c
similarity index 100%
copy from cbindgen-0.24.5/tests/expectations/expand.both.c
copy to cbindgen-0.27.0/tests/expectations/expand_no_default_features_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_no_default_features_both.compat.c b/cbindgen-0.27.0/tests/expectations/expand_no_default_features_both.compat.c
new file mode 100644
index 0000000..adb1db9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_no_default_features_both.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo {
+
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand.tag.c b/cbindgen-0.27.0/tests/expectations/expand_no_default_features_tag.c
similarity index 100%
copy from cbindgen-0.24.5/tests/expectations/expand.tag.c
copy to cbindgen-0.27.0/tests/expectations/expand_no_default_features_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_no_default_features_tag.compat.c b/cbindgen-0.27.0/tests/expectations/expand_no_default_features_tag.compat.c
new file mode 100644
index 0000000..2e2265c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_no_default_features_tag.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo {
+
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand.tag.pyx b/cbindgen-0.27.0/tests/expectations/expand_no_default_features_tag.pyx
similarity index 100%
copy from cbindgen-0.24.5/tests/expectations/expand.tag.pyx
copy to cbindgen-0.27.0/tests/expectations/expand_no_default_features_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/expand.tag.c b/cbindgen-0.27.0/tests/expectations/expand_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand.tag.c
rename to cbindgen-0.27.0/tests/expectations/expand_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/expand_tag.compat.c b/cbindgen-0.27.0/tests/expectations/expand_tag.compat.c
new file mode 100644
index 0000000..2e2265c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/expand_tag.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo {
+
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/expand.tag.pyx b/cbindgen-0.27.0/tests/expectations/expand_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/expand.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/expand_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/export_name.c b/cbindgen-0.27.0/tests/expectations/export_name.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/export_name.c
rename to cbindgen-0.27.0/tests/expectations/export_name.c
diff --git a/cbindgen-0.27.0/tests/expectations/export_name.compat.c b/cbindgen-0.27.0/tests/expectations/export_name.compat.c
new file mode 100644
index 0000000..67d6638
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/export_name.compat.c
@@ -0,0 +1,14 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void do_the_thing_with_export_name(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/export_name.cpp b/cbindgen-0.27.0/tests/expectations/export_name.cpp
new file mode 100644
index 0000000..e657310
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/export_name.cpp
@@ -0,0 +1,11 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+void do_the_thing_with_export_name();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/export_name.pyx b/cbindgen-0.27.0/tests/expectations/export_name.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/export_name.pyx
rename to cbindgen-0.27.0/tests/expectations/export_name.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/extern.c b/cbindgen-0.27.0/tests/expectations/extern.c
new file mode 100644
index 0000000..70b2a3b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/extern.c
@@ -0,0 +1,15 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ int32_t x;
+ float y;
+} Normal;
+
+extern int32_t foo(void);
+
+extern void bar(Normal a);
+
+extern int32_t baz(void);
diff --git a/cbindgen-0.27.0/tests/expectations/extern.compat.c b/cbindgen-0.27.0/tests/expectations/extern.compat.c
new file mode 100644
index 0000000..5fd87fa
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/extern.compat.c
@@ -0,0 +1,23 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ int32_t x;
+ float y;
+} Normal;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern int32_t foo(void);
+
+extern void bar(Normal a);
+
+extern int32_t baz(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/extern.cpp b/cbindgen-0.27.0/tests/expectations/extern.cpp
new file mode 100644
index 0000000..90e62d9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/extern.cpp
@@ -0,0 +1,20 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Normal {
+ int32_t x;
+ float y;
+};
+
+extern "C" {
+
+extern int32_t foo();
+
+extern void bar(Normal a);
+
+extern int32_t baz();
+
+} // extern "C"
diff --git a/cbindgen-0.27.0/tests/expectations/extern.pyx b/cbindgen-0.27.0/tests/expectations/extern.pyx
new file mode 100644
index 0000000..51b0583
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/extern.pyx
@@ -0,0 +1,17 @@
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ ctypedef struct Normal:
+ int32_t x;
+ float y;
+
+ extern int32_t foo();
+
+ extern void bar(Normal a);
+
+ extern int32_t baz();
diff --git a/cbindgen-0.24.5/tests/expectations/extern_2.c b/cbindgen-0.27.0/tests/expectations/extern_2.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/extern_2.c
rename to cbindgen-0.27.0/tests/expectations/extern_2.c
diff --git a/cbindgen-0.27.0/tests/expectations/extern_2.compat.c b/cbindgen-0.27.0/tests/expectations/extern_2.compat.c
new file mode 100644
index 0000000..4aa4fbf
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/extern_2.compat.c
@@ -0,0 +1,16 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void first(void);
+
+void second(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/extern_2.cpp b/cbindgen-0.27.0/tests/expectations/extern_2.cpp
new file mode 100644
index 0000000..2b6231b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/extern_2.cpp
@@ -0,0 +1,13 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+void first();
+
+void second();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/extern_2.pyx b/cbindgen-0.27.0/tests/expectations/extern_2.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/extern_2.pyx
rename to cbindgen-0.27.0/tests/expectations/extern_2.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/extern_both.c b/cbindgen-0.27.0/tests/expectations/extern_both.c
new file mode 100644
index 0000000..56aad04
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/extern_both.c
@@ -0,0 +1,15 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Normal {
+ int32_t x;
+ float y;
+} Normal;
+
+extern int32_t foo(void);
+
+extern void bar(struct Normal a);
+
+extern int32_t baz(void);
diff --git a/cbindgen-0.27.0/tests/expectations/extern_both.compat.c b/cbindgen-0.27.0/tests/expectations/extern_both.compat.c
new file mode 100644
index 0000000..954f5ff
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/extern_both.compat.c
@@ -0,0 +1,23 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Normal {
+ int32_t x;
+ float y;
+} Normal;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern int32_t foo(void);
+
+extern void bar(struct Normal a);
+
+extern int32_t baz(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/extern_tag.c b/cbindgen-0.27.0/tests/expectations/extern_tag.c
new file mode 100644
index 0000000..e70c271
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/extern_tag.c
@@ -0,0 +1,15 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Normal {
+ int32_t x;
+ float y;
+};
+
+extern int32_t foo(void);
+
+extern void bar(struct Normal a);
+
+extern int32_t baz(void);
diff --git a/cbindgen-0.27.0/tests/expectations/extern_tag.compat.c b/cbindgen-0.27.0/tests/expectations/extern_tag.compat.c
new file mode 100644
index 0000000..9a1a351
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/extern_tag.compat.c
@@ -0,0 +1,23 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Normal {
+ int32_t x;
+ float y;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern int32_t foo(void);
+
+extern void bar(struct Normal a);
+
+extern int32_t baz(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/extern_tag.pyx b/cbindgen-0.27.0/tests/expectations/extern_tag.pyx
new file mode 100644
index 0000000..f627733
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/extern_tag.pyx
@@ -0,0 +1,17 @@
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ cdef struct Normal:
+ int32_t x;
+ float y;
+
+ extern int32_t foo();
+
+ extern void bar(Normal a);
+
+ extern int32_t baz();
diff --git a/cbindgen-0.24.5/tests/expectations/external_workspace_child.c b/cbindgen-0.27.0/tests/expectations/external_workspace_child.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/external_workspace_child.c
rename to cbindgen-0.27.0/tests/expectations/external_workspace_child.c
diff --git a/cbindgen-0.27.0/tests/expectations/external_workspace_child.compat.c b/cbindgen-0.27.0/tests/expectations/external_workspace_child.compat.c
new file mode 100644
index 0000000..24046af
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/external_workspace_child.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ uint32_t data;
+} ExtType;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void consume_ext(ExtType _ext);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/external_workspace_child.cpp b/cbindgen-0.27.0/tests/expectations/external_workspace_child.cpp
new file mode 100644
index 0000000..aed1607
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/external_workspace_child.cpp
@@ -0,0 +1,15 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct ExtType {
+ uint32_t data;
+};
+
+extern "C" {
+
+void consume_ext(ExtType _ext);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/external_workspace_child.pyx b/cbindgen-0.27.0/tests/expectations/external_workspace_child.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/external_workspace_child.pyx
rename to cbindgen-0.27.0/tests/expectations/external_workspace_child.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/external_workspace_child.both.c b/cbindgen-0.27.0/tests/expectations/external_workspace_child_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/external_workspace_child.both.c
rename to cbindgen-0.27.0/tests/expectations/external_workspace_child_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/external_workspace_child_both.compat.c b/cbindgen-0.27.0/tests/expectations/external_workspace_child_both.compat.c
new file mode 100644
index 0000000..3a31441
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/external_workspace_child_both.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct ExtType {
+ uint32_t data;
+} ExtType;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void consume_ext(struct ExtType _ext);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/external_workspace_child.tag.c b/cbindgen-0.27.0/tests/expectations/external_workspace_child_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/external_workspace_child.tag.c
rename to cbindgen-0.27.0/tests/expectations/external_workspace_child_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/external_workspace_child_tag.compat.c b/cbindgen-0.27.0/tests/expectations/external_workspace_child_tag.compat.c
new file mode 100644
index 0000000..218e12f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/external_workspace_child_tag.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct ExtType {
+ uint32_t data;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void consume_ext(struct ExtType _ext);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/external_workspace_child.tag.pyx b/cbindgen-0.27.0/tests/expectations/external_workspace_child_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/external_workspace_child.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/external_workspace_child_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/fns.c b/cbindgen-0.27.0/tests/expectations/fns.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/fns.c
rename to cbindgen-0.27.0/tests/expectations/fns.c
diff --git a/cbindgen-0.27.0/tests/expectations/fns.compat.c b/cbindgen-0.27.0/tests/expectations/fns.compat.c
new file mode 100644
index 0000000..a5e27b1
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/fns.compat.c
@@ -0,0 +1,24 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ void (*noArgs)(void);
+ void (*anonymousArg)(int32_t);
+ int32_t (*returnsNumber)(void);
+ int8_t (*namedArgs)(int32_t first, int16_t snd);
+ int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
+} Fns;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Fns _fns);
+
+void no_return(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/fns.cpp b/cbindgen-0.27.0/tests/expectations/fns.cpp
new file mode 100644
index 0000000..bde5b37
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/fns.cpp
@@ -0,0 +1,21 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Fns {
+ void (*noArgs)();
+ void (*anonymousArg)(int32_t);
+ int32_t (*returnsNumber)();
+ int8_t (*namedArgs)(int32_t first, int16_t snd);
+ int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
+};
+
+extern "C" {
+
+void root(Fns _fns);
+
+void no_return();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/fns.pyx b/cbindgen-0.27.0/tests/expectations/fns.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/fns.pyx
rename to cbindgen-0.27.0/tests/expectations/fns.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/fns.both.c b/cbindgen-0.27.0/tests/expectations/fns_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/fns.both.c
rename to cbindgen-0.27.0/tests/expectations/fns_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/fns_both.compat.c b/cbindgen-0.27.0/tests/expectations/fns_both.compat.c
new file mode 100644
index 0000000..4089c07
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/fns_both.compat.c
@@ -0,0 +1,24 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Fns {
+ void (*noArgs)(void);
+ void (*anonymousArg)(int32_t);
+ int32_t (*returnsNumber)(void);
+ int8_t (*namedArgs)(int32_t first, int16_t snd);
+ int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
+} Fns;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Fns _fns);
+
+void no_return(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/fns.tag.c b/cbindgen-0.27.0/tests/expectations/fns_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/fns.tag.c
rename to cbindgen-0.27.0/tests/expectations/fns_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/fns_tag.compat.c b/cbindgen-0.27.0/tests/expectations/fns_tag.compat.c
new file mode 100644
index 0000000..cf3aab5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/fns_tag.compat.c
@@ -0,0 +1,24 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Fns {
+ void (*noArgs)(void);
+ void (*anonymousArg)(int32_t);
+ int32_t (*returnsNumber)(void);
+ int8_t (*namedArgs)(int32_t first, int16_t snd);
+ int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Fns _fns);
+
+void no_return(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/fns.tag.pyx b/cbindgen-0.27.0/tests/expectations/fns_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/fns.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/fns_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/forward_declaration.c b/cbindgen-0.27.0/tests/expectations/forward_declaration.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/forward_declaration.c
rename to cbindgen-0.27.0/tests/expectations/forward_declaration.c
diff --git a/cbindgen-0.27.0/tests/expectations/forward_declaration.compat.c b/cbindgen-0.27.0/tests/expectations/forward_declaration.compat.c
new file mode 100644
index 0000000..375fc8d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/forward_declaration.compat.c
@@ -0,0 +1,58 @@
+#if 0
+''' '
+#endif
+#if defined(CBINDGEN_STYLE_TYPE)
+/* ANONYMOUS STRUCTS DO NOT SUPPORT FORWARD DECLARATIONS!
+#endif
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ const TypeInfo *const *fields;
+ uintptr_t num_fields;
+} StructInfo;
+
+typedef enum {
+ Primitive,
+ Struct,
+} TypeData_Tag;
+
+typedef struct {
+ TypeData_Tag tag;
+ union {
+ struct {
+ StructInfo struct_;
+ };
+ };
+} TypeData;
+
+typedef struct {
+ TypeData data;
+} TypeInfo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(TypeInfo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#if 0
+''' '
+#endif
+#if defined(CBINDGEN_STYLE_TYPE)
+*/
+#endif
+#if 0
+' '''
+#endif
diff --git a/cbindgen-0.27.0/tests/expectations/forward_declaration.cpp b/cbindgen-0.27.0/tests/expectations/forward_declaration.cpp
new file mode 100644
index 0000000..766b799
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/forward_declaration.cpp
@@ -0,0 +1,57 @@
+#if 0
+''' '
+#endif
+#if defined(CBINDGEN_STYLE_TYPE)
+/* ANONYMOUS STRUCTS DO NOT SUPPORT FORWARD DECLARATIONS!
+#endif
+#if 0
+' '''
+#endif
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct StructInfo {
+ const TypeInfo *const *fields;
+ uintptr_t num_fields;
+};
+
+struct TypeData {
+ enum class Tag {
+ Primitive,
+ Struct,
+ };
+
+ struct Struct_Body {
+ StructInfo _0;
+ };
+
+ Tag tag;
+ union {
+ Struct_Body struct_;
+ };
+};
+
+struct TypeInfo {
+ TypeData data;
+};
+
+extern "C" {
+
+void root(TypeInfo x);
+
+} // extern "C"
+
+#if 0
+''' '
+#endif
+#if defined(CBINDGEN_STYLE_TYPE)
+*/
+#endif
+#if 0
+' '''
+#endif
diff --git a/cbindgen-0.24.5/tests/expectations/forward_declaration.pyx b/cbindgen-0.27.0/tests/expectations/forward_declaration.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/forward_declaration.pyx
rename to cbindgen-0.27.0/tests/expectations/forward_declaration.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/forward_declaration.both.c b/cbindgen-0.27.0/tests/expectations/forward_declaration_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/forward_declaration.both.c
rename to cbindgen-0.27.0/tests/expectations/forward_declaration_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/forward_declaration_both.compat.c b/cbindgen-0.27.0/tests/expectations/forward_declaration_both.compat.c
new file mode 100644
index 0000000..031e40c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/forward_declaration_both.compat.c
@@ -0,0 +1,58 @@
+#if 0
+''' '
+#endif
+#if defined(CBINDGEN_STYLE_TYPE)
+/* ANONYMOUS STRUCTS DO NOT SUPPORT FORWARD DECLARATIONS!
+#endif
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct StructInfo {
+ const struct TypeInfo *const *fields;
+ uintptr_t num_fields;
+} StructInfo;
+
+typedef enum TypeData_Tag {
+ Primitive,
+ Struct,
+} TypeData_Tag;
+
+typedef struct TypeData {
+ TypeData_Tag tag;
+ union {
+ struct {
+ struct StructInfo struct_;
+ };
+ };
+} TypeData;
+
+typedef struct TypeInfo {
+ struct TypeData data;
+} TypeInfo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct TypeInfo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#if 0
+''' '
+#endif
+#if defined(CBINDGEN_STYLE_TYPE)
+*/
+#endif
+#if 0
+' '''
+#endif
diff --git a/cbindgen-0.24.5/tests/expectations/forward_declaration.tag.c b/cbindgen-0.27.0/tests/expectations/forward_declaration_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/forward_declaration.tag.c
rename to cbindgen-0.27.0/tests/expectations/forward_declaration_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/forward_declaration_tag.compat.c b/cbindgen-0.27.0/tests/expectations/forward_declaration_tag.compat.c
new file mode 100644
index 0000000..1a61c5e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/forward_declaration_tag.compat.c
@@ -0,0 +1,58 @@
+#if 0
+''' '
+#endif
+#if defined(CBINDGEN_STYLE_TYPE)
+/* ANONYMOUS STRUCTS DO NOT SUPPORT FORWARD DECLARATIONS!
+#endif
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct StructInfo {
+ const struct TypeInfo *const *fields;
+ uintptr_t num_fields;
+};
+
+enum TypeData_Tag {
+ Primitive,
+ Struct,
+};
+
+struct TypeData {
+ enum TypeData_Tag tag;
+ union {
+ struct {
+ struct StructInfo struct_;
+ };
+ };
+};
+
+struct TypeInfo {
+ struct TypeData data;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct TypeInfo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#if 0
+''' '
+#endif
+#if defined(CBINDGEN_STYLE_TYPE)
+*/
+#endif
+#if 0
+' '''
+#endif
diff --git a/cbindgen-0.24.5/tests/expectations/forward_declaration.tag.pyx b/cbindgen-0.27.0/tests/expectations/forward_declaration_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/forward_declaration.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/forward_declaration_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/function_args.c b/cbindgen-0.27.0/tests/expectations/function_args.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/function_args.c
rename to cbindgen-0.27.0/tests/expectations/function_args.c
diff --git a/cbindgen-0.27.0/tests/expectations/function_args.compat.c b/cbindgen-0.27.0/tests/expectations/function_args.compat.c
new file mode 100644
index 0000000..cf79a63
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/function_args.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void unnamed(const uint64_t*);
+
+void pointer_test(const uint64_t *a);
+
+void print_from_rust(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/function_args.cpp b/cbindgen-0.27.0/tests/expectations/function_args.cpp
new file mode 100644
index 0000000..91eefff
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/function_args.cpp
@@ -0,0 +1,15 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+void unnamed(const uint64_t*);
+
+void pointer_test(const uint64_t *a);
+
+void print_from_rust();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/function_args.pyx b/cbindgen-0.27.0/tests/expectations/function_args.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/function_args.pyx
rename to cbindgen-0.27.0/tests/expectations/function_args.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/function_noreturn.c b/cbindgen-0.27.0/tests/expectations/function_noreturn.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/function_noreturn.c
rename to cbindgen-0.27.0/tests/expectations/function_noreturn.c
diff --git a/cbindgen-0.27.0/tests/expectations/function_noreturn.compat.c b/cbindgen-0.27.0/tests/expectations/function_noreturn.compat.c
new file mode 100644
index 0000000..29bdf8c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/function_noreturn.compat.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#ifndef NO_RETURN_ATTR
+ #ifdef __GNUC__
+ #define NO_RETURN_ATTR __attribute__ ((noreturn))
+ #else // __GNUC__
+ #define NO_RETURN_ATTR
+ #endif // __GNUC__
+#endif // NO_RETURN_ATTR
+
+
+typedef struct {
+ void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
+} Example;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void loop_forever(void) NO_RETURN_ATTR;
+
+uint8_t normal_return(Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/function_noreturn.cpp b/cbindgen-0.27.0/tests/expectations/function_noreturn.cpp
new file mode 100644
index 0000000..bac5b8f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/function_noreturn.cpp
@@ -0,0 +1,25 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+#ifndef NO_RETURN_ATTR
+ #ifdef __GNUC__
+ #define NO_RETURN_ATTR __attribute__ ((noreturn))
+ #else // __GNUC__
+ #define NO_RETURN_ATTR
+ #endif // __GNUC__
+#endif // NO_RETURN_ATTR
+
+
+struct Example {
+ void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
+};
+
+extern "C" {
+
+void loop_forever() NO_RETURN_ATTR;
+
+uint8_t normal_return(Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/function_noreturn.pyx b/cbindgen-0.27.0/tests/expectations/function_noreturn.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/function_noreturn.pyx
rename to cbindgen-0.27.0/tests/expectations/function_noreturn.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/function_noreturn.both.c b/cbindgen-0.27.0/tests/expectations/function_noreturn_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/function_noreturn.both.c
rename to cbindgen-0.27.0/tests/expectations/function_noreturn_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/function_noreturn_both.compat.c b/cbindgen-0.27.0/tests/expectations/function_noreturn_both.compat.c
new file mode 100644
index 0000000..c231cbb
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/function_noreturn_both.compat.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#ifndef NO_RETURN_ATTR
+ #ifdef __GNUC__
+ #define NO_RETURN_ATTR __attribute__ ((noreturn))
+ #else // __GNUC__
+ #define NO_RETURN_ATTR
+ #endif // __GNUC__
+#endif // NO_RETURN_ATTR
+
+
+typedef struct Example {
+ void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
+} Example;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void loop_forever(void) NO_RETURN_ATTR;
+
+uint8_t normal_return(struct Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/function_noreturn.tag.c b/cbindgen-0.27.0/tests/expectations/function_noreturn_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/function_noreturn.tag.c
rename to cbindgen-0.27.0/tests/expectations/function_noreturn_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/function_noreturn_tag.compat.c b/cbindgen-0.27.0/tests/expectations/function_noreturn_tag.compat.c
new file mode 100644
index 0000000..c2b80b5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/function_noreturn_tag.compat.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#ifndef NO_RETURN_ATTR
+ #ifdef __GNUC__
+ #define NO_RETURN_ATTR __attribute__ ((noreturn))
+ #else // __GNUC__
+ #define NO_RETURN_ATTR
+ #endif // __GNUC__
+#endif // NO_RETURN_ATTR
+
+
+struct Example {
+ void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void loop_forever(void) NO_RETURN_ATTR;
+
+uint8_t normal_return(struct Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/function_noreturn.tag.pyx b/cbindgen-0.27.0/tests/expectations/function_noreturn_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/function_noreturn.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/function_noreturn_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/function_ptr.c b/cbindgen-0.27.0/tests/expectations/function_ptr.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/function_ptr.c
rename to cbindgen-0.27.0/tests/expectations/function_ptr.c
diff --git a/cbindgen-0.27.0/tests/expectations/function_ptr.compat.c b/cbindgen-0.27.0/tests/expectations/function_ptr.compat.c
new file mode 100644
index 0000000..b201780
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/function_ptr.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef void (*MyCallback)(uintptr_t a, uintptr_t b);
+
+typedef void (*MyOtherCallback)(uintptr_t a,
+ uintptr_t lot,
+ uintptr_t of,
+ uintptr_t args,
+ uintptr_t and_then_some);
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void my_function(MyCallback a, MyOtherCallback b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/function_ptr.cpp b/cbindgen-0.27.0/tests/expectations/function_ptr.cpp
new file mode 100644
index 0000000..20c5258
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/function_ptr.cpp
@@ -0,0 +1,19 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+using MyCallback = void(*)(uintptr_t a, uintptr_t b);
+
+using MyOtherCallback = void(*)(uintptr_t a,
+ uintptr_t lot,
+ uintptr_t of,
+ uintptr_t args,
+ uintptr_t and_then_some);
+
+extern "C" {
+
+void my_function(MyCallback a, MyOtherCallback b);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/function_ptr.pyx b/cbindgen-0.27.0/tests/expectations/function_ptr.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/function_ptr.pyx
rename to cbindgen-0.27.0/tests/expectations/function_ptr.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/function_sort_name.c b/cbindgen-0.27.0/tests/expectations/function_sort_name.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/function_sort_name.c
rename to cbindgen-0.27.0/tests/expectations/function_sort_name.c
diff --git a/cbindgen-0.27.0/tests/expectations/function_sort_name.compat.c b/cbindgen-0.27.0/tests/expectations/function_sort_name.compat.c
new file mode 100644
index 0000000..fa401ac
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/function_sort_name.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void A(void);
+
+void B(void);
+
+void C(void);
+
+void D(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/function_sort_name.cpp b/cbindgen-0.27.0/tests/expectations/function_sort_name.cpp
new file mode 100644
index 0000000..4a885c3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/function_sort_name.cpp
@@ -0,0 +1,17 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+void A();
+
+void B();
+
+void C();
+
+void D();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/function_sort_name.pyx b/cbindgen-0.27.0/tests/expectations/function_sort_name.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/function_sort_name.pyx
rename to cbindgen-0.27.0/tests/expectations/function_sort_name.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/function_sort_none.c b/cbindgen-0.27.0/tests/expectations/function_sort_none.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/function_sort_none.c
rename to cbindgen-0.27.0/tests/expectations/function_sort_none.c
diff --git a/cbindgen-0.27.0/tests/expectations/function_sort_none.compat.c b/cbindgen-0.27.0/tests/expectations/function_sort_none.compat.c
new file mode 100644
index 0000000..2b37491
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/function_sort_none.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void C(void);
+
+void B(void);
+
+void D(void);
+
+void A(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/function_sort_none.cpp b/cbindgen-0.27.0/tests/expectations/function_sort_none.cpp
new file mode 100644
index 0000000..636c767
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/function_sort_none.cpp
@@ -0,0 +1,17 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+void C();
+
+void B();
+
+void D();
+
+void A();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/function_sort_none.pyx b/cbindgen-0.27.0/tests/expectations/function_sort_none.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/function_sort_none.pyx
rename to cbindgen-0.27.0/tests/expectations/function_sort_none.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/generic_defaults.c b/cbindgen-0.27.0/tests/expectations/generic_defaults.c
new file mode 100644
index 0000000..72fbb41
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/generic_defaults.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef int16_t Foo_i16;
+
+typedef int32_t Foo_i32;
+
+typedef struct {
+ Foo_i32 f;
+ uint32_t p;
+} Bar_i32__u32;
+
+typedef int64_t Foo_i64;
+
+typedef Foo_i64 Baz_i64;
+
+void foo_root(Foo_i16 f, Bar_i32__u32 b, Baz_i64 z);
diff --git a/cbindgen-0.27.0/tests/expectations/generic_defaults.compat.c b/cbindgen-0.27.0/tests/expectations/generic_defaults.compat.c
new file mode 100644
index 0000000..d08662a
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/generic_defaults.compat.c
@@ -0,0 +1,27 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef int16_t Foo_i16;
+
+typedef int32_t Foo_i32;
+
+typedef struct {
+ Foo_i32 f;
+ uint32_t p;
+} Bar_i32__u32;
+
+typedef int64_t Foo_i64;
+
+typedef Foo_i64 Baz_i64;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void foo_root(Foo_i16 f, Bar_i32__u32 b, Baz_i64 z);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/generic_defaults.cpp b/cbindgen-0.27.0/tests/expectations/generic_defaults.cpp
new file mode 100644
index 0000000..afc28fb
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/generic_defaults.cpp
@@ -0,0 +1,23 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T, typename P = void>
+using Foo = T;
+
+template<typename T, typename P>
+struct Bar {
+ Foo<T> f;
+ P p;
+};
+
+template<typename T>
+using Baz = Foo<T>;
+
+extern "C" {
+
+void foo_root(Foo<int16_t> f, Bar<int32_t, uint32_t> b, Baz<int64_t> z);
+
+} // extern "C"
diff --git a/cbindgen-0.27.0/tests/expectations/generic_defaults.pyx b/cbindgen-0.27.0/tests/expectations/generic_defaults.pyx
new file mode 100644
index 0000000..0c17c1b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/generic_defaults.pyx
@@ -0,0 +1,21 @@
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ ctypedef int16_t Foo_i16;
+
+ ctypedef int32_t Foo_i32;
+
+ ctypedef struct Bar_i32__u32:
+ Foo_i32 f;
+ uint32_t p;
+
+ ctypedef int64_t Foo_i64;
+
+ ctypedef Foo_i64 Baz_i64;
+
+ void foo_root(Foo_i16 f, Bar_i32__u32 b, Baz_i64 z);
diff --git a/cbindgen-0.27.0/tests/expectations/generic_defaults_both.c b/cbindgen-0.27.0/tests/expectations/generic_defaults_both.c
new file mode 100644
index 0000000..1e7e7c5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/generic_defaults_both.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef int16_t Foo_i16;
+
+typedef int32_t Foo_i32;
+
+typedef struct Bar_i32__u32 {
+ Foo_i32 f;
+ uint32_t p;
+} Bar_i32__u32;
+
+typedef int64_t Foo_i64;
+
+typedef Foo_i64 Baz_i64;
+
+void foo_root(Foo_i16 f, struct Bar_i32__u32 b, Baz_i64 z);
diff --git a/cbindgen-0.27.0/tests/expectations/generic_defaults_both.compat.c b/cbindgen-0.27.0/tests/expectations/generic_defaults_both.compat.c
new file mode 100644
index 0000000..e7aa9d4
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/generic_defaults_both.compat.c
@@ -0,0 +1,27 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef int16_t Foo_i16;
+
+typedef int32_t Foo_i32;
+
+typedef struct Bar_i32__u32 {
+ Foo_i32 f;
+ uint32_t p;
+} Bar_i32__u32;
+
+typedef int64_t Foo_i64;
+
+typedef Foo_i64 Baz_i64;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void foo_root(Foo_i16 f, struct Bar_i32__u32 b, Baz_i64 z);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/generic_defaults_tag.c b/cbindgen-0.27.0/tests/expectations/generic_defaults_tag.c
new file mode 100644
index 0000000..b3fa498
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/generic_defaults_tag.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef int16_t Foo_i16;
+
+typedef int32_t Foo_i32;
+
+struct Bar_i32__u32 {
+ Foo_i32 f;
+ uint32_t p;
+};
+
+typedef int64_t Foo_i64;
+
+typedef Foo_i64 Baz_i64;
+
+void foo_root(Foo_i16 f, struct Bar_i32__u32 b, Baz_i64 z);
diff --git a/cbindgen-0.27.0/tests/expectations/generic_defaults_tag.compat.c b/cbindgen-0.27.0/tests/expectations/generic_defaults_tag.compat.c
new file mode 100644
index 0000000..9fcc7e3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/generic_defaults_tag.compat.c
@@ -0,0 +1,27 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef int16_t Foo_i16;
+
+typedef int32_t Foo_i32;
+
+struct Bar_i32__u32 {
+ Foo_i32 f;
+ uint32_t p;
+};
+
+typedef int64_t Foo_i64;
+
+typedef Foo_i64 Baz_i64;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void foo_root(Foo_i16 f, struct Bar_i32__u32 b, Baz_i64 z);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/generic_defaults_tag.pyx b/cbindgen-0.27.0/tests/expectations/generic_defaults_tag.pyx
new file mode 100644
index 0000000..9b88074
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/generic_defaults_tag.pyx
@@ -0,0 +1,21 @@
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ ctypedef int16_t Foo_i16;
+
+ ctypedef int32_t Foo_i32;
+
+ cdef struct Bar_i32__u32:
+ Foo_i32 f;
+ uint32_t p;
+
+ ctypedef int64_t Foo_i64;
+
+ ctypedef Foo_i64 Baz_i64;
+
+ void foo_root(Foo_i16 f, Bar_i32__u32 b, Baz_i64 z);
diff --git a/cbindgen-0.24.5/tests/expectations/generic_pointer.c b/cbindgen-0.27.0/tests/expectations/generic_pointer.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/generic_pointer.c
rename to cbindgen-0.27.0/tests/expectations/generic_pointer.c
diff --git a/cbindgen-0.27.0/tests/expectations/generic_pointer.compat.c b/cbindgen-0.27.0/tests/expectations/generic_pointer.compat.c
new file mode 100644
index 0000000..d5f3ac9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/generic_pointer.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ uint8_t *a;
+} Foo_____u8;
+
+typedef Foo_____u8 Boo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Boo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/generic_pointer.cpp b/cbindgen-0.27.0/tests/expectations/generic_pointer.cpp
new file mode 100644
index 0000000..8b50514
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/generic_pointer.cpp
@@ -0,0 +1,18 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T>
+struct Foo {
+ T a;
+};
+
+using Boo = Foo<uint8_t*>;
+
+extern "C" {
+
+void root(Boo x);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/generic_pointer.pyx b/cbindgen-0.27.0/tests/expectations/generic_pointer.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/generic_pointer.pyx
rename to cbindgen-0.27.0/tests/expectations/generic_pointer.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/generic_pointer.both.c b/cbindgen-0.27.0/tests/expectations/generic_pointer_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/generic_pointer.both.c
rename to cbindgen-0.27.0/tests/expectations/generic_pointer_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/generic_pointer_both.compat.c b/cbindgen-0.27.0/tests/expectations/generic_pointer_both.compat.c
new file mode 100644
index 0000000..5b2981c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/generic_pointer_both.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo_____u8 {
+ uint8_t *a;
+} Foo_____u8;
+
+typedef struct Foo_____u8 Boo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Boo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/generic_pointer.tag.c b/cbindgen-0.27.0/tests/expectations/generic_pointer_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/generic_pointer.tag.c
rename to cbindgen-0.27.0/tests/expectations/generic_pointer_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/generic_pointer_tag.compat.c b/cbindgen-0.27.0/tests/expectations/generic_pointer_tag.compat.c
new file mode 100644
index 0000000..07dee15
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/generic_pointer_tag.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo_____u8 {
+ uint8_t *a;
+};
+
+typedef struct Foo_____u8 Boo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Boo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/generic_pointer.tag.pyx b/cbindgen-0.27.0/tests/expectations/generic_pointer_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/generic_pointer.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/generic_pointer_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/global_attr.compat.c b/cbindgen-0.27.0/tests/expectations/global_attr.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/global_attr.compat.c
rename to cbindgen-0.27.0/tests/expectations/global_attr.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/global_attr.cpp b/cbindgen-0.27.0/tests/expectations/global_attr.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/global_attr.cpp
rename to cbindgen-0.27.0/tests/expectations/global_attr.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/global_attr.pyx b/cbindgen-0.27.0/tests/expectations/global_attr.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/global_attr.pyx
rename to cbindgen-0.27.0/tests/expectations/global_attr.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/global_variable.c b/cbindgen-0.27.0/tests/expectations/global_variable.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/global_variable.c
rename to cbindgen-0.27.0/tests/expectations/global_variable.c
diff --git a/cbindgen-0.27.0/tests/expectations/global_variable.compat.c b/cbindgen-0.27.0/tests/expectations/global_variable.compat.c
new file mode 100644
index 0000000..2e99b02
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/global_variable.compat.c
@@ -0,0 +1,16 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern char MUT_GLOBAL_ARRAY[128];
+
+extern const char CONST_GLOBAL_ARRAY[128];
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/global_variable.cpp b/cbindgen-0.27.0/tests/expectations/global_variable.cpp
new file mode 100644
index 0000000..1212152
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/global_variable.cpp
@@ -0,0 +1,13 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+extern char MUT_GLOBAL_ARRAY[128];
+
+extern const char CONST_GLOBAL_ARRAY[128];
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/global_variable.pyx b/cbindgen-0.27.0/tests/expectations/global_variable.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/global_variable.pyx
rename to cbindgen-0.27.0/tests/expectations/global_variable.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/ignore.c b/cbindgen-0.27.0/tests/expectations/ignore.c
new file mode 100644
index 0000000..a2d72a8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/ignore.c
@@ -0,0 +1,12 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define NO_IGNORE_CONST 0
+
+#define NoIgnoreStructWithImpl_NO_IGNORE_INNER_CONST 0
+
+void no_ignore_root(void);
+
+void no_ignore_associated_method(void);
diff --git a/cbindgen-0.27.0/tests/expectations/ignore.compat.c b/cbindgen-0.27.0/tests/expectations/ignore.compat.c
new file mode 100644
index 0000000..8cc8679
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/ignore.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define NO_IGNORE_CONST 0
+
+#define NoIgnoreStructWithImpl_NO_IGNORE_INNER_CONST 0
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void no_ignore_root(void);
+
+void no_ignore_associated_method(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/ignore.cpp b/cbindgen-0.27.0/tests/expectations/ignore.cpp
new file mode 100644
index 0000000..fc21bdd
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/ignore.cpp
@@ -0,0 +1,17 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+constexpr static const uint32_t NO_IGNORE_CONST = 0;
+
+constexpr static const uint32_t NoIgnoreStructWithImpl_NO_IGNORE_INNER_CONST = 0;
+
+extern "C" {
+
+void no_ignore_root();
+
+void no_ignore_associated_method();
+
+} // extern "C"
diff --git a/cbindgen-0.27.0/tests/expectations/ignore.pyx b/cbindgen-0.27.0/tests/expectations/ignore.pyx
new file mode 100644
index 0000000..d6ff83a
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/ignore.pyx
@@ -0,0 +1,15 @@
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ const uint32_t NO_IGNORE_CONST # = 0
+
+ const uint32_t NoIgnoreStructWithImpl_NO_IGNORE_INNER_CONST # = 0
+
+ void no_ignore_root();
+
+ void no_ignore_associated_method();
diff --git a/cbindgen-0.24.5/tests/expectations/include.compat.c b/cbindgen-0.27.0/tests/expectations/include.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/include.compat.c
rename to cbindgen-0.27.0/tests/expectations/include.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/include.cpp b/cbindgen-0.27.0/tests/expectations/include.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/include.cpp
rename to cbindgen-0.27.0/tests/expectations/include.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/include.pyx b/cbindgen-0.27.0/tests/expectations/include.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/include.pyx
rename to cbindgen-0.27.0/tests/expectations/include.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/include_guard.c b/cbindgen-0.27.0/tests/expectations/include_guard.c
new file mode 100644
index 0000000..d55161b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/include_guard.c
@@ -0,0 +1,6 @@
+#ifndef INCLUDE_GUARD_H
+#define INCLUDE_GUARD_H
+
+void root(void);
+
+#endif /* INCLUDE_GUARD_H */
diff --git a/cbindgen-0.27.0/tests/expectations/include_guard.compat.c b/cbindgen-0.27.0/tests/expectations/include_guard.compat.c
new file mode 100644
index 0000000..aea25de
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/include_guard.compat.c
@@ -0,0 +1,14 @@
+#ifndef INCLUDE_GUARD_H
+#define INCLUDE_GUARD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif /* INCLUDE_GUARD_H */
diff --git a/cbindgen-0.27.0/tests/expectations/include_guard.cpp b/cbindgen-0.27.0/tests/expectations/include_guard.cpp
new file mode 100644
index 0000000..a5bec6c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/include_guard.cpp
@@ -0,0 +1,10 @@
+#ifndef INCLUDE_GUARD_H
+#define INCLUDE_GUARD_H
+
+extern "C" {
+
+void root();
+
+} // extern "C"
+
+#endif // INCLUDE_GUARD_H
diff --git a/cbindgen-0.24.5/tests/expectations/include_guard.pyx b/cbindgen-0.27.0/tests/expectations/include_guard.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/include_guard.pyx
rename to cbindgen-0.27.0/tests/expectations/include_guard.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/include_item.compat.c b/cbindgen-0.27.0/tests/expectations/include_item.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/include_item.compat.c
rename to cbindgen-0.27.0/tests/expectations/include_item.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/include_item.cpp b/cbindgen-0.27.0/tests/expectations/include_item.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/include_item.cpp
rename to cbindgen-0.27.0/tests/expectations/include_item.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/include_item.pyx b/cbindgen-0.27.0/tests/expectations/include_item.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/include_item.pyx
rename to cbindgen-0.27.0/tests/expectations/include_item.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/include_item.both.compat.c b/cbindgen-0.27.0/tests/expectations/include_item_both.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/include_item.both.compat.c
rename to cbindgen-0.27.0/tests/expectations/include_item_both.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/include_item.tag.compat.c b/cbindgen-0.27.0/tests/expectations/include_item_tag.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/include_item.tag.compat.c
rename to cbindgen-0.27.0/tests/expectations/include_item_tag.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/include_item.tag.pyx b/cbindgen-0.27.0/tests/expectations/include_item_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/include_item.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/include_item_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/include_specific.compat.c b/cbindgen-0.27.0/tests/expectations/include_specific.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/include_specific.compat.c
rename to cbindgen-0.27.0/tests/expectations/include_specific.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/include_specific.cpp b/cbindgen-0.27.0/tests/expectations/include_specific.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/include_specific.cpp
rename to cbindgen-0.27.0/tests/expectations/include_specific.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/include_specific.pyx b/cbindgen-0.27.0/tests/expectations/include_specific.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/include_specific.pyx
rename to cbindgen-0.27.0/tests/expectations/include_specific.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/infinite-recursion-typedef-monomorph.compat.c b/cbindgen-0.27.0/tests/expectations/infinite-recursion-typedef-monomorph.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/infinite-recursion-typedef-monomorph.compat.c
rename to cbindgen-0.27.0/tests/expectations/infinite-recursion-typedef-monomorph.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/infinite-recursion-typedef-monomorph.cpp b/cbindgen-0.27.0/tests/expectations/infinite-recursion-typedef-monomorph.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/infinite-recursion-typedef-monomorph.cpp
rename to cbindgen-0.27.0/tests/expectations/infinite-recursion-typedef-monomorph.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/infinite-recursion-typedef-monomorph.pyx b/cbindgen-0.27.0/tests/expectations/infinite-recursion-typedef-monomorph.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/infinite-recursion-typedef-monomorph.pyx
rename to cbindgen-0.27.0/tests/expectations/infinite-recursion-typedef-monomorph.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/infinite_recursion_typedef_monomorph.compat.c b/cbindgen-0.27.0/tests/expectations/infinite_recursion_typedef_monomorph.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/infinite_recursion_typedef_monomorph.compat.c
rename to cbindgen-0.27.0/tests/expectations/infinite_recursion_typedef_monomorph.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/infinite_recursion_typedef_monomorph.cpp b/cbindgen-0.27.0/tests/expectations/infinite_recursion_typedef_monomorph.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/infinite_recursion_typedef_monomorph.cpp
rename to cbindgen-0.27.0/tests/expectations/infinite_recursion_typedef_monomorph.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/infinite_recursion_typedef_monomorph.pyx b/cbindgen-0.27.0/tests/expectations/infinite_recursion_typedef_monomorph.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/infinite_recursion_typedef_monomorph.pyx
rename to cbindgen-0.27.0/tests/expectations/infinite_recursion_typedef_monomorph.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/inner_mod.c b/cbindgen-0.27.0/tests/expectations/inner_mod.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/inner_mod.c
rename to cbindgen-0.27.0/tests/expectations/inner_mod.c
diff --git a/cbindgen-0.27.0/tests/expectations/inner_mod.compat.c b/cbindgen-0.27.0/tests/expectations/inner_mod.compat.c
new file mode 100644
index 0000000..6be528f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/inner_mod.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ float x;
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/inner_mod.cpp b/cbindgen-0.27.0/tests/expectations/inner_mod.cpp
new file mode 100644
index 0000000..acdcb81
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/inner_mod.cpp
@@ -0,0 +1,15 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Foo {
+ float x;
+};
+
+extern "C" {
+
+void root(Foo a);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/inner_mod.pyx b/cbindgen-0.27.0/tests/expectations/inner_mod.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/inner_mod.pyx
rename to cbindgen-0.27.0/tests/expectations/inner_mod.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/inner_mod.both.c b/cbindgen-0.27.0/tests/expectations/inner_mod_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/inner_mod.both.c
rename to cbindgen-0.27.0/tests/expectations/inner_mod_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/inner_mod_both.compat.c b/cbindgen-0.27.0/tests/expectations/inner_mod_both.compat.c
new file mode 100644
index 0000000..f562f13
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/inner_mod_both.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo {
+ float x;
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/inner_mod.tag.c b/cbindgen-0.27.0/tests/expectations/inner_mod_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/inner_mod.tag.c
rename to cbindgen-0.27.0/tests/expectations/inner_mod_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/inner_mod_tag.compat.c b/cbindgen-0.27.0/tests/expectations/inner_mod_tag.compat.c
new file mode 100644
index 0000000..5c5be2e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/inner_mod_tag.compat.c
@@ -0,0 +1,18 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo {
+ float x;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/inner_mod.tag.pyx b/cbindgen-0.27.0/tests/expectations/inner_mod_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/inner_mod.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/inner_mod_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/item_types.c b/cbindgen-0.27.0/tests/expectations/item_types.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/item_types.c
rename to cbindgen-0.27.0/tests/expectations/item_types.c
diff --git a/cbindgen-0.24.5/tests/expectations/item_types.compat.c b/cbindgen-0.27.0/tests/expectations/item_types.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/item_types.compat.c
rename to cbindgen-0.27.0/tests/expectations/item_types.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/item_types.cpp b/cbindgen-0.27.0/tests/expectations/item_types.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/item_types.cpp
rename to cbindgen-0.27.0/tests/expectations/item_types.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/item_types.pyx b/cbindgen-0.27.0/tests/expectations/item_types.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/item_types.pyx
rename to cbindgen-0.27.0/tests/expectations/item_types.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/item_types_renamed.c b/cbindgen-0.27.0/tests/expectations/item_types_renamed.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/item_types_renamed.c
rename to cbindgen-0.27.0/tests/expectations/item_types_renamed.c
diff --git a/cbindgen-0.24.5/tests/expectations/item_types_renamed.compat.c b/cbindgen-0.27.0/tests/expectations/item_types_renamed.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/item_types_renamed.compat.c
rename to cbindgen-0.27.0/tests/expectations/item_types_renamed.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/item_types_renamed.cpp b/cbindgen-0.27.0/tests/expectations/item_types_renamed.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/item_types_renamed.cpp
rename to cbindgen-0.27.0/tests/expectations/item_types_renamed.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/item_types_renamed.pyx b/cbindgen-0.27.0/tests/expectations/item_types_renamed.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/item_types_renamed.pyx
rename to cbindgen-0.27.0/tests/expectations/item_types_renamed.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/layout.compat.c b/cbindgen-0.27.0/tests/expectations/layout.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout.compat.c
rename to cbindgen-0.27.0/tests/expectations/layout.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/layout.cpp b/cbindgen-0.27.0/tests/expectations/layout.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout.cpp
rename to cbindgen-0.27.0/tests/expectations/layout.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/layout.pyx b/cbindgen-0.27.0/tests/expectations/layout.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout.pyx
rename to cbindgen-0.27.0/tests/expectations/layout.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/layout_aligned_opaque.compat.c b/cbindgen-0.27.0/tests/expectations/layout_aligned_opaque.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout_aligned_opaque.compat.c
rename to cbindgen-0.27.0/tests/expectations/layout_aligned_opaque.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/layout_aligned_opaque.cpp b/cbindgen-0.27.0/tests/expectations/layout_aligned_opaque.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout_aligned_opaque.cpp
rename to cbindgen-0.27.0/tests/expectations/layout_aligned_opaque.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/layout_aligned_opaque.pyx b/cbindgen-0.27.0/tests/expectations/layout_aligned_opaque.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout_aligned_opaque.pyx
rename to cbindgen-0.27.0/tests/expectations/layout_aligned_opaque.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/layout_aligned_opaque.both.compat.c b/cbindgen-0.27.0/tests/expectations/layout_aligned_opaque_both.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout_aligned_opaque.both.compat.c
rename to cbindgen-0.27.0/tests/expectations/layout_aligned_opaque_both.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/layout_aligned_opaque.tag.compat.c b/cbindgen-0.27.0/tests/expectations/layout_aligned_opaque_tag.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout_aligned_opaque.tag.compat.c
rename to cbindgen-0.27.0/tests/expectations/layout_aligned_opaque_tag.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/layout_aligned_opaque.tag.pyx b/cbindgen-0.27.0/tests/expectations/layout_aligned_opaque_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout_aligned_opaque.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/layout_aligned_opaque_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/layout.both.compat.c b/cbindgen-0.27.0/tests/expectations/layout_both.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout.both.compat.c
rename to cbindgen-0.27.0/tests/expectations/layout_both.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/layout_packed_opaque.compat.c b/cbindgen-0.27.0/tests/expectations/layout_packed_opaque.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout_packed_opaque.compat.c
rename to cbindgen-0.27.0/tests/expectations/layout_packed_opaque.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/layout_packed_opaque.cpp b/cbindgen-0.27.0/tests/expectations/layout_packed_opaque.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout_packed_opaque.cpp
rename to cbindgen-0.27.0/tests/expectations/layout_packed_opaque.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/layout_packed_opaque.pyx b/cbindgen-0.27.0/tests/expectations/layout_packed_opaque.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout_packed_opaque.pyx
rename to cbindgen-0.27.0/tests/expectations/layout_packed_opaque.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/layout_packed_opaque.both.compat.c b/cbindgen-0.27.0/tests/expectations/layout_packed_opaque_both.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout_packed_opaque.both.compat.c
rename to cbindgen-0.27.0/tests/expectations/layout_packed_opaque_both.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/layout_packed_opaque.tag.compat.c b/cbindgen-0.27.0/tests/expectations/layout_packed_opaque_tag.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout_packed_opaque.tag.compat.c
rename to cbindgen-0.27.0/tests/expectations/layout_packed_opaque_tag.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/layout_packed_opaque.tag.pyx b/cbindgen-0.27.0/tests/expectations/layout_packed_opaque_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout_packed_opaque.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/layout_packed_opaque_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/layout.tag.compat.c b/cbindgen-0.27.0/tests/expectations/layout_tag.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout.tag.compat.c
rename to cbindgen-0.27.0/tests/expectations/layout_tag.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/layout.tag.pyx b/cbindgen-0.27.0/tests/expectations/layout_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/layout.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/layout_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/lifetime_arg.c b/cbindgen-0.27.0/tests/expectations/lifetime_arg.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/lifetime_arg.c
rename to cbindgen-0.27.0/tests/expectations/lifetime_arg.c
diff --git a/cbindgen-0.27.0/tests/expectations/lifetime_arg.compat.c b/cbindgen-0.27.0/tests/expectations/lifetime_arg.compat.c
new file mode 100644
index 0000000..1c607b5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/lifetime_arg.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ const int32_t *data;
+} A;
+
+typedef enum {
+ V,
+ U,
+} E_Tag;
+
+typedef struct {
+ E_Tag tag;
+ union {
+ struct {
+ const uint8_t *u;
+ };
+ };
+} E;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(A _a, E _e);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/lifetime_arg.cpp b/cbindgen-0.27.0/tests/expectations/lifetime_arg.cpp
new file mode 100644
index 0000000..72b2103
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/lifetime_arg.cpp
@@ -0,0 +1,31 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct A {
+ const int32_t *data;
+};
+
+struct E {
+ enum class Tag {
+ V,
+ U,
+ };
+
+ struct U_Body {
+ const uint8_t *_0;
+ };
+
+ Tag tag;
+ union {
+ U_Body u;
+ };
+};
+
+extern "C" {
+
+void root(A _a, E _e);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/lifetime_arg.pyx b/cbindgen-0.27.0/tests/expectations/lifetime_arg.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/lifetime_arg.pyx
rename to cbindgen-0.27.0/tests/expectations/lifetime_arg.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/lifetime_arg.both.c b/cbindgen-0.27.0/tests/expectations/lifetime_arg_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/lifetime_arg.both.c
rename to cbindgen-0.27.0/tests/expectations/lifetime_arg_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/lifetime_arg_both.compat.c b/cbindgen-0.27.0/tests/expectations/lifetime_arg_both.compat.c
new file mode 100644
index 0000000..033e3c5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/lifetime_arg_both.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct A {
+ const int32_t *data;
+} A;
+
+typedef enum E_Tag {
+ V,
+ U,
+} E_Tag;
+
+typedef struct E {
+ E_Tag tag;
+ union {
+ struct {
+ const uint8_t *u;
+ };
+ };
+} E;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct A _a, struct E _e);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/lifetime_arg.tag.c b/cbindgen-0.27.0/tests/expectations/lifetime_arg_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/lifetime_arg.tag.c
rename to cbindgen-0.27.0/tests/expectations/lifetime_arg_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/lifetime_arg_tag.compat.c b/cbindgen-0.27.0/tests/expectations/lifetime_arg_tag.compat.c
new file mode 100644
index 0000000..ec3791c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/lifetime_arg_tag.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct A {
+ const int32_t *data;
+};
+
+enum E_Tag {
+ V,
+ U,
+};
+
+struct E {
+ enum E_Tag tag;
+ union {
+ struct {
+ const uint8_t *u;
+ };
+ };
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct A _a, struct E _e);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/lifetime_arg.tag.pyx b/cbindgen-0.27.0/tests/expectations/lifetime_arg_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/lifetime_arg.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/lifetime_arg_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_cr.c b/cbindgen-0.27.0/tests/expectations/linestyle_cr.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_cr.c
rename to cbindgen-0.27.0/tests/expectations/linestyle_cr.c
Binary files differ
diff --git a/cbindgen-0.27.0/tests/expectations/linestyle_cr.compat.c b/cbindgen-0.27.0/tests/expectations/linestyle_cr.compat.c
new file mode 100644
index 0000000..5459295
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/linestyle_cr.compat.c
Binary files differ
diff --git a/cbindgen-0.27.0/tests/expectations/linestyle_cr.cpp b/cbindgen-0.27.0/tests/expectations/linestyle_cr.cpp
new file mode 100644
index 0000000..5f77d78
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/linestyle_cr.cpp
Binary files differ
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_cr.pyx b/cbindgen-0.27.0/tests/expectations/linestyle_cr.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_cr.pyx
rename to cbindgen-0.27.0/tests/expectations/linestyle_cr.pyx
Binary files differ
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_cr.both.c b/cbindgen-0.27.0/tests/expectations/linestyle_cr_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_cr.both.c
rename to cbindgen-0.27.0/tests/expectations/linestyle_cr_both.c
Binary files differ
diff --git a/cbindgen-0.27.0/tests/expectations/linestyle_cr_both.compat.c b/cbindgen-0.27.0/tests/expectations/linestyle_cr_both.compat.c
new file mode 100644
index 0000000..34792f6
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/linestyle_cr_both.compat.c
Binary files differ
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_cr.tag.c b/cbindgen-0.27.0/tests/expectations/linestyle_cr_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_cr.tag.c
rename to cbindgen-0.27.0/tests/expectations/linestyle_cr_tag.c
Binary files differ
diff --git a/cbindgen-0.27.0/tests/expectations/linestyle_cr_tag.compat.c b/cbindgen-0.27.0/tests/expectations/linestyle_cr_tag.compat.c
new file mode 100644
index 0000000..2b1f382
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/linestyle_cr_tag.compat.c
Binary files differ
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_cr.tag.pyx b/cbindgen-0.27.0/tests/expectations/linestyle_cr_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_cr.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/linestyle_cr_tag.pyx
Binary files differ
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_crlf.c b/cbindgen-0.27.0/tests/expectations/linestyle_crlf.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_crlf.c
rename to cbindgen-0.27.0/tests/expectations/linestyle_crlf.c
diff --git a/cbindgen-0.27.0/tests/expectations/linestyle_crlf.compat.c b/cbindgen-0.27.0/tests/expectations/linestyle_crlf.compat.c
new file mode 100644
index 0000000..72f9a6e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/linestyle_crlf.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ int32_t x;
+ float y;
+} Dummy;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Dummy d);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/linestyle_crlf.cpp b/cbindgen-0.27.0/tests/expectations/linestyle_crlf.cpp
new file mode 100644
index 0000000..ff773f1
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/linestyle_crlf.cpp
@@ -0,0 +1,16 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Dummy {
+ int32_t x;
+ float y;
+};
+
+extern "C" {
+
+void root(Dummy d);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_crlf.pyx b/cbindgen-0.27.0/tests/expectations/linestyle_crlf.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_crlf.pyx
rename to cbindgen-0.27.0/tests/expectations/linestyle_crlf.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_crlf.both.c b/cbindgen-0.27.0/tests/expectations/linestyle_crlf_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_crlf.both.c
rename to cbindgen-0.27.0/tests/expectations/linestyle_crlf_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/linestyle_crlf_both.compat.c b/cbindgen-0.27.0/tests/expectations/linestyle_crlf_both.compat.c
new file mode 100644
index 0000000..94f194d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/linestyle_crlf_both.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Dummy {
+ int32_t x;
+ float y;
+} Dummy;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Dummy d);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_crlf.tag.c b/cbindgen-0.27.0/tests/expectations/linestyle_crlf_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_crlf.tag.c
rename to cbindgen-0.27.0/tests/expectations/linestyle_crlf_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/linestyle_crlf_tag.compat.c b/cbindgen-0.27.0/tests/expectations/linestyle_crlf_tag.compat.c
new file mode 100644
index 0000000..045c156
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/linestyle_crlf_tag.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Dummy {
+ int32_t x;
+ float y;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Dummy d);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_crlf.tag.pyx b/cbindgen-0.27.0/tests/expectations/linestyle_crlf_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_crlf.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/linestyle_crlf_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_lf.c b/cbindgen-0.27.0/tests/expectations/linestyle_lf.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_lf.c
rename to cbindgen-0.27.0/tests/expectations/linestyle_lf.c
diff --git a/cbindgen-0.27.0/tests/expectations/linestyle_lf.compat.c b/cbindgen-0.27.0/tests/expectations/linestyle_lf.compat.c
new file mode 100644
index 0000000..321db34
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/linestyle_lf.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ int32_t x;
+ float y;
+} Dummy;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Dummy d);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/linestyle_lf.cpp b/cbindgen-0.27.0/tests/expectations/linestyle_lf.cpp
new file mode 100644
index 0000000..bd70e20
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/linestyle_lf.cpp
@@ -0,0 +1,16 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Dummy {
+ int32_t x;
+ float y;
+};
+
+extern "C" {
+
+void root(Dummy d);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_lf.pyx b/cbindgen-0.27.0/tests/expectations/linestyle_lf.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_lf.pyx
rename to cbindgen-0.27.0/tests/expectations/linestyle_lf.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_lf.both.c b/cbindgen-0.27.0/tests/expectations/linestyle_lf_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_lf.both.c
rename to cbindgen-0.27.0/tests/expectations/linestyle_lf_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/linestyle_lf_both.compat.c b/cbindgen-0.27.0/tests/expectations/linestyle_lf_both.compat.c
new file mode 100644
index 0000000..75a4f59
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/linestyle_lf_both.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Dummy {
+ int32_t x;
+ float y;
+} Dummy;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Dummy d);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_lf.tag.c b/cbindgen-0.27.0/tests/expectations/linestyle_lf_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_lf.tag.c
rename to cbindgen-0.27.0/tests/expectations/linestyle_lf_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/linestyle_lf_tag.compat.c b/cbindgen-0.27.0/tests/expectations/linestyle_lf_tag.compat.c
new file mode 100644
index 0000000..54fb0b9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/linestyle_lf_tag.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Dummy {
+ int32_t x;
+ float y;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Dummy d);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/linestyle_lf.tag.pyx b/cbindgen-0.27.0/tests/expectations/linestyle_lf_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/linestyle_lf.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/linestyle_lf_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/literal_target.compat.c b/cbindgen-0.27.0/tests/expectations/literal_target.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/literal_target.compat.c
rename to cbindgen-0.27.0/tests/expectations/literal_target.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/literal_target.cpp b/cbindgen-0.27.0/tests/expectations/literal_target.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/literal_target.cpp
rename to cbindgen-0.27.0/tests/expectations/literal_target.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/literal_target.pyx b/cbindgen-0.27.0/tests/expectations/literal_target.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/literal_target.pyx
rename to cbindgen-0.27.0/tests/expectations/literal_target.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/mangle.c b/cbindgen-0.27.0/tests/expectations/mangle.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mangle.c
rename to cbindgen-0.27.0/tests/expectations/mangle.c
diff --git a/cbindgen-0.27.0/tests/expectations/mangle.compat.c b/cbindgen-0.27.0/tests/expectations/mangle.compat.c
new file mode 100644
index 0000000..83f816e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mangle.compat.c
@@ -0,0 +1,25 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef enum {
+ BarSome,
+ BarThing,
+} Bar;
+
+typedef struct {
+ uint8_t a;
+} FooU8;
+
+typedef FooU8 Boo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Boo x, Bar y);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/mangle.cpp b/cbindgen-0.27.0/tests/expectations/mangle.cpp
new file mode 100644
index 0000000..30b959c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mangle.cpp
@@ -0,0 +1,23 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+enum class Bar {
+ BarSome,
+ BarThing,
+};
+
+template<typename T>
+struct Foo {
+ T a;
+};
+
+using Boo = Foo<uint8_t>;
+
+extern "C" {
+
+void root(Boo x, Bar y);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/mangle.pyx b/cbindgen-0.27.0/tests/expectations/mangle.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mangle.pyx
rename to cbindgen-0.27.0/tests/expectations/mangle.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/mangle.both.c b/cbindgen-0.27.0/tests/expectations/mangle_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mangle.both.c
rename to cbindgen-0.27.0/tests/expectations/mangle_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/mangle_both.compat.c b/cbindgen-0.27.0/tests/expectations/mangle_both.compat.c
new file mode 100644
index 0000000..db849dc
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mangle_both.compat.c
@@ -0,0 +1,25 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef enum Bar {
+ BarSome,
+ BarThing,
+} Bar;
+
+typedef struct FooU8 {
+ uint8_t a;
+} FooU8;
+
+typedef struct FooU8 Boo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Boo x, enum Bar y);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mangle.tag.c b/cbindgen-0.27.0/tests/expectations/mangle_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mangle.tag.c
rename to cbindgen-0.27.0/tests/expectations/mangle_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/mangle_tag.compat.c b/cbindgen-0.27.0/tests/expectations/mangle_tag.compat.c
new file mode 100644
index 0000000..a7b9231
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mangle_tag.compat.c
@@ -0,0 +1,25 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum Bar {
+ BarSome,
+ BarThing,
+};
+
+struct FooU8 {
+ uint8_t a;
+};
+
+typedef struct FooU8 Boo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Boo x, enum Bar y);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mangle.tag.pyx b/cbindgen-0.27.0/tests/expectations/mangle_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mangle.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/mangle_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/manuallydrop.c b/cbindgen-0.27.0/tests/expectations/manuallydrop.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/manuallydrop.c
rename to cbindgen-0.27.0/tests/expectations/manuallydrop.c
diff --git a/cbindgen-0.27.0/tests/expectations/manuallydrop.compat.c b/cbindgen-0.27.0/tests/expectations/manuallydrop.compat.c
new file mode 100644
index 0000000..b8bdf43
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/manuallydrop.compat.c
@@ -0,0 +1,43 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using ManuallyDrop = T;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct NotReprC_Point NotReprC_Point;
+
+typedef NotReprC_Point Foo;
+
+typedef struct {
+ int32_t x;
+ int32_t y;
+} Point;
+
+typedef struct {
+ Point point;
+} MyStruct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const MyStruct *with_manual_drop);
+
+void take(Point with_manual_drop);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/manuallydrop.cpp b/cbindgen-0.27.0/tests/expectations/manuallydrop.cpp
new file mode 100644
index 0000000..df517dc
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/manuallydrop.cpp
@@ -0,0 +1,41 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using ManuallyDrop = T;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T = void>
+struct NotReprC;
+
+struct Point {
+ int32_t x;
+ int32_t y;
+};
+
+using Foo = NotReprC<ManuallyDrop<Point>>;
+
+struct MyStruct {
+ ManuallyDrop<Point> point;
+};
+
+extern "C" {
+
+void root(const Foo *a, const MyStruct *with_manual_drop);
+
+void take(ManuallyDrop<Point> with_manual_drop);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/manuallydrop.pyx b/cbindgen-0.27.0/tests/expectations/manuallydrop.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/manuallydrop.pyx
rename to cbindgen-0.27.0/tests/expectations/manuallydrop.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/manuallydrop.both.c b/cbindgen-0.27.0/tests/expectations/manuallydrop_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/manuallydrop.both.c
rename to cbindgen-0.27.0/tests/expectations/manuallydrop_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/manuallydrop_both.compat.c b/cbindgen-0.27.0/tests/expectations/manuallydrop_both.compat.c
new file mode 100644
index 0000000..1975e26
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/manuallydrop_both.compat.c
@@ -0,0 +1,43 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using ManuallyDrop = T;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct NotReprC_Point NotReprC_Point;
+
+typedef struct NotReprC_Point Foo;
+
+typedef struct Point {
+ int32_t x;
+ int32_t y;
+} Point;
+
+typedef struct MyStruct {
+ struct Point point;
+} MyStruct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const struct MyStruct *with_manual_drop);
+
+void take(struct Point with_manual_drop);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/manuallydrop.tag.c b/cbindgen-0.27.0/tests/expectations/manuallydrop_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/manuallydrop.tag.c
rename to cbindgen-0.27.0/tests/expectations/manuallydrop_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/manuallydrop_tag.compat.c b/cbindgen-0.27.0/tests/expectations/manuallydrop_tag.compat.c
new file mode 100644
index 0000000..08d952c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/manuallydrop_tag.compat.c
@@ -0,0 +1,43 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using ManuallyDrop = T;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct NotReprC_Point;
+
+typedef struct NotReprC_Point Foo;
+
+struct Point {
+ int32_t x;
+ int32_t y;
+};
+
+struct MyStruct {
+ struct Point point;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const struct MyStruct *with_manual_drop);
+
+void take(struct Point with_manual_drop);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/manuallydrop.tag.pyx b/cbindgen-0.27.0/tests/expectations/manuallydrop_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/manuallydrop.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/manuallydrop_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/maybeuninit.c b/cbindgen-0.27.0/tests/expectations/maybeuninit.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/maybeuninit.c
rename to cbindgen-0.27.0/tests/expectations/maybeuninit.c
diff --git a/cbindgen-0.27.0/tests/expectations/maybeuninit.compat.c b/cbindgen-0.27.0/tests/expectations/maybeuninit.compat.c
new file mode 100644
index 0000000..a979299
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/maybeuninit.compat.c
@@ -0,0 +1,36 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using MaybeUninit = T;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct NotReprC______i32 NotReprC______i32;
+
+typedef NotReprC______i32 Foo;
+
+typedef struct {
+ const int32_t *number;
+} MyStruct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const MyStruct *with_maybe_uninit);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/maybeuninit.cpp b/cbindgen-0.27.0/tests/expectations/maybeuninit.cpp
new file mode 100644
index 0000000..638cdfd
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/maybeuninit.cpp
@@ -0,0 +1,34 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using MaybeUninit = T;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T = void>
+struct NotReprC;
+
+using Foo = NotReprC<MaybeUninit<const int32_t*>>;
+
+struct MyStruct {
+ MaybeUninit<const int32_t*> number;
+};
+
+extern "C" {
+
+void root(const Foo *a, const MyStruct *with_maybe_uninit);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/maybeuninit.pyx b/cbindgen-0.27.0/tests/expectations/maybeuninit.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/maybeuninit.pyx
rename to cbindgen-0.27.0/tests/expectations/maybeuninit.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/maybeuninit.both.c b/cbindgen-0.27.0/tests/expectations/maybeuninit_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/maybeuninit.both.c
rename to cbindgen-0.27.0/tests/expectations/maybeuninit_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/maybeuninit_both.compat.c b/cbindgen-0.27.0/tests/expectations/maybeuninit_both.compat.c
new file mode 100644
index 0000000..046822d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/maybeuninit_both.compat.c
@@ -0,0 +1,36 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using MaybeUninit = T;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct NotReprC______i32 NotReprC______i32;
+
+typedef struct NotReprC______i32 Foo;
+
+typedef struct MyStruct {
+ const int32_t *number;
+} MyStruct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const struct MyStruct *with_maybe_uninit);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/maybeuninit.tag.c b/cbindgen-0.27.0/tests/expectations/maybeuninit_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/maybeuninit.tag.c
rename to cbindgen-0.27.0/tests/expectations/maybeuninit_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/maybeuninit_tag.compat.c b/cbindgen-0.27.0/tests/expectations/maybeuninit_tag.compat.c
new file mode 100644
index 0000000..8ec05f1
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/maybeuninit_tag.compat.c
@@ -0,0 +1,36 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using MaybeUninit = T;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct NotReprC______i32;
+
+typedef struct NotReprC______i32 Foo;
+
+struct MyStruct {
+ const int32_t *number;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const struct MyStruct *with_maybe_uninit);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/maybeuninit.tag.pyx b/cbindgen-0.27.0/tests/expectations/maybeuninit_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/maybeuninit.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/maybeuninit_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2015.c b/cbindgen-0.27.0/tests/expectations/mod_2015.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_2015.c
rename to cbindgen-0.27.0/tests/expectations/mod_2015.c
diff --git a/cbindgen-0.27.0/tests/expectations/mod_2015.compat.c b/cbindgen-0.27.0/tests/expectations/mod_2015.compat.c
new file mode 100644
index 0000000..e8dd0c3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_2015.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define EXPORT_ME_TOO 42
+
+typedef struct {
+ uint64_t val;
+} ExportMe;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void export_me(ExportMe *val);
+
+void from_really_nested_mod(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/mod_2015.cpp b/cbindgen-0.27.0/tests/expectations/mod_2015.cpp
new file mode 100644
index 0000000..037aaa5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_2015.cpp
@@ -0,0 +1,19 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+constexpr static const uint8_t EXPORT_ME_TOO = 42;
+
+struct ExportMe {
+ uint64_t val;
+};
+
+extern "C" {
+
+void export_me(ExportMe *val);
+
+void from_really_nested_mod();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2015.pyx b/cbindgen-0.27.0/tests/expectations/mod_2015.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_2015.pyx
rename to cbindgen-0.27.0/tests/expectations/mod_2015.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2015.both.c b/cbindgen-0.27.0/tests/expectations/mod_2015_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_2015.both.c
rename to cbindgen-0.27.0/tests/expectations/mod_2015_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/mod_2015_both.compat.c b/cbindgen-0.27.0/tests/expectations/mod_2015_both.compat.c
new file mode 100644
index 0000000..ffbb829
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_2015_both.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define EXPORT_ME_TOO 42
+
+typedef struct ExportMe {
+ uint64_t val;
+} ExportMe;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void export_me(struct ExportMe *val);
+
+void from_really_nested_mod(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2015.tag.c b/cbindgen-0.27.0/tests/expectations/mod_2015_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_2015.tag.c
rename to cbindgen-0.27.0/tests/expectations/mod_2015_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/mod_2015_tag.compat.c b/cbindgen-0.27.0/tests/expectations/mod_2015_tag.compat.c
new file mode 100644
index 0000000..4d459d6
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_2015_tag.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define EXPORT_ME_TOO 42
+
+struct ExportMe {
+ uint64_t val;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void export_me(struct ExportMe *val);
+
+void from_really_nested_mod(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2015.tag.pyx b/cbindgen-0.27.0/tests/expectations/mod_2015_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_2015.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/mod_2015_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2018.c b/cbindgen-0.27.0/tests/expectations/mod_2018.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_2018.c
rename to cbindgen-0.27.0/tests/expectations/mod_2018.c
diff --git a/cbindgen-0.27.0/tests/expectations/mod_2018.compat.c b/cbindgen-0.27.0/tests/expectations/mod_2018.compat.c
new file mode 100644
index 0000000..45c2535
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_2018.compat.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define EXPORT_ME_TOO 42
+
+typedef struct {
+ uint64_t val;
+} ExportMe;
+
+typedef struct {
+ uint64_t val;
+} ExportMe2;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void export_me(ExportMe *val);
+
+void export_me_2(ExportMe2*);
+
+void from_really_nested_mod(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/mod_2018.cpp b/cbindgen-0.27.0/tests/expectations/mod_2018.cpp
new file mode 100644
index 0000000..13cd90f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_2018.cpp
@@ -0,0 +1,25 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+constexpr static const uint8_t EXPORT_ME_TOO = 42;
+
+struct ExportMe {
+ uint64_t val;
+};
+
+struct ExportMe2 {
+ uint64_t val;
+};
+
+extern "C" {
+
+void export_me(ExportMe *val);
+
+void export_me_2(ExportMe2*);
+
+void from_really_nested_mod();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2018.pyx b/cbindgen-0.27.0/tests/expectations/mod_2018.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_2018.pyx
rename to cbindgen-0.27.0/tests/expectations/mod_2018.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2018.both.c b/cbindgen-0.27.0/tests/expectations/mod_2018_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_2018.both.c
rename to cbindgen-0.27.0/tests/expectations/mod_2018_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/mod_2018_both.compat.c b/cbindgen-0.27.0/tests/expectations/mod_2018_both.compat.c
new file mode 100644
index 0000000..620b4c3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_2018_both.compat.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define EXPORT_ME_TOO 42
+
+typedef struct ExportMe {
+ uint64_t val;
+} ExportMe;
+
+typedef struct ExportMe2 {
+ uint64_t val;
+} ExportMe2;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void export_me(struct ExportMe *val);
+
+void export_me_2(struct ExportMe2*);
+
+void from_really_nested_mod(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2018.tag.c b/cbindgen-0.27.0/tests/expectations/mod_2018_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_2018.tag.c
rename to cbindgen-0.27.0/tests/expectations/mod_2018_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/mod_2018_tag.compat.c b/cbindgen-0.27.0/tests/expectations/mod_2018_tag.compat.c
new file mode 100644
index 0000000..6e167de
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_2018_tag.compat.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define EXPORT_ME_TOO 42
+
+struct ExportMe {
+ uint64_t val;
+};
+
+struct ExportMe2 {
+ uint64_t val;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void export_me(struct ExportMe *val);
+
+void export_me_2(struct ExportMe2*);
+
+void from_really_nested_mod(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_2018.tag.pyx b/cbindgen-0.27.0/tests/expectations/mod_2018_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_2018.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/mod_2018_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/mod_attr.c b/cbindgen-0.27.0/tests/expectations/mod_attr.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_attr.c
rename to cbindgen-0.27.0/tests/expectations/mod_attr.c
diff --git a/cbindgen-0.27.0/tests/expectations/mod_attr.compat.c b/cbindgen-0.27.0/tests/expectations/mod_attr.compat.c
new file mode 100644
index 0000000..bc9fd9a
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_attr.compat.c
@@ -0,0 +1,46 @@
+#if 0
+DEF FOO = 0
+DEF BAR = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if defined(FOO)
+#define FOO 1
+#endif
+
+#if defined(BAR)
+#define BAR 2
+#endif
+
+#if defined(FOO)
+typedef struct {
+
+} Foo;
+#endif
+
+#if defined(BAR)
+typedef struct {
+
+} Bar;
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#if defined(FOO)
+void foo(const Foo *foo);
+#endif
+
+#if defined(BAR)
+void bar(const Bar *bar);
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/mod_attr.cpp b/cbindgen-0.27.0/tests/expectations/mod_attr.cpp
new file mode 100644
index 0000000..a114c95
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_attr.cpp
@@ -0,0 +1,43 @@
+#if 0
+DEF FOO = 0
+DEF BAR = 0
+#endif
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+#if defined(FOO)
+constexpr static const int32_t FOO = 1;
+#endif
+
+#if defined(BAR)
+constexpr static const int32_t BAR = 2;
+#endif
+
+#if defined(FOO)
+struct Foo {
+
+};
+#endif
+
+#if defined(BAR)
+struct Bar {
+
+};
+#endif
+
+extern "C" {
+
+#if defined(FOO)
+void foo(const Foo *foo);
+#endif
+
+#if defined(BAR)
+void bar(const Bar *bar);
+#endif
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/mod_attr.pyx b/cbindgen-0.27.0/tests/expectations/mod_attr.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_attr.pyx
rename to cbindgen-0.27.0/tests/expectations/mod_attr.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/mod_attr.both.c b/cbindgen-0.27.0/tests/expectations/mod_attr_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_attr.both.c
rename to cbindgen-0.27.0/tests/expectations/mod_attr_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/mod_attr_both.compat.c b/cbindgen-0.27.0/tests/expectations/mod_attr_both.compat.c
new file mode 100644
index 0000000..cc3a389
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_attr_both.compat.c
@@ -0,0 +1,46 @@
+#if 0
+DEF FOO = 0
+DEF BAR = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if defined(FOO)
+#define FOO 1
+#endif
+
+#if defined(BAR)
+#define BAR 2
+#endif
+
+#if defined(FOO)
+typedef struct Foo {
+
+} Foo;
+#endif
+
+#if defined(BAR)
+typedef struct Bar {
+
+} Bar;
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#if defined(FOO)
+void foo(const struct Foo *foo);
+#endif
+
+#if defined(BAR)
+void bar(const struct Bar *bar);
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_attr.tag.c b/cbindgen-0.27.0/tests/expectations/mod_attr_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_attr.tag.c
rename to cbindgen-0.27.0/tests/expectations/mod_attr_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/mod_attr_tag.compat.c b/cbindgen-0.27.0/tests/expectations/mod_attr_tag.compat.c
new file mode 100644
index 0000000..6226db9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_attr_tag.compat.c
@@ -0,0 +1,46 @@
+#if 0
+DEF FOO = 0
+DEF BAR = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if defined(FOO)
+#define FOO 1
+#endif
+
+#if defined(BAR)
+#define BAR 2
+#endif
+
+#if defined(FOO)
+struct Foo {
+
+};
+#endif
+
+#if defined(BAR)
+struct Bar {
+
+};
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#if defined(FOO)
+void foo(const struct Foo *foo);
+#endif
+
+#if defined(BAR)
+void bar(const struct Bar *bar);
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_attr.tag.pyx b/cbindgen-0.27.0/tests/expectations/mod_attr_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_attr.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/mod_attr_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/mod_path.c b/cbindgen-0.27.0/tests/expectations/mod_path.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_path.c
rename to cbindgen-0.27.0/tests/expectations/mod_path.c
diff --git a/cbindgen-0.27.0/tests/expectations/mod_path.compat.c b/cbindgen-0.27.0/tests/expectations/mod_path.compat.c
new file mode 100644
index 0000000..d534a1e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_path.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define EXPORT_ME_TOO 42
+
+typedef struct {
+ uint64_t val;
+} ExportMe;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void export_me(ExportMe *val);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/mod_path.cpp b/cbindgen-0.27.0/tests/expectations/mod_path.cpp
new file mode 100644
index 0000000..fdc338b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_path.cpp
@@ -0,0 +1,17 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+constexpr static const uint8_t EXPORT_ME_TOO = 42;
+
+struct ExportMe {
+ uint64_t val;
+};
+
+extern "C" {
+
+void export_me(ExportMe *val);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/mod_path.pyx b/cbindgen-0.27.0/tests/expectations/mod_path.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_path.pyx
rename to cbindgen-0.27.0/tests/expectations/mod_path.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/mod_path.both.c b/cbindgen-0.27.0/tests/expectations/mod_path_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_path.both.c
rename to cbindgen-0.27.0/tests/expectations/mod_path_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/mod_path_both.compat.c b/cbindgen-0.27.0/tests/expectations/mod_path_both.compat.c
new file mode 100644
index 0000000..e4b4169
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_path_both.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define EXPORT_ME_TOO 42
+
+typedef struct ExportMe {
+ uint64_t val;
+} ExportMe;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void export_me(struct ExportMe *val);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_path.tag.c b/cbindgen-0.27.0/tests/expectations/mod_path_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_path.tag.c
rename to cbindgen-0.27.0/tests/expectations/mod_path_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/mod_path_tag.compat.c b/cbindgen-0.27.0/tests/expectations/mod_path_tag.compat.c
new file mode 100644
index 0000000..ce06f4a
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/mod_path_tag.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define EXPORT_ME_TOO 42
+
+struct ExportMe {
+ uint64_t val;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void export_me(struct ExportMe *val);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/mod_path.tag.pyx b/cbindgen-0.27.0/tests/expectations/mod_path_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/mod_path.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/mod_path_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_1.c b/cbindgen-0.27.0/tests/expectations/monomorph_1.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_1.c
rename to cbindgen-0.27.0/tests/expectations/monomorph_1.c
diff --git a/cbindgen-0.27.0/tests/expectations/monomorph_1.compat.c b/cbindgen-0.27.0/tests/expectations/monomorph_1.compat.c
new file mode 100644
index 0000000..f348875
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/monomorph_1.compat.c
@@ -0,0 +1,51 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Bar_Bar_f32 Bar_Bar_f32;
+
+typedef struct Bar_Foo_f32 Bar_Foo_f32;
+
+typedef struct Bar_f32 Bar_f32;
+
+typedef struct {
+ const int32_t *data;
+} Foo_i32;
+
+typedef struct {
+ const float *data;
+} Foo_f32;
+
+typedef struct {
+ const Bar_f32 *data;
+} Foo_Bar_f32;
+
+typedef struct {
+ const Foo_f32 *a;
+ const float *b;
+} Tuple_Foo_f32_____f32;
+
+typedef struct {
+ const float *a;
+ const float *b;
+} Tuple_f32__f32;
+
+typedef Tuple_f32__f32 Indirection_f32;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Foo_i32 a,
+ Foo_f32 b,
+ Bar_f32 c,
+ Foo_Bar_f32 d,
+ Bar_Foo_f32 e,
+ Bar_Bar_f32 f,
+ Tuple_Foo_f32_____f32 g,
+ Indirection_f32 h);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/monomorph_1.cpp b/cbindgen-0.27.0/tests/expectations/monomorph_1.cpp
new file mode 100644
index 0000000..076bf25
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/monomorph_1.cpp
@@ -0,0 +1,35 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T = void>
+struct Bar;
+
+template<typename T>
+struct Foo {
+ const T *data;
+};
+
+template<typename T, typename E>
+struct Tuple {
+ const T *a;
+ const E *b;
+};
+
+template<typename T>
+using Indirection = Tuple<T, float>;
+
+extern "C" {
+
+void root(Foo<int32_t> a,
+ Foo<float> b,
+ Bar<float> c,
+ Foo<Bar<float>> d,
+ Bar<Foo<float>> e,
+ Bar<Bar<float>> f,
+ Tuple<Foo<float>, float> g,
+ Indirection<float> h);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_1.pyx b/cbindgen-0.27.0/tests/expectations/monomorph_1.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_1.pyx
rename to cbindgen-0.27.0/tests/expectations/monomorph_1.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_1.both.c b/cbindgen-0.27.0/tests/expectations/monomorph_1_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_1.both.c
rename to cbindgen-0.27.0/tests/expectations/monomorph_1_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/monomorph_1_both.compat.c b/cbindgen-0.27.0/tests/expectations/monomorph_1_both.compat.c
new file mode 100644
index 0000000..0acdeb8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/monomorph_1_both.compat.c
@@ -0,0 +1,51 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Bar_Bar_f32 Bar_Bar_f32;
+
+typedef struct Bar_Foo_f32 Bar_Foo_f32;
+
+typedef struct Bar_f32 Bar_f32;
+
+typedef struct Foo_i32 {
+ const int32_t *data;
+} Foo_i32;
+
+typedef struct Foo_f32 {
+ const float *data;
+} Foo_f32;
+
+typedef struct Foo_Bar_f32 {
+ const struct Bar_f32 *data;
+} Foo_Bar_f32;
+
+typedef struct Tuple_Foo_f32_____f32 {
+ const struct Foo_f32 *a;
+ const float *b;
+} Tuple_Foo_f32_____f32;
+
+typedef struct Tuple_f32__f32 {
+ const float *a;
+ const float *b;
+} Tuple_f32__f32;
+
+typedef struct Tuple_f32__f32 Indirection_f32;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo_i32 a,
+ struct Foo_f32 b,
+ struct Bar_f32 c,
+ struct Foo_Bar_f32 d,
+ struct Bar_Foo_f32 e,
+ struct Bar_Bar_f32 f,
+ struct Tuple_Foo_f32_____f32 g,
+ Indirection_f32 h);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_1.tag.c b/cbindgen-0.27.0/tests/expectations/monomorph_1_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_1.tag.c
rename to cbindgen-0.27.0/tests/expectations/monomorph_1_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/monomorph_1_tag.compat.c b/cbindgen-0.27.0/tests/expectations/monomorph_1_tag.compat.c
new file mode 100644
index 0000000..491bb3d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/monomorph_1_tag.compat.c
@@ -0,0 +1,51 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Bar_Bar_f32;
+
+struct Bar_Foo_f32;
+
+struct Bar_f32;
+
+struct Foo_i32 {
+ const int32_t *data;
+};
+
+struct Foo_f32 {
+ const float *data;
+};
+
+struct Foo_Bar_f32 {
+ const struct Bar_f32 *data;
+};
+
+struct Tuple_Foo_f32_____f32 {
+ const struct Foo_f32 *a;
+ const float *b;
+};
+
+struct Tuple_f32__f32 {
+ const float *a;
+ const float *b;
+};
+
+typedef struct Tuple_f32__f32 Indirection_f32;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo_i32 a,
+ struct Foo_f32 b,
+ struct Bar_f32 c,
+ struct Foo_Bar_f32 d,
+ struct Bar_Foo_f32 e,
+ struct Bar_Bar_f32 f,
+ struct Tuple_Foo_f32_____f32 g,
+ Indirection_f32 h);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_1.tag.pyx b/cbindgen-0.27.0/tests/expectations/monomorph_1_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_1.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/monomorph_1_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_2.c b/cbindgen-0.27.0/tests/expectations/monomorph_2.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_2.c
rename to cbindgen-0.27.0/tests/expectations/monomorph_2.c
diff --git a/cbindgen-0.27.0/tests/expectations/monomorph_2.compat.c b/cbindgen-0.27.0/tests/expectations/monomorph_2.compat.c
new file mode 100644
index 0000000..389dcd7
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/monomorph_2.compat.c
@@ -0,0 +1,30 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct A A;
+
+typedef struct B B;
+
+typedef struct {
+ A *members;
+ uintptr_t count;
+} List_A;
+
+typedef struct {
+ B *members;
+ uintptr_t count;
+} List_B;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void foo(List_A a);
+
+void bar(List_B b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/monomorph_2.cpp b/cbindgen-0.27.0/tests/expectations/monomorph_2.cpp
new file mode 100644
index 0000000..198c144
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/monomorph_2.cpp
@@ -0,0 +1,23 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct A;
+
+struct B;
+
+template<typename T>
+struct List {
+ T *members;
+ uintptr_t count;
+};
+
+extern "C" {
+
+void foo(List<A> a);
+
+void bar(List<B> b);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_2.pyx b/cbindgen-0.27.0/tests/expectations/monomorph_2.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_2.pyx
rename to cbindgen-0.27.0/tests/expectations/monomorph_2.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_2.both.c b/cbindgen-0.27.0/tests/expectations/monomorph_2_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_2.both.c
rename to cbindgen-0.27.0/tests/expectations/monomorph_2_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/monomorph_2_both.compat.c b/cbindgen-0.27.0/tests/expectations/monomorph_2_both.compat.c
new file mode 100644
index 0000000..cb9fdd8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/monomorph_2_both.compat.c
@@ -0,0 +1,30 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct A A;
+
+typedef struct B B;
+
+typedef struct List_A {
+ struct A *members;
+ uintptr_t count;
+} List_A;
+
+typedef struct List_B {
+ struct B *members;
+ uintptr_t count;
+} List_B;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void foo(struct List_A a);
+
+void bar(struct List_B b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_2.tag.c b/cbindgen-0.27.0/tests/expectations/monomorph_2_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_2.tag.c
rename to cbindgen-0.27.0/tests/expectations/monomorph_2_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/monomorph_2_tag.compat.c b/cbindgen-0.27.0/tests/expectations/monomorph_2_tag.compat.c
new file mode 100644
index 0000000..762994c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/monomorph_2_tag.compat.c
@@ -0,0 +1,30 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct A;
+
+struct B;
+
+struct List_A {
+ struct A *members;
+ uintptr_t count;
+};
+
+struct List_B {
+ struct B *members;
+ uintptr_t count;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void foo(struct List_A a);
+
+void bar(struct List_B b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_2.tag.pyx b/cbindgen-0.27.0/tests/expectations/monomorph_2_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_2.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/monomorph_2_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_3.c b/cbindgen-0.27.0/tests/expectations/monomorph_3.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_3.c
rename to cbindgen-0.27.0/tests/expectations/monomorph_3.c
diff --git a/cbindgen-0.27.0/tests/expectations/monomorph_3.compat.c b/cbindgen-0.27.0/tests/expectations/monomorph_3.compat.c
new file mode 100644
index 0000000..ba3dc83
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/monomorph_3.compat.c
@@ -0,0 +1,51 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Bar_Bar_f32 Bar_Bar_f32;
+
+typedef struct Bar_Foo_f32 Bar_Foo_f32;
+
+typedef struct Bar_f32 Bar_f32;
+
+typedef union {
+ const int32_t *data;
+} Foo_i32;
+
+typedef union {
+ const float *data;
+} Foo_f32;
+
+typedef union {
+ const Bar_f32 *data;
+} Foo_Bar_f32;
+
+typedef union {
+ const Foo_f32 *a;
+ const float *b;
+} Tuple_Foo_f32_____f32;
+
+typedef union {
+ const float *a;
+ const float *b;
+} Tuple_f32__f32;
+
+typedef Tuple_f32__f32 Indirection_f32;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Foo_i32 a,
+ Foo_f32 b,
+ Bar_f32 c,
+ Foo_Bar_f32 d,
+ Bar_Foo_f32 e,
+ Bar_Bar_f32 f,
+ Tuple_Foo_f32_____f32 g,
+ Indirection_f32 h);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/monomorph_3.cpp b/cbindgen-0.27.0/tests/expectations/monomorph_3.cpp
new file mode 100644
index 0000000..b6b297f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/monomorph_3.cpp
@@ -0,0 +1,35 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T = void>
+struct Bar;
+
+template<typename T>
+union Foo {
+ const T *data;
+};
+
+template<typename T, typename E>
+union Tuple {
+ const T *a;
+ const E *b;
+};
+
+template<typename T>
+using Indirection = Tuple<T, float>;
+
+extern "C" {
+
+void root(Foo<int32_t> a,
+ Foo<float> b,
+ Bar<float> c,
+ Foo<Bar<float>> d,
+ Bar<Foo<float>> e,
+ Bar<Bar<float>> f,
+ Tuple<Foo<float>, float> g,
+ Indirection<float> h);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_3.pyx b/cbindgen-0.27.0/tests/expectations/monomorph_3.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_3.pyx
rename to cbindgen-0.27.0/tests/expectations/monomorph_3.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_3.both.c b/cbindgen-0.27.0/tests/expectations/monomorph_3_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_3.both.c
rename to cbindgen-0.27.0/tests/expectations/monomorph_3_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/monomorph_3_both.compat.c b/cbindgen-0.27.0/tests/expectations/monomorph_3_both.compat.c
new file mode 100644
index 0000000..3da15cb
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/monomorph_3_both.compat.c
@@ -0,0 +1,51 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Bar_Bar_f32 Bar_Bar_f32;
+
+typedef struct Bar_Foo_f32 Bar_Foo_f32;
+
+typedef struct Bar_f32 Bar_f32;
+
+typedef union Foo_i32 {
+ const int32_t *data;
+} Foo_i32;
+
+typedef union Foo_f32 {
+ const float *data;
+} Foo_f32;
+
+typedef union Foo_Bar_f32 {
+ const struct Bar_f32 *data;
+} Foo_Bar_f32;
+
+typedef union Tuple_Foo_f32_____f32 {
+ const union Foo_f32 *a;
+ const float *b;
+} Tuple_Foo_f32_____f32;
+
+typedef union Tuple_f32__f32 {
+ const float *a;
+ const float *b;
+} Tuple_f32__f32;
+
+typedef union Tuple_f32__f32 Indirection_f32;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(union Foo_i32 a,
+ union Foo_f32 b,
+ struct Bar_f32 c,
+ union Foo_Bar_f32 d,
+ struct Bar_Foo_f32 e,
+ struct Bar_Bar_f32 f,
+ union Tuple_Foo_f32_____f32 g,
+ Indirection_f32 h);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_3.tag.c b/cbindgen-0.27.0/tests/expectations/monomorph_3_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_3.tag.c
rename to cbindgen-0.27.0/tests/expectations/monomorph_3_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/monomorph_3_tag.compat.c b/cbindgen-0.27.0/tests/expectations/monomorph_3_tag.compat.c
new file mode 100644
index 0000000..c1724c5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/monomorph_3_tag.compat.c
@@ -0,0 +1,51 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Bar_Bar_f32;
+
+struct Bar_Foo_f32;
+
+struct Bar_f32;
+
+union Foo_i32 {
+ const int32_t *data;
+};
+
+union Foo_f32 {
+ const float *data;
+};
+
+union Foo_Bar_f32 {
+ const struct Bar_f32 *data;
+};
+
+union Tuple_Foo_f32_____f32 {
+ const union Foo_f32 *a;
+ const float *b;
+};
+
+union Tuple_f32__f32 {
+ const float *a;
+ const float *b;
+};
+
+typedef union Tuple_f32__f32 Indirection_f32;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(union Foo_i32 a,
+ union Foo_f32 b,
+ struct Bar_f32 c,
+ union Foo_Bar_f32 d,
+ struct Bar_Foo_f32 e,
+ struct Bar_Bar_f32 f,
+ union Tuple_Foo_f32_____f32 g,
+ Indirection_f32 h);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/monomorph_3.tag.pyx b/cbindgen-0.27.0/tests/expectations/monomorph_3_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/monomorph_3.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/monomorph_3_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/must_use.c b/cbindgen-0.27.0/tests/expectations/must_use.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/must_use.c
rename to cbindgen-0.27.0/tests/expectations/must_use.c
diff --git a/cbindgen-0.27.0/tests/expectations/must_use.compat.c b/cbindgen-0.27.0/tests/expectations/must_use.compat.c
new file mode 100644
index 0000000..b6fd172
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/must_use.compat.c
@@ -0,0 +1,44 @@
+#define MUST_USE_FUNC __attribute__((warn_unused_result))
+#define MUST_USE_STRUCT __attribute__((warn_unused))
+#define MUST_USE_ENUM /* nothing */
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum MaybeOwnedPtr_i32_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Owned_i32,
+ None_i32,
+};
+#ifndef __cplusplus
+typedef uint8_t MaybeOwnedPtr_i32_Tag;
+#endif // __cplusplus
+
+typedef struct MUST_USE_STRUCT {
+ MaybeOwnedPtr_i32_Tag tag;
+ union {
+ struct {
+ int32_t *owned;
+ };
+ };
+} MaybeOwnedPtr_i32;
+
+typedef struct MUST_USE_STRUCT {
+ int32_t *ptr;
+} OwnedPtr_i32;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+MUST_USE_FUNC MaybeOwnedPtr_i32 maybe_consume(OwnedPtr_i32 input);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/must_use.cpp b/cbindgen-0.27.0/tests/expectations/must_use.cpp
new file mode 100644
index 0000000..45333eb
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/must_use.cpp
@@ -0,0 +1,38 @@
+#define MUST_USE_FUNC __attribute__((warn_unused_result))
+#define MUST_USE_STRUCT __attribute__((warn_unused))
+#define MUST_USE_ENUM /* nothing */
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T>
+struct MUST_USE_STRUCT MaybeOwnedPtr {
+ enum class MUST_USE_ENUM Tag : uint8_t {
+ Owned,
+ None,
+ };
+
+ struct Owned_Body {
+ T *_0;
+ };
+
+ Tag tag;
+ union {
+ Owned_Body owned;
+ };
+};
+
+template<typename T>
+struct MUST_USE_STRUCT OwnedPtr {
+ T *ptr;
+};
+
+extern "C" {
+
+MUST_USE_FUNC MaybeOwnedPtr<int32_t> maybe_consume(OwnedPtr<int32_t> input);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/must_use.pyx b/cbindgen-0.27.0/tests/expectations/must_use.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/must_use.pyx
rename to cbindgen-0.27.0/tests/expectations/must_use.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/must_use.both.c b/cbindgen-0.27.0/tests/expectations/must_use_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/must_use.both.c
rename to cbindgen-0.27.0/tests/expectations/must_use_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/must_use_both.compat.c b/cbindgen-0.27.0/tests/expectations/must_use_both.compat.c
new file mode 100644
index 0000000..f56e8f0
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/must_use_both.compat.c
@@ -0,0 +1,44 @@
+#define MUST_USE_FUNC __attribute__((warn_unused_result))
+#define MUST_USE_STRUCT __attribute__((warn_unused))
+#define MUST_USE_ENUM /* nothing */
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum MaybeOwnedPtr_i32_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Owned_i32,
+ None_i32,
+};
+#ifndef __cplusplus
+typedef uint8_t MaybeOwnedPtr_i32_Tag;
+#endif // __cplusplus
+
+typedef struct MUST_USE_STRUCT MaybeOwnedPtr_i32 {
+ MaybeOwnedPtr_i32_Tag tag;
+ union {
+ struct {
+ int32_t *owned;
+ };
+ };
+} MaybeOwnedPtr_i32;
+
+typedef struct MUST_USE_STRUCT OwnedPtr_i32 {
+ int32_t *ptr;
+} OwnedPtr_i32;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+MUST_USE_FUNC struct MaybeOwnedPtr_i32 maybe_consume(struct OwnedPtr_i32 input);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/must_use.tag.c b/cbindgen-0.27.0/tests/expectations/must_use_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/must_use.tag.c
rename to cbindgen-0.27.0/tests/expectations/must_use_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/must_use_tag.compat.c b/cbindgen-0.27.0/tests/expectations/must_use_tag.compat.c
new file mode 100644
index 0000000..7aa48ce
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/must_use_tag.compat.c
@@ -0,0 +1,44 @@
+#define MUST_USE_FUNC __attribute__((warn_unused_result))
+#define MUST_USE_STRUCT __attribute__((warn_unused))
+#define MUST_USE_ENUM /* nothing */
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum MaybeOwnedPtr_i32_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Owned_i32,
+ None_i32,
+};
+#ifndef __cplusplus
+typedef uint8_t MaybeOwnedPtr_i32_Tag;
+#endif // __cplusplus
+
+struct MUST_USE_STRUCT MaybeOwnedPtr_i32 {
+ MaybeOwnedPtr_i32_Tag tag;
+ union {
+ struct {
+ int32_t *owned;
+ };
+ };
+};
+
+struct MUST_USE_STRUCT OwnedPtr_i32 {
+ int32_t *ptr;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+MUST_USE_FUNC struct MaybeOwnedPtr_i32 maybe_consume(struct OwnedPtr_i32 input);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/must_use.tag.pyx b/cbindgen-0.27.0/tests/expectations/must_use_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/must_use.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/must_use_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/namespace_constant.c b/cbindgen-0.27.0/tests/expectations/namespace_constant.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/namespace_constant.c
rename to cbindgen-0.27.0/tests/expectations/namespace_constant.c
diff --git a/cbindgen-0.27.0/tests/expectations/namespace_constant.compat.c b/cbindgen-0.27.0/tests/expectations/namespace_constant.compat.c
new file mode 100644
index 0000000..cd0df69
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/namespace_constant.compat.c
@@ -0,0 +1,30 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+namespace constants {
+#endif // __cplusplus
+
+#define FOO 10
+
+#define ZOM 3.14
+
+typedef struct {
+ int32_t x[FOO];
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Foo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#ifdef __cplusplus
+} // namespace constants
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/namespace_constant.cpp b/cbindgen-0.27.0/tests/expectations/namespace_constant.cpp
new file mode 100644
index 0000000..f62b20d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/namespace_constant.cpp
@@ -0,0 +1,23 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+namespace constants {
+
+constexpr static const int32_t FOO = 10;
+
+constexpr static const float ZOM = 3.14;
+
+struct Foo {
+ int32_t x[FOO];
+};
+
+extern "C" {
+
+void root(Foo x);
+
+} // extern "C"
+
+} // namespace constants
diff --git a/cbindgen-0.24.5/tests/expectations/namespace_constant.pyx b/cbindgen-0.27.0/tests/expectations/namespace_constant.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/namespace_constant.pyx
rename to cbindgen-0.27.0/tests/expectations/namespace_constant.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/namespace_constant.both.c b/cbindgen-0.27.0/tests/expectations/namespace_constant_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/namespace_constant.both.c
rename to cbindgen-0.27.0/tests/expectations/namespace_constant_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/namespace_constant_both.compat.c b/cbindgen-0.27.0/tests/expectations/namespace_constant_both.compat.c
new file mode 100644
index 0000000..4d7cd8c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/namespace_constant_both.compat.c
@@ -0,0 +1,30 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+namespace constants {
+#endif // __cplusplus
+
+#define FOO 10
+
+#define ZOM 3.14
+
+typedef struct Foo {
+ int32_t x[FOO];
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#ifdef __cplusplus
+} // namespace constants
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/namespace_constant.tag.c b/cbindgen-0.27.0/tests/expectations/namespace_constant_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/namespace_constant.tag.c
rename to cbindgen-0.27.0/tests/expectations/namespace_constant_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/namespace_constant_tag.compat.c b/cbindgen-0.27.0/tests/expectations/namespace_constant_tag.compat.c
new file mode 100644
index 0000000..ee17dc6
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/namespace_constant_tag.compat.c
@@ -0,0 +1,30 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+namespace constants {
+#endif // __cplusplus
+
+#define FOO 10
+
+#define ZOM 3.14
+
+struct Foo {
+ int32_t x[FOO];
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#ifdef __cplusplus
+} // namespace constants
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/namespace_constant.tag.pyx b/cbindgen-0.27.0/tests/expectations/namespace_constant_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/namespace_constant.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/namespace_constant_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/namespaces_constant.c b/cbindgen-0.27.0/tests/expectations/namespaces_constant.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/namespaces_constant.c
rename to cbindgen-0.27.0/tests/expectations/namespaces_constant.c
diff --git a/cbindgen-0.27.0/tests/expectations/namespaces_constant.compat.c b/cbindgen-0.27.0/tests/expectations/namespaces_constant.compat.c
new file mode 100644
index 0000000..58efa97
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/namespaces_constant.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+namespace constants {
+namespace test {
+#endif // __cplusplus
+
+#define FOO 10
+
+#define ZOM 3.14
+
+typedef struct {
+ int32_t x[FOO];
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Foo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#ifdef __cplusplus
+} // namespace test
+} // namespace constants
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/namespaces_constant.cpp b/cbindgen-0.27.0/tests/expectations/namespaces_constant.cpp
new file mode 100644
index 0000000..6140c2a
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/namespaces_constant.cpp
@@ -0,0 +1,25 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+namespace constants {
+namespace test {
+
+constexpr static const int32_t FOO = 10;
+
+constexpr static const float ZOM = 3.14;
+
+struct Foo {
+ int32_t x[FOO];
+};
+
+extern "C" {
+
+void root(Foo x);
+
+} // extern "C"
+
+} // namespace test
+} // namespace constants
diff --git a/cbindgen-0.24.5/tests/expectations/namespaces_constant.pyx b/cbindgen-0.27.0/tests/expectations/namespaces_constant.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/namespaces_constant.pyx
rename to cbindgen-0.27.0/tests/expectations/namespaces_constant.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/namespace_constant.both.c b/cbindgen-0.27.0/tests/expectations/namespaces_constant_both.c
similarity index 100%
copy from cbindgen-0.24.5/tests/expectations/namespace_constant.both.c
copy to cbindgen-0.27.0/tests/expectations/namespaces_constant_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/namespaces_constant_both.compat.c b/cbindgen-0.27.0/tests/expectations/namespaces_constant_both.compat.c
new file mode 100644
index 0000000..9e49dbd
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/namespaces_constant_both.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+namespace constants {
+namespace test {
+#endif // __cplusplus
+
+#define FOO 10
+
+#define ZOM 3.14
+
+typedef struct Foo {
+ int32_t x[FOO];
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#ifdef __cplusplus
+} // namespace test
+} // namespace constants
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/namespace_constant.tag.c b/cbindgen-0.27.0/tests/expectations/namespaces_constant_tag.c
similarity index 100%
copy from cbindgen-0.24.5/tests/expectations/namespace_constant.tag.c
copy to cbindgen-0.27.0/tests/expectations/namespaces_constant_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/namespaces_constant_tag.compat.c b/cbindgen-0.27.0/tests/expectations/namespaces_constant_tag.compat.c
new file mode 100644
index 0000000..9a93f96
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/namespaces_constant_tag.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+namespace constants {
+namespace test {
+#endif // __cplusplus
+
+#define FOO 10
+
+#define ZOM 3.14
+
+struct Foo {
+ int32_t x[FOO];
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#ifdef __cplusplus
+} // namespace test
+} // namespace constants
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/namespace_constant.tag.pyx b/cbindgen-0.27.0/tests/expectations/namespaces_constant_tag.pyx
similarity index 100%
copy from cbindgen-0.24.5/tests/expectations/namespace_constant.tag.pyx
copy to cbindgen-0.27.0/tests/expectations/namespaces_constant_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/nested_import.compat.c b/cbindgen-0.27.0/tests/expectations/nested_import.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/nested_import.compat.c
rename to cbindgen-0.27.0/tests/expectations/nested_import.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/nested_import.cpp b/cbindgen-0.27.0/tests/expectations/nested_import.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/nested_import.cpp
rename to cbindgen-0.27.0/tests/expectations/nested_import.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/nested_import.pyx b/cbindgen-0.27.0/tests/expectations/nested_import.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/nested_import.pyx
rename to cbindgen-0.27.0/tests/expectations/nested_import.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/no_includes.c b/cbindgen-0.27.0/tests/expectations/no_includes.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/no_includes.c
rename to cbindgen-0.27.0/tests/expectations/no_includes.c
diff --git a/cbindgen-0.27.0/tests/expectations/no_includes.compat.c b/cbindgen-0.27.0/tests/expectations/no_includes.compat.c
new file mode 100644
index 0000000..537f644
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/no_includes.compat.c
@@ -0,0 +1,9 @@
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/no_includes.cpp b/cbindgen-0.27.0/tests/expectations/no_includes.cpp
new file mode 100644
index 0000000..3c6fe1e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/no_includes.cpp
@@ -0,0 +1,6 @@
+
+extern "C" {
+
+void root();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/no_includes.pyx b/cbindgen-0.27.0/tests/expectations/no_includes.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/no_includes.pyx
rename to cbindgen-0.27.0/tests/expectations/no_includes.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/non_pub_extern.c b/cbindgen-0.27.0/tests/expectations/non_pub_extern.c
new file mode 100644
index 0000000..779000d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/non_pub_extern.c
@@ -0,0 +1,12 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+extern const uint32_t FIRST;
+
+extern const uint32_t RENAMED;
+
+void first(void);
+
+void renamed(void);
diff --git a/cbindgen-0.27.0/tests/expectations/non_pub_extern.compat.c b/cbindgen-0.27.0/tests/expectations/non_pub_extern.compat.c
new file mode 100644
index 0000000..266b681
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/non_pub_extern.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern const uint32_t FIRST;
+
+extern const uint32_t RENAMED;
+
+void first(void);
+
+void renamed(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/non_pub_extern.cpp b/cbindgen-0.27.0/tests/expectations/non_pub_extern.cpp
new file mode 100644
index 0000000..945433d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/non_pub_extern.cpp
@@ -0,0 +1,17 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+extern const uint32_t FIRST;
+
+extern const uint32_t RENAMED;
+
+void first();
+
+void renamed();
+
+} // extern "C"
diff --git a/cbindgen-0.27.0/tests/expectations/non_pub_extern.pyx b/cbindgen-0.27.0/tests/expectations/non_pub_extern.pyx
new file mode 100644
index 0000000..112841f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/non_pub_extern.pyx
@@ -0,0 +1,15 @@
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ extern const uint32_t FIRST;
+
+ extern const uint32_t RENAMED;
+
+ void first();
+
+ void renamed();
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull.c b/cbindgen-0.27.0/tests/expectations/nonnull.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/nonnull.c
rename to cbindgen-0.27.0/tests/expectations/nonnull.c
diff --git a/cbindgen-0.27.0/tests/expectations/nonnull.compat.c b/cbindgen-0.27.0/tests/expectations/nonnull.compat.c
new file mode 100644
index 0000000..d24c16d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonnull.compat.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Opaque Opaque;
+
+typedef struct {
+ float *a;
+ uint64_t *b;
+ Opaque *c;
+ uint64_t **d;
+ float **e;
+ Opaque **f;
+ uint64_t *g;
+ int32_t *h;
+ int32_t **i;
+} Foo_u64;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(int32_t *arg, Foo_u64 *foo, Opaque **d);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/nonnull.cpp b/cbindgen-0.27.0/tests/expectations/nonnull.cpp
new file mode 100644
index 0000000..81cf9e5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonnull.cpp
@@ -0,0 +1,26 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Opaque;
+
+template<typename T>
+struct Foo {
+ float *a;
+ T *b;
+ Opaque *c;
+ T **d;
+ float **e;
+ Opaque **f;
+ T *g;
+ int32_t *h;
+ int32_t **i;
+};
+
+extern "C" {
+
+void root(int32_t *arg, Foo<uint64_t> *foo, Opaque **d);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull.pyx b/cbindgen-0.27.0/tests/expectations/nonnull.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/nonnull.pyx
rename to cbindgen-0.27.0/tests/expectations/nonnull.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull_attribute.c b/cbindgen-0.27.0/tests/expectations/nonnull_attribute.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/nonnull_attribute.c
rename to cbindgen-0.27.0/tests/expectations/nonnull_attribute.c
diff --git a/cbindgen-0.27.0/tests/expectations/nonnull_attribute.compat.c b/cbindgen-0.27.0/tests/expectations/nonnull_attribute.compat.c
new file mode 100644
index 0000000..294f5d4
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonnull_attribute.compat.c
@@ -0,0 +1,60 @@
+#ifdef __clang__
+#define CBINDGEN_NONNULL _Nonnull
+#else
+#define CBINDGEN_NONNULL
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Opaque Opaque;
+
+typedef struct {
+ const Opaque *CBINDGEN_NONNULL a;
+ Opaque *CBINDGEN_NONNULL b;
+ const Opaque *c;
+ Opaque *d;
+} References;
+
+typedef struct {
+ float *CBINDGEN_NONNULL a;
+ uint64_t *CBINDGEN_NONNULL b;
+ Opaque *CBINDGEN_NONNULL c;
+ uint64_t *CBINDGEN_NONNULL *CBINDGEN_NONNULL d;
+ float *CBINDGEN_NONNULL *CBINDGEN_NONNULL e;
+ Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL f;
+ uint64_t *g;
+ int32_t *h;
+ int32_t *CBINDGEN_NONNULL *i;
+ const uint64_t *j;
+ uint64_t *k;
+} Pointers_u64;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void value_arg(References arg);
+
+void mutltiple_args(int32_t *CBINDGEN_NONNULL arg,
+ Pointers_u64 *foo,
+ Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL d);
+
+void ref_arg(const Pointers_u64 *CBINDGEN_NONNULL arg);
+
+void mut_ref_arg(Pointers_u64 *CBINDGEN_NONNULL arg);
+
+void optional_ref_arg(const Pointers_u64 *arg);
+
+void optional_mut_ref_arg(Pointers_u64 *arg);
+
+void nullable_const_ptr(const Pointers_u64 *arg);
+
+void nullable_mut_ptr(Pointers_u64 *arg);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/nonnull_attribute.cpp b/cbindgen-0.27.0/tests/expectations/nonnull_attribute.cpp
new file mode 100644
index 0000000..97fee67
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonnull_attribute.cpp
@@ -0,0 +1,58 @@
+#ifdef __clang__
+#define CBINDGEN_NONNULL _Nonnull
+#else
+#define CBINDGEN_NONNULL
+#endif
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Opaque;
+
+struct References {
+ const Opaque *CBINDGEN_NONNULL a;
+ Opaque *CBINDGEN_NONNULL b;
+ const Opaque *c;
+ Opaque *d;
+};
+
+template<typename T>
+struct Pointers {
+ float *CBINDGEN_NONNULL a;
+ T *CBINDGEN_NONNULL b;
+ Opaque *CBINDGEN_NONNULL c;
+ T *CBINDGEN_NONNULL *CBINDGEN_NONNULL d;
+ float *CBINDGEN_NONNULL *CBINDGEN_NONNULL e;
+ Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL f;
+ T *g;
+ int32_t *h;
+ int32_t *CBINDGEN_NONNULL *i;
+ const T *j;
+ T *k;
+};
+
+extern "C" {
+
+void value_arg(References arg);
+
+void mutltiple_args(int32_t *CBINDGEN_NONNULL arg,
+ Pointers<uint64_t> *foo,
+ Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL d);
+
+void ref_arg(const Pointers<uint64_t> *CBINDGEN_NONNULL arg);
+
+void mut_ref_arg(Pointers<uint64_t> *CBINDGEN_NONNULL arg);
+
+void optional_ref_arg(const Pointers<uint64_t> *arg);
+
+void optional_mut_ref_arg(Pointers<uint64_t> *arg);
+
+void nullable_const_ptr(const Pointers<uint64_t> *arg);
+
+void nullable_mut_ptr(Pointers<uint64_t> *arg);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull_attribute.pyx b/cbindgen-0.27.0/tests/expectations/nonnull_attribute.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/nonnull_attribute.pyx
rename to cbindgen-0.27.0/tests/expectations/nonnull_attribute.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull_attribute.both.c b/cbindgen-0.27.0/tests/expectations/nonnull_attribute_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/nonnull_attribute.both.c
rename to cbindgen-0.27.0/tests/expectations/nonnull_attribute_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/nonnull_attribute_both.compat.c b/cbindgen-0.27.0/tests/expectations/nonnull_attribute_both.compat.c
new file mode 100644
index 0000000..bc81c76
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonnull_attribute_both.compat.c
@@ -0,0 +1,60 @@
+#ifdef __clang__
+#define CBINDGEN_NONNULL _Nonnull
+#else
+#define CBINDGEN_NONNULL
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Opaque Opaque;
+
+typedef struct References {
+ const struct Opaque *CBINDGEN_NONNULL a;
+ struct Opaque *CBINDGEN_NONNULL b;
+ const struct Opaque *c;
+ struct Opaque *d;
+} References;
+
+typedef struct Pointers_u64 {
+ float *CBINDGEN_NONNULL a;
+ uint64_t *CBINDGEN_NONNULL b;
+ struct Opaque *CBINDGEN_NONNULL c;
+ uint64_t *CBINDGEN_NONNULL *CBINDGEN_NONNULL d;
+ float *CBINDGEN_NONNULL *CBINDGEN_NONNULL e;
+ struct Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL f;
+ uint64_t *g;
+ int32_t *h;
+ int32_t *CBINDGEN_NONNULL *i;
+ const uint64_t *j;
+ uint64_t *k;
+} Pointers_u64;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void value_arg(struct References arg);
+
+void mutltiple_args(int32_t *CBINDGEN_NONNULL arg,
+ struct Pointers_u64 *foo,
+ struct Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL d);
+
+void ref_arg(const struct Pointers_u64 *CBINDGEN_NONNULL arg);
+
+void mut_ref_arg(struct Pointers_u64 *CBINDGEN_NONNULL arg);
+
+void optional_ref_arg(const struct Pointers_u64 *arg);
+
+void optional_mut_ref_arg(struct Pointers_u64 *arg);
+
+void nullable_const_ptr(const struct Pointers_u64 *arg);
+
+void nullable_mut_ptr(struct Pointers_u64 *arg);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull_attribute.tag.c b/cbindgen-0.27.0/tests/expectations/nonnull_attribute_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/nonnull_attribute.tag.c
rename to cbindgen-0.27.0/tests/expectations/nonnull_attribute_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/nonnull_attribute_tag.compat.c b/cbindgen-0.27.0/tests/expectations/nonnull_attribute_tag.compat.c
new file mode 100644
index 0000000..61c119d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonnull_attribute_tag.compat.c
@@ -0,0 +1,60 @@
+#ifdef __clang__
+#define CBINDGEN_NONNULL _Nonnull
+#else
+#define CBINDGEN_NONNULL
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Opaque;
+
+struct References {
+ const struct Opaque *CBINDGEN_NONNULL a;
+ struct Opaque *CBINDGEN_NONNULL b;
+ const struct Opaque *c;
+ struct Opaque *d;
+};
+
+struct Pointers_u64 {
+ float *CBINDGEN_NONNULL a;
+ uint64_t *CBINDGEN_NONNULL b;
+ struct Opaque *CBINDGEN_NONNULL c;
+ uint64_t *CBINDGEN_NONNULL *CBINDGEN_NONNULL d;
+ float *CBINDGEN_NONNULL *CBINDGEN_NONNULL e;
+ struct Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL f;
+ uint64_t *g;
+ int32_t *h;
+ int32_t *CBINDGEN_NONNULL *i;
+ const uint64_t *j;
+ uint64_t *k;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void value_arg(struct References arg);
+
+void mutltiple_args(int32_t *CBINDGEN_NONNULL arg,
+ struct Pointers_u64 *foo,
+ struct Opaque *CBINDGEN_NONNULL *CBINDGEN_NONNULL d);
+
+void ref_arg(const struct Pointers_u64 *CBINDGEN_NONNULL arg);
+
+void mut_ref_arg(struct Pointers_u64 *CBINDGEN_NONNULL arg);
+
+void optional_ref_arg(const struct Pointers_u64 *arg);
+
+void optional_mut_ref_arg(struct Pointers_u64 *arg);
+
+void nullable_const_ptr(const struct Pointers_u64 *arg);
+
+void nullable_mut_ptr(struct Pointers_u64 *arg);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull_attribute.tag.pyx b/cbindgen-0.27.0/tests/expectations/nonnull_attribute_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/nonnull_attribute.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/nonnull_attribute_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull.both.c b/cbindgen-0.27.0/tests/expectations/nonnull_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/nonnull.both.c
rename to cbindgen-0.27.0/tests/expectations/nonnull_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/nonnull_both.compat.c b/cbindgen-0.27.0/tests/expectations/nonnull_both.compat.c
new file mode 100644
index 0000000..f38bc4a
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonnull_both.compat.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Opaque Opaque;
+
+typedef struct Foo_u64 {
+ float *a;
+ uint64_t *b;
+ struct Opaque *c;
+ uint64_t **d;
+ float **e;
+ struct Opaque **f;
+ uint64_t *g;
+ int32_t *h;
+ int32_t **i;
+} Foo_u64;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(int32_t *arg, struct Foo_u64 *foo, struct Opaque **d);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull.tag.c b/cbindgen-0.27.0/tests/expectations/nonnull_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/nonnull.tag.c
rename to cbindgen-0.27.0/tests/expectations/nonnull_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/nonnull_tag.compat.c b/cbindgen-0.27.0/tests/expectations/nonnull_tag.compat.c
new file mode 100644
index 0000000..e7b8dc6
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonnull_tag.compat.c
@@ -0,0 +1,28 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Opaque;
+
+struct Foo_u64 {
+ float *a;
+ uint64_t *b;
+ struct Opaque *c;
+ uint64_t **d;
+ float **e;
+ struct Opaque **f;
+ uint64_t *g;
+ int32_t *h;
+ int32_t **i;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(int32_t *arg, struct Foo_u64 *foo, struct Opaque **d);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/nonnull.tag.pyx b/cbindgen-0.27.0/tests/expectations/nonnull_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/nonnull.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/nonnull_tag.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/nonzero.c b/cbindgen-0.27.0/tests/expectations/nonzero.c
new file mode 100644
index 0000000..ec7d8e0
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonzero.c
@@ -0,0 +1,69 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+struct NonZeroI64;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Option_i64 Option_i64;
+
+typedef struct {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const Option_i64 *j;
+} NonZeroAliases;
+
+typedef struct {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const Option_i64 *j;
+} NonZeroGenerics;
+
+void root_nonzero_aliases(NonZeroAliases test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const Option_i64 *j);
+
+void root_nonzero_generics(NonZeroGenerics test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const Option_i64 *j);
diff --git a/cbindgen-0.27.0/tests/expectations/nonzero.compat.c b/cbindgen-0.27.0/tests/expectations/nonzero.compat.c
new file mode 100644
index 0000000..f9e1703
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonzero.compat.c
@@ -0,0 +1,77 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+struct NonZeroI64;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Option_i64 Option_i64;
+
+typedef struct {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const Option_i64 *j;
+} NonZeroAliases;
+
+typedef struct {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const Option_i64 *j;
+} NonZeroGenerics;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root_nonzero_aliases(NonZeroAliases test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const Option_i64 *j);
+
+void root_nonzero_generics(NonZeroGenerics test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const Option_i64 *j);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/nonzero.cpp b/cbindgen-0.27.0/tests/expectations/nonzero.cpp
new file mode 100644
index 0000000..25a930c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonzero.cpp
@@ -0,0 +1,75 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+struct NonZeroI64;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T = void>
+struct Option;
+
+struct NonZeroAliases {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const Option<int64_t> *j;
+};
+
+struct NonZeroGenerics {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const Option<int64_t> *j;
+};
+
+extern "C" {
+
+void root_nonzero_aliases(NonZeroAliases test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const Option<int64_t> *j);
+
+void root_nonzero_generics(NonZeroGenerics test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const Option<int64_t> *j);
+
+} // extern "C"
diff --git a/cbindgen-0.27.0/tests/expectations/nonzero.pyx b/cbindgen-0.27.0/tests/expectations/nonzero.pyx
new file mode 100644
index 0000000..737c441
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonzero.pyx
@@ -0,0 +1,71 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+struct NonZeroI64;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ ctypedef struct Option_i64:
+ pass
+
+ ctypedef struct NonZeroAliases:
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const Option_i64 *j;
+
+ ctypedef struct NonZeroGenerics:
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const Option_i64 *j;
+
+ void root_nonzero_aliases(NonZeroAliases test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const Option_i64 *j);
+
+ void root_nonzero_generics(NonZeroGenerics test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const Option_i64 *j);
diff --git a/cbindgen-0.27.0/tests/expectations/nonzero_both.c b/cbindgen-0.27.0/tests/expectations/nonzero_both.c
new file mode 100644
index 0000000..6f47e75
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonzero_both.c
@@ -0,0 +1,69 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+struct NonZeroI64;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Option_i64 Option_i64;
+
+typedef struct NonZeroAliases {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const struct Option_i64 *j;
+} NonZeroAliases;
+
+typedef struct NonZeroGenerics {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const struct Option_i64 *j;
+} NonZeroGenerics;
+
+void root_nonzero_aliases(struct NonZeroAliases test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const struct Option_i64 *j);
+
+void root_nonzero_generics(struct NonZeroGenerics test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const struct Option_i64 *j);
diff --git a/cbindgen-0.27.0/tests/expectations/nonzero_both.compat.c b/cbindgen-0.27.0/tests/expectations/nonzero_both.compat.c
new file mode 100644
index 0000000..ee8433e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonzero_both.compat.c
@@ -0,0 +1,77 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+struct NonZeroI64;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Option_i64 Option_i64;
+
+typedef struct NonZeroAliases {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const struct Option_i64 *j;
+} NonZeroAliases;
+
+typedef struct NonZeroGenerics {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const struct Option_i64 *j;
+} NonZeroGenerics;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root_nonzero_aliases(struct NonZeroAliases test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const struct Option_i64 *j);
+
+void root_nonzero_generics(struct NonZeroGenerics test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const struct Option_i64 *j);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/nonzero_tag.c b/cbindgen-0.27.0/tests/expectations/nonzero_tag.c
new file mode 100644
index 0000000..cf67b3d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonzero_tag.c
@@ -0,0 +1,69 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+struct NonZeroI64;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Option_i64;
+
+struct NonZeroAliases {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const struct Option_i64 *j;
+};
+
+struct NonZeroGenerics {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const struct Option_i64 *j;
+};
+
+void root_nonzero_aliases(struct NonZeroAliases test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const struct Option_i64 *j);
+
+void root_nonzero_generics(struct NonZeroGenerics test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const struct Option_i64 *j);
diff --git a/cbindgen-0.27.0/tests/expectations/nonzero_tag.compat.c b/cbindgen-0.27.0/tests/expectations/nonzero_tag.compat.c
new file mode 100644
index 0000000..896ddbf
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonzero_tag.compat.c
@@ -0,0 +1,77 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+struct NonZeroI64;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Option_i64;
+
+struct NonZeroAliases {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const struct Option_i64 *j;
+};
+
+struct NonZeroGenerics {
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const struct Option_i64 *j;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root_nonzero_aliases(struct NonZeroAliases test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const struct Option_i64 *j);
+
+void root_nonzero_generics(struct NonZeroGenerics test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const struct Option_i64 *j);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/nonzero_tag.pyx b/cbindgen-0.27.0/tests/expectations/nonzero_tag.pyx
new file mode 100644
index 0000000..0f3caf3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/nonzero_tag.pyx
@@ -0,0 +1,71 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+struct NonZeroI64;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ cdef struct Option_i64:
+ pass
+
+ cdef struct NonZeroAliases:
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const Option_i64 *j;
+
+ cdef struct NonZeroGenerics:
+ uint8_t a;
+ uint16_t b;
+ uint32_t c;
+ uint64_t d;
+ int8_t e;
+ int16_t f;
+ int32_t g;
+ int64_t h;
+ int64_t i;
+ const Option_i64 *j;
+
+ void root_nonzero_aliases(NonZeroAliases test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const Option_i64 *j);
+
+ void root_nonzero_generics(NonZeroGenerics test,
+ uint8_t a,
+ uint16_t b,
+ uint32_t c,
+ uint64_t d,
+ int8_t e,
+ int16_t f,
+ int32_t g,
+ int64_t h,
+ int64_t i,
+ const Option_i64 *j);
diff --git a/cbindgen-0.24.5/tests/expectations/opaque.c b/cbindgen-0.27.0/tests/expectations/opaque.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/opaque.c
rename to cbindgen-0.27.0/tests/expectations/opaque.c
diff --git a/cbindgen-0.27.0/tests/expectations/opaque.compat.c b/cbindgen-0.27.0/tests/expectations/opaque.compat.c
new file mode 100644
index 0000000..61a93ed
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/opaque.compat.c
@@ -0,0 +1,44 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+// These could be added as opaque types I guess.
+template <typename T>
+struct BuildHasherDefault;
+
+struct DefaultHasher;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct HashMap_i32__i32__BuildHasherDefault_DefaultHasher HashMap_i32__i32__BuildHasherDefault_DefaultHasher;
+
+typedef struct Result_Foo Result_Foo;
+
+/**
+ * Fast hash map used internally.
+ */
+typedef HashMap_i32__i32__BuildHasherDefault_DefaultHasher FastHashMap_i32__i32;
+
+typedef FastHashMap_i32__i32 Foo;
+
+typedef Result_Foo Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const Bar *b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/opaque.cpp b/cbindgen-0.27.0/tests/expectations/opaque.cpp
new file mode 100644
index 0000000..0e22c0e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/opaque.cpp
@@ -0,0 +1,42 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+// These could be added as opaque types I guess.
+template <typename T>
+struct BuildHasherDefault;
+
+struct DefaultHasher;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename K = void, typename V = void, typename Hasher = void>
+struct HashMap;
+
+template<typename T = void, typename E = void>
+struct Result;
+
+/// Fast hash map used internally.
+template<typename K, typename V>
+using FastHashMap = HashMap<K, V, BuildHasherDefault<DefaultHasher>>;
+
+using Foo = FastHashMap<int32_t, int32_t>;
+
+using Bar = Result<Foo>;
+
+extern "C" {
+
+void root(const Foo *a, const Bar *b);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/opaque.pyx b/cbindgen-0.27.0/tests/expectations/opaque.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/opaque.pyx
rename to cbindgen-0.27.0/tests/expectations/opaque.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/opaque.both.c b/cbindgen-0.27.0/tests/expectations/opaque_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/opaque.both.c
rename to cbindgen-0.27.0/tests/expectations/opaque_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/opaque_both.compat.c b/cbindgen-0.27.0/tests/expectations/opaque_both.compat.c
new file mode 100644
index 0000000..fa057a1
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/opaque_both.compat.c
@@ -0,0 +1,44 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+// These could be added as opaque types I guess.
+template <typename T>
+struct BuildHasherDefault;
+
+struct DefaultHasher;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct HashMap_i32__i32__BuildHasherDefault_DefaultHasher HashMap_i32__i32__BuildHasherDefault_DefaultHasher;
+
+typedef struct Result_Foo Result_Foo;
+
+/**
+ * Fast hash map used internally.
+ */
+typedef struct HashMap_i32__i32__BuildHasherDefault_DefaultHasher FastHashMap_i32__i32;
+
+typedef FastHashMap_i32__i32 Foo;
+
+typedef struct Result_Foo Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const Bar *b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/opaque.tag.c b/cbindgen-0.27.0/tests/expectations/opaque_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/opaque.tag.c
rename to cbindgen-0.27.0/tests/expectations/opaque_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/opaque_tag.compat.c b/cbindgen-0.27.0/tests/expectations/opaque_tag.compat.c
new file mode 100644
index 0000000..71ab06c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/opaque_tag.compat.c
@@ -0,0 +1,44 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+// These could be added as opaque types I guess.
+template <typename T>
+struct BuildHasherDefault;
+
+struct DefaultHasher;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct HashMap_i32__i32__BuildHasherDefault_DefaultHasher;
+
+struct Result_Foo;
+
+/**
+ * Fast hash map used internally.
+ */
+typedef struct HashMap_i32__i32__BuildHasherDefault_DefaultHasher FastHashMap_i32__i32;
+
+typedef FastHashMap_i32__i32 Foo;
+
+typedef struct Result_Foo Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Foo *a, const Bar *b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/opaque.tag.pyx b/cbindgen-0.27.0/tests/expectations/opaque_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/opaque.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/opaque_tag.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/package_version.c b/cbindgen-0.27.0/tests/expectations/package_version.c
new file mode 100644
index 0000000..dd8e718
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/package_version.c
@@ -0,0 +1,12 @@
+/* Package version: 0.1.0 */
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ uint64_t bar;
+} Foo;
+
+void doit(const Foo*);
diff --git a/cbindgen-0.27.0/tests/expectations/package_version.compat.c b/cbindgen-0.27.0/tests/expectations/package_version.compat.c
new file mode 100644
index 0000000..47ff31d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/package_version.compat.c
@@ -0,0 +1,20 @@
+/* Package version: 0.1.0 */
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ uint64_t bar;
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void doit(const Foo*);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/package_version.cpp b/cbindgen-0.27.0/tests/expectations/package_version.cpp
new file mode 100644
index 0000000..f8919d0
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/package_version.cpp
@@ -0,0 +1,17 @@
+/* Package version: 0.1.0 */
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Foo {
+ uint64_t bar;
+};
+
+extern "C" {
+
+void doit(const Foo*);
+
+} // extern "C"
diff --git a/cbindgen-0.27.0/tests/expectations/package_version.pyx b/cbindgen-0.27.0/tests/expectations/package_version.pyx
new file mode 100644
index 0000000..7c92cad
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/package_version.pyx
@@ -0,0 +1,14 @@
+''' Package version: 0.1.0 '''
+
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ ctypedef struct Foo:
+ uint64_t bar;
+
+ void doit(const Foo*);
diff --git a/cbindgen-0.27.0/tests/expectations/package_version_both.c b/cbindgen-0.27.0/tests/expectations/package_version_both.c
new file mode 100644
index 0000000..b09c946
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/package_version_both.c
@@ -0,0 +1,12 @@
+/* Package version: 0.1.0 */
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo {
+ uint64_t bar;
+} Foo;
+
+void doit(const struct Foo*);
diff --git a/cbindgen-0.27.0/tests/expectations/package_version_both.compat.c b/cbindgen-0.27.0/tests/expectations/package_version_both.compat.c
new file mode 100644
index 0000000..c159445
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/package_version_both.compat.c
@@ -0,0 +1,20 @@
+/* Package version: 0.1.0 */
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo {
+ uint64_t bar;
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void doit(const struct Foo*);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/package_version_tag.c b/cbindgen-0.27.0/tests/expectations/package_version_tag.c
new file mode 100644
index 0000000..b46eae6
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/package_version_tag.c
@@ -0,0 +1,12 @@
+/* Package version: 0.1.0 */
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo {
+ uint64_t bar;
+};
+
+void doit(const struct Foo*);
diff --git a/cbindgen-0.27.0/tests/expectations/package_version_tag.compat.c b/cbindgen-0.27.0/tests/expectations/package_version_tag.compat.c
new file mode 100644
index 0000000..18909d8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/package_version_tag.compat.c
@@ -0,0 +1,20 @@
+/* Package version: 0.1.0 */
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo {
+ uint64_t bar;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void doit(const struct Foo*);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/package_version_tag.pyx b/cbindgen-0.27.0/tests/expectations/package_version_tag.pyx
new file mode 100644
index 0000000..8f70779
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/package_version_tag.pyx
@@ -0,0 +1,14 @@
+''' Package version: 0.1.0 '''
+
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ cdef struct Foo:
+ uint64_t bar;
+
+ void doit(const Foo*);
diff --git a/cbindgen-0.24.5/tests/expectations/pin.c b/cbindgen-0.27.0/tests/expectations/pin.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/pin.c
rename to cbindgen-0.27.0/tests/expectations/pin.c
diff --git a/cbindgen-0.27.0/tests/expectations/pin.compat.c b/cbindgen-0.27.0/tests/expectations/pin.compat.c
new file mode 100644
index 0000000..117641d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/pin.compat.c
@@ -0,0 +1,35 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using Pin = T;
+template <typename T>
+using Box = T*;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ int32_t *pinned_box;
+ int32_t *pinned_ref;
+} PinTest;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(int32_t *s, PinTest p);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/pin.cpp b/cbindgen-0.27.0/tests/expectations/pin.cpp
new file mode 100644
index 0000000..f8a16c7
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/pin.cpp
@@ -0,0 +1,32 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using Pin = T;
+template <typename T>
+using Box = T*;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct PinTest {
+ Pin<Box<int32_t>> pinned_box;
+ Pin<int32_t*> pinned_ref;
+};
+
+extern "C" {
+
+void root(Pin<int32_t*> s, PinTest p);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/pin.pyx b/cbindgen-0.27.0/tests/expectations/pin.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/pin.pyx
rename to cbindgen-0.27.0/tests/expectations/pin.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/pin.both.c b/cbindgen-0.27.0/tests/expectations/pin_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/pin.both.c
rename to cbindgen-0.27.0/tests/expectations/pin_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/pin_both.compat.c b/cbindgen-0.27.0/tests/expectations/pin_both.compat.c
new file mode 100644
index 0000000..9424fbf
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/pin_both.compat.c
@@ -0,0 +1,35 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using Pin = T;
+template <typename T>
+using Box = T*;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct PinTest {
+ int32_t *pinned_box;
+ int32_t *pinned_ref;
+} PinTest;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(int32_t *s, struct PinTest p);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/pin.tag.c b/cbindgen-0.27.0/tests/expectations/pin_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/pin.tag.c
rename to cbindgen-0.27.0/tests/expectations/pin_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/pin_tag.compat.c b/cbindgen-0.27.0/tests/expectations/pin_tag.compat.c
new file mode 100644
index 0000000..2bb04fd
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/pin_tag.compat.c
@@ -0,0 +1,35 @@
+#if 0
+''' '
+#endif
+
+#ifdef __cplusplus
+template <typename T>
+using Pin = T;
+template <typename T>
+using Box = T*;
+#endif
+
+#if 0
+' '''
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct PinTest {
+ int32_t *pinned_box;
+ int32_t *pinned_ref;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(int32_t *s, struct PinTest p);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/pin.tag.pyx b/cbindgen-0.27.0/tests/expectations/pin_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/pin.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/pin_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/pragma_once.c b/cbindgen-0.27.0/tests/expectations/pragma_once.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/pragma_once.c
rename to cbindgen-0.27.0/tests/expectations/pragma_once.c
diff --git a/cbindgen-0.27.0/tests/expectations/pragma_once.compat.c b/cbindgen-0.27.0/tests/expectations/pragma_once.compat.c
new file mode 100644
index 0000000..56345c1
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/pragma_once.compat.c
@@ -0,0 +1,16 @@
+#pragma once
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/pragma_once.cpp b/cbindgen-0.27.0/tests/expectations/pragma_once.cpp
new file mode 100644
index 0000000..7144b27
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/pragma_once.cpp
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+void root();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/pragma_once.pyx b/cbindgen-0.27.0/tests/expectations/pragma_once.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/pragma_once.pyx
rename to cbindgen-0.27.0/tests/expectations/pragma_once.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/prefix.c b/cbindgen-0.27.0/tests/expectations/prefix.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefix.c
rename to cbindgen-0.27.0/tests/expectations/prefix.c
diff --git a/cbindgen-0.27.0/tests/expectations/prefix.compat.c b/cbindgen-0.27.0/tests/expectations/prefix.compat.c
new file mode 100644
index 0000000..a37a15a
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/prefix.compat.c
@@ -0,0 +1,45 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define PREFIX_LEN 22
+
+#define PREFIX_X (22 << 22)
+
+#define PREFIX_Y (PREFIX_X + PREFIX_X)
+
+typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
+
+typedef int32_t PREFIX_ValuedLenArray[22];
+
+enum PREFIX_AbsoluteFontWeight_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Weight,
+ Normal,
+ Bold,
+};
+#ifndef __cplusplus
+typedef uint8_t PREFIX_AbsoluteFontWeight_Tag;
+#endif // __cplusplus
+
+typedef union {
+ PREFIX_AbsoluteFontWeight_Tag tag;
+ struct {
+ PREFIX_AbsoluteFontWeight_Tag weight_tag;
+ float weight;
+ };
+} PREFIX_AbsoluteFontWeight;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(PREFIX_NamedLenArray x, PREFIX_ValuedLenArray y, PREFIX_AbsoluteFontWeight z);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/prefix.cpp b/cbindgen-0.27.0/tests/expectations/prefix.cpp
new file mode 100644
index 0000000..e11ffc7
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/prefix.cpp
@@ -0,0 +1,39 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+constexpr static const int32_t PREFIX_LEN = 22;
+
+constexpr static const int64_t PREFIX_X = (22 << 22);
+
+constexpr static const int64_t PREFIX_Y = (PREFIX_X + PREFIX_X);
+
+using PREFIX_NamedLenArray = int32_t[PREFIX_LEN];
+
+using PREFIX_ValuedLenArray = int32_t[22];
+
+union PREFIX_AbsoluteFontWeight {
+ enum class Tag : uint8_t {
+ Weight,
+ Normal,
+ Bold,
+ };
+
+ struct Weight_Body {
+ Tag tag;
+ float _0;
+ };
+
+ struct {
+ Tag tag;
+ };
+ Weight_Body weight;
+};
+
+extern "C" {
+
+void root(PREFIX_NamedLenArray x, PREFIX_ValuedLenArray y, PREFIX_AbsoluteFontWeight z);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/prefix.pyx b/cbindgen-0.27.0/tests/expectations/prefix.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefix.pyx
rename to cbindgen-0.27.0/tests/expectations/prefix.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/prefix.both.c b/cbindgen-0.27.0/tests/expectations/prefix_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefix.both.c
rename to cbindgen-0.27.0/tests/expectations/prefix_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/prefix_both.compat.c b/cbindgen-0.27.0/tests/expectations/prefix_both.compat.c
new file mode 100644
index 0000000..1b6475c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/prefix_both.compat.c
@@ -0,0 +1,45 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define PREFIX_LEN 22
+
+#define PREFIX_X (22 << 22)
+
+#define PREFIX_Y (PREFIX_X + PREFIX_X)
+
+typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
+
+typedef int32_t PREFIX_ValuedLenArray[22];
+
+enum PREFIX_AbsoluteFontWeight_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Weight,
+ Normal,
+ Bold,
+};
+#ifndef __cplusplus
+typedef uint8_t PREFIX_AbsoluteFontWeight_Tag;
+#endif // __cplusplus
+
+typedef union PREFIX_AbsoluteFontWeight {
+ PREFIX_AbsoluteFontWeight_Tag tag;
+ struct {
+ PREFIX_AbsoluteFontWeight_Tag weight_tag;
+ float weight;
+ };
+} PREFIX_AbsoluteFontWeight;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(PREFIX_NamedLenArray x, PREFIX_ValuedLenArray y, union PREFIX_AbsoluteFontWeight z);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefix.tag.c b/cbindgen-0.27.0/tests/expectations/prefix_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefix.tag.c
rename to cbindgen-0.27.0/tests/expectations/prefix_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/prefix_tag.compat.c b/cbindgen-0.27.0/tests/expectations/prefix_tag.compat.c
new file mode 100644
index 0000000..e300cda
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/prefix_tag.compat.c
@@ -0,0 +1,45 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define PREFIX_LEN 22
+
+#define PREFIX_X (22 << 22)
+
+#define PREFIX_Y (PREFIX_X + PREFIX_X)
+
+typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
+
+typedef int32_t PREFIX_ValuedLenArray[22];
+
+enum PREFIX_AbsoluteFontWeight_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Weight,
+ Normal,
+ Bold,
+};
+#ifndef __cplusplus
+typedef uint8_t PREFIX_AbsoluteFontWeight_Tag;
+#endif // __cplusplus
+
+union PREFIX_AbsoluteFontWeight {
+ PREFIX_AbsoluteFontWeight_Tag tag;
+ struct {
+ PREFIX_AbsoluteFontWeight_Tag weight_tag;
+ float weight;
+ };
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(PREFIX_NamedLenArray x, PREFIX_ValuedLenArray y, union PREFIX_AbsoluteFontWeight z);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefix.tag.pyx b/cbindgen-0.27.0/tests/expectations/prefix_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefix.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/prefix_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.c b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.c
rename to cbindgen-0.27.0/tests/expectations/prefixed_struct_literal.c
diff --git a/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal.compat.c b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal.compat.c
new file mode 100644
index 0000000..b45631f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ int32_t a;
+ uint32_t b;
+} PREFIXFoo;
+#define PREFIXFoo_FOO (PREFIXFoo){ .a = 42, .b = 47 }
+
+#define PREFIXBAR (PREFIXFoo){ .a = 42, .b = 1337 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(PREFIXFoo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal.cpp b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal.cpp
new file mode 100644
index 0000000..c8f5dba
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal.cpp
@@ -0,0 +1,19 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct PREFIXFoo {
+ int32_t a;
+ uint32_t b;
+};
+constexpr static const PREFIXFoo PREFIXFoo_FOO = PREFIXFoo{ /* .a = */ 42, /* .b = */ 47 };
+
+constexpr static const PREFIXFoo PREFIXBAR = PREFIXFoo{ /* .a = */ 42, /* .b = */ 1337 };
+
+extern "C" {
+
+void root(PREFIXFoo x);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.pyx b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.pyx
rename to cbindgen-0.27.0/tests/expectations/prefixed_struct_literal.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.both.c b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.both.c
rename to cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_both.compat.c b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_both.compat.c
new file mode 100644
index 0000000..71cfa35
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_both.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct PREFIXFoo {
+ int32_t a;
+ uint32_t b;
+} PREFIXFoo;
+#define PREFIXFoo_FOO (PREFIXFoo){ .a = 42, .b = 47 }
+
+#define PREFIXBAR (PREFIXFoo){ .a = 42, .b = 1337 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct PREFIXFoo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.c b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.c
rename to cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep.c
diff --git a/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep.compat.c b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep.compat.c
new file mode 100644
index 0000000..e851f9d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep.compat.c
@@ -0,0 +1,26 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ int32_t a;
+} PREFIXBar;
+
+typedef struct {
+ int32_t a;
+ uint32_t b;
+ PREFIXBar bar;
+} PREFIXFoo;
+
+#define PREFIXVAL (PREFIXFoo){ .a = 42, .b = 1337, .bar = (PREFIXBar){ .a = 323 } }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(PREFIXFoo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep.cpp b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep.cpp
new file mode 100644
index 0000000..bd883f6
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep.cpp
@@ -0,0 +1,23 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct PREFIXBar {
+ int32_t a;
+};
+
+struct PREFIXFoo {
+ int32_t a;
+ uint32_t b;
+ PREFIXBar bar;
+};
+
+constexpr static const PREFIXFoo PREFIXVAL = PREFIXFoo{ /* .a = */ 42, /* .b = */ 1337, /* .bar = */ PREFIXBar{ /* .a = */ 323 } };
+
+extern "C" {
+
+void root(PREFIXFoo x);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.pyx b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.pyx
rename to cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.both.c b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.both.c
rename to cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep_both.compat.c b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep_both.compat.c
new file mode 100644
index 0000000..273d433
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep_both.compat.c
@@ -0,0 +1,26 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct PREFIXBar {
+ int32_t a;
+} PREFIXBar;
+
+typedef struct PREFIXFoo {
+ int32_t a;
+ uint32_t b;
+ struct PREFIXBar bar;
+} PREFIXFoo;
+
+#define PREFIXVAL (PREFIXFoo){ .a = 42, .b = 1337, .bar = (PREFIXBar){ .a = 323 } }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct PREFIXFoo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.tag.c b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.tag.c
rename to cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep_tag.compat.c b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep_tag.compat.c
new file mode 100644
index 0000000..31f038b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep_tag.compat.c
@@ -0,0 +1,26 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct PREFIXBar {
+ int32_t a;
+};
+
+struct PREFIXFoo {
+ int32_t a;
+ uint32_t b;
+ struct PREFIXBar bar;
+};
+
+#define PREFIXVAL (PREFIXFoo){ .a = 42, .b = 1337, .bar = (PREFIXBar){ .a = 323 } }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct PREFIXFoo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.tag.pyx b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefixed_struct_literal_deep.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_deep_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.tag.c b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.tag.c
rename to cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_tag.compat.c b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_tag.compat.c
new file mode 100644
index 0000000..98b5c9d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_tag.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct PREFIXFoo {
+ int32_t a;
+ uint32_t b;
+};
+#define PREFIXFoo_FOO (PREFIXFoo){ .a = 42, .b = 47 }
+
+#define PREFIXBAR (PREFIXFoo){ .a = 42, .b = 1337 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct PREFIXFoo x);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.tag.pyx b/cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/prefixed_struct_literal.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/prefixed_struct_literal_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/ptrs_as_arrays.c b/cbindgen-0.27.0/tests/expectations/ptrs_as_arrays.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/ptrs_as_arrays.c
rename to cbindgen-0.27.0/tests/expectations/ptrs_as_arrays.c
diff --git a/cbindgen-0.27.0/tests/expectations/ptrs_as_arrays.compat.c b/cbindgen-0.27.0/tests/expectations/ptrs_as_arrays.compat.c
new file mode 100644
index 0000000..23dca94
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/ptrs_as_arrays.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void ptr_as_array(uint32_t n, const uint32_t arg[3], const uint64_t *v);
+
+void ptr_as_array1(uint32_t n, const uint32_t arg[3], uint64_t v[4]);
+
+void ptr_as_array2(uint32_t n, uint32_t arg[], const uint64_t v[]);
+
+void ptr_as_array_wrong_syntax(uint32_t *arg, const uint32_t *v, const uint32_t*);
+
+void ptr_as_array_unnamed(uint32_t*, const uint32_t*);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/ptrs_as_arrays.cpp b/cbindgen-0.27.0/tests/expectations/ptrs_as_arrays.cpp
new file mode 100644
index 0000000..41122d8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/ptrs_as_arrays.cpp
@@ -0,0 +1,19 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+void ptr_as_array(uint32_t n, const uint32_t arg[3], const uint64_t *v);
+
+void ptr_as_array1(uint32_t n, const uint32_t arg[3], uint64_t v[4]);
+
+void ptr_as_array2(uint32_t n, uint32_t arg[], const uint64_t v[]);
+
+void ptr_as_array_wrong_syntax(uint32_t *arg, const uint32_t *v, const uint32_t*);
+
+void ptr_as_array_unnamed(uint32_t*, const uint32_t*);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/ptrs_as_arrays.pyx b/cbindgen-0.27.0/tests/expectations/ptrs_as_arrays.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/ptrs_as_arrays.pyx
rename to cbindgen-0.27.0/tests/expectations/ptrs_as_arrays.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/raw_ident.c b/cbindgen-0.27.0/tests/expectations/raw_ident.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/raw_ident.c
rename to cbindgen-0.27.0/tests/expectations/raw_ident.c
diff --git a/cbindgen-0.27.0/tests/expectations/raw_ident.compat.c b/cbindgen-0.27.0/tests/expectations/raw_ident.compat.c
new file mode 100644
index 0000000..a8d1490
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/raw_ident.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum Enum
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ a,
+ b,
+};
+#ifndef __cplusplus
+typedef uint8_t Enum;
+#endif // __cplusplus
+
+typedef struct {
+ Enum field;
+} Struct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern const Enum STATIC;
+
+void fn(Struct arg);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/raw_ident.cpp b/cbindgen-0.27.0/tests/expectations/raw_ident.cpp
new file mode 100644
index 0000000..46d14d5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/raw_ident.cpp
@@ -0,0 +1,22 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+enum class Enum : uint8_t {
+ a,
+ b,
+};
+
+struct Struct {
+ Enum field;
+};
+
+extern "C" {
+
+extern const Enum STATIC;
+
+void fn(Struct arg);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/raw_ident.pyx b/cbindgen-0.27.0/tests/expectations/raw_ident.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/raw_ident.pyx
rename to cbindgen-0.27.0/tests/expectations/raw_ident.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/raw_ident.both.c b/cbindgen-0.27.0/tests/expectations/raw_ident_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/raw_ident.both.c
rename to cbindgen-0.27.0/tests/expectations/raw_ident_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/raw_ident_both.compat.c b/cbindgen-0.27.0/tests/expectations/raw_ident_both.compat.c
new file mode 100644
index 0000000..07f66e8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/raw_ident_both.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum Enum
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ a,
+ b,
+};
+#ifndef __cplusplus
+typedef uint8_t Enum;
+#endif // __cplusplus
+
+typedef struct Struct {
+ Enum field;
+} Struct;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern const Enum STATIC;
+
+void fn(struct Struct arg);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/raw_ident.tag.c b/cbindgen-0.27.0/tests/expectations/raw_ident_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/raw_ident.tag.c
rename to cbindgen-0.27.0/tests/expectations/raw_ident_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/raw_ident_tag.compat.c b/cbindgen-0.27.0/tests/expectations/raw_ident_tag.compat.c
new file mode 100644
index 0000000..afa2458
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/raw_ident_tag.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum Enum
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ a,
+ b,
+};
+#ifndef __cplusplus
+typedef uint8_t Enum;
+#endif // __cplusplus
+
+struct Struct {
+ Enum field;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern const Enum STATIC;
+
+void fn(struct Struct arg);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/raw_ident.tag.pyx b/cbindgen-0.27.0/tests/expectations/raw_ident_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/raw_ident.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/raw_ident_tag.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/raw_lines.c b/cbindgen-0.27.0/tests/expectations/raw_lines.c
new file mode 100644
index 0000000..6f628a5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/raw_lines.c
@@ -0,0 +1,12 @@
+#ifndef INCLUDE_GUARD_H
+#define INCLUDE_GUARD_H
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#define VERSION 1
+
+void root(void);
+
+#endif /* INCLUDE_GUARD_H */
diff --git a/cbindgen-0.27.0/tests/expectations/raw_lines.compat.c b/cbindgen-0.27.0/tests/expectations/raw_lines.compat.c
new file mode 100644
index 0000000..2fc3f9c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/raw_lines.compat.c
@@ -0,0 +1,20 @@
+#ifndef INCLUDE_GUARD_H
+#define INCLUDE_GUARD_H
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#define VERSION 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif /* INCLUDE_GUARD_H */
diff --git a/cbindgen-0.27.0/tests/expectations/raw_lines.cpp b/cbindgen-0.27.0/tests/expectations/raw_lines.cpp
new file mode 100644
index 0000000..cbe9e21
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/raw_lines.cpp
@@ -0,0 +1,17 @@
+#ifndef INCLUDE_GUARD_H
+#define INCLUDE_GUARD_H
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+#define VERSION 1
+
+extern "C" {
+
+void root();
+
+} // extern "C"
+
+#endif // INCLUDE_GUARD_H
diff --git a/cbindgen-0.24.5/tests/expectations/raw_lines.pyx b/cbindgen-0.27.0/tests/expectations/raw_lines.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/raw_lines.pyx
rename to cbindgen-0.27.0/tests/expectations/raw_lines.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/rename.c b/cbindgen-0.27.0/tests/expectations/rename.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/rename.c
rename to cbindgen-0.27.0/tests/expectations/rename.c
diff --git a/cbindgen-0.27.0/tests/expectations/rename.compat.c b/cbindgen-0.27.0/tests/expectations/rename.compat.c
new file mode 100644
index 0000000..75f6644
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/rename.compat.c
@@ -0,0 +1,48 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define C_H 10
+
+enum C_E
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ x = 0,
+ y = 1,
+};
+#ifndef __cplusplus
+typedef uint8_t C_E;
+#endif // __cplusplus
+
+typedef struct C_A C_A;
+
+typedef struct C_C C_C;
+
+typedef struct {
+ int32_t x;
+ float y;
+} C_AwesomeB;
+
+typedef union {
+ int32_t x;
+ float y;
+} C_D;
+
+typedef C_A C_F;
+
+#define C_I (intptr_t)(C_F*)10
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern const int32_t G;
+
+void root(const C_A *a, C_AwesomeB b, C_C c, C_D d, C_E e, C_F f);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/rename.cpp b/cbindgen-0.27.0/tests/expectations/rename.cpp
new file mode 100644
index 0000000..e27a636
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/rename.cpp
@@ -0,0 +1,38 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+constexpr static const int32_t C_H = 10;
+
+enum class C_E : uint8_t {
+ x = 0,
+ y = 1,
+};
+
+struct C_A;
+
+struct C_C;
+
+struct C_AwesomeB {
+ int32_t x;
+ float y;
+};
+
+union C_D {
+ int32_t x;
+ float y;
+};
+
+using C_F = C_A;
+
+static const intptr_t C_I = (intptr_t)(C_F*)10;
+
+extern "C" {
+
+extern const int32_t G;
+
+void root(const C_A *a, C_AwesomeB b, C_C c, C_D d, C_E e, C_F f);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/rename.pyx b/cbindgen-0.27.0/tests/expectations/rename.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/rename.pyx
rename to cbindgen-0.27.0/tests/expectations/rename.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/rename.both.c b/cbindgen-0.27.0/tests/expectations/rename_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/rename.both.c
rename to cbindgen-0.27.0/tests/expectations/rename_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/rename_both.compat.c b/cbindgen-0.27.0/tests/expectations/rename_both.compat.c
new file mode 100644
index 0000000..9361e68
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/rename_both.compat.c
@@ -0,0 +1,48 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define C_H 10
+
+enum C_E
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ x = 0,
+ y = 1,
+};
+#ifndef __cplusplus
+typedef uint8_t C_E;
+#endif // __cplusplus
+
+typedef struct C_A C_A;
+
+typedef struct C_C C_C;
+
+typedef struct C_AwesomeB {
+ int32_t x;
+ float y;
+} C_AwesomeB;
+
+typedef union C_D {
+ int32_t x;
+ float y;
+} C_D;
+
+typedef struct C_A C_F;
+
+#define C_I (intptr_t)(C_F*)10
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern const int32_t G;
+
+void root(const struct C_A *a, struct C_AwesomeB b, struct C_C c, union C_D d, C_E e, C_F f);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/rename_case.c b/cbindgen-0.27.0/tests/expectations/rename_case.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/rename_case.c
rename to cbindgen-0.27.0/tests/expectations/rename_case.c
diff --git a/cbindgen-0.27.0/tests/expectations/rename_case.compat.c b/cbindgen-0.27.0/tests/expectations/rename_case.compat.c
new file mode 100644
index 0000000..1d2cb1c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/rename_case.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void test_camel_case(int32_t fooBar);
+
+void test_pascal_case(int32_t FooBar);
+
+void test_snake_case(int32_t foo_bar);
+
+void test_screaming_snake_case(int32_t FOO_BAR);
+
+void test_gecko_case(int32_t aFooBar);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/rename_case.cpp b/cbindgen-0.27.0/tests/expectations/rename_case.cpp
new file mode 100644
index 0000000..0d5a6d9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/rename_case.cpp
@@ -0,0 +1,19 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+extern "C" {
+
+void test_camel_case(int32_t fooBar);
+
+void test_pascal_case(int32_t FooBar);
+
+void test_snake_case(int32_t foo_bar);
+
+void test_screaming_snake_case(int32_t FOO_BAR);
+
+void test_gecko_case(int32_t aFooBar);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/rename_case.pyx b/cbindgen-0.27.0/tests/expectations/rename_case.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/rename_case.pyx
rename to cbindgen-0.27.0/tests/expectations/rename_case.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/rename_crate.c b/cbindgen-0.27.0/tests/expectations/rename_crate.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/rename_crate.c
rename to cbindgen-0.27.0/tests/expectations/rename_crate.c
diff --git a/cbindgen-0.27.0/tests/expectations/rename_crate.compat.c b/cbindgen-0.27.0/tests/expectations/rename_crate.compat.c
new file mode 100644
index 0000000..d832e1a
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/rename_crate.compat.c
@@ -0,0 +1,49 @@
+#if 0
+DEF DEFINE_FREEBSD = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ int32_t x;
+} Foo;
+
+typedef struct {
+ uint64_t y;
+} RenamedTy;
+
+#if !defined(DEFINE_FREEBSD)
+typedef struct {
+ uint8_t field;
+} NoExternTy;
+#endif
+
+#if !defined(DEFINE_FREEBSD)
+typedef struct {
+ NoExternTy field;
+} ContainsNoExternTy;
+#endif
+
+#if defined(DEFINE_FREEBSD)
+typedef struct {
+ uint64_t field;
+} ContainsNoExternTy;
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Foo a);
+
+void renamed_func(RenamedTy a);
+
+void no_extern_func(ContainsNoExternTy a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/rename_crate.cpp b/cbindgen-0.27.0/tests/expectations/rename_crate.cpp
new file mode 100644
index 0000000..80633db
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/rename_crate.cpp
@@ -0,0 +1,46 @@
+#if 0
+DEF DEFINE_FREEBSD = 0
+#endif
+
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Foo {
+ int32_t x;
+};
+
+struct RenamedTy {
+ uint64_t y;
+};
+
+#if !defined(DEFINE_FREEBSD)
+struct NoExternTy {
+ uint8_t field;
+};
+#endif
+
+#if !defined(DEFINE_FREEBSD)
+struct ContainsNoExternTy {
+ NoExternTy field;
+};
+#endif
+
+#if defined(DEFINE_FREEBSD)
+struct ContainsNoExternTy {
+ uint64_t field;
+};
+#endif
+
+extern "C" {
+
+void root(Foo a);
+
+void renamed_func(RenamedTy a);
+
+void no_extern_func(ContainsNoExternTy a);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/rename_crate.pyx b/cbindgen-0.27.0/tests/expectations/rename_crate.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/rename_crate.pyx
rename to cbindgen-0.27.0/tests/expectations/rename_crate.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/rename_crate.both.c b/cbindgen-0.27.0/tests/expectations/rename_crate_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/rename_crate.both.c
rename to cbindgen-0.27.0/tests/expectations/rename_crate_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/rename_crate_both.compat.c b/cbindgen-0.27.0/tests/expectations/rename_crate_both.compat.c
new file mode 100644
index 0000000..0f16353
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/rename_crate_both.compat.c
@@ -0,0 +1,49 @@
+#if 0
+DEF DEFINE_FREEBSD = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo {
+ int32_t x;
+} Foo;
+
+typedef struct RenamedTy {
+ uint64_t y;
+} RenamedTy;
+
+#if !defined(DEFINE_FREEBSD)
+typedef struct NoExternTy {
+ uint8_t field;
+} NoExternTy;
+#endif
+
+#if !defined(DEFINE_FREEBSD)
+typedef struct ContainsNoExternTy {
+ struct NoExternTy field;
+} ContainsNoExternTy;
+#endif
+
+#if defined(DEFINE_FREEBSD)
+typedef struct ContainsNoExternTy {
+ uint64_t field;
+} ContainsNoExternTy;
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo a);
+
+void renamed_func(struct RenamedTy a);
+
+void no_extern_func(struct ContainsNoExternTy a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/rename_crate.tag.c b/cbindgen-0.27.0/tests/expectations/rename_crate_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/rename_crate.tag.c
rename to cbindgen-0.27.0/tests/expectations/rename_crate_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/rename_crate_tag.compat.c b/cbindgen-0.27.0/tests/expectations/rename_crate_tag.compat.c
new file mode 100644
index 0000000..bcf649c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/rename_crate_tag.compat.c
@@ -0,0 +1,49 @@
+#if 0
+DEF DEFINE_FREEBSD = 0
+#endif
+
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo {
+ int32_t x;
+};
+
+struct RenamedTy {
+ uint64_t y;
+};
+
+#if !defined(DEFINE_FREEBSD)
+struct NoExternTy {
+ uint8_t field;
+};
+#endif
+
+#if !defined(DEFINE_FREEBSD)
+struct ContainsNoExternTy {
+ struct NoExternTy field;
+};
+#endif
+
+#if defined(DEFINE_FREEBSD)
+struct ContainsNoExternTy {
+ uint64_t field;
+};
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo a);
+
+void renamed_func(struct RenamedTy a);
+
+void no_extern_func(struct ContainsNoExternTy a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/rename_crate.tag.pyx b/cbindgen-0.27.0/tests/expectations/rename_crate_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/rename_crate.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/rename_crate_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/rename.tag.c b/cbindgen-0.27.0/tests/expectations/rename_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/rename.tag.c
rename to cbindgen-0.27.0/tests/expectations/rename_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/rename_tag.compat.c b/cbindgen-0.27.0/tests/expectations/rename_tag.compat.c
new file mode 100644
index 0000000..e952b49
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/rename_tag.compat.c
@@ -0,0 +1,48 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define C_H 10
+
+enum C_E
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ x = 0,
+ y = 1,
+};
+#ifndef __cplusplus
+typedef uint8_t C_E;
+#endif // __cplusplus
+
+struct C_A;
+
+struct C_C;
+
+struct C_AwesomeB {
+ int32_t x;
+ float y;
+};
+
+union C_D {
+ int32_t x;
+ float y;
+};
+
+typedef struct C_A C_F;
+
+#define C_I (intptr_t)(C_F*)10
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern const int32_t G;
+
+void root(const struct C_A *a, struct C_AwesomeB b, struct C_C c, union C_D d, C_E e, C_F f);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/rename.tag.pyx b/cbindgen-0.27.0/tests/expectations/rename_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/rename.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/rename_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.c b/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.c
rename to cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing.c
diff --git a/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing.compat.c b/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing.compat.c
new file mode 100644
index 0000000..be8ad66
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing.compat.c
@@ -0,0 +1,21 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct StyleA StyleA;
+
+typedef struct {
+ int32_t x;
+ float y;
+} B;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const StyleA *a, B b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing.cpp b/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing.cpp
new file mode 100644
index 0000000..e31c3b8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing.cpp
@@ -0,0 +1,18 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct StyleA;
+
+struct B {
+ int32_t x;
+ float y;
+};
+
+extern "C" {
+
+void root(const StyleA *a, B b);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.pyx b/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.pyx
rename to cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.both.c b/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.both.c
rename to cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing_both.compat.c b/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing_both.compat.c
new file mode 100644
index 0000000..d7dd5c5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing_both.compat.c
@@ -0,0 +1,21 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct StyleA StyleA;
+
+typedef struct B {
+ int32_t x;
+ float y;
+} B;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const struct StyleA *a, struct B b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.tag.c b/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.tag.c
rename to cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing_tag.compat.c b/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing_tag.compat.c
new file mode 100644
index 0000000..8f6e7df
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing_tag.compat.c
@@ -0,0 +1,21 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct StyleA;
+
+struct B {
+ int32_t x;
+ float y;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const struct StyleA *a, struct B b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.tag.pyx b/cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/renaming_overrides_prefixing.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/renaming_overrides_prefixing_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/reserved.c b/cbindgen-0.27.0/tests/expectations/reserved.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/reserved.c
rename to cbindgen-0.27.0/tests/expectations/reserved.c
diff --git a/cbindgen-0.27.0/tests/expectations/reserved.compat.c b/cbindgen-0.27.0/tests/expectations/reserved.compat.c
new file mode 100644
index 0000000..ecdade3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/reserved.compat.c
@@ -0,0 +1,95 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ int32_t namespace_;
+ float float_;
+} A;
+
+typedef struct {
+ int32_t namespace_;
+ float float_;
+} B;
+
+enum C_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ D,
+};
+#ifndef __cplusplus
+typedef uint8_t C_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ int32_t namespace_;
+ float float_;
+} D_Body;
+
+typedef struct {
+ C_Tag tag;
+ union {
+ D_Body d;
+ };
+} C;
+
+enum E_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Double,
+ Float,
+};
+#ifndef __cplusplus
+typedef uint8_t E_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ E_Tag tag;
+ union {
+ struct {
+ double double_;
+ };
+ struct {
+ float float_;
+ };
+ };
+} E;
+
+enum F_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ double_,
+ float_,
+};
+#ifndef __cplusplus
+typedef uint8_t F_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ F_Tag tag;
+ union {
+ struct {
+ double double_;
+ };
+ struct {
+ float float_;
+ };
+ };
+} F;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(A a, B b, C c, E e, F f, int32_t namespace_, float float_);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/reserved.cpp b/cbindgen-0.27.0/tests/expectations/reserved.cpp
new file mode 100644
index 0000000..4883eb2
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/reserved.cpp
@@ -0,0 +1,79 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct A {
+ int32_t namespace_;
+ float float_;
+};
+
+struct B {
+ int32_t namespace_;
+ float float_;
+};
+
+struct C {
+ enum class Tag : uint8_t {
+ D,
+ };
+
+ struct D_Body {
+ int32_t namespace_;
+ float float_;
+ };
+
+ Tag tag;
+ union {
+ D_Body d;
+ };
+};
+
+struct E {
+ enum class Tag : uint8_t {
+ Double,
+ Float,
+ };
+
+ struct Double_Body {
+ double _0;
+ };
+
+ struct Float_Body {
+ float _0;
+ };
+
+ Tag tag;
+ union {
+ Double_Body double_;
+ Float_Body float_;
+ };
+};
+
+struct F {
+ enum class Tag : uint8_t {
+ double_,
+ float_,
+ };
+
+ struct double_Body {
+ double _0;
+ };
+
+ struct float_Body {
+ float _0;
+ };
+
+ Tag tag;
+ union {
+ double_Body double_;
+ float_Body float_;
+ };
+};
+
+extern "C" {
+
+void root(A a, B b, C c, E e, F f, int32_t namespace_, float float_);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/reserved.pyx b/cbindgen-0.27.0/tests/expectations/reserved.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/reserved.pyx
rename to cbindgen-0.27.0/tests/expectations/reserved.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/reserved.both.c b/cbindgen-0.27.0/tests/expectations/reserved_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/reserved.both.c
rename to cbindgen-0.27.0/tests/expectations/reserved_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/reserved_both.compat.c b/cbindgen-0.27.0/tests/expectations/reserved_both.compat.c
new file mode 100644
index 0000000..702a1b7
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/reserved_both.compat.c
@@ -0,0 +1,101 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct A {
+ int32_t namespace_;
+ float float_;
+} A;
+
+typedef struct B {
+ int32_t namespace_;
+ float float_;
+} B;
+
+enum C_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ D,
+};
+#ifndef __cplusplus
+typedef uint8_t C_Tag;
+#endif // __cplusplus
+
+typedef struct D_Body {
+ int32_t namespace_;
+ float float_;
+} D_Body;
+
+typedef struct C {
+ C_Tag tag;
+ union {
+ D_Body d;
+ };
+} C;
+
+enum E_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Double,
+ Float,
+};
+#ifndef __cplusplus
+typedef uint8_t E_Tag;
+#endif // __cplusplus
+
+typedef struct E {
+ E_Tag tag;
+ union {
+ struct {
+ double double_;
+ };
+ struct {
+ float float_;
+ };
+ };
+} E;
+
+enum F_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ double_,
+ float_,
+};
+#ifndef __cplusplus
+typedef uint8_t F_Tag;
+#endif // __cplusplus
+
+typedef struct F {
+ F_Tag tag;
+ union {
+ struct {
+ double double_;
+ };
+ struct {
+ float float_;
+ };
+ };
+} F;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct A a,
+ struct B b,
+ struct C c,
+ struct E e,
+ struct F f,
+ int32_t namespace_,
+ float float_);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/reserved.tag.c b/cbindgen-0.27.0/tests/expectations/reserved_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/reserved.tag.c
rename to cbindgen-0.27.0/tests/expectations/reserved_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/reserved_tag.compat.c b/cbindgen-0.27.0/tests/expectations/reserved_tag.compat.c
new file mode 100644
index 0000000..0ce3ee2
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/reserved_tag.compat.c
@@ -0,0 +1,101 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct A {
+ int32_t namespace_;
+ float float_;
+};
+
+struct B {
+ int32_t namespace_;
+ float float_;
+};
+
+enum C_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ D,
+};
+#ifndef __cplusplus
+typedef uint8_t C_Tag;
+#endif // __cplusplus
+
+struct D_Body {
+ int32_t namespace_;
+ float float_;
+};
+
+struct C {
+ C_Tag tag;
+ union {
+ struct D_Body d;
+ };
+};
+
+enum E_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Double,
+ Float,
+};
+#ifndef __cplusplus
+typedef uint8_t E_Tag;
+#endif // __cplusplus
+
+struct E {
+ E_Tag tag;
+ union {
+ struct {
+ double double_;
+ };
+ struct {
+ float float_;
+ };
+ };
+};
+
+enum F_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ double_,
+ float_,
+};
+#ifndef __cplusplus
+typedef uint8_t F_Tag;
+#endif // __cplusplus
+
+struct F {
+ F_Tag tag;
+ union {
+ struct {
+ double double_;
+ };
+ struct {
+ float float_;
+ };
+ };
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct A a,
+ struct B b,
+ struct C c,
+ struct E e,
+ struct F f,
+ int32_t namespace_,
+ float float_);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/reserved.tag.pyx b/cbindgen-0.27.0/tests/expectations/reserved_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/reserved.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/reserved_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/sentinel.c b/cbindgen-0.27.0/tests/expectations/sentinel.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/sentinel.c
rename to cbindgen-0.27.0/tests/expectations/sentinel.c
diff --git a/cbindgen-0.27.0/tests/expectations/sentinel.compat.c b/cbindgen-0.27.0/tests/expectations/sentinel.compat.c
new file mode 100644
index 0000000..124b06e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/sentinel.compat.c
@@ -0,0 +1,81 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum A
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ A_A1,
+ A_A2,
+ A_A3,
+ /**
+ * Must be last for serialization purposes
+ */
+ A_Sentinel,
+};
+#ifndef __cplusplus
+typedef uint8_t A;
+#endif // __cplusplus
+
+enum B
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ B_B1,
+ B_B2,
+ B_B3,
+ /**
+ * Must be last for serialization purposes
+ */
+ B_Sentinel,
+};
+#ifndef __cplusplus
+typedef uint8_t B;
+#endif // __cplusplus
+
+enum C_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ C_C1,
+ C_C2,
+ C_C3,
+ /**
+ * Must be last for serialization purposes
+ */
+ C_Sentinel,
+};
+#ifndef __cplusplus
+typedef uint8_t C_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ C_Tag tag;
+ uint32_t a;
+} C_C1_Body;
+
+typedef struct {
+ C_Tag tag;
+ uint32_t b;
+} C_C2_Body;
+
+typedef union {
+ C_Tag tag;
+ C_C1_Body c1;
+ C_C2_Body c2;
+} C;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(A a, B b, C c);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/sentinel.cpp b/cbindgen-0.27.0/tests/expectations/sentinel.cpp
new file mode 100644
index 0000000..db0a5e6
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/sentinel.cpp
@@ -0,0 +1,53 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+enum class A : uint8_t {
+ A_A1,
+ A_A2,
+ A_A3,
+ /// Must be last for serialization purposes
+ A_Sentinel,
+};
+
+enum class B : uint8_t {
+ B_B1,
+ B_B2,
+ B_B3,
+ /// Must be last for serialization purposes
+ B_Sentinel,
+};
+
+union C {
+ enum class Tag : uint8_t {
+ C_C1,
+ C_C2,
+ C_C3,
+ /// Must be last for serialization purposes
+ C_Sentinel,
+ };
+
+ struct C_C1_Body {
+ Tag tag;
+ uint32_t a;
+ };
+
+ struct C_C2_Body {
+ Tag tag;
+ uint32_t b;
+ };
+
+ struct {
+ Tag tag;
+ };
+ C_C1_Body c1;
+ C_C2_Body c2;
+};
+
+extern "C" {
+
+void root(A a, B b, C c);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/sentinel.pyx b/cbindgen-0.27.0/tests/expectations/sentinel.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/sentinel.pyx
rename to cbindgen-0.27.0/tests/expectations/sentinel.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/sentinel.both.c b/cbindgen-0.27.0/tests/expectations/sentinel_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/sentinel.both.c
rename to cbindgen-0.27.0/tests/expectations/sentinel_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/sentinel_both.compat.c b/cbindgen-0.27.0/tests/expectations/sentinel_both.compat.c
new file mode 100644
index 0000000..ac26146
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/sentinel_both.compat.c
@@ -0,0 +1,81 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum A
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ A_A1,
+ A_A2,
+ A_A3,
+ /**
+ * Must be last for serialization purposes
+ */
+ A_Sentinel,
+};
+#ifndef __cplusplus
+typedef uint8_t A;
+#endif // __cplusplus
+
+enum B
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ B_B1,
+ B_B2,
+ B_B3,
+ /**
+ * Must be last for serialization purposes
+ */
+ B_Sentinel,
+};
+#ifndef __cplusplus
+typedef uint8_t B;
+#endif // __cplusplus
+
+enum C_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ C_C1,
+ C_C2,
+ C_C3,
+ /**
+ * Must be last for serialization purposes
+ */
+ C_Sentinel,
+};
+#ifndef __cplusplus
+typedef uint8_t C_Tag;
+#endif // __cplusplus
+
+typedef struct C_C1_Body {
+ C_Tag tag;
+ uint32_t a;
+} C_C1_Body;
+
+typedef struct C_C2_Body {
+ C_Tag tag;
+ uint32_t b;
+} C_C2_Body;
+
+typedef union C {
+ C_Tag tag;
+ C_C1_Body c1;
+ C_C2_Body c2;
+} C;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(A a, B b, union C c);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/sentinel.tag.c b/cbindgen-0.27.0/tests/expectations/sentinel_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/sentinel.tag.c
rename to cbindgen-0.27.0/tests/expectations/sentinel_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/sentinel_tag.compat.c b/cbindgen-0.27.0/tests/expectations/sentinel_tag.compat.c
new file mode 100644
index 0000000..e4dac92
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/sentinel_tag.compat.c
@@ -0,0 +1,81 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum A
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ A_A1,
+ A_A2,
+ A_A3,
+ /**
+ * Must be last for serialization purposes
+ */
+ A_Sentinel,
+};
+#ifndef __cplusplus
+typedef uint8_t A;
+#endif // __cplusplus
+
+enum B
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ B_B1,
+ B_B2,
+ B_B3,
+ /**
+ * Must be last for serialization purposes
+ */
+ B_Sentinel,
+};
+#ifndef __cplusplus
+typedef uint8_t B;
+#endif // __cplusplus
+
+enum C_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ C_C1,
+ C_C2,
+ C_C3,
+ /**
+ * Must be last for serialization purposes
+ */
+ C_Sentinel,
+};
+#ifndef __cplusplus
+typedef uint8_t C_Tag;
+#endif // __cplusplus
+
+struct C_C1_Body {
+ C_Tag tag;
+ uint32_t a;
+};
+
+struct C_C2_Body {
+ C_Tag tag;
+ uint32_t b;
+};
+
+union C {
+ C_Tag tag;
+ struct C_C1_Body c1;
+ struct C_C2_Body c2;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(A a, B b, union C c);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/sentinel.tag.pyx b/cbindgen-0.27.0/tests/expectations/sentinel_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/sentinel.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/sentinel_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.c b/cbindgen-0.27.0/tests/expectations/simplify_option_ptr.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/simplify_option_ptr.c
rename to cbindgen-0.27.0/tests/expectations/simplify_option_ptr.c
diff --git a/cbindgen-0.27.0/tests/expectations/simplify_option_ptr.compat.c b/cbindgen-0.27.0/tests/expectations/simplify_option_ptr.compat.c
new file mode 100644
index 0000000..cd65966
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/simplify_option_ptr.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Opaque Opaque;
+
+typedef struct Option_____Opaque Option_____Opaque;
+
+typedef struct {
+ const Opaque *x;
+ Opaque *y;
+ void (*z)(void);
+ void (**zz)(void);
+} Foo;
+
+typedef union {
+ const Opaque *x;
+ Opaque *y;
+ void (*z)(void);
+ void (**zz)(void);
+} Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Opaque *a, Opaque *b, Foo c, Bar d, Option_____Opaque *e, void (*f)(const Opaque*));
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/simplify_option_ptr.cpp b/cbindgen-0.27.0/tests/expectations/simplify_option_ptr.cpp
new file mode 100644
index 0000000..2373216
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/simplify_option_ptr.cpp
@@ -0,0 +1,30 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Opaque;
+
+template<typename T = void>
+struct Option;
+
+struct Foo {
+ const Opaque *x;
+ Opaque *y;
+ void (*z)();
+ void (**zz)();
+};
+
+union Bar {
+ const Opaque *x;
+ Opaque *y;
+ void (*z)();
+ void (**zz)();
+};
+
+extern "C" {
+
+void root(const Opaque *a, Opaque *b, Foo c, Bar d, Option<Opaque*> *e, void (*f)(const Opaque*));
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.pyx b/cbindgen-0.27.0/tests/expectations/simplify_option_ptr.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/simplify_option_ptr.pyx
rename to cbindgen-0.27.0/tests/expectations/simplify_option_ptr.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.both.c b/cbindgen-0.27.0/tests/expectations/simplify_option_ptr_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/simplify_option_ptr.both.c
rename to cbindgen-0.27.0/tests/expectations/simplify_option_ptr_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/simplify_option_ptr_both.compat.c b/cbindgen-0.27.0/tests/expectations/simplify_option_ptr_both.compat.c
new file mode 100644
index 0000000..2f0fd0b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/simplify_option_ptr_both.compat.c
@@ -0,0 +1,37 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Opaque Opaque;
+
+typedef struct Option_____Opaque Option_____Opaque;
+
+typedef struct Foo {
+ const struct Opaque *x;
+ struct Opaque *y;
+ void (*z)(void);
+ void (**zz)(void);
+} Foo;
+
+typedef union Bar {
+ const struct Opaque *x;
+ struct Opaque *y;
+ void (*z)(void);
+ void (**zz)(void);
+} Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const struct Opaque *a,
+ struct Opaque *b,
+ struct Foo c,
+ union Bar d,
+ struct Option_____Opaque *e,
+ void (*f)(const struct Opaque*));
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.tag.c b/cbindgen-0.27.0/tests/expectations/simplify_option_ptr_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/simplify_option_ptr.tag.c
rename to cbindgen-0.27.0/tests/expectations/simplify_option_ptr_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/simplify_option_ptr_tag.compat.c b/cbindgen-0.27.0/tests/expectations/simplify_option_ptr_tag.compat.c
new file mode 100644
index 0000000..10b9905
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/simplify_option_ptr_tag.compat.c
@@ -0,0 +1,37 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Opaque;
+
+struct Option_____Opaque;
+
+struct Foo {
+ const struct Opaque *x;
+ struct Opaque *y;
+ void (*z)(void);
+ void (**zz)(void);
+};
+
+union Bar {
+ const struct Opaque *x;
+ struct Opaque *y;
+ void (*z)(void);
+ void (**zz)(void);
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const struct Opaque *a,
+ struct Opaque *b,
+ struct Foo c,
+ union Bar d,
+ struct Option_____Opaque *e,
+ void (*f)(const struct Opaque*));
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/simplify_option_ptr.tag.pyx b/cbindgen-0.27.0/tests/expectations/simplify_option_ptr_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/simplify_option_ptr.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/simplify_option_ptr_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/size_types.c b/cbindgen-0.27.0/tests/expectations/size_types.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/size_types.c
rename to cbindgen-0.27.0/tests/expectations/size_types.c
diff --git a/cbindgen-0.27.0/tests/expectations/size_types.compat.c b/cbindgen-0.27.0/tests/expectations/size_types.compat.c
new file mode 100644
index 0000000..4ca5273
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/size_types.compat.c
@@ -0,0 +1,41 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+enum IE
+#ifdef __cplusplus
+ : ptrdiff_t
+#endif // __cplusplus
+ {
+ IV,
+};
+#ifndef __cplusplus
+typedef ptrdiff_t IE;
+#endif // __cplusplus
+
+enum UE
+#ifdef __cplusplus
+ : size_t
+#endif // __cplusplus
+ {
+ UV,
+};
+#ifndef __cplusplus
+typedef size_t UE;
+#endif // __cplusplus
+
+typedef size_t Usize;
+
+typedef ptrdiff_t Isize;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Usize, Isize, UE, IE);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/size_types.cpp b/cbindgen-0.27.0/tests/expectations/size_types.cpp
new file mode 100644
index 0000000..ce7b41c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/size_types.cpp
@@ -0,0 +1,24 @@
+#include <cstdarg>
+#include <cstddef>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+enum class IE : ptrdiff_t {
+ IV,
+};
+
+enum class UE : size_t {
+ UV,
+};
+
+using Usize = size_t;
+
+using Isize = ptrdiff_t;
+
+extern "C" {
+
+void root(Usize, Isize, UE, IE);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/size_types.pyx b/cbindgen-0.27.0/tests/expectations/size_types.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/size_types.pyx
rename to cbindgen-0.27.0/tests/expectations/size_types.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/static.c b/cbindgen-0.27.0/tests/expectations/static.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/static.c
rename to cbindgen-0.27.0/tests/expectations/static.c
diff --git a/cbindgen-0.27.0/tests/expectations/static.compat.c b/cbindgen-0.27.0/tests/expectations/static.compat.c
new file mode 100644
index 0000000..59b485e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/static.compat.c
@@ -0,0 +1,26 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Bar Bar;
+
+typedef struct {
+
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern const int32_t NUMBER;
+
+extern Foo FOO;
+
+extern const Bar BAR;
+
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/static.cpp b/cbindgen-0.27.0/tests/expectations/static.cpp
new file mode 100644
index 0000000..8788846
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/static.cpp
@@ -0,0 +1,23 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Bar;
+
+struct Foo {
+
+};
+
+extern "C" {
+
+extern const int32_t NUMBER;
+
+extern Foo FOO;
+
+extern const Bar BAR;
+
+void root();
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/static.pyx b/cbindgen-0.27.0/tests/expectations/static.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/static.pyx
rename to cbindgen-0.27.0/tests/expectations/static.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/static.both.c b/cbindgen-0.27.0/tests/expectations/static_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/static.both.c
rename to cbindgen-0.27.0/tests/expectations/static_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/static_both.compat.c b/cbindgen-0.27.0/tests/expectations/static_both.compat.c
new file mode 100644
index 0000000..6e1ad02
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/static_both.compat.c
@@ -0,0 +1,26 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Bar Bar;
+
+typedef struct Foo {
+
+} Foo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern const int32_t NUMBER;
+
+extern struct Foo FOO;
+
+extern const struct Bar BAR;
+
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/static.tag.c b/cbindgen-0.27.0/tests/expectations/static_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/static.tag.c
rename to cbindgen-0.27.0/tests/expectations/static_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/static_tag.compat.c b/cbindgen-0.27.0/tests/expectations/static_tag.compat.c
new file mode 100644
index 0000000..56bcde9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/static_tag.compat.c
@@ -0,0 +1,26 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Bar;
+
+struct Foo {
+
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+extern const int32_t NUMBER;
+
+extern struct Foo FOO;
+
+extern const struct Bar BAR;
+
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/static.tag.pyx b/cbindgen-0.27.0/tests/expectations/static_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/static.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/static_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/std_lib.c b/cbindgen-0.27.0/tests/expectations/std_lib.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/std_lib.c
rename to cbindgen-0.27.0/tests/expectations/std_lib.c
diff --git a/cbindgen-0.27.0/tests/expectations/std_lib.compat.c b/cbindgen-0.27.0/tests/expectations/std_lib.compat.c
new file mode 100644
index 0000000..6ef97bb
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/std_lib.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Option_i32 Option_i32;
+
+typedef struct Result_i32__String Result_i32__String;
+
+typedef struct Vec_String Vec_String;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const Vec_String *a, const Option_i32 *b, const Result_i32__String *c);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/std_lib.cpp b/cbindgen-0.27.0/tests/expectations/std_lib.cpp
new file mode 100644
index 0000000..2af7c14
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/std_lib.cpp
@@ -0,0 +1,22 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T = void>
+struct Option;
+
+template<typename T = void, typename E = void>
+struct Result;
+
+struct String;
+
+template<typename T = void>
+struct Vec;
+
+extern "C" {
+
+void root(const Vec<String> *a, const Option<int32_t> *b, const Result<int32_t, String> *c);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/std_lib.pyx b/cbindgen-0.27.0/tests/expectations/std_lib.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/std_lib.pyx
rename to cbindgen-0.27.0/tests/expectations/std_lib.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/std_lib.both.c b/cbindgen-0.27.0/tests/expectations/std_lib_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/std_lib.both.c
rename to cbindgen-0.27.0/tests/expectations/std_lib_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/std_lib_both.compat.c b/cbindgen-0.27.0/tests/expectations/std_lib_both.compat.c
new file mode 100644
index 0000000..53f9ead
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/std_lib_both.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Option_i32 Option_i32;
+
+typedef struct Result_i32__String Result_i32__String;
+
+typedef struct Vec_String Vec_String;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const struct Vec_String *a,
+ const struct Option_i32 *b,
+ const struct Result_i32__String *c);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/std_lib.tag.c b/cbindgen-0.27.0/tests/expectations/std_lib_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/std_lib.tag.c
rename to cbindgen-0.27.0/tests/expectations/std_lib_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/std_lib_tag.compat.c b/cbindgen-0.27.0/tests/expectations/std_lib_tag.compat.c
new file mode 100644
index 0000000..74a8c14
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/std_lib_tag.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Option_i32;
+
+struct Result_i32__String;
+
+struct Vec_String;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(const struct Vec_String *a,
+ const struct Option_i32 *b,
+ const struct Result_i32__String *c);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/std_lib.tag.pyx b/cbindgen-0.27.0/tests/expectations/std_lib_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/std_lib.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/std_lib_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/struct.c b/cbindgen-0.27.0/tests/expectations/struct.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct.c
rename to cbindgen-0.27.0/tests/expectations/struct.c
diff --git a/cbindgen-0.27.0/tests/expectations/struct.compat.c b/cbindgen-0.27.0/tests/expectations/struct.compat.c
new file mode 100644
index 0000000..fd82fcd
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct.compat.c
@@ -0,0 +1,36 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Opaque Opaque;
+
+typedef struct {
+ int32_t x;
+ float y;
+} Normal;
+
+typedef struct {
+ int32_t x;
+ float y;
+} NormalWithZST;
+
+typedef struct {
+ int32_t m0;
+ float m1;
+} TupleRenamed;
+
+typedef struct {
+ int32_t x;
+ float y;
+} TupleNamed;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Opaque *a, Normal b, NormalWithZST c, TupleRenamed d, TupleNamed e);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/struct.cpp b/cbindgen-0.27.0/tests/expectations/struct.cpp
new file mode 100644
index 0000000..4fe0340
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct.cpp
@@ -0,0 +1,33 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Opaque;
+
+struct Normal {
+ int32_t x;
+ float y;
+};
+
+struct NormalWithZST {
+ int32_t x;
+ float y;
+};
+
+struct TupleRenamed {
+ int32_t m0;
+ float m1;
+};
+
+struct TupleNamed {
+ int32_t x;
+ float y;
+};
+
+extern "C" {
+
+void root(Opaque *a, Normal b, NormalWithZST c, TupleRenamed d, TupleNamed e);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/struct.pyx b/cbindgen-0.27.0/tests/expectations/struct.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct.pyx
rename to cbindgen-0.27.0/tests/expectations/struct.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/struct.both.c b/cbindgen-0.27.0/tests/expectations/struct_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct.both.c
rename to cbindgen-0.27.0/tests/expectations/struct_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/struct_both.compat.c b/cbindgen-0.27.0/tests/expectations/struct_both.compat.c
new file mode 100644
index 0000000..ee0f4c7
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_both.compat.c
@@ -0,0 +1,40 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Opaque Opaque;
+
+typedef struct Normal {
+ int32_t x;
+ float y;
+} Normal;
+
+typedef struct NormalWithZST {
+ int32_t x;
+ float y;
+} NormalWithZST;
+
+typedef struct TupleRenamed {
+ int32_t m0;
+ float m1;
+} TupleRenamed;
+
+typedef struct TupleNamed {
+ int32_t x;
+ float y;
+} TupleNamed;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Opaque *a,
+ struct Normal b,
+ struct NormalWithZST c,
+ struct TupleRenamed d,
+ struct TupleNamed e);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal.c b/cbindgen-0.27.0/tests/expectations/struct_literal.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_literal.c
rename to cbindgen-0.27.0/tests/expectations/struct_literal.c
diff --git a/cbindgen-0.27.0/tests/expectations/struct_literal.compat.c b/cbindgen-0.27.0/tests/expectations/struct_literal.compat.c
new file mode 100644
index 0000000..9478cc9
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_literal.compat.c
@@ -0,0 +1,29 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Bar Bar;
+
+typedef struct {
+ int32_t a;
+ uint32_t b;
+} Foo;
+#define Foo_FOO (Foo){ .a = 42, .b = 47 }
+#define Foo_FOO2 (Foo){ .a = 42, .b = 47 }
+#define Foo_FOO3 (Foo){ .a = 42, .b = 47 }
+
+
+#define BAR (Foo){ .a = 42, .b = 1337 }
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Foo x, Bar bar);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/struct_literal.cpp b/cbindgen-0.27.0/tests/expectations/struct_literal.cpp
new file mode 100644
index 0000000..678cf93
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_literal.cpp
@@ -0,0 +1,26 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Bar;
+
+struct Foo {
+ int32_t a;
+ uint32_t b;
+};
+constexpr static const Foo Foo_FOO = Foo{ /* .a = */ 42, /* .b = */ 47 };
+constexpr static const Foo Foo_FOO2 = Foo{ /* .a = */ 42, /* .b = */ 47 };
+constexpr static const Foo Foo_FOO3 = Foo{ /* .a = */ 42, /* .b = */ 47 };
+
+
+constexpr static const Foo BAR = Foo{ /* .a = */ 42, /* .b = */ 1337 };
+
+
+
+extern "C" {
+
+void root(Foo x, Bar bar);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal.pyx b/cbindgen-0.27.0/tests/expectations/struct_literal.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_literal.pyx
rename to cbindgen-0.27.0/tests/expectations/struct_literal.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal.both.c b/cbindgen-0.27.0/tests/expectations/struct_literal_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_literal.both.c
rename to cbindgen-0.27.0/tests/expectations/struct_literal_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/struct_literal_both.compat.c b/cbindgen-0.27.0/tests/expectations/struct_literal_both.compat.c
new file mode 100644
index 0000000..fc28786
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_literal_both.compat.c
@@ -0,0 +1,29 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Bar Bar;
+
+typedef struct Foo {
+ int32_t a;
+ uint32_t b;
+} Foo;
+#define Foo_FOO (Foo){ .a = 42, .b = 47 }
+#define Foo_FOO2 (Foo){ .a = 42, .b = 47 }
+#define Foo_FOO3 (Foo){ .a = 42, .b = 47 }
+
+
+#define BAR (Foo){ .a = 42, .b = 1337 }
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo x, struct Bar bar);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal_order.c b/cbindgen-0.27.0/tests/expectations/struct_literal_order.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_literal_order.c
rename to cbindgen-0.27.0/tests/expectations/struct_literal_order.c
diff --git a/cbindgen-0.27.0/tests/expectations/struct_literal_order.compat.c b/cbindgen-0.27.0/tests/expectations/struct_literal_order.compat.c
new file mode 100644
index 0000000..6aaa292
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_literal_order.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ float a;
+ uint32_t b;
+ uint32_t c;
+} ABC;
+#define ABC_abc (ABC){ .a = 1.0, .b = 2, .c = 3 }
+#define ABC_bac (ABC){ .a = 1.0, .b = 2, .c = 3 }
+#define ABC_cba (ABC){ .a = 1.0, .b = 2, .c = 3 }
+
+typedef struct {
+ uint32_t b;
+ float a;
+ int32_t c;
+} BAC;
+#define BAC_abc (BAC){ .b = 1, .a = 2.0, .c = 3 }
+#define BAC_bac (BAC){ .b = 1, .a = 2.0, .c = 3 }
+#define BAC_cba (BAC){ .b = 1, .a = 2.0, .c = 3 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(ABC a1, BAC a2);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/struct_literal_order.cpp b/cbindgen-0.27.0/tests/expectations/struct_literal_order.cpp
new file mode 100644
index 0000000..cd38588
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_literal_order.cpp
@@ -0,0 +1,29 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct ABC {
+ float a;
+ uint32_t b;
+ uint32_t c;
+};
+constexpr static const ABC ABC_abc = ABC{ /* .a = */ 1.0, /* .b = */ 2, /* .c = */ 3 };
+constexpr static const ABC ABC_bac = ABC{ /* .a = */ 1.0, /* .b = */ 2, /* .c = */ 3 };
+constexpr static const ABC ABC_cba = ABC{ /* .a = */ 1.0, /* .b = */ 2, /* .c = */ 3 };
+
+struct BAC {
+ uint32_t b;
+ float a;
+ int32_t c;
+};
+constexpr static const BAC BAC_abc = BAC{ /* .b = */ 1, /* .a = */ 2.0, /* .c = */ 3 };
+constexpr static const BAC BAC_bac = BAC{ /* .b = */ 1, /* .a = */ 2.0, /* .c = */ 3 };
+constexpr static const BAC BAC_cba = BAC{ /* .b = */ 1, /* .a = */ 2.0, /* .c = */ 3 };
+
+extern "C" {
+
+void root(ABC a1, BAC a2);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal_order.pyx b/cbindgen-0.27.0/tests/expectations/struct_literal_order.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_literal_order.pyx
rename to cbindgen-0.27.0/tests/expectations/struct_literal_order.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal_order.both.c b/cbindgen-0.27.0/tests/expectations/struct_literal_order_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_literal_order.both.c
rename to cbindgen-0.27.0/tests/expectations/struct_literal_order_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/struct_literal_order_both.compat.c b/cbindgen-0.27.0/tests/expectations/struct_literal_order_both.compat.c
new file mode 100644
index 0000000..7dbc15a
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_literal_order_both.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct ABC {
+ float a;
+ uint32_t b;
+ uint32_t c;
+} ABC;
+#define ABC_abc (ABC){ .a = 1.0, .b = 2, .c = 3 }
+#define ABC_bac (ABC){ .a = 1.0, .b = 2, .c = 3 }
+#define ABC_cba (ABC){ .a = 1.0, .b = 2, .c = 3 }
+
+typedef struct BAC {
+ uint32_t b;
+ float a;
+ int32_t c;
+} BAC;
+#define BAC_abc (BAC){ .b = 1, .a = 2.0, .c = 3 }
+#define BAC_bac (BAC){ .b = 1, .a = 2.0, .c = 3 }
+#define BAC_cba (BAC){ .b = 1, .a = 2.0, .c = 3 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct ABC a1, struct BAC a2);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal_order.tag.c b/cbindgen-0.27.0/tests/expectations/struct_literal_order_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_literal_order.tag.c
rename to cbindgen-0.27.0/tests/expectations/struct_literal_order_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/struct_literal_order_tag.compat.c b/cbindgen-0.27.0/tests/expectations/struct_literal_order_tag.compat.c
new file mode 100644
index 0000000..79e0fc6
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_literal_order_tag.compat.c
@@ -0,0 +1,32 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct ABC {
+ float a;
+ uint32_t b;
+ uint32_t c;
+};
+#define ABC_abc (ABC){ .a = 1.0, .b = 2, .c = 3 }
+#define ABC_bac (ABC){ .a = 1.0, .b = 2, .c = 3 }
+#define ABC_cba (ABC){ .a = 1.0, .b = 2, .c = 3 }
+
+struct BAC {
+ uint32_t b;
+ float a;
+ int32_t c;
+};
+#define BAC_abc (BAC){ .b = 1, .a = 2.0, .c = 3 }
+#define BAC_bac (BAC){ .b = 1, .a = 2.0, .c = 3 }
+#define BAC_cba (BAC){ .b = 1, .a = 2.0, .c = 3 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct ABC a1, struct BAC a2);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal_order.tag.pyx b/cbindgen-0.27.0/tests/expectations/struct_literal_order_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_literal_order.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/struct_literal_order_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal.tag.c b/cbindgen-0.27.0/tests/expectations/struct_literal_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_literal.tag.c
rename to cbindgen-0.27.0/tests/expectations/struct_literal_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/struct_literal_tag.compat.c b/cbindgen-0.27.0/tests/expectations/struct_literal_tag.compat.c
new file mode 100644
index 0000000..2e5bed6
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_literal_tag.compat.c
@@ -0,0 +1,29 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Bar;
+
+struct Foo {
+ int32_t a;
+ uint32_t b;
+};
+#define Foo_FOO (Foo){ .a = 42, .b = 47 }
+#define Foo_FOO2 (Foo){ .a = 42, .b = 47 }
+#define Foo_FOO3 (Foo){ .a = 42, .b = 47 }
+
+
+#define BAR (Foo){ .a = 42, .b = 1337 }
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Foo x, struct Bar bar);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_literal.tag.pyx b/cbindgen-0.27.0/tests/expectations/struct_literal_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_literal.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/struct_literal_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/struct_self.c b/cbindgen-0.27.0/tests/expectations/struct_self.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_self.c
rename to cbindgen-0.27.0/tests/expectations/struct_self.c
diff --git a/cbindgen-0.27.0/tests/expectations/struct_self.compat.c b/cbindgen-0.27.0/tests/expectations/struct_self.compat.c
new file mode 100644
index 0000000..3719db4
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_self.compat.c
@@ -0,0 +1,23 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ const int32_t *something;
+} Foo_Bar;
+
+typedef struct {
+ int32_t something;
+ Foo_Bar subexpressions;
+} Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Bar b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/struct_self.cpp b/cbindgen-0.27.0/tests/expectations/struct_self.cpp
new file mode 100644
index 0000000..37389c7
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_self.cpp
@@ -0,0 +1,21 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T>
+struct Foo {
+ const int32_t *something;
+};
+
+struct Bar {
+ int32_t something;
+ Foo<Bar> subexpressions;
+};
+
+extern "C" {
+
+void root(Bar b);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/struct_self.pyx b/cbindgen-0.27.0/tests/expectations/struct_self.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_self.pyx
rename to cbindgen-0.27.0/tests/expectations/struct_self.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/struct_self.both.c b/cbindgen-0.27.0/tests/expectations/struct_self_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_self.both.c
rename to cbindgen-0.27.0/tests/expectations/struct_self_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/struct_self_both.compat.c b/cbindgen-0.27.0/tests/expectations/struct_self_both.compat.c
new file mode 100644
index 0000000..34c3da4
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_self_both.compat.c
@@ -0,0 +1,23 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo_Bar {
+ const int32_t *something;
+} Foo_Bar;
+
+typedef struct Bar {
+ int32_t something;
+ struct Foo_Bar subexpressions;
+} Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Bar b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_self.tag.c b/cbindgen-0.27.0/tests/expectations/struct_self_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_self.tag.c
rename to cbindgen-0.27.0/tests/expectations/struct_self_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/struct_self_tag.compat.c b/cbindgen-0.27.0/tests/expectations/struct_self_tag.compat.c
new file mode 100644
index 0000000..61fbdf8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_self_tag.compat.c
@@ -0,0 +1,23 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo_Bar {
+ const int32_t *something;
+};
+
+struct Bar {
+ int32_t something;
+ struct Foo_Bar subexpressions;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Bar b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct_self.tag.pyx b/cbindgen-0.27.0/tests/expectations/struct_self_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct_self.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/struct_self_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/struct.tag.c b/cbindgen-0.27.0/tests/expectations/struct_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct.tag.c
rename to cbindgen-0.27.0/tests/expectations/struct_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/struct_tag.compat.c b/cbindgen-0.27.0/tests/expectations/struct_tag.compat.c
new file mode 100644
index 0000000..092007c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/struct_tag.compat.c
@@ -0,0 +1,40 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Opaque;
+
+struct Normal {
+ int32_t x;
+ float y;
+};
+
+struct NormalWithZST {
+ int32_t x;
+ float y;
+};
+
+struct TupleRenamed {
+ int32_t m0;
+ float m1;
+};
+
+struct TupleNamed {
+ int32_t x;
+ float y;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Opaque *a,
+ struct Normal b,
+ struct NormalWithZST c,
+ struct TupleRenamed d,
+ struct TupleNamed e);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/struct.tag.pyx b/cbindgen-0.27.0/tests/expectations/struct_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/struct.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/struct_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/style_crash.compat.c b/cbindgen-0.27.0/tests/expectations/style_crash.compat.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/style_crash.compat.c
rename to cbindgen-0.27.0/tests/expectations/style_crash.compat.c
diff --git a/cbindgen-0.24.5/tests/expectations/style_crash.cpp b/cbindgen-0.27.0/tests/expectations/style_crash.cpp
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/style_crash.cpp
rename to cbindgen-0.27.0/tests/expectations/style_crash.cpp
diff --git a/cbindgen-0.24.5/tests/expectations/style_crash.pyx b/cbindgen-0.27.0/tests/expectations/style_crash.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/style_crash.pyx
rename to cbindgen-0.27.0/tests/expectations/style_crash.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/swift_name.c b/cbindgen-0.27.0/tests/expectations/swift_name.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/swift_name.c
rename to cbindgen-0.27.0/tests/expectations/swift_name.c
diff --git a/cbindgen-0.27.0/tests/expectations/swift_name.compat.c b/cbindgen-0.27.0/tests/expectations/swift_name.compat.c
new file mode 100644
index 0000000..d018ce8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/swift_name.compat.c
@@ -0,0 +1,62 @@
+#define CF_SWIFT_NAME(_name) __attribute__((swift_name(#_name)))
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Opaque Opaque;
+
+typedef struct {
+ uint8_t times;
+} SelfTypeTestStruct;
+
+typedef struct {
+ Opaque *ptr;
+} PointerToOpaque;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void rust_print_hello_world(void) CF_SWIFT_NAME(rust_print_hello_world());
+
+void SelfTypeTestStruct_should_exist_ref(const SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref(self:));
+
+void SelfTypeTestStruct_should_exist_ref_mut(SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref_mut(self:));
+
+void SelfTypeTestStruct_should_not_exist_box(SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_box(self:));
+
+SelfTypeTestStruct *SelfTypeTestStruct_should_not_exist_return_box(void) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_return_box());
+
+void SelfTypeTestStruct_should_exist_annotated_self(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_self(self:));
+
+void SelfTypeTestStruct_should_exist_annotated_mut_self(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_self(self:));
+
+void SelfTypeTestStruct_should_exist_annotated_by_name(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_by_name(self:));
+
+void SelfTypeTestStruct_should_exist_annotated_mut_by_name(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_by_name(self:));
+
+void SelfTypeTestStruct_should_exist_unannotated(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_unannotated(self:));
+
+void SelfTypeTestStruct_should_exist_mut_unannotated(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_mut_unannotated(self:));
+
+void free_function_should_exist_ref(const SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref(test_struct:));
+
+void free_function_should_exist_ref_mut(SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref_mut(test_struct:));
+
+void unnamed_argument(SelfTypeTestStruct*);
+
+void free_function_should_not_exist_box(SelfTypeTestStruct *boxed) CF_SWIFT_NAME(free_function_should_not_exist_box(boxed:));
+
+void free_function_should_exist_annotated_by_name(SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_by_name(test_struct:));
+
+void free_function_should_exist_annotated_mut_by_name(SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_mut_by_name(test_struct:));
+
+PointerToOpaque PointerToOpaque_create(uint8_t times) CF_SWIFT_NAME(PointerToOpaque.create(times:));
+
+void PointerToOpaque_sayHello(PointerToOpaque self) CF_SWIFT_NAME(PointerToOpaque.sayHello(self:));
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/swift_name.cpp b/cbindgen-0.27.0/tests/expectations/swift_name.cpp
new file mode 100644
index 0000000..56d422c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/swift_name.cpp
@@ -0,0 +1,62 @@
+#define CF_SWIFT_NAME(_name) __attribute__((swift_name(#_name)))
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T = void>
+struct Box;
+
+struct Opaque;
+
+struct SelfTypeTestStruct {
+ uint8_t times;
+};
+
+struct PointerToOpaque {
+ Opaque *ptr;
+};
+
+extern "C" {
+
+void rust_print_hello_world() CF_SWIFT_NAME(rust_print_hello_world());
+
+void SelfTypeTestStruct_should_exist_ref(const SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref(self:));
+
+void SelfTypeTestStruct_should_exist_ref_mut(SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref_mut(self:));
+
+void SelfTypeTestStruct_should_not_exist_box(Box<SelfTypeTestStruct> self) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_box(self:));
+
+Box<SelfTypeTestStruct> SelfTypeTestStruct_should_not_exist_return_box() CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_return_box());
+
+void SelfTypeTestStruct_should_exist_annotated_self(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_self(self:));
+
+void SelfTypeTestStruct_should_exist_annotated_mut_self(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_self(self:));
+
+void SelfTypeTestStruct_should_exist_annotated_by_name(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_by_name(self:));
+
+void SelfTypeTestStruct_should_exist_annotated_mut_by_name(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_by_name(self:));
+
+void SelfTypeTestStruct_should_exist_unannotated(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_unannotated(self:));
+
+void SelfTypeTestStruct_should_exist_mut_unannotated(SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_mut_unannotated(self:));
+
+void free_function_should_exist_ref(const SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref(test_struct:));
+
+void free_function_should_exist_ref_mut(SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref_mut(test_struct:));
+
+void unnamed_argument(SelfTypeTestStruct*);
+
+void free_function_should_not_exist_box(Box<SelfTypeTestStruct> boxed) CF_SWIFT_NAME(free_function_should_not_exist_box(boxed:));
+
+void free_function_should_exist_annotated_by_name(SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_by_name(test_struct:));
+
+void free_function_should_exist_annotated_mut_by_name(SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_mut_by_name(test_struct:));
+
+PointerToOpaque PointerToOpaque_create(uint8_t times) CF_SWIFT_NAME(PointerToOpaque.create(times:));
+
+void PointerToOpaque_sayHello(PointerToOpaque self) CF_SWIFT_NAME(PointerToOpaque.sayHello(self:));
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/swift_name.pyx b/cbindgen-0.27.0/tests/expectations/swift_name.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/swift_name.pyx
rename to cbindgen-0.27.0/tests/expectations/swift_name.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/swift_name.both.c b/cbindgen-0.27.0/tests/expectations/swift_name_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/swift_name.both.c
rename to cbindgen-0.27.0/tests/expectations/swift_name_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/swift_name_both.compat.c b/cbindgen-0.27.0/tests/expectations/swift_name_both.compat.c
new file mode 100644
index 0000000..592a8c7
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/swift_name_both.compat.c
@@ -0,0 +1,62 @@
+#define CF_SWIFT_NAME(_name) __attribute__((swift_name(#_name)))
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Opaque Opaque;
+
+typedef struct SelfTypeTestStruct {
+ uint8_t times;
+} SelfTypeTestStruct;
+
+typedef struct PointerToOpaque {
+ struct Opaque *ptr;
+} PointerToOpaque;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void rust_print_hello_world(void) CF_SWIFT_NAME(rust_print_hello_world());
+
+void SelfTypeTestStruct_should_exist_ref(const struct SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref(self:));
+
+void SelfTypeTestStruct_should_exist_ref_mut(struct SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref_mut(self:));
+
+void SelfTypeTestStruct_should_not_exist_box(struct SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_box(self:));
+
+struct SelfTypeTestStruct *SelfTypeTestStruct_should_not_exist_return_box(void) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_return_box());
+
+void SelfTypeTestStruct_should_exist_annotated_self(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_self(self:));
+
+void SelfTypeTestStruct_should_exist_annotated_mut_self(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_self(self:));
+
+void SelfTypeTestStruct_should_exist_annotated_by_name(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_by_name(self:));
+
+void SelfTypeTestStruct_should_exist_annotated_mut_by_name(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_by_name(self:));
+
+void SelfTypeTestStruct_should_exist_unannotated(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_unannotated(self:));
+
+void SelfTypeTestStruct_should_exist_mut_unannotated(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_mut_unannotated(self:));
+
+void free_function_should_exist_ref(const struct SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref(test_struct:));
+
+void free_function_should_exist_ref_mut(struct SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref_mut(test_struct:));
+
+void unnamed_argument(struct SelfTypeTestStruct*);
+
+void free_function_should_not_exist_box(struct SelfTypeTestStruct *boxed) CF_SWIFT_NAME(free_function_should_not_exist_box(boxed:));
+
+void free_function_should_exist_annotated_by_name(struct SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_by_name(test_struct:));
+
+void free_function_should_exist_annotated_mut_by_name(struct SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_mut_by_name(test_struct:));
+
+struct PointerToOpaque PointerToOpaque_create(uint8_t times) CF_SWIFT_NAME(PointerToOpaque.create(times:));
+
+void PointerToOpaque_sayHello(struct PointerToOpaque self) CF_SWIFT_NAME(PointerToOpaque.sayHello(self:));
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/swift_name.tag.c b/cbindgen-0.27.0/tests/expectations/swift_name_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/swift_name.tag.c
rename to cbindgen-0.27.0/tests/expectations/swift_name_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/swift_name_tag.compat.c b/cbindgen-0.27.0/tests/expectations/swift_name_tag.compat.c
new file mode 100644
index 0000000..89b1b2b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/swift_name_tag.compat.c
@@ -0,0 +1,62 @@
+#define CF_SWIFT_NAME(_name) __attribute__((swift_name(#_name)))
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Opaque;
+
+struct SelfTypeTestStruct {
+ uint8_t times;
+};
+
+struct PointerToOpaque {
+ struct Opaque *ptr;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void rust_print_hello_world(void) CF_SWIFT_NAME(rust_print_hello_world());
+
+void SelfTypeTestStruct_should_exist_ref(const struct SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref(self:));
+
+void SelfTypeTestStruct_should_exist_ref_mut(struct SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_ref_mut(self:));
+
+void SelfTypeTestStruct_should_not_exist_box(struct SelfTypeTestStruct *self) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_box(self:));
+
+struct SelfTypeTestStruct *SelfTypeTestStruct_should_not_exist_return_box(void) CF_SWIFT_NAME(SelfTypeTestStruct.should_not_exist_return_box());
+
+void SelfTypeTestStruct_should_exist_annotated_self(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_self(self:));
+
+void SelfTypeTestStruct_should_exist_annotated_mut_self(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_self(self:));
+
+void SelfTypeTestStruct_should_exist_annotated_by_name(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_by_name(self:));
+
+void SelfTypeTestStruct_should_exist_annotated_mut_by_name(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_annotated_mut_by_name(self:));
+
+void SelfTypeTestStruct_should_exist_unannotated(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_unannotated(self:));
+
+void SelfTypeTestStruct_should_exist_mut_unannotated(struct SelfTypeTestStruct self) CF_SWIFT_NAME(SelfTypeTestStruct.should_exist_mut_unannotated(self:));
+
+void free_function_should_exist_ref(const struct SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref(test_struct:));
+
+void free_function_should_exist_ref_mut(struct SelfTypeTestStruct *test_struct) CF_SWIFT_NAME(free_function_should_exist_ref_mut(test_struct:));
+
+void unnamed_argument(struct SelfTypeTestStruct*);
+
+void free_function_should_not_exist_box(struct SelfTypeTestStruct *boxed) CF_SWIFT_NAME(free_function_should_not_exist_box(boxed:));
+
+void free_function_should_exist_annotated_by_name(struct SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_by_name(test_struct:));
+
+void free_function_should_exist_annotated_mut_by_name(struct SelfTypeTestStruct test_struct) CF_SWIFT_NAME(free_function_should_exist_annotated_mut_by_name(test_struct:));
+
+struct PointerToOpaque PointerToOpaque_create(uint8_t times) CF_SWIFT_NAME(PointerToOpaque.create(times:));
+
+void PointerToOpaque_sayHello(struct PointerToOpaque self) CF_SWIFT_NAME(PointerToOpaque.sayHello(self:));
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/swift_name.tag.pyx b/cbindgen-0.27.0/tests/expectations/swift_name_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/swift_name.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/swift_name_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/transform_op.c b/cbindgen-0.27.0/tests/expectations/transform_op.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/transform_op.c
rename to cbindgen-0.27.0/tests/expectations/transform_op.c
diff --git a/cbindgen-0.27.0/tests/expectations/transform_op.compat.c b/cbindgen-0.27.0/tests/expectations/transform_op.compat.c
new file mode 100644
index 0000000..8608b43
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/transform_op.compat.c
@@ -0,0 +1,170 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ int32_t x;
+ int32_t y;
+} StylePoint_i32;
+
+typedef struct {
+ float x;
+ float y;
+} StylePoint_f32;
+
+enum StyleFoo_i32_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo_i32,
+ Bar_i32,
+ Baz_i32,
+ Bazz_i32,
+};
+#ifndef __cplusplus
+typedef uint8_t StyleFoo_i32_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ StyleFoo_i32_Tag tag;
+ int32_t x;
+ StylePoint_i32 y;
+ StylePoint_f32 z;
+} StyleFoo_Body_i32;
+
+typedef union {
+ StyleFoo_i32_Tag tag;
+ StyleFoo_Body_i32 foo;
+ struct {
+ StyleFoo_i32_Tag bar_tag;
+ int32_t bar;
+ };
+ struct {
+ StyleFoo_i32_Tag baz_tag;
+ StylePoint_i32 baz;
+ };
+} StyleFoo_i32;
+
+typedef enum {
+ Bar1_i32,
+ Bar2_i32,
+ Bar3_i32,
+ Bar4_i32,
+} StyleBar_i32_Tag;
+
+typedef struct {
+ int32_t x;
+ StylePoint_i32 y;
+ StylePoint_f32 z;
+ int32_t (*u)(int32_t);
+} StyleBar1_Body_i32;
+
+typedef struct {
+ StyleBar_i32_Tag tag;
+ union {
+ StyleBar1_Body_i32 bar1;
+ struct {
+ int32_t bar2;
+ };
+ struct {
+ StylePoint_i32 bar3;
+ };
+ };
+} StyleBar_i32;
+
+typedef struct {
+ uint32_t x;
+ uint32_t y;
+} StylePoint_u32;
+
+typedef enum {
+ Bar1_u32,
+ Bar2_u32,
+ Bar3_u32,
+ Bar4_u32,
+} StyleBar_u32_Tag;
+
+typedef struct {
+ int32_t x;
+ StylePoint_u32 y;
+ StylePoint_f32 z;
+ int32_t (*u)(int32_t);
+} StyleBar1_Body_u32;
+
+typedef struct {
+ StyleBar_u32_Tag tag;
+ union {
+ StyleBar1_Body_u32 bar1;
+ struct {
+ uint32_t bar2;
+ };
+ struct {
+ StylePoint_u32 bar3;
+ };
+ };
+} StyleBar_u32;
+
+enum StyleBaz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Baz1,
+ Baz2,
+ Baz3,
+};
+#ifndef __cplusplus
+typedef uint8_t StyleBaz_Tag;
+#endif // __cplusplus
+
+typedef union {
+ StyleBaz_Tag tag;
+ struct {
+ StyleBaz_Tag baz1_tag;
+ StyleBar_u32 baz1;
+ };
+ struct {
+ StyleBaz_Tag baz2_tag;
+ StylePoint_i32 baz2;
+ };
+} StyleBaz;
+
+enum StyleTaz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Taz1,
+ Taz2,
+ Taz3,
+};
+#ifndef __cplusplus
+typedef uint8_t StyleTaz_Tag;
+#endif // __cplusplus
+
+typedef struct {
+ StyleTaz_Tag tag;
+ union {
+ struct {
+ StyleBar_u32 taz1;
+ };
+ struct {
+ StyleBaz taz2;
+ };
+ };
+} StyleTaz;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void foo(const StyleFoo_i32 *foo,
+ const StyleBar_i32 *bar,
+ const StyleBaz *baz,
+ const StyleTaz *taz);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/transform_op.cpp b/cbindgen-0.27.0/tests/expectations/transform_op.cpp
new file mode 100644
index 0000000..2d070ba
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/transform_op.cpp
@@ -0,0 +1,393 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+#include <cassert>
+
+template<typename T>
+struct StylePoint {
+ T x;
+ T y;
+};
+
+template<typename T>
+union StyleFoo {
+ enum class Tag : uint8_t {
+ Foo,
+ Bar,
+ Baz,
+ Bazz,
+ };
+
+ struct Foo_Body {
+ Tag tag;
+ int32_t x;
+ StylePoint<T> y;
+ StylePoint<float> z;
+ };
+
+ struct Bar_Body {
+ Tag tag;
+ T _0;
+ };
+
+ struct Baz_Body {
+ Tag tag;
+ StylePoint<T> _0;
+ };
+
+ struct {
+ Tag tag;
+ };
+ Foo_Body foo;
+ Bar_Body bar;
+ Baz_Body baz;
+
+ static StyleFoo Foo(const int32_t &x,
+ const StylePoint<T> &y,
+ const StylePoint<float> &z) {
+ StyleFoo result;
+ ::new (&result.foo.x) (int32_t)(x);
+ ::new (&result.foo.y) (StylePoint<T>)(y);
+ ::new (&result.foo.z) (StylePoint<float>)(z);
+ result.tag = Tag::Foo;
+ return result;
+ }
+
+ bool IsFoo() const {
+ return tag == Tag::Foo;
+ }
+
+ const Foo_Body& AsFoo() const {
+ assert(IsFoo());
+ return foo;
+ }
+
+ Foo_Body& AsFoo() {
+ assert(IsFoo());
+ return foo;
+ }
+
+ static StyleFoo Bar(const T &_0) {
+ StyleFoo result;
+ ::new (&result.bar._0) (T)(_0);
+ result.tag = Tag::Bar;
+ return result;
+ }
+
+ bool IsBar() const {
+ return tag == Tag::Bar;
+ }
+
+ const T& AsBar() const {
+ assert(IsBar());
+ return bar._0;
+ }
+
+ T& AsBar() {
+ assert(IsBar());
+ return bar._0;
+ }
+
+ static StyleFoo Baz(const StylePoint<T> &_0) {
+ StyleFoo result;
+ ::new (&result.baz._0) (StylePoint<T>)(_0);
+ result.tag = Tag::Baz;
+ return result;
+ }
+
+ bool IsBaz() const {
+ return tag == Tag::Baz;
+ }
+
+ const StylePoint<T>& AsBaz() const {
+ assert(IsBaz());
+ return baz._0;
+ }
+
+ StylePoint<T>& AsBaz() {
+ assert(IsBaz());
+ return baz._0;
+ }
+
+ static StyleFoo Bazz() {
+ StyleFoo result;
+ result.tag = Tag::Bazz;
+ return result;
+ }
+
+ bool IsBazz() const {
+ return tag == Tag::Bazz;
+ }
+};
+
+template<typename T>
+struct StyleBar {
+ enum class Tag {
+ Bar1,
+ Bar2,
+ Bar3,
+ Bar4,
+ };
+
+ struct StyleBar1_Body {
+ int32_t x;
+ StylePoint<T> y;
+ StylePoint<float> z;
+ int32_t (*u)(int32_t);
+ };
+
+ struct StyleBar2_Body {
+ T _0;
+ };
+
+ struct StyleBar3_Body {
+ StylePoint<T> _0;
+ };
+
+ Tag tag;
+ union {
+ StyleBar1_Body bar1;
+ StyleBar2_Body bar2;
+ StyleBar3_Body bar3;
+ };
+
+ static StyleBar Bar1(const int32_t &x,
+ const StylePoint<T> &y,
+ const StylePoint<float> &z,
+ int32_t (*&u)(int32_t)) {
+ StyleBar result;
+ ::new (&result.bar1.x) (int32_t)(x);
+ ::new (&result.bar1.y) (StylePoint<T>)(y);
+ ::new (&result.bar1.z) (StylePoint<float>)(z);
+ ::new (&result.bar1.u) (int32_t(*)(int32_t))(u);
+ result.tag = Tag::Bar1;
+ return result;
+ }
+
+ bool IsBar1() const {
+ return tag == Tag::Bar1;
+ }
+
+ const StyleBar1_Body& AsBar1() const {
+ assert(IsBar1());
+ return bar1;
+ }
+
+ StyleBar1_Body& AsBar1() {
+ assert(IsBar1());
+ return bar1;
+ }
+
+ static StyleBar Bar2(const T &_0) {
+ StyleBar result;
+ ::new (&result.bar2._0) (T)(_0);
+ result.tag = Tag::Bar2;
+ return result;
+ }
+
+ bool IsBar2() const {
+ return tag == Tag::Bar2;
+ }
+
+ const T& AsBar2() const {
+ assert(IsBar2());
+ return bar2._0;
+ }
+
+ T& AsBar2() {
+ assert(IsBar2());
+ return bar2._0;
+ }
+
+ static StyleBar Bar3(const StylePoint<T> &_0) {
+ StyleBar result;
+ ::new (&result.bar3._0) (StylePoint<T>)(_0);
+ result.tag = Tag::Bar3;
+ return result;
+ }
+
+ bool IsBar3() const {
+ return tag == Tag::Bar3;
+ }
+
+ const StylePoint<T>& AsBar3() const {
+ assert(IsBar3());
+ return bar3._0;
+ }
+
+ StylePoint<T>& AsBar3() {
+ assert(IsBar3());
+ return bar3._0;
+ }
+
+ static StyleBar Bar4() {
+ StyleBar result;
+ result.tag = Tag::Bar4;
+ return result;
+ }
+
+ bool IsBar4() const {
+ return tag == Tag::Bar4;
+ }
+};
+
+union StyleBaz {
+ enum class Tag : uint8_t {
+ Baz1,
+ Baz2,
+ Baz3,
+ };
+
+ struct Baz1_Body {
+ Tag tag;
+ StyleBar<uint32_t> _0;
+ };
+
+ struct Baz2_Body {
+ Tag tag;
+ StylePoint<int32_t> _0;
+ };
+
+ struct {
+ Tag tag;
+ };
+ Baz1_Body baz1;
+ Baz2_Body baz2;
+
+ static StyleBaz Baz1(const StyleBar<uint32_t> &_0) {
+ StyleBaz result;
+ ::new (&result.baz1._0) (StyleBar<uint32_t>)(_0);
+ result.tag = Tag::Baz1;
+ return result;
+ }
+
+ bool IsBaz1() const {
+ return tag == Tag::Baz1;
+ }
+
+ const StyleBar<uint32_t>& AsBaz1() const {
+ assert(IsBaz1());
+ return baz1._0;
+ }
+
+ StyleBar<uint32_t>& AsBaz1() {
+ assert(IsBaz1());
+ return baz1._0;
+ }
+
+ static StyleBaz Baz2(const StylePoint<int32_t> &_0) {
+ StyleBaz result;
+ ::new (&result.baz2._0) (StylePoint<int32_t>)(_0);
+ result.tag = Tag::Baz2;
+ return result;
+ }
+
+ bool IsBaz2() const {
+ return tag == Tag::Baz2;
+ }
+
+ const StylePoint<int32_t>& AsBaz2() const {
+ assert(IsBaz2());
+ return baz2._0;
+ }
+
+ StylePoint<int32_t>& AsBaz2() {
+ assert(IsBaz2());
+ return baz2._0;
+ }
+
+ static StyleBaz Baz3() {
+ StyleBaz result;
+ result.tag = Tag::Baz3;
+ return result;
+ }
+
+ bool IsBaz3() const {
+ return tag == Tag::Baz3;
+ }
+};
+
+struct StyleTaz {
+ enum class Tag : uint8_t {
+ Taz1,
+ Taz2,
+ Taz3,
+ };
+
+ struct StyleTaz1_Body {
+ StyleBar<uint32_t> _0;
+ };
+
+ struct StyleTaz2_Body {
+ StyleBaz _0;
+ };
+
+ Tag tag;
+ union {
+ StyleTaz1_Body taz1;
+ StyleTaz2_Body taz2;
+ };
+
+ static StyleTaz Taz1(const StyleBar<uint32_t> &_0) {
+ StyleTaz result;
+ ::new (&result.taz1._0) (StyleBar<uint32_t>)(_0);
+ result.tag = Tag::Taz1;
+ return result;
+ }
+
+ bool IsTaz1() const {
+ return tag == Tag::Taz1;
+ }
+
+ const StyleBar<uint32_t>& AsTaz1() const {
+ assert(IsTaz1());
+ return taz1._0;
+ }
+
+ StyleBar<uint32_t>& AsTaz1() {
+ assert(IsTaz1());
+ return taz1._0;
+ }
+
+ static StyleTaz Taz2(const StyleBaz &_0) {
+ StyleTaz result;
+ ::new (&result.taz2._0) (StyleBaz)(_0);
+ result.tag = Tag::Taz2;
+ return result;
+ }
+
+ bool IsTaz2() const {
+ return tag == Tag::Taz2;
+ }
+
+ const StyleBaz& AsTaz2() const {
+ assert(IsTaz2());
+ return taz2._0;
+ }
+
+ StyleBaz& AsTaz2() {
+ assert(IsTaz2());
+ return taz2._0;
+ }
+
+ static StyleTaz Taz3() {
+ StyleTaz result;
+ result.tag = Tag::Taz3;
+ return result;
+ }
+
+ bool IsTaz3() const {
+ return tag == Tag::Taz3;
+ }
+};
+
+extern "C" {
+
+void foo(const StyleFoo<int32_t> *foo,
+ const StyleBar<int32_t> *bar,
+ const StyleBaz *baz,
+ const StyleTaz *taz);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/transform_op.pyx b/cbindgen-0.27.0/tests/expectations/transform_op.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/transform_op.pyx
rename to cbindgen-0.27.0/tests/expectations/transform_op.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/transform_op.both.c b/cbindgen-0.27.0/tests/expectations/transform_op_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/transform_op.both.c
rename to cbindgen-0.27.0/tests/expectations/transform_op_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/transform_op_both.compat.c b/cbindgen-0.27.0/tests/expectations/transform_op_both.compat.c
new file mode 100644
index 0000000..d4ab94d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/transform_op_both.compat.c
@@ -0,0 +1,170 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct StylePoint_i32 {
+ int32_t x;
+ int32_t y;
+} StylePoint_i32;
+
+typedef struct StylePoint_f32 {
+ float x;
+ float y;
+} StylePoint_f32;
+
+enum StyleFoo_i32_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo_i32,
+ Bar_i32,
+ Baz_i32,
+ Bazz_i32,
+};
+#ifndef __cplusplus
+typedef uint8_t StyleFoo_i32_Tag;
+#endif // __cplusplus
+
+typedef struct StyleFoo_Body_i32 {
+ StyleFoo_i32_Tag tag;
+ int32_t x;
+ struct StylePoint_i32 y;
+ struct StylePoint_f32 z;
+} StyleFoo_Body_i32;
+
+typedef union StyleFoo_i32 {
+ StyleFoo_i32_Tag tag;
+ StyleFoo_Body_i32 foo;
+ struct {
+ StyleFoo_i32_Tag bar_tag;
+ int32_t bar;
+ };
+ struct {
+ StyleFoo_i32_Tag baz_tag;
+ struct StylePoint_i32 baz;
+ };
+} StyleFoo_i32;
+
+typedef enum StyleBar_i32_Tag {
+ Bar1_i32,
+ Bar2_i32,
+ Bar3_i32,
+ Bar4_i32,
+} StyleBar_i32_Tag;
+
+typedef struct StyleBar1_Body_i32 {
+ int32_t x;
+ struct StylePoint_i32 y;
+ struct StylePoint_f32 z;
+ int32_t (*u)(int32_t);
+} StyleBar1_Body_i32;
+
+typedef struct StyleBar_i32 {
+ StyleBar_i32_Tag tag;
+ union {
+ StyleBar1_Body_i32 bar1;
+ struct {
+ int32_t bar2;
+ };
+ struct {
+ struct StylePoint_i32 bar3;
+ };
+ };
+} StyleBar_i32;
+
+typedef struct StylePoint_u32 {
+ uint32_t x;
+ uint32_t y;
+} StylePoint_u32;
+
+typedef enum StyleBar_u32_Tag {
+ Bar1_u32,
+ Bar2_u32,
+ Bar3_u32,
+ Bar4_u32,
+} StyleBar_u32_Tag;
+
+typedef struct StyleBar1_Body_u32 {
+ int32_t x;
+ struct StylePoint_u32 y;
+ struct StylePoint_f32 z;
+ int32_t (*u)(int32_t);
+} StyleBar1_Body_u32;
+
+typedef struct StyleBar_u32 {
+ StyleBar_u32_Tag tag;
+ union {
+ StyleBar1_Body_u32 bar1;
+ struct {
+ uint32_t bar2;
+ };
+ struct {
+ struct StylePoint_u32 bar3;
+ };
+ };
+} StyleBar_u32;
+
+enum StyleBaz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Baz1,
+ Baz2,
+ Baz3,
+};
+#ifndef __cplusplus
+typedef uint8_t StyleBaz_Tag;
+#endif // __cplusplus
+
+typedef union StyleBaz {
+ StyleBaz_Tag tag;
+ struct {
+ StyleBaz_Tag baz1_tag;
+ struct StyleBar_u32 baz1;
+ };
+ struct {
+ StyleBaz_Tag baz2_tag;
+ struct StylePoint_i32 baz2;
+ };
+} StyleBaz;
+
+enum StyleTaz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Taz1,
+ Taz2,
+ Taz3,
+};
+#ifndef __cplusplus
+typedef uint8_t StyleTaz_Tag;
+#endif // __cplusplus
+
+typedef struct StyleTaz {
+ StyleTaz_Tag tag;
+ union {
+ struct {
+ struct StyleBar_u32 taz1;
+ };
+ struct {
+ union StyleBaz taz2;
+ };
+ };
+} StyleTaz;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void foo(const union StyleFoo_i32 *foo,
+ const struct StyleBar_i32 *bar,
+ const union StyleBaz *baz,
+ const struct StyleTaz *taz);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/transform_op.tag.c b/cbindgen-0.27.0/tests/expectations/transform_op_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/transform_op.tag.c
rename to cbindgen-0.27.0/tests/expectations/transform_op_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/transform_op_tag.compat.c b/cbindgen-0.27.0/tests/expectations/transform_op_tag.compat.c
new file mode 100644
index 0000000..3e6c48d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/transform_op_tag.compat.c
@@ -0,0 +1,170 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct StylePoint_i32 {
+ int32_t x;
+ int32_t y;
+};
+
+struct StylePoint_f32 {
+ float x;
+ float y;
+};
+
+enum StyleFoo_i32_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Foo_i32,
+ Bar_i32,
+ Baz_i32,
+ Bazz_i32,
+};
+#ifndef __cplusplus
+typedef uint8_t StyleFoo_i32_Tag;
+#endif // __cplusplus
+
+struct StyleFoo_Body_i32 {
+ StyleFoo_i32_Tag tag;
+ int32_t x;
+ struct StylePoint_i32 y;
+ struct StylePoint_f32 z;
+};
+
+union StyleFoo_i32 {
+ StyleFoo_i32_Tag tag;
+ struct StyleFoo_Body_i32 foo;
+ struct {
+ StyleFoo_i32_Tag bar_tag;
+ int32_t bar;
+ };
+ struct {
+ StyleFoo_i32_Tag baz_tag;
+ struct StylePoint_i32 baz;
+ };
+};
+
+enum StyleBar_i32_Tag {
+ Bar1_i32,
+ Bar2_i32,
+ Bar3_i32,
+ Bar4_i32,
+};
+
+struct StyleBar1_Body_i32 {
+ int32_t x;
+ struct StylePoint_i32 y;
+ struct StylePoint_f32 z;
+ int32_t (*u)(int32_t);
+};
+
+struct StyleBar_i32 {
+ enum StyleBar_i32_Tag tag;
+ union {
+ struct StyleBar1_Body_i32 bar1;
+ struct {
+ int32_t bar2;
+ };
+ struct {
+ struct StylePoint_i32 bar3;
+ };
+ };
+};
+
+struct StylePoint_u32 {
+ uint32_t x;
+ uint32_t y;
+};
+
+enum StyleBar_u32_Tag {
+ Bar1_u32,
+ Bar2_u32,
+ Bar3_u32,
+ Bar4_u32,
+};
+
+struct StyleBar1_Body_u32 {
+ int32_t x;
+ struct StylePoint_u32 y;
+ struct StylePoint_f32 z;
+ int32_t (*u)(int32_t);
+};
+
+struct StyleBar_u32 {
+ enum StyleBar_u32_Tag tag;
+ union {
+ struct StyleBar1_Body_u32 bar1;
+ struct {
+ uint32_t bar2;
+ };
+ struct {
+ struct StylePoint_u32 bar3;
+ };
+ };
+};
+
+enum StyleBaz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Baz1,
+ Baz2,
+ Baz3,
+};
+#ifndef __cplusplus
+typedef uint8_t StyleBaz_Tag;
+#endif // __cplusplus
+
+union StyleBaz {
+ StyleBaz_Tag tag;
+ struct {
+ StyleBaz_Tag baz1_tag;
+ struct StyleBar_u32 baz1;
+ };
+ struct {
+ StyleBaz_Tag baz2_tag;
+ struct StylePoint_i32 baz2;
+ };
+};
+
+enum StyleTaz_Tag
+#ifdef __cplusplus
+ : uint8_t
+#endif // __cplusplus
+ {
+ Taz1,
+ Taz2,
+ Taz3,
+};
+#ifndef __cplusplus
+typedef uint8_t StyleTaz_Tag;
+#endif // __cplusplus
+
+struct StyleTaz {
+ StyleTaz_Tag tag;
+ union {
+ struct {
+ struct StyleBar_u32 taz1;
+ };
+ struct {
+ union StyleBaz taz2;
+ };
+ };
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void foo(const union StyleFoo_i32 *foo,
+ const struct StyleBar_i32 *bar,
+ const union StyleBaz *baz,
+ const struct StyleTaz *taz);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/transform_op.tag.pyx b/cbindgen-0.27.0/tests/expectations/transform_op_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/transform_op.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/transform_op_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/transparent.c b/cbindgen-0.27.0/tests/expectations/transparent.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/transparent.c
rename to cbindgen-0.27.0/tests/expectations/transparent.c
diff --git a/cbindgen-0.27.0/tests/expectations/transparent.compat.c b/cbindgen-0.27.0/tests/expectations/transparent.compat.c
new file mode 100644
index 0000000..c271f81
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/transparent.compat.c
@@ -0,0 +1,43 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct DummyStruct DummyStruct;
+
+typedef struct EnumWithAssociatedConstantInImpl EnumWithAssociatedConstantInImpl;
+
+typedef DummyStruct TransparentComplexWrappingStructTuple;
+
+typedef uint32_t TransparentPrimitiveWrappingStructTuple;
+
+typedef DummyStruct TransparentComplexWrappingStructure;
+
+typedef uint32_t TransparentPrimitiveWrappingStructure;
+
+typedef DummyStruct TransparentComplexWrapper_i32;
+
+typedef uint32_t TransparentPrimitiveWrapper_i32;
+
+typedef uint32_t TransparentPrimitiveWithAssociatedConstants;
+#define TransparentPrimitiveWithAssociatedConstants_ZERO 0
+#define TransparentPrimitiveWithAssociatedConstants_ONE 1
+
+#define EnumWithAssociatedConstantInImpl_TEN 10
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(TransparentComplexWrappingStructTuple a,
+ TransparentPrimitiveWrappingStructTuple b,
+ TransparentComplexWrappingStructure c,
+ TransparentPrimitiveWrappingStructure d,
+ TransparentComplexWrapper_i32 e,
+ TransparentPrimitiveWrapper_i32 f,
+ TransparentPrimitiveWithAssociatedConstants g,
+ EnumWithAssociatedConstantInImpl h);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/transparent.cpp b/cbindgen-0.27.0/tests/expectations/transparent.cpp
new file mode 100644
index 0000000..22b5f17
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/transparent.cpp
@@ -0,0 +1,42 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct DummyStruct;
+
+struct EnumWithAssociatedConstantInImpl;
+
+using TransparentComplexWrappingStructTuple = DummyStruct;
+
+using TransparentPrimitiveWrappingStructTuple = uint32_t;
+
+using TransparentComplexWrappingStructure = DummyStruct;
+
+using TransparentPrimitiveWrappingStructure = uint32_t;
+
+template<typename T>
+using TransparentComplexWrapper = DummyStruct;
+
+template<typename T>
+using TransparentPrimitiveWrapper = uint32_t;
+
+using TransparentPrimitiveWithAssociatedConstants = uint32_t;
+constexpr static const TransparentPrimitiveWithAssociatedConstants TransparentPrimitiveWithAssociatedConstants_ZERO = 0;
+constexpr static const TransparentPrimitiveWithAssociatedConstants TransparentPrimitiveWithAssociatedConstants_ONE = 1;
+
+constexpr static const TransparentPrimitiveWrappingStructure EnumWithAssociatedConstantInImpl_TEN = 10;
+
+extern "C" {
+
+void root(TransparentComplexWrappingStructTuple a,
+ TransparentPrimitiveWrappingStructTuple b,
+ TransparentComplexWrappingStructure c,
+ TransparentPrimitiveWrappingStructure d,
+ TransparentComplexWrapper<int32_t> e,
+ TransparentPrimitiveWrapper<int32_t> f,
+ TransparentPrimitiveWithAssociatedConstants g,
+ EnumWithAssociatedConstantInImpl h);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/transparent.pyx b/cbindgen-0.27.0/tests/expectations/transparent.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/transparent.pyx
rename to cbindgen-0.27.0/tests/expectations/transparent.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/transparent.both.c b/cbindgen-0.27.0/tests/expectations/transparent_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/transparent.both.c
rename to cbindgen-0.27.0/tests/expectations/transparent_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/transparent_both.compat.c b/cbindgen-0.27.0/tests/expectations/transparent_both.compat.c
new file mode 100644
index 0000000..8d56046
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/transparent_both.compat.c
@@ -0,0 +1,43 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct DummyStruct DummyStruct;
+
+typedef struct EnumWithAssociatedConstantInImpl EnumWithAssociatedConstantInImpl;
+
+typedef struct DummyStruct TransparentComplexWrappingStructTuple;
+
+typedef uint32_t TransparentPrimitiveWrappingStructTuple;
+
+typedef struct DummyStruct TransparentComplexWrappingStructure;
+
+typedef uint32_t TransparentPrimitiveWrappingStructure;
+
+typedef struct DummyStruct TransparentComplexWrapper_i32;
+
+typedef uint32_t TransparentPrimitiveWrapper_i32;
+
+typedef uint32_t TransparentPrimitiveWithAssociatedConstants;
+#define TransparentPrimitiveWithAssociatedConstants_ZERO 0
+#define TransparentPrimitiveWithAssociatedConstants_ONE 1
+
+#define EnumWithAssociatedConstantInImpl_TEN 10
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(TransparentComplexWrappingStructTuple a,
+ TransparentPrimitiveWrappingStructTuple b,
+ TransparentComplexWrappingStructure c,
+ TransparentPrimitiveWrappingStructure d,
+ TransparentComplexWrapper_i32 e,
+ TransparentPrimitiveWrapper_i32 f,
+ TransparentPrimitiveWithAssociatedConstants g,
+ struct EnumWithAssociatedConstantInImpl h);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/transparent.tag.c b/cbindgen-0.27.0/tests/expectations/transparent_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/transparent.tag.c
rename to cbindgen-0.27.0/tests/expectations/transparent_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/transparent_tag.compat.c b/cbindgen-0.27.0/tests/expectations/transparent_tag.compat.c
new file mode 100644
index 0000000..8329ca8
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/transparent_tag.compat.c
@@ -0,0 +1,43 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct DummyStruct;
+
+struct EnumWithAssociatedConstantInImpl;
+
+typedef struct DummyStruct TransparentComplexWrappingStructTuple;
+
+typedef uint32_t TransparentPrimitiveWrappingStructTuple;
+
+typedef struct DummyStruct TransparentComplexWrappingStructure;
+
+typedef uint32_t TransparentPrimitiveWrappingStructure;
+
+typedef struct DummyStruct TransparentComplexWrapper_i32;
+
+typedef uint32_t TransparentPrimitiveWrapper_i32;
+
+typedef uint32_t TransparentPrimitiveWithAssociatedConstants;
+#define TransparentPrimitiveWithAssociatedConstants_ZERO 0
+#define TransparentPrimitiveWithAssociatedConstants_ONE 1
+
+#define EnumWithAssociatedConstantInImpl_TEN 10
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(TransparentComplexWrappingStructTuple a,
+ TransparentPrimitiveWrappingStructTuple b,
+ TransparentComplexWrappingStructure c,
+ TransparentPrimitiveWrappingStructure d,
+ TransparentComplexWrapper_i32 e,
+ TransparentPrimitiveWrapper_i32 f,
+ TransparentPrimitiveWithAssociatedConstants g,
+ struct EnumWithAssociatedConstantInImpl h);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/transparent.tag.pyx b/cbindgen-0.27.0/tests/expectations/transparent_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/transparent.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/transparent_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/typedef.c b/cbindgen-0.27.0/tests/expectations/typedef.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/typedef.c
rename to cbindgen-0.27.0/tests/expectations/typedef.c
diff --git a/cbindgen-0.27.0/tests/expectations/typedef.compat.c b/cbindgen-0.27.0/tests/expectations/typedef.compat.c
new file mode 100644
index 0000000..ccb3909
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/typedef.compat.c
@@ -0,0 +1,21 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ int32_t x;
+ int32_t y;
+} Foo_i32__i32;
+
+typedef Foo_i32__i32 IntFoo_i32;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(IntFoo_i32 a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/typedef.cpp b/cbindgen-0.27.0/tests/expectations/typedef.cpp
new file mode 100644
index 0000000..3b3be7f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/typedef.cpp
@@ -0,0 +1,20 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T, typename U>
+struct Foo {
+ T x;
+ U y;
+};
+
+template<typename T>
+using IntFoo = Foo<int32_t, T>;
+
+extern "C" {
+
+void root(IntFoo<int32_t> a);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/typedef.pyx b/cbindgen-0.27.0/tests/expectations/typedef.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/typedef.pyx
rename to cbindgen-0.27.0/tests/expectations/typedef.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/typedef.both.c b/cbindgen-0.27.0/tests/expectations/typedef_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/typedef.both.c
rename to cbindgen-0.27.0/tests/expectations/typedef_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/typedef_both.compat.c b/cbindgen-0.27.0/tests/expectations/typedef_both.compat.c
new file mode 100644
index 0000000..6a34d79
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/typedef_both.compat.c
@@ -0,0 +1,21 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo_i32__i32 {
+ int32_t x;
+ int32_t y;
+} Foo_i32__i32;
+
+typedef struct Foo_i32__i32 IntFoo_i32;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(IntFoo_i32 a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/typedef.tag.c b/cbindgen-0.27.0/tests/expectations/typedef_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/typedef.tag.c
rename to cbindgen-0.27.0/tests/expectations/typedef_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/typedef_tag.compat.c b/cbindgen-0.27.0/tests/expectations/typedef_tag.compat.c
new file mode 100644
index 0000000..2852cf1
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/typedef_tag.compat.c
@@ -0,0 +1,21 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo_i32__i32 {
+ int32_t x;
+ int32_t y;
+};
+
+typedef struct Foo_i32__i32 IntFoo_i32;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(IntFoo_i32 a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/typedef.tag.pyx b/cbindgen-0.27.0/tests/expectations/typedef_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/typedef.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/typedef_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/union.c b/cbindgen-0.27.0/tests/expectations/union.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/union.c
rename to cbindgen-0.27.0/tests/expectations/union.c
diff --git a/cbindgen-0.27.0/tests/expectations/union.compat.c b/cbindgen-0.27.0/tests/expectations/union.compat.c
new file mode 100644
index 0000000..c5e3d34
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/union.compat.c
@@ -0,0 +1,26 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Opaque Opaque;
+
+typedef union {
+ int32_t x;
+ float y;
+} Normal;
+
+typedef union {
+ int32_t x;
+ float y;
+} NormalWithZST;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Opaque *a, Normal b, NormalWithZST c);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/union.cpp b/cbindgen-0.27.0/tests/expectations/union.cpp
new file mode 100644
index 0000000..95d0a6e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/union.cpp
@@ -0,0 +1,23 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct Opaque;
+
+union Normal {
+ int32_t x;
+ float y;
+};
+
+union NormalWithZST {
+ int32_t x;
+ float y;
+};
+
+extern "C" {
+
+void root(Opaque *a, Normal b, NormalWithZST c);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/union.pyx b/cbindgen-0.27.0/tests/expectations/union.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/union.pyx
rename to cbindgen-0.27.0/tests/expectations/union.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/union.both.c b/cbindgen-0.27.0/tests/expectations/union_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/union.both.c
rename to cbindgen-0.27.0/tests/expectations/union_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/union_both.compat.c b/cbindgen-0.27.0/tests/expectations/union_both.compat.c
new file mode 100644
index 0000000..31f0a53
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/union_both.compat.c
@@ -0,0 +1,26 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Opaque Opaque;
+
+typedef union Normal {
+ int32_t x;
+ float y;
+} Normal;
+
+typedef union NormalWithZST {
+ int32_t x;
+ float y;
+} NormalWithZST;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Opaque *a, union Normal b, union NormalWithZST c);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/union_self.c b/cbindgen-0.27.0/tests/expectations/union_self.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/union_self.c
rename to cbindgen-0.27.0/tests/expectations/union_self.c
diff --git a/cbindgen-0.27.0/tests/expectations/union_self.compat.c b/cbindgen-0.27.0/tests/expectations/union_self.compat.c
new file mode 100644
index 0000000..74f0277
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/union_self.compat.c
@@ -0,0 +1,23 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ const int32_t *something;
+} Foo_Bar;
+
+typedef union {
+ int32_t something;
+ Foo_Bar subexpressions;
+} Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(Bar b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/union_self.cpp b/cbindgen-0.27.0/tests/expectations/union_self.cpp
new file mode 100644
index 0000000..f604b4e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/union_self.cpp
@@ -0,0 +1,21 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+template<typename T>
+struct Foo {
+ const int32_t *something;
+};
+
+union Bar {
+ int32_t something;
+ Foo<Bar> subexpressions;
+};
+
+extern "C" {
+
+void root(Bar b);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/union_self.pyx b/cbindgen-0.27.0/tests/expectations/union_self.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/union_self.pyx
rename to cbindgen-0.27.0/tests/expectations/union_self.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/union_self.both.c b/cbindgen-0.27.0/tests/expectations/union_self_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/union_self.both.c
rename to cbindgen-0.27.0/tests/expectations/union_self_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/union_self_both.compat.c b/cbindgen-0.27.0/tests/expectations/union_self_both.compat.c
new file mode 100644
index 0000000..021057e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/union_self_both.compat.c
@@ -0,0 +1,23 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct Foo_Bar {
+ const int32_t *something;
+} Foo_Bar;
+
+typedef union Bar {
+ int32_t something;
+ struct Foo_Bar subexpressions;
+} Bar;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(union Bar b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/union_self.tag.c b/cbindgen-0.27.0/tests/expectations/union_self_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/union_self.tag.c
rename to cbindgen-0.27.0/tests/expectations/union_self_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/union_self_tag.compat.c b/cbindgen-0.27.0/tests/expectations/union_self_tag.compat.c
new file mode 100644
index 0000000..6cf7e8f
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/union_self_tag.compat.c
@@ -0,0 +1,23 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Foo_Bar {
+ const int32_t *something;
+};
+
+union Bar {
+ int32_t something;
+ struct Foo_Bar subexpressions;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(union Bar b);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/union_self.tag.pyx b/cbindgen-0.27.0/tests/expectations/union_self_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/union_self.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/union_self_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/union.tag.c b/cbindgen-0.27.0/tests/expectations/union_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/union.tag.c
rename to cbindgen-0.27.0/tests/expectations/union_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/union_tag.compat.c b/cbindgen-0.27.0/tests/expectations/union_tag.compat.c
new file mode 100644
index 0000000..0619175
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/union_tag.compat.c
@@ -0,0 +1,26 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct Opaque;
+
+union Normal {
+ int32_t x;
+ float y;
+};
+
+union NormalWithZST {
+ int32_t x;
+ float y;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(struct Opaque *a, union Normal b, union NormalWithZST c);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/union.tag.pyx b/cbindgen-0.27.0/tests/expectations/union_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/union.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/union_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/using_namespaces.c b/cbindgen-0.27.0/tests/expectations/using_namespaces.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/using_namespaces.c
rename to cbindgen-0.27.0/tests/expectations/using_namespaces.c
diff --git a/cbindgen-0.27.0/tests/expectations/using_namespaces.compat.c b/cbindgen-0.27.0/tests/expectations/using_namespaces.compat.c
new file mode 100644
index 0000000..3dec072
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/using_namespaces.compat.c
@@ -0,0 +1,22 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+namespace root {
+#endif // __cplusplus
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void root(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#ifdef __cplusplus
+} // namespace root
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/using_namespaces.cpp b/cbindgen-0.27.0/tests/expectations/using_namespaces.cpp
new file mode 100644
index 0000000..7cceaef
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/using_namespaces.cpp
@@ -0,0 +1,17 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+namespace root {
+
+using namespace std;
+
+extern "C" {
+
+void root();
+
+} // extern "C"
+
+} // namespace root
diff --git a/cbindgen-0.24.5/tests/expectations/using_namespaces.pyx b/cbindgen-0.27.0/tests/expectations/using_namespaces.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/using_namespaces.pyx
rename to cbindgen-0.27.0/tests/expectations/using_namespaces.pyx
diff --git a/cbindgen-0.27.0/tests/expectations/va_list.c b/cbindgen-0.27.0/tests/expectations/va_list.c
new file mode 100644
index 0000000..fb5d8b4
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/va_list.c
@@ -0,0 +1,23 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef int32_t (*VaListFnPtr)(int32_t count, ...);
+
+typedef int32_t (*VaListFnPtr2)(int32_t count, ...);
+
+typedef struct {
+ int32_t (*fn1)(int32_t count, ...);
+} Interface_______i32_______i32_______va_list;
+
+int32_t va_list_test(int32_t count, ...);
+
+int32_t va_list_test2(int32_t count, ...);
+
+void va_list_fn_ptrs(int32_t (*fn1)(int32_t count, ...),
+ int32_t (*fn2)(int32_t count, ...),
+ VaListFnPtr fn3,
+ VaListFnPtr2 fn4,
+ Interface_______i32_______i32_______va_list fn5,
+ Interface_______i32_______i32_______va_list fn6);
diff --git a/cbindgen-0.27.0/tests/expectations/va_list.compat.c b/cbindgen-0.27.0/tests/expectations/va_list.compat.c
new file mode 100644
index 0000000..d9b9518
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/va_list.compat.c
@@ -0,0 +1,31 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef int32_t (*VaListFnPtr)(int32_t count, ...);
+
+typedef int32_t (*VaListFnPtr2)(int32_t count, ...);
+
+typedef struct {
+ int32_t (*fn1)(int32_t count, ...);
+} Interface_______i32_______i32_______va_list;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+int32_t va_list_test(int32_t count, ...);
+
+int32_t va_list_test2(int32_t count, ...);
+
+void va_list_fn_ptrs(int32_t (*fn1)(int32_t count, ...),
+ int32_t (*fn2)(int32_t count, ...),
+ VaListFnPtr fn3,
+ VaListFnPtr2 fn4,
+ Interface_______i32_______i32_______va_list fn5,
+ Interface_______i32_______i32_______va_list fn6);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/va_list.cpp b/cbindgen-0.27.0/tests/expectations/va_list.cpp
new file mode 100644
index 0000000..86e0d99
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/va_list.cpp
@@ -0,0 +1,29 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+using VaListFnPtr = int32_t(*)(int32_t count, ...);
+
+using VaListFnPtr2 = int32_t(*)(int32_t count, ...);
+
+template<typename T>
+struct Interface {
+ T fn1;
+};
+
+extern "C" {
+
+int32_t va_list_test(int32_t count, ...);
+
+int32_t va_list_test2(int32_t count, ...);
+
+void va_list_fn_ptrs(int32_t (*fn1)(int32_t count, ...),
+ int32_t (*fn2)(int32_t count, ...),
+ VaListFnPtr fn3,
+ VaListFnPtr2 fn4,
+ Interface<int32_t(*)(int32_t count, ...)> fn5,
+ Interface<int32_t(*)(int32_t count, ...)> fn6);
+
+} // extern "C"
diff --git a/cbindgen-0.27.0/tests/expectations/va_list.pyx b/cbindgen-0.27.0/tests/expectations/va_list.pyx
new file mode 100644
index 0000000..c0c297c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/va_list.pyx
@@ -0,0 +1,25 @@
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ ctypedef int32_t (*VaListFnPtr)(int32_t count, ...);
+
+ ctypedef int32_t (*VaListFnPtr2)(int32_t count, ...);
+
+ ctypedef struct Interface_______i32_______i32_______va_list:
+ int32_t (*fn1)(int32_t count, ...);
+
+ int32_t va_list_test(int32_t count, ...);
+
+ int32_t va_list_test2(int32_t count, ...);
+
+ void va_list_fn_ptrs(int32_t (*fn1)(int32_t count, ...),
+ int32_t (*fn2)(int32_t count, ...),
+ VaListFnPtr fn3,
+ VaListFnPtr2 fn4,
+ Interface_______i32_______i32_______va_list fn5,
+ Interface_______i32_______i32_______va_list fn6);
diff --git a/cbindgen-0.27.0/tests/expectations/va_list_both.c b/cbindgen-0.27.0/tests/expectations/va_list_both.c
new file mode 100644
index 0000000..a403a5c
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/va_list_both.c
@@ -0,0 +1,23 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef int32_t (*VaListFnPtr)(int32_t count, ...);
+
+typedef int32_t (*VaListFnPtr2)(int32_t count, ...);
+
+typedef struct Interface_______i32_______i32_______va_list {
+ int32_t (*fn1)(int32_t count, ...);
+} Interface_______i32_______i32_______va_list;
+
+int32_t va_list_test(int32_t count, ...);
+
+int32_t va_list_test2(int32_t count, ...);
+
+void va_list_fn_ptrs(int32_t (*fn1)(int32_t count, ...),
+ int32_t (*fn2)(int32_t count, ...),
+ VaListFnPtr fn3,
+ VaListFnPtr2 fn4,
+ struct Interface_______i32_______i32_______va_list fn5,
+ struct Interface_______i32_______i32_______va_list fn6);
diff --git a/cbindgen-0.27.0/tests/expectations/va_list_both.compat.c b/cbindgen-0.27.0/tests/expectations/va_list_both.compat.c
new file mode 100644
index 0000000..8c1f898
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/va_list_both.compat.c
@@ -0,0 +1,31 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef int32_t (*VaListFnPtr)(int32_t count, ...);
+
+typedef int32_t (*VaListFnPtr2)(int32_t count, ...);
+
+typedef struct Interface_______i32_______i32_______va_list {
+ int32_t (*fn1)(int32_t count, ...);
+} Interface_______i32_______i32_______va_list;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+int32_t va_list_test(int32_t count, ...);
+
+int32_t va_list_test2(int32_t count, ...);
+
+void va_list_fn_ptrs(int32_t (*fn1)(int32_t count, ...),
+ int32_t (*fn2)(int32_t count, ...),
+ VaListFnPtr fn3,
+ VaListFnPtr2 fn4,
+ struct Interface_______i32_______i32_______va_list fn5,
+ struct Interface_______i32_______i32_______va_list fn6);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/va_list_tag.c b/cbindgen-0.27.0/tests/expectations/va_list_tag.c
new file mode 100644
index 0000000..fd48828
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/va_list_tag.c
@@ -0,0 +1,23 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef int32_t (*VaListFnPtr)(int32_t count, ...);
+
+typedef int32_t (*VaListFnPtr2)(int32_t count, ...);
+
+struct Interface_______i32_______i32_______va_list {
+ int32_t (*fn1)(int32_t count, ...);
+};
+
+int32_t va_list_test(int32_t count, ...);
+
+int32_t va_list_test2(int32_t count, ...);
+
+void va_list_fn_ptrs(int32_t (*fn1)(int32_t count, ...),
+ int32_t (*fn2)(int32_t count, ...),
+ VaListFnPtr fn3,
+ VaListFnPtr2 fn4,
+ struct Interface_______i32_______i32_______va_list fn5,
+ struct Interface_______i32_______i32_______va_list fn6);
diff --git a/cbindgen-0.27.0/tests/expectations/va_list_tag.compat.c b/cbindgen-0.27.0/tests/expectations/va_list_tag.compat.c
new file mode 100644
index 0000000..2853bfa
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/va_list_tag.compat.c
@@ -0,0 +1,31 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef int32_t (*VaListFnPtr)(int32_t count, ...);
+
+typedef int32_t (*VaListFnPtr2)(int32_t count, ...);
+
+struct Interface_______i32_______i32_______va_list {
+ int32_t (*fn1)(int32_t count, ...);
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+int32_t va_list_test(int32_t count, ...);
+
+int32_t va_list_test2(int32_t count, ...);
+
+void va_list_fn_ptrs(int32_t (*fn1)(int32_t count, ...),
+ int32_t (*fn2)(int32_t count, ...),
+ VaListFnPtr fn3,
+ VaListFnPtr2 fn4,
+ struct Interface_______i32_______i32_______va_list fn5,
+ struct Interface_______i32_______i32_______va_list fn6);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/va_list_tag.pyx b/cbindgen-0.27.0/tests/expectations/va_list_tag.pyx
new file mode 100644
index 0000000..3c80ff3
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/va_list_tag.pyx
@@ -0,0 +1,25 @@
+from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
+cdef extern from *:
+ ctypedef bint bool
+ ctypedef struct va_list
+
+cdef extern from *:
+
+ ctypedef int32_t (*VaListFnPtr)(int32_t count, ...);
+
+ ctypedef int32_t (*VaListFnPtr2)(int32_t count, ...);
+
+ cdef struct Interface_______i32_______i32_______va_list:
+ int32_t (*fn1)(int32_t count, ...);
+
+ int32_t va_list_test(int32_t count, ...);
+
+ int32_t va_list_test2(int32_t count, ...);
+
+ void va_list_fn_ptrs(int32_t (*fn1)(int32_t count, ...),
+ int32_t (*fn2)(int32_t count, ...),
+ VaListFnPtr fn3,
+ VaListFnPtr2 fn4,
+ Interface_______i32_______i32_______va_list fn5,
+ Interface_______i32_______i32_______va_list fn6);
diff --git a/cbindgen-0.24.5/tests/expectations/workspace.c b/cbindgen-0.27.0/tests/expectations/workspace.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/workspace.c
rename to cbindgen-0.27.0/tests/expectations/workspace.c
diff --git a/cbindgen-0.27.0/tests/expectations/workspace.compat.c b/cbindgen-0.27.0/tests/expectations/workspace.compat.c
new file mode 100644
index 0000000..0b09fbd
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/workspace.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define EXT_CONST 0
+
+typedef struct {
+ uint32_t data;
+} ExtType;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void consume_ext(ExtType _ext);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/workspace.cpp b/cbindgen-0.27.0/tests/expectations/workspace.cpp
new file mode 100644
index 0000000..77d92ff
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/workspace.cpp
@@ -0,0 +1,17 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+constexpr static const int32_t EXT_CONST = 0;
+
+struct ExtType {
+ uint32_t data;
+};
+
+extern "C" {
+
+void consume_ext(ExtType _ext);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/workspace.pyx b/cbindgen-0.27.0/tests/expectations/workspace.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/workspace.pyx
rename to cbindgen-0.27.0/tests/expectations/workspace.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/workspace.both.c b/cbindgen-0.27.0/tests/expectations/workspace_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/workspace.both.c
rename to cbindgen-0.27.0/tests/expectations/workspace_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/workspace_both.compat.c b/cbindgen-0.27.0/tests/expectations/workspace_both.compat.c
new file mode 100644
index 0000000..87363e5
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/workspace_both.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define EXT_CONST 0
+
+typedef struct ExtType {
+ uint32_t data;
+} ExtType;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void consume_ext(struct ExtType _ext);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/workspace.tag.c b/cbindgen-0.27.0/tests/expectations/workspace_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/workspace.tag.c
rename to cbindgen-0.27.0/tests/expectations/workspace_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/workspace_tag.compat.c b/cbindgen-0.27.0/tests/expectations/workspace_tag.compat.c
new file mode 100644
index 0000000..625077b
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/workspace_tag.compat.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#define EXT_CONST 0
+
+struct ExtType {
+ uint32_t data;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void consume_ext(struct ExtType _ext);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/workspace.tag.pyx b/cbindgen-0.27.0/tests/expectations/workspace_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/workspace.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/workspace_tag.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/zst.c b/cbindgen-0.27.0/tests/expectations/zst.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/zst.c
rename to cbindgen-0.27.0/tests/expectations/zst.c
diff --git a/cbindgen-0.27.0/tests/expectations/zst.compat.c b/cbindgen-0.27.0/tests/expectations/zst.compat.c
new file mode 100644
index 0000000..521c775
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/zst.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct {
+ void *data;
+ void *vtable;
+} TraitObject;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void *root(const void *ptr, TraitObject t);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.27.0/tests/expectations/zst.cpp b/cbindgen-0.27.0/tests/expectations/zst.cpp
new file mode 100644
index 0000000..f39bd92
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/zst.cpp
@@ -0,0 +1,16 @@
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+struct TraitObject {
+ void *data;
+ void *vtable;
+};
+
+extern "C" {
+
+void *root(const void *ptr, TraitObject t);
+
+} // extern "C"
diff --git a/cbindgen-0.24.5/tests/expectations/zst.pyx b/cbindgen-0.27.0/tests/expectations/zst.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/zst.pyx
rename to cbindgen-0.27.0/tests/expectations/zst.pyx
diff --git a/cbindgen-0.24.5/tests/expectations/zst.both.c b/cbindgen-0.27.0/tests/expectations/zst_both.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/zst.both.c
rename to cbindgen-0.27.0/tests/expectations/zst_both.c
diff --git a/cbindgen-0.27.0/tests/expectations/zst_both.compat.c b/cbindgen-0.27.0/tests/expectations/zst_both.compat.c
new file mode 100644
index 0000000..0c8467a
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/zst_both.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct TraitObject {
+ void *data;
+ void *vtable;
+} TraitObject;
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void *root(const void *ptr, struct TraitObject t);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/zst.tag.c b/cbindgen-0.27.0/tests/expectations/zst_tag.c
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/zst.tag.c
rename to cbindgen-0.27.0/tests/expectations/zst_tag.c
diff --git a/cbindgen-0.27.0/tests/expectations/zst_tag.compat.c b/cbindgen-0.27.0/tests/expectations/zst_tag.compat.c
new file mode 100644
index 0000000..67dde1e
--- /dev/null
+++ b/cbindgen-0.27.0/tests/expectations/zst_tag.compat.c
@@ -0,0 +1,19 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct TraitObject {
+ void *data;
+ void *vtable;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+void *root(const void *ptr, struct TraitObject t);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
diff --git a/cbindgen-0.24.5/tests/expectations/zst.tag.pyx b/cbindgen-0.27.0/tests/expectations/zst_tag.pyx
similarity index 100%
rename from cbindgen-0.24.5/tests/expectations/zst.tag.pyx
rename to cbindgen-0.27.0/tests/expectations/zst_tag.pyx
diff --git a/cbindgen-0.27.0/tests/rust/abi_string.rs b/cbindgen-0.27.0/tests/rust/abi_string.rs
new file mode 100644
index 0000000..f685532
--- /dev/null
+++ b/cbindgen-0.27.0/tests/rust/abi_string.rs
@@ -0,0 +1,5 @@
+#[no_mangle]
+pub extern "C" fn c() {}
+
+#[no_mangle]
+pub extern "C-unwind" fn c_unwind() {}
diff --git a/cbindgen-0.24.5/tests/rust/alias.rs b/cbindgen-0.27.0/tests/rust/alias.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/alias.rs
rename to cbindgen-0.27.0/tests/rust/alias.rs
diff --git a/cbindgen-0.24.5/tests/rust/annotation.rs b/cbindgen-0.27.0/tests/rust/annotation.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/annotation.rs
rename to cbindgen-0.27.0/tests/rust/annotation.rs
diff --git a/cbindgen-0.24.5/tests/rust/array.rs b/cbindgen-0.27.0/tests/rust/array.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/array.rs
rename to cbindgen-0.27.0/tests/rust/array.rs
diff --git a/cbindgen-0.24.5/tests/rust/array.toml b/cbindgen-0.27.0/tests/rust/array.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/array.toml
rename to cbindgen-0.27.0/tests/rust/array.toml
diff --git a/cbindgen-0.24.5/tests/rust/asserted_cast.rs b/cbindgen-0.27.0/tests/rust/asserted_cast.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/asserted_cast.rs
rename to cbindgen-0.27.0/tests/rust/asserted_cast.rs
diff --git a/cbindgen-0.24.5/tests/rust/asserted_cast.toml b/cbindgen-0.27.0/tests/rust/asserted_cast.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/asserted_cast.toml
rename to cbindgen-0.27.0/tests/rust/asserted_cast.toml
diff --git a/cbindgen-0.24.5/tests/rust/assoc_const_conflict.rs b/cbindgen-0.27.0/tests/rust/assoc_const_conflict.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/assoc_const_conflict.rs
rename to cbindgen-0.27.0/tests/rust/assoc_const_conflict.rs
diff --git a/cbindgen-0.24.5/tests/rust/assoc_constant.rs b/cbindgen-0.27.0/tests/rust/assoc_constant.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/assoc_constant.rs
rename to cbindgen-0.27.0/tests/rust/assoc_constant.rs
diff --git a/cbindgen-0.24.5/tests/rust/associated_constant_panic.rs b/cbindgen-0.27.0/tests/rust/associated_constant_panic.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/associated_constant_panic.rs
rename to cbindgen-0.27.0/tests/rust/associated_constant_panic.rs
diff --git a/cbindgen-0.24.5/tests/rust/associated_in_body.rs b/cbindgen-0.27.0/tests/rust/associated_in_body.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/associated_in_body.rs
rename to cbindgen-0.27.0/tests/rust/associated_in_body.rs
diff --git a/cbindgen-0.24.5/tests/rust/associated_in_body.toml b/cbindgen-0.27.0/tests/rust/associated_in_body.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/associated_in_body.toml
rename to cbindgen-0.27.0/tests/rust/associated_in_body.toml
diff --git a/cbindgen-0.27.0/tests/rust/bitflags.rs b/cbindgen-0.27.0/tests/rust/bitflags.rs
new file mode 100644
index 0000000..cba8377
--- /dev/null
+++ b/cbindgen-0.27.0/tests/rust/bitflags.rs
@@ -0,0 +1,61 @@
+bitflags! {
+ /// Constants shared by multiple CSS Box Alignment properties
+ ///
+ /// These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
+ #[derive(MallocSizeOf)]
+ #[repr(C)]
+ pub struct AlignFlags: u8 {
+ /// 'auto'
+ const AUTO = 0;
+ /// 'normal'
+ const NORMAL = 1;
+ /// 'start'
+ const START = 1 << 1;
+ /// 'end'
+ const END = 1 << 2;
+ const ALIAS = Self::END.bits();
+ /// 'flex-start'
+ const FLEX_START = 1 << 3;
+ const MIXED = 1 << 4 | AlignFlags::FLEX_START.bits() | AlignFlags::END.bits();
+ const MIXED_SELF = 1 << 5 | AlignFlags::FLEX_START.bits() | AlignFlags::END.bits();
+ }
+}
+
+bitflags! {
+ #[repr(C)]
+ pub struct DebugFlags: u32 {
+ /// Flag with the topmost bit set of the u32
+ const BIGGEST_ALLOWED = 1 << 31;
+ }
+}
+
+bitflags! {
+ #[repr(C)]
+ pub struct LargeFlags: u64 {
+ /// Flag with a very large shift that usually would be narrowed.
+ const LARGE_SHIFT = 1u64 << 44;
+ const INVERTED = !Self::LARGE_SHIFT.bits();
+ }
+}
+
+// bitflags 2 allows to define types out-of-line for custom derives
+// #[derive(SomeTrait)]
+#[repr(C)]
+pub struct OutOfLine(u32);
+
+bitflags! {
+ impl OutOfLine: u32 {
+ const A = 1;
+ const B = 2;
+ const AB = Self::A.bits() | Self::B.bits();
+ }
+}
+
+#[no_mangle]
+pub extern "C" fn root(
+ flags: AlignFlags,
+ bigger_flags: DebugFlags,
+ largest_flags: LargeFlags,
+ out_of_line: OutOfLine,
+) {
+}
diff --git a/cbindgen-0.24.5/tests/rust/bitflags.toml b/cbindgen-0.27.0/tests/rust/bitflags.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/bitflags.toml
rename to cbindgen-0.27.0/tests/rust/bitflags.toml
diff --git a/cbindgen-0.24.5/tests/rust/body.rs b/cbindgen-0.27.0/tests/rust/body.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/body.rs
rename to cbindgen-0.27.0/tests/rust/body.rs
diff --git a/cbindgen-0.24.5/tests/rust/body.toml b/cbindgen-0.27.0/tests/rust/body.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/body.toml
rename to cbindgen-0.27.0/tests/rust/body.toml
diff --git a/cbindgen-0.24.5/tests/rust/box.rs b/cbindgen-0.27.0/tests/rust/box.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/box.rs
rename to cbindgen-0.27.0/tests/rust/box.rs
diff --git a/cbindgen-0.24.5/tests/rust/box.toml b/cbindgen-0.27.0/tests/rust/box.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/box.toml
rename to cbindgen-0.27.0/tests/rust/box.toml
diff --git a/cbindgen-0.24.5/tests/rust/cdecl.rs b/cbindgen-0.27.0/tests/rust/cdecl.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/cdecl.rs
rename to cbindgen-0.27.0/tests/rust/cdecl.rs
diff --git a/cbindgen-0.24.5/tests/rust/cell.rs b/cbindgen-0.27.0/tests/rust/cell.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/cell.rs
rename to cbindgen-0.27.0/tests/rust/cell.rs
diff --git a/cbindgen-0.27.0/tests/rust/cfg.rs b/cbindgen-0.27.0/tests/rust/cfg.rs
new file mode 100644
index 0000000..7089360
--- /dev/null
+++ b/cbindgen-0.27.0/tests/rust/cfg.rs
@@ -0,0 +1,85 @@
+#[cfg(all(unix, x11))]
+#[repr(u32)]
+enum FooType {
+ A,
+ B,
+ C,
+}
+
+#[cfg(all(unix, x11))]
+#[repr(C)]
+struct FooHandle {
+ ty: FooType,
+ x: i32,
+ y: f32,
+}
+
+#[cfg(any(windows, target_pointer_width="32"))]
+#[repr(u32)]
+enum BarType {
+ A,
+ B,
+ C,
+}
+
+#[repr(u8)]
+pub enum C {
+ C1,
+ C2,
+ #[cfg(windows)]
+ C3,
+ #[cfg(unix)]
+ C5 { int: i32 },
+}
+
+#[cfg(any(windows, target_pointer_width="32"))]
+#[repr(C)]
+struct BarHandle {
+ ty: BarType,
+ x: i32,
+ y: f32,
+}
+
+// FIXME(#634): Support deriving methods for structs with conditional fields.
+/// cbindgen:derive-eq=false
+/// cbindgen:derive-neq=false
+#[repr(C)]
+struct ConditionalField {
+ #[cfg(x11)]
+ field: i32,
+}
+
+#[cfg(all(unix, x11))]
+#[no_mangle]
+pub extern "C" fn root(a: FooHandle, c: C)
+{ }
+
+#[cfg(any(windows, target_pointer_width="32"))]
+#[no_mangle]
+pub extern "C" fn root(a: BarHandle, c: C)
+{ }
+
+#[no_mangle]
+pub extern "C" fn cond(a: ConditionalField)
+{ }
+
+// src/lib.rs
+#[repr(C)]
+struct Normal {
+ x: i32,
+ y: f32,
+}
+
+#[cfg(windows)]
+extern "C" {
+ fn foo() -> i32;
+
+ fn bar(a: Normal);
+}
+
+#[cfg(windows)]
+#[no_mangle]
+pub static mut global_array_with_different_sizes: [i32; 2] = [123, 456];
+#[cfg(unix)]
+#[no_mangle]
+pub static mut global_array_with_different_sizes: [i32; 1] = [7890];
diff --git a/cbindgen-0.24.5/tests/rust/cfg.toml b/cbindgen-0.27.0/tests/rust/cfg.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/cfg.toml
rename to cbindgen-0.27.0/tests/rust/cfg.toml
diff --git a/cbindgen-0.24.5/tests/rust/cfg_2.rs b/cbindgen-0.27.0/tests/rust/cfg_2.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/cfg_2.rs
rename to cbindgen-0.27.0/tests/rust/cfg_2.rs
diff --git a/cbindgen-0.24.5/tests/rust/cfg_2.toml b/cbindgen-0.27.0/tests/rust/cfg_2.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/cfg_2.toml
rename to cbindgen-0.27.0/tests/rust/cfg_2.toml
diff --git a/cbindgen-0.24.5/tests/rust/cfg_field.rs b/cbindgen-0.27.0/tests/rust/cfg_field.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/cfg_field.rs
rename to cbindgen-0.27.0/tests/rust/cfg_field.rs
diff --git a/cbindgen-0.24.5/tests/rust/char.rs b/cbindgen-0.27.0/tests/rust/char.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/char.rs
rename to cbindgen-0.27.0/tests/rust/char.rs
diff --git a/cbindgen-0.24.5/tests/rust/const_conflict.rs b/cbindgen-0.27.0/tests/rust/const_conflict.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/const_conflict.rs
rename to cbindgen-0.27.0/tests/rust/const_conflict.rs
diff --git a/cbindgen-0.24.5/tests/rust/const_generics.rs b/cbindgen-0.27.0/tests/rust/const_generics.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/const_generics.rs
rename to cbindgen-0.27.0/tests/rust/const_generics.rs
diff --git a/cbindgen-0.24.5/tests/rust/const_generics_arrayvec.rs b/cbindgen-0.27.0/tests/rust/const_generics_arrayvec.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/const_generics_arrayvec.rs
rename to cbindgen-0.27.0/tests/rust/const_generics_arrayvec.rs
diff --git a/cbindgen-0.24.5/tests/rust/const_generics_bool.rs b/cbindgen-0.27.0/tests/rust/const_generics_bool.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/const_generics_bool.rs
rename to cbindgen-0.27.0/tests/rust/const_generics_bool.rs
diff --git a/cbindgen-0.24.5/tests/rust/const_generics_byte.rs b/cbindgen-0.27.0/tests/rust/const_generics_byte.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/const_generics_byte.rs
rename to cbindgen-0.27.0/tests/rust/const_generics_byte.rs
diff --git a/cbindgen-0.24.5/tests/rust/const_generics_char.rs b/cbindgen-0.27.0/tests/rust/const_generics_char.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/const_generics_char.rs
rename to cbindgen-0.27.0/tests/rust/const_generics_char.rs
diff --git a/cbindgen-0.24.5/tests/rust/const_generics_constant.rs b/cbindgen-0.27.0/tests/rust/const_generics_constant.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/const_generics_constant.rs
rename to cbindgen-0.27.0/tests/rust/const_generics_constant.rs
diff --git a/cbindgen-0.24.5/tests/rust/const_generics_thru.rs b/cbindgen-0.27.0/tests/rust/const_generics_thru.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/const_generics_thru.rs
rename to cbindgen-0.27.0/tests/rust/const_generics_thru.rs
diff --git a/cbindgen-0.27.0/tests/rust/const_transparent.rs b/cbindgen-0.27.0/tests/rust/const_transparent.rs
new file mode 100644
index 0000000..83b9dac
--- /dev/null
+++ b/cbindgen-0.27.0/tests/rust/const_transparent.rs
@@ -0,0 +1,32 @@
+#[repr(transparent)]
+struct TransparentStruct { field: u8 }
+
+impl TransparentStruct {
+ pub const ASSOC_STRUCT_FOO: i64 = 1;
+ pub const ASSOC_STRUCT_BAR: TransparentStruct = TransparentStruct { field: 2 };
+
+ // TODO: Only C++ supports template constants so far.
+ pub const ASSOC_STRUCT_BAZ: Wrapper<TransparentStruct> = Wrapper { field: TransparentStruct { field: 3 } };
+}
+
+#[repr(transparent)]
+struct TransparentTupleStruct(u8);
+
+#[repr(transparent)]
+struct Wrapper<T> { field: T }
+
+pub const STRUCT_FOO: TransparentStruct = TransparentStruct { field: 4 };
+pub const STRUCT_BAR: TransparentTupleStruct = TransparentTupleStruct(5);
+
+// TODO: Only C++ supports template constants so far.
+pub const STRUCT_BAZ: Wrapper<TransparentStruct> = Wrapper { field: TransparentStruct { field: 6 } };
+
+#[repr(transparent)]
+struct TransparentStructWithErasedField<T> {
+ field: Wrapper<T>,
+}
+
+// TODO: Only C++ supports template constants so far.
+pub const COMPLEX: TransparentStructWithErasedField<TransparentStruct> = TransparentStructWithErasedField {
+ field: Wrapper { field: TransparentStruct { field: 7 } }
+};
diff --git a/cbindgen-0.24.5/tests/rust/constant.rs b/cbindgen-0.27.0/tests/rust/constant.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/constant.rs
rename to cbindgen-0.27.0/tests/rust/constant.rs
diff --git a/cbindgen-0.24.5/tests/rust/constant_big.rs b/cbindgen-0.27.0/tests/rust/constant_big.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/constant_big.rs
rename to cbindgen-0.27.0/tests/rust/constant_big.rs
diff --git a/cbindgen-0.24.5/tests/rust/constant_constexpr.rs b/cbindgen-0.27.0/tests/rust/constant_constexpr.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/constant_constexpr.rs
rename to cbindgen-0.27.0/tests/rust/constant_constexpr.rs
diff --git a/cbindgen-0.24.5/tests/rust/constant_constexpr.toml b/cbindgen-0.27.0/tests/rust/constant_constexpr.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/constant_constexpr.toml
rename to cbindgen-0.27.0/tests/rust/constant_constexpr.toml
diff --git a/cbindgen-0.24.5/tests/rust/constant_sort_name.rs b/cbindgen-0.27.0/tests/rust/constant_sort_name.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/constant_sort_name.rs
rename to cbindgen-0.27.0/tests/rust/constant_sort_name.rs
diff --git a/cbindgen-0.24.5/tests/rust/constant_sort_name.toml b/cbindgen-0.27.0/tests/rust/constant_sort_name.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/constant_sort_name.toml
rename to cbindgen-0.27.0/tests/rust/constant_sort_name.toml
diff --git a/cbindgen-0.24.5/tests/rust/constant_sort_none.rs b/cbindgen-0.27.0/tests/rust/constant_sort_none.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/constant_sort_none.rs
rename to cbindgen-0.27.0/tests/rust/constant_sort_none.rs
diff --git a/cbindgen-0.24.5/tests/rust/constant_user_defined_type.rs b/cbindgen-0.27.0/tests/rust/constant_user_defined_type.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/constant_user_defined_type.rs
rename to cbindgen-0.27.0/tests/rust/constant_user_defined_type.rs
diff --git a/cbindgen-0.24.5/tests/rust/custom_header.rs b/cbindgen-0.27.0/tests/rust/custom_header.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/custom_header.rs
rename to cbindgen-0.27.0/tests/rust/custom_header.rs
diff --git a/cbindgen-0.24.5/tests/rust/custom_header.toml b/cbindgen-0.27.0/tests/rust/custom_header.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/custom_header.toml
rename to cbindgen-0.27.0/tests/rust/custom_header.toml
diff --git a/cbindgen-0.24.5/tests/rust/cython_options.rs b/cbindgen-0.27.0/tests/rust/cython_options.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/cython_options.rs
rename to cbindgen-0.27.0/tests/rust/cython_options.rs
diff --git a/cbindgen-0.24.5/tests/rust/cython_options.toml b/cbindgen-0.27.0/tests/rust/cython_options.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/cython_options.toml
rename to cbindgen-0.27.0/tests/rust/cython_options.toml
diff --git a/cbindgen-0.24.5/tests/rust/decl_name_conflicting.rs b/cbindgen-0.27.0/tests/rust/decl_name_conflicting.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/decl_name_conflicting.rs
rename to cbindgen-0.27.0/tests/rust/decl_name_conflicting.rs
diff --git a/cbindgen-0.27.0/tests/rust/deprecated.rs b/cbindgen-0.27.0/tests/rust/deprecated.rs
new file mode 100644
index 0000000..0098b85
--- /dev/null
+++ b/cbindgen-0.27.0/tests/rust/deprecated.rs
@@ -0,0 +1,74 @@
+#[no_mangle]
+#[deprecated]
+pub extern "C" fn deprecated_without_note() {}
+
+#[no_mangle]
+#[deprecated = "This is a note"]
+pub extern "C" fn deprecated_without_bracket() {}
+
+#[no_mangle]
+#[deprecated(note = "This is a note")]
+pub extern "C" fn deprecated_with_note() {}
+
+#[no_mangle]
+#[deprecated(note = "This is a note", since = "1.0.0")]
+pub extern "C" fn deprecated_with_note_and_since() {}
+
+#[no_mangle]
+#[deprecated(note = "This quote \" requires to be quoted, and this [\n] requires to be escaped")]
+pub extern "C" fn deprecated_with_note_which_requires_to_be_escaped() {}
+
+#[repr(i32)]
+#[deprecated]
+pub enum DeprecatedEnum {
+ A = 0,
+}
+
+#[repr(i32)]
+#[deprecated(note = "This is a note")]
+pub enum DeprecatedEnumWithNote {
+ B = 0,
+}
+
+#[repr(i32)]
+pub enum EnumWithDeprecatedVariants {
+ C = 0,
+ #[deprecated]
+ D = 1,
+ #[deprecated(note = "This is a note")]
+ E = 2,
+ #[deprecated(note = "This is a note", since = "1.0.0")]
+ F = 3,
+}
+
+#[repr(u8)]
+enum EnumWithDeprecatedStructVariants {
+ Foo(i16),
+ #[deprecated]
+ Bar { x: u8, y: i16 },
+ #[deprecated(note = "This is a note")]
+ Baz { x: u8, y: u8 },
+}
+
+#[repr(C)]
+#[deprecated]
+pub struct DeprecatedStruct {
+ pub a: i32,
+}
+
+#[repr(C)]
+#[deprecated(note = "This is a note")]
+pub struct DeprecatedStructWithNote {
+ pub a: i32,
+}
+
+#[no_mangle]
+pub extern "C" fn dummy(
+ a: DeprecatedEnum,
+ b: DeprecatedEnumWithNote,
+ c: EnumWithDeprecatedVariants,
+ d: DeprecatedStruct,
+ e: DeprecatedStructWithNote,
+ f: EnumWithDeprecatedStructVariants,
+) -> void {
+}
diff --git a/cbindgen-0.27.0/tests/rust/deprecated.toml b/cbindgen-0.27.0/tests/rust/deprecated.toml
new file mode 100644
index 0000000..95f7f3d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/rust/deprecated.toml
@@ -0,0 +1,24 @@
+header = """
+#define DEPRECATED_FUNC __attribute__((deprecated))
+#define DEPRECATED_STRUCT __attribute__((deprecated))
+#define DEPRECATED_ENUM __attribute__((deprecated))
+#define DEPRECATED_ENUM_VARIANT __attribute__((deprecated))
+#define DEPRECATED_FUNC_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_STRUCT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+#define DEPRECATED_ENUM_VARIANT_WITH_NOTE(...) __attribute__((deprecated(__VA_ARGS__)))
+"""
+
+[fn]
+deprecated = "DEPRECATED_FUNC"
+deprecated_with_note = "DEPRECATED_FUNC_WITH_NOTE({})"
+
+[struct]
+deprecated = "DEPRECATED_STRUCT"
+deprecated_with_note = "DEPRECATED_STRUCT_WITH_NOTE({})"
+
+[enum]
+deprecated = "DEPRECATED_ENUM"
+deprecated_with_note = "DEPRECATED_ENUM_WITH_NOTE({})"
+deprecated_variant = "DEPRECATED_ENUM_VARIANT"
+deprecated_variant_with_note = "DEPRECATED_ENUM_VARIANT_WITH_NOTE({})"
diff --git a/cbindgen-0.24.5/tests/rust/derive_ostream.rs b/cbindgen-0.27.0/tests/rust/derive_ostream.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/derive_ostream.rs
rename to cbindgen-0.27.0/tests/rust/derive_ostream.rs
diff --git a/cbindgen-0.24.5/tests/rust/destructor_and_copy_ctor.rs b/cbindgen-0.27.0/tests/rust/destructor_and_copy_ctor.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/destructor_and_copy_ctor.rs
rename to cbindgen-0.27.0/tests/rust/destructor_and_copy_ctor.rs
diff --git a/cbindgen-0.24.5/tests/rust/destructor_and_copy_ctor.toml b/cbindgen-0.27.0/tests/rust/destructor_and_copy_ctor.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/destructor_and_copy_ctor.toml
rename to cbindgen-0.27.0/tests/rust/destructor_and_copy_ctor.toml
diff --git a/cbindgen-0.24.5/tests/rust/display_list.rs b/cbindgen-0.27.0/tests/rust/display_list.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/display_list.rs
rename to cbindgen-0.27.0/tests/rust/display_list.rs
diff --git a/cbindgen-0.24.5/tests/rust/doclength_short.rs b/cbindgen-0.27.0/tests/rust/doclength_short.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/doclength_short.rs
rename to cbindgen-0.27.0/tests/rust/doclength_short.rs
diff --git a/cbindgen-0.24.5/tests/rust/doclength_short.toml b/cbindgen-0.27.0/tests/rust/doclength_short.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/doclength_short.toml
rename to cbindgen-0.27.0/tests/rust/doclength_short.toml
diff --git a/cbindgen-0.24.5/tests/rust/docstyle_auto.rs b/cbindgen-0.27.0/tests/rust/docstyle_auto.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/docstyle_auto.rs
rename to cbindgen-0.27.0/tests/rust/docstyle_auto.rs
diff --git a/cbindgen-0.24.5/tests/rust/docstyle_auto.toml b/cbindgen-0.27.0/tests/rust/docstyle_auto.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/docstyle_auto.toml
rename to cbindgen-0.27.0/tests/rust/docstyle_auto.toml
diff --git a/cbindgen-0.24.5/tests/rust/docstyle_c99.rs b/cbindgen-0.27.0/tests/rust/docstyle_c99.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/docstyle_c99.rs
rename to cbindgen-0.27.0/tests/rust/docstyle_c99.rs
diff --git a/cbindgen-0.24.5/tests/rust/docstyle_c99.toml b/cbindgen-0.27.0/tests/rust/docstyle_c99.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/docstyle_c99.toml
rename to cbindgen-0.27.0/tests/rust/docstyle_c99.toml
diff --git a/cbindgen-0.24.5/tests/rust/docstyle_doxy.rs b/cbindgen-0.27.0/tests/rust/docstyle_doxy.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/docstyle_doxy.rs
rename to cbindgen-0.27.0/tests/rust/docstyle_doxy.rs
diff --git a/cbindgen-0.24.5/tests/rust/docstyle_doxy.toml b/cbindgen-0.27.0/tests/rust/docstyle_doxy.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/docstyle_doxy.toml
rename to cbindgen-0.27.0/tests/rust/docstyle_doxy.toml
diff --git a/cbindgen-0.27.0/tests/rust/documentation.rs b/cbindgen-0.27.0/tests/rust/documentation.rs
new file mode 100644
index 0000000..909221d
--- /dev/null
+++ b/cbindgen-0.27.0/tests/rust/documentation.rs
@@ -0,0 +1,24 @@
+/// The root of all evil.
+///
+/// But at least it contains some more documentation as someone would expect
+/// from a simple test case like this.
+///
+/// # Hint
+///
+/// Always ensure that everything is properly documented, even if you feel lazy.
+/// **Sometimes** it is also helpful to include some markdown formatting.
+///
+/// ////////////////////////////////////////////////////////////////////////////
+///
+/// Attention:
+///
+/// Rust is going to trim all leading `/` symbols. If you want to use them as a
+/// marker you need to add at least a single whitespace inbetween the tripple
+/// slash doc-comment marker and the rest.
+///
+#[no_mangle]
+pub extern "C" fn root() {}
+
+/// Some docs.
+#[no_mangle]
+pub static FOO: u32 = 4;
diff --git a/cbindgen-0.24.5/tests/rust/documentation_attr.rs b/cbindgen-0.27.0/tests/rust/documentation_attr.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/documentation_attr.rs
rename to cbindgen-0.27.0/tests/rust/documentation_attr.rs
diff --git a/cbindgen-0.24.5/tests/rust/enum.rs b/cbindgen-0.27.0/tests/rust/enum.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/enum.rs
rename to cbindgen-0.27.0/tests/rust/enum.rs
diff --git a/cbindgen-0.24.5/tests/rust/enum.toml b/cbindgen-0.27.0/tests/rust/enum.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/enum.toml
rename to cbindgen-0.27.0/tests/rust/enum.toml
diff --git a/cbindgen-0.24.5/tests/rust/enum_discriminant.rs b/cbindgen-0.27.0/tests/rust/enum_discriminant.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/enum_discriminant.rs
rename to cbindgen-0.27.0/tests/rust/enum_discriminant.rs
diff --git a/cbindgen-0.24.5/tests/rust/enum_discriminant.toml b/cbindgen-0.27.0/tests/rust/enum_discriminant.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/enum_discriminant.toml
rename to cbindgen-0.27.0/tests/rust/enum_discriminant.toml
diff --git a/cbindgen-0.24.5/tests/rust/enum_self.rs b/cbindgen-0.27.0/tests/rust/enum_self.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/enum_self.rs
rename to cbindgen-0.27.0/tests/rust/enum_self.rs
diff --git a/cbindgen-0.24.5/tests/rust/euclid.rs b/cbindgen-0.27.0/tests/rust/euclid.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/euclid.rs
rename to cbindgen-0.27.0/tests/rust/euclid.rs
diff --git a/cbindgen-0.24.5/tests/rust/exclude_generic_monomorph.rs b/cbindgen-0.27.0/tests/rust/exclude_generic_monomorph.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/exclude_generic_monomorph.rs
rename to cbindgen-0.27.0/tests/rust/exclude_generic_monomorph.rs
diff --git a/cbindgen-0.24.5/tests/rust/exclude_generic_monomorph.toml b/cbindgen-0.27.0/tests/rust/exclude_generic_monomorph.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/exclude_generic_monomorph.toml
rename to cbindgen-0.27.0/tests/rust/exclude_generic_monomorph.toml
diff --git a/cbindgen-0.24.5/tests/rust/export_name.rs b/cbindgen-0.27.0/tests/rust/export_name.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/export_name.rs
rename to cbindgen-0.27.0/tests/rust/export_name.rs
diff --git a/cbindgen-0.27.0/tests/rust/extern.rs b/cbindgen-0.27.0/tests/rust/extern.rs
new file mode 100644
index 0000000..e9a9392
--- /dev/null
+++ b/cbindgen-0.27.0/tests/rust/extern.rs
@@ -0,0 +1,15 @@
+#[repr(C)]
+struct Normal {
+ x: i32,
+ y: f32,
+}
+
+extern "C" {
+ fn foo() -> i32;
+
+ fn bar(a: Normal);
+}
+
+extern {
+ fn baz() -> i32;
+}
diff --git a/cbindgen-0.24.5/tests/rust/extern_2.rs b/cbindgen-0.27.0/tests/rust/extern_2.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/extern_2.rs
rename to cbindgen-0.27.0/tests/rust/extern_2.rs
diff --git a/cbindgen-0.24.5/tests/rust/fns.rs b/cbindgen-0.27.0/tests/rust/fns.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/fns.rs
rename to cbindgen-0.27.0/tests/rust/fns.rs
diff --git a/cbindgen-0.24.5/tests/rust/forward_declaration.rs b/cbindgen-0.27.0/tests/rust/forward_declaration.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/forward_declaration.rs
rename to cbindgen-0.27.0/tests/rust/forward_declaration.rs
diff --git a/cbindgen-0.24.5/tests/rust/forward_declaration.toml b/cbindgen-0.27.0/tests/rust/forward_declaration.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/forward_declaration.toml
rename to cbindgen-0.27.0/tests/rust/forward_declaration.toml
diff --git a/cbindgen-0.24.5/tests/rust/function_args.rs b/cbindgen-0.27.0/tests/rust/function_args.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/function_args.rs
rename to cbindgen-0.27.0/tests/rust/function_args.rs
diff --git a/cbindgen-0.24.5/tests/rust/function_noreturn.rs b/cbindgen-0.27.0/tests/rust/function_noreturn.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/function_noreturn.rs
rename to cbindgen-0.27.0/tests/rust/function_noreturn.rs
diff --git a/cbindgen-0.24.5/tests/rust/function_noreturn.toml b/cbindgen-0.27.0/tests/rust/function_noreturn.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/function_noreturn.toml
rename to cbindgen-0.27.0/tests/rust/function_noreturn.toml
diff --git a/cbindgen-0.24.5/tests/rust/function_ptr.rs b/cbindgen-0.27.0/tests/rust/function_ptr.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/function_ptr.rs
rename to cbindgen-0.27.0/tests/rust/function_ptr.rs
diff --git a/cbindgen-0.24.5/tests/rust/function_sort_name.rs b/cbindgen-0.27.0/tests/rust/function_sort_name.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/function_sort_name.rs
rename to cbindgen-0.27.0/tests/rust/function_sort_name.rs
diff --git a/cbindgen-0.24.5/tests/rust/function_sort_name.toml b/cbindgen-0.27.0/tests/rust/function_sort_name.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/function_sort_name.toml
rename to cbindgen-0.27.0/tests/rust/function_sort_name.toml
diff --git a/cbindgen-0.24.5/tests/rust/function_sort_none.rs b/cbindgen-0.27.0/tests/rust/function_sort_none.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/function_sort_none.rs
rename to cbindgen-0.27.0/tests/rust/function_sort_none.rs
diff --git a/cbindgen-0.27.0/tests/rust/generic_defaults.rs b/cbindgen-0.27.0/tests/rust/generic_defaults.rs
new file mode 100644
index 0000000..7b7a835
--- /dev/null
+++ b/cbindgen-0.27.0/tests/rust/generic_defaults.rs
@@ -0,0 +1,16 @@
+#[repr(transparent)]
+pub struct Foo<T, P = c_void> {
+ field: T,
+ _phantom: std::marker::PhantomData<P>,
+}
+
+#[repr(C)]
+pub struct Bar<T, P> {
+ f: Foo<T>,
+ p: P,
+}
+
+pub type Baz<T> = Foo<T>;
+
+#[no_mangle]
+pub extern "C" fn foo_root(f: Foo<i16>, b: Bar<i32, u32>, z: Baz<i64>) {}
diff --git a/cbindgen-0.24.5/tests/rust/generic_pointer.rs b/cbindgen-0.27.0/tests/rust/generic_pointer.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/generic_pointer.rs
rename to cbindgen-0.27.0/tests/rust/generic_pointer.rs
diff --git a/cbindgen-0.24.5/tests/rust/global_attr.rs b/cbindgen-0.27.0/tests/rust/global_attr.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/global_attr.rs
rename to cbindgen-0.27.0/tests/rust/global_attr.rs
diff --git a/cbindgen-0.24.5/tests/rust/global_variable.rs b/cbindgen-0.27.0/tests/rust/global_variable.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/global_variable.rs
rename to cbindgen-0.27.0/tests/rust/global_variable.rs
diff --git a/cbindgen-0.27.0/tests/rust/ignore.rs b/cbindgen-0.27.0/tests/rust/ignore.rs
new file mode 100644
index 0000000..b051317
--- /dev/null
+++ b/cbindgen-0.27.0/tests/rust/ignore.rs
@@ -0,0 +1,52 @@
+/// cbindgen:ignore
+#[no_mangle]
+pub extern "C" fn root() {}
+
+/// cbindgen:ignore
+///
+/// Something else.
+#[no_mangle]
+pub extern "C" fn another_root() {}
+
+#[no_mangle]
+pub extern "C" fn no_ignore_root() {}
+
+/// cbindgen:ignore
+#[repr(C)]
+pub struct IgnoreStruct {}
+
+pub struct IgnoreStructWithImpl;
+
+/// cbindgen:ignore
+impl IgnoreStructWithImpl {
+ #[no_mangle]
+ pub extern "C" fn ignore_associated_method() {}
+
+ pub const IGNORE_INNER_CONST: u32 = 0;
+}
+
+/// cbindgen:ignore
+pub const IGNORE_CONST: u32 = 0;
+
+pub const NO_IGNORE_CONST: u32 = 0;
+
+pub struct NoIgnoreStructWithImpl;
+
+impl NoIgnoreStructWithImpl {
+ /// cbindgen:ignore
+ #[no_mangle]
+ pub extern "C" fn ignore_associated_method() {}
+
+ #[no_mangle]
+ pub extern "C" fn no_ignore_associated_method() {}
+
+ /// cbindgen:ignore
+ pub const IGNORE_INNER_CONST: u32 = 0;
+
+ pub const NO_IGNORE_INNER_CONST: u32 = 0;
+}
+
+/// cbindgen:ignore
+enum IgnoreEnum {}
+
+enum NoIgnoreEnum {}
diff --git a/cbindgen-0.24.5/tests/rust/include.rs b/cbindgen-0.27.0/tests/rust/include.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/include.rs
rename to cbindgen-0.27.0/tests/rust/include.rs
diff --git a/cbindgen-0.24.5/tests/rust/include.toml b/cbindgen-0.27.0/tests/rust/include.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/include.toml
rename to cbindgen-0.27.0/tests/rust/include.toml
diff --git a/cbindgen-0.24.5/tests/rust/include_guard.rs b/cbindgen-0.27.0/tests/rust/include_guard.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/include_guard.rs
rename to cbindgen-0.27.0/tests/rust/include_guard.rs
diff --git a/cbindgen-0.24.5/tests/rust/include_guard.toml b/cbindgen-0.27.0/tests/rust/include_guard.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/include_guard.toml
rename to cbindgen-0.27.0/tests/rust/include_guard.toml
diff --git a/cbindgen-0.24.5/tests/rust/include_item.rs b/cbindgen-0.27.0/tests/rust/include_item.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/include_item.rs
rename to cbindgen-0.27.0/tests/rust/include_item.rs
diff --git a/cbindgen-0.24.5/tests/rust/include_item.toml b/cbindgen-0.27.0/tests/rust/include_item.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/include_item.toml
rename to cbindgen-0.27.0/tests/rust/include_item.toml
diff --git a/cbindgen-0.24.5/tests/rust/include_specific.rs b/cbindgen-0.27.0/tests/rust/include_specific.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/include_specific.rs
rename to cbindgen-0.27.0/tests/rust/include_specific.rs
diff --git a/cbindgen-0.24.5/tests/rust/include_specific.toml b/cbindgen-0.27.0/tests/rust/include_specific.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/include_specific.toml
rename to cbindgen-0.27.0/tests/rust/include_specific.toml
diff --git a/cbindgen-0.24.5/tests/rust/infinite_recursion_typedef_monomorph.rs b/cbindgen-0.27.0/tests/rust/infinite_recursion_typedef_monomorph.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/infinite_recursion_typedef_monomorph.rs
rename to cbindgen-0.27.0/tests/rust/infinite_recursion_typedef_monomorph.rs
diff --git a/cbindgen-0.24.5/tests/rust/inner_mod.rs b/cbindgen-0.27.0/tests/rust/inner_mod.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/inner_mod.rs
rename to cbindgen-0.27.0/tests/rust/inner_mod.rs
diff --git a/cbindgen-0.24.5/tests/rust/item_types.rs b/cbindgen-0.27.0/tests/rust/item_types.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/item_types.rs
rename to cbindgen-0.27.0/tests/rust/item_types.rs
diff --git a/cbindgen-0.24.5/tests/rust/item_types.toml b/cbindgen-0.27.0/tests/rust/item_types.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/item_types.toml
rename to cbindgen-0.27.0/tests/rust/item_types.toml
diff --git a/cbindgen-0.24.5/tests/rust/item_types_renamed.rs b/cbindgen-0.27.0/tests/rust/item_types_renamed.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/item_types_renamed.rs
rename to cbindgen-0.27.0/tests/rust/item_types_renamed.rs
diff --git a/cbindgen-0.24.5/tests/rust/item_types_renamed.toml b/cbindgen-0.27.0/tests/rust/item_types_renamed.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/item_types_renamed.toml
rename to cbindgen-0.27.0/tests/rust/item_types_renamed.toml
diff --git a/cbindgen-0.24.5/tests/rust/layout.rs b/cbindgen-0.27.0/tests/rust/layout.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/layout.rs
rename to cbindgen-0.27.0/tests/rust/layout.rs
diff --git a/cbindgen-0.24.5/tests/rust/layout.toml b/cbindgen-0.27.0/tests/rust/layout.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/layout.toml
rename to cbindgen-0.27.0/tests/rust/layout.toml
diff --git a/cbindgen-0.24.5/tests/rust/layout_aligned_opaque.rs b/cbindgen-0.27.0/tests/rust/layout_aligned_opaque.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/layout_aligned_opaque.rs
rename to cbindgen-0.27.0/tests/rust/layout_aligned_opaque.rs
diff --git a/cbindgen-0.24.5/tests/rust/layout_aligned_opaque.toml b/cbindgen-0.27.0/tests/rust/layout_aligned_opaque.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/layout_aligned_opaque.toml
rename to cbindgen-0.27.0/tests/rust/layout_aligned_opaque.toml
diff --git a/cbindgen-0.24.5/tests/rust/layout_packed_opaque.rs b/cbindgen-0.27.0/tests/rust/layout_packed_opaque.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/layout_packed_opaque.rs
rename to cbindgen-0.27.0/tests/rust/layout_packed_opaque.rs
diff --git a/cbindgen-0.24.5/tests/rust/layout_packed_opaque.toml b/cbindgen-0.27.0/tests/rust/layout_packed_opaque.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/layout_packed_opaque.toml
rename to cbindgen-0.27.0/tests/rust/layout_packed_opaque.toml
diff --git a/cbindgen-0.24.5/tests/rust/lifetime_arg.rs b/cbindgen-0.27.0/tests/rust/lifetime_arg.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/lifetime_arg.rs
rename to cbindgen-0.27.0/tests/rust/lifetime_arg.rs
diff --git a/cbindgen-0.24.5/tests/rust/linestyle_cr.rs b/cbindgen-0.27.0/tests/rust/linestyle_cr.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/linestyle_cr.rs
rename to cbindgen-0.27.0/tests/rust/linestyle_cr.rs
diff --git a/cbindgen-0.24.5/tests/rust/linestyle_cr.toml b/cbindgen-0.27.0/tests/rust/linestyle_cr.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/linestyle_cr.toml
rename to cbindgen-0.27.0/tests/rust/linestyle_cr.toml
diff --git a/cbindgen-0.24.5/tests/rust/linestyle_crlf.rs b/cbindgen-0.27.0/tests/rust/linestyle_crlf.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/linestyle_crlf.rs
rename to cbindgen-0.27.0/tests/rust/linestyle_crlf.rs
diff --git a/cbindgen-0.24.5/tests/rust/linestyle_crlf.toml b/cbindgen-0.27.0/tests/rust/linestyle_crlf.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/linestyle_crlf.toml
rename to cbindgen-0.27.0/tests/rust/linestyle_crlf.toml
diff --git a/cbindgen-0.24.5/tests/rust/linestyle_lf.rs b/cbindgen-0.27.0/tests/rust/linestyle_lf.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/linestyle_lf.rs
rename to cbindgen-0.27.0/tests/rust/linestyle_lf.rs
diff --git a/cbindgen-0.24.5/tests/rust/linestyle_lf.toml b/cbindgen-0.27.0/tests/rust/linestyle_lf.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/linestyle_lf.toml
rename to cbindgen-0.27.0/tests/rust/linestyle_lf.toml
diff --git a/cbindgen-0.24.5/tests/rust/mangle.rs b/cbindgen-0.27.0/tests/rust/mangle.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/mangle.rs
rename to cbindgen-0.27.0/tests/rust/mangle.rs
diff --git a/cbindgen-0.24.5/tests/rust/mangle.toml b/cbindgen-0.27.0/tests/rust/mangle.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/mangle.toml
rename to cbindgen-0.27.0/tests/rust/mangle.toml
diff --git a/cbindgen-0.24.5/tests/rust/manuallydrop.rs b/cbindgen-0.27.0/tests/rust/manuallydrop.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/manuallydrop.rs
rename to cbindgen-0.27.0/tests/rust/manuallydrop.rs
diff --git a/cbindgen-0.24.5/tests/rust/manuallydrop.toml b/cbindgen-0.27.0/tests/rust/manuallydrop.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/manuallydrop.toml
rename to cbindgen-0.27.0/tests/rust/manuallydrop.toml
diff --git a/cbindgen-0.24.5/tests/rust/maybeuninit.rs b/cbindgen-0.27.0/tests/rust/maybeuninit.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/maybeuninit.rs
rename to cbindgen-0.27.0/tests/rust/maybeuninit.rs
diff --git a/cbindgen-0.24.5/tests/rust/maybeuninit.toml b/cbindgen-0.27.0/tests/rust/maybeuninit.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/maybeuninit.toml
rename to cbindgen-0.27.0/tests/rust/maybeuninit.toml
diff --git a/cbindgen-0.24.5/tests/rust/monomorph_1.rs b/cbindgen-0.27.0/tests/rust/monomorph_1.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/monomorph_1.rs
rename to cbindgen-0.27.0/tests/rust/monomorph_1.rs
diff --git a/cbindgen-0.24.5/tests/rust/monomorph_2.rs b/cbindgen-0.27.0/tests/rust/monomorph_2.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/monomorph_2.rs
rename to cbindgen-0.27.0/tests/rust/monomorph_2.rs
diff --git a/cbindgen-0.24.5/tests/rust/monomorph_3.rs b/cbindgen-0.27.0/tests/rust/monomorph_3.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/monomorph_3.rs
rename to cbindgen-0.27.0/tests/rust/monomorph_3.rs
diff --git a/cbindgen-0.24.5/tests/rust/must_use.rs b/cbindgen-0.27.0/tests/rust/must_use.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/must_use.rs
rename to cbindgen-0.27.0/tests/rust/must_use.rs
diff --git a/cbindgen-0.24.5/tests/rust/must_use.toml b/cbindgen-0.27.0/tests/rust/must_use.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/must_use.toml
rename to cbindgen-0.27.0/tests/rust/must_use.toml
diff --git a/cbindgen-0.24.5/tests/rust/namespace_constant.rs b/cbindgen-0.27.0/tests/rust/namespace_constant.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/namespace_constant.rs
rename to cbindgen-0.27.0/tests/rust/namespace_constant.rs
diff --git a/cbindgen-0.24.5/tests/rust/namespace_constant.toml b/cbindgen-0.27.0/tests/rust/namespace_constant.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/namespace_constant.toml
rename to cbindgen-0.27.0/tests/rust/namespace_constant.toml
diff --git a/cbindgen-0.24.5/tests/rust/namespaces_constant.rs b/cbindgen-0.27.0/tests/rust/namespaces_constant.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/namespaces_constant.rs
rename to cbindgen-0.27.0/tests/rust/namespaces_constant.rs
diff --git a/cbindgen-0.24.5/tests/rust/namespaces_constant.toml b/cbindgen-0.27.0/tests/rust/namespaces_constant.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/namespaces_constant.toml
rename to cbindgen-0.27.0/tests/rust/namespaces_constant.toml
diff --git a/cbindgen-0.24.5/tests/rust/nested_import.rs b/cbindgen-0.27.0/tests/rust/nested_import.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/nested_import.rs
rename to cbindgen-0.27.0/tests/rust/nested_import.rs
diff --git a/cbindgen-0.24.5/tests/rust/no_includes.rs b/cbindgen-0.27.0/tests/rust/no_includes.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/no_includes.rs
rename to cbindgen-0.27.0/tests/rust/no_includes.rs
diff --git a/cbindgen-0.24.5/tests/rust/no_includes.toml b/cbindgen-0.27.0/tests/rust/no_includes.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/no_includes.toml
rename to cbindgen-0.27.0/tests/rust/no_includes.toml
diff --git a/cbindgen-0.27.0/tests/rust/non_pub_extern.rs b/cbindgen-0.27.0/tests/rust/non_pub_extern.rs
new file mode 100644
index 0000000..4174324
--- /dev/null
+++ b/cbindgen-0.27.0/tests/rust/non_pub_extern.rs
@@ -0,0 +1,13 @@
+#[no_mangle]
+static FIRST: u32 = 10;
+
+#[export_name = "RENAMED"]
+static SECOND: u32 = 42;
+
+#[no_mangle]
+extern "C" fn first()
+{ }
+
+#[export_name = "renamed"]
+extern fn second()
+{ }
diff --git a/cbindgen-0.24.5/tests/rust/nonnull.rs b/cbindgen-0.27.0/tests/rust/nonnull.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/nonnull.rs
rename to cbindgen-0.27.0/tests/rust/nonnull.rs
diff --git a/cbindgen-0.24.5/tests/rust/nonnull_attribute.rs b/cbindgen-0.27.0/tests/rust/nonnull_attribute.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/nonnull_attribute.rs
rename to cbindgen-0.27.0/tests/rust/nonnull_attribute.rs
diff --git a/cbindgen-0.24.5/tests/rust/nonnull_attribute.toml b/cbindgen-0.27.0/tests/rust/nonnull_attribute.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/nonnull_attribute.toml
rename to cbindgen-0.27.0/tests/rust/nonnull_attribute.toml
diff --git a/cbindgen-0.27.0/tests/rust/nonzero.rs b/cbindgen-0.27.0/tests/rust/nonzero.rs
new file mode 100644
index 0000000..2c62f33
--- /dev/null
+++ b/cbindgen-0.27.0/tests/rust/nonzero.rs
@@ -0,0 +1,59 @@
+use std::num::*;
+
+#[repr(C)]
+pub struct NonZeroAliases {
+ pub a: NonZeroU8,
+ pub b: NonZeroU16,
+ pub c: NonZeroU32,
+ pub d: NonZeroU64,
+ pub e: NonZeroI8,
+ pub f: NonZeroI16,
+ pub g: NonZeroI32,
+ pub h: NonZeroI64,
+ pub i: Option<NonZeroI64>,
+ pub j: *const Option<Option<NonZeroI64>>,
+}
+
+#[no_mangle]
+pub extern "C" fn root_nonzero_aliases(
+ test: NonZeroAliases,
+ a: NonZeroU8,
+ b: NonZeroU16,
+ c: NonZeroU32,
+ d: NonZeroU64,
+ e: NonZeroI8,
+ f: NonZeroI16,
+ g: NonZeroI32,
+ h: NonZeroI64,
+ i: Option<NonZeroI64>,
+ j: *const Option<Option<NonZeroI64>>,
+) {}
+
+#[repr(C)]
+pub struct NonZeroGenerics {
+ pub a: NonZero<u8>,
+ pub b: NonZero<u16>,
+ pub c: NonZero<u32>,
+ pub d: NonZero<u64>,
+ pub e: NonZero<i8>,
+ pub f: NonZero<i16>,
+ pub g: NonZero<i32>,
+ pub h: NonZero<i64>,
+ pub i: Option<NonZero<i64>>,
+ pub j: *const Option<Option<NonZero<i64>>>,
+}
+
+#[no_mangle]
+pub extern "C" fn root_nonzero_generics(
+ test: NonZeroGenerics,
+ a: NonZero<u8>,
+ b: NonZero<u16>,
+ c: NonZero<u32>,
+ d: NonZero<u64>,
+ e: NonZero<i8>,
+ f: NonZero<i16>,
+ g: NonZero<i32>,
+ h: NonZero<i64>,
+ i: Option<NonZero<i64>>,
+ j: *const Option<Option<NonZero<i64>>>,
+) {}
diff --git a/cbindgen-0.24.5/tests/rust/nonzero.toml b/cbindgen-0.27.0/tests/rust/nonzero.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/nonzero.toml
rename to cbindgen-0.27.0/tests/rust/nonzero.toml
diff --git a/cbindgen-0.24.5/tests/rust/opaque.rs b/cbindgen-0.27.0/tests/rust/opaque.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/opaque.rs
rename to cbindgen-0.27.0/tests/rust/opaque.rs
diff --git a/cbindgen-0.24.5/tests/rust/opaque.toml b/cbindgen-0.27.0/tests/rust/opaque.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/opaque.toml
rename to cbindgen-0.27.0/tests/rust/opaque.toml
diff --git a/cbindgen-0.24.5/tests/rust/pin.rs b/cbindgen-0.27.0/tests/rust/pin.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/pin.rs
rename to cbindgen-0.27.0/tests/rust/pin.rs
diff --git a/cbindgen-0.24.5/tests/rust/pin.toml b/cbindgen-0.27.0/tests/rust/pin.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/pin.toml
rename to cbindgen-0.27.0/tests/rust/pin.toml
diff --git a/cbindgen-0.24.5/tests/rust/pragma_once.skip_warning_as_error.rs b/cbindgen-0.27.0/tests/rust/pragma_once.skip_warning_as_error.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/pragma_once.skip_warning_as_error.rs
rename to cbindgen-0.27.0/tests/rust/pragma_once.skip_warning_as_error.rs
diff --git a/cbindgen-0.24.5/tests/rust/pragma_once.skip_warning_as_error.toml b/cbindgen-0.27.0/tests/rust/pragma_once.skip_warning_as_error.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/pragma_once.skip_warning_as_error.toml
rename to cbindgen-0.27.0/tests/rust/pragma_once.skip_warning_as_error.toml
diff --git a/cbindgen-0.24.5/tests/rust/prefix.rs b/cbindgen-0.27.0/tests/rust/prefix.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/prefix.rs
rename to cbindgen-0.27.0/tests/rust/prefix.rs
diff --git a/cbindgen-0.24.5/tests/rust/prefix.toml b/cbindgen-0.27.0/tests/rust/prefix.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/prefix.toml
rename to cbindgen-0.27.0/tests/rust/prefix.toml
diff --git a/cbindgen-0.24.5/tests/rust/prefixed_struct_literal.rs b/cbindgen-0.27.0/tests/rust/prefixed_struct_literal.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/prefixed_struct_literal.rs
rename to cbindgen-0.27.0/tests/rust/prefixed_struct_literal.rs
diff --git a/cbindgen-0.24.5/tests/rust/prefixed_struct_literal.toml b/cbindgen-0.27.0/tests/rust/prefixed_struct_literal.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/prefixed_struct_literal.toml
rename to cbindgen-0.27.0/tests/rust/prefixed_struct_literal.toml
diff --git a/cbindgen-0.24.5/tests/rust/prefixed_struct_literal_deep.rs b/cbindgen-0.27.0/tests/rust/prefixed_struct_literal_deep.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/prefixed_struct_literal_deep.rs
rename to cbindgen-0.27.0/tests/rust/prefixed_struct_literal_deep.rs
diff --git a/cbindgen-0.24.5/tests/rust/prefixed_struct_literal_deep.toml b/cbindgen-0.27.0/tests/rust/prefixed_struct_literal_deep.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/prefixed_struct_literal_deep.toml
rename to cbindgen-0.27.0/tests/rust/prefixed_struct_literal_deep.toml
diff --git a/cbindgen-0.24.5/tests/rust/ptrs_as_arrays.rs b/cbindgen-0.27.0/tests/rust/ptrs_as_arrays.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/ptrs_as_arrays.rs
rename to cbindgen-0.27.0/tests/rust/ptrs_as_arrays.rs
diff --git a/cbindgen-0.24.5/tests/rust/raw_ident.rs b/cbindgen-0.27.0/tests/rust/raw_ident.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/raw_ident.rs
rename to cbindgen-0.27.0/tests/rust/raw_ident.rs
diff --git a/cbindgen-0.24.5/tests/rust/raw_lines.rs b/cbindgen-0.27.0/tests/rust/raw_lines.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/raw_lines.rs
rename to cbindgen-0.27.0/tests/rust/raw_lines.rs
diff --git a/cbindgen-0.24.5/tests/rust/raw_lines.toml b/cbindgen-0.27.0/tests/rust/raw_lines.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/raw_lines.toml
rename to cbindgen-0.27.0/tests/rust/raw_lines.toml
diff --git a/cbindgen-0.24.5/tests/rust/rename.rs b/cbindgen-0.27.0/tests/rust/rename.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/rename.rs
rename to cbindgen-0.27.0/tests/rust/rename.rs
diff --git a/cbindgen-0.24.5/tests/rust/rename.toml b/cbindgen-0.27.0/tests/rust/rename.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/rename.toml
rename to cbindgen-0.27.0/tests/rust/rename.toml
diff --git a/cbindgen-0.24.5/tests/rust/rename_case.rs b/cbindgen-0.27.0/tests/rust/rename_case.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/rename_case.rs
rename to cbindgen-0.27.0/tests/rust/rename_case.rs
diff --git a/cbindgen-0.24.5/tests/rust/renaming_overrides_prefixing.rs b/cbindgen-0.27.0/tests/rust/renaming_overrides_prefixing.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/renaming_overrides_prefixing.rs
rename to cbindgen-0.27.0/tests/rust/renaming_overrides_prefixing.rs
diff --git a/cbindgen-0.24.5/tests/rust/renaming_overrides_prefixing.toml b/cbindgen-0.27.0/tests/rust/renaming_overrides_prefixing.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/renaming_overrides_prefixing.toml
rename to cbindgen-0.27.0/tests/rust/renaming_overrides_prefixing.toml
diff --git a/cbindgen-0.24.5/tests/rust/reserved.rs b/cbindgen-0.27.0/tests/rust/reserved.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/reserved.rs
rename to cbindgen-0.27.0/tests/rust/reserved.rs
diff --git a/cbindgen-0.24.5/tests/rust/sentinel.rs b/cbindgen-0.27.0/tests/rust/sentinel.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/sentinel.rs
rename to cbindgen-0.27.0/tests/rust/sentinel.rs
diff --git a/cbindgen-0.24.5/tests/rust/sentinel.toml b/cbindgen-0.27.0/tests/rust/sentinel.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/sentinel.toml
rename to cbindgen-0.27.0/tests/rust/sentinel.toml
diff --git a/cbindgen-0.24.5/tests/rust/simplify_option_ptr.rs b/cbindgen-0.27.0/tests/rust/simplify_option_ptr.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/simplify_option_ptr.rs
rename to cbindgen-0.27.0/tests/rust/simplify_option_ptr.rs
diff --git a/cbindgen-0.24.5/tests/rust/size_types.rs b/cbindgen-0.27.0/tests/rust/size_types.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/size_types.rs
rename to cbindgen-0.27.0/tests/rust/size_types.rs
diff --git a/cbindgen-0.24.5/tests/rust/size_types.toml b/cbindgen-0.27.0/tests/rust/size_types.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/size_types.toml
rename to cbindgen-0.27.0/tests/rust/size_types.toml
diff --git a/cbindgen-0.24.5/tests/rust/static.rs b/cbindgen-0.27.0/tests/rust/static.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/static.rs
rename to cbindgen-0.27.0/tests/rust/static.rs
diff --git a/cbindgen-0.24.5/tests/rust/std_lib.rs b/cbindgen-0.27.0/tests/rust/std_lib.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/std_lib.rs
rename to cbindgen-0.27.0/tests/rust/std_lib.rs
diff --git a/cbindgen-0.24.5/tests/rust/struct.rs b/cbindgen-0.27.0/tests/rust/struct.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/struct.rs
rename to cbindgen-0.27.0/tests/rust/struct.rs
diff --git a/cbindgen-0.24.5/tests/rust/struct_literal.rs b/cbindgen-0.27.0/tests/rust/struct_literal.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/struct_literal.rs
rename to cbindgen-0.27.0/tests/rust/struct_literal.rs
diff --git a/cbindgen-0.24.5/tests/rust/struct_literal_order.rs b/cbindgen-0.27.0/tests/rust/struct_literal_order.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/struct_literal_order.rs
rename to cbindgen-0.27.0/tests/rust/struct_literal_order.rs
diff --git a/cbindgen-0.24.5/tests/rust/struct_self.rs b/cbindgen-0.27.0/tests/rust/struct_self.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/struct_self.rs
rename to cbindgen-0.27.0/tests/rust/struct_self.rs
diff --git a/cbindgen-0.24.5/tests/rust/style_crash.rs b/cbindgen-0.27.0/tests/rust/style_crash.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/style_crash.rs
rename to cbindgen-0.27.0/tests/rust/style_crash.rs
diff --git a/cbindgen-0.24.5/tests/rust/swift_name.rs b/cbindgen-0.27.0/tests/rust/swift_name.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/swift_name.rs
rename to cbindgen-0.27.0/tests/rust/swift_name.rs
diff --git a/cbindgen-0.24.5/tests/rust/swift_name.toml b/cbindgen-0.27.0/tests/rust/swift_name.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/swift_name.toml
rename to cbindgen-0.27.0/tests/rust/swift_name.toml
diff --git a/cbindgen-0.24.5/tests/rust/transform_op.rs b/cbindgen-0.27.0/tests/rust/transform_op.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/transform_op.rs
rename to cbindgen-0.27.0/tests/rust/transform_op.rs
diff --git a/cbindgen-0.24.5/tests/rust/transform_op.toml b/cbindgen-0.27.0/tests/rust/transform_op.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/transform_op.toml
rename to cbindgen-0.27.0/tests/rust/transform_op.toml
diff --git a/cbindgen-0.24.5/tests/rust/transparent.rs b/cbindgen-0.27.0/tests/rust/transparent.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/transparent.rs
rename to cbindgen-0.27.0/tests/rust/transparent.rs
diff --git a/cbindgen-0.24.5/tests/rust/typedef.rs b/cbindgen-0.27.0/tests/rust/typedef.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/typedef.rs
rename to cbindgen-0.27.0/tests/rust/typedef.rs
diff --git a/cbindgen-0.24.5/tests/rust/union.rs b/cbindgen-0.27.0/tests/rust/union.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/union.rs
rename to cbindgen-0.27.0/tests/rust/union.rs
diff --git a/cbindgen-0.24.5/tests/rust/union_self.rs b/cbindgen-0.27.0/tests/rust/union_self.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/union_self.rs
rename to cbindgen-0.27.0/tests/rust/union_self.rs
diff --git a/cbindgen-0.24.5/tests/rust/using_namespaces.rs b/cbindgen-0.27.0/tests/rust/using_namespaces.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/using_namespaces.rs
rename to cbindgen-0.27.0/tests/rust/using_namespaces.rs
diff --git a/cbindgen-0.24.5/tests/rust/using_namespaces.toml b/cbindgen-0.27.0/tests/rust/using_namespaces.toml
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/using_namespaces.toml
rename to cbindgen-0.27.0/tests/rust/using_namespaces.toml
diff --git a/cbindgen-0.27.0/tests/rust/va_list.rs b/cbindgen-0.27.0/tests/rust/va_list.rs
new file mode 100644
index 0000000..db8bdd0
--- /dev/null
+++ b/cbindgen-0.27.0/tests/rust/va_list.rs
@@ -0,0 +1,30 @@
+use std::ffi::VaList;
+
+#[no_mangle]
+pub unsafe extern "C" fn va_list_test(count: int32_t, mut ap: VaList) -> int32_t {
+ ap.arg()
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn va_list_test2(count: int32_t, mut ap: ...) -> int32_t {
+ ap.arg()
+}
+
+type VaListFnPtr = Option<unsafe extern "C" fn(count: int32_t, VaList) -> int32_t>;
+type VaListFnPtr2 = Option<unsafe extern "C" fn(count: int32_t, ...) -> int32_t>;
+
+#[repr(C)]
+struct Interface<T> {
+ fn1: T,
+}
+
+#[no_mangle]
+pub extern "C" fn va_list_fn_ptrs(
+ fn1: Option<unsafe extern "C" fn(count: int32_t, VaList) -> int32_t>,
+ fn2: Option<unsafe extern "C" fn(count: int32_t, ...) -> int32_t>,
+ fn3: VaListFnPtr,
+ fn4: VaListFnPtr2,
+ fn5: Interface<Option<unsafe extern "C" fn(count: int32_t, VaList) -> int32_t>>,
+ fn6: Interface<Option<unsafe extern "C" fn(count: int32_t, ...) -> int32_t>>,
+) {
+}
diff --git a/cbindgen-0.24.5/tests/rust/zst.rs b/cbindgen-0.27.0/tests/rust/zst.rs
similarity index 100%
rename from cbindgen-0.24.5/tests/rust/zst.rs
rename to cbindgen-0.27.0/tests/rust/zst.rs
diff --git a/cbindgen-0.24.5/tests/testing-helpers.h b/cbindgen-0.27.0/tests/testing-helpers.h
similarity index 100%
rename from cbindgen-0.24.5/tests/testing-helpers.h
rename to cbindgen-0.27.0/tests/testing-helpers.h
diff --git a/cbindgen-0.27.0/tests/tests.rs b/cbindgen-0.27.0/tests/tests.rs
new file mode 100644
index 0000000..eebabef
--- /dev/null
+++ b/cbindgen-0.27.0/tests/tests.rs
@@ -0,0 +1,386 @@
+extern crate cbindgen;
+
+use cbindgen::*;
+use std::collections::HashSet;
+use std::fs::File;
+use std::io::Read;
+use std::path::Path;
+use std::process::Command;
+use std::{env, fs, str};
+
+use pretty_assertions::assert_eq;
+
+// Set automatically by cargo for integration tests
+static CBINDGEN_PATH: &str = env!("CARGO_BIN_EXE_cbindgen");
+
+fn style_str(style: Style) -> &'static str {
+ match style {
+ Style::Both => "both",
+ Style::Tag => "tag",
+ Style::Type => "type",
+ }
+}
+
+fn run_cbindgen(
+ path: &Path,
+ output: Option<&Path>,
+ language: Language,
+ cpp_compat: bool,
+ style: Option<Style>,
+ generate_depfile: bool,
+ package_version: bool,
+) -> (Vec<u8>, Option<String>) {
+ assert!(
+ !(output.is_none() && generate_depfile),
+ "generating a depfile requires outputting to a path"
+ );
+ let program = Path::new(CBINDGEN_PATH);
+ let mut command = Command::new(program);
+ if let Some(output) = output {
+ command.arg("--output").arg(output);
+ }
+ let cbindgen_depfile = if generate_depfile {
+ let depfile = tempfile::NamedTempFile::new().unwrap();
+ command.arg("--depfile").arg(depfile.path());
+ Some(depfile)
+ } else {
+ None
+ };
+
+ match language {
+ Language::Cxx => {}
+ Language::C => {
+ command.arg("--lang").arg("c");
+
+ if cpp_compat {
+ command.arg("--cpp-compat");
+ }
+ }
+ Language::Cython => {
+ command.arg("--lang").arg("cython");
+ }
+ }
+
+ if package_version {
+ command.arg("--package-version");
+ }
+
+ if let Some(style) = style {
+ command.arg("--style").arg(style_str(style));
+ }
+
+ let config = path.with_extension("toml");
+ if config.exists() {
+ command.arg("--config").arg(config);
+ }
+
+ command.arg(path);
+
+ println!("Running: {:?}", command);
+ let cbindgen_output = command.output().expect("failed to execute process");
+
+ assert!(
+ cbindgen_output.status.success(),
+ "cbindgen failed: {:?} with error: {}",
+ output,
+ str::from_utf8(&cbindgen_output.stderr).unwrap_or_default()
+ );
+
+ let bindings = if let Some(output_path) = output {
+ let mut bindings = Vec::new();
+ // Ignore errors here, we have assertions on the expected output later.
+ let _ = File::open(output_path).map(|mut file| {
+ let _ = file.read_to_end(&mut bindings);
+ });
+ bindings
+ } else {
+ cbindgen_output.stdout
+ };
+
+ let depfile_contents = if let Some(mut depfile) = cbindgen_depfile {
+ let mut raw = Vec::new();
+ depfile.read_to_end(&mut raw).unwrap();
+ Some(
+ str::from_utf8(raw.as_slice())
+ .expect("Invalid encoding encountered in depfile")
+ .into(),
+ )
+ } else {
+ None
+ };
+ (bindings, depfile_contents)
+}
+
+fn compile(
+ cbindgen_output: &Path,
+ tests_path: &Path,
+ tmp_dir: &Path,
+ language: Language,
+ style: Option<Style>,
+ skip_warning_as_error: bool,
+) {
+ let cc = match language {
+ Language::Cxx => env::var("CXX").unwrap_or_else(|_| "g++".to_owned()),
+ Language::C => env::var("CC").unwrap_or_else(|_| "gcc".to_owned()),
+ Language::Cython => env::var("CYTHON").unwrap_or_else(|_| "cython".to_owned()),
+ };
+
+ let file_name = cbindgen_output
+ .file_name()
+ .expect("cbindgen output should be a file");
+ let mut object = tmp_dir.join(file_name);
+ object.set_extension("o");
+
+ let mut command = Command::new(cc);
+ match language {
+ Language::Cxx | Language::C => {
+ command.arg("-D").arg("DEFINED");
+ command.arg("-I").arg(tests_path);
+ command.arg("-Wall");
+ if !skip_warning_as_error {
+ command.arg("-Werror");
+ }
+ // `swift_name` is not recognzied by gcc.
+ command.arg("-Wno-attributes");
+ // clang warns about unused const variables.
+ command.arg("-Wno-unused-const-variable");
+ // clang also warns about returning non-instantiated templates (they could
+ // be specialized, but they're not so it's fine).
+ command.arg("-Wno-return-type-c-linkage");
+ // deprecated warnings should not be errors as it's intended
+ command.arg("-Wno-deprecated-declarations");
+
+ if let Language::Cxx = language {
+ // enum class is a c++11 extension which makes g++ on macos 10.14 error out
+ // inline variables are are a c++17 extension
+ command.arg("-std=c++17");
+ // Prevents warnings when compiling .c files as c++.
+ command.arg("-x").arg("c++");
+ if let Ok(extra_flags) = env::var("CXXFLAGS") {
+ command.args(extra_flags.split_whitespace());
+ }
+ } else if let Ok(extra_flags) = env::var("CFLAGS") {
+ command.args(extra_flags.split_whitespace());
+ }
+
+ if let Some(style) = style {
+ command.arg("-D");
+ command.arg(format!(
+ "CBINDGEN_STYLE_{}",
+ style_str(style).to_uppercase()
+ ));
+ }
+
+ command.arg("-o").arg(&object);
+ command.arg("-c").arg(cbindgen_output);
+ }
+ Language::Cython => {
+ command.arg("-Wextra");
+ if !skip_warning_as_error {
+ // Our tests contain code that is deprecated in Cython 3.0.
+ // Allowing warnings buys a little time.
+ // command.arg("-Werror");
+ }
+ command.arg("-3");
+ command.arg("-o").arg(&object);
+ command.arg(cbindgen_output);
+ }
+ }
+
+ println!("Running: {:?}", command);
+ let out = command.output().expect("failed to compile");
+ assert!(out.status.success(), "Output failed to compile: {:?}", out);
+
+ if object.exists() {
+ fs::remove_file(object).unwrap();
+ }
+}
+
+const SKIP_WARNING_AS_ERROR_SUFFIX: &str = ".skip_warning_as_error";
+
+#[allow(clippy::too_many_arguments)]
+fn run_compile_test(
+ name: &'static str,
+ path: &Path,
+ tmp_dir: &Path,
+ language: Language,
+ cpp_compat: bool,
+ style: Option<Style>,
+ cbindgen_outputs: &mut HashSet<Vec<u8>>,
+ package_version: bool,
+) {
+ let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
+ let tests_path = Path::new(&crate_dir).join("tests");
+ let mut generated_file = tests_path.join("expectations");
+ fs::create_dir_all(&generated_file).unwrap();
+
+ let style_ext = style
+ // Cython is sensitive to dots, so we can't include any dots.
+ .map(|style| match style {
+ Style::Both => "_both",
+ Style::Tag => "_tag",
+ Style::Type => "",
+ })
+ .unwrap_or_default();
+ let lang_ext = match language {
+ Language::Cxx => ".cpp",
+ Language::C if cpp_compat => ".compat.c",
+ Language::C => ".c",
+ // cbindgen is supposed to generate declaration files (`.pxd`), but `cython` compiler
+ // is extension-sensitive and won't work on them, so we use implementation files (`.pyx`)
+ // in the test suite.
+ Language::Cython => ".pyx",
+ };
+
+ let skip_warning_as_error = name.rfind(SKIP_WARNING_AS_ERROR_SUFFIX).is_some();
+
+ let source_file =
+ format!("{}{}{}", name, style_ext, lang_ext).replace(SKIP_WARNING_AS_ERROR_SUFFIX, "");
+
+ generated_file.push(source_file);
+
+ let (output_file, generate_depfile) = if env::var_os("CBINDGEN_TEST_VERIFY").is_some() {
+ (None, false)
+ } else {
+ (
+ Some(generated_file.as_path()),
+ // --depfile does not work in combination with expanding yet, so we blacklist expanding tests.
+ !(name.contains("expand") || name.contains("bitfield")),
+ )
+ };
+
+ let (cbindgen_output, depfile_contents) = run_cbindgen(
+ path,
+ output_file,
+ language,
+ cpp_compat,
+ style,
+ generate_depfile,
+ package_version,
+ );
+ if generate_depfile {
+ let depfile = depfile_contents.expect("No depfile generated");
+ assert!(!depfile.is_empty());
+ let mut rules = depfile.split(':');
+ let target = rules.next().expect("No target found");
+ assert_eq!(target, generated_file.as_os_str().to_str().unwrap());
+ let sources = rules.next().unwrap();
+ // All the tests here only have one sourcefile.
+ assert!(
+ sources.contains(path.to_str().unwrap()),
+ "Path: {:?}, Depfile contents: {}",
+ path,
+ depfile
+ );
+ assert_eq!(rules.count(), 0, "More than 1 rule in the depfile");
+ }
+
+ if cbindgen_outputs.contains(&cbindgen_output) {
+ // We already generated an identical file previously.
+ if env::var_os("CBINDGEN_TEST_VERIFY").is_some() {
+ assert!(!generated_file.exists());
+ } else if generated_file.exists() {
+ fs::remove_file(&generated_file).unwrap();
+ }
+ } else {
+ if env::var_os("CBINDGEN_TEST_VERIFY").is_some() {
+ use std::str::from_utf8;
+ let prev_cbindgen_output = fs::read(&generated_file).unwrap();
+ let cbindgen_output = from_utf8(&cbindgen_output).unwrap();
+ let prev_cbindgen_output = from_utf8(&prev_cbindgen_output).unwrap();
+ assert_eq!(prev_cbindgen_output, cbindgen_output);
+ } else {
+ fs::write(&generated_file, &cbindgen_output).unwrap();
+ }
+
+ cbindgen_outputs.insert(cbindgen_output);
+
+ if env::var_os("CBINDGEN_TEST_NO_COMPILE").is_some() {
+ return;
+ }
+
+ compile(
+ &generated_file,
+ &tests_path,
+ tmp_dir,
+ language,
+ style,
+ skip_warning_as_error,
+ );
+
+ if language == Language::C && cpp_compat {
+ compile(
+ &generated_file,
+ &tests_path,
+ tmp_dir,
+ Language::Cxx,
+ style,
+ skip_warning_as_error,
+ );
+ }
+ }
+}
+
+fn test_file(name: &'static str, filename: &'static str) {
+ let test = Path::new(filename);
+ let tmp_dir = tempfile::Builder::new()
+ .prefix("cbindgen-test-output")
+ .tempdir()
+ .expect("Creating tmp dir failed");
+ let tmp_dir = tmp_dir.path();
+ // Run tests in deduplication priority order. C++ compatibility tests are run first,
+ // otherwise we would lose the C++ compiler run if they were deduplicated.
+ let mut cbindgen_outputs = HashSet::new();
+ for cpp_compat in &[true, false] {
+ for style in &[Style::Type, Style::Tag, Style::Both] {
+ run_compile_test(
+ name,
+ test,
+ tmp_dir,
+ Language::C,
+ *cpp_compat,
+ Some(*style),
+ &mut cbindgen_outputs,
+ false,
+ );
+ }
+ }
+
+ run_compile_test(
+ name,
+ test,
+ tmp_dir,
+ Language::Cxx,
+ /* cpp_compat = */ false,
+ None,
+ &mut HashSet::new(),
+ false,
+ );
+
+ // `Style::Both` should be identical to `Style::Tag` for Cython.
+ let mut cbindgen_outputs = HashSet::new();
+ for style in &[Style::Type, Style::Tag] {
+ run_compile_test(
+ name,
+ test,
+ tmp_dir,
+ Language::Cython,
+ /* cpp_compat = */ false,
+ Some(*style),
+ &mut cbindgen_outputs,
+ false,
+ );
+ }
+}
+
+macro_rules! test_file {
+ ($test_function_name:ident, $name:expr, $file:tt) => {
+ #[test]
+ fn $test_function_name() {
+ test_file($name, $file);
+ }
+ };
+}
+
+// This file is generated by build.rs
+include!(concat!(env!("OUT_DIR"), "/tests.rs"));