Skip to content
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

add #[must_use] new_call function to show warning #30

Merged
merged 5 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/brainfuck/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ fn codegen<'a, 'ctx>(ops: &[Op], context: &'a gccjit::Context<'ctx>) -> bool {
let mut current_block = brainf_main.new_block("entry_block");
// now we have to zero out the giant buffer we just allocated on the stack.
let zero_access = context.new_array_access(None, array.to_rvalue(), context.new_rvalue_zero(int_ty));
// A function call that is done for its side effects must be sent to add_eval.
current_block.add_eval(None, context.new_call(None, memset, &[zero_access.get_address(None), context.new_rvalue_zero(int_ty), size]));
let mut block_stack = vec![];
let mut blocks = 0;
Expand Down
1 change: 1 addition & 0 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ impl<'ctx> Context<'ctx> {
/// together with LValues and Parameters, for example), so in order to
/// mix the types of the arguments it may be necessary to call to_rvalue()
/// before calling this function.
#[must_use]
pub fn new_call<'a>(&'a self,
loc: Option<Location<'a>>,
func: Function<'a>,
Expand Down
Loading