Skip to content

Commit

Permalink
add #[must_use] new_call function to show warning (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
mubarak23 authored Mar 21, 2024
1 parent 0d9271a commit 55b63b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
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

0 comments on commit 55b63b4

Please sign in to comment.