!13 回退 'Pull Request !9 : bindgen升级0.70.1版本'

Merge pull request !13 from oh_ci/revert-merge-9-master
This commit is contained in:
oh_ci
2025-04-19 07:10:58 +00:00
committed by Gitee
761 changed files with 31339 additions and 22716 deletions
+52 -101
View File
@@ -7,98 +7,64 @@ on:
pull_request:
branches:
- main
merge_group:
branches:
- main
jobs:
rustfmt-clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Install stable
uses: dtolnay/rust-toolchain@master
uses: actions-rs/toolchain@v1
with:
profile: minimal
# TODO: Should ideally be stable, but we use some nightly-only
# features.
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Run rustfmt
run: cargo fmt -- --check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Run clippy
run: cargo clippy --tests
uses: actions-rs/cargo@v1
with:
command: clippy
args: --tests
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Install msrv for lib
uses: dtolnay/rust-toolchain@master
- name: Install msrv
uses: actions-rs/toolchain@v1
with:
profile: minimal
# MSRV below is documented in Cargo.toml and README.md, please update those if you
# change this.
toolchain: 1.70.0
toolchain: 1.60.0
override: true
- name: Test lib with msrv
run: cargo +1.70.0 test --package bindgen
- name: Install msrv for cli
uses: dtolnay/rust-toolchain@master
with:
# MSRV below is documented in Cargo.toml and README.md, please update those if you
# change this.
toolchain: 1.70.0
- name: Test cli with msrv
run: cargo +1.70.0 build --package bindgen-cli
minimal:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Check without default features
run: cargo check -p bindgen --no-default-features --features=runtime
docs:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- name: Install stable
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Generate documentation for `bindgen`
run: cargo doc --document-private-items --no-deps -p bindgen
- name: Generate documentation for `bindgen-cli`
run: cargo doc --document-private-items --no-deps -p bindgen-cli
- name: Build with msrv
run: rm Cargo.lock && cargo +1.60.0 build --lib
quickchecking:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Install stable
uses: dtolnay/rust-toolchain@master
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
# TODO: Actually run quickchecks once `bindgen` is reliable enough.
- name: Build quickcheck tests
@@ -108,14 +74,18 @@ jobs:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, macos-12]
# TODO(#1954): These should be run on mac too, but turns out they're
# broken.
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Install stable
uses: dtolnay/rust-toolchain@master
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Test expectations
run: cd bindgen-tests/tests/expectations && cargo test
@@ -129,7 +99,7 @@ jobs:
- debian: null
cross: null
rust: null
llvm_version: ["9.0", "16.0"]
llvm_version: ["5.0", "9.0"]
main_tests: [1]
release_build: [0, 1]
no_default_features: [0, 1]
@@ -137,15 +107,17 @@ jobs:
# `static` feature is not testable atm.
feature_runtime: [0, 1]
feature_extra_asserts: [0]
feature_testing_only_docs: [0]
include:
# Test with extra asserts + docs just with latest llvm versions to
# prevent explosion
- os: ubuntu-latest
llvm_version: "16.0"
llvm_version: "9.0"
release_build: 0
no_default_features: 0
feature_extra_asserts: 1
feature_testing_only_docs: 1
# FIXME: Seems installing multiarch packages fails:
#
@@ -156,22 +128,21 @@ jobs:
# debian: arm64
# cross: aarch64-linux-gnu
# rust: aarch64-unknown-linux-gnu
# llvm_version: "16.0"
# llvm_version: "9.0"
# main_tests: 0
# release_build: 0
# feature_extra_asserts: 0
# feature_testing_only_docs: 0
# Ensure stuff works on macos too
# FIXME: Ideally should use the latest llvm version, but llvm doesn't
# provide releases for x86-64 macOS anymore which is what the runner uses.
#
- os: macos-12
- os: macos-latest
llvm_version: "9.0"
release_build: 0
no_default_features: 0
feature_extra_asserts: 0
feature_testing_only_docs: 0
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Install multiarch packages
if: matrix.target.debian
@@ -189,10 +160,12 @@ jobs:
sudo apt-get install libc6:${{matrix.target.debian}} libstdc++6:${{matrix.target.debian}}
- name: Install stable
uses: dtolnay/rust-toolchain@master
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{matrix.target.rust}}
override: true
- name: Install libtinfo
if: matrix.os == 'ubuntu-latest'
run: |
@@ -208,28 +181,21 @@ jobs:
BINDGEN_RELEASE_BUILD: ${{matrix.release_build}}
BINDGEN_FEATURE_RUNTIME: ${{matrix.feature_runtime}}
BINDGEN_FEATURE_EXTRA_ASSERTS: ${{matrix.feature_extra_asserts}}
BINDGEN_FEATURE_TESTING_ONLY_DOCS: ${{matrix.feature_testing_only_docs}}
BINDGEN_NO_DEFAULT_FEATURES: ${{matrix.no_default_features}}
run: ./ci/test.sh
check-cfg:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- name: Install nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Check cfg
run: cargo check -Z unstable-options -Z check-cfg
test-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Install stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
# NOTE(emilio): Change deploy-book as well if you change this.
- name: Test book
@@ -237,18 +203,3 @@ jobs:
curl -L https://github.com/rust-lang/mdBook/releases/download/v0.4.5/mdbook-v0.4.5-x86_64-unknown-linux-gnu.tar.gz | tar xz
./mdbook build book
./mdbook test book
# One job that "summarizes" the success state of this pipeline. This can then
# be added to branch protection, rather than having to add each job
# separately.
success:
runs-on: ubuntu-latest
needs: [rustfmt-clippy, msrv, minimal, docs, quickchecking, test-expectations, test, check-cfg, test-book]
# GitHub branch protection is exceedingly silly and treats "jobs skipped
# because a dependency failed" as success. So we have to do some
# contortions to ensure the job fails if any of its dependencies fails.
if: always() # make sure this is never "skipped"
steps:
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: check if any dependency failed
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
-68
View File
@@ -1,68 +0,0 @@
name: Bump version for release
on:
workflow_dispatch:
inputs:
level:
description: |
Select the level of the release
required: true
type: choice
options:
- minor
- patch
jobs:
bump-version:
permissions:
id-token: write
pull-requests: write
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure gitsign
uses: chainguard-dev/actions/setup-gitsign@main
- name: Install cargo-release
uses: taiki-e/install-action@v1
with:
tool: cargo-release
- name: Install sd
uses: taiki-e/install-action@v1
with:
tool: sd
- name: Install npm
uses: actions/setup-node@v4
- name: Install doctoc
run: npm install doctoc
- name: Bump version
run: |
cargo release version ${{ inputs.level }} --execute --no-confirm
- name: Extract version
run: |
echo "version=$(cargo pkgid -p bindgen | cut -d '#' -f 2)" >> $GITHUB_ENV
- name: Update changelog
run: |
sd "# Unreleased" "# Unreleased\n## Added\n## Changed\n## Removed\n## Fixed\n## Security\n\n# ${{ env.version }} ($(date -I))" CHANGELOG.md
./node_modules/doctoc/doctoc.js CHANGELOG.md
- name: Create PR
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: bump-version/${{ env.version }}
base: main
commit-message: "Bump crates version to ${{ env.version }}"
title: "Bump crates version to ${{ env.version }}"
body: |
This pull request was created automatically by GitHub Actions.
-27
View File
@@ -1,27 +0,0 @@
name: Create tag for release
on:
pull_request:
types:
- closed
jobs:
create-tag:
if: github.event.pull_request.merged == true && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name && startsWith(github.event.pull_request.head.ref, 'bump-version')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Extract version
run: |
echo "version=$(cargo pkgid -p bindgen | cut -d '#' -f 2)" >> $GITHUB_ENV
- name: Create tag
run: |
TAG_NAME="v${{ env.version }}"
git tag $TAG_NAME
git push origin $TAG_NAME
+8 -1
View File
@@ -9,10 +9,17 @@ jobs:
deploy-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Install stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Test book
run: |
curl -L https://github.com/rust-lang/mdBook/releases/download/v0.4.5/mdbook-v0.4.5-x86_64-unknown-linux-gnu.tar.gz | tar xz
-24
View File
@@ -1,24 +0,0 @@
# This is triggered after the Release workflow successfully completes its run
on:
workflow_run:
workflows:
- Release
types:
- completed
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
jobs:
cargo-publish:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Publish bindgen (lib)
run: cargo publish --package bindgen --token ${CARGO_REGISTRY_TOKEN}
- name: Publish bindgen-cli
run: cargo publish --package bindgen-cli --token ${CARGO_REGISTRY_TOKEN}
-266
View File
@@ -1,266 +0,0 @@
# Copyright 2022-2023, axodotdev
# SPDX-License-Identifier: MIT or Apache-2.0
#
# CI that:
#
# * checks for a Git Tag that looks like a release
# * builds artifacts with cargo-dist (archives, installers, hashes)
# * uploads those artifacts to temporary workflow zip
# * on success, uploads the artifacts to a Github Release
#
# Note that the Github Release will be created with a generated
# title/body based on your changelogs.
name: Release
permissions:
contents: write
# This task will run whenever you push a git tag that looks like a version
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
# Various formats will be parsed into a VERSION and an optional PACKAGE_NAME, where
# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION
# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
#
# If PACKAGE_NAME is specified, then the announcement will be for that
# package (erroring out if it doesn't have the given version or isn't cargo-dist-able).
#
# If PACKAGE_NAME isn't specified, then the announcement will be for all
# (cargo-dist-able) packages in the workspace with that version (this mode is
# intended for workspaces with only one dist-able package, or with all dist-able
# packages versioned/released in lockstep).
#
# If you push multiple tags at once, separate instances of this workflow will
# spin up, creating an independent announcement for each one. However Github
# will hard limit this to 3 tags per commit, as it will assume more tags is a
# mistake.
#
# If there's a prerelease-style suffix to the version, then the release(s)
# will be marked as a prerelease.
on:
push:
tags:
- '**[0-9]+.[0-9]+.[0-9]+*'
pull_request:
jobs:
# Run 'cargo dist plan' (or host) to determine what tasks we need to do
plan:
runs-on: ubuntu-latest
outputs:
val: ${{ steps.plan.outputs.manifest }}
tag: ${{ !github.event.pull_request && github.ref_name || '' }}
tag-flag: ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }}
publishing: ${{ !github.event.pull_request }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install cargo-dist
# we specify bash to get pipefail; it guards against the `curl` command
# failing. otherwise `sh` won't catch that `curl` returned non-0
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.12.0/cargo-dist-installer.sh | sh"
# sure would be cool if github gave us proper conditionals...
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
# functionality based on whether this is a pull_request, and whether it's from a fork.
# (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
# but also really annoying to build CI around when it needs secrets to work right.)
- id: plan
run: |
cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
echo "cargo dist ran successfully"
cat plan-dist-manifest.json
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
- name: "Upload dist-manifest.json"
uses: actions/upload-artifact@v4
with:
name: artifacts-plan-dist-manifest
path: plan-dist-manifest.json
# Build and packages all the platform-specific things
build-local-artifacts:
name: build-local-artifacts (${{ join(matrix.targets, ', ') }})
# Let the initial task tell us to not run (currently very blunt)
needs:
- plan
if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }}
strategy:
fail-fast: false
# Target platforms/runners are computed by cargo-dist in create-release.
# Each member of the matrix has the following arguments:
#
# - runner: the github runner
# - dist-args: cli flags to pass to cargo dist
# - install-dist: expression to run to install cargo-dist on the runner
#
# Typically there will be:
# - 1 "global" task that builds universal installers
# - N "local" tasks that build each platform's binaries and platform-specific installers
matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
runs-on: ${{ matrix.runner }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: swatinem/rust-cache@v2
- name: Install cargo-dist
run: ${{ matrix.install_dist }}
# Get the dist-manifest
- name: Fetch local artifacts
uses: actions/download-artifact@v4
with:
pattern: artifacts-*
path: target/distrib/
merge-multiple: true
- name: Install dependencies
run: |
${{ matrix.packages_install }}
- name: Build artifacts
run: |
# Actually do builds and make zips and whatnot
cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
echo "cargo dist ran successfully"
- id: cargo-dist
name: Post-build
# We force bash here just because github makes it really hard to get values up
# to "real" actions without writing to env-vars, and writing to env-vars has
# inconsistent syntax between shell and powershell.
shell: bash
run: |
# Parse out what we just built and upload it to scratch storage
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
- name: "Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: artifacts-build-local-${{ join(matrix.targets, '_') }}
path: |
${{ steps.cargo-dist.outputs.paths }}
${{ env.BUILD_MANIFEST_NAME }}
# Build and package all the platform-agnostic(ish) things
build-global-artifacts:
needs:
- plan
- build-local-artifacts
runs-on: "ubuntu-20.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install cargo-dist
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.12.0/cargo-dist-installer.sh | sh"
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
- name: Fetch local artifacts
uses: actions/download-artifact@v4
with:
pattern: artifacts-*
path: target/distrib/
merge-multiple: true
- id: cargo-dist
shell: bash
run: |
cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
echo "cargo dist ran successfully"
# Parse out what we just built and upload it to scratch storage
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
- name: "Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: artifacts-build-global
path: |
${{ steps.cargo-dist.outputs.paths }}
${{ env.BUILD_MANIFEST_NAME }}
# Determines if we should publish/announce
host:
needs:
- plan
- build-local-artifacts
- build-global-artifacts
# Only run if we're "publishing", and only if local and global didn't fail (skipped is fine)
if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: "ubuntu-20.04"
outputs:
val: ${{ steps.host.outputs.manifest }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install cargo-dist
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.12.0/cargo-dist-installer.sh | sh"
# Fetch artifacts from scratch-storage
- name: Fetch artifacts
uses: actions/download-artifact@v4
with:
pattern: artifacts-*
path: target/distrib/
merge-multiple: true
# This is a harmless no-op for Github Releases, hosting for that happens in "announce"
- id: host
shell: bash
run: |
cargo dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
echo "artifacts uploaded and released successfully"
cat dist-manifest.json
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
- name: "Upload dist-manifest.json"
uses: actions/upload-artifact@v4
with:
# Overwrite the previous copy
name: artifacts-dist-manifest
path: dist-manifest.json
# Create a Github Release while uploading all files to it
announce:
needs:
- plan
- host
# use "always() && ..." to allow us to wait for all publish jobs while
# still allowing individual publish jobs to skip themselves (for prereleases).
# "host" however must run to completion, no skipping allowed!
if: ${{ always() && needs.host.result == 'success' }}
runs-on: "ubuntu-20.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: "Download Github Artifacts"
uses: actions/download-artifact@v4
with:
pattern: artifacts-*
path: artifacts
merge-multiple: true
- name: Cleanup
run: |
# Remove the granular manifests
rm -f artifacts/*-dist-manifest.json
- name: Create Github Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.plan.outputs.tag }}
name: ${{ fromJson(needs.host.outputs.val).announcement_title }}
body: ${{ fromJson(needs.host.outputs.val).announcement_github_body }}
prerelease: ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
artifacts: "artifacts/*"
-5
View File
@@ -18,8 +18,3 @@ csmith-fuzzing/platform.info
# Backups of test cases from C-Reduce
**/*.orig
# node.js files
node_modules
package-lock.json
package.json
+114 -394
View File
@@ -7,456 +7,170 @@
- [Removed](#removed)
- [Fixed](#fixed)
- [Security](#security)
- [0.70.1 (2024-08-20)](#0701-2024-08-20)
- [0.64.0](#0640)
- [Added](#added-1)
- [Changed](#changed-1)
- [Removed](#removed-1)
- [Fixed](#fixed-1)
- [Security](#security-1)
- [0.70.0 (2024-08-16)](#0700-2024-08-16)
- [0.63.0](#0630)
- [Added](#added-2)
- [Changed](#changed-2)
- [Removed](#removed-2)
- [Fixed](#fixed-2)
- [Security](#security-2)
- [0.69.4 (2024-02-04)](#0694-2024-02-04)
- [0.62.0](#0620)
- [Added](#added-3)
- [Changed](#changed-3)
- [Removed](#removed-3)
- [Fixed](#fixed-3)
- [Security](#security-3)
- [0.69.3 (2024-02-04)](#0693-2024-02-04)
- [Fixed](#fixed-2)
- [0.61.0](#0610)
- [Added](#added-4)
- [Changed](#changed-4)
- [Removed](#removed-4)
- [Fixed](#fixed-4)
- [Security](#security-4)
- [0.69.2 (2024-01-13)](#0692-2024-01-13)
- [Added](#added-5)
- [Changed](#changed-5)
- [Removed](#removed-5)
- [Fixed](#fixed-5)
- [Security](#security-5)
- [0.69.1 (2023-11-02)](#0691-2023-11-02)
- [Fixed](#fixed-6)
- [0.69.0 (2023-11-01)](#0690-2023-11-01)
- [Added](#added-6)
- [Changed](#changed-6)
- [Removed](#removed-6)
- [Fixed](#fixed-7)
- [Security](#security-6)
- [0.68.1](#0681)
- [Fixed](#fixed-8)
- [0.68.0](#0680)
- [Added](#added-7)
- [Changed](#changed-7)
- [Removed](#removed-7)
- [Fixed](#fixed-9)
- [0.67.0](#0670)
- [0.66.1](#0661)
- [Removed](#removed-8)
- [0.66.0](#0660)
- [Added](#added-8)
- [Changed](#changed-8)
- [Removed](#removed-9)
- [0.65.1](#0651)
- [Fixed](#fixed-10)
- [0.65.0](#0650)
- [Added](#added-9)
- [Changed](#changed-9)
- [Removed](#removed-10)
- [0.64.0](#0640)
- [Added](#added-10)
- [Changed](#changed-10)
- [0.63.0](#0630)
- [Added](#added-11)
- [Changed](#changed-11)
- [Removed](#removed-11)
- [0.62.0](#0620)
- [Added](#added-12)
- [Changed](#changed-12)
- [Fixed](#fixed-11)
- [0.61.0](#0610)
- [Added](#added-13)
- [Changed](#changed-13)
- [Fixed](#fixed-12)
- [Fixed](#fixed-3)
- [0.60.1](#0601)
- [Fixed](#fixed-13)
- [Fixed](#fixed-4)
- [0.60.0](#0600)
- [Added](#added-14)
- [Fixed](#fixed-14)
- [Changed](#changed-14)
- [Removed](#removed-12)
- [Added](#added-5)
- [Fixed](#fixed-5)
- [Changed](#changed-5)
- [Removed](#removed-3)
- [0.59.2](#0592)
- [0.59.1](#0591)
- [Fixed](#fixed-15)
- [Fixed](#fixed-6)
- [0.59.0](#0590)
- [Added](#added-15)
- [Fixed](#fixed-16)
- [Changed](#changed-15)
- [Added](#added-6)
- [Fixed](#fixed-7)
- [Changed](#changed-6)
- [0.58.1](#0581)
- [Added](#added-16)
- [Added](#added-7)
- [0.58.0](#0580)
- [Added](#added-17)
- [Fixed](#fixed-17)
- [Changed](#changed-16)
- [Added](#added-8)
- [Fixed](#fixed-8)
- [Changed](#changed-7)
- [Deprecated](#deprecated)
- [Removed](#removed-13)
- [Fixed](#fixed-18)
- [Security](#security-7)
- [Removed](#removed-4)
- [Fixed](#fixed-9)
- [Security](#security-2)
- [0.57.0](#0570)
- [Added](#added-18)
- [Fixed](#fixed-19)
- [Added](#added-9)
- [Fixed](#fixed-10)
- [0.56.0](#0560)
- [Added](#added-19)
- [Changed](#changed-17)
- [Fixed](#fixed-20)
- [Added](#added-10)
- [Changed](#changed-8)
- [Fixed](#fixed-11)
- [0.55.1](#0551)
- [Fixed](#fixed-21)
- [Fixed](#fixed-12)
- [0.55.0](#0550)
- [Removed](#removed-14)
- [Added](#added-20)
- [Changed](#changed-18)
- [Fixed](#fixed-22)
- [Removed](#removed-5)
- [Added](#added-11)
- [Changed](#changed-9)
- [Fixed](#fixed-13)
- [0.54.1](#0541)
- [Added](#added-21)
- [Changed](#changed-19)
- [Fixed](#fixed-23)
- [Added](#added-12)
- [Changed](#changed-10)
- [Fixed](#fixed-14)
- [0.54.0](#0540)
- [Added](#added-22)
- [Added](#added-13)
- [Changed](#changed-11)
- [Fixed](#fixed-15)
- [0.53.3](#0533)
- [Added](#added-14)
- [Fixed](#fixed-16)
- [0.53.2](#0532)
- [Changed](#changed-12)
- [0.53.1](#0531)
- [Added](#added-15)
- [0.53.0](#0530)
- [Added](#added-16)
- [Changed](#changed-13)
- [Fixed](#fixed-17)
- [0.52.0](#0520)
- [Added](#added-17)
- [Changed](#changed-14)
- [Fixed](#fixed-18)
- [0.51.1](#0511)
- [Fixed](#fixed-19)
- [Changed](#changed-15)
- [0.51.0](#0510)
- [Fixed](#fixed-20)
- [Changed](#changed-16)
- [Added](#added-18)
- [0.50.0](#0500)
- [Added](#added-19)
- [0.49.3](#0493)
- [Added](#added-20)
- [0.49.2](#0492)
- [Changed](#changed-17)
- [0.49.1](#0491)
- [Fixed](#fixed-21)
- [Changed](#changed-18)
- [0.49.0](#0490)
- [Added](#added-21)
- [Fixed](#fixed-22)
- [Changed](#changed-19)
- [0.48.1](#0481)
- [Fixed](#fixed-23)
- [0.48.0](#0480)
- [Changed](#changed-20)
- [Fixed](#fixed-24)
- [0.53.3](#0533)
- [Added](#added-23)
- [Fixed](#fixed-25)
- [0.53.2](#0532)
- [0.47.4](#0474)
- [Added](#added-22)
- [0.47.3](#0473)
- [Changed](#changed-21)
- [0.53.1](#0531)
- [Added](#added-24)
- [0.53.0](#0530)
- [Added](#added-25)
- [0.47.2](#0472)
- [Fixed](#fixed-25)
- [0.47.1](#0471)
- [Changed](#changed-22)
- [Fixed](#fixed-26)
- [0.52.0](#0520)
- [Added](#added-26)
- [0.47.0](#0470)
- [Changed](#changed-23)
- [Fixed](#fixed-27)
- [0.51.1](#0511)
- [Fixed](#fixed-28)
- [Changed](#changed-24)
- [0.51.0](#0510)
- [Fixed](#fixed-29)
- [Changed](#changed-25)
- [Added](#added-27)
- [0.50.0](#0500)
- [Added](#added-28)
- [0.49.3](#0493)
- [Added](#added-29)
- [0.49.2](#0492)
- [Changed](#changed-26)
- [0.49.1](#0491)
- [Fixed](#fixed-30)
- [Changed](#changed-27)
- [0.49.0](#0490)
- [Added](#added-30)
- [Fixed](#fixed-31)
- [Changed](#changed-28)
- [0.48.1](#0481)
- [Fixed](#fixed-32)
- [0.48.0](#0480)
- [Changed](#changed-29)
- [Fixed](#fixed-33)
- [0.47.4](#0474)
- [Added](#added-31)
- [0.47.3](#0473)
- [Changed](#changed-30)
- [0.47.2](#0472)
- [Fixed](#fixed-34)
- [0.47.1](#0471)
- [Changed](#changed-31)
- [Fixed](#fixed-35)
- [0.47.0](#0470)
- [Changed](#changed-32)
- [Fixed](#fixed-36)
- [0.33.1 .. 0.46.0](#0331--0460)
- [Added](#added-32)
- [Removed](#removed-15)
- [Changed](#changed-33)
- [Fixed](#fixed-37)
- [Added](#added-23)
- [Removed](#removed-6)
- [Changed](#changed-24)
- [Fixed](#fixed-28)
- [0.33.1](#0331)
- [Fixed](#fixed-38)
- [Fixed](#fixed-29)
- [0.33.0](#0330)
- [0.32.2](#0322)
- [Fixed](#fixed-39)
- [Fixed](#fixed-30)
- [0.32.1](#0321)
- [Fixed](#fixed-40)
- [Fixed](#fixed-31)
- [0.32.0](#0320)
- [Added](#added-33)
- [Changed](#changed-34)
- [Fixed](#fixed-41)
- [Added](#added-24)
- [Changed](#changed-25)
- [Fixed](#fixed-32)
- [0.31.0](#0310)
- [Added](#added-34)
- [Changed](#changed-35)
- [Added](#added-25)
- [Changed](#changed-26)
- [Deprecated](#deprecated-1)
- [Removed](#removed-16)
- [Fixed](#fixed-42)
- [Removed](#removed-7)
- [Fixed](#fixed-33)
- [0.30.0](#0300)
- [Added](#added-35)
- [Changed](#changed-36)
- [Added](#added-26)
- [Changed](#changed-27)
- [Deprecated](#deprecated-2)
- [Fixed](#fixed-43)
- [Fixed](#fixed-34)
- [0.29.0](#0290)
- [Added](#added-36)
- [Changed](#changed-37)
- [Fixed](#fixed-44)
- [Added](#added-27)
- [Changed](#changed-28)
- [Fixed](#fixed-35)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
--------------------------------------------------------------------------------
# Unreleased
## Added
## Changed
## Removed
## Fixed
## Security
# 0.70.1 (2024-08-20)
## Added
## Changed
## Removed
## Fixed
- Fix regression where the `const` layout tests were triggering the `unnecessary_operation` and `identity_op` clippy warnings.
## Security
# 0.70.0 (2024-08-16)
## Added
- Add target mappings for riscv64imac and riscv32imafc.
- Add a complex macro fallback API (#2779).
- Add option to use DST structs for flexible arrays (--flexarray-dst, #2772).
- Add option to dynamically load variables (#2812).
- Add option in CLI to use rustified non-exhaustive enums (--rustified-non-exhaustive-enum, #2847).
## Changed
- Remove which and lazy-static dependencies (#2809, #2817).
- Generate compile-time layout tests (#2787).
- Print `bindgen-cli` errors to stderr instead of stdout (#2840)
## Removed
## Fixed
- Fix `--formatter=prettyplease` not working in `bindgen-cli` by adding `prettyplease` feature and
enabling it by default for `bindgen-cli` (#2789) .
- Fix `--allowlist-item` so anonymous enums are no longer ignored (#2827).
- Use clang_getFileLocation instead of clang_getSpellingLocation to fix clang-trunk (#2824).
- Fix generated constants: `f64::INFINITY`, `f64::NEG_ INFINITY`, `f64::NAN` (#2854).
## Security
- Update `tempfile` and `rustix` due to [GHSA-c827-hfw6-qwvm](https://github.com/advisories/GHSA-c827-hfw6-qwvm).
# 0.69.4 (2024-02-04)
## Added
## Changed
- Allow older itertools. (#2745)
## Removed
## Fixed
## Security
# 0.69.3 (2024-02-04)
## Added
- Added blocklist_var (#2731)
- Stabilized thiscall_abi (#2661)
## Changed
- Use CR consistently on windows (#2698)
- Replaced peeking_take_while by itertools (#2724)
## Removed
## Fixed
- Try to avoid repr(packed) for explicitly aligned types when not needed (#2734)
- Improved destructor handling on Windows (#2663)
- Support Float16 (#2667)
- Fix alignment contribution from bitfields (#2680)
- Fixed msrv build.
## Fixed
## Security
- Updated shlex dependency (RUSTSEC-2024-0006)
# 0.69.2 (2024-01-13)
## Added
## Changed
## Removed
## Fixed
- Fixed generation of extern "C" blocks with llvm 18+. See #2689.
## Security
# 0.69.1 (2023-11-02)
## Fixed
- Allow to run `bindgen -v` without an input header argument.
# 0.69.0 (2023-11-01)
## Added
- Added the `ParseCallbacks::header_file` callback which runs on every filename passed to `Builder::header`.
- Added the `CargoCallbacks::new` constructor which emits a cargo-rerun line
for every input header file by default.
- Added the `CargoCallbacks::rerun_on_header_files` method to configure whether
a cargo-rerun line should be emitted for every input header file.
## Changed
- The `--wrap-static-fns` feature was updated so function types that has no
argument use `void` as its sole argument.
- `CargoCallbacks` is no longer a [unit-like
struct](https://doc.rust-lang.org/reference/items/structs.html) and the
`CargoCallbacks` constant was added to mitigate the breaking nature of this
change. This constant has been marked as deprecated and users will have to
use the new `CargoCallbacks::new` method in the future.
## Removed
## Fixed
- Allow compiling `bindgen-cli` with a static libclang.
- Emit an opaque integer type for pointer types that don't have the same size
as the target's pointer size.
- Avoid escaping Objective-C method names unless they are `Self`, `self`,
`crate` or `super`.
## Security
# 0.68.1
## Fixed
- Fixed errors on the windows artifact build process.
# 0.68.0
## Added
- The `system` ABI is now supported as an option for the `--override-abi` flag.
- The `allowlist_item` method and the `--allowlist-item` flag have been
included to filter items regardless or their kind.
- Include installers as release artifacts on Github.
## Changed
- The `Clone` implementation for `_BindgenUnionField` has been changed to pass
the `incorrect_clone_impl_on_copy_type` Clippy lint.
- The `c_unwind` ABI can be used without a feature gate for any Rust target version
equal to or greater than 1.71.
This comes as a result of the ABI being stabilised (in Rust 1.71).
- Formatting changes when using prettyplease as a formatter due to a new
prettyplease version.
- Avoid generating invalid `CStr` constants when using the `--generate-cstr`
option.
## Removed
- The `extra_assert` and `extra_assert_eq` macros are no longer exported.
## Fixed
- Bindgen no longer panics when parsing an objective-C header that includes a
Rust keyword that cannot be a raw identifier, such as: `self`, `crate`,
`super` or `Self`.
# 0.67.0
This version was skipped due to some problems on the release workflow.
# 0.66.1
## Removed
* Revert source order sorting (#2543) due to correctness regressions #2558.
# 0.66.0
## Added
* Added the `--generate-cstr` CLI flag to generate string constants as `&CStr`
instead of `&[u8]`. (Requires Rust 1.59 or higher.)
* Added the `--generate-shell-completions` CLI flag to generate completions for
different shells.
* The `--wrap-static-fns` option can now wrap `va_list` functions as variadic functions
with the experimental `ParseCallbacks::wrap_as_variadic_fn` method.
* Add target mappings for riscv32imc and riscv32imac.
* Add the `ParseCallbacks::field_visibility` method to modify field visibility.
## Changed
* Non-UTF-8 string constants are now generated as references (`&[u8; SIZE]`)
instead of arrays (`[u8; SIZE]`) to match UTF-8 strings.
* Wrappers for static functions that return `void` no longer contain a `return`
statement and only call the static function instead.
* The `--wrap-static-fns` option no longer emits wrappers for static variadic
functions.
* Depfiles generated with `--depfile` or `Builder::depfile` will now properly
generate module names and paths that include spaces by escaping them. To make
the escaping clear and consistent, backslashes are also escaped.
* Updated `bitflags` dependency to 2.2.1. This changes the API of `CodegenConfig`.
* Prettyplease formatting is gated by an optional, enabled by default Cargo
feature when depending on `bindgen` as a library.
* Items are now parsed in the order they appear in source files. This may result in
auto-generated `_bindgen_*` names having a different index.
* Use default visibility for padding fields: Previously, padding fields were
always public. Now, they follow the default visibility for the type they are
in.
* Compute visibility of bitfield unit based on actual field visibility: A
bitfield unit field and its related functions now have their visibility
determined based on the most private between the default visibility and the
actual visibility of the bitfields within the unit.
## Removed
* Remove redundant Cargo features, which were all implicit:
- bindgen-cli: `env_logger` and `log` removed in favor of `logging`
- bindgen (lib):
+ `log` removed in favor of `logging`
+ `which` removed in favor of `which-logging`
+ `annotate-snippets` removed in favor of `experimental`
* Prettyplease is available as a `Formatter` variant now.
# 0.65.1
## Fixed
* The `Builder::rustfmt_bindings` method was added back and tagged as
deprecated instead of being removed.
* Broken documentation links were fixed.
# 0.65.0
## Added
* Added the `Builder::default_visibility` method and the
`--default-visibility` flag to set the default visibility of fields. (#2338)
* Added the `--formatter` CLI flag with the values `none`, `rustfmt` and
`prettyplease` to select which tool will be used to format the bindings. The
default value is `rustfmt`. (#2453)
* Added the `Builder::formatter` method and the `Formatter` type to select
which tool will be used to format the bindings. (#2453)
* Added the `Builder::emit_diagnostics` method and the `--emit-diagnostics`
flag to enable emission of diagnostic messages under the `experimental`
feature. (#2436)
* Added support for the `"efiapi"` calling convention (#2490).
* Added the `ParseCallbacks::read_env_var` method which runs everytime
`bindgen` reads and environment variable. (#2400)
* Added the `ParseCallbacks::generated_link_name_override` method which allow
overriding the link name of items. (#2425)
* Add support for C `enum`s when generating code while using the
`--wrap-static-fns` feature. (#2415)
## Changed
* Static functions with no arguments use `void` as their single argument
instead of having no arguments when the `--wrap-static-fns` flag is used.
(#2443)
* The source file generated when the `--wrap-static-fns` flag is enabled now
contains `#include` directives with all the input headers and all the source
code added with the `header_contents` method. (#2447)
* The source file generated when the `--wrap-static-fns` flag no longer uses
`asm` labeling and the link name of static wrapper functions is allowed to
be mangled. (#2448)
* The documentation of the generated `type` aliases now matches the comments
of their `typedef` counterparts instead of using the comments of the aliased
types. (#2463)
* The `Builder::rustfmt_bindings` methods and the `--no-rustfmt-bindings` flag
are now deprecated in favor of the formatter API. (#2453)
## Removed
* The following deprecated flags were removed: `--use-msvc-mangling`,
`--rustfmt-bindings` and `--size_t-is-usize`. (#2408)
* The `Bindings::emit_warnings` and `Bindings::warnings` methods were removed
in favor of `--emit-diagnostics`. (#2436)
* Bindgen no longer generates C string constants that cannot be represented as
byte slices. (#2487)
# 0.64.0
## Added
@@ -477,13 +191,19 @@ This version was skipped due to some problems on the release workflow.
* The `ParseCallbacks::generated_name_override` method now receives `ItemInfo<'_>` as
argument instead of a `&str`.
* Updated the `clang-sys` crate version to 1.4.0 to support clang 15.
* The return type is now omitted in signatures of functions returning `void`.
* The return type is now ommited in signatures of functions returning `void`.
* Updated the `clap` dependency for `bindgen-cli` to 4.
* Rewrote the `bindgen-cli` argument parser which could introduce unexpected
behavior changes.
behavior changes.
* The `ParseCallbacks::add_derives` method now receives `DeriveInfo<'_>` as
argument instead of a `&str`. This type also includes the kind of target type.
## Removed
## Fixed
## Security
# 0.63.0
## Added
@@ -1514,7 +1234,7 @@ Released 2017/10/27
We <3 folks who [help us find and fix issues via fuzzing][fuzzing]! *hint
hint*
* Added experimental support for the `thiscall` ABI when targeting Rust
* Added experimental support for the `thiscall` ABI when targetting Rust
nightly. [#1065][]
## Changed
+55 -107
View File
@@ -11,8 +11,6 @@ and introduce yourself.
- [Code of Conduct](#code-of-conduct)
- [Filing an Issue](#filing-an-issue)
- [Looking to Start Contributing to `bindgen`?](#looking-to-start-contributing-to-bindgen)
- [Prerequisites](#prerequisites)
- [`rustfmt` / `cargo fmt`](#rustfmt--cargo-fmt)
- [Building](#building)
- [Testing](#testing)
- [Overview](#overview)
@@ -35,11 +33,9 @@ and introduce yourself.
- [Writing a Predicate Script](#writing-a-predicate-script)
- [Cutting a new bindgen release](#cutting-a-new-bindgen-release)
- [Updating the changelog](#updating-the-changelog)
- [Bumping the version numbers.](#bumping-the-version-numbers)
- [Merge to `main`](#merge-to-main)
- [Tag and publish](#tag-and-publish)
- [Create a new release on Github](#create-a-new-release-on-github)
- [What to do if a Github release fails](#what-to-do-if-a-github-release-fails)
- [Create a new crates.io release](#create-a-new-cratesio-release)
- [Publish and add a git tag for the right commit](#publish-and-add-a-git-tag-for-the-right-commit)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -47,7 +43,7 @@ and introduce yourself.
We abide by the [Rust Code of Conduct][coc] and ask that you do as well.
[coc]: https://www.rust-lang.org/policies/code-of-conduct
[coc]: https://www.rust-lang.org/en-US/conduct.html
## Filing an Issue
@@ -58,7 +54,7 @@ issue, provide us with:
* The `bindgen` flags used to reproduce the issue with the header file
* The expected `bindgen` output
* The actual `bindgen` output
* The [debugging logs](#debug-logging) generated when running `bindgen` on this testcase
* The [debugging logs](#logs) generated when running `bindgen` on this testcase
## Looking to Start Contributing to `bindgen`?
@@ -67,17 +63,6 @@ issue, provide us with:
* [Issues labeled "help wanted"](https://github.com/rust-lang/rust-bindgen/labels/help%20wanted)
* Still can't find something to work on? [Drop a comment here](https://github.com/rust-lang/rust-bindgen/issues/747)
## Prerequisites
### `rustfmt` / `cargo fmt`
We use `nightly` channel for `rustfmt`,
so please set the appropriate setting in your editor/IDE for that.
For rust-analyzer, you can set `rustfmt.extraArgs = ['+nightly']`.
To check via command line, you can run `cargo +nightly fmt --check`.
## Building
To build the `bindgen` library and the `bindgen` executable:
@@ -94,6 +79,14 @@ versions of llvm, or specify the path of the desired libclang explicitly:
$ export LIBCLANG_PATH=path/to/clang-9.0/lib
```
Additionally, you may want to build and test with the `testing_only_docs`
feature to ensure that you aren't forgetting to document types and functions. CI
will catch it if you forget, but the turn around will be a lot slower ;)
```
$ cargo build --features testing_only_docs
```
## Testing
### Overview
@@ -107,18 +100,18 @@ There are also some integration tests in the `./bindgen-integration` crate, whic
generate bindings to some C++ code, and then uses the bindings, asserting that
values are what we expect them to be, both on the Rust and C++ side.
The generated and expected bindings are formatted with [prettyplease] before they are
compared. It is a default (but optional) dependency of `bindgen`,
so be sure to keep that in mind
(if you built `bindgen` with the `--no-default-features` option of Cargo).
Note also that `rustfmt` formatting is disabled for the `bindgen-tests/tests/expectations/`
directory tree, which helps avoid failing ui tests.
The generated and expected bindings are run through `rustfmt` before they are
compared. Make sure you have `rustfmt` up to date:
```
$ rustup update nightly
$ rustup component add rustfmt --toolchain nightly
```
Note: running `cargo test` from the root directory of `bindgen`'s repository does not
automatically test the generated bindings or run the integration tests.
These steps must be performed manually when needed.
### Testing Bindings Generation
To regenerate bindings from the corpus of test headers in `bindgen-tests/tests/headers` and
@@ -164,10 +157,10 @@ $ cargo test
### Testing a Single Header's Bindings Generation and Compiling its Bindings
Note: You will need to install [Graphviz](https://graphviz.org/) since that
Note: You will to need to install [Graphviz](https://graphviz.org/) since that
is a dependency for running `test-one.sh`.
Sometimes it's useful to work with one test header from start (generating
Sometimes its useful to work with one test header from start (generating
bindings for it) to finish (compiling the bindings and running their layout
tests). This can be done with the `bindgen-tests/tests/test-one.sh` script. It supports fuzzy
searching for test headers. For example, to test
@@ -210,13 +203,13 @@ can add multiple test expectations, one for each supported `libclang`
version. Instead of having a single `bindgen-tests/tests/expectations/tests/my_test.rs` file,
add each of:
* `bindgen-tests/tests/expectations/tests/libclang-16/my_test.rs`
* `bindgen-tests/tests/expectations/tests/libclang-9/my_test.rs`
* `bindgen-tests/tests/expectations/tests/libclang-5/my_test.rs`
If you need to update the test expectations for a test file that generates
different bindings for different `libclang` versions, you *don't* need to have
many versions of `libclang` installed locally. Just make a work-in-progress pull
request, and then when CI fails, it will log a diff of the
many version of `libclang` installed locally. Just make a work-in-progress pull
request, and then when Travis CI fails, it will log a diff of the
expectations. Use the diff to patch the appropriate expectation file locally and
then update your pull request.
@@ -225,9 +218,15 @@ have. If for some reason it can't, you can force a specific `libclang` version
to check the bindings against with a cargo feature:
```
$ cargo test --features __testing_only_libclang_$VERSION
$ cargo test --features testing_only_libclang_$VERSION
```
Where `$VERSION` is one of:
* `4`
* `3_9`
* `3_8`
depending on which version of `libclang` you have installed.
### Integration Tests
@@ -352,7 +351,7 @@ changes should be squashed into the original commit.
Unsure who to ask for review? Ask any of:
* `@emilio`
* `@pvdrz`
* `@fitzgen`
More resources:
@@ -425,7 +424,7 @@ $ brew install creduce
$ # Etc...
```
Otherwise, follow [these instructions](https://github.com/csmith-project/creduce/blob/master/INSTALL.md) for building and/or installing `creduce`.
Otherwise, follow [these instructions](https://github.com/csmith-project/creduce/blob/main/INSTALL.md) for building and/or installing `creduce`.
Running `creduce` requires two things:
@@ -490,11 +489,10 @@ to fail to compile `bindgen`'s emitted bindings, you can invoke `predicate.py`
like this:
```bash
# the rustc-grep argument expects a regex, thus escape where necessary
path/to/rust-bindgen/csmith-fuzzing/predicate.py \
--bindings-grep NameOfTheStructThatIsErroneouslyDerivingEq \
--expect-compile-fail \
--rustc-grep 'error\[E0277\]: the trait bound `f64: std::cmp::Eq` is not satisfied' \
--rustc-grep 'error[E0277]: the trait bound `f64: std::cmp::Eq` is not satisfied' \
./isolated-test-case.h
```
@@ -539,11 +537,21 @@ like the following is a useful way to check what has landed:
$ git log --oneline v0.62.0..HEAD
```
Also worth checking the [next-release
tag](https://github.com/rust-lang/rust-bindgen/pulls?q=is%3Apr+label%3Anext-release).
It is very important that you do not rename the `Unreleased` section of the
changelog as this will be done automatically using `cargo release` on a further
step.
Also worth checking the [next-release tag](https://github.com/rust-lang/rust-bindgen/pulls?q=is%3Apr+label%3Anext-release).
Once that's done and the changelog is up-to-date, run `doctoc` on it.
If needed, install it locally by running:
```
$ npm install doctoc
$ ./node_modules/doctoc/doctoc.js CHANGELOG.md
```
### Bumping the version numbers.
Bump version numbers as needed. Run tests just to ensure everything is working
as expected.
### Merge to `main`
@@ -551,73 +559,13 @@ For regular releases, the changes above should end up in `main` before
publishing. For dot-releases of an old version (e.g., cherry-picking an
important fix) you can skip this.
### Tag and publish
### Publish and add a git tag for the right commit
Once you're in `main`. Remember to install `doctoc` by running:
```
npm install doctoc
```
And then run:
```
cargo release [patch|minor] --no-publish --execute
```
This does the following:
- Bump the version.
- Turn the `Unreleased` section of the changelog into the section for the version being released.
- Update the table of contents of the changelog using `doctoc`.
- Tag (`git tag`) the HEAD commit
- Push (`git push`) to GitHub
The `patch` and `minor` refer to semver concepts:
- `patch` would bump __v0.68.1__ to __v0.68.2__
- `minor` would bump __v0.68.2__ to __v0.69.0__
> NOTE:
> We use the `--no-publish` so that the crates are only published after the release is complete.
> This is automatic, provided the release CI job is successful.
### Create a new release on Github
The release is automated with the help of `.github/workflows/release.yml`,
and will only be created...
- when a Git tag is pushed
- when all tests succeed
While the tests are still running,
a draft GitHub release will be created,
to avoid notifying watchers of the repo should a CI step fail.
If everything succeeds,
tarballs containing bindgen cli executables for Linux and MacOS
(both for x86 and Arm) will be created.
See `[workspace.metadata.dist]` section in Cargo.toml for the configuration.
To update the release configuration,
when a new cargo-dist is available:
Once you're in the right commit, do:
```
cargo dist init # from "cargo install cargo-dist"
$ git tag -a v0.62.1 # With the right version of course
$ pushd bindgen && cargo publish && popd
$ pushd bindgen-cli && cargo publish && popd
$ git push --tags upstream # To publish the tag
```
### What to do if a Github release fails
If the release process fails after you run `cargo release`, you can manually
delete the tag and release from Github. Also remember to delete the tag locally
by running `git tag -d`. Once all the extra changes are in the `main` branch,
you can trigger a release by creating a new tag using `git tag` and push it
using `git push --tag`.
### Create a new crates.io release
Go to [the Publish
workflow](https://github.com/rust-lang/rust-bindgen/actions/workflows/publish.yml)
and run a new workflow using the "Run Workflow" button.
Remember that crates.io releases cannot be deleted!
[prettyplease]: https://github.com/dtolnay/prettyplease
Generated
+340 -264
View File
@@ -2,53 +2,72 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66"
dependencies = [
"memchr 0.1.11",
]
[[package]]
name = "aho-corasick"
version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
dependencies = [
"memchr",
"memchr 2.5.0",
]
[[package]]
name = "annotate-snippets"
version = "0.9.1"
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3b9d411ecbaf79885c6df4d75fff75858d5995ff25385657a28af47e82f9c36"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"unicode-width",
"yansi-term",
"winapi 0.3.9",
]
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi 0.1.19",
"libc",
"winapi 0.3.9",
]
[[package]]
name = "bindgen"
version = "0.70.1"
version = "0.64.0"
dependencies = [
"annotate-snippets",
"bitflags 2.2.1",
"bitflags",
"cexpr",
"clang-sys",
"itertools",
"log",
"prettyplease",
"lazy_static",
"lazycell",
"log 0.4.17",
"peeking_take_while",
"proc-macro2",
"quote",
"regex",
"regex 1.7.1",
"rustc-hash",
"shlex",
"syn 2.0.18",
"syn",
"which",
]
[[package]]
name = "bindgen-cli"
version = "0.70.1"
version = "0.64.0"
dependencies = [
"bindgen",
"clap",
"clap_complete",
"env_logger 0.10.0",
"log",
"clap 4.1.4",
"env_logger 0.9.3",
"log 0.4.17",
"shlex",
]
@@ -65,13 +84,9 @@ name = "bindgen-tests"
version = "0.1.0"
dependencies = [
"bindgen",
"clap",
"clap_complete",
"owo-colors",
"prettyplease",
"clap 4.1.4",
"diff",
"shlex",
"similar",
"syn 2.0.18",
"tempfile",
]
@@ -81,12 +96,6 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24a6904aef64d73cf10ab17ebace7befb918b82164785cb89907993be7f83813"
[[package]]
name = "block"
version = "0.1.6"
@@ -122,7 +131,22 @@ checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3"
dependencies = [
"glob",
"libc",
"libloading",
"libloading 0.7.4",
]
[[package]]
name = "clap"
version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [
"ansi_term",
"atty",
"bitflags",
"strsim 0.8.0",
"textwrap",
"unicode-width",
"vec_map",
]
[[package]]
@@ -131,24 +155,15 @@ version = "4.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76"
dependencies = [
"bitflags 1.3.2",
"bitflags",
"clap_derive",
"clap_lex",
"is-terminal",
"once_cell",
"strsim",
"strsim 0.10.0",
"termcolor",
]
[[package]]
name = "clap_complete"
version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01c22dcfb410883764b29953103d9ef7bb8fe21b3fa1158bc99986c2067294bd"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
version = "4.1.0"
@@ -159,7 +174,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 1.0.107",
"syn",
]
[[package]]
@@ -171,6 +186,12 @@ dependencies = [
"os_str_bytes",
]
[[package]]
name = "diff"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
[[package]]
name = "either"
version = "1.8.1"
@@ -179,36 +200,36 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
[[package]]
name = "env_logger"
version = "0.8.4"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
checksum = "15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f"
dependencies = [
"log",
"regex",
"log 0.3.9",
"regex 0.1.80",
]
[[package]]
name = "env_logger"
version = "0.10.0"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"
checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7"
dependencies = [
"atty",
"humantime",
"is-terminal",
"log",
"regex",
"log 0.4.17",
"regex 1.7.1",
"termcolor",
]
[[package]]
name = "errno"
version = "0.3.1"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
dependencies = [
"errno-dragonfly",
"libc",
"windows-sys 0.48.0",
"winapi 0.3.9",
]
[[package]]
@@ -231,15 +252,10 @@ dependencies = [
]
[[package]]
name = "getrandom"
version = "0.2.8"
name = "fuchsia-cprng"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
[[package]]
name = "glob"
@@ -255,9 +271,21 @@ checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
version = "0.3.2"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]]
name = "humantime"
@@ -281,35 +309,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"
dependencies = [
"libc",
"windows-sys 0.42.0",
"windows-sys",
]
[[package]]
name = "is-terminal"
version = "0.4.7"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
dependencies = [
"hermit-abi",
"hermit-abi 0.2.6",
"io-lifetimes",
"rustix",
"windows-sys 0.48.0",
"windows-sys",
]
[[package]]
name = "itertools"
version = "0.13.0"
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
dependencies = [
"either",
"winapi 0.2.8",
"winapi-build",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "lazycell"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.154"
version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "libloading"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883"
dependencies = [
"cfg-if",
"winapi 0.3.9",
]
[[package]]
name = "libloading"
@@ -318,14 +369,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
dependencies = [
"cfg-if",
"winapi",
"winapi 0.3.9",
]
[[package]]
name = "linux-raw-sys"
version = "0.3.8"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
[[package]]
name = "log"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
dependencies = [
"log 0.4.17",
]
[[package]]
name = "log"
@@ -345,6 +405,15 @@ dependencies = [
"libc",
]
[[package]]
name = "memchr"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20"
dependencies = [
"libc",
]
[[package]]
name = "memchr"
version = "2.5.0"
@@ -363,7 +432,7 @@ version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
"memchr",
"memchr 2.5.0",
"minimal-lexical",
]
@@ -389,20 +458,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
[[package]]
name = "owo-colors"
version = "3.5.0"
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
[[package]]
name = "prettyplease"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43ded2b5b204571f065ab8540367d738dfe1b3606ab9eb669dcfb5e7a3a07501"
dependencies = [
"proc-macro2",
"syn 2.0.18",
]
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]]
name = "proc-macro-error"
@@ -413,7 +472,7 @@ dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn 1.0.107",
"syn",
"version_check",
]
@@ -430,67 +489,111 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.60"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406"
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quickcheck"
version = "1.0.3"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6"
checksum = "02c2411d418cea2364325b18a205664f9ef8252e06b2e911db97c0b0d98b1406"
dependencies = [
"env_logger 0.8.4",
"log",
"rand",
"env_logger 0.3.5",
"log 0.3.9",
"rand 0.3.23",
]
[[package]]
name = "quickchecking"
version = "0.0.0"
version = "0.1.0"
dependencies = [
"clap",
"clap 2.34.0",
"lazy_static",
"quickcheck",
"tempfile",
"rand 0.3.23",
"tempdir",
]
[[package]]
name = "quote"
version = "1.0.28"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.8.5"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c"
dependencies = [
"rand_core",
"libc",
"rand 0.4.6",
]
[[package]]
name = "rand"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
dependencies = [
"fuchsia-cprng",
"libc",
"rand_core 0.3.1",
"rdrand",
"winapi 0.3.9",
]
[[package]]
name = "rand_core"
version = "0.6.4"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
dependencies = [
"getrandom",
"rand_core 0.4.2",
]
[[package]]
name = "rand_core"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
[[package]]
name = "rdrand"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
dependencies = [
"rand_core 0.3.1",
]
[[package]]
name = "redox_syscall"
version = "0.3.5"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags 1.3.2",
"bitflags",
]
[[package]]
name = "regex"
version = "0.1.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f"
dependencies = [
"aho-corasick 0.5.3",
"memchr 0.1.11",
"regex-syntax 0.3.9",
"thread_local",
"utf8-ranges",
]
[[package]]
@@ -499,17 +602,32 @@ version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
"aho-corasick 0.7.20",
"memchr 2.5.0",
"regex-syntax 0.6.28",
]
[[package]]
name = "regex-syntax"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957"
[[package]]
name = "regex-syntax"
version = "0.6.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
[[package]]
name = "remove_dir_all"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "rustc-hash"
version = "1.1.0"
@@ -518,29 +636,29 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustix"
version = "0.37.7"
version = "0.36.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d"
checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03"
dependencies = [
"bitflags 1.3.2",
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys 0.45.0",
"windows-sys",
]
[[package]]
name = "shlex"
version = "1.3.0"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]]
name = "similar"
version = "2.2.1"
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "strsim"
@@ -560,27 +678,27 @@ dependencies = [
]
[[package]]
name = "syn"
version = "2.0.18"
name = "tempdir"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e"
checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
"rand 0.4.6",
"remove_dir_all",
]
[[package]]
name = "tempfile"
version = "3.5.0"
version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998"
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
dependencies = [
"cfg-if",
"fastrand",
"libc",
"redox_syscall",
"rustix",
"windows-sys 0.45.0",
"remove_dir_all",
"winapi 0.3.9",
]
[[package]]
@@ -594,13 +712,41 @@ dependencies = [
[[package]]
name = "tests_expectations"
version = "0.0.0"
version = "0.1.0"
dependencies = [
"block",
"libloading",
"libloading 0.6.7",
"objc",
]
[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
[[package]]
name = "thread-id"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
dependencies = [
"kernel32-sys",
"libc",
]
[[package]]
name = "thread_local"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5"
dependencies = [
"thread-id",
]
[[package]]
name = "unicode-ident"
version = "1.0.6"
@@ -613,6 +759,18 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
name = "utf8-ranges"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version_check"
version = "0.9.4"
@@ -620,10 +778,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
name = "which"
version = "4.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269"
dependencies = [
"either",
"libc",
"once_cell",
]
[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
[[package]]
name = "winapi"
@@ -635,6 +804,12 @@ dependencies = [
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
@@ -647,7 +822,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
"winapi 0.3.9",
]
[[package]]
@@ -662,152 +837,53 @@ version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
]
[[package]]
name = "windows-sys"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets 0.42.2",
]
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.1",
]
[[package]]
name = "windows-targets"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
dependencies = [
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
]
[[package]]
name = "windows-targets"
version = "0.48.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
dependencies = [
"windows_aarch64_gnullvm 0.48.0",
"windows_aarch64_msvc 0.48.0",
"windows_i686_gnu 0.48.0",
"windows_i686_msvc 0.48.0",
"windows_x86_64_gnu 0.48.0",
"windows_x86_64_gnullvm 0.48.0",
"windows_x86_64_msvc 0.48.0",
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]]
name = "windows_i686_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[package]]
name = "windows_i686_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.2"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
[[package]]
name = "yansi-term"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe5c30ade05e61656247b2e334a031dfd0cc466fadef865bdcdea8d537951bf1"
dependencies = [
"winapi",
]
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
-29
View File
@@ -13,32 +13,3 @@ default-members = [
"bindgen-cli",
"bindgen-tests",
]
# Config for 'cargo dist'
[workspace.metadata.dist]
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.12.0"
# CI backends to support
ci = ["github"]
# The installers to generate for each app
installers = ["shell", "powershell"]
# Target platforms to build apps for (Rust target-triple syntax)
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"]
# Whether to consider the binaries in a package for distribution (defaults true)
dist = false
# Publish jobs to run in CI
pr-run-mode = "plan"
# Whether to install an updater program
install-updater = false
# Config for 'cargo release'
[workspace.metadata.release]
shared-version = true # ensures published packages share the same version
tag-name = "v{{version}}"
# Don't release any crate unless its manifest has `release = true`
release = false
# The profile that 'cargo dist' will build with
[profile.dist]
inherits = "release"
lto = "thin"
-1
View File
@@ -60,7 +60,6 @@ Note:If the text contains special characters|please escape them according to the
<policy name="projectPolicy" desc="">
<policyitem type="compatibility" name="InvalidLicense" path="bindgen-cli/Cargo.toml" desc="配置文件不涉及LICENSE"/>
<policyitem type="compatibility" name="InvalidLicense" path="bindgen/Cargo.toml" desc="配置文件不涉及LICENSE"/>
<policyitem type="compatibility" name="InvalidLicense" path="Cargo.toml" desc="配置文件不涉及LICENSE"/>
</policy>
</policylist>
<filefilterlist>
+2 -6
View File
@@ -39,15 +39,11 @@ extern "C" {
## MSRV
The `bindgen` minimum supported Rust version is **1.70.0**.
The `bindgen-cli` minimum supported Rust version is **1.70.0**.
The minimum supported Rust version is **1.60.0**.
No MSRV bump policy has been established yet, so MSRV may increase in any release.
The MSRV is the minimum Rust version that can be used to *compile* each crate. However, `bindgen` and `bindgen-cli` can generate bindings that are compatible with Rust versions below the current MSRV.
Most of the time, the `bindgen-cli` crate will have a more recent MSRV than `bindgen` as crates such as `clap` require it.
The MSRV is the minimum Rust version that can be used to *compile* `bindgen`. However, `bindgen` can generate bindings that are compatible with Rust versions below the current MSRV.
## API Reference
+8 -8
View File
@@ -3,17 +3,17 @@ environment:
RUST_CHANNEL: "%Configuration%"
matrix:
- TARGET: gnu
LLVM_VERSION: 9.0.0-1
BINDGEN_FEATURES: __testing_only_libclang_9
LLVM_VERSION: 5.0.0-1
BINDGEN_FEATURES: testing_only_libclang_5
- TARGET: gnu
LLVM_VERSION: 16.0.4
BINDGEN_FEATURES: __testing_only_libclang_16
LLVM_VERSION: 9.0.0-1
BINDGEN_FEATURES: testing_only_libclang_9
- TARGET: msvc
LLVM_VERSION: 5.0.0
BINDGEN_FEATURES: testing_only_libclang_5
- TARGET: msvc
LLVM_VERSION: 9.0.0
BINDGEN_FEATURES: __testing_only_libclang_9
- TARGET: msvc
LLVM_VERSION: 16.0.4
BINDGEN_FEATURES: __testing_only_libclang_16
BINDGEN_FEATURES: testing_only_libclang_9
configuration:
- stable
+11 -23
View File
@@ -11,38 +11,26 @@ readme = "../README.md"
repository = "https://github.com/rust-lang/rust-bindgen"
documentation = "https://docs.rs/bindgen"
homepage = "https://rust-lang.github.io/rust-bindgen/"
version = "0.70.1"
version = "0.64.0"
edition = "2018"
rust-version = "1.70.0"
# If you change this, also update README.md and msrv in .github/workflows/bindgen.yml
rust-version = "1.60.0"
[[bin]]
path = "main.rs"
name = "bindgen"
[dependencies]
bindgen = { path = "../bindgen", version = "=0.70.1", default-features = false, features = ["__cli", "experimental", "prettyplease"] }
clap = { version = "4", features = ["derive"] }
clap_complete = "4"
env_logger = { version = "0.10.0", optional = true }
log = { version = "0.4", optional = true }
bindgen = { path = "../bindgen", version = "=0.64.0", features = ["cli", "experimental"] }
shlex = "1"
clap = { version = "4", features = ["derive"] }
env_logger = { version = "0.9.0", optional = true }
log = { version = "0.4", optional = true }
[features]
default = ["logging", "runtime"]
logging = ["bindgen/logging", "dep:env_logger", "dep:log"]
default = ["logging", "runtime", "which-rustfmt"]
logging = ["bindgen/logging", "env_logger", "log"]
static = ["bindgen/static"]
runtime = ["bindgen/runtime"]
prettyplease = ["bindgen/prettyplease"]
## The following features are for internal use and they shouldn't be used if
## you're not hacking on bindgen
# Features used for CI testing
__testing_only_extra_assertions = ["bindgen/__testing_only_extra_assertions"]
__testing_only_libclang_9 = ["bindgen/__testing_only_libclang_9"]
__testing_only_libclang_16 = ["bindgen/__testing_only_libclang_16"]
[package.metadata.release]
release = true
[package.metadata.dist]
dist = true
# Dynamically discover a `rustfmt` binary using the `which` crate
which-rustfmt = ["bindgen/which-rustfmt"]
+15 -8
View File
@@ -1,3 +1,10 @@
extern crate bindgen;
extern crate clap;
#[cfg(feature = "logging")]
extern crate env_logger;
#[cfg(feature = "logging")]
extern crate log;
use std::env;
mod options;
@@ -6,10 +13,10 @@ use crate::options::builder_from_flags;
#[cfg(feature = "logging")]
fn clang_version_check() {
let version = bindgen::clang_version();
let expected_version = if cfg!(feature = "__testing_only_libclang_16") {
Some((16, 0))
} else if cfg!(feature = "__testing_only_libclang_9") {
let expected_version = if cfg!(feature = "testing_only_libclang_9") {
Some((9, 0))
} else if cfg!(feature = "testing_only_libclang_5") {
Some((5, 0))
} else {
None
};
@@ -38,7 +45,7 @@ pub fn main() {
if verbose {
print_verbose_err()
}
eprintln!("{}", info);
println!("{}", info);
}));
let bindings =
@@ -49,21 +56,21 @@ pub fn main() {
bindings.write(output).expect("Unable to write output");
}
Err(error) => {
eprintln!("{}", error);
println!("{}", error);
std::process::exit(1);
}
};
}
fn print_verbose_err() {
eprintln!("Bindgen unexpectedly panicked");
eprintln!(
println!("Bindgen unexpectedly panicked");
println!(
"This may be caused by one of the known-unsupported \
things (https://rust-lang.github.io/rust-bindgen/cpp.html), \
please modify the bindgen flags to work around it as \
described in https://rust-lang.github.io/rust-bindgen/cpp.html"
);
eprintln!(
println!(
"Otherwise, please file an issue at \
https://github.com/rust-lang/rust-bindgen/issues/new"
);
+136 -278
View File
@@ -1,27 +1,23 @@
use bindgen::callbacks::TypeKind;
use bindgen::{
builder, Abi, AliasVariation, Builder, CodegenConfig, EnumVariation,
FieldVisibilityKind, Formatter, MacroTypeVariation, NonCopyUnionStyle,
RegexSet, RustTarget, DEFAULT_ANON_FIELDS_PREFIX, RUST_TARGET_STRINGS,
builder, AliasVariation, Builder, CodegenConfig, EnumVariation,
MacroTypeVariation, NonCopyUnionStyle, RegexSet, RustTarget,
DEFAULT_ANON_FIELDS_PREFIX, RUST_TARGET_STRINGS,
};
use clap::error::{Error, ErrorKind};
use clap::{CommandFactory, Parser};
use clap::Parser;
use std::fs::File;
use std::io;
use std::path::{Path, PathBuf};
use std::process::exit;
use std::io::{self, Error, ErrorKind};
use std::path::PathBuf;
fn rust_target_help() -> String {
format!(
"Version of the Rust compiler to target. Valid options are: {:?}. Defaults to {}.",
"Version of the Rust compiler to target. Valid options are: {:?}. Defaults to {:?}.",
RUST_TARGET_STRINGS,
RustTarget::default()
String::from(RustTarget::default())
)
}
fn parse_codegen_config(
what_to_generate: &str,
) -> Result<CodegenConfig, Error> {
fn parse_codegen_config(what_to_generate: &str) -> io::Result<CodegenConfig> {
let mut config = CodegenConfig::empty();
for what in what_to_generate.split(',') {
match what {
@@ -32,9 +28,9 @@ fn parse_codegen_config(
"constructors" => config.insert(CodegenConfig::CONSTRUCTORS),
"destructors" => config.insert(CodegenConfig::DESTRUCTORS),
otherwise => {
return Err(Error::raw(
ErrorKind::InvalidValue,
format!("Unknown codegen item kind: {}", otherwise),
return Err(Error::new(
ErrorKind::Other,
format!("Unknown generate item: {}", otherwise),
));
}
}
@@ -43,54 +39,10 @@ fn parse_codegen_config(
Ok(config)
}
fn parse_rustfmt_config_path(path_str: &str) -> Result<PathBuf, Error> {
let path = Path::new(path_str);
if !path.is_absolute() {
return Err(Error::raw(
ErrorKind::InvalidValue,
"--rustfmt-configuration-file needs to be an absolute path!",
));
}
if path.to_str().is_none() {
return Err(Error::raw(
ErrorKind::InvalidUtf8,
"--rustfmt-configuration-file contains non-valid UTF8 characters.",
));
}
Ok(path.to_path_buf())
}
fn parse_abi_override(abi_override: &str) -> Result<(Abi, String), Error> {
let (regex, abi_str) = abi_override
.rsplit_once('=')
.ok_or_else(|| Error::raw(ErrorKind::InvalidValue, "Missing `=`"))?;
let abi = abi_str
.parse()
.map_err(|err| Error::raw(ErrorKind::InvalidValue, err))?;
Ok((abi, regex.to_owned()))
}
fn parse_custom_derive(
custom_derive: &str,
) -> Result<(Vec<String>, String), Error> {
let (regex, derives) = custom_derive
.rsplit_once('=')
.ok_or_else(|| Error::raw(ErrorKind::InvalidValue, "Missing `=`"))?;
let derives = derives.split(',').map(|s| s.to_owned()).collect();
Ok((derives, regex.to_owned()))
}
#[derive(Parser, Debug)]
#[clap(
about = "Generates Rust bindings from C/C++ headers.",
override_usage = "bindgen <FLAGS> <OPTIONS> <HEADER> -- <CLANG_ARGS>...",
override_usage = "bindgen [FLAGS] [OPTIONS] [HEADER] -- [CLANG_ARGS]...",
trailing_var_arg = true
)]
struct BindgenCommand {
@@ -99,69 +51,63 @@ struct BindgenCommand {
/// Path to write depfile to.
#[arg(long)]
depfile: Option<String>,
/// The default STYLE of code used to generate enums.
#[arg(long, value_name = "STYLE")]
/// The default style of code used to generate enums.
#[arg(long, value_name = "VARIANT")]
default_enum_style: Option<EnumVariation>,
/// Mark any enum whose name matches REGEX as a set of bitfield flags.
/// Mark any enum whose name matches <REGEX> as a set of bitfield flags.
#[arg(long, value_name = "REGEX")]
bitfield_enum: Vec<String>,
/// Mark any enum whose name matches REGEX as a newtype.
/// Mark any enum whose name matches <REGEX> as a newtype.
#[arg(long, value_name = "REGEX")]
newtype_enum: Vec<String>,
/// Mark any enum whose name matches REGEX as a global newtype.
/// Mark any enum whose name matches <REGEX> as a global newtype.
#[arg(long, value_name = "REGEX")]
newtype_global_enum: Vec<String>,
/// Mark any enum whose name matches REGEX as a Rust enum.
/// Mark any enum whose name matches <REGEX> as a Rust enum.
#[arg(long, value_name = "REGEX")]
rustified_enum: Vec<String>,
/// Mark any enum whose name matches REGEX as a non-exhaustive Rust enum.
#[arg(long, value_name = "REGEX")]
rustified_non_exhaustive_enum: Vec<String>,
/// Mark any enum whose name matches REGEX as a series of constants.
/// Mark any enum whose name matches <REGEX> as a series of constants.
#[arg(long, value_name = "REGEX")]
constified_enum: Vec<String>,
/// Mark any enum whose name matches REGEX as a module of constants.
/// Mark any enum whose name matches <regex> as a module of constants.
#[arg(long, value_name = "REGEX")]
constified_enum_module: Vec<String>,
/// The default signed/unsigned TYPE for C macro constants.
#[arg(long, value_name = "TYPE")]
/// The default signed/unsigned type for C macro constants.
#[arg(long, value_name = "VARIANT")]
default_macro_constant_type: Option<MacroTypeVariation>,
/// The default STYLE of code used to generate typedefs.
#[arg(long, value_name = "STYLE")]
/// The default style of code used to generate typedefs.
#[arg(long, value_name = "VARIANT")]
default_alias_style: Option<AliasVariation>,
/// Mark any typedef alias whose name matches REGEX to use normal type aliasing.
/// Mark any typedef alias whose name matches <REGEX> to use normal type aliasing.
#[arg(long, value_name = "REGEX")]
normal_alias: Vec<String>,
/// Mark any typedef alias whose name matches REGEX to have a new type generated for it.
/// Mark any typedef alias whose name matches <REGEX> to have a new type generated for it.
#[arg(long, value_name = "REGEX")]
new_type_alias: Vec<String>,
/// Mark any typedef alias whose name matches REGEX to have a new type with Deref and DerefMut to the inner type.
/// Mark any typedef alias whose name matches <REGEX> to have a new type with Deref and DerefMut to the inner type.
#[arg(long, value_name = "REGEX")]
new_type_alias_deref: Vec<String>,
/// The default STYLE of code used to generate unions with non-Copy members. Note that ManuallyDrop was first stabilized in Rust 1.20.0.
/// The default style of code used to generate unions with non-Copy members. Note that ManuallyDrop was first stabilized in Rust 1.20.0.
#[arg(long, value_name = "STYLE")]
default_non_copy_union_style: Option<NonCopyUnionStyle>,
/// Mark any union whose name matches REGEX and who has a non-Copy member to use a bindgen-generated wrapper for fields.
/// Mark any union whose name matches <REGEX> and who has a non-Copy member to use a bindgen-generated wrapper for fields.
#[arg(long, value_name = "REGEX")]
bindgen_wrapper_union: Vec<String>,
/// Mark any union whose name matches REGEX and who has a non-Copy member to use ManuallyDrop (stabilized in Rust 1.20.0) for fields.
/// Mark any union whose name matches <REGEX> and who has a non-Copy member to use ManuallyDrop (stabilized in Rust 1.20.0) for fields.
#[arg(long, value_name = "REGEX")]
manually_drop_union: Vec<String>,
/// Mark TYPE as hidden.
/// Mark <TYPE> as hidden.
#[arg(long, value_name = "TYPE")]
blocklist_type: Vec<String>,
/// Mark FUNCTION as hidden.
/// Mark <FUNCTION> as hidden.
#[arg(long, value_name = "FUNCTION")]
blocklist_function: Vec<String>,
/// Mark ITEM as hidden.
/// Mark <ITEM> as hidden.
#[arg(long, value_name = "ITEM")]
blocklist_item: Vec<String>,
/// Mark FILE as hidden.
/// Mark <FILE> as hidden.
#[arg(long, value_name = "FILE")]
blocklist_file: Vec<String>,
/// Mark VAR as hidden.
#[arg(long, value_name = "VAR")]
blocklist_var: Vec<String>,
/// Avoid generating layout tests for any type.
#[arg(long)]
no_layout_tests: bool,
@@ -183,7 +129,7 @@ struct BindgenCommand {
/// Derive Default on any type.
#[arg(long)]
with_derive_default: bool,
/// Derive Hash on any type.
/// Derive Hash on any type.docstring
#[arg(long)]
with_derive_hash: bool,
/// Derive PartialEq on any type.
@@ -198,7 +144,7 @@ struct BindgenCommand {
/// Derive Ord on any type.
#[arg(long)]
with_derive_ord: bool,
/// Avoid including doc comments in the output, see: <https://github.com/rust-lang/rust-bindgen/issues/426>
/// Avoid including doc comments in the output, see: https://github.com/rust-lang/rust-bindgen/issues/426
#[arg(long)]
no_doc_comments: bool,
/// Disable allowlisting types recursively. This will cause bindgen to emit Rust code that won't compile! See the `bindgen::Builder::allowlist_recursively` method's documentation for details.
@@ -210,9 +156,6 @@ struct BindgenCommand {
/// Generate block signatures instead of void pointers.
#[arg(long)]
generate_block: bool,
/// Generate string constants as `&CStr` instead of `&[u8]`.
#[arg(long)]
generate_cstr: bool,
/// Use extern crate instead of use for block.
#[arg(long)]
block_extern_crate: bool,
@@ -222,10 +165,10 @@ struct BindgenCommand {
/// Output bindings for builtin definitions, e.g. __builtin_va_list.
#[arg(long)]
builtins: bool,
/// Use the given PREFIX before raw types instead of ::std::os::raw.
/// Use the given prefix before raw types instead of ::std::os::raw.
#[arg(long, value_name = "PREFIX")]
ctypes_prefix: Option<String>,
/// Use the given PREFIX for anonymous fields.
/// Use the given prefix for anonymous fields.
#[arg(long, default_value = DEFAULT_ANON_FIELDS_PREFIX, value_name = "PREFIX")]
anon_fields_prefix: String,
/// Time the different bindgen phases and print to stderr
@@ -237,7 +180,7 @@ struct BindgenCommand {
/// Output our internal IR for debugging purposes.
#[arg(long)]
emit_ir: bool,
/// Dump a graphviz dot file to PATH.
/// Dump graphviz dot file.
#[arg(long, value_name = "PATH")]
emit_ir_graphviz: Option<String>,
/// Enable support for C++ namespaces.
@@ -255,7 +198,7 @@ struct BindgenCommand {
/// Suppress insertion of bindgen's version identifier into generated bindings.
#[arg(long)]
disable_header_comment: bool,
/// Do not generate bindings for functions or methods. This is useful when you only care about struct layouts.
/// Do not generate bindings for functions or methods. This is useful when you only care about struct layouts.docstring
#[arg(long)]
ignore_functions: bool,
/// Generate only given items, split by commas. Valid values are `functions`,`types`, `vars`, `methods`, `constructors` and `destructors`.
@@ -276,17 +219,17 @@ struct BindgenCommand {
/// Try to fit macro constants into types smaller than u32/i32
#[arg(long)]
fit_macro_constant_types: bool,
/// Mark TYPE as opaque.
/// Mark <TYPE> as opaque.
#[arg(long, value_name = "TYPE")]
opaque_type: Vec<String>,
/// Write Rust bindings to OUTPUT.
/// Write Rust bindings to <OUTPUT>.
#[arg(long, short, value_name = "OUTPUT")]
output: Option<String>,
/// Add a raw line of Rust code at the beginning of output.
#[arg(long)]
raw_line: Vec<String>,
/// Add a RAW_LINE of Rust code to a given module with name MODULE_NAME.
#[arg(long, number_of_values = 2, value_names = ["MODULE_NAME", "RAW_LINE"])]
/// Add a raw line of Rust code to a given module.
#[arg(long, number_of_values = 2, value_names = ["MODULE-NAME", "RAW-LINE"])]
module_raw_line: Vec<String>,
#[arg(long, help = rust_target_help())]
rust_target: Option<RustTarget>,
@@ -296,24 +239,24 @@ struct BindgenCommand {
/// Conservatively generate inline namespaces to avoid name conflicts.
#[arg(long)]
conservative_inline_namespaces: bool,
/// Allowlist all the free-standing functions matching REGEX. Other non-allowlisted functions will not be generated.
/// MSVC C++ ABI mangling. DEPRECATED: Has no effect.
#[arg(long)]
use_msvc_mangling: bool,
/// Allowlist all the free-standing functions matching <REGEX>. Other non-allowlisted functions will not be generated.
#[arg(long, value_name = "REGEX")]
allowlist_function: Vec<String>,
/// Generate inline functions.
#[arg(long)]
generate_inline_functions: bool,
/// Only generate types matching REGEX. Other non-allowlisted types will not be generated.
/// Only generate types matching <REGEX>. Other non-allowlisted types will not be generated.
#[arg(long, value_name = "REGEX")]
allowlist_type: Vec<String>,
/// Allowlist all the free-standing variables matching REGEX. Other non-allowlisted variables will not be generated.
/// Allowlist all the free-standing variables matching <REGEX>. Other non-allowlisted variables will not be generated.
#[arg(long, value_name = "REGEX")]
allowlist_var: Vec<String>,
/// Allowlist all contents of PATH.
/// Allowlist all contents of <PATH>.
#[arg(long, value_name = "PATH")]
allowlist_file: Vec<String>,
/// Allowlist all items matching REGEX. Other non-allowlisted items will not be generated.
#[arg(long, value_name = "REGEX")]
allowlist_item: Vec<String>,
/// Print verbose error messages.
#[arg(long)]
verbose: bool,
@@ -323,60 +266,55 @@ struct BindgenCommand {
/// Do not record matching items in the regex sets. This disables reporting of unused items.
#[arg(long)]
no_record_matches: bool,
/// Ignored - this is enabled by default.
#[arg(long = "size_t-is-usize")]
size_t_is_usize: bool,
/// Do not bind size_t as usize (useful on platforms where those types are incompatible).
#[arg(long = "no-size_t-is-usize")]
no_size_t_is_usize: bool,
/// Do not format the generated bindings with rustfmt. This option is deprecated, please use
/// `--formatter=none` instead.
/// Do not format the generated bindings with rustfmt.
#[arg(long)]
no_rustfmt_bindings: bool,
/// Which FORMATTER should be used for the bindings
#[arg(
long,
value_name = "FORMATTER",
conflicts_with = "no_rustfmt_bindings"
)]
formatter: Option<Formatter>,
/// The absolute PATH to the rustfmt configuration file. The configuration file will be used for formatting the bindings. This parameter sets `formatter` to `rustfmt`.
#[arg(long, value_name = "PATH", conflicts_with = "no_rustfmt_bindings", value_parser=parse_rustfmt_config_path)]
rustfmt_configuration_file: Option<PathBuf>,
/// Avoid deriving PartialEq for types matching REGEX.
/// Format the generated bindings with rustfmt. DEPRECATED: --rustfmt-bindings is now enabled by default. Disable with --no-rustfmt-bindings.
#[arg(long)]
rustfmt_bindings: bool,
/// The absolute path to the rustfmt configuration file. The configuration file will be used for formatting the bindings. This parameter is incompatible with --no-rustfmt-bindings.
#[arg(long, value_name = "PATH")]
rustfmt_configuration_file: Option<String>,
/// Avoid deriving PartialEq for types matching <REGEX>.
#[arg(long, value_name = "REGEX")]
no_partialeq: Vec<String>,
/// Avoid deriving Copy and Clone for types matching REGEX.
/// Avoid deriving Copy for types matching <REGEX>.
#[arg(long, value_name = "REGEX")]
no_copy: Vec<String>,
/// Avoid deriving Debug for types matching REGEX.
/// Avoid deriving Debug for types matching <REGEX>.
#[arg(long, value_name = "REGEX")]
no_debug: Vec<String>,
/// Avoid deriving/implementing Default for types matching REGEX.
/// Avoid deriving/implementing Default for types matching <REGEX>.
#[arg(long, value_name = "REGEX")]
no_default: Vec<String>,
/// Avoid deriving Hash for types matching REGEX.
/// Avoid deriving Hash for types matching <REGEX>.
#[arg(long, value_name = "REGEX")]
no_hash: Vec<String>,
/// Add `#[must_use]` annotation to types matching REGEX.
/// Add #[must_use] annotation to types matching <REGEX>.
#[arg(long, value_name = "REGEX")]
must_use_type: Vec<String>,
/// Enables detecting unexposed attributes in functions (slow). Used to generate `#[must_use]` annotations.
/// Enables detecting unexposed attributes in functions (slow). Used to generate #[must_use] annotations.
#[arg(long)]
enable_function_attribute_detection: bool,
/// Use `*const [T; size]` instead of `*const T` for C arrays
#[arg(long)]
use_array_pointers_in_arguments: bool,
/// The NAME to be used in a #[link(wasm_import_module = ...)] statement
/// The name to be used in a #[link(wasm_import_module = ...)] statement
#[arg(long, value_name = "NAME")]
wasm_import_module_name: Option<String>,
/// Use dynamic loading mode with the given library NAME.
/// Use dynamic loading mode with the given library name.
#[arg(long, value_name = "NAME")]
dynamic_loading: Option<String>,
/// Require successful linkage to all functions in the library.
#[arg(long)]
dynamic_link_require_all: bool,
/// Prefix the name of exported symbols.
#[arg(long)]
prefix_link_name: Option<String>,
/// Makes generated bindings `pub` only for items if the items are publicly accessible in C++.
/// Makes generated bindings `pub` only for items if the items are publically accessible in C++.
#[arg(long)]
respect_cxx_access_specs: bool,
/// Always translate enum integer types to native Rust integer types.
@@ -397,54 +335,35 @@ struct BindgenCommand {
/// Deduplicates extern blocks.
#[arg(long)]
merge_extern_blocks: bool,
/// Overrides the ABI of functions matching REGEX. The OVERRIDE value must be of the shape REGEX=ABI where ABI can be one of C, stdcall, efiapi, fastcall, thiscall, aapcs, win64 or C-unwind<.>
#[arg(long, value_name = "OVERRIDE", value_parser = parse_abi_override)]
override_abi: Vec<(Abi, String)>,
/// Overrides the ABI of functions matching <regex>. The <OVERRIDE> value must be of the shape <REGEX>=<ABI> where <ABI> can be one of C, stdcall, fastcall, thiscall, aapcs, win64 or C-unwind.
#[arg(long, value_name = "OVERRIDE")]
override_abi: Vec<String>,
/// Wrap unsafe operations in unsafe blocks.
#[arg(long)]
wrap_unsafe_ops: bool,
/// Enable fallback for clang macro parsing.
#[arg(long)]
clang_macro_fallback: bool,
/// Set path for temporary files generated by fallback for clang macro parsing.
#[arg(long)]
clang_macro_fallback_build_dir: Option<PathBuf>,
/// Use DSTs to represent structures with flexible array members.
#[arg(long)]
flexarray_dst: bool,
/// Derive custom traits on any kind of type. The CUSTOM value must be of the shape REGEX=DERIVE where DERIVE is a coma-separated list of derive macros.
#[arg(long, value_name = "CUSTOM", value_parser = parse_custom_derive)]
with_derive_custom: Vec<(Vec<String>, String)>,
/// Derive custom traits on a `struct`. The CUSTOM value must be of the shape REGEX=DERIVE where DERIVE is a coma-separated list of derive macros.
#[arg(long, value_name = "CUSTOM", value_parser = parse_custom_derive)]
with_derive_custom_struct: Vec<(Vec<String>, String)>,
/// Derive custom traits on an `enum. The CUSTOM value must be of the shape REGEX=DERIVE where DERIVE is a coma-separated list of derive macros.
#[arg(long, value_name = "CUSTOM", value_parser = parse_custom_derive)]
with_derive_custom_enum: Vec<(Vec<String>, String)>,
/// Derive custom traits on a `union`. The CUSTOM value must be of the shape REGEX=DERIVE where DERIVE is a coma-separated list of derive macros.
#[arg(long, value_name = "CUSTOM", value_parser = parse_custom_derive)]
with_derive_custom_union: Vec<(Vec<String>, String)>,
/// Derive custom traits on any kind of type. The <CUSTOM> value must be of the shape <REGEX>=<DERIVE> where <DERIVE> is a coma-separated list of derive macros.
#[arg(long, value_name = "CUSTOM")]
with_derive_custom: Vec<String>,
/// Derive custom traits on a `struct`. The <CUSTOM> value must be of the shape <REGEX>=<DERIVE> where <DERIVE> is a coma-separated list of derive macros.
#[arg(long, value_name = "CUSTOM")]
with_derive_custom_struct: Vec<String>,
/// Derive custom traits on an `enum. The <CUSTOM> value must be of the shape <REGEX>=<DERIVE> where <DERIVE> is a coma-separated list of derive macros.
#[arg(long, value_name = "CUSTOM")]
with_derive_custom_enum: Vec<String>,
/// Derive custom traits on a `union`. The <CUSTOM> value must be of the shape <REGEX>=<DERIVE> where <DERIVE> is a coma-separated list of derive macros.
#[arg(long, value_name = "CUSTOM")]
with_derive_custom_union: Vec<String>,
/// Generate wrappers for `static` and `static inline` functions.
#[arg(long, requires = "experimental")]
wrap_static_fns: bool,
/// Sets the PATH for the source file that must be created due to the presence of `static` and
/// Sets the path for the source file that must be created due to the presence of `static` and
/// `static inline` functions.
#[arg(long, requires = "experimental", value_name = "PATH")]
wrap_static_fns_path: Option<PathBuf>,
/// Sets the SUFFIX added to the extern wrapper functions generated for `static` and `static
/// Sets the suffix added to the extern wrapper functions generated for `static` and `static
/// inline` functions.
#[arg(long, requires = "experimental", value_name = "SUFFIX")]
wrap_static_fns_suffix: Option<String>,
/// Set the default VISIBILITY of fields, including bitfields and accessor methods for
/// bitfields. This flag is ignored if the `--respect-cxx-access-specs` flag is used.
#[arg(long, value_name = "VISIBILITY")]
default_visibility: Option<FieldVisibilityKind>,
/// Whether to emit diagnostics or not.
#[arg(long, requires = "experimental")]
emit_diagnostics: bool,
/// Generates completions for the specified SHELL, sends them to `stdout` and exits.
#[arg(long, value_name = "SHELL")]
generate_shell_completions: Option<clap_complete::Shell>,
/// Enables experimental features.
#[arg(long)]
experimental: bool,
@@ -472,7 +391,6 @@ where
newtype_enum,
newtype_global_enum,
rustified_enum,
rustified_non_exhaustive_enum,
constified_enum,
constified_enum_module,
default_macro_constant_type,
@@ -487,7 +405,6 @@ where
blocklist_function,
blocklist_item,
blocklist_file,
blocklist_var,
no_layout_tests,
no_derive_copy,
no_derive_debug,
@@ -504,7 +421,6 @@ where
no_recursive_allowlist,
objc_extern_crate,
generate_block,
generate_cstr,
block_extern_crate,
distrust_clang_mangling,
builtins,
@@ -533,18 +449,19 @@ where
rust_target,
use_core,
conservative_inline_namespaces,
use_msvc_mangling: _,
allowlist_function,
generate_inline_functions,
allowlist_type,
allowlist_var,
allowlist_file,
allowlist_item,
verbose,
dump_preprocessed_input,
no_record_matches,
size_t_is_usize: _,
no_size_t_is_usize,
no_rustfmt_bindings,
formatter,
rustfmt_bindings: _,
rustfmt_configuration_file,
no_partialeq,
no_copy,
@@ -557,7 +474,6 @@ where
wasm_import_module_name,
dynamic_loading,
dynamic_link_require_all,
prefix_link_name,
respect_cxx_access_specs,
translate_enum_integer_types,
c_naming,
@@ -567,9 +483,6 @@ where
merge_extern_blocks,
override_abi,
wrap_unsafe_ops,
clang_macro_fallback,
clang_macro_fallback_build_dir,
flexarray_dst,
with_derive_custom,
with_derive_custom_struct,
with_derive_custom_enum,
@@ -577,25 +490,11 @@ where
wrap_static_fns,
wrap_static_fns_path,
wrap_static_fns_suffix,
default_visibility,
emit_diagnostics,
generate_shell_completions,
experimental: _,
version,
clang_args,
} = command;
if let Some(shell) = generate_shell_completions {
clap_complete::generate(
shell,
&mut BindgenCommand::command(),
"bindgen",
&mut std::io::stdout(),
);
exit(0);
}
if version {
println!(
"bindgen {}",
@@ -612,7 +511,7 @@ where
if let Some(header) = header {
builder = builder.header(header);
} else {
return Err(io::Error::new(io::ErrorKind::Other, "Header not found"));
return Err(Error::new(ErrorKind::Other, "Header not found"));
}
if let Some(rust_target) = rust_target {
@@ -639,10 +538,6 @@ where
builder = builder.rustified_enum(regex);
}
for regex in rustified_non_exhaustive_enum {
builder = builder.rustified_non_exhaustive_enum(regex);
}
for regex in constified_enum {
builder = builder.constified_enum(regex);
}
@@ -700,10 +595,6 @@ where
builder = builder.blocklist_file(file);
}
for var in blocklist_var {
builder = builder.blocklist_var(var);
}
if builtins {
builder = builder.emit_builtins();
}
@@ -854,10 +745,6 @@ where
builder = builder.generate_block(true);
}
if generate_cstr {
builder = builder.generate_cstr(true);
}
if block_extern_crate {
builder = builder.block_extern_crate(true);
}
@@ -908,10 +795,6 @@ where
builder = builder.allowlist_file(file);
}
for item in allowlist_item {
builder = builder.allowlist_item(item);
}
for arg in clang_args {
builder = builder.clang_arg(arg);
}
@@ -942,14 +825,33 @@ where
}
if no_rustfmt_bindings {
builder = builder.formatter(Formatter::None);
builder = builder.rustfmt_bindings(false);
}
if let Some(formatter) = formatter {
builder = builder.formatter(formatter);
}
if let Some(path_str) = rustfmt_configuration_file {
let path = PathBuf::from(path_str);
if no_rustfmt_bindings {
return Err(Error::new(
ErrorKind::Other,
"Cannot supply both --rustfmt-configuration-file and --no-rustfmt-bindings",
));
}
if !path.is_absolute() {
return Err(Error::new(
ErrorKind::Other,
"--rustfmt-configuration--file needs to be an absolute path!",
));
}
if path.to_str().is_none() {
return Err(Error::new(
ErrorKind::Other,
"--rustfmt-configuration-file contains non-valid UTF8 characters.",
));
}
if let Some(path) = rustfmt_configuration_file {
builder = builder.rustfmt_configuration_file(Some(path));
}
@@ -985,28 +887,6 @@ where
builder = builder.dynamic_link_require_all(true);
}
if let Some(prefix_link_name) = prefix_link_name {
#[derive(Debug)]
struct PrefixLinkNameCallback {
prefix: String,
}
impl bindgen::callbacks::ParseCallbacks for PrefixLinkNameCallback {
fn generated_link_name_override(
&self,
item_info: bindgen::callbacks::ItemInfo<'_>,
) -> Option<String> {
let mut prefix = self.prefix.clone();
prefix.push_str(item_info.name);
Some(prefix)
}
}
builder = builder.parse_callbacks(Box::new(PrefixLinkNameCallback {
prefix: prefix_link_name,
}))
}
if respect_cxx_access_specs {
builder = builder.respect_cxx_access_specs(true);
}
@@ -1035,7 +915,13 @@ where
builder = builder.merge_extern_blocks(true);
}
for (abi, regex) in override_abi {
for abi_override in override_abi {
let (regex, abi_str) = abi_override
.rsplit_once('=')
.expect("Invalid ABI override: Missing `=`");
let abi = abi_str
.parse()
.unwrap_or_else(|err| panic!("Invalid ABI override: {}", err));
builder = builder.override_abi(abi, regex);
}
@@ -1043,18 +929,6 @@ where
builder = builder.wrap_unsafe_ops(true);
}
if clang_macro_fallback {
builder = builder.clang_macro_fallback();
}
if let Some(path) = clang_macro_fallback_build_dir {
builder = builder.clang_macro_fallback_build_dir(path);
}
if flexarray_dst {
builder = builder.flexarray_dst(true);
}
#[derive(Debug)]
struct CustomDeriveCallback {
derives: Vec<String>,
@@ -1098,29 +972,21 @@ where
}
}
for (custom_derives, kind, name) in [
(with_derive_custom, None, "--with-derive-custom"),
(
with_derive_custom_struct,
Some(TypeKind::Struct),
"--with-derive-custom-struct",
),
(
with_derive_custom_enum,
Some(TypeKind::Enum),
"--with-derive-custom-enum",
),
(
with_derive_custom_union,
Some(TypeKind::Union),
"--with-derive-custom-union",
),
for (custom_derives, kind) in [
(with_derive_custom, None),
(with_derive_custom_struct, Some(TypeKind::Struct)),
(with_derive_custom_enum, Some(TypeKind::Enum)),
(with_derive_custom_union, Some(TypeKind::Union)),
] {
let name = emit_diagnostics.then_some(name);
for (derives, regex) in custom_derives {
for custom_derive in custom_derives {
let (regex, derives) = custom_derive
.rsplit_once('=')
.expect("Invalid custom derive argument: Missing `=`");
let derives = derives.split(',').map(|s| s.to_owned()).collect();
let mut regex_set = RegexSet::new();
regex_set.insert(regex);
regex_set.build_with_diagnostics(false, name);
regex_set.build(false);
builder = builder.parse_callbacks(Box::new(CustomDeriveCallback {
derives,
@@ -1142,13 +1008,5 @@ where
builder = builder.wrap_static_fns_suffix(suffix);
}
if let Some(visibility) = default_visibility {
builder = builder.default_visibility(visibility);
}
if emit_diagnostics {
builder = builder.emit_diagnostics();
}
Ok((builder, output, verbose))
}
+4 -3
View File
@@ -14,6 +14,7 @@ cc = "1.0"
static = ["bindgen/static"]
runtime = ["bindgen/runtime"]
__testing_only_extra_assertions = ["bindgen/__testing_only_extra_assertions"]
__testing_only_libclang_9 = ["bindgen/__testing_only_libclang_9"]
__testing_only_libclang_16 = ["bindgen/__testing_only_libclang_16"]
testing_only_docs = ["bindgen/testing_only_docs"]
testing_only_extra_assertions = ["bindgen/testing_only_extra_assertions"]
testing_only_libclang_9 = ["bindgen/testing_only_libclang_9"]
testing_only_libclang_5 = ["bindgen/testing_only_libclang_5"]
+7 -21
View File
@@ -1,9 +1,10 @@
extern crate bindgen;
extern crate cc;
use bindgen::callbacks::{
DeriveInfo, IntKind, MacroParsingBehavior, ParseCallbacks,
};
use bindgen::{Builder, EnumVariation, Formatter};
use bindgen::{Builder, CargoCallbacks, EnumVariation};
use std::collections::HashSet;
use std::env;
use std::path::PathBuf;
@@ -127,8 +128,6 @@ impl ParseCallbacks for MacroCallback {
vec!["PartialEq".into()]
} else if info.name == "MyOrderedEnum" {
vec!["std::cmp::PartialOrd".into()]
} else if info.name == "TestDeriveOnAlias" {
vec!["std::cmp::PartialEq".into(), "std::cmp::PartialOrd".into()]
} else {
vec![]
}
@@ -150,15 +149,6 @@ impl Drop for MacroCallback {
}
}
#[derive(Debug)]
struct WrappedVaListCallback;
impl ParseCallbacks for WrappedVaListCallback {
fn wrap_as_variadic_fn(&self, name: &str) -> Option<String> {
Some(name.to_owned() + "_wrapped")
}
}
fn setup_macro_test() {
cc::Build::new()
.cpp(true)
@@ -176,7 +166,7 @@ fn setup_macro_test() {
let out_dep_file = out_path.join("test.d");
let bindings = Builder::default()
.formatter(Formatter::None)
.rustfmt_bindings(false)
.enable_cxx_namespaces()
.default_enum_style(EnumVariation::Rust {
non_exhaustive: false,
@@ -194,7 +184,6 @@ fn setup_macro_test() {
.blocklist_function("my_prefixed_function_to_remove")
.constified_enum("my_prefixed_enum_to_be_constified")
.opaque_type("my_prefixed_templated_foo<my_prefixed_baz>")
.new_type_alias("TestDeriveOnAlias")
.depfile(out_rust_file_relative.display().to_string(), &out_dep_file)
.generate()
.expect("Unable to generate bindings");
@@ -233,15 +222,11 @@ fn setup_wrap_static_fns_test() {
// generate external bindings with the external .c and .h files
let bindings = Builder::default()
.header(input_header_file_path_str)
.parse_callbacks(Box::new(
bindgen::CargoCallbacks::new().rerun_on_header_files(true),
))
.parse_callbacks(Box::new(WrappedVaListCallback))
.parse_callbacks(Box::new(CargoCallbacks))
.wrap_static_fns(true)
.wrap_static_fns_path(
out_path.join("wrap_static_fns").display().to_string(),
)
.clang_arg("-DUSE_VA_HEADER")
.generate()
.expect("Unable to generate bindings");
@@ -257,7 +242,8 @@ fn setup_wrap_static_fns_test() {
.arg("-o")
.arg(&obj_path)
.arg(out_path.join("wrap_static_fns.c"))
.arg("-DUSE_VA_HEADER")
.arg("-include")
.arg(input_header_file_path)
.output()
.expect("`clang` command error");
if !clang_output.status.success() {
@@ -283,7 +269,7 @@ fn setup_wrap_static_fns_test() {
bindings
.write_to_file(out_rust_file)
.expect("Could not write bindings to the Rust file");
.expect("Cound not write bindings to the Rust file");
}
fn main() {
-3
View File
@@ -241,6 +241,3 @@ enum MyOrderedEnum {
METER,
LIGHTYEAR,
};
// Used to test custom derives on new-type alias. See `test_custom_derive`.
typedef int TestDeriveOnAlias;
+1 -15
View File
@@ -12,6 +12,7 @@ use std::ffi::CStr;
use std::mem;
use std::os::raw::c_int;
#[allow(unused)]
use bindings::testing::Bar; // This type is generated from module_raw_line.
type MacroInteger = isize;
@@ -288,13 +289,6 @@ fn test_custom_derive() {
assert!(meter < lightyear);
assert!(meter > micron);
// The `add_derives` callback should have added `#[derive(PartialEq, PartialOrd)]`
// to the `TestDeriveOnAlias` new-type alias. If it didn't, this will fail to compile.
let test1 = unsafe { bindings::TestDeriveOnAlias(5) };
let test2 = unsafe { bindings::TestDeriveOnAlias(6) };
assert!(test1 < test2);
assert!(!(test1 > test2));
}
#[test]
@@ -326,13 +320,5 @@ fn test_wrap_static_fns() {
let tq =
extern_bindings::takes_qualified(&(&5 as *const _) as *const _);
assert_eq!(5, tq);
let wv1 = extern_bindings::wrap_as_variadic_fn1_wrapped(0);
assert_eq!(0, wv1);
let wv1 = extern_bindings::wrap_as_variadic_fn1_wrapped(2, 5, 3);
assert_eq!(8, wv1);
extern_bindings::wrap_as_variadic_fn2_wrapped(1, 2);
}
}
+8 -10
View File
@@ -5,21 +5,19 @@ version = "0.1.0"
publish = false
[dev-dependencies]
bindgen = { path = "../bindgen", features = ["__cli", "experimental"] }
clap = { version = "4", features = ["derive"] }
clap_complete = "4"
bindgen = { path = "../bindgen", features = ["cli", "experimental"] }
diff = "0.1"
shlex = "1"
prettyplease = { version = "0.2.7", features = ["verbatim"] }
syn = { version = "2.0" }
clap = { version = "4", features = ["derive"] }
tempfile = "3"
similar = { version = "2.2.1", features = ["inline"] }
owo-colors = "3.5.0"
[features]
logging = ["bindgen/logging"]
static = ["bindgen/static"]
runtime = ["bindgen/runtime"]
which-rustfmt = ["bindgen/which-rustfmt"]
__testing_only_extra_assertions = ["bindgen/__testing_only_extra_assertions"]
__testing_only_libclang_9 = ["bindgen/__testing_only_libclang_9"]
__testing_only_libclang_16 = ["bindgen/__testing_only_libclang_16"]
testing_only_docs = ["bindgen/testing_only_docs"]
testing_only_extra_assertions = ["bindgen/testing_only_extra_assertions"]
testing_only_libclang_9 = ["bindgen/testing_only_libclang_9"]
testing_only_libclang_5 = ["bindgen/testing_only_libclang_5"]
+3 -4
View File
@@ -1,16 +1,15 @@
[package]
name = "tests_expectations"
description = "bindgen results when ran on ../headers/*"
version = "0.0.0"
version = "0.1.0"
authors = [
"Jyun-Yan You <jyyou.tw@gmail.com>",
"Emilio Cobos Álvarez <emilio@crisal.io>",
"The Servo project developers",
]
edition = "2018"
publish = false
[dependencies]
block = "0.1"
libloading = "0.7"
objc = "0.2"
block = "0.1"
libloading = "0.6.2"
+1 -1
View File
@@ -8,7 +8,7 @@ use std::fs;
use std::io::Write;
use std::path::Path;
const LIBCLANG_VERSION_DIRS: &[&str] = &["libclang-9"];
const LIBCLANG_VERSION_DIRS: &[&str] = &["libclang-5", "libclang-9"];
fn main() {
println!("cargo:rerun-if-changed=build.rs");
@@ -1,2 +0,0 @@
# disable rustfmt for this crate so running `cargo fmt` doesn't affect the expected binding files
disable_all_formatting = true
+265 -94
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct rte_ipv4_tuple {
@@ -18,35 +24,77 @@ pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
pub dport: u16,
pub sport: u16,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1",
][::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>() - 4usize];
[
"Alignment of rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1",
][::std::mem::align_of::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>() - 2usize];
[
"Offset of field: rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1::dport",
][::std::mem::offset_of!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1, dport)
- 0usize];
[
"Offset of field: rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1::sport",
][::std::mem::offset_of!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1, sport)
- 2usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of rte_ipv4_tuple__bindgen_ty_1",
][::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1>() - 4usize];
[
"Alignment of rte_ipv4_tuple__bindgen_ty_1",
][::std::mem::align_of::<rte_ipv4_tuple__bindgen_ty_1>() - 4usize];
[
"Offset of field: rte_ipv4_tuple__bindgen_ty_1::sctp_tag",
][::std::mem::offset_of!(rte_ipv4_tuple__bindgen_ty_1, sctp_tag) - 0usize];
};
#[test]
fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() {
const UNINIT: ::std::mem::MaybeUninit<
rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1,
> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(),
4usize,
concat!(
"Size of: ",
stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
::std::mem::align_of::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(),
2usize,
concat!(
"Alignment of ",
stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(dport)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(sport)
)
);
}
#[test]
fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() {
const UNINIT: ::std::mem::MaybeUninit<rte_ipv4_tuple__bindgen_ty_1> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1>(),
4usize,
concat!("Size of: ", stringify!(rte_ipv4_tuple__bindgen_ty_1))
);
assert_eq!(
::std::mem::align_of::<rte_ipv4_tuple__bindgen_ty_1>(),
4usize,
concat!("Alignment of ", stringify!(rte_ipv4_tuple__bindgen_ty_1))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(rte_ipv4_tuple__bindgen_ty_1),
"::",
stringify!(sctp_tag)
)
);
}
impl Default for rte_ipv4_tuple__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -56,17 +104,46 @@ impl Default for rte_ipv4_tuple__bindgen_ty_1 {
}
}
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of rte_ipv4_tuple"][::std::mem::size_of::<rte_ipv4_tuple>() - 12usize];
["Alignment of rte_ipv4_tuple"][::std::mem::align_of::<rte_ipv4_tuple>() - 4usize];
[
"Offset of field: rte_ipv4_tuple::src_addr",
][::std::mem::offset_of!(rte_ipv4_tuple, src_addr) - 0usize];
[
"Offset of field: rte_ipv4_tuple::dst_addr",
][::std::mem::offset_of!(rte_ipv4_tuple, dst_addr) - 4usize];
};
#[test]
fn bindgen_test_layout_rte_ipv4_tuple() {
const UNINIT: ::std::mem::MaybeUninit<rte_ipv4_tuple> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_ipv4_tuple>(),
12usize,
concat!("Size of: ", stringify!(rte_ipv4_tuple))
);
assert_eq!(
::std::mem::align_of::<rte_ipv4_tuple>(),
4usize,
concat!("Alignment of ", stringify!(rte_ipv4_tuple))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(rte_ipv4_tuple),
"::",
stringify!(src_addr)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize
},
4usize,
concat!(
"Offset of field: ",
stringify!(rte_ipv4_tuple),
"::",
stringify!(dst_addr)
)
);
}
impl Default for rte_ipv4_tuple {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -95,35 +172,77 @@ pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
pub dport: u16,
pub sport: u16,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1",
][::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>() - 4usize];
[
"Alignment of rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1",
][::std::mem::align_of::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>() - 2usize];
[
"Offset of field: rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1::dport",
][::std::mem::offset_of!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1, dport)
- 0usize];
[
"Offset of field: rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1::sport",
][::std::mem::offset_of!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1, sport)
- 2usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of rte_ipv6_tuple__bindgen_ty_1",
][::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1>() - 4usize];
[
"Alignment of rte_ipv6_tuple__bindgen_ty_1",
][::std::mem::align_of::<rte_ipv6_tuple__bindgen_ty_1>() - 4usize];
[
"Offset of field: rte_ipv6_tuple__bindgen_ty_1::sctp_tag",
][::std::mem::offset_of!(rte_ipv6_tuple__bindgen_ty_1, sctp_tag) - 0usize];
};
#[test]
fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() {
const UNINIT: ::std::mem::MaybeUninit<
rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1,
> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(),
4usize,
concat!(
"Size of: ",
stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
::std::mem::align_of::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(),
2usize,
concat!(
"Alignment of ",
stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(dport)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(sport)
)
);
}
#[test]
fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() {
const UNINIT: ::std::mem::MaybeUninit<rte_ipv6_tuple__bindgen_ty_1> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1>(),
4usize,
concat!("Size of: ", stringify!(rte_ipv6_tuple__bindgen_ty_1))
);
assert_eq!(
::std::mem::align_of::<rte_ipv6_tuple__bindgen_ty_1>(),
4usize,
concat!("Alignment of ", stringify!(rte_ipv6_tuple__bindgen_ty_1))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(rte_ipv6_tuple__bindgen_ty_1),
"::",
stringify!(sctp_tag)
)
);
}
impl Default for rte_ipv6_tuple__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -133,17 +252,46 @@ impl Default for rte_ipv6_tuple__bindgen_ty_1 {
}
}
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of rte_ipv6_tuple"][::std::mem::size_of::<rte_ipv6_tuple>() - 36usize];
["Alignment of rte_ipv6_tuple"][::std::mem::align_of::<rte_ipv6_tuple>() - 4usize];
[
"Offset of field: rte_ipv6_tuple::src_addr",
][::std::mem::offset_of!(rte_ipv6_tuple, src_addr) - 0usize];
[
"Offset of field: rte_ipv6_tuple::dst_addr",
][::std::mem::offset_of!(rte_ipv6_tuple, dst_addr) - 16usize];
};
#[test]
fn bindgen_test_layout_rte_ipv6_tuple() {
const UNINIT: ::std::mem::MaybeUninit<rte_ipv6_tuple> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_ipv6_tuple>(),
36usize,
concat!("Size of: ", stringify!(rte_ipv6_tuple))
);
assert_eq!(
::std::mem::align_of::<rte_ipv6_tuple>(),
4usize,
concat!("Alignment of ", stringify!(rte_ipv6_tuple))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(rte_ipv6_tuple),
"::",
stringify!(src_addr)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize
},
16usize,
concat!(
"Offset of field: ",
stringify!(rte_ipv6_tuple),
"::",
stringify!(dst_addr)
)
);
}
impl Default for rte_ipv6_tuple {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -160,19 +308,42 @@ pub union rte_thash_tuple {
pub v4: rte_ipv4_tuple,
pub v6: rte_ipv6_tuple,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of rte_thash_tuple"][::std::mem::size_of::<rte_thash_tuple>() - 48usize];
[
"Alignment of rte_thash_tuple",
][::std::mem::align_of::<rte_thash_tuple>() - 16usize];
[
"Offset of field: rte_thash_tuple::v4",
][::std::mem::offset_of!(rte_thash_tuple, v4) - 0usize];
[
"Offset of field: rte_thash_tuple::v6",
][::std::mem::offset_of!(rte_thash_tuple, v6) - 0usize];
};
#[test]
fn bindgen_test_layout_rte_thash_tuple() {
const UNINIT: ::std::mem::MaybeUninit<rte_thash_tuple> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_thash_tuple>(),
48usize,
concat!("Size of: ", stringify!(rte_thash_tuple))
);
assert_eq!(
::std::mem::align_of::<rte_thash_tuple>(),
16usize,
concat!("Alignment of ", stringify!(rte_thash_tuple))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).v4) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(rte_thash_tuple),
"::",
stringify!(v4)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).v6) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(rte_thash_tuple),
"::",
stringify!(v6)
)
);
}
impl Default for rte_thash_tuple {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
+143 -46
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl<T> __BindgenUnionField<T> {
@@ -24,7 +30,7 @@ impl<T> ::std::default::Default for __BindgenUnionField<T> {
impl<T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self {
*self
Self::new()
}
}
impl<T> ::std::marker::Copy for __BindgenUnionField<T> {}
@@ -52,9 +58,8 @@ pub struct rte_ipv4_tuple {
#[repr(C)]
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct rte_ipv4_tuple__bindgen_ty_1 {
pub __bindgen_anon_1: __BindgenUnionField<
rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1,
>,
pub __bindgen_anon_1:
__BindgenUnionField<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>,
pub sctp_tag: __BindgenUnionField<u32>,
pub bindgen_union_field: u32,
}
@@ -66,27 +71,45 @@ pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
}
#[test]
fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() {
const UNINIT: ::std::mem::MaybeUninit<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<
rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1,
> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(),
4usize,
"Size of rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1",
concat!(
"Size of: ",
stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
::std::mem::align_of::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(),
2usize,
"Alignment of rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1",
concat!(
"Alignment of ",
stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize },
0usize,
"Offset of field: rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1::dport",
concat!(
"Offset of field: ",
stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(dport)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize },
2usize,
"Offset of field: rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1::sport",
concat!(
"Offset of field: ",
stringify!(rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(sport)
)
);
}
impl Clone for rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
@@ -96,22 +119,30 @@ impl Clone for rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
}
#[test]
fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() {
const UNINIT: ::std::mem::MaybeUninit<rte_ipv4_tuple__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<rte_ipv4_tuple__bindgen_ty_1> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1>(),
4usize,
"Size of rte_ipv4_tuple__bindgen_ty_1",
concat!("Size of: ", stringify!(rte_ipv4_tuple__bindgen_ty_1))
);
assert_eq!(
::std::mem::align_of::<rte_ipv4_tuple__bindgen_ty_1>(),
4usize,
"Alignment of rte_ipv4_tuple__bindgen_ty_1",
concat!("Alignment of ", stringify!(rte_ipv4_tuple__bindgen_ty_1))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize },
unsafe {
::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize
},
0usize,
"Offset of field: rte_ipv4_tuple__bindgen_ty_1::sctp_tag",
concat!(
"Offset of field: ",
stringify!(rte_ipv4_tuple__bindgen_ty_1),
"::",
stringify!(sctp_tag)
)
);
}
impl Clone for rte_ipv4_tuple__bindgen_ty_1 {
@@ -121,27 +152,42 @@ impl Clone for rte_ipv4_tuple__bindgen_ty_1 {
}
#[test]
fn bindgen_test_layout_rte_ipv4_tuple() {
const UNINIT: ::std::mem::MaybeUninit<rte_ipv4_tuple> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<rte_ipv4_tuple> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_ipv4_tuple>(),
12usize,
"Size of rte_ipv4_tuple",
concat!("Size of: ", stringify!(rte_ipv4_tuple))
);
assert_eq!(
::std::mem::align_of::<rte_ipv4_tuple>(),
4usize,
"Alignment of rte_ipv4_tuple",
concat!("Alignment of ", stringify!(rte_ipv4_tuple))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize },
unsafe {
::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize
},
0usize,
"Offset of field: rte_ipv4_tuple::src_addr",
concat!(
"Offset of field: ",
stringify!(rte_ipv4_tuple),
"::",
stringify!(src_addr)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize },
unsafe {
::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize
},
4usize,
"Offset of field: rte_ipv4_tuple::dst_addr",
concat!(
"Offset of field: ",
stringify!(rte_ipv4_tuple),
"::",
stringify!(dst_addr)
)
);
}
impl Clone for rte_ipv4_tuple {
@@ -159,9 +205,8 @@ pub struct rte_ipv6_tuple {
#[repr(C)]
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct rte_ipv6_tuple__bindgen_ty_1 {
pub __bindgen_anon_1: __BindgenUnionField<
rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1,
>,
pub __bindgen_anon_1:
__BindgenUnionField<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>,
pub sctp_tag: __BindgenUnionField<u32>,
pub bindgen_union_field: u32,
}
@@ -173,27 +218,45 @@ pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
}
#[test]
fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() {
const UNINIT: ::std::mem::MaybeUninit<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<
rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1,
> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(),
4usize,
"Size of rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1",
concat!(
"Size of: ",
stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
::std::mem::align_of::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(),
2usize,
"Alignment of rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1",
concat!(
"Alignment of ",
stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize },
0usize,
"Offset of field: rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1::dport",
concat!(
"Offset of field: ",
stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(dport)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize },
2usize,
"Offset of field: rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1::sport",
concat!(
"Offset of field: ",
stringify!(rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1),
"::",
stringify!(sport)
)
);
}
impl Clone for rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
@@ -203,22 +266,30 @@ impl Clone for rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
}
#[test]
fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() {
const UNINIT: ::std::mem::MaybeUninit<rte_ipv6_tuple__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<rte_ipv6_tuple__bindgen_ty_1> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1>(),
4usize,
"Size of rte_ipv6_tuple__bindgen_ty_1",
concat!("Size of: ", stringify!(rte_ipv6_tuple__bindgen_ty_1))
);
assert_eq!(
::std::mem::align_of::<rte_ipv6_tuple__bindgen_ty_1>(),
4usize,
"Alignment of rte_ipv6_tuple__bindgen_ty_1",
concat!("Alignment of ", stringify!(rte_ipv6_tuple__bindgen_ty_1))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize },
unsafe {
::std::ptr::addr_of!((*ptr).sctp_tag) as usize - ptr as usize
},
0usize,
"Offset of field: rte_ipv6_tuple__bindgen_ty_1::sctp_tag",
concat!(
"Offset of field: ",
stringify!(rte_ipv6_tuple__bindgen_ty_1),
"::",
stringify!(sctp_tag)
)
);
}
impl Clone for rte_ipv6_tuple__bindgen_ty_1 {
@@ -228,27 +299,42 @@ impl Clone for rte_ipv6_tuple__bindgen_ty_1 {
}
#[test]
fn bindgen_test_layout_rte_ipv6_tuple() {
const UNINIT: ::std::mem::MaybeUninit<rte_ipv6_tuple> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<rte_ipv6_tuple> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_ipv6_tuple>(),
36usize,
"Size of rte_ipv6_tuple",
concat!("Size of: ", stringify!(rte_ipv6_tuple))
);
assert_eq!(
::std::mem::align_of::<rte_ipv6_tuple>(),
4usize,
"Alignment of rte_ipv6_tuple",
concat!("Alignment of ", stringify!(rte_ipv6_tuple))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize },
unsafe {
::std::ptr::addr_of!((*ptr).src_addr) as usize - ptr as usize
},
0usize,
"Offset of field: rte_ipv6_tuple::src_addr",
concat!(
"Offset of field: ",
stringify!(rte_ipv6_tuple),
"::",
stringify!(src_addr)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize },
unsafe {
::std::ptr::addr_of!((*ptr).dst_addr) as usize - ptr as usize
},
16usize,
"Offset of field: rte_ipv6_tuple::dst_addr",
concat!(
"Offset of field: ",
stringify!(rte_ipv6_tuple),
"::",
stringify!(dst_addr)
)
);
}
impl Clone for rte_ipv6_tuple {
@@ -265,22 +351,33 @@ pub struct rte_thash_tuple {
}
#[test]
fn bindgen_test_layout_rte_thash_tuple() {
const UNINIT: ::std::mem::MaybeUninit<rte_thash_tuple> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<rte_thash_tuple> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<rte_thash_tuple>(),
48usize,
"Size of rte_thash_tuple",
concat!("Size of: ", stringify!(rte_thash_tuple))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).v4) as usize - ptr as usize },
0usize,
"Offset of field: rte_thash_tuple::v4",
concat!(
"Offset of field: ",
stringify!(rte_thash_tuple),
"::",
stringify!(v4)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).v6) as usize - ptr as usize },
0usize,
"Offset of field: rte_thash_tuple::v6",
concat!(
"Offset of field: ",
stringify!(rte_thash_tuple),
"::",
stringify!(v6)
)
);
}
impl Clone for rte_thash_tuple {
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct std_allocator_traits {
+7 -6
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
extern "fastcall" {
pub fn foo();
}
@@ -8,8 +14,3 @@ extern "stdcall" {
extern "C" {
pub fn baz();
}
extern "system" {
pub fn qux();
}
pub type boo = ::std::option::Option<unsafe extern "efiapi" fn()>;
pub type foobar = ::std::option::Option<unsafe extern "efiapi" fn(boo: boo)>;
@@ -1,5 +0,0 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
extern "C" {
#[link_name = "\u{1}_Z1bcz"]
pub fn b(arg1: ::std::os::raw::c_char, ...) -> ::std::os::raw::c_char;
}
+289 -83
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct SomeAccessors {
@@ -10,23 +16,72 @@ pub struct SomeAccessors {
/// <div rustbindgen accessor="immutable"></div>
pub mImmutableAccessor: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of SomeAccessors"][::std::mem::size_of::<SomeAccessors>() - 16usize];
["Alignment of SomeAccessors"][::std::mem::align_of::<SomeAccessors>() - 4usize];
[
"Offset of field: SomeAccessors::mNoAccessor",
][::std::mem::offset_of!(SomeAccessors, mNoAccessor) - 0usize];
[
"Offset of field: SomeAccessors::mBothAccessors",
][::std::mem::offset_of!(SomeAccessors, mBothAccessors) - 4usize];
[
"Offset of field: SomeAccessors::mUnsafeAccessors",
][::std::mem::offset_of!(SomeAccessors, mUnsafeAccessors) - 8usize];
[
"Offset of field: SomeAccessors::mImmutableAccessor",
][::std::mem::offset_of!(SomeAccessors, mImmutableAccessor) - 12usize];
};
#[test]
fn bindgen_test_layout_SomeAccessors() {
const UNINIT: ::std::mem::MaybeUninit<SomeAccessors> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<SomeAccessors>(),
16usize,
concat!("Size of: ", stringify!(SomeAccessors))
);
assert_eq!(
::std::mem::align_of::<SomeAccessors>(),
4usize,
concat!("Alignment of ", stringify!(SomeAccessors))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mNoAccessor) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(SomeAccessors),
"::",
stringify!(mNoAccessor)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mBothAccessors) as usize - ptr as usize
},
4usize,
concat!(
"Offset of field: ",
stringify!(SomeAccessors),
"::",
stringify!(mBothAccessors)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mUnsafeAccessors) as usize -
ptr as usize
},
8usize,
concat!(
"Offset of field: ",
stringify!(SomeAccessors),
"::",
stringify!(mUnsafeAccessors)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mImmutableAccessor) as usize -
ptr as usize
},
12usize,
concat!(
"Offset of field: ",
stringify!(SomeAccessors),
"::",
stringify!(mImmutableAccessor)
)
);
}
impl SomeAccessors {
#[inline]
pub fn get_mBothAccessors(&self) -> &::std::os::raw::c_int {
@@ -41,7 +96,9 @@ impl SomeAccessors {
&self.mUnsafeAccessors
}
#[inline]
pub unsafe fn get_mUnsafeAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int {
pub unsafe fn get_mUnsafeAccessors_mut(
&mut self,
) -> &mut ::std::os::raw::c_int {
&mut self.mUnsafeAccessors
}
#[inline]
@@ -56,17 +113,47 @@ pub struct AllAccessors {
pub mBothAccessors: ::std::os::raw::c_int,
pub mAlsoBothAccessors: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of AllAccessors"][::std::mem::size_of::<AllAccessors>() - 8usize];
["Alignment of AllAccessors"][::std::mem::align_of::<AllAccessors>() - 4usize];
[
"Offset of field: AllAccessors::mBothAccessors",
][::std::mem::offset_of!(AllAccessors, mBothAccessors) - 0usize];
[
"Offset of field: AllAccessors::mAlsoBothAccessors",
][::std::mem::offset_of!(AllAccessors, mAlsoBothAccessors) - 4usize];
};
#[test]
fn bindgen_test_layout_AllAccessors() {
const UNINIT: ::std::mem::MaybeUninit<AllAccessors> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<AllAccessors>(),
8usize,
concat!("Size of: ", stringify!(AllAccessors))
);
assert_eq!(
::std::mem::align_of::<AllAccessors>(),
4usize,
concat!("Alignment of ", stringify!(AllAccessors))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mBothAccessors) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(AllAccessors),
"::",
stringify!(mBothAccessors)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mAlsoBothAccessors) as usize -
ptr as usize
},
4usize,
concat!(
"Offset of field: ",
stringify!(AllAccessors),
"::",
stringify!(mAlsoBothAccessors)
)
);
}
impl AllAccessors {
#[inline]
pub fn get_mBothAccessors(&self) -> &::std::os::raw::c_int {
@@ -92,26 +179,56 @@ pub struct AllUnsafeAccessors {
pub mBothAccessors: ::std::os::raw::c_int,
pub mAlsoBothAccessors: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of AllUnsafeAccessors"][::std::mem::size_of::<AllUnsafeAccessors>() - 8usize];
[
"Alignment of AllUnsafeAccessors",
][::std::mem::align_of::<AllUnsafeAccessors>() - 4usize];
[
"Offset of field: AllUnsafeAccessors::mBothAccessors",
][::std::mem::offset_of!(AllUnsafeAccessors, mBothAccessors) - 0usize];
[
"Offset of field: AllUnsafeAccessors::mAlsoBothAccessors",
][::std::mem::offset_of!(AllUnsafeAccessors, mAlsoBothAccessors) - 4usize];
};
#[test]
fn bindgen_test_layout_AllUnsafeAccessors() {
const UNINIT: ::std::mem::MaybeUninit<AllUnsafeAccessors> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<AllUnsafeAccessors>(),
8usize,
concat!("Size of: ", stringify!(AllUnsafeAccessors))
);
assert_eq!(
::std::mem::align_of::<AllUnsafeAccessors>(),
4usize,
concat!("Alignment of ", stringify!(AllUnsafeAccessors))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mBothAccessors) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(AllUnsafeAccessors),
"::",
stringify!(mBothAccessors)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mAlsoBothAccessors) as usize -
ptr as usize
},
4usize,
concat!(
"Offset of field: ",
stringify!(AllUnsafeAccessors),
"::",
stringify!(mAlsoBothAccessors)
)
);
}
impl AllUnsafeAccessors {
#[inline]
pub unsafe fn get_mBothAccessors(&self) -> &::std::os::raw::c_int {
&self.mBothAccessors
}
#[inline]
pub unsafe fn get_mBothAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int {
pub unsafe fn get_mBothAccessors_mut(
&mut self,
) -> &mut ::std::os::raw::c_int {
&mut self.mBothAccessors
}
#[inline]
@@ -119,7 +236,9 @@ impl AllUnsafeAccessors {
&self.mAlsoBothAccessors
}
#[inline]
pub unsafe fn get_mAlsoBothAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int {
pub unsafe fn get_mAlsoBothAccessors_mut(
&mut self,
) -> &mut ::std::os::raw::c_int {
&mut self.mAlsoBothAccessors
}
}
@@ -135,27 +254,72 @@ pub struct ContradictAccessors {
/// <div rustbindgen accessor="immutable"></div>
pub mImmutableAccessor: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of ContradictAccessors",
][::std::mem::size_of::<ContradictAccessors>() - 16usize];
[
"Alignment of ContradictAccessors",
][::std::mem::align_of::<ContradictAccessors>() - 4usize];
[
"Offset of field: ContradictAccessors::mBothAccessors",
][::std::mem::offset_of!(ContradictAccessors, mBothAccessors) - 0usize];
[
"Offset of field: ContradictAccessors::mNoAccessors",
][::std::mem::offset_of!(ContradictAccessors, mNoAccessors) - 4usize];
[
"Offset of field: ContradictAccessors::mUnsafeAccessors",
][::std::mem::offset_of!(ContradictAccessors, mUnsafeAccessors) - 8usize];
[
"Offset of field: ContradictAccessors::mImmutableAccessor",
][::std::mem::offset_of!(ContradictAccessors, mImmutableAccessor) - 12usize];
};
#[test]
fn bindgen_test_layout_ContradictAccessors() {
const UNINIT: ::std::mem::MaybeUninit<ContradictAccessors> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<ContradictAccessors>(),
16usize,
concat!("Size of: ", stringify!(ContradictAccessors))
);
assert_eq!(
::std::mem::align_of::<ContradictAccessors>(),
4usize,
concat!("Alignment of ", stringify!(ContradictAccessors))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mBothAccessors) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(ContradictAccessors),
"::",
stringify!(mBothAccessors)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mNoAccessors) as usize - ptr as usize
},
4usize,
concat!(
"Offset of field: ",
stringify!(ContradictAccessors),
"::",
stringify!(mNoAccessors)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mUnsafeAccessors) as usize -
ptr as usize
},
8usize,
concat!(
"Offset of field: ",
stringify!(ContradictAccessors),
"::",
stringify!(mUnsafeAccessors)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mImmutableAccessor) as usize -
ptr as usize
},
12usize,
concat!(
"Offset of field: ",
stringify!(ContradictAccessors),
"::",
stringify!(mImmutableAccessor)
)
);
}
impl ContradictAccessors {
#[inline]
pub fn get_mBothAccessors(&self) -> &::std::os::raw::c_int {
@@ -170,7 +334,9 @@ impl ContradictAccessors {
&self.mUnsafeAccessors
}
#[inline]
pub unsafe fn get_mUnsafeAccessors_mut(&mut self) -> &mut ::std::os::raw::c_int {
pub unsafe fn get_mUnsafeAccessors_mut(
&mut self,
) -> &mut ::std::os::raw::c_int {
&mut self.mUnsafeAccessors
}
#[inline]
@@ -184,14 +350,34 @@ impl ContradictAccessors {
pub struct Replaced {
pub mAccessor: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Replaced"][::std::mem::size_of::<Replaced>() - 4usize];
["Alignment of Replaced"][::std::mem::align_of::<Replaced>() - 4usize];
[
"Offset of field: Replaced::mAccessor",
][::std::mem::offset_of!(Replaced, mAccessor) - 0usize];
};
#[test]
fn bindgen_test_layout_Replaced() {
const UNINIT: ::std::mem::MaybeUninit<Replaced> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<Replaced>(),
4usize,
concat!("Size of: ", stringify!(Replaced))
);
assert_eq!(
::std::mem::align_of::<Replaced>(),
4usize,
concat!("Alignment of ", stringify!(Replaced))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mAccessor) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(Replaced),
"::",
stringify!(mAccessor)
)
);
}
impl Replaced {
#[inline]
pub fn get_mAccessor(&self) -> &::std::os::raw::c_int {
@@ -208,14 +394,34 @@ impl Replaced {
pub struct Wrapper {
pub mReplaced: Replaced,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Wrapper"][::std::mem::size_of::<Wrapper>() - 4usize];
["Alignment of Wrapper"][::std::mem::align_of::<Wrapper>() - 4usize];
[
"Offset of field: Wrapper::mReplaced",
][::std::mem::offset_of!(Wrapper, mReplaced) - 0usize];
};
#[test]
fn bindgen_test_layout_Wrapper() {
const UNINIT: ::std::mem::MaybeUninit<Wrapper> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<Wrapper>(),
4usize,
concat!("Size of: ", stringify!(Wrapper))
);
assert_eq!(
::std::mem::align_of::<Wrapper>(),
4usize,
concat!("Alignment of ", stringify!(Wrapper))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).mReplaced) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(Wrapper),
"::",
stringify!(mReplaced)
)
);
}
impl Wrapper {
#[inline]
pub fn get_mReplaced(&self) -> &Replaced {
-14
View File
@@ -1,14 +0,0 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
/// This is Struct
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Struct {
/// This is field
pub field: ::std::os::raw::c_int,
}
/// This is AliasToStruct
pub type AliasToStruct = Struct;
/// This is AliasToInt
pub type AliasToInt = ::std::os::raw::c_int;
/// This is AliasToAliasToInt
pub type AliasToAliasToInt = AliasToInt;
+102 -39
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
pub const SOME_DEFUN: u32 = 123;
extern "C" {
#[link_name = "\u{1}_Z12SomeFunctionv"]
@@ -12,14 +18,25 @@ extern "C" {
pub struct someClass {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of someClass"][::std::mem::size_of::<someClass>() - 1usize];
["Alignment of someClass"][::std::mem::align_of::<someClass>() - 1usize];
};
#[test]
fn bindgen_test_layout_someClass() {
assert_eq!(
::std::mem::size_of::<someClass>(),
1usize,
concat!("Size of: ", stringify!(someClass))
);
assert_eq!(
::std::mem::align_of::<someClass>(),
1usize,
concat!("Alignment of ", stringify!(someClass))
);
}
extern "C" {
#[link_name = "\u{1}_ZN9someClass16somePublicMethodEi"]
pub fn someClass_somePublicMethod(this: *mut someClass, foo: ::std::os::raw::c_int);
pub fn someClass_somePublicMethod(
this: *mut someClass,
foo: ::std::os::raw::c_int,
);
}
impl someClass {
#[inline]
@@ -39,18 +56,32 @@ extern "C" {
pub struct StructWithAllowlistedDefinition {
pub other: *mut StructWithAllowlistedFwdDecl,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of StructWithAllowlistedDefinition",
][::std::mem::size_of::<StructWithAllowlistedDefinition>() - 8usize];
[
"Alignment of StructWithAllowlistedDefinition",
][::std::mem::align_of::<StructWithAllowlistedDefinition>() - 8usize];
[
"Offset of field: StructWithAllowlistedDefinition::other",
][::std::mem::offset_of!(StructWithAllowlistedDefinition, other) - 0usize];
};
#[test]
fn bindgen_test_layout_StructWithAllowlistedDefinition() {
const UNINIT: ::std::mem::MaybeUninit<StructWithAllowlistedDefinition> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<StructWithAllowlistedDefinition>(),
8usize,
concat!("Size of: ", stringify!(StructWithAllowlistedDefinition))
);
assert_eq!(
::std::mem::align_of::<StructWithAllowlistedDefinition>(),
8usize,
concat!("Alignment of ", stringify!(StructWithAllowlistedDefinition))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).other) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(StructWithAllowlistedDefinition),
"::",
stringify!(other)
)
);
}
impl Default for StructWithAllowlistedDefinition {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -65,28 +96,60 @@ impl Default for StructWithAllowlistedDefinition {
pub struct StructWithAllowlistedFwdDecl {
pub b: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of StructWithAllowlistedFwdDecl",
][::std::mem::size_of::<StructWithAllowlistedFwdDecl>() - 4usize];
[
"Alignment of StructWithAllowlistedFwdDecl",
][::std::mem::align_of::<StructWithAllowlistedFwdDecl>() - 4usize];
[
"Offset of field: StructWithAllowlistedFwdDecl::b",
][::std::mem::offset_of!(StructWithAllowlistedFwdDecl, b) - 0usize];
};
#[test]
fn bindgen_test_layout_StructWithAllowlistedFwdDecl() {
const UNINIT: ::std::mem::MaybeUninit<StructWithAllowlistedFwdDecl> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<StructWithAllowlistedFwdDecl>(),
4usize,
concat!("Size of: ", stringify!(StructWithAllowlistedFwdDecl))
);
assert_eq!(
::std::mem::align_of::<StructWithAllowlistedFwdDecl>(),
4usize,
concat!("Alignment of ", stringify!(StructWithAllowlistedFwdDecl))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(StructWithAllowlistedFwdDecl),
"::",
stringify!(b)
)
);
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct AllowlistMe {
pub foo: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of AllowlistMe"][::std::mem::size_of::<AllowlistMe>() - 4usize];
["Alignment of AllowlistMe"][::std::mem::align_of::<AllowlistMe>() - 4usize];
[
"Offset of field: AllowlistMe::foo",
][::std::mem::offset_of!(AllowlistMe, foo) - 0usize];
};
#[test]
fn bindgen_test_layout_AllowlistMe() {
const UNINIT: ::std::mem::MaybeUninit<AllowlistMe> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<AllowlistMe>(),
4usize,
concat!("Size of: ", stringify!(AllowlistMe))
);
assert_eq!(
::std::mem::align_of::<AllowlistMe>(),
4usize,
concat!("Alignment of ", stringify!(AllowlistMe))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(AllowlistMe),
"::",
stringify!(foo)
)
);
}
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub mod root {
#[allow(unused_imports)]
@@ -14,11 +20,19 @@ pub mod root {
pub struct Helper {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Helper"][::std::mem::size_of::<Helper>() - 1usize];
["Alignment of Helper"][::std::mem::align_of::<Helper>() - 1usize];
};
#[test]
fn bindgen_test_layout_Helper() {
assert_eq!(
::std::mem::size_of::<Helper>(),
1usize,
concat!("Size of: ", stringify!(Helper))
);
assert_eq!(
::std::mem::align_of::<Helper>(),
1usize,
concat!("Alignment of ", stringify!(Helper))
);
}
}
}
}
+48 -14
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub mod root {
#[allow(unused_imports)]
@@ -14,24 +20,52 @@ pub mod root {
pub struct Helper {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Helper"][::std::mem::size_of::<Helper>() - 1usize];
["Alignment of Helper"][::std::mem::align_of::<Helper>() - 1usize];
};
#[test]
fn bindgen_test_layout_Helper() {
assert_eq!(
::std::mem::size_of::<Helper>(),
1usize,
concat!("Size of: ", stringify!(Helper))
);
assert_eq!(
::std::mem::align_of::<Helper>(),
1usize,
concat!("Alignment of ", stringify!(Helper))
);
}
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Test {
pub helper: root::outer::inner::Helper,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Test"][::std::mem::size_of::<Test>() - 1usize];
["Alignment of Test"][::std::mem::align_of::<Test>() - 1usize];
[
"Offset of field: Test::helper",
][::std::mem::offset_of!(Test, helper) - 0usize];
};
#[test]
fn bindgen_test_layout_Test() {
const UNINIT: ::std::mem::MaybeUninit<Test> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<Test>(),
1usize,
concat!("Size of: ", stringify!(Test))
);
assert_eq!(
::std::mem::align_of::<Test>(),
1usize,
concat!("Alignment of ", stringify!(Test))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).helper) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(Test),
"::",
stringify!(helper)
)
);
}
}
}
+9 -3
View File
@@ -1,16 +1,22 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct AllowlistMe<T> {
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
pub foo: ::std::os::raw::c_int,
pub bar: AllowlistMe_Inner<T>,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct AllowlistMe_Inner<T> {
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
pub bar: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
}
impl<T> Default for AllowlistMe_Inner<T> {
fn default() -> Self {
+8 -1
View File
@@ -1,5 +1,12 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
pub enum Test {}
extern "C" {
pub fn Servo_Test(a: *mut Test);
}
-16
View File
@@ -1,16 +0,0 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub const FooDefault: u32 = 0;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub field: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Foo"][::std::mem::size_of::<Foo>() - 4usize];
["Alignment of Foo"][::std::mem::align_of::<Foo>() - 4usize];
["Offset of field: Foo::field"][::std::mem::offset_of!(Foo, field) - 0usize];
};
extern "C" {
pub fn FooNew(value: ::std::os::raw::c_int) -> Foo;
}
+7 -1
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
pub const NONE: u32 = 0;
pub const FOO: u32 = 5;
pub const FOOB: i32 = -2;
@@ -1 +1,6 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
@@ -1,22 +1,56 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct NoHash {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of NoHash"][::std::mem::size_of::<NoHash>() - 1usize];
["Alignment of NoHash"][::std::mem::align_of::<NoHash>() - 1usize];
};
#[test]
fn bindgen_test_layout_NoHash() {
assert_eq!(
::std::mem::size_of::<NoHash>(),
1usize,
concat!("Size of: ", stringify!(NoHash))
);
assert_eq!(
::std::mem::align_of::<NoHash>(),
1usize,
concat!("Alignment of ", stringify!(NoHash))
);
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct AllowlistMe {
pub a: NoHash,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of AllowlistMe"][::std::mem::size_of::<AllowlistMe>() - 1usize];
["Alignment of AllowlistMe"][::std::mem::align_of::<AllowlistMe>() - 1usize];
["Offset of field: AllowlistMe::a"][::std::mem::offset_of!(AllowlistMe, a) - 0usize];
};
#[test]
fn bindgen_test_layout_AllowlistMe() {
const UNINIT: ::std::mem::MaybeUninit<AllowlistMe> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<AllowlistMe>(),
1usize,
concat!("Size of: ", stringify!(AllowlistMe))
);
assert_eq!(
::std::mem::align_of::<AllowlistMe>(),
1usize,
concat!("Alignment of ", stringify!(AllowlistMe))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(AllowlistMe),
"::",
stringify!(a)
)
);
}
@@ -1,22 +1,56 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct NoPartialEq {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of NoPartialEq"][::std::mem::size_of::<NoPartialEq>() - 1usize];
["Alignment of NoPartialEq"][::std::mem::align_of::<NoPartialEq>() - 1usize];
};
#[test]
fn bindgen_test_layout_NoPartialEq() {
assert_eq!(
::std::mem::size_of::<NoPartialEq>(),
1usize,
concat!("Size of: ", stringify!(NoPartialEq))
);
assert_eq!(
::std::mem::align_of::<NoPartialEq>(),
1usize,
concat!("Alignment of ", stringify!(NoPartialEq))
);
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct AllowlistMe {
pub a: NoPartialEq,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of AllowlistMe"][::std::mem::size_of::<AllowlistMe>() - 1usize];
["Alignment of AllowlistMe"][::std::mem::align_of::<AllowlistMe>() - 1usize];
["Offset of field: AllowlistMe::a"][::std::mem::offset_of!(AllowlistMe, a) - 0usize];
};
#[test]
fn bindgen_test_layout_AllowlistMe() {
const UNINIT: ::std::mem::MaybeUninit<AllowlistMe> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<AllowlistMe>(),
1usize,
concat!("Size of: ", stringify!(AllowlistMe))
);
assert_eq!(
::std::mem::align_of::<AllowlistMe>(),
1usize,
concat!("Alignment of ", stringify!(AllowlistMe))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(AllowlistMe),
"::",
stringify!(a)
)
);
}
@@ -1,22 +1,56 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default)]
pub struct NoCopy {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of NoCopy"][::std::mem::size_of::<NoCopy>() - 1usize];
["Alignment of NoCopy"][::std::mem::align_of::<NoCopy>() - 1usize];
};
#[test]
fn bindgen_test_layout_NoCopy() {
assert_eq!(
::std::mem::size_of::<NoCopy>(),
1usize,
concat!("Size of: ", stringify!(NoCopy))
);
assert_eq!(
::std::mem::align_of::<NoCopy>(),
1usize,
concat!("Alignment of ", stringify!(NoCopy))
);
}
#[repr(C)]
#[derive(Debug, Default)]
pub struct AllowlistMe {
pub a: NoCopy,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of AllowlistMe"][::std::mem::size_of::<AllowlistMe>() - 1usize];
["Alignment of AllowlistMe"][::std::mem::align_of::<AllowlistMe>() - 1usize];
["Offset of field: AllowlistMe::a"][::std::mem::offset_of!(AllowlistMe, a) - 0usize];
};
#[test]
fn bindgen_test_layout_AllowlistMe() {
const UNINIT: ::std::mem::MaybeUninit<AllowlistMe> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<AllowlistMe>(),
1usize,
concat!("Size of: ", stringify!(AllowlistMe))
);
assert_eq!(
::std::mem::align_of::<AllowlistMe>(),
1usize,
concat!("Alignment of ", stringify!(AllowlistMe))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(AllowlistMe),
"::",
stringify!(a)
)
);
}
+46 -14
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
/// <div rustbindgen opaque></div>
#[repr(C)]
#[repr(align(4))]
@@ -6,21 +12,47 @@
pub struct D {
pub _bindgen_opaque_blob: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of D"][::std::mem::size_of::<D>() - 4usize];
["Alignment of D"][::std::mem::align_of::<D>() - 4usize];
};
#[test]
fn bindgen_test_layout_D() {
assert_eq!(
::std::mem::size_of::<D>(),
4usize,
concat!("Size of: ", stringify!(D))
);
assert_eq!(
::std::mem::align_of::<D>(),
4usize,
concat!("Alignment of ", stringify!(D))
);
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct NotAnnotated {
pub f: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of NotAnnotated"][::std::mem::size_of::<NotAnnotated>() - 4usize];
["Alignment of NotAnnotated"][::std::mem::align_of::<NotAnnotated>() - 4usize];
[
"Offset of field: NotAnnotated::f",
][::std::mem::offset_of!(NotAnnotated, f) - 0usize];
};
#[test]
fn bindgen_test_layout_NotAnnotated() {
const UNINIT: ::std::mem::MaybeUninit<NotAnnotated> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<NotAnnotated>(),
4usize,
concat!("Size of: ", stringify!(NotAnnotated))
);
assert_eq!(
::std::mem::align_of::<NotAnnotated>(),
4usize,
concat!("Alignment of ", stringify!(NotAnnotated))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).f) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(NotAnnotated),
"::",
stringify!(f)
)
);
}
+120 -43
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone)]
pub union color {
@@ -13,24 +19,52 @@ pub struct color__bindgen_ty_1 {
pub g: ::std::os::raw::c_uchar,
pub b: ::std::os::raw::c_uchar,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of color__bindgen_ty_1",
][::std::mem::size_of::<color__bindgen_ty_1>() - 3usize];
[
"Alignment of color__bindgen_ty_1",
][::std::mem::align_of::<color__bindgen_ty_1>() - 1usize];
[
"Offset of field: color__bindgen_ty_1::r",
][::std::mem::offset_of!(color__bindgen_ty_1, r) - 0usize];
[
"Offset of field: color__bindgen_ty_1::g",
][::std::mem::offset_of!(color__bindgen_ty_1, g) - 1usize];
[
"Offset of field: color__bindgen_ty_1::b",
][::std::mem::offset_of!(color__bindgen_ty_1, b) - 2usize];
};
#[test]
fn bindgen_test_layout_color__bindgen_ty_1() {
const UNINIT: ::std::mem::MaybeUninit<color__bindgen_ty_1> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<color__bindgen_ty_1>(),
3usize,
concat!("Size of: ", stringify!(color__bindgen_ty_1))
);
assert_eq!(
::std::mem::align_of::<color__bindgen_ty_1>(),
1usize,
concat!("Alignment of ", stringify!(color__bindgen_ty_1))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).r) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(color__bindgen_ty_1),
"::",
stringify!(r)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).g) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(color__bindgen_ty_1),
"::",
stringify!(g)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(color__bindgen_ty_1),
"::",
stringify!(b)
)
);
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct color__bindgen_ty_2 {
@@ -38,30 +72,73 @@ pub struct color__bindgen_ty_2 {
pub u: ::std::os::raw::c_uchar,
pub v: ::std::os::raw::c_uchar,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of color__bindgen_ty_2",
][::std::mem::size_of::<color__bindgen_ty_2>() - 3usize];
[
"Alignment of color__bindgen_ty_2",
][::std::mem::align_of::<color__bindgen_ty_2>() - 1usize];
[
"Offset of field: color__bindgen_ty_2::y",
][::std::mem::offset_of!(color__bindgen_ty_2, y) - 0usize];
[
"Offset of field: color__bindgen_ty_2::u",
][::std::mem::offset_of!(color__bindgen_ty_2, u) - 1usize];
[
"Offset of field: color__bindgen_ty_2::v",
][::std::mem::offset_of!(color__bindgen_ty_2, v) - 2usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of color"][::std::mem::size_of::<color>() - 3usize];
["Alignment of color"][::std::mem::align_of::<color>() - 1usize];
["Offset of field: color::v3"][::std::mem::offset_of!(color, v3) - 0usize];
};
#[test]
fn bindgen_test_layout_color__bindgen_ty_2() {
const UNINIT: ::std::mem::MaybeUninit<color__bindgen_ty_2> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<color__bindgen_ty_2>(),
3usize,
concat!("Size of: ", stringify!(color__bindgen_ty_2))
);
assert_eq!(
::std::mem::align_of::<color__bindgen_ty_2>(),
1usize,
concat!("Alignment of ", stringify!(color__bindgen_ty_2))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(color__bindgen_ty_2),
"::",
stringify!(y)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(color__bindgen_ty_2),
"::",
stringify!(u)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).v) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(color__bindgen_ty_2),
"::",
stringify!(v)
)
);
}
#[test]
fn bindgen_test_layout_color() {
const UNINIT: ::std::mem::MaybeUninit<color> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<color>(),
3usize,
concat!("Size of: ", stringify!(color))
);
assert_eq!(
::std::mem::align_of::<color>(),
1usize,
concat!("Alignment of ", stringify!(color))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).v3) as usize - ptr as usize },
0usize,
concat!("Offset of field: ", stringify!(color), "::", stringify!(v3))
);
}
impl Default for color {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
+33 -8
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, PartialEq)]
pub struct Test {
@@ -11,13 +17,32 @@ pub const Test_T_NONE: Test__bindgen_ty_1 = Test__bindgen_ty_1::T_NONE;
pub enum Test__bindgen_ty_1 {
T_NONE = 0,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Test"][::std::mem::size_of::<Test>() - 8usize];
["Alignment of Test"][::std::mem::align_of::<Test>() - 4usize];
["Offset of field: Test::foo"][::std::mem::offset_of!(Test, foo) - 0usize];
["Offset of field: Test::bar"][::std::mem::offset_of!(Test, bar) - 4usize];
};
#[test]
fn bindgen_test_layout_Test() {
const UNINIT: ::std::mem::MaybeUninit<Test> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<Test>(),
8usize,
concat!("Size of: ", stringify!(Test))
);
assert_eq!(
::std::mem::align_of::<Test>(),
4usize,
concat!("Alignment of ", stringify!(Test))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize },
0usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(foo))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize },
4usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(bar))
);
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum Baz {
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
pub const NODE_FLAG_FOO: _bindgen_ty_1 = _bindgen_ty_1::NODE_FLAG_FOO;
pub const NODE_FLAG_BAR: _bindgen_ty_1 = _bindgen_ty_1::NODE_FLAG_BAR;
#[repr(u32)]
@@ -1,4 +0,0 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub const NODE_FLAG_FOO: _bindgen_ty_1 = 0;
pub const NODE_FLAG_BAR: _bindgen_ty_1 = 1;
pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
@@ -1,4 +0,0 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub const FLAG_Z: _bindgen_ty_2 = 0;
pub const FLAG_W: _bindgen_ty_2 = 1;
pub type _bindgen_ty_2 = ::std::os::raw::c_uint;
+30 -11
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct DataType {
@@ -8,11 +14,16 @@ pub type DataType_value_type<_Tp> = _Tp;
pub type DataType_work_type<_Tp> = DataType_value_type<_Tp>;
pub type DataType_channel_type<_Tp> = DataType_value_type<_Tp>;
pub type DataType_vec_type<_Tp> = DataType_value_type<_Tp>;
pub const DataType_generic_type: DataType__bindgen_ty_1 = DataType__bindgen_ty_1::generic_type;
pub const DataType_depth: DataType__bindgen_ty_1 = DataType__bindgen_ty_1::generic_type;
pub const DataType_channels: DataType__bindgen_ty_1 = DataType__bindgen_ty_1::generic_type;
pub const DataType_fmt: DataType__bindgen_ty_1 = DataType__bindgen_ty_1::generic_type;
pub const DataType_type_: DataType__bindgen_ty_1 = DataType__bindgen_ty_1::generic_type;
pub const DataType_generic_type: DataType__bindgen_ty_1 =
DataType__bindgen_ty_1::generic_type;
pub const DataType_depth: DataType__bindgen_ty_1 =
DataType__bindgen_ty_1::generic_type;
pub const DataType_channels: DataType__bindgen_ty_1 =
DataType__bindgen_ty_1::generic_type;
pub const DataType_fmt: DataType__bindgen_ty_1 =
DataType__bindgen_ty_1::generic_type;
pub const DataType_type_: DataType__bindgen_ty_1 =
DataType__bindgen_ty_1::generic_type;
#[repr(i32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum DataType__bindgen_ty_1 {
@@ -30,8 +41,16 @@ pub const Foo_Baz: Foo__bindgen_ty_1 = Foo__bindgen_ty_1::Bar;
pub enum Foo__bindgen_ty_1 {
Bar = 0,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Foo"][::std::mem::size_of::<Foo>() - 1usize];
["Alignment of Foo"][::std::mem::align_of::<Foo>() - 1usize];
};
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(
::std::mem::size_of::<Foo>(),
1usize,
concat!("Size of: ", stringify!(Foo))
);
assert_eq!(
::std::mem::align_of::<Foo>(),
1usize,
concat!("Alignment of ", stringify!(Foo))
);
}
+80 -27
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct s {
@@ -14,26 +20,58 @@ pub union s__bindgen_ty_1 {
pub struct s__bindgen_ty_1_inner {
pub b: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of s__bindgen_ty_1_inner",
][::std::mem::size_of::<s__bindgen_ty_1_inner>() - 4usize];
[
"Alignment of s__bindgen_ty_1_inner",
][::std::mem::align_of::<s__bindgen_ty_1_inner>() - 4usize];
[
"Offset of field: s__bindgen_ty_1_inner::b",
][::std::mem::offset_of!(s__bindgen_ty_1_inner, b) - 0usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of s__bindgen_ty_1"][::std::mem::size_of::<s__bindgen_ty_1>() - 4usize];
["Alignment of s__bindgen_ty_1"][::std::mem::align_of::<s__bindgen_ty_1>() - 4usize];
[
"Offset of field: s__bindgen_ty_1::field",
][::std::mem::offset_of!(s__bindgen_ty_1, field) - 0usize];
};
#[test]
fn bindgen_test_layout_s__bindgen_ty_1_inner() {
const UNINIT: ::std::mem::MaybeUninit<s__bindgen_ty_1_inner> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<s__bindgen_ty_1_inner>(),
4usize,
concat!("Size of: ", stringify!(s__bindgen_ty_1_inner))
);
assert_eq!(
::std::mem::align_of::<s__bindgen_ty_1_inner>(),
4usize,
concat!("Alignment of ", stringify!(s__bindgen_ty_1_inner))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(s__bindgen_ty_1_inner),
"::",
stringify!(b)
)
);
}
#[test]
fn bindgen_test_layout_s__bindgen_ty_1() {
const UNINIT: ::std::mem::MaybeUninit<s__bindgen_ty_1> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<s__bindgen_ty_1>(),
4usize,
concat!("Size of: ", stringify!(s__bindgen_ty_1))
);
assert_eq!(
::std::mem::align_of::<s__bindgen_ty_1>(),
4usize,
concat!("Alignment of ", stringify!(s__bindgen_ty_1))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).field) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(s__bindgen_ty_1),
"::",
stringify!(field)
)
);
}
impl Default for s__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -43,12 +81,27 @@ impl Default for s__bindgen_ty_1 {
}
}
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of s"][::std::mem::size_of::<s>() - 4usize];
["Alignment of s"][::std::mem::align_of::<s>() - 4usize];
["Offset of field: s::u"][::std::mem::offset_of!(s, u) - 0usize];
};
#[test]
fn bindgen_test_layout_s() {
const UNINIT: ::std::mem::MaybeUninit<s> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<s>(),
4usize,
concat!("Size of: ", stringify!(s))
);
assert_eq!(
::std::mem::align_of::<s>(),
4usize,
concat!("Alignment of ", stringify!(s))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize },
0usize,
concat!("Offset of field: ", stringify!(s), "::", stringify!(u))
);
}
impl Default for s {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl<T> __BindgenUnionField<T> {
@@ -24,7 +30,7 @@ impl<T> ::std::default::Default for __BindgenUnionField<T> {
impl<T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self {
*self
Self::new()
}
}
impl<T> ::std::marker::Copy for __BindgenUnionField<T> {}
@@ -60,22 +66,28 @@ pub struct s__bindgen_ty_1_inner {
}
#[test]
fn bindgen_test_layout_s__bindgen_ty_1_inner() {
const UNINIT: ::std::mem::MaybeUninit<s__bindgen_ty_1_inner> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<s__bindgen_ty_1_inner> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<s__bindgen_ty_1_inner>(),
4usize,
"Size of s__bindgen_ty_1_inner",
concat!("Size of: ", stringify!(s__bindgen_ty_1_inner))
);
assert_eq!(
::std::mem::align_of::<s__bindgen_ty_1_inner>(),
4usize,
"Alignment of s__bindgen_ty_1_inner",
concat!("Alignment of ", stringify!(s__bindgen_ty_1_inner))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize },
0usize,
"Offset of field: s__bindgen_ty_1_inner::b",
concat!(
"Offset of field: ",
stringify!(s__bindgen_ty_1_inner),
"::",
stringify!(b)
)
);
}
impl Clone for s__bindgen_ty_1_inner {
@@ -85,22 +97,28 @@ impl Clone for s__bindgen_ty_1_inner {
}
#[test]
fn bindgen_test_layout_s__bindgen_ty_1() {
const UNINIT: ::std::mem::MaybeUninit<s__bindgen_ty_1> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<s__bindgen_ty_1> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<s__bindgen_ty_1>(),
4usize,
"Size of s__bindgen_ty_1",
concat!("Size of: ", stringify!(s__bindgen_ty_1))
);
assert_eq!(
::std::mem::align_of::<s__bindgen_ty_1>(),
4usize,
"Alignment of s__bindgen_ty_1",
concat!("Alignment of ", stringify!(s__bindgen_ty_1))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).field) as usize - ptr as usize },
0usize,
"Offset of field: s__bindgen_ty_1::field",
concat!(
"Offset of field: ",
stringify!(s__bindgen_ty_1),
"::",
stringify!(field)
)
);
}
impl Clone for s__bindgen_ty_1 {
@@ -110,14 +128,23 @@ impl Clone for s__bindgen_ty_1 {
}
#[test]
fn bindgen_test_layout_s() {
const UNINIT: ::std::mem::MaybeUninit<s> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<s> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(::std::mem::size_of::<s>(), 4usize, "Size of s");
assert_eq!(::std::mem::align_of::<s>(), 4usize, "Alignment of s");
assert_eq!(
::std::mem::size_of::<s>(),
4usize,
concat!("Size of: ", stringify!(s))
);
assert_eq!(
::std::mem::align_of::<s>(),
4usize,
concat!("Alignment of ", stringify!(s))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize },
0usize,
"Offset of field: s::u",
concat!("Offset of field: ", stringify!(s), "::", stringify!(u))
);
}
impl Clone for s {
+41 -16
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
pub struct TErrorResult {
pub mResult: ::std::os::raw::c_int,
@@ -7,7 +13,8 @@ pub struct TErrorResult {
pub mUnionState: TErrorResult_UnionState,
}
impl TErrorResult_UnionState {
pub const HasException: TErrorResult_UnionState = TErrorResult_UnionState::HasMessage;
pub const HasException: TErrorResult_UnionState =
TErrorResult_UnionState::HasMessage;
}
#[repr(i32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -51,11 +58,19 @@ impl Default for TErrorResult {
pub struct ErrorResult {
pub _base: TErrorResult,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of ErrorResult"][::std::mem::size_of::<ErrorResult>() - 24usize];
["Alignment of ErrorResult"][::std::mem::align_of::<ErrorResult>() - 8usize];
};
#[test]
fn bindgen_test_layout_ErrorResult() {
assert_eq!(
::std::mem::size_of::<ErrorResult>(),
24usize,
concat!("Size of: ", stringify!(ErrorResult))
);
assert_eq!(
::std::mem::align_of::<ErrorResult>(),
8usize,
concat!("Alignment of ", stringify!(ErrorResult))
);
}
impl Default for ErrorResult {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -65,12 +80,22 @@ impl Default for ErrorResult {
}
}
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of template specialization: TErrorResult_open0_int_close0",
][::std::mem::size_of::<TErrorResult>() - 24usize];
[
"Align of template specialization: TErrorResult_open0_int_close0",
][::std::mem::align_of::<TErrorResult>() - 8usize];
};
#[test]
fn __bindgen_test_layout_TErrorResult_open0_int_close0_instantiation() {
assert_eq!(
::std::mem::size_of::<TErrorResult>(),
24usize,
concat!(
"Size of template specialization: ",
stringify!(TErrorResult)
)
);
assert_eq!(
::std::mem::align_of::<TErrorResult>(),
8usize,
concat!(
"Alignment of template specialization: ",
stringify!(TErrorResult)
)
);
}
+26 -8
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl<T> __BindgenUnionField<T> {
@@ -24,7 +30,7 @@ impl<T> ::std::default::Default for __BindgenUnionField<T> {
impl<T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self {
*self
Self::new()
}
}
impl<T> ::std::marker::Copy for __BindgenUnionField<T> {}
@@ -50,7 +56,8 @@ pub struct TErrorResult {
pub mMightHaveUnreported: bool,
pub mUnionState: TErrorResult_UnionState,
}
pub const TErrorResult_UnionState_HasException: TErrorResult_UnionState = TErrorResult_UnionState::HasMessage;
pub const TErrorResult_UnionState_HasException: TErrorResult_UnionState =
TErrorResult_UnionState::HasMessage;
#[repr(i32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum TErrorResult_UnionState {
@@ -70,7 +77,8 @@ pub struct TErrorResult_DOMExceptionInfo {
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct TErrorResult__bindgen_ty_1 {
pub mMessage: __BindgenUnionField<*mut TErrorResult_Message>,
pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo>,
pub mDOMExceptionInfo:
__BindgenUnionField<*mut TErrorResult_DOMExceptionInfo>,
pub bindgen_union_field: u64,
}
impl Default for TErrorResult {
@@ -89,11 +97,15 @@ pub struct ErrorResult {
}
#[test]
fn bindgen_test_layout_ErrorResult() {
assert_eq!(::std::mem::size_of::<ErrorResult>(), 24usize, "Size of ErrorResult");
assert_eq!(
::std::mem::size_of::<ErrorResult>(),
24usize,
concat!("Size of: ", stringify!(ErrorResult))
);
assert_eq!(
::std::mem::align_of::<ErrorResult>(),
8usize,
"Alignment of ErrorResult",
concat!("Alignment of ", stringify!(ErrorResult))
);
}
impl Clone for ErrorResult {
@@ -115,11 +127,17 @@ fn __bindgen_test_layout_TErrorResult_open0_int_close0_instantiation() {
assert_eq!(
::std::mem::size_of::<TErrorResult>(),
24usize,
"Size of template specialization: TErrorResult_open0_int_close0",
concat!(
"Size of template specialization: ",
stringify!(TErrorResult)
)
);
assert_eq!(
::std::mem::align_of::<TErrorResult>(),
8usize,
"Align of template specialization: TErrorResult_open0_int_close0",
concat!(
"Alignment of template specialization: ",
stringify!(TErrorResult)
)
);
}
@@ -1,9 +1,15 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Foo<T> {
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
pub t_member: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
}
impl<T> Default for Foo<T> {
fn default() -> Self {
@@ -22,8 +28,8 @@ pub struct Bar {
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Quux<V> {
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>,
pub v_member: V,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>,
}
impl<V> Default for Quux<V> {
fn default() -> Self {
+7 -1
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
extern "C" {
#[link_name = "\u{1}_Z3fooPKc"]
pub fn foo(type_: *const ::std::os::raw::c_char);
@@ -1,27 +1,59 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
/// This should get an `_address` byte.
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Empty {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Empty"][::std::mem::size_of::<Empty>() - 1usize];
["Alignment of Empty"][::std::mem::align_of::<Empty>() - 1usize];
};
/** This should not get an `_address` byte, since each `Empty` gets one, meaning
that this object is addressable.*/
#[test]
fn bindgen_test_layout_Empty() {
assert_eq!(
::std::mem::size_of::<Empty>(),
1usize,
concat!("Size of: ", stringify!(Empty))
);
assert_eq!(
::std::mem::align_of::<Empty>(),
1usize,
concat!("Alignment of ", stringify!(Empty))
);
}
/// This should not get an `_address` byte, since each `Empty` gets one, meaning
/// that this object is addressable.
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct HasArrayOfEmpty {
pub empties: [Empty; 10usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of HasArrayOfEmpty"][::std::mem::size_of::<HasArrayOfEmpty>() - 10usize];
["Alignment of HasArrayOfEmpty"][::std::mem::align_of::<HasArrayOfEmpty>() - 1usize];
[
"Offset of field: HasArrayOfEmpty::empties",
][::std::mem::offset_of!(HasArrayOfEmpty, empties) - 0usize];
};
#[test]
fn bindgen_test_layout_HasArrayOfEmpty() {
const UNINIT: ::std::mem::MaybeUninit<HasArrayOfEmpty> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<HasArrayOfEmpty>(),
10usize,
concat!("Size of: ", stringify!(HasArrayOfEmpty))
);
assert_eq!(
::std::mem::align_of::<HasArrayOfEmpty>(),
1usize,
concat!("Alignment of ", stringify!(HasArrayOfEmpty))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).empties) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(HasArrayOfEmpty),
"::",
stringify!(empties)
)
);
}
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
@@ -6,18 +12,32 @@ pub struct Foo {
}
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(::std::mem::size_of::<Foo>(), 1usize, "Size of Foo");
assert_eq!(::std::mem::align_of::<Foo>(), 1usize, "Alignment of Foo");
assert_eq!(
::std::mem::size_of::<Foo>(),
1usize,
concat!("Size of: ", stringify!(Foo))
);
assert_eq!(
::std::mem::align_of::<Foo>(),
1usize,
concat!("Alignment of ", stringify!(Foo))
);
}
extern "C" {
#[must_use]
#[link_name = "\u{1}_ZN3Foo3fooEi"]
pub fn Foo_foo(this: *mut Foo, arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
pub fn Foo_foo(
this: *mut Foo,
arg1: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
impl Foo {
#[inline]
#[must_use]
pub unsafe fn foo(&mut self, arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int {
pub unsafe fn foo(
&mut self,
arg1: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int {
Foo_foo(self, arg1)
}
}
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
@@ -6,16 +12,30 @@ pub struct Foo {
}
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(::std::mem::size_of::<Foo>(), 1usize, "Size of Foo");
assert_eq!(::std::mem::align_of::<Foo>(), 1usize, "Alignment of Foo");
assert_eq!(
::std::mem::size_of::<Foo>(),
1usize,
concat!("Size of: ", stringify!(Foo))
);
assert_eq!(
::std::mem::align_of::<Foo>(),
1usize,
concat!("Alignment of ", stringify!(Foo))
);
}
extern "C" {
#[link_name = "\u{1}_ZN3Foo3fooEi"]
pub fn Foo_foo(this: *mut Foo, arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
pub fn Foo_foo(
this: *mut Foo,
arg1: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
impl Foo {
#[inline]
pub unsafe fn foo(&mut self, arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int {
pub unsafe fn foo(
&mut self,
arg1: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int {
Foo_foo(self, arg1)
}
}
@@ -1,21 +1,41 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Foo"][::std::mem::size_of::<Foo>() - 1usize];
["Alignment of Foo"][::std::mem::align_of::<Foo>() - 1usize];
};
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(
::std::mem::size_of::<Foo>(),
1usize,
concat!("Size of: ", stringify!(Foo))
);
assert_eq!(
::std::mem::align_of::<Foo>(),
1usize,
concat!("Alignment of ", stringify!(Foo))
);
}
extern "C" {
#[link_name = "\u{1}_ZN3Foo3fooEi"]
pub fn Foo_foo(this: *mut Foo, arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
pub fn Foo_foo(
this: *mut Foo,
arg1: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
impl Foo {
#[inline]
pub unsafe fn foo(&mut self, arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int {
pub unsafe fn foo(
&mut self,
arg1: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int {
Foo_foo(self, arg1)
}
}
-21
View File
@@ -1,21 +0,0 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
pub const Foo_kFoo: bool = true;
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Foo"][::std::mem::size_of::<Foo>() - 1usize];
["Alignment of Foo"][::std::mem::align_of::<Foo>() - 1usize];
};
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
pub _address: u8,
}
extern "C" {
#[link_name = "\u{1}_Z5Test2v"]
pub fn Test2() -> ::std::os::raw::c_uint;
}
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct std_char_traits {
+20 -6
View File
@@ -1,11 +1,25 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct false_type {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of false_type"][::std::mem::size_of::<false_type>() - 1usize];
["Alignment of false_type"][::std::mem::align_of::<false_type>() - 1usize];
};
#[test]
fn bindgen_test_layout_false_type() {
assert_eq!(
::std::mem::size_of::<false_type>(),
1usize,
concat!("Size of: ", stringify!(false_type))
);
assert_eq!(
::std::mem::align_of::<false_type>(),
1usize,
concat!("Alignment of ", stringify!(false_type))
);
}
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub mod root {
#[repr(C)]
@@ -26,12 +32,15 @@ pub mod root {
impl<T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self {
*self
Self::new()
}
}
impl<T> ::std::marker::Copy for __BindgenUnionField<T> {}
impl<T> ::std::fmt::Debug for __BindgenUnionField<T> {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
fn fmt(
&self,
fmt: &mut ::std::fmt::Formatter<'_>,
) -> ::std::fmt::Result {
fmt.write_str("__BindgenUnionField")
}
}
@@ -58,19 +67,42 @@ pub mod root {
}
#[test]
fn bindgen_test_layout_Bar() {
const UNINIT: ::std::mem::MaybeUninit<Bar> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<Bar> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(::std::mem::size_of::<Bar>(), 4usize, "Size of Bar");
assert_eq!(::std::mem::align_of::<Bar>(), 4usize, "Alignment of Bar");
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize },
0usize,
"Offset of field: Bar::foo",
::std::mem::size_of::<Bar>(),
4usize,
concat!("Size of: ", stringify!(Bar))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize },
::std::mem::align_of::<Bar>(),
4usize,
concat!("Alignment of ", stringify!(Bar))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize
},
0usize,
"Offset of field: Bar::bar",
concat!(
"Offset of field: ",
stringify!(Bar),
"::",
stringify!(foo)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).bar) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(Bar),
"::",
stringify!(bar)
)
);
}
impl Clone for Bar {
+258 -340
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage> {
@@ -49,7 +55,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
let mut val = 0;
for i in 0..(bit_width as usize) {
@@ -69,7 +76,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
for i in 0..(bit_width as usize) {
let mask = 1 << i;
@@ -83,21 +91,31 @@ where
}
}
}
#[repr(C)]
#[repr(C, packed)]
#[derive(Debug, Default, Copy, Clone)]
pub struct MuchBitfield {
pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 5usize]>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of MuchBitfield"][::std::mem::size_of::<MuchBitfield>() - 5usize];
["Alignment of MuchBitfield"][::std::mem::align_of::<MuchBitfield>() - 1usize];
};
#[test]
fn bindgen_test_layout_MuchBitfield() {
assert_eq!(
::std::mem::size_of::<MuchBitfield>(),
5usize,
concat!("Size of: ", stringify!(MuchBitfield))
);
assert_eq!(
::std::mem::align_of::<MuchBitfield>(),
1usize,
concat!("Alignment of ", stringify!(MuchBitfield))
);
}
impl MuchBitfield {
#[inline]
pub fn m0(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m0(&mut self, val: ::std::os::raw::c_char) {
@@ -108,7 +126,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m1(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m1(&mut self, val: ::std::os::raw::c_char) {
@@ -119,7 +139,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m2(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m2(&mut self, val: ::std::os::raw::c_char) {
@@ -130,7 +152,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m3(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m3(&mut self, val: ::std::os::raw::c_char) {
@@ -141,7 +165,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m4(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m4(&mut self, val: ::std::os::raw::c_char) {
@@ -152,7 +178,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m5(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m5(&mut self, val: ::std::os::raw::c_char) {
@@ -163,7 +191,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m6(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m6(&mut self, val: ::std::os::raw::c_char) {
@@ -174,7 +204,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m7(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m7(&mut self, val: ::std::os::raw::c_char) {
@@ -185,7 +217,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m8(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m8(&mut self, val: ::std::os::raw::c_char) {
@@ -196,7 +230,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m9(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m9(&mut self, val: ::std::os::raw::c_char) {
@@ -207,7 +243,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m10(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m10(&mut self, val: ::std::os::raw::c_char) {
@@ -218,7 +256,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m11(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(11usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(11usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m11(&mut self, val: ::std::os::raw::c_char) {
@@ -229,7 +269,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m12(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(12usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m12(&mut self, val: ::std::os::raw::c_char) {
@@ -240,7 +282,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m13(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(13usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(13usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m13(&mut self, val: ::std::os::raw::c_char) {
@@ -251,7 +295,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m14(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m14(&mut self, val: ::std::os::raw::c_char) {
@@ -262,7 +308,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m15(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(15usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(15usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m15(&mut self, val: ::std::os::raw::c_char) {
@@ -273,7 +321,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m16(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m16(&mut self, val: ::std::os::raw::c_char) {
@@ -284,7 +334,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m17(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(17usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(17usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m17(&mut self, val: ::std::os::raw::c_char) {
@@ -295,7 +347,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m18(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(18usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(18usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m18(&mut self, val: ::std::os::raw::c_char) {
@@ -306,7 +360,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m19(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(19usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(19usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m19(&mut self, val: ::std::os::raw::c_char) {
@@ -317,7 +373,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m20(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(20usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(20usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m20(&mut self, val: ::std::os::raw::c_char) {
@@ -328,7 +386,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m21(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(21usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(21usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m21(&mut self, val: ::std::os::raw::c_char) {
@@ -339,7 +399,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m22(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(22usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(22usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m22(&mut self, val: ::std::os::raw::c_char) {
@@ -350,7 +412,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m23(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(23usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(23usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m23(&mut self, val: ::std::os::raw::c_char) {
@@ -361,7 +425,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m24(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(24usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m24(&mut self, val: ::std::os::raw::c_char) {
@@ -372,7 +438,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m25(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(25usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(25usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m25(&mut self, val: ::std::os::raw::c_char) {
@@ -383,7 +451,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m26(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(26usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(26usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m26(&mut self, val: ::std::os::raw::c_char) {
@@ -394,7 +464,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m27(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(27usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(27usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m27(&mut self, val: ::std::os::raw::c_char) {
@@ -405,7 +477,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m28(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(28usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(28usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m28(&mut self, val: ::std::os::raw::c_char) {
@@ -416,7 +490,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m29(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(29usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(29usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m29(&mut self, val: ::std::os::raw::c_char) {
@@ -427,7 +503,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m30(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(30usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(30usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m30(&mut self, val: ::std::os::raw::c_char) {
@@ -438,7 +516,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m31(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m31(&mut self, val: ::std::os::raw::c_char) {
@@ -449,7 +529,9 @@ impl MuchBitfield {
}
#[inline]
pub fn m32(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(32usize, 1u8) as u8)
}
}
#[inline]
pub fn set_m32(&mut self, val: ::std::os::raw::c_char) {
@@ -494,304 +576,140 @@ impl MuchBitfield {
m31: ::std::os::raw::c_char,
m32: ::std::os::raw::c_char,
) -> __BindgenBitfieldUnit<[u8; 5usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 5usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
1u8,
{
let m0: u8 = unsafe { ::std::mem::transmute(m0) };
m0 as u64
},
);
__bindgen_bitfield_unit
.set(
1usize,
1u8,
{
let m1: u8 = unsafe { ::std::mem::transmute(m1) };
m1 as u64
},
);
__bindgen_bitfield_unit
.set(
2usize,
1u8,
{
let m2: u8 = unsafe { ::std::mem::transmute(m2) };
m2 as u64
},
);
__bindgen_bitfield_unit
.set(
3usize,
1u8,
{
let m3: u8 = unsafe { ::std::mem::transmute(m3) };
m3 as u64
},
);
__bindgen_bitfield_unit
.set(
4usize,
1u8,
{
let m4: u8 = unsafe { ::std::mem::transmute(m4) };
m4 as u64
},
);
__bindgen_bitfield_unit
.set(
5usize,
1u8,
{
let m5: u8 = unsafe { ::std::mem::transmute(m5) };
m5 as u64
},
);
__bindgen_bitfield_unit
.set(
6usize,
1u8,
{
let m6: u8 = unsafe { ::std::mem::transmute(m6) };
m6 as u64
},
);
__bindgen_bitfield_unit
.set(
7usize,
1u8,
{
let m7: u8 = unsafe { ::std::mem::transmute(m7) };
m7 as u64
},
);
__bindgen_bitfield_unit
.set(
8usize,
1u8,
{
let m8: u8 = unsafe { ::std::mem::transmute(m8) };
m8 as u64
},
);
__bindgen_bitfield_unit
.set(
9usize,
1u8,
{
let m9: u8 = unsafe { ::std::mem::transmute(m9) };
m9 as u64
},
);
__bindgen_bitfield_unit
.set(
10usize,
1u8,
{
let m10: u8 = unsafe { ::std::mem::transmute(m10) };
m10 as u64
},
);
__bindgen_bitfield_unit
.set(
11usize,
1u8,
{
let m11: u8 = unsafe { ::std::mem::transmute(m11) };
m11 as u64
},
);
__bindgen_bitfield_unit
.set(
12usize,
1u8,
{
let m12: u8 = unsafe { ::std::mem::transmute(m12) };
m12 as u64
},
);
__bindgen_bitfield_unit
.set(
13usize,
1u8,
{
let m13: u8 = unsafe { ::std::mem::transmute(m13) };
m13 as u64
},
);
__bindgen_bitfield_unit
.set(
14usize,
1u8,
{
let m14: u8 = unsafe { ::std::mem::transmute(m14) };
m14 as u64
},
);
__bindgen_bitfield_unit
.set(
15usize,
1u8,
{
let m15: u8 = unsafe { ::std::mem::transmute(m15) };
m15 as u64
},
);
__bindgen_bitfield_unit
.set(
16usize,
1u8,
{
let m16: u8 = unsafe { ::std::mem::transmute(m16) };
m16 as u64
},
);
__bindgen_bitfield_unit
.set(
17usize,
1u8,
{
let m17: u8 = unsafe { ::std::mem::transmute(m17) };
m17 as u64
},
);
__bindgen_bitfield_unit
.set(
18usize,
1u8,
{
let m18: u8 = unsafe { ::std::mem::transmute(m18) };
m18 as u64
},
);
__bindgen_bitfield_unit
.set(
19usize,
1u8,
{
let m19: u8 = unsafe { ::std::mem::transmute(m19) };
m19 as u64
},
);
__bindgen_bitfield_unit
.set(
20usize,
1u8,
{
let m20: u8 = unsafe { ::std::mem::transmute(m20) };
m20 as u64
},
);
__bindgen_bitfield_unit
.set(
21usize,
1u8,
{
let m21: u8 = unsafe { ::std::mem::transmute(m21) };
m21 as u64
},
);
__bindgen_bitfield_unit
.set(
22usize,
1u8,
{
let m22: u8 = unsafe { ::std::mem::transmute(m22) };
m22 as u64
},
);
__bindgen_bitfield_unit
.set(
23usize,
1u8,
{
let m23: u8 = unsafe { ::std::mem::transmute(m23) };
m23 as u64
},
);
__bindgen_bitfield_unit
.set(
24usize,
1u8,
{
let m24: u8 = unsafe { ::std::mem::transmute(m24) };
m24 as u64
},
);
__bindgen_bitfield_unit
.set(
25usize,
1u8,
{
let m25: u8 = unsafe { ::std::mem::transmute(m25) };
m25 as u64
},
);
__bindgen_bitfield_unit
.set(
26usize,
1u8,
{
let m26: u8 = unsafe { ::std::mem::transmute(m26) };
m26 as u64
},
);
__bindgen_bitfield_unit
.set(
27usize,
1u8,
{
let m27: u8 = unsafe { ::std::mem::transmute(m27) };
m27 as u64
},
);
__bindgen_bitfield_unit
.set(
28usize,
1u8,
{
let m28: u8 = unsafe { ::std::mem::transmute(m28) };
m28 as u64
},
);
__bindgen_bitfield_unit
.set(
29usize,
1u8,
{
let m29: u8 = unsafe { ::std::mem::transmute(m29) };
m29 as u64
},
);
__bindgen_bitfield_unit
.set(
30usize,
1u8,
{
let m30: u8 = unsafe { ::std::mem::transmute(m30) };
m30 as u64
},
);
__bindgen_bitfield_unit
.set(
31usize,
1u8,
{
let m31: u8 = unsafe { ::std::mem::transmute(m31) };
m31 as u64
},
);
__bindgen_bitfield_unit
.set(
32usize,
1u8,
{
let m32: u8 = unsafe { ::std::mem::transmute(m32) };
m32 as u64
},
);
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 5usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 1u8, {
let m0: u8 = unsafe { ::std::mem::transmute(m0) };
m0 as u64
});
__bindgen_bitfield_unit.set(1usize, 1u8, {
let m1: u8 = unsafe { ::std::mem::transmute(m1) };
m1 as u64
});
__bindgen_bitfield_unit.set(2usize, 1u8, {
let m2: u8 = unsafe { ::std::mem::transmute(m2) };
m2 as u64
});
__bindgen_bitfield_unit.set(3usize, 1u8, {
let m3: u8 = unsafe { ::std::mem::transmute(m3) };
m3 as u64
});
__bindgen_bitfield_unit.set(4usize, 1u8, {
let m4: u8 = unsafe { ::std::mem::transmute(m4) };
m4 as u64
});
__bindgen_bitfield_unit.set(5usize, 1u8, {
let m5: u8 = unsafe { ::std::mem::transmute(m5) };
m5 as u64
});
__bindgen_bitfield_unit.set(6usize, 1u8, {
let m6: u8 = unsafe { ::std::mem::transmute(m6) };
m6 as u64
});
__bindgen_bitfield_unit.set(7usize, 1u8, {
let m7: u8 = unsafe { ::std::mem::transmute(m7) };
m7 as u64
});
__bindgen_bitfield_unit.set(8usize, 1u8, {
let m8: u8 = unsafe { ::std::mem::transmute(m8) };
m8 as u64
});
__bindgen_bitfield_unit.set(9usize, 1u8, {
let m9: u8 = unsafe { ::std::mem::transmute(m9) };
m9 as u64
});
__bindgen_bitfield_unit.set(10usize, 1u8, {
let m10: u8 = unsafe { ::std::mem::transmute(m10) };
m10 as u64
});
__bindgen_bitfield_unit.set(11usize, 1u8, {
let m11: u8 = unsafe { ::std::mem::transmute(m11) };
m11 as u64
});
__bindgen_bitfield_unit.set(12usize, 1u8, {
let m12: u8 = unsafe { ::std::mem::transmute(m12) };
m12 as u64
});
__bindgen_bitfield_unit.set(13usize, 1u8, {
let m13: u8 = unsafe { ::std::mem::transmute(m13) };
m13 as u64
});
__bindgen_bitfield_unit.set(14usize, 1u8, {
let m14: u8 = unsafe { ::std::mem::transmute(m14) };
m14 as u64
});
__bindgen_bitfield_unit.set(15usize, 1u8, {
let m15: u8 = unsafe { ::std::mem::transmute(m15) };
m15 as u64
});
__bindgen_bitfield_unit.set(16usize, 1u8, {
let m16: u8 = unsafe { ::std::mem::transmute(m16) };
m16 as u64
});
__bindgen_bitfield_unit.set(17usize, 1u8, {
let m17: u8 = unsafe { ::std::mem::transmute(m17) };
m17 as u64
});
__bindgen_bitfield_unit.set(18usize, 1u8, {
let m18: u8 = unsafe { ::std::mem::transmute(m18) };
m18 as u64
});
__bindgen_bitfield_unit.set(19usize, 1u8, {
let m19: u8 = unsafe { ::std::mem::transmute(m19) };
m19 as u64
});
__bindgen_bitfield_unit.set(20usize, 1u8, {
let m20: u8 = unsafe { ::std::mem::transmute(m20) };
m20 as u64
});
__bindgen_bitfield_unit.set(21usize, 1u8, {
let m21: u8 = unsafe { ::std::mem::transmute(m21) };
m21 as u64
});
__bindgen_bitfield_unit.set(22usize, 1u8, {
let m22: u8 = unsafe { ::std::mem::transmute(m22) };
m22 as u64
});
__bindgen_bitfield_unit.set(23usize, 1u8, {
let m23: u8 = unsafe { ::std::mem::transmute(m23) };
m23 as u64
});
__bindgen_bitfield_unit.set(24usize, 1u8, {
let m24: u8 = unsafe { ::std::mem::transmute(m24) };
m24 as u64
});
__bindgen_bitfield_unit.set(25usize, 1u8, {
let m25: u8 = unsafe { ::std::mem::transmute(m25) };
m25 as u64
});
__bindgen_bitfield_unit.set(26usize, 1u8, {
let m26: u8 = unsafe { ::std::mem::transmute(m26) };
m26 as u64
});
__bindgen_bitfield_unit.set(27usize, 1u8, {
let m27: u8 = unsafe { ::std::mem::transmute(m27) };
m27 as u64
});
__bindgen_bitfield_unit.set(28usize, 1u8, {
let m28: u8 = unsafe { ::std::mem::transmute(m28) };
m28 as u64
});
__bindgen_bitfield_unit.set(29usize, 1u8, {
let m29: u8 = unsafe { ::std::mem::transmute(m29) };
m29 as u64
});
__bindgen_bitfield_unit.set(30usize, 1u8, {
let m30: u8 = unsafe { ::std::mem::transmute(m30) };
m30 as u64
});
__bindgen_bitfield_unit.set(31usize, 1u8, {
let m31: u8 = unsafe { ::std::mem::transmute(m31) };
m31 as u64
});
__bindgen_bitfield_unit.set(32usize, 1u8, {
let m32: u8 = unsafe { ::std::mem::transmute(m32) };
m32 as u64
});
__bindgen_bitfield_unit
}
}
+20 -6
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
impl Foo {
pub const Bar: Foo = Foo(2);
}
@@ -148,8 +154,16 @@ impl ::std::ops::BitAndAssign for Dummy__bindgen_ty_1 {
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Dummy__bindgen_ty_1(pub ::std::os::raw::c_uint);
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Dummy"][::std::mem::size_of::<Dummy>() - 1usize];
["Alignment of Dummy"][::std::mem::align_of::<Dummy>() - 1usize];
};
#[test]
fn bindgen_test_layout_Dummy() {
assert_eq!(
::std::mem::size_of::<Dummy>(),
1usize,
concat!("Size of: ", stringify!(Dummy))
);
assert_eq!(
::std::mem::align_of::<Dummy>(),
1usize,
concat!("Alignment of ", stringify!(Dummy))
);
}
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
impl Foo {
pub const Bar: Foo = Foo(2);
}
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
impl Foo {
pub const Bar: Foo = Foo(2);
}
+66 -50
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage> {
@@ -49,7 +55,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
let mut val = 0;
for i in 0..(bit_width as usize) {
@@ -69,7 +76,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
for i in 0..(bit_width as usize) {
let mask = 1 << i;
@@ -90,15 +98,25 @@ pub struct HasBigBitfield {
pub _bitfield_align_1: [u64; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize]>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of HasBigBitfield"][::std::mem::size_of::<HasBigBitfield>() - 16usize];
["Alignment of HasBigBitfield"][::std::mem::align_of::<HasBigBitfield>() - 16usize];
};
#[test]
fn bindgen_test_layout_HasBigBitfield() {
assert_eq!(
::std::mem::size_of::<HasBigBitfield>(),
16usize,
concat!("Size of: ", stringify!(HasBigBitfield))
);
assert_eq!(
::std::mem::align_of::<HasBigBitfield>(),
16usize,
concat!("Alignment of ", stringify!(HasBigBitfield))
);
}
impl HasBigBitfield {
#[inline]
pub fn x(&self) -> i128 {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 128u8) as u128) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 128u8) as u128)
}
}
#[inline]
pub fn set_x(&mut self, val: i128) {
@@ -109,16 +127,12 @@ impl HasBigBitfield {
}
#[inline]
pub fn new_bitfield_1(x: i128) -> __BindgenBitfieldUnit<[u8; 16usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
128u8,
{
let x: u128 = unsafe { ::std::mem::transmute(x) };
x as u64
},
);
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 128u8, {
let x: u128 = unsafe { ::std::mem::transmute(x) };
x as u64
});
__bindgen_bitfield_unit
}
}
@@ -129,19 +143,25 @@ pub struct HasTwoBigBitfields {
pub _bitfield_align_1: [u64; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize]>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of HasTwoBigBitfields",
][::std::mem::size_of::<HasTwoBigBitfields>() - 16usize];
[
"Alignment of HasTwoBigBitfields",
][::std::mem::align_of::<HasTwoBigBitfields>() - 16usize];
};
#[test]
fn bindgen_test_layout_HasTwoBigBitfields() {
assert_eq!(
::std::mem::size_of::<HasTwoBigBitfields>(),
16usize,
concat!("Size of: ", stringify!(HasTwoBigBitfields))
);
assert_eq!(
::std::mem::align_of::<HasTwoBigBitfields>(),
16usize,
concat!("Alignment of ", stringify!(HasTwoBigBitfields))
);
}
impl HasTwoBigBitfields {
#[inline]
pub fn x(&self) -> i128 {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 80u8) as u128) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 80u8) as u128)
}
}
#[inline]
pub fn set_x(&mut self, val: i128) {
@@ -152,7 +172,9 @@ impl HasTwoBigBitfields {
}
#[inline]
pub fn y(&self) -> i128 {
unsafe { ::std::mem::transmute(self._bitfield_1.get(80usize, 48u8) as u128) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(80usize, 48u8) as u128)
}
}
#[inline]
pub fn set_y(&mut self, val: i128) {
@@ -162,26 +184,20 @@ impl HasTwoBigBitfields {
}
}
#[inline]
pub fn new_bitfield_1(x: i128, y: i128) -> __BindgenBitfieldUnit<[u8; 16usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
80u8,
{
let x: u128 = unsafe { ::std::mem::transmute(x) };
x as u64
},
);
__bindgen_bitfield_unit
.set(
80usize,
48u8,
{
let y: u128 = unsafe { ::std::mem::transmute(y) };
y as u64
},
);
pub fn new_bitfield_1(
x: i128,
y: i128,
) -> __BindgenBitfieldUnit<[u8; 16usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 80u8, {
let x: u128 = unsafe { ::std::mem::transmute(x) };
x as u64
});
__bindgen_bitfield_unit.set(80usize, 48u8, {
let y: u128 = unsafe { ::std::mem::transmute(y) };
y as u64
});
__bindgen_bitfield_unit
}
}
+52 -31
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage> {
@@ -49,7 +55,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
let mut val = 0;
for i in 0..(bit_width as usize) {
@@ -69,7 +76,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
for i in 0..(bit_width as usize) {
let mask = 1 << i;
@@ -90,16 +98,33 @@ pub struct Test {
pub _bitfield_align_1: [u64; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 8usize]>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Test"][::std::mem::size_of::<Test>() - 16usize];
["Alignment of Test"][::std::mem::align_of::<Test>() - 4usize];
["Offset of field: Test::foo"][::std::mem::offset_of!(Test, foo) - 0usize];
};
#[test]
fn bindgen_test_layout_Test() {
const UNINIT: ::std::mem::MaybeUninit<Test> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<Test>(),
16usize,
concat!("Size of: ", stringify!(Test))
);
assert_eq!(
::std::mem::align_of::<Test>(),
4usize,
concat!("Alignment of ", stringify!(Test))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).foo) as usize - ptr as usize },
0usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(foo))
);
}
impl Test {
#[inline]
pub fn x(&self) -> u64 {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 56u8) as u64) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 56u8) as u64)
}
}
#[inline]
pub fn set_x(&mut self, val: u64) {
@@ -110,7 +135,9 @@ impl Test {
}
#[inline]
pub fn y(&self) -> u64 {
unsafe { ::std::mem::transmute(self._bitfield_1.get(56usize, 8u8) as u64) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(56usize, 8u8) as u64)
}
}
#[inline]
pub fn set_y(&mut self, val: u64) {
@@ -120,26 +147,20 @@ impl Test {
}
}
#[inline]
pub fn new_bitfield_1(x: u64, y: u64) -> __BindgenBitfieldUnit<[u8; 8usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
56u8,
{
let x: u64 = unsafe { ::std::mem::transmute(x) };
x as u64
},
);
__bindgen_bitfield_unit
.set(
56usize,
8u8,
{
let y: u64 = unsafe { ::std::mem::transmute(y) };
y as u64
},
);
pub fn new_bitfield_1(
x: u64,
y: u64,
) -> __BindgenBitfieldUnit<[u8; 8usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 56u8, {
let x: u64 = unsafe { ::std::mem::transmute(x) };
x as u64
});
__bindgen_bitfield_unit.set(56usize, 8u8, {
let y: u64 = unsafe { ::std::mem::transmute(y) };
y as u64
});
__bindgen_bitfield_unit
}
}
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage> {
@@ -49,7 +55,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
let mut val = 0;
for i in 0..(bit_width as usize) {
@@ -69,7 +76,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
for i in 0..(bit_width as usize) {
let mask = 1 << i;
@@ -83,17 +91,25 @@ where
}
}
}
#[repr(C)]
#[repr(C, packed)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Foo"][::std::mem::size_of::<Foo>() - 1usize];
["Alignment of Foo"][::std::mem::align_of::<Foo>() - 1usize];
};
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(
::std::mem::size_of::<Foo>(),
1usize,
concat!("Size of: ", stringify!(Foo))
);
assert_eq!(
::std::mem::align_of::<Foo>(),
1usize,
concat!("Alignment of ", stringify!(Foo))
);
}
extern "C" {
#[link_name = "\u{1}_ZN3Foo4typeEv"]
pub fn Foo_type(this: *mut Foo) -> ::std::os::raw::c_char;
@@ -109,7 +125,9 @@ extern "C" {
impl Foo {
#[inline]
pub fn type__bindgen_bitfield(&self) -> ::std::os::raw::c_char {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u8)
}
}
#[inline]
pub fn set_type__bindgen_bitfield(&mut self, val: ::std::os::raw::c_char) {
@@ -122,18 +140,13 @@ impl Foo {
pub fn new_bitfield_1(
type__bindgen_bitfield: ::std::os::raw::c_char,
) -> __BindgenBitfieldUnit<[u8; 1usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
3u8,
{
let type__bindgen_bitfield: u8 = unsafe {
::std::mem::transmute(type__bindgen_bitfield)
};
type__bindgen_bitfield as u64
},
);
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 3u8, {
let type__bindgen_bitfield: u8 =
unsafe { ::std::mem::transmute(type__bindgen_bitfield) };
type__bindgen_bitfield as u64
});
__bindgen_bitfield_unit
}
#[inline]
+330 -314
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage> {
@@ -49,7 +55,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
let mut val = 0;
for i in 0..(bit_width as usize) {
@@ -69,7 +76,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
for i in 0..(bit_width as usize) {
let mask = 1 << i;
@@ -92,17 +100,38 @@ pub struct A {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
pub y: ::std::os::raw::c_uchar,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of A"][::std::mem::size_of::<A>() - 4usize];
["Alignment of A"][::std::mem::align_of::<A>() - 4usize];
["Offset of field: A::x"][::std::mem::offset_of!(A, x) - 0usize];
["Offset of field: A::y"][::std::mem::offset_of!(A, y) - 3usize];
};
#[test]
fn bindgen_test_layout_A() {
const UNINIT: ::std::mem::MaybeUninit<A> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<A>(),
4usize,
concat!("Size of: ", stringify!(A))
);
assert_eq!(
::std::mem::align_of::<A>(),
4usize,
concat!("Alignment of ", stringify!(A))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
0usize,
concat!("Offset of field: ", stringify!(A), "::", stringify!(x))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize },
3usize,
concat!("Offset of field: ", stringify!(A), "::", stringify!(y))
);
}
impl A {
#[inline]
pub fn b1(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32)
}
}
#[inline]
pub fn set_b1(&mut self, val: ::std::os::raw::c_uint) {
@@ -113,7 +142,9 @@ impl A {
}
#[inline]
pub fn b2(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32)
}
}
#[inline]
pub fn set_b2(&mut self, val: ::std::os::raw::c_uint) {
@@ -124,7 +155,9 @@ impl A {
}
#[inline]
pub fn b3(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32)
}
}
#[inline]
pub fn set_b3(&mut self, val: ::std::os::raw::c_uint) {
@@ -135,7 +168,9 @@ impl A {
}
#[inline]
pub fn b4(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32)
}
}
#[inline]
pub fn set_b4(&mut self, val: ::std::os::raw::c_uint) {
@@ -146,7 +181,9 @@ impl A {
}
#[inline]
pub fn b5(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32)
}
}
#[inline]
pub fn set_b5(&mut self, val: ::std::os::raw::c_uint) {
@@ -157,7 +194,9 @@ impl A {
}
#[inline]
pub fn b6(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32)
}
}
#[inline]
pub fn set_b6(&mut self, val: ::std::os::raw::c_uint) {
@@ -168,7 +207,9 @@ impl A {
}
#[inline]
pub fn b7(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32)
}
}
#[inline]
pub fn set_b7(&mut self, val: ::std::os::raw::c_uint) {
@@ -179,7 +220,9 @@ impl A {
}
#[inline]
pub fn b8(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32)
}
}
#[inline]
pub fn set_b8(&mut self, val: ::std::os::raw::c_uint) {
@@ -190,7 +233,9 @@ impl A {
}
#[inline]
pub fn b9(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u32)
}
}
#[inline]
pub fn set_b9(&mut self, val: ::std::os::raw::c_uint) {
@@ -201,7 +246,9 @@ impl A {
}
#[inline]
pub fn b10(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u32)
}
}
#[inline]
pub fn set_b10(&mut self, val: ::std::os::raw::c_uint) {
@@ -223,115 +270,77 @@ impl A {
b9: ::std::os::raw::c_uint,
b10: ::std::os::raw::c_uint,
) -> __BindgenBitfieldUnit<[u8; 2usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
1u8,
{
let b1: u32 = unsafe { ::std::mem::transmute(b1) };
b1 as u64
},
);
__bindgen_bitfield_unit
.set(
1usize,
1u8,
{
let b2: u32 = unsafe { ::std::mem::transmute(b2) };
b2 as u64
},
);
__bindgen_bitfield_unit
.set(
2usize,
1u8,
{
let b3: u32 = unsafe { ::std::mem::transmute(b3) };
b3 as u64
},
);
__bindgen_bitfield_unit
.set(
3usize,
1u8,
{
let b4: u32 = unsafe { ::std::mem::transmute(b4) };
b4 as u64
},
);
__bindgen_bitfield_unit
.set(
4usize,
1u8,
{
let b5: u32 = unsafe { ::std::mem::transmute(b5) };
b5 as u64
},
);
__bindgen_bitfield_unit
.set(
5usize,
1u8,
{
let b6: u32 = unsafe { ::std::mem::transmute(b6) };
b6 as u64
},
);
__bindgen_bitfield_unit
.set(
6usize,
1u8,
{
let b7: u32 = unsafe { ::std::mem::transmute(b7) };
b7 as u64
},
);
__bindgen_bitfield_unit
.set(
7usize,
1u8,
{
let b8: u32 = unsafe { ::std::mem::transmute(b8) };
b8 as u64
},
);
__bindgen_bitfield_unit
.set(
8usize,
1u8,
{
let b9: u32 = unsafe { ::std::mem::transmute(b9) };
b9 as u64
},
);
__bindgen_bitfield_unit
.set(
9usize,
1u8,
{
let b10: u32 = unsafe { ::std::mem::transmute(b10) };
b10 as u64
},
);
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 1u8, {
let b1: u32 = unsafe { ::std::mem::transmute(b1) };
b1 as u64
});
__bindgen_bitfield_unit.set(1usize, 1u8, {
let b2: u32 = unsafe { ::std::mem::transmute(b2) };
b2 as u64
});
__bindgen_bitfield_unit.set(2usize, 1u8, {
let b3: u32 = unsafe { ::std::mem::transmute(b3) };
b3 as u64
});
__bindgen_bitfield_unit.set(3usize, 1u8, {
let b4: u32 = unsafe { ::std::mem::transmute(b4) };
b4 as u64
});
__bindgen_bitfield_unit.set(4usize, 1u8, {
let b5: u32 = unsafe { ::std::mem::transmute(b5) };
b5 as u64
});
__bindgen_bitfield_unit.set(5usize, 1u8, {
let b6: u32 = unsafe { ::std::mem::transmute(b6) };
b6 as u64
});
__bindgen_bitfield_unit.set(6usize, 1u8, {
let b7: u32 = unsafe { ::std::mem::transmute(b7) };
b7 as u64
});
__bindgen_bitfield_unit.set(7usize, 1u8, {
let b8: u32 = unsafe { ::std::mem::transmute(b8) };
b8 as u64
});
__bindgen_bitfield_unit.set(8usize, 1u8, {
let b9: u32 = unsafe { ::std::mem::transmute(b9) };
b9 as u64
});
__bindgen_bitfield_unit.set(9usize, 1u8, {
let b10: u32 = unsafe { ::std::mem::transmute(b10) };
b10 as u64
});
__bindgen_bitfield_unit
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone)]
pub struct B {
pub _bitfield_align_1: [u32; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of B"][::std::mem::size_of::<B>() - 4usize];
["Alignment of B"][::std::mem::align_of::<B>() - 4usize];
};
#[test]
fn bindgen_test_layout_B() {
assert_eq!(
::std::mem::size_of::<B>(),
4usize,
concat!("Size of: ", stringify!(B))
);
assert_eq!(
::std::mem::align_of::<B>(),
4usize,
concat!("Alignment of ", stringify!(B))
);
}
impl B {
#[inline]
pub fn foo(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 31u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 31u8) as u32)
}
}
#[inline]
pub fn set_foo(&mut self, val: ::std::os::raw::c_uint) {
@@ -342,7 +351,9 @@ impl B {
}
#[inline]
pub fn bar(&self) -> ::std::os::raw::c_uchar {
unsafe { ::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u8)
}
}
#[inline]
pub fn set_bar(&mut self, val: ::std::os::raw::c_uchar) {
@@ -356,25 +367,16 @@ impl B {
foo: ::std::os::raw::c_uint,
bar: ::std::os::raw::c_uchar,
) -> __BindgenBitfieldUnit<[u8; 4usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
31u8,
{
let foo: u32 = unsafe { ::std::mem::transmute(foo) };
foo as u64
},
);
__bindgen_bitfield_unit
.set(
31usize,
1u8,
{
let bar: u8 = unsafe { ::std::mem::transmute(bar) };
bar as u64
},
);
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 31u8, {
let foo: u32 = unsafe { ::std::mem::transmute(foo) };
foo as u64
});
__bindgen_bitfield_unit.set(31usize, 1u8, {
let bar: u8 = unsafe { ::std::mem::transmute(bar) };
bar as u64
});
__bindgen_bitfield_unit
}
}
@@ -386,17 +388,38 @@ pub struct C {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
pub baz: ::std::os::raw::c_uint,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of C"][::std::mem::size_of::<C>() - 8usize];
["Alignment of C"][::std::mem::align_of::<C>() - 4usize];
["Offset of field: C::x"][::std::mem::offset_of!(C, x) - 0usize];
["Offset of field: C::baz"][::std::mem::offset_of!(C, baz) - 4usize];
};
#[test]
fn bindgen_test_layout_C() {
const UNINIT: ::std::mem::MaybeUninit<C> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<C>(),
8usize,
concat!("Size of: ", stringify!(C))
);
assert_eq!(
::std::mem::align_of::<C>(),
4usize,
concat!("Alignment of ", stringify!(C))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
0usize,
concat!("Offset of field: ", stringify!(C), "::", stringify!(x))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize },
4usize,
concat!("Offset of field: ", stringify!(C), "::", stringify!(baz))
);
}
impl C {
#[inline]
pub fn b1(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32)
}
}
#[inline]
pub fn set_b1(&mut self, val: ::std::os::raw::c_uint) {
@@ -407,7 +430,9 @@ impl C {
}
#[inline]
pub fn b2(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32)
}
}
#[inline]
pub fn set_b2(&mut self, val: ::std::os::raw::c_uint) {
@@ -421,25 +446,16 @@ impl C {
b1: ::std::os::raw::c_uint,
b2: ::std::os::raw::c_uint,
) -> __BindgenBitfieldUnit<[u8; 1usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
1u8,
{
let b1: u32 = unsafe { ::std::mem::transmute(b1) };
b1 as u64
},
);
__bindgen_bitfield_unit
.set(
1usize,
1u8,
{
let b2: u32 = unsafe { ::std::mem::transmute(b2) };
b2 as u64
},
);
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 1u8, {
let b1: u32 = unsafe { ::std::mem::transmute(b1) };
b1 as u64
});
__bindgen_bitfield_unit.set(1usize, 1u8, {
let b2: u32 = unsafe { ::std::mem::transmute(b2) };
b2 as u64
});
__bindgen_bitfield_unit
}
}
@@ -451,15 +467,25 @@ pub struct Date1 {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize]>,
pub __bindgen_padding_0: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Date1"][::std::mem::size_of::<Date1>() - 4usize];
["Alignment of Date1"][::std::mem::align_of::<Date1>() - 2usize];
};
#[test]
fn bindgen_test_layout_Date1() {
assert_eq!(
::std::mem::size_of::<Date1>(),
4usize,
concat!("Size of: ", stringify!(Date1))
);
assert_eq!(
::std::mem::align_of::<Date1>(),
2usize,
concat!("Alignment of ", stringify!(Date1))
);
}
impl Date1 {
#[inline]
pub fn nWeekDay(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u16) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u16)
}
}
#[inline]
pub fn set_nWeekDay(&mut self, val: ::std::os::raw::c_ushort) {
@@ -470,7 +496,9 @@ impl Date1 {
}
#[inline]
pub fn nMonthDay(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 6u8) as u16) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(3usize, 6u8) as u16)
}
}
#[inline]
pub fn set_nMonthDay(&mut self, val: ::std::os::raw::c_ushort) {
@@ -481,7 +509,9 @@ impl Date1 {
}
#[inline]
pub fn nMonth(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 5u8) as u16) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(9usize, 5u8) as u16)
}
}
#[inline]
pub fn set_nMonth(&mut self, val: ::std::os::raw::c_ushort) {
@@ -492,7 +522,9 @@ impl Date1 {
}
#[inline]
pub fn nYear(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u16) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u16)
}
}
#[inline]
pub fn set_nYear(&mut self, val: ::std::os::raw::c_ushort) {
@@ -508,43 +540,24 @@ impl Date1 {
nMonth: ::std::os::raw::c_ushort,
nYear: ::std::os::raw::c_ushort,
) -> __BindgenBitfieldUnit<[u8; 3usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
3u8,
{
let nWeekDay: u16 = unsafe { ::std::mem::transmute(nWeekDay) };
nWeekDay as u64
},
);
__bindgen_bitfield_unit
.set(
3usize,
6u8,
{
let nMonthDay: u16 = unsafe { ::std::mem::transmute(nMonthDay) };
nMonthDay as u64
},
);
__bindgen_bitfield_unit
.set(
9usize,
5u8,
{
let nMonth: u16 = unsafe { ::std::mem::transmute(nMonth) };
nMonth as u64
},
);
__bindgen_bitfield_unit
.set(
16usize,
8u8,
{
let nYear: u16 = unsafe { ::std::mem::transmute(nYear) };
nYear as u64
},
);
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 3u8, {
let nWeekDay: u16 = unsafe { ::std::mem::transmute(nWeekDay) };
nWeekDay as u64
});
__bindgen_bitfield_unit.set(3usize, 6u8, {
let nMonthDay: u16 = unsafe { ::std::mem::transmute(nMonthDay) };
nMonthDay as u64
});
__bindgen_bitfield_unit.set(9usize, 5u8, {
let nMonth: u16 = unsafe { ::std::mem::transmute(nMonth) };
nMonth as u64
});
__bindgen_bitfield_unit.set(16usize, 8u8, {
let nYear: u16 = unsafe { ::std::mem::transmute(nYear) };
nYear as u64
});
__bindgen_bitfield_unit
}
}
@@ -555,15 +568,25 @@ pub struct Date2 {
pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Date2"][::std::mem::size_of::<Date2>() - 4usize];
["Alignment of Date2"][::std::mem::align_of::<Date2>() - 2usize];
};
#[test]
fn bindgen_test_layout_Date2() {
assert_eq!(
::std::mem::size_of::<Date2>(),
4usize,
concat!("Size of: ", stringify!(Date2))
);
assert_eq!(
::std::mem::align_of::<Date2>(),
2usize,
concat!("Alignment of ", stringify!(Date2))
);
}
impl Date2 {
#[inline]
pub fn nWeekDay(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u16) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u16)
}
}
#[inline]
pub fn set_nWeekDay(&mut self, val: ::std::os::raw::c_ushort) {
@@ -574,7 +597,9 @@ impl Date2 {
}
#[inline]
pub fn nMonthDay(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 6u8) as u16) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(3usize, 6u8) as u16)
}
}
#[inline]
pub fn set_nMonthDay(&mut self, val: ::std::os::raw::c_ushort) {
@@ -585,7 +610,9 @@ impl Date2 {
}
#[inline]
pub fn nMonth(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 5u8) as u16) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(9usize, 5u8) as u16)
}
}
#[inline]
pub fn set_nMonth(&mut self, val: ::std::os::raw::c_ushort) {
@@ -596,7 +623,9 @@ impl Date2 {
}
#[inline]
pub fn nYear(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u16) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u16)
}
}
#[inline]
pub fn set_nYear(&mut self, val: ::std::os::raw::c_ushort) {
@@ -607,7 +636,9 @@ impl Date2 {
}
#[inline]
pub fn byte(&self) -> ::std::os::raw::c_uchar {
unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 8u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(24usize, 8u8) as u8)
}
}
#[inline]
pub fn set_byte(&mut self, val: ::std::os::raw::c_uchar) {
@@ -624,52 +655,28 @@ impl Date2 {
nYear: ::std::os::raw::c_ushort,
byte: ::std::os::raw::c_uchar,
) -> __BindgenBitfieldUnit<[u8; 4usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
3u8,
{
let nWeekDay: u16 = unsafe { ::std::mem::transmute(nWeekDay) };
nWeekDay as u64
},
);
__bindgen_bitfield_unit
.set(
3usize,
6u8,
{
let nMonthDay: u16 = unsafe { ::std::mem::transmute(nMonthDay) };
nMonthDay as u64
},
);
__bindgen_bitfield_unit
.set(
9usize,
5u8,
{
let nMonth: u16 = unsafe { ::std::mem::transmute(nMonth) };
nMonth as u64
},
);
__bindgen_bitfield_unit
.set(
16usize,
8u8,
{
let nYear: u16 = unsafe { ::std::mem::transmute(nYear) };
nYear as u64
},
);
__bindgen_bitfield_unit
.set(
24usize,
8u8,
{
let byte: u8 = unsafe { ::std::mem::transmute(byte) };
byte as u64
},
);
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 3u8, {
let nWeekDay: u16 = unsafe { ::std::mem::transmute(nWeekDay) };
nWeekDay as u64
});
__bindgen_bitfield_unit.set(3usize, 6u8, {
let nMonthDay: u16 = unsafe { ::std::mem::transmute(nMonthDay) };
nMonthDay as u64
});
__bindgen_bitfield_unit.set(9usize, 5u8, {
let nMonth: u16 = unsafe { ::std::mem::transmute(nMonth) };
nMonth as u64
});
__bindgen_bitfield_unit.set(16usize, 8u8, {
let nYear: u16 = unsafe { ::std::mem::transmute(nYear) };
nYear as u64
});
__bindgen_bitfield_unit.set(24usize, 8u8, {
let byte: u8 = unsafe { ::std::mem::transmute(byte) };
byte as u64
});
__bindgen_bitfield_unit
}
}
@@ -681,16 +688,38 @@ pub struct Date3 {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize]>,
pub byte: ::std::os::raw::c_uchar,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Date3"][::std::mem::size_of::<Date3>() - 4usize];
["Alignment of Date3"][::std::mem::align_of::<Date3>() - 2usize];
["Offset of field: Date3::byte"][::std::mem::offset_of!(Date3, byte) - 3usize];
};
#[test]
fn bindgen_test_layout_Date3() {
const UNINIT: ::std::mem::MaybeUninit<Date3> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<Date3>(),
4usize,
concat!("Size of: ", stringify!(Date3))
);
assert_eq!(
::std::mem::align_of::<Date3>(),
2usize,
concat!("Alignment of ", stringify!(Date3))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).byte) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(Date3),
"::",
stringify!(byte)
)
);
}
impl Date3 {
#[inline]
pub fn nWeekDay(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u16) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u16)
}
}
#[inline]
pub fn set_nWeekDay(&mut self, val: ::std::os::raw::c_ushort) {
@@ -701,7 +730,9 @@ impl Date3 {
}
#[inline]
pub fn nMonthDay(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 6u8) as u16) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(3usize, 6u8) as u16)
}
}
#[inline]
pub fn set_nMonthDay(&mut self, val: ::std::os::raw::c_ushort) {
@@ -712,7 +743,9 @@ impl Date3 {
}
#[inline]
pub fn nMonth(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 5u8) as u16) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(9usize, 5u8) as u16)
}
}
#[inline]
pub fn set_nMonth(&mut self, val: ::std::os::raw::c_ushort) {
@@ -723,7 +756,9 @@ impl Date3 {
}
#[inline]
pub fn nYear(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u16) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u16)
}
}
#[inline]
pub fn set_nYear(&mut self, val: ::std::os::raw::c_ushort) {
@@ -739,43 +774,24 @@ impl Date3 {
nMonth: ::std::os::raw::c_ushort,
nYear: ::std::os::raw::c_ushort,
) -> __BindgenBitfieldUnit<[u8; 3usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
3u8,
{
let nWeekDay: u16 = unsafe { ::std::mem::transmute(nWeekDay) };
nWeekDay as u64
},
);
__bindgen_bitfield_unit
.set(
3usize,
6u8,
{
let nMonthDay: u16 = unsafe { ::std::mem::transmute(nMonthDay) };
nMonthDay as u64
},
);
__bindgen_bitfield_unit
.set(
9usize,
5u8,
{
let nMonth: u16 = unsafe { ::std::mem::transmute(nMonth) };
nMonth as u64
},
);
__bindgen_bitfield_unit
.set(
16usize,
8u8,
{
let nYear: u16 = unsafe { ::std::mem::transmute(nYear) };
nYear as u64
},
);
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 3u8, {
let nWeekDay: u16 = unsafe { ::std::mem::transmute(nWeekDay) };
nWeekDay as u64
});
__bindgen_bitfield_unit.set(3usize, 6u8, {
let nMonthDay: u16 = unsafe { ::std::mem::transmute(nMonthDay) };
nMonthDay as u64
});
__bindgen_bitfield_unit.set(9usize, 5u8, {
let nMonth: u16 = unsafe { ::std::mem::transmute(nMonth) };
nMonth as u64
});
__bindgen_bitfield_unit.set(16usize, 8u8, {
let nYear: u16 = unsafe { ::std::mem::transmute(nYear) };
nYear as u64
});
__bindgen_bitfield_unit
}
}
+41 -29
View File
@@ -1,5 +1,11 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#![cfg(not(target_os = "windows"))]
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage> {
@@ -50,7 +56,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
let mut val = 0;
for i in 0..(bit_width as usize) {
@@ -70,7 +77,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
for i in 0..(bit_width as usize) {
let mask = 1 << i;
@@ -93,16 +101,25 @@ pub enum MyEnum {
FOUR = 3,
}
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct TaggedPtr {
pub _bitfield_align_1: [u64; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 8usize]>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of TaggedPtr"][::std::mem::size_of::<TaggedPtr>() - 8usize];
["Alignment of TaggedPtr"][::std::mem::align_of::<TaggedPtr>() - 8usize];
};
#[test]
fn bindgen_test_layout_TaggedPtr() {
assert_eq!(
::std::mem::size_of::<TaggedPtr>(),
8usize,
concat!("Size of: ", stringify!(TaggedPtr))
);
assert_eq!(
::std::mem::align_of::<TaggedPtr>(),
8usize,
concat!("Alignment of ", stringify!(TaggedPtr))
);
}
impl Default for TaggedPtr {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -115,7 +132,9 @@ impl Default for TaggedPtr {
impl TaggedPtr {
#[inline]
pub fn tag(&self) -> MyEnum {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32)
}
}
#[inline]
pub fn set_tag(&mut self, val: MyEnum) {
@@ -126,7 +145,9 @@ impl TaggedPtr {
}
#[inline]
pub fn ptr(&self) -> ::std::os::raw::c_long {
unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 62u8) as u64) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(2usize, 62u8) as u64)
}
}
#[inline]
pub fn set_ptr(&mut self, val: ::std::os::raw::c_long) {
@@ -140,25 +161,16 @@ impl TaggedPtr {
tag: MyEnum,
ptr: ::std::os::raw::c_long,
) -> __BindgenBitfieldUnit<[u8; 8usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
2u8,
{
let tag: u32 = unsafe { ::std::mem::transmute(tag) };
tag as u64
},
);
__bindgen_bitfield_unit
.set(
2usize,
62u8,
{
let ptr: u64 = unsafe { ::std::mem::transmute(ptr) };
ptr as u64
},
);
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 2u8, {
let tag: u32 = unsafe { ::std::mem::transmute(tag) };
tag as u64
});
__bindgen_bitfield_unit.set(2usize, 62u8, {
let ptr: u64 = unsafe { ::std::mem::transmute(ptr) };
ptr as u64
});
__bindgen_bitfield_unit
}
}
@@ -1,15 +1,29 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Default, Copy, Clone)]
pub struct _bindgen_ty_1 {
pub _bindgen_opaque_blob: [u64; 10usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of _bindgen_ty_1"][::std::mem::size_of::<_bindgen_ty_1>() - 80usize];
["Alignment of _bindgen_ty_1"][::std::mem::align_of::<_bindgen_ty_1>() - 8usize];
};
#[test]
fn bindgen_test_layout__bindgen_ty_1() {
assert_eq!(
::std::mem::size_of::<_bindgen_ty_1>(),
80usize,
concat!("Size of: ", stringify!(_bindgen_ty_1))
);
assert_eq!(
::std::mem::align_of::<_bindgen_ty_1>(),
8usize,
concat!("Alignment of ", stringify!(_bindgen_ty_1))
);
}
extern "C" {
pub static mut a: _bindgen_ty_1;
}
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage> {
@@ -49,7 +55,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
let mut val = 0;
for i in 0..(bit_width as usize) {
@@ -69,7 +76,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
for i in 0..(bit_width as usize) {
let mask = 1 << i;
@@ -84,24 +92,31 @@ where
}
}
#[repr(C)]
#[repr(align(4))]
#[derive(Debug, Default, Copy, Clone)]
pub struct mach_msg_type_descriptor_t {
pub _bitfield_align_1: [u32; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of mach_msg_type_descriptor_t",
][::std::mem::size_of::<mach_msg_type_descriptor_t>() - 4usize];
[
"Alignment of mach_msg_type_descriptor_t",
][::std::mem::align_of::<mach_msg_type_descriptor_t>() - 4usize];
};
#[test]
fn bindgen_test_layout_mach_msg_type_descriptor_t() {
assert_eq!(
::std::mem::size_of::<mach_msg_type_descriptor_t>(),
4usize,
concat!("Size of: ", stringify!(mach_msg_type_descriptor_t))
);
assert_eq!(
::std::mem::align_of::<mach_msg_type_descriptor_t>(),
4usize,
concat!("Alignment of ", stringify!(mach_msg_type_descriptor_t))
);
}
impl mach_msg_type_descriptor_t {
#[inline]
pub fn pad3(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 24u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 24u8) as u32)
}
}
#[inline]
pub fn set_pad3(&mut self, val: ::std::os::raw::c_uint) {
@@ -112,7 +127,9 @@ impl mach_msg_type_descriptor_t {
}
#[inline]
pub fn type_(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 8u8) as u32) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(24usize, 8u8) as u32)
}
}
#[inline]
pub fn set_type(&mut self, val: ::std::os::raw::c_uint) {
@@ -126,25 +143,16 @@ impl mach_msg_type_descriptor_t {
pad3: ::std::os::raw::c_uint,
type_: ::std::os::raw::c_uint,
) -> __BindgenBitfieldUnit<[u8; 4usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
24u8,
{
let pad3: u32 = unsafe { ::std::mem::transmute(pad3) };
pad3 as u64
},
);
__bindgen_bitfield_unit
.set(
24usize,
8u8,
{
let type_: u32 = unsafe { ::std::mem::transmute(type_) };
type_ as u64
},
);
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 24u8, {
let pad3: u32 = unsafe { ::std::mem::transmute(pad3) };
pad3 as u64
});
__bindgen_bitfield_unit.set(24usize, 8u8, {
let type_: u32 = unsafe { ::std::mem::transmute(type_) };
type_ as u64
});
__bindgen_bitfield_unit
}
}
+62 -132
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage> {
@@ -49,7 +55,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
let mut val = 0;
for i in 0..(bit_width as usize) {
@@ -69,7 +76,8 @@ where
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!(
(bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),
(bit_offset + (bit_width as usize)) / 8 <=
self.storage.as_ref().len()
);
for i in 0..(bit_width as usize) {
let mask = 1 << i;
@@ -83,21 +91,31 @@ where
}
}
}
#[repr(C)]
#[repr(C, packed)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Struct {
pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Struct"][::std::mem::size_of::<Struct>() - 4usize];
["Alignment of Struct"][::std::mem::align_of::<Struct>() - 1usize];
};
#[test]
fn bindgen_test_layout_Struct() {
assert_eq!(
::std::mem::size_of::<Struct>(),
4usize,
concat!("Size of: ", stringify!(Struct))
);
assert_eq!(
::std::mem::align_of::<Struct>(),
1usize,
concat!("Alignment of ", stringify!(Struct))
);
}
impl Struct {
#[inline]
pub fn a(&self) -> ::std::os::raw::c_uchar {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8)
}
}
#[inline]
pub fn set_a(&mut self, val: ::std::os::raw::c_uchar) {
@@ -108,7 +126,9 @@ impl Struct {
}
#[inline]
pub fn b(&self) -> ::std::os::raw::c_uchar {
unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8)
}
}
#[inline]
pub fn set_b(&mut self, val: ::std::os::raw::c_uchar) {
@@ -119,7 +139,9 @@ impl Struct {
}
#[inline]
pub fn c(&self) -> ::std::os::raw::c_uchar {
unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 6u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(2usize, 6u8) as u8)
}
}
#[inline]
pub fn set_c(&mut self, val: ::std::os::raw::c_uchar) {
@@ -130,7 +152,9 @@ impl Struct {
}
#[inline]
pub fn d(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 16u8) as u16) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(8usize, 16u8) as u16)
}
}
#[inline]
pub fn set_d(&mut self, val: ::std::os::raw::c_ushort) {
@@ -141,7 +165,9 @@ impl Struct {
}
#[inline]
pub fn e(&self) -> ::std::os::raw::c_uchar {
unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 8u8) as u8) }
unsafe {
::std::mem::transmute(self._bitfield_1.get(24usize, 8u8) as u8)
}
}
#[inline]
pub fn set_e(&mut self, val: ::std::os::raw::c_uchar) {
@@ -158,124 +184,28 @@ impl Struct {
d: ::std::os::raw::c_ushort,
e: ::std::os::raw::c_uchar,
) -> __BindgenBitfieldUnit<[u8; 4usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
1u8,
{
let a: u8 = unsafe { ::std::mem::transmute(a) };
a as u64
},
);
__bindgen_bitfield_unit
.set(
1usize,
1u8,
{
let b: u8 = unsafe { ::std::mem::transmute(b) };
b as u64
},
);
__bindgen_bitfield_unit
.set(
2usize,
6u8,
{
let c: u8 = unsafe { ::std::mem::transmute(c) };
c as u64
},
);
__bindgen_bitfield_unit
.set(
8usize,
16u8,
{
let d: u16 = unsafe { ::std::mem::transmute(d) };
d as u64
},
);
__bindgen_bitfield_unit
.set(
24usize,
8u8,
{
let e: u8 = unsafe { ::std::mem::transmute(e) };
e as u64
},
);
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 1u8, {
let a: u8 = unsafe { ::std::mem::transmute(a) };
a as u64
});
__bindgen_bitfield_unit.set(1usize, 1u8, {
let b: u8 = unsafe { ::std::mem::transmute(b) };
b as u64
});
__bindgen_bitfield_unit.set(2usize, 6u8, {
let c: u8 = unsafe { ::std::mem::transmute(c) };
c as u64
});
__bindgen_bitfield_unit.set(8usize, 16u8, {
let d: u16 = unsafe { ::std::mem::transmute(d) };
d as u64
});
__bindgen_bitfield_unit.set(24usize, 8u8, {
let e: u8 = unsafe { ::std::mem::transmute(e) };
e as u64
});
__bindgen_bitfield_unit
}
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Inner {
pub _bitfield_align_1: [u16; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Inner"][::std::mem::size_of::<Inner>() - 4usize];
["Alignment of Inner"][::std::mem::align_of::<Inner>() - 2usize];
};
impl Inner {
#[inline]
pub fn a(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 16u8) as u16) }
}
#[inline]
pub fn set_a(&mut self, val: ::std::os::raw::c_ushort) {
unsafe {
let val: u16 = ::std::mem::transmute(val);
self._bitfield_1.set(0usize, 16u8, val as u64)
}
}
#[inline]
pub fn b(&self) -> ::std::os::raw::c_ushort {
unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 16u8) as u16) }
}
#[inline]
pub fn set_b(&mut self, val: ::std::os::raw::c_ushort) {
unsafe {
let val: u16 = ::std::mem::transmute(val);
self._bitfield_1.set(16usize, 16u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_1(
a: ::std::os::raw::c_ushort,
b: ::std::os::raw::c_ushort,
) -> __BindgenBitfieldUnit<[u8; 4usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
16u8,
{
let a: u16 = unsafe { ::std::mem::transmute(a) };
a as u64
},
);
__bindgen_bitfield_unit
.set(
16usize,
16u8,
{
let b: u16 = unsafe { ::std::mem::transmute(b) };
b as u64
},
);
__bindgen_bitfield_unit
}
}
#[repr(C, packed)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Outer {
pub inner: Inner,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Outer"][::std::mem::size_of::<Outer>() - 4usize];
["Alignment of Outer"][::std::mem::align_of::<Outer>() - 1usize];
["Offset of field: Outer::inner"][::std::mem::offset_of!(Outer, inner) - 0usize];
};
+7 -1
View File
@@ -1,5 +1,11 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#![cfg(target_os = "macos")]
extern crate block;
extern "C" {
pub fn func() -> _bindgen_ty_id_4;
@@ -1,22 +1,43 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
pub struct BlocklistMe(u8);
/// Because this type contains a blocklisted type, it should not derive Debug.
#[repr(C)]
pub struct ShouldManuallyImplDebug {
pub a: BlocklistMe,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of ShouldManuallyImplDebug",
][::std::mem::size_of::<ShouldManuallyImplDebug>() - 1usize];
[
"Alignment of ShouldManuallyImplDebug",
][::std::mem::align_of::<ShouldManuallyImplDebug>() - 1usize];
[
"Offset of field: ShouldManuallyImplDebug::a",
][::std::mem::offset_of!(ShouldManuallyImplDebug, a) - 0usize];
};
#[test]
fn bindgen_test_layout_ShouldManuallyImplDebug() {
const UNINIT: ::std::mem::MaybeUninit<ShouldManuallyImplDebug> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<ShouldManuallyImplDebug>(),
1usize,
concat!("Size of: ", stringify!(ShouldManuallyImplDebug))
);
assert_eq!(
::std::mem::align_of::<ShouldManuallyImplDebug>(),
1usize,
concat!("Alignment of ", stringify!(ShouldManuallyImplDebug))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ShouldManuallyImplDebug),
"::",
stringify!(a)
)
);
}
impl Default for ShouldManuallyImplDebug {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
+79 -27
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct SizedIntegers {
@@ -6,34 +12,80 @@ pub struct SizedIntegers {
pub y: u16,
pub z: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of SizedIntegers"][::std::mem::size_of::<SizedIntegers>() - 8usize];
["Alignment of SizedIntegers"][::std::mem::align_of::<SizedIntegers>() - 4usize];
[
"Offset of field: SizedIntegers::x",
][::std::mem::offset_of!(SizedIntegers, x) - 0usize];
[
"Offset of field: SizedIntegers::y",
][::std::mem::offset_of!(SizedIntegers, y) - 2usize];
[
"Offset of field: SizedIntegers::z",
][::std::mem::offset_of!(SizedIntegers, z) - 4usize];
};
#[test]
fn bindgen_test_layout_SizedIntegers() {
const UNINIT: ::std::mem::MaybeUninit<SizedIntegers> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<SizedIntegers>(),
8usize,
concat!("Size of: ", stringify!(SizedIntegers))
);
assert_eq!(
::std::mem::align_of::<SizedIntegers>(),
4usize,
concat!("Alignment of ", stringify!(SizedIntegers))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(SizedIntegers),
"::",
stringify!(x)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(SizedIntegers),
"::",
stringify!(y)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).z) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(SizedIntegers),
"::",
stringify!(z)
)
);
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct StructWithBlocklistedFwdDecl {
pub b: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of StructWithBlocklistedFwdDecl",
][::std::mem::size_of::<StructWithBlocklistedFwdDecl>() - 1usize];
[
"Alignment of StructWithBlocklistedFwdDecl",
][::std::mem::align_of::<StructWithBlocklistedFwdDecl>() - 1usize];
[
"Offset of field: StructWithBlocklistedFwdDecl::b",
][::std::mem::offset_of!(StructWithBlocklistedFwdDecl, b) - 0usize];
};
#[test]
fn bindgen_test_layout_StructWithBlocklistedFwdDecl() {
const UNINIT: ::std::mem::MaybeUninit<StructWithBlocklistedFwdDecl> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<StructWithBlocklistedFwdDecl>(),
1usize,
concat!("Size of: ", stringify!(StructWithBlocklistedFwdDecl))
);
assert_eq!(
::std::mem::align_of::<StructWithBlocklistedFwdDecl>(),
1usize,
concat!("Alignment of ", stringify!(StructWithBlocklistedFwdDecl))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(StructWithBlocklistedFwdDecl),
"::",
stringify!(b)
)
);
}
+20 -6
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub mod root {
#[allow(unused_imports)]
@@ -20,9 +26,17 @@ pub mod root {
pub struct C {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of C"][::std::mem::size_of::<C>() - 1usize];
["Alignment of C"][::std::mem::align_of::<C>() - 1usize];
};
#[test]
fn bindgen_test_layout_C() {
assert_eq!(
::std::mem::size_of::<C>(),
1usize,
concat!("Size of: ", stringify!(C))
);
assert_eq!(
::std::mem::align_of::<C>(),
1usize,
concat!("Alignment of ", stringify!(C))
);
}
}
+7 -1
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub mod root {
#[allow(unused_imports)]
+20 -6
View File
@@ -1,14 +1,28 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Foo"][::std::mem::size_of::<Foo>() - 1usize];
["Alignment of Foo"][::std::mem::align_of::<Foo>() - 1usize];
};
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(
::std::mem::size_of::<Foo>(),
1usize,
concat!("Size of: ", stringify!(Foo))
);
assert_eq!(
::std::mem::align_of::<Foo>(),
1usize,
concat!("Alignment of ", stringify!(Foo))
);
}
extern "C" {
#[link_name = "\u{1}_ZN3Foo3fooEv"]
pub fn Foo_foo(this: *mut Foo) -> ::std::os::raw::c_int;
-1
View File
@@ -1 +0,0 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
@@ -1,69 +0,0 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#[path = "./struct_with_bitfields.rs"]
mod bitfields;
use bitfields::*;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct C {
pub x: ::std::os::raw::c_uchar,
pub _bitfield_align_1: [u8; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
pub baz: ::std::os::raw::c_uint,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of C"][::std::mem::size_of::<C>() - 8usize];
["Alignment of C"][::std::mem::align_of::<C>() - 4usize];
["Offset of field: C::x"][::std::mem::offset_of!(C, x) - 0usize];
["Offset of field: C::baz"][::std::mem::offset_of!(C, baz) - 4usize];
};
impl C {
#[inline]
pub fn b1(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) }
}
#[inline]
pub fn set_b1(&mut self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(0usize, 1u8, val as u64)
}
}
#[inline]
pub fn b2(&self) -> ::std::os::raw::c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) }
}
#[inline]
pub fn set_b2(&mut self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(1usize, 1u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_1(
b1: ::std::os::raw::c_uint,
b2: ::std::os::raw::c_uint,
) -> __BindgenBitfieldUnit<[u8; 1usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
__bindgen_bitfield_unit
.set(
0usize,
1u8,
{
let b1: u32 = unsafe { ::std::mem::transmute(b1) };
b1 as u64
},
);
__bindgen_bitfield_unit
.set(
1usize,
1u8,
{
let b2: u32 = unsafe { ::std::mem::transmute(b2) };
b2 as u64
},
);
__bindgen_bitfield_unit
}
}
+47 -21
View File
@@ -1,5 +1,11 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#![cfg(target_os = "macos")]
extern crate block;
extern "C" {
#[link_name = "\u{1}_Z8atexit_bU13block_pointerFvvE"]
@@ -28,21 +34,42 @@ pub struct contains_block_pointers {
pub val: contains_block_pointers__bindgen_ty_id_61,
pub ptr_val: *mut _bindgen_ty_id_68,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of contains_block_pointers",
][::std::mem::size_of::<contains_block_pointers>() - 16usize];
[
"Alignment of contains_block_pointers",
][::std::mem::align_of::<contains_block_pointers>() - 8usize];
[
"Offset of field: contains_block_pointers::val",
][::std::mem::offset_of!(contains_block_pointers, val) - 0usize];
[
"Offset of field: contains_block_pointers::ptr_val",
][::std::mem::offset_of!(contains_block_pointers, ptr_val) - 8usize];
};
#[test]
fn bindgen_test_layout_contains_block_pointers() {
const UNINIT: ::std::mem::MaybeUninit<contains_block_pointers> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<contains_block_pointers>(),
16usize,
concat!("Size of: ", stringify!(contains_block_pointers))
);
assert_eq!(
::std::mem::align_of::<contains_block_pointers>(),
8usize,
concat!("Alignment of ", stringify!(contains_block_pointers))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(contains_block_pointers),
"::",
stringify!(val)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).ptr_val) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(contains_block_pointers),
"::",
stringify!(ptr_val)
)
);
}
impl Default for contains_block_pointers {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -59,8 +86,7 @@ pub type _bindgen_ty_id_40 = *const ::block::Block<
>;
pub type _bindgen_ty_id_50 = *const ::block::Block<(usize,), ()>;
pub type _bindgen_ty_id_56 = *const ::block::Block<(usize,), ()>;
pub type contains_block_pointers__bindgen_ty_id_61 = *const ::block::Block<
(::std::os::raw::c_int,),
(),
>;
pub type _bindgen_ty_id_68 = *const ::block::Block<(::std::os::raw::c_int,), ()>;
pub type contains_block_pointers__bindgen_ty_id_61 =
*const ::block::Block<(::std::os::raw::c_int,), ()>;
pub type _bindgen_ty_id_68 =
*const ::block::Block<(::std::os::raw::c_int,), ()>;
+43 -16
View File
@@ -1,5 +1,11 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#![cfg(target_os = "macos")]
extern "C" {
#[link_name = "\u{1}_Z8atexit_bU13block_pointerFvvE"]
pub fn atexit_b(arg1: *mut ::std::os::raw::c_void);
@@ -27,21 +33,42 @@ pub struct contains_block_pointers {
pub val: *mut ::std::os::raw::c_void,
pub ptr_val: *mut *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of contains_block_pointers",
][::std::mem::size_of::<contains_block_pointers>() - 16usize];
[
"Alignment of contains_block_pointers",
][::std::mem::align_of::<contains_block_pointers>() - 8usize];
[
"Offset of field: contains_block_pointers::val",
][::std::mem::offset_of!(contains_block_pointers, val) - 0usize];
[
"Offset of field: contains_block_pointers::ptr_val",
][::std::mem::offset_of!(contains_block_pointers, ptr_val) - 8usize];
};
#[test]
fn bindgen_test_layout_contains_block_pointers() {
const UNINIT: ::std::mem::MaybeUninit<contains_block_pointers> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<contains_block_pointers>(),
16usize,
concat!("Size of: ", stringify!(contains_block_pointers))
);
assert_eq!(
::std::mem::align_of::<contains_block_pointers>(),
8usize,
concat!("Alignment of ", stringify!(contains_block_pointers))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(contains_block_pointers),
"::",
stringify!(val)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).ptr_val) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(contains_block_pointers),
"::",
stringify!(ptr_val)
)
);
}
impl Default for contains_block_pointers {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
+20 -6
View File
@@ -1,11 +1,25 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct BrowsingContext {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of BrowsingContext"][::std::mem::size_of::<BrowsingContext>() - 1usize];
["Alignment of BrowsingContext"][::std::mem::align_of::<BrowsingContext>() - 1usize];
};
#[test]
fn bindgen_test_layout_BrowsingContext() {
assert_eq!(
::std::mem::size_of::<BrowsingContext>(),
1usize,
concat!("Size of: ", stringify!(BrowsingContext))
);
assert_eq!(
::std::mem::align_of::<BrowsingContext>(),
1usize,
concat!("Alignment of ", stringify!(BrowsingContext))
);
}
+7 -1
View File
@@ -1,2 +1,8 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
pub type std_make_integer_sequence = u8;
+20 -6
View File
@@ -1,9 +1,23 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Foo {}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Foo"][::std::mem::size_of::<Foo>() - 0usize];
["Alignment of Foo"][::std::mem::align_of::<Foo>() - 1usize];
};
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(
::std::mem::size_of::<Foo>(),
0usize,
concat!("Size of: ", stringify!(Foo))
);
assert_eq!(
::std::mem::align_of::<Foo>(),
1usize,
concat!("Alignment of ", stringify!(Foo))
);
}
@@ -1,10 +0,0 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
extern "C-unwind" {
pub fn foo();
}
extern "C-unwind" {
pub fn bar();
}
extern "C" {
pub fn baz();
}
+69 -14
View File
@@ -1,15 +1,41 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct struct_a {
pub a: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of struct_a"][::std::mem::size_of::<struct_a>() - 4usize];
["Alignment of struct_a"][::std::mem::align_of::<struct_a>() - 4usize];
["Offset of field: struct_a::a"][::std::mem::offset_of!(struct_a, a) - 0usize];
};
#[test]
fn bindgen_test_layout_struct_a() {
const UNINIT: ::std::mem::MaybeUninit<struct_a> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<struct_a>(),
4usize,
concat!("Size of: ", stringify!(struct_a))
);
assert_eq!(
::std::mem::align_of::<struct_a>(),
4usize,
concat!("Alignment of ", stringify!(struct_a))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(struct_a),
"::",
stringify!(a)
)
);
}
pub type a = *const struct_a;
#[repr(C)]
#[derive(Copy, Clone)]
@@ -17,13 +43,42 @@ pub union union_b {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of union_b"][::std::mem::size_of::<union_b>() - 4usize];
["Alignment of union_b"][::std::mem::align_of::<union_b>() - 4usize];
["Offset of field: union_b::a"][::std::mem::offset_of!(union_b, a) - 0usize];
["Offset of field: union_b::b"][::std::mem::offset_of!(union_b, b) - 0usize];
};
#[test]
fn bindgen_test_layout_union_b() {
const UNINIT: ::std::mem::MaybeUninit<union_b> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<union_b>(),
4usize,
concat!("Size of: ", stringify!(union_b))
);
assert_eq!(
::std::mem::align_of::<union_b>(),
4usize,
concat!("Alignment of ", stringify!(union_b))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(union_b),
"::",
stringify!(a)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(union_b),
"::",
stringify!(b)
)
);
}
impl Default for union_b {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -1,30 +0,0 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![cfg(not(test))]
#[repr(C)]
#[derive(Default, Copy, Clone)]
pub struct JNINativeInterface_ {
pub GetVersion: ::std::option::Option<
unsafe extern "stdcall" fn(
env: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int,
>,
pub __hack: ::std::os::raw::c_ulonglong,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of JNINativeInterface_",
][::std::mem::size_of::<JNINativeInterface_>() - 16usize];
[
"Alignment of JNINativeInterface_",
][::std::mem::align_of::<JNINativeInterface_>() - 8usize];
[
"Offset of field: JNINativeInterface_::GetVersion",
][::std::mem::offset_of!(JNINativeInterface_, GetVersion) - 0usize];
[
"Offset of field: JNINativeInterface_::__hack",
][::std::mem::offset_of!(JNINativeInterface_, __hack) - 8usize];
};
extern "stdcall" {
pub fn bar();
}
+7 -1
View File
@@ -1,5 +1,11 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#![cfg(not(test))]
pub type void_fn = ::std::option::Option<unsafe extern "stdcall" fn()>;
pub type fn_ = ::std::option::Option<
unsafe extern "stdcall" fn(id: ::std::os::raw::c_int) -> void_fn,
+140 -52
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct ClassA {
@@ -7,8 +13,8 @@ pub struct ClassA {
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ClassA_ClassAInner<T> {
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
pub x: *mut T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
}
impl<T> Default for ClassA_ClassAInner<T> {
fn default() -> Self {
@@ -76,11 +82,19 @@ impl Default for ClassC_ClassCInnerCRTP {
pub struct ClassD {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of ClassD"][::std::mem::size_of::<ClassD>() - 1usize];
["Alignment of ClassD"][::std::mem::align_of::<ClassD>() - 1usize];
};
#[test]
fn bindgen_test_layout_ClassD() {
assert_eq!(
::std::mem::size_of::<ClassD>(),
1usize,
concat!("Size of: ", stringify!(ClassD))
);
assert_eq!(
::std::mem::align_of::<ClassD>(),
1usize,
concat!("Alignment of ", stringify!(ClassD))
);
}
impl Default for ClassD {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -90,25 +104,38 @@ impl Default for ClassD {
}
}
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of template specialization: ClassB_open0_ClassD_ClassCInnerCRTP_close0",
][::std::mem::size_of::<ClassB>() - 1usize];
[
"Align of template specialization: ClassB_open0_ClassD_ClassCInnerCRTP_close0",
][::std::mem::align_of::<ClassB>() - 1usize];
};
#[test]
fn __bindgen_test_layout_ClassB_open0_ClassD_ClassCInnerCRTP_close0_instantiation(
) {
assert_eq!(
::std::mem::size_of::<ClassB>(),
1usize,
concat!("Size of template specialization: ", stringify!(ClassB))
);
assert_eq!(
::std::mem::align_of::<ClassB>(),
1usize,
concat!("Alignment of template specialization: ", stringify!(ClassB))
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ClassCInnerCRTP {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of ClassCInnerCRTP"][::std::mem::size_of::<ClassCInnerCRTP>() - 1usize];
["Alignment of ClassCInnerCRTP"][::std::mem::align_of::<ClassCInnerCRTP>() - 1usize];
};
#[test]
fn bindgen_test_layout_ClassCInnerCRTP() {
assert_eq!(
::std::mem::size_of::<ClassCInnerCRTP>(),
1usize,
concat!("Size of: ", stringify!(ClassCInnerCRTP))
);
assert_eq!(
::std::mem::align_of::<ClassCInnerCRTP>(),
1usize,
concat!("Alignment of ", stringify!(ClassCInnerCRTP))
);
}
impl Default for ClassCInnerCRTP {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -118,26 +145,51 @@ impl Default for ClassCInnerCRTP {
}
}
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of template specialization: ClassB_open0_ClassCInnerCRTP_ClassAInner_close0",
][::std::mem::size_of::<ClassB>() - 1usize];
[
"Align of template specialization: ClassB_open0_ClassCInnerCRTP_ClassAInner_close0",
][::std::mem::align_of::<ClassB>() - 1usize];
};
#[test]
fn __bindgen_test_layout_ClassB_open0_ClassCInnerCRTP_ClassAInner_close0_instantiation(
) {
assert_eq!(
::std::mem::size_of::<ClassB>(),
1usize,
concat!("Size of template specialization: ", stringify!(ClassB))
);
assert_eq!(
::std::mem::align_of::<ClassB>(),
1usize,
concat!("Alignment of template specialization: ", stringify!(ClassB))
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ClassAInner {
pub x: *mut ClassCInnerA,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of ClassAInner"][::std::mem::size_of::<ClassAInner>() - 8usize];
["Alignment of ClassAInner"][::std::mem::align_of::<ClassAInner>() - 8usize];
["Offset of field: ClassAInner::x"][::std::mem::offset_of!(ClassAInner, x) - 0usize];
};
#[test]
fn bindgen_test_layout_ClassAInner() {
const UNINIT: ::std::mem::MaybeUninit<ClassAInner> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<ClassAInner>(),
8usize,
concat!("Size of: ", stringify!(ClassAInner))
);
assert_eq!(
::std::mem::align_of::<ClassAInner>(),
8usize,
concat!("Alignment of ", stringify!(ClassAInner))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ClassAInner),
"::",
stringify!(x)
)
);
}
impl Default for ClassAInner {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -152,14 +204,32 @@ impl Default for ClassAInner {
pub struct ClassCInnerA {
pub member: *mut ClassCInnerB,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of ClassCInnerA"][::std::mem::size_of::<ClassCInnerA>() - 8usize];
["Alignment of ClassCInnerA"][::std::mem::align_of::<ClassCInnerA>() - 8usize];
[
"Offset of field: ClassCInnerA::member",
][::std::mem::offset_of!(ClassCInnerA, member) - 0usize];
};
#[test]
fn bindgen_test_layout_ClassCInnerA() {
const UNINIT: ::std::mem::MaybeUninit<ClassCInnerA> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<ClassCInnerA>(),
8usize,
concat!("Size of: ", stringify!(ClassCInnerA))
);
assert_eq!(
::std::mem::align_of::<ClassCInnerA>(),
8usize,
concat!("Alignment of ", stringify!(ClassCInnerA))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ClassCInnerA),
"::",
stringify!(member)
)
);
}
impl Default for ClassCInnerA {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -174,14 +244,32 @@ impl Default for ClassCInnerA {
pub struct ClassCInnerB {
pub cache: *mut ClassCInnerA,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of ClassCInnerB"][::std::mem::size_of::<ClassCInnerB>() - 8usize];
["Alignment of ClassCInnerB"][::std::mem::align_of::<ClassCInnerB>() - 8usize];
[
"Offset of field: ClassCInnerB::cache",
][::std::mem::offset_of!(ClassCInnerB, cache) - 0usize];
};
#[test]
fn bindgen_test_layout_ClassCInnerB() {
const UNINIT: ::std::mem::MaybeUninit<ClassCInnerB> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<ClassCInnerB>(),
8usize,
concat!("Size of: ", stringify!(ClassCInnerB))
);
assert_eq!(
::std::mem::align_of::<ClassCInnerB>(),
8usize,
concat!("Alignment of ", stringify!(ClassCInnerB))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).cache) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ClassCInnerB),
"::",
stringify!(cache)
)
);
}
impl Default for ClassCInnerB {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
@@ -1,14 +1,28 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Bar {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Bar"][::std::mem::size_of::<Bar>() - 1usize];
["Alignment of Bar"][::std::mem::align_of::<Bar>() - 1usize];
};
#[test]
fn bindgen_test_layout_Bar() {
assert_eq!(
::std::mem::size_of::<Bar>(),
1usize,
concat!("Size of: ", stringify!(Bar))
);
assert_eq!(
::std::mem::align_of::<Bar>(),
1usize,
concat!("Alignment of ", stringify!(Bar))
);
}
extern "C" {
#[link_name = "\u{1}_Z3bazPN3foo3BarE"]
pub fn baz(arg1: *mut Bar);
+88 -18
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
pub type Char = ::std::os::raw::c_char;
pub type SChar = ::std::os::raw::c_schar;
pub type UChar = ::std::os::raw::c_uchar;
@@ -18,20 +24,84 @@ pub struct Test {
pub Ccu: UChar,
pub Ccd: SChar,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of Test"][::std::mem::size_of::<Test>() - 12usize];
["Alignment of Test"][::std::mem::align_of::<Test>() - 1usize];
["Offset of field: Test::ch"][::std::mem::offset_of!(Test, ch) - 0usize];
["Offset of field: Test::u"][::std::mem::offset_of!(Test, u) - 1usize];
["Offset of field: Test::d"][::std::mem::offset_of!(Test, d) - 2usize];
["Offset of field: Test::cch"][::std::mem::offset_of!(Test, cch) - 3usize];
["Offset of field: Test::cu"][::std::mem::offset_of!(Test, cu) - 4usize];
["Offset of field: Test::cd"][::std::mem::offset_of!(Test, cd) - 5usize];
["Offset of field: Test::Cch"][::std::mem::offset_of!(Test, Cch) - 6usize];
["Offset of field: Test::Cu"][::std::mem::offset_of!(Test, Cu) - 7usize];
["Offset of field: Test::Cd"][::std::mem::offset_of!(Test, Cd) - 8usize];
["Offset of field: Test::Ccch"][::std::mem::offset_of!(Test, Ccch) - 9usize];
["Offset of field: Test::Ccu"][::std::mem::offset_of!(Test, Ccu) - 10usize];
["Offset of field: Test::Ccd"][::std::mem::offset_of!(Test, Ccd) - 11usize];
};
#[test]
fn bindgen_test_layout_Test() {
const UNINIT: ::std::mem::MaybeUninit<Test> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<Test>(),
12usize,
concat!("Size of: ", stringify!(Test))
);
assert_eq!(
::std::mem::align_of::<Test>(),
1usize,
concat!("Alignment of ", stringify!(Test))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).ch) as usize - ptr as usize },
0usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(ch))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize },
1usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(u))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize },
2usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(d))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).cch) as usize - ptr as usize },
3usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(cch))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).cu) as usize - ptr as usize },
4usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(cu))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).cd) as usize - ptr as usize },
5usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(cd))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).Cch) as usize - ptr as usize },
6usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cch))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).Cu) as usize - ptr as usize },
7usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cu))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).Cd) as usize - ptr as usize },
8usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cd))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).Ccch) as usize - ptr as usize },
9usize,
concat!(
"Offset of field: ",
stringify!(Test),
"::",
stringify!(Ccch)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).Ccu) as usize - ptr as usize },
10usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccu))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).Ccd) as usize - ptr as usize },
11usize,
concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccd))
);
}
+158 -139
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Default)]
pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>, [T; 0]);
@@ -37,19 +43,35 @@ pub struct C {
}
#[test]
fn bindgen_test_layout_C() {
const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<C> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(::std::mem::size_of::<C>(), 40usize, "Size of C");
assert_eq!(::std::mem::align_of::<C>(), 4usize, "Alignment of C");
assert_eq!(
::std::mem::size_of::<C>(),
40usize,
concat!("Size of: ", stringify!(C))
);
assert_eq!(
::std::mem::align_of::<C>(),
4usize,
concat!("Alignment of ", stringify!(C))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C::a",
concat!("Offset of field: ", stringify!(C), "::", stringify!(a))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize },
unsafe {
::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
},
4usize,
"Offset of field: C::big_array",
concat!(
"Offset of field: ",
stringify!(C),
"::",
stringify!(big_array)
)
);
}
impl Default for C {
@@ -69,34 +91,53 @@ pub struct C_with_zero_length_array {
}
#[test]
fn bindgen_test_layout_C_with_zero_length_array() {
const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<C_with_zero_length_array>(),
40usize,
"Size of C_with_zero_length_array",
concat!("Size of: ", stringify!(C_with_zero_length_array))
);
assert_eq!(
::std::mem::align_of::<C_with_zero_length_array>(),
4usize,
"Alignment of C_with_zero_length_array",
concat!("Alignment of ", stringify!(C_with_zero_length_array))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C_with_zero_length_array::a",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize },
4usize,
"Offset of field: C_with_zero_length_array::big_array",
concat!(
"Offset of field: ",
stringify!(C_with_zero_length_array),
"::",
stringify!(a)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize
::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
},
4usize,
concat!(
"Offset of field: ",
stringify!(C_with_zero_length_array),
"::",
stringify!(big_array)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
ptr as usize
},
37usize,
"Offset of field: C_with_zero_length_array::zero_length_array",
concat!(
"Offset of field: ",
stringify!(C_with_zero_length_array),
"::",
stringify!(zero_length_array)
)
);
}
impl Default for C_with_zero_length_array {
@@ -116,29 +157,41 @@ pub struct C_with_zero_length_array_2 {
}
#[test]
fn bindgen_test_layout_C_with_zero_length_array_2() {
const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array_2> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array_2> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<C_with_zero_length_array_2>(),
4usize,
"Size of C_with_zero_length_array_2",
concat!("Size of: ", stringify!(C_with_zero_length_array_2))
);
assert_eq!(
::std::mem::align_of::<C_with_zero_length_array_2>(),
4usize,
"Alignment of C_with_zero_length_array_2",
concat!("Alignment of ", stringify!(C_with_zero_length_array_2))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C_with_zero_length_array_2::a",
concat!(
"Offset of field: ",
stringify!(C_with_zero_length_array_2),
"::",
stringify!(a)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize
::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
ptr as usize
},
4usize,
"Offset of field: C_with_zero_length_array_2::zero_length_array",
concat!(
"Offset of field: ",
stringify!(C_with_zero_length_array_2),
"::",
stringify!(zero_length_array)
)
);
}
#[repr(C)]
@@ -149,32 +202,15 @@ pub struct C_with_incomplete_array {
}
#[test]
fn bindgen_test_layout_C_with_incomplete_array() {
const UNINIT: ::std::mem::MaybeUninit<C_with_incomplete_array> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<C_with_incomplete_array>(),
40usize,
"Size of C_with_incomplete_array",
concat!("Size of: ", stringify!(C_with_incomplete_array))
);
assert_eq!(
::std::mem::align_of::<C_with_incomplete_array>(),
4usize,
"Alignment of C_with_incomplete_array",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C_with_incomplete_array::a",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize },
4usize,
"Offset of field: C_with_incomplete_array::big_array",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize },
37usize,
"Offset of field: C_with_incomplete_array::incomplete_array",
concat!("Alignment of ", stringify!(C_with_incomplete_array))
);
}
impl Default for C_with_incomplete_array {
@@ -194,27 +230,15 @@ pub struct C_with_incomplete_array_2 {
}
#[test]
fn bindgen_test_layout_C_with_incomplete_array_2() {
const UNINIT: ::std::mem::MaybeUninit<C_with_incomplete_array_2> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<C_with_incomplete_array_2>(),
4usize,
"Size of C_with_incomplete_array_2",
concat!("Size of: ", stringify!(C_with_incomplete_array_2))
);
assert_eq!(
::std::mem::align_of::<C_with_incomplete_array_2>(),
4usize,
"Alignment of C_with_incomplete_array_2",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C_with_incomplete_array_2::a",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize },
4usize,
"Offset of field: C_with_incomplete_array_2::incomplete_array",
concat!("Alignment of ", stringify!(C_with_incomplete_array_2))
);
}
#[repr(C)]
@@ -226,41 +250,21 @@ pub struct C_with_zero_length_array_and_incomplete_array {
}
#[test]
fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() {
const UNINIT: ::std::mem::MaybeUninit<
C_with_zero_length_array_and_incomplete_array,
> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array>(),
40usize,
"Size of C_with_zero_length_array_and_incomplete_array",
concat!(
"Size of: ",
stringify!(C_with_zero_length_array_and_incomplete_array)
)
);
assert_eq!(
::std::mem::align_of::<C_with_zero_length_array_and_incomplete_array>(),
4usize,
"Alignment of C_with_zero_length_array_and_incomplete_array",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array::a",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize },
4usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array::big_array",
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize
},
37usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array::zero_length_array",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize },
37usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array::incomplete_array",
concat!(
"Alignment of ",
stringify!(C_with_zero_length_array_and_incomplete_array)
)
);
}
impl Default for C_with_zero_length_array_and_incomplete_array {
@@ -281,36 +285,23 @@ pub struct C_with_zero_length_array_and_incomplete_array_2 {
}
#[test]
fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() {
const UNINIT: ::std::mem::MaybeUninit<
C_with_zero_length_array_and_incomplete_array_2,
> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array_2>(),
::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array_2>(
),
4usize,
"Size of C_with_zero_length_array_and_incomplete_array_2",
concat!(
"Size of: ",
stringify!(C_with_zero_length_array_and_incomplete_array_2)
)
);
assert_eq!(
::std::mem::align_of::<C_with_zero_length_array_and_incomplete_array_2>(),
::std::mem::align_of::<C_with_zero_length_array_and_incomplete_array_2>(
),
4usize,
"Alignment of C_with_zero_length_array_and_incomplete_array_2",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array_2::a",
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize
},
4usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array_2::zero_length_array",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize },
4usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array_2::incomplete_array",
concat!(
"Alignment of ",
stringify!(C_with_zero_length_array_and_incomplete_array_2)
)
);
}
#[repr(C)]
@@ -320,14 +311,28 @@ pub struct WithDtor {
}
#[test]
fn bindgen_test_layout_WithDtor() {
const UNINIT: ::std::mem::MaybeUninit<WithDtor> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<WithDtor> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(::std::mem::size_of::<WithDtor>(), 4usize, "Size of WithDtor");
assert_eq!(::std::mem::align_of::<WithDtor>(), 4usize, "Alignment of WithDtor");
assert_eq!(
::std::mem::size_of::<WithDtor>(),
4usize,
concat!("Size of: ", stringify!(WithDtor))
);
assert_eq!(
::std::mem::align_of::<WithDtor>(),
4usize,
concat!("Alignment of ", stringify!(WithDtor))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize },
0usize,
"Offset of field: WithDtor::b",
concat!(
"Offset of field: ",
stringify!(WithDtor),
"::",
stringify!(b)
)
);
}
#[repr(C)]
@@ -337,27 +342,15 @@ pub struct IncompleteArrayNonCopiable {
}
#[test]
fn bindgen_test_layout_IncompleteArrayNonCopiable() {
const UNINIT: ::std::mem::MaybeUninit<IncompleteArrayNonCopiable> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<IncompleteArrayNonCopiable>(),
8usize,
"Size of IncompleteArrayNonCopiable",
concat!("Size of: ", stringify!(IncompleteArrayNonCopiable))
);
assert_eq!(
::std::mem::align_of::<IncompleteArrayNonCopiable>(),
8usize,
"Alignment of IncompleteArrayNonCopiable",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).whatever) as usize - ptr as usize },
0usize,
"Offset of field: IncompleteArrayNonCopiable::whatever",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize },
8usize,
"Offset of field: IncompleteArrayNonCopiable::incomplete_array",
concat!("Alignment of ", stringify!(IncompleteArrayNonCopiable))
);
}
impl Default for IncompleteArrayNonCopiable {
@@ -377,19 +370,28 @@ pub union Union {
}
#[test]
fn bindgen_test_layout_Union() {
const UNINIT: ::std::mem::MaybeUninit<Union> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<Union> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(::std::mem::size_of::<Union>(), 4usize, "Size of Union");
assert_eq!(::std::mem::align_of::<Union>(), 4usize, "Alignment of Union");
assert_eq!(
::std::mem::size_of::<Union>(),
4usize,
concat!("Size of: ", stringify!(Union))
);
assert_eq!(
::std::mem::align_of::<Union>(),
4usize,
concat!("Alignment of ", stringify!(Union))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize },
0usize,
"Offset of field: Union::d",
concat!("Offset of field: ", stringify!(Union), "::", stringify!(d))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize },
0usize,
"Offset of field: Union::i",
concat!("Offset of field: ", stringify!(Union), "::", stringify!(i))
);
}
impl Default for Union {
@@ -408,14 +410,28 @@ pub struct WithUnion {
}
#[test]
fn bindgen_test_layout_WithUnion() {
const UNINIT: ::std::mem::MaybeUninit<WithUnion> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<WithUnion> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(::std::mem::size_of::<WithUnion>(), 4usize, "Size of WithUnion");
assert_eq!(::std::mem::align_of::<WithUnion>(), 4usize, "Alignment of WithUnion");
assert_eq!(
::std::mem::size_of::<WithUnion>(),
4usize,
concat!("Size of: ", stringify!(WithUnion))
);
assert_eq!(
::std::mem::align_of::<WithUnion>(),
4usize,
concat!("Alignment of ", stringify!(WithUnion))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
"Offset of field: WithUnion::data",
concat!(
"Offset of field: ",
stringify!(WithUnion),
"::",
stringify!(data)
)
);
}
impl Default for WithUnion {
@@ -437,12 +453,15 @@ fn bindgen_test_layout_RealAbstractionWithTonsOfMethods() {
assert_eq!(
::std::mem::size_of::<RealAbstractionWithTonsOfMethods>(),
1usize,
"Size of RealAbstractionWithTonsOfMethods",
concat!("Size of: ", stringify!(RealAbstractionWithTonsOfMethods))
);
assert_eq!(
::std::mem::align_of::<RealAbstractionWithTonsOfMethods>(),
1usize,
"Alignment of RealAbstractionWithTonsOfMethods",
concat!(
"Alignment of ",
stringify!(RealAbstractionWithTonsOfMethods)
)
);
}
extern "C" {
+159 -140
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Default)]
pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>, [T; 0]);
@@ -54,7 +60,7 @@ impl<T> ::std::default::Default for __BindgenUnionField<T> {
impl<T> ::std::clone::Clone for __BindgenUnionField<T> {
#[inline]
fn clone(&self) -> Self {
*self
Self::new()
}
}
impl<T> ::std::marker::Copy for __BindgenUnionField<T> {}
@@ -80,19 +86,35 @@ pub struct C {
}
#[test]
fn bindgen_test_layout_C() {
const UNINIT: ::std::mem::MaybeUninit<C> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<C> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(::std::mem::size_of::<C>(), 40usize, "Size of C");
assert_eq!(::std::mem::align_of::<C>(), 4usize, "Alignment of C");
assert_eq!(
::std::mem::size_of::<C>(),
40usize,
concat!("Size of: ", stringify!(C))
);
assert_eq!(
::std::mem::align_of::<C>(),
4usize,
concat!("Alignment of ", stringify!(C))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C::a",
concat!("Offset of field: ", stringify!(C), "::", stringify!(a))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize },
unsafe {
::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
},
4usize,
"Offset of field: C::big_array",
concat!(
"Offset of field: ",
stringify!(C),
"::",
stringify!(big_array)
)
);
}
impl Clone for C {
@@ -122,34 +144,53 @@ pub struct C_with_zero_length_array {
}
#[test]
fn bindgen_test_layout_C_with_zero_length_array() {
const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<C_with_zero_length_array>(),
40usize,
"Size of C_with_zero_length_array",
concat!("Size of: ", stringify!(C_with_zero_length_array))
);
assert_eq!(
::std::mem::align_of::<C_with_zero_length_array>(),
4usize,
"Alignment of C_with_zero_length_array",
concat!("Alignment of ", stringify!(C_with_zero_length_array))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C_with_zero_length_array::a",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize },
4usize,
"Offset of field: C_with_zero_length_array::big_array",
concat!(
"Offset of field: ",
stringify!(C_with_zero_length_array),
"::",
stringify!(a)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize
::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize
},
4usize,
concat!(
"Offset of field: ",
stringify!(C_with_zero_length_array),
"::",
stringify!(big_array)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
ptr as usize
},
37usize,
"Offset of field: C_with_zero_length_array::zero_length_array",
concat!(
"Offset of field: ",
stringify!(C_with_zero_length_array),
"::",
stringify!(zero_length_array)
)
);
}
impl Default for C_with_zero_length_array {
@@ -169,29 +210,41 @@ pub struct C_with_zero_length_array_2 {
}
#[test]
fn bindgen_test_layout_C_with_zero_length_array_2() {
const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array_2> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<C_with_zero_length_array_2> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<C_with_zero_length_array_2>(),
4usize,
"Size of C_with_zero_length_array_2",
concat!("Size of: ", stringify!(C_with_zero_length_array_2))
);
assert_eq!(
::std::mem::align_of::<C_with_zero_length_array_2>(),
4usize,
"Alignment of C_with_zero_length_array_2",
concat!("Alignment of ", stringify!(C_with_zero_length_array_2))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C_with_zero_length_array_2::a",
concat!(
"Offset of field: ",
stringify!(C_with_zero_length_array_2),
"::",
stringify!(a)
)
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize
::std::ptr::addr_of!((*ptr).zero_length_array) as usize -
ptr as usize
},
4usize,
"Offset of field: C_with_zero_length_array_2::zero_length_array",
concat!(
"Offset of field: ",
stringify!(C_with_zero_length_array_2),
"::",
stringify!(zero_length_array)
)
);
}
#[repr(C)]
@@ -202,32 +255,15 @@ pub struct C_with_incomplete_array {
}
#[test]
fn bindgen_test_layout_C_with_incomplete_array() {
const UNINIT: ::std::mem::MaybeUninit<C_with_incomplete_array> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<C_with_incomplete_array>(),
40usize,
"Size of C_with_incomplete_array",
concat!("Size of: ", stringify!(C_with_incomplete_array))
);
assert_eq!(
::std::mem::align_of::<C_with_incomplete_array>(),
4usize,
"Alignment of C_with_incomplete_array",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C_with_incomplete_array::a",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize },
4usize,
"Offset of field: C_with_incomplete_array::big_array",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize },
37usize,
"Offset of field: C_with_incomplete_array::incomplete_array",
concat!("Alignment of ", stringify!(C_with_incomplete_array))
);
}
impl Default for C_with_incomplete_array {
@@ -247,27 +283,15 @@ pub struct C_with_incomplete_array_2 {
}
#[test]
fn bindgen_test_layout_C_with_incomplete_array_2() {
const UNINIT: ::std::mem::MaybeUninit<C_with_incomplete_array_2> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<C_with_incomplete_array_2>(),
4usize,
"Size of C_with_incomplete_array_2",
concat!("Size of: ", stringify!(C_with_incomplete_array_2))
);
assert_eq!(
::std::mem::align_of::<C_with_incomplete_array_2>(),
4usize,
"Alignment of C_with_incomplete_array_2",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C_with_incomplete_array_2::a",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize },
4usize,
"Offset of field: C_with_incomplete_array_2::incomplete_array",
concat!("Alignment of ", stringify!(C_with_incomplete_array_2))
);
}
#[repr(C)]
@@ -279,41 +303,21 @@ pub struct C_with_zero_length_array_and_incomplete_array {
}
#[test]
fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() {
const UNINIT: ::std::mem::MaybeUninit<
C_with_zero_length_array_and_incomplete_array,
> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array>(),
40usize,
"Size of C_with_zero_length_array_and_incomplete_array",
concat!(
"Size of: ",
stringify!(C_with_zero_length_array_and_incomplete_array)
)
);
assert_eq!(
::std::mem::align_of::<C_with_zero_length_array_and_incomplete_array>(),
4usize,
"Alignment of C_with_zero_length_array_and_incomplete_array",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array::a",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).big_array) as usize - ptr as usize },
4usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array::big_array",
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize
},
37usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array::zero_length_array",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize },
37usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array::incomplete_array",
concat!(
"Alignment of ",
stringify!(C_with_zero_length_array_and_incomplete_array)
)
);
}
impl Default for C_with_zero_length_array_and_incomplete_array {
@@ -334,36 +338,23 @@ pub struct C_with_zero_length_array_and_incomplete_array_2 {
}
#[test]
fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() {
const UNINIT: ::std::mem::MaybeUninit<
C_with_zero_length_array_and_incomplete_array_2,
> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array_2>(),
::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array_2>(
),
4usize,
"Size of C_with_zero_length_array_and_incomplete_array_2",
concat!(
"Size of: ",
stringify!(C_with_zero_length_array_and_incomplete_array_2)
)
);
assert_eq!(
::std::mem::align_of::<C_with_zero_length_array_and_incomplete_array_2>(),
::std::mem::align_of::<C_with_zero_length_array_and_incomplete_array_2>(
),
4usize,
"Alignment of C_with_zero_length_array_and_incomplete_array_2",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
0usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array_2::a",
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).zero_length_array) as usize - ptr as usize
},
4usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array_2::zero_length_array",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize },
4usize,
"Offset of field: C_with_zero_length_array_and_incomplete_array_2::incomplete_array",
concat!(
"Alignment of ",
stringify!(C_with_zero_length_array_and_incomplete_array_2)
)
);
}
#[repr(C)]
@@ -373,14 +364,28 @@ pub struct WithDtor {
}
#[test]
fn bindgen_test_layout_WithDtor() {
const UNINIT: ::std::mem::MaybeUninit<WithDtor> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<WithDtor> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(::std::mem::size_of::<WithDtor>(), 4usize, "Size of WithDtor");
assert_eq!(::std::mem::align_of::<WithDtor>(), 4usize, "Alignment of WithDtor");
assert_eq!(
::std::mem::size_of::<WithDtor>(),
4usize,
concat!("Size of: ", stringify!(WithDtor))
);
assert_eq!(
::std::mem::align_of::<WithDtor>(),
4usize,
concat!("Alignment of ", stringify!(WithDtor))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize },
0usize,
"Offset of field: WithDtor::b",
concat!(
"Offset of field: ",
stringify!(WithDtor),
"::",
stringify!(b)
)
);
}
#[repr(C)]
@@ -390,27 +395,15 @@ pub struct IncompleteArrayNonCopiable {
}
#[test]
fn bindgen_test_layout_IncompleteArrayNonCopiable() {
const UNINIT: ::std::mem::MaybeUninit<IncompleteArrayNonCopiable> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<IncompleteArrayNonCopiable>(),
8usize,
"Size of IncompleteArrayNonCopiable",
concat!("Size of: ", stringify!(IncompleteArrayNonCopiable))
);
assert_eq!(
::std::mem::align_of::<IncompleteArrayNonCopiable>(),
8usize,
"Alignment of IncompleteArrayNonCopiable",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).whatever) as usize - ptr as usize },
0usize,
"Offset of field: IncompleteArrayNonCopiable::whatever",
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).incomplete_array) as usize - ptr as usize },
8usize,
"Offset of field: IncompleteArrayNonCopiable::incomplete_array",
concat!("Alignment of ", stringify!(IncompleteArrayNonCopiable))
);
}
impl Default for IncompleteArrayNonCopiable {
@@ -431,19 +424,28 @@ pub struct Union {
}
#[test]
fn bindgen_test_layout_Union() {
const UNINIT: ::std::mem::MaybeUninit<Union> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<Union> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(::std::mem::size_of::<Union>(), 4usize, "Size of Union");
assert_eq!(::std::mem::align_of::<Union>(), 4usize, "Alignment of Union");
assert_eq!(
::std::mem::size_of::<Union>(),
4usize,
concat!("Size of: ", stringify!(Union))
);
assert_eq!(
::std::mem::align_of::<Union>(),
4usize,
concat!("Alignment of ", stringify!(Union))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).d) as usize - ptr as usize },
0usize,
"Offset of field: Union::d",
concat!("Offset of field: ", stringify!(Union), "::", stringify!(d))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).i) as usize - ptr as usize },
0usize,
"Offset of field: Union::i",
concat!("Offset of field: ", stringify!(Union), "::", stringify!(i))
);
}
impl Clone for Union {
@@ -458,14 +460,28 @@ pub struct WithUnion {
}
#[test]
fn bindgen_test_layout_WithUnion() {
const UNINIT: ::std::mem::MaybeUninit<WithUnion> = ::std::mem::MaybeUninit::uninit();
const UNINIT: ::std::mem::MaybeUninit<WithUnion> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(::std::mem::size_of::<WithUnion>(), 4usize, "Size of WithUnion");
assert_eq!(::std::mem::align_of::<WithUnion>(), 4usize, "Alignment of WithUnion");
assert_eq!(
::std::mem::size_of::<WithUnion>(),
4usize,
concat!("Size of: ", stringify!(WithUnion))
);
assert_eq!(
::std::mem::align_of::<WithUnion>(),
4usize,
concat!("Alignment of ", stringify!(WithUnion))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
"Offset of field: WithUnion::data",
concat!(
"Offset of field: ",
stringify!(WithUnion),
"::",
stringify!(data)
)
);
}
impl Clone for WithUnion {
@@ -483,12 +499,15 @@ fn bindgen_test_layout_RealAbstractionWithTonsOfMethods() {
assert_eq!(
::std::mem::size_of::<RealAbstractionWithTonsOfMethods>(),
1usize,
"Size of RealAbstractionWithTonsOfMethods",
concat!("Size of: ", stringify!(RealAbstractionWithTonsOfMethods))
);
assert_eq!(
::std::mem::align_of::<RealAbstractionWithTonsOfMethods>(),
1usize,
"Alignment of RealAbstractionWithTonsOfMethods",
concat!(
"Alignment of ",
stringify!(RealAbstractionWithTonsOfMethods)
)
);
}
extern "C" {
+127 -37
View File
@@ -1,4 +1,10 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct A {
@@ -9,17 +15,39 @@ pub struct A {
pub struct A_B {
pub member_b: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of A_B"][::std::mem::size_of::<A_B>() - 4usize];
["Alignment of A_B"][::std::mem::align_of::<A_B>() - 4usize];
["Offset of field: A_B::member_b"][::std::mem::offset_of!(A_B, member_b) - 0usize];
};
#[test]
fn bindgen_test_layout_A_B() {
const UNINIT: ::std::mem::MaybeUninit<A_B> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<A_B>(),
4usize,
concat!("Size of: ", stringify!(A_B))
);
assert_eq!(
::std::mem::align_of::<A_B>(),
4usize,
concat!("Alignment of ", stringify!(A_B))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).member_b) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(A_B),
"::",
stringify!(member_b)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct A_D<T> {
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
pub foo: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
}
impl<T> Default for A_D<T> {
fn default() -> Self {
@@ -30,35 +58,82 @@ impl<T> Default for A_D<T> {
}
}
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of A"][::std::mem::size_of::<A>() - 4usize];
["Alignment of A"][::std::mem::align_of::<A>() - 4usize];
["Offset of field: A::member_a"][::std::mem::offset_of!(A, member_a) - 0usize];
};
#[test]
fn bindgen_test_layout_A() {
const UNINIT: ::std::mem::MaybeUninit<A> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<A>(),
4usize,
concat!("Size of: ", stringify!(A))
);
assert_eq!(
::std::mem::align_of::<A>(),
4usize,
concat!("Alignment of ", stringify!(A))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).member_a) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(A),
"::",
stringify!(member_a)
)
);
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct A_C {
pub baz: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of A_C"][::std::mem::size_of::<A_C>() - 4usize];
["Alignment of A_C"][::std::mem::align_of::<A_C>() - 4usize];
["Offset of field: A_C::baz"][::std::mem::offset_of!(A_C, baz) - 0usize];
};
#[test]
fn bindgen_test_layout_A_C() {
const UNINIT: ::std::mem::MaybeUninit<A_C> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<A_C>(),
4usize,
concat!("Size of: ", stringify!(A_C))
);
assert_eq!(
::std::mem::align_of::<A_C>(),
4usize,
concat!("Alignment of ", stringify!(A_C))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).baz) as usize - ptr as usize },
0usize,
concat!("Offset of field: ", stringify!(A_C), "::", stringify!(baz))
);
}
extern "C" {
pub static mut var: A_B;
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of template specialization: A_D_open0_int_close0",
][::std::mem::size_of::<A_D<::std::os::raw::c_int>>() - 4usize];
[
"Align of template specialization: A_D_open0_int_close0",
][::std::mem::align_of::<A_D<::std::os::raw::c_int>>() - 4usize];
};
#[test]
fn __bindgen_test_layout_A_D_open0_int_close0_instantiation() {
assert_eq!(
::std::mem::size_of::<A_D<::std::os::raw::c_int>>(),
4usize,
concat!(
"Size of template specialization: ",
stringify!(A_D<::std::os::raw::c_int>)
)
);
assert_eq!(
::std::mem::align_of::<A_D<::std::os::raw::c_int>>(),
4usize,
concat!(
"Alignment of template specialization: ",
stringify!(A_D<::std::os::raw::c_int>)
)
);
}
extern "C" {
pub static mut baz: A_D<::std::os::raw::c_int>;
}
@@ -67,23 +142,38 @@ extern "C" {
pub struct D {
pub member: A_B,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of D"][::std::mem::size_of::<D>() - 4usize];
["Alignment of D"][::std::mem::align_of::<D>() - 4usize];
["Offset of field: D::member"][::std::mem::offset_of!(D, member) - 0usize];
};
#[test]
fn bindgen_test_layout_D() {
const UNINIT: ::std::mem::MaybeUninit<D> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<D>(),
4usize,
concat!("Size of: ", stringify!(D))
);
assert_eq!(
::std::mem::align_of::<D>(),
4usize,
concat!("Alignment of ", stringify!(D))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).member) as usize - ptr as usize },
0usize,
concat!("Offset of field: ", stringify!(D), "::", stringify!(member))
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Templated<T> {
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
pub member: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
}
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Templated_Templated_inner<T> {
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
pub member_ptr: *mut T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
}
impl<T> Default for Templated_Templated_inner<T> {
fn default() -> Self {
+61 -23
View File
@@ -1,38 +1,76 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct whatever {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of whatever"][::std::mem::size_of::<whatever>() - 1usize];
["Alignment of whatever"][::std::mem::align_of::<whatever>() - 1usize];
};
#[test]
fn bindgen_test_layout_whatever() {
assert_eq!(
::std::mem::size_of::<whatever>(),
1usize,
concat!("Size of: ", stringify!(whatever))
);
assert_eq!(
::std::mem::align_of::<whatever>(),
1usize,
concat!("Alignment of ", stringify!(whatever))
);
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct whatever_child {
pub _address: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of whatever_child"][::std::mem::size_of::<whatever_child>() - 1usize];
["Alignment of whatever_child"][::std::mem::align_of::<whatever_child>() - 1usize];
};
#[test]
fn bindgen_test_layout_whatever_child() {
assert_eq!(
::std::mem::size_of::<whatever_child>(),
1usize,
concat!("Size of: ", stringify!(whatever_child))
);
assert_eq!(
::std::mem::align_of::<whatever_child>(),
1usize,
concat!("Alignment of ", stringify!(whatever_child))
);
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
pub struct whatever_child_with_member {
pub m_member: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
[
"Size of whatever_child_with_member",
][::std::mem::size_of::<whatever_child_with_member>() - 4usize];
[
"Alignment of whatever_child_with_member",
][::std::mem::align_of::<whatever_child_with_member>() - 4usize];
[
"Offset of field: whatever_child_with_member::m_member",
][::std::mem::offset_of!(whatever_child_with_member, m_member) - 0usize];
};
#[test]
fn bindgen_test_layout_whatever_child_with_member() {
const UNINIT: ::std::mem::MaybeUninit<whatever_child_with_member> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<whatever_child_with_member>(),
4usize,
concat!("Size of: ", stringify!(whatever_child_with_member))
);
assert_eq!(
::std::mem::align_of::<whatever_child_with_member>(),
4usize,
concat!("Alignment of ", stringify!(whatever_child_with_member))
);
assert_eq!(
unsafe {
::std::ptr::addr_of!((*ptr).m_member) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(whatever_child_with_member),
"::",
stringify!(m_member)
)
);
}

Some files were not shown because too many files have changed in this diff Show More