-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ffigen] Add config ignore-source-errors
#810
Merged
dcharkes
merged 19 commits into
dart-lang:main
from
mannprerak2:ffigen_severe_compiler_logs
Nov 21, 2023
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
835c436
Add handling for catching severe errors via libclang
mannprerak2 9cf7e2b
Change strings
mannprerak2 26c7df6
minor fixes
mannprerak2 97ea8ba
Ignore source errors for ObjC
mannprerak2 661d6e2
nit
mannprerak2 0f7e74d
nit
mannprerak2 ba86016
Skip generation for union test
mannprerak2 eb1637c
temp
mannprerak2 5e1bb11
Revert "temp"
mannprerak2 f04c464
minor fixes
mannprerak2 dba820b
Update data.dart
mannprerak2 06c23a5
Update pubspec.yaml
mannprerak2 9151aac
Update CHANGELOG.md
mannprerak2 15fa9ec
Merge pull request #1 from mannprerak2/mannprerak2-patch-1
mannprerak2 ab67a57
Add errors.md (#2)
mannprerak2 877c5af
Rename pkgs/ffigen/errors.md to pkgs/ffigen/docs/errors.md (#3)
mannprerak2 c347bb0
Rename pkgs/ffigen/errors.md to pkgs/ffigen/doc/errors.md (#4)
mannprerak2 2fda6eb
Update errors.md (#5)
mannprerak2 3aa6561
Update CHANGELOG.md (#6)
mannprerak2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Errors in ffigen | ||
|
||
This file documents various errors and their potential fixes related to ffigen. | ||
|
||
## Errors in source header files | ||
|
||
FFIgen uses libclang to parse header files. Any compiler warnings/errors should be logged (with SEVERE level). | ||
Compiler errors and warnings should be resolved as they can potentially generate invalid bindings that might cause silent errors and crashes at runtime. | ||
|
||
> You can pass in args to libclang using `compiler-opts` via cmd line or yaml config or both. | ||
Here we'll list some common usecases. You can find the full list of [supported args here](https://clang.llvm.org/docs/ClangCommandLineReference.html#id5). | ||
|
||
### Missing headers | ||
|
||
These are the most common source file errors. You can specify [include paths to clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#id6) like this | ||
```yaml | ||
compiler-opts: | ||
- "-I/path/to/folder" | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we mention @liamappelbe what are typical errors we see with Objective-C? |
||
### Ignoring source errors | ||
As a last resort, you can pass in `--ignore-source-errors` or set `ignore-source-errors: true` in yaml config. | ||
mannprerak2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
**Warning: This will likely lead to incorrect bindings!** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of warnings result in wrong generated code? Should we refuse to generate on all warnings?
If we refuse to generate for too many warnings, people might just start using
ignore-source-errors
instead of fixing the issues.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, for now I've only handled warnings/errors from libclang. (Excluding ObjC for now)
But I think anything which can potentially generate invalid bindings, that might silently break at runtime should be covered.