Skip to content

Commit 0c98c3d

Browse files
committed
Rename whitelist -> allowlist and blacklist -> blocklist
For the commandline arguments I added undocumented aliases to old flags, to stay backwards compatible.
1 parent b1c4178 commit 0c98c3d

File tree

95 files changed

+829
-692
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+829
-692
lines changed

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,42 @@
127127

128128
## Deprecated
129129

130+
* `bindgen::Builder::whitelist_type` is deprecated in favor of
131+
`bindgen::Builder::allowlist_type`. [#1812][]
132+
133+
* `bindgen::Builder::whitelist_function` is deprecated in favor of
134+
`bindgen::Builder::allowlist_function`. [#1812][]
135+
136+
* `bindgen::Builder::whitelist_var` is deprecated in favor of
137+
`bindgen::Builder::allowlist_var`. [#1812][]
138+
139+
* `--whitelist-type` is deprecated in favor of
140+
`--allowlist-type`. [#1812][]
141+
142+
* `--whitelist-function` is deprecated in favor of
143+
`--allowlist-function`. [#1812][]
144+
145+
* `--whitelist-var` is deprecated in favor of
146+
`--allowlist-var`. [#1812][]
147+
148+
* `bindgen::Builder::blacklist_type` is deprecated in favor of
149+
`bindgen::Builder::blocklist_type`. [#1812][]
150+
151+
* `bindgen::Builder::blacklist_function` is deprecated in favor of
152+
`bindgen::Builder::blocklist_function`. [#1812][]
153+
154+
* `bindgen::Builder::blacklist_item` is deprecated in favor of
155+
`bindgen::Builder::blocklist_item`. [#1812][]
156+
157+
* `--blacklist-type` is deprecated in favor of
158+
`--blocklist-type`. [#1812][]
159+
160+
* `--blacklist-function` is deprecated in favor of
161+
`--blocklist-function`. [#1812][]
162+
163+
* `--blacklist-item` is deprecated in favor of
164+
`--blocklist-item`. [#1812][]
165+
130166
## Removed
131167

132168
## Fixed

bindgen-integration/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ fn main() {
160160
seen_hellos: Mutex::new(0),
161161
seen_funcs: Mutex::new(0),
162162
}))
163-
.blacklist_function("my_prefixed_function_to_remove")
163+
.blocklist_function("my_prefixed_function_to_remove")
164164
.constified_enum("my_prefixed_enum_to_be_constified")
165165
.opaque_type("my_prefixed_templated_foo<my_prefixed_baz>")
166166
.generate()

book/src/SUMMARY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
- [Publish Your Crate!](./tutorial-6.md)
1313
- [Command Line Usage](./command-line-usage.md)
1414
- [Customizing the Generated Bindings](./customizing-generated-bindings.md)
15-
- [Whitelisting](./whitelisting.md)
16-
- [Blacklisting](./blacklisting.md)
15+
- [Allowlisting](./allowlisting.md)
16+
- [Blocklisting](./blocklisting.md)
1717
- [Treating a Type as an Opaque Blob of Bytes](./opaque.md)
1818
- [Replacing One Type with Another](./replacing-types.md)
1919
- [Preventing the Derivation of `Copy` and `Clone`](./nocopy.md)

book/src/allowlisting.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Allowlisting
2+
3+
Allowlisting allows us to be precise about which type, function, and global
4+
variable definitions `bindgen` generates bindings for. By default, if we don't
5+
specify any allowlisting rules, everything is considered allowlisted. This may
6+
not be desirable because of either
7+
8+
* the generated bindings contain a lot of extra definitions we don't plan on using, or
9+
* the header file contains C++ features for which Rust does not have a
10+
corresponding form (such as partial template specialization), and we would
11+
like to avoid these definitions
12+
13+
If we specify allowlisting rules, then `bindgen` will only generate bindings to
14+
types, functions, and global variables that match the allowlisting rules, or are
15+
transitively used by a definition that matches them.
16+
17+
### Library
18+
19+
* [`bindgen::Builder::allowlist_type`](https://docs.rs/bindgen/0.23.1/bindgen/struct.Builder.html#method.allowlist_type)
20+
* [`bindgen::Builder::allowlist_function`](https://docs.rs/bindgen/0.23.1/bindgen/struct.Builder.html#method.allowlist_function)
21+
* [`bindgen::Builder::allowlist_var`](https://docs.rs/bindgen/0.23.1/bindgen/struct.Builder.html#method.allowlist_var)
22+
23+
### Command Line
24+
25+
* `--allowlist-type <type>`
26+
* `--allowlist-function <function>`
27+
* `--allowlist-var <var>`
28+
29+
### Annotations
30+
31+
None.

book/src/blacklisting.md renamed to book/src/blocklisting.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
# Blacklisting
1+
# Blocklisting
22

33
If you need to provide your own custom translation of some type (for example,
44
because you need to wrap one of its fields in an `UnsafeCell`), you can
5-
explicitly blacklist generation of its definition. Uses of the blacklisted type
5+
explicitly blocklist
6+
generation of its definition. Uses of the blocklisted type
67
will still appear in other types' definitions. (If you don't want the type to
78
appear in the bindings at
89
all, [make it opaque](./opaque.md) instead of
9-
blacklisting it.)
10+
blocklisting it.)
1011

11-
Blacklisted types are pessimistically assumed not to be able to `derive` any
12+
Blocklisted types are pessimistically assumed not to be able to `derive` any
1213
traits, which can transitively affect other types' ability to `derive` traits or
1314
not.
1415

1516
### Library
1617

17-
* [`bindgen::Builder::blacklist_type`](https://docs.rs/bindgen/0.31.3/bindgen/struct.Builder.html#method.blacklist_type)
18+
* [`bindgen::Builder::blocklist_type`](https://docs.rs/bindgen/0.31.3/bindgen/struct.Builder.html#method.blocklist_type)
1819

1920
### Command Line
2021

21-
* `--blacklist-type <type>`
22+
* `--blocklist-type <type>`
2223

2324
### Annotations
2425

book/src/cpp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ it ends in `.hpp`. If it doesn't, adding `-x c++` clang args can be used to
1111
force C++ mode. You probably also want to use `-std=c++14` or similar clang args
1212
as well.
1313

14-
You pretty much **must** use [whitelisting](./whitelisting.md) when working
14+
You pretty much **must** use [allowlisting](./allowlisting.md) when working
1515
with C++ to avoid pulling in all of the `std::.*` types, many of which `bindgen`
1616
cannot handle. Additionally, you may want to mark other types as
1717
[opaque](./opaque.md) that `bindgen` stumbles on. It is recommended to mark
18-
all of `std::.*` opaque, and to whitelist only precisely the functions and types
18+
all of `std::.*` opaque, and to allowlist only precisely the functions and types
1919
you intend to use.
2020

2121
You should read up on the [FAQs](./faq.md) as well.

book/src/faq.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
55

66

7-
- [Why isn't `bindgen` generating methods for this whitelisted class?](#why-isnt-bindgen-generating-methods-for-this-whitelisted-class)
7+
- [Why isn't `bindgen` generating methods for this allowlisted class?](#why-isnt-bindgen-generating-methods-for-this-allowlisted-class)
88
- [Why isn't `bindgen` generating bindings to inline functions?](#why-isnt-bindgen-generating-bindings-to-inline-functions)
99
- [Does `bindgen` support the C++ Standard Template Library (STL)?](#does-bindgen-support-the-c-standard-template-library-stl)
1010

1111
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1212

13-
### Why isn't `bindgen` generating methods for this whitelisted class?
13+
### Why isn't `bindgen` generating methods for this allowlisted class?
1414

1515
Are the methods `inline` methods, or defined inline in the class? For example:
1616

@@ -62,7 +62,7 @@ STL. That ties our hands when it comes to linking: ["Why isn't `bindgen` generat
6262
As far as generating opaque blobs of bytes with the correct size and alignment,
6363
`bindgen` can do pretty well. This is typically enough to let you use types that
6464
transitively contain STL things. We generally recommend marking `std::.*` as
65-
opaque, and then whitelisting only the specific things you need from the library
65+
opaque, and then allowlisting only the specific things you need from the library
6666
you're binding to that is pulling in STL headers.
6767
6868
### How to deal with bindgen generated padding fields?

book/src/objc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Generating Bindings to Objective-C
22

33
`bindgen` does not (yet) have full objective-c support but it can generate bindings
4-
for a lot of the apple frameworks without too much blacklisting.
4+
for a lot of the apple frameworks without too much blocklisting.
55

66
In order to generate bindings, you will need `-x objective-c` as the clang
77
args. If you'd like to use [block](https://crates.io/crates/block) you will need
@@ -49,7 +49,7 @@ name and `id` is a pointer to the objective-c Object.
4949
`--target=arm64-apple-ios` as mentioned
5050
[here](https://github.com/rust-lang/rust-bindgen/issues/1211#issuecomment-569804287).
5151
* The generated bindings will almost certainly have some conflicts so you will
52-
have to blacklist a few things. There are a few cases of the parameters being
52+
have to blocklist a few things. There are a few cases of the parameters being
5353
poorly named in the objective-c headers. But if you're using anything with
5454
Core Foundation, you'll find that `time.h` as has a variable called timezone that
5555
conflicts with some of the things in `NSCalendar.h`.

book/src/replacing-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ That way, after code generation, the bindings for the `nsTArray` type are
2424
the ones that would be generated for `nsTArray_Simple`.
2525
2626
Replacing is only available as an annotation. To replace a C or C++ definition
27-
with a Rust definition, use [blacklisting](./blacklisting.md).
27+
with a Rust definition, use [blocklisting](./blocklisting.md).

book/src/whitelisting.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)