Commit 040149b
authored
* Generate `BindgenOptions` and the `Builder` methods using macros
This is done so the definition, default value and `Builder` methods for
each field of `BindgenOptions` are kept in the same region of code.
Before this change, adding (or modifying) a new option for `bindgen`
required:
- Updating the fields of the `BindgenOptions` type.
- Updating the `Default` implementation for `BindgenOptions`.
- Updating one or several `Builder` methods with proper documentation
explaining the default value of the option.
- Updating the `Builder::command_line_flags` method.
Each one of these steps was done in a different place inside
`bindgen/lib.rs`.
With this change, all these 4 steps are done in the same place. This
should make less likely to have bugs.
Clearly using macros implies properly documenting how to use such macros
and makes adding new options a bit harder because most (all?) editors
are not able to format code and suggest completions inside macros.
This change also moves all the code related to setting `BindgenOptions`
to the new `bindgen/options.rs` file.
* Factor out the "Regex are supported" docs.
All the options that support regular expressions had the following
sentence in their documentation:
> Regular expressions are supported
This comment was factored out to the macro that documents options based
on `RegexSet`s.
* Rename `fn_with_regex_arg` to `regex_option`
* Allow optional commas in the `options` macro.
This is done to avoid hard to detect macro parsing issues due to missing
commas.
* Fix typo
* Add the `AsArg` trait.
This trait eases the conversion of `BindgenOptions` fields into CLI
args.
This commit also changes the `options` macro so the flag can be passed
to `as_args` instead of a closure.
* Document the `option` macro
* Document the `options` module
* Rewrite some documentation
* Run rustfmt
* Avoid examples with `bool` parameters
* More documentation changes
* Reorganize the `options` module
* Run rustfmt
1 parent c94367c commit 040149b
File tree
5 files changed
+2441
-2279
lines changed- bindgen
- codegen
- options
5 files changed
+2441
-2279
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
| 76 | + | |
| 77 | + | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
2736 | 2736 | | |
2737 | 2737 | | |
2738 | 2738 | | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
| 2745 | + | |
| 2746 | + | |
| 2747 | + | |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
| 2751 | + | |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
2739 | 2768 | | |
2740 | 2769 | | |
2741 | 2770 | | |
| |||
3422 | 3451 | | |
3423 | 3452 | | |
3424 | 3453 | | |
3425 | | - | |
3426 | | - | |
3427 | | - | |
3428 | | - | |
3429 | | - | |
3430 | | - | |
3431 | | - | |
| 3454 | + | |
| 3455 | + | |
| 3456 | + | |
| 3457 | + | |
| 3458 | + | |
| 3459 | + | |
| 3460 | + | |
3432 | 3461 | | |
3433 | 3462 | | |
3434 | 3463 | | |
| |||
3468 | 3497 | | |
3469 | 3498 | | |
3470 | 3499 | | |
3471 | | - | |
3472 | | - | |
3473 | | - | |
3474 | | - | |
3475 | | - | |
3476 | | - | |
3477 | | - | |
3478 | | - | |
| 3500 | + | |
| 3501 | + | |
| 3502 | + | |
| 3503 | + | |
| 3504 | + | |
| 3505 | + | |
| 3506 | + | |
| 3507 | + | |
| 3508 | + | |
3479 | 3509 | | |
3480 | 3510 | | |
3481 | 3511 | | |
| |||
3505 | 3535 | | |
3506 | 3536 | | |
3507 | 3537 | | |
3508 | | - | |
| 3538 | + | |
3509 | 3539 | | |
3510 | 3540 | | |
3511 | | - | |
| 3541 | + | |
3512 | 3542 | | |
3513 | 3543 | | |
3514 | 3544 | | |
| |||
3517 | 3547 | | |
3518 | 3548 | | |
3519 | 3549 | | |
3520 | | - | |
3521 | | - | |
3522 | | - | |
3523 | | - | |
| 3550 | + | |
| 3551 | + | |
| 3552 | + | |
3524 | 3553 | | |
3525 | 3554 | | |
3526 | | - | |
| 3555 | + | |
| 3556 | + | |
| 3557 | + | |
3527 | 3558 | | |
3528 | 3559 | | |
3529 | 3560 | | |
| |||
0 commit comments