-
Notifications
You must be signed in to change notification settings - Fork 729
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1467 from emilio/attr-detection-flag
ir: Put function attribute detection under an opt-in flag.
- Loading branch information
Showing
8 changed files
with
85 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
41 changes: 41 additions & 0 deletions
41
tests/expectations/tests/attribute_warn_unused_result_no_attribute_detection.rs
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,41 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
#![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, | ||
} | ||
#[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; | ||
} | ||
impl Foo { | ||
#[inline] | ||
pub unsafe fn foo(&mut self, arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int { | ||
Foo_foo(self, arg1) | ||
} | ||
} | ||
extern "C" { | ||
#[link_name = "\u{1}_Z3fooi"] | ||
pub fn foo(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int; | ||
} |
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
10 changes: 10 additions & 0 deletions
10
tests/headers/attribute_warn_unused_result_no_attribute_detection.hpp
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,10 @@ | ||
// bindgen-flags: --rust-target 1.27 | ||
|
||
class Foo { | ||
public: | ||
__attribute__((warn_unused_result)) | ||
int foo(int); | ||
}; | ||
|
||
__attribute__((warn_unused_result)) | ||
int foo(int); |