Skip to content

Commit 55b63b4

Browse files
authored
add #[must_use] new_call function to show warning (#30)
1 parent 0d9271a commit 55b63b4

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

examples/brainfuck/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ fn codegen<'a, 'ctx>(ops: &[Op], context: &'a gccjit::Context<'ctx>) -> bool {
107107
let mut current_block = brainf_main.new_block("entry_block");
108108
// now we have to zero out the giant buffer we just allocated on the stack.
109109
let zero_access = context.new_array_access(None, array.to_rvalue(), context.new_rvalue_zero(int_ty));
110+
// A function call that is done for its side effects must be sent to add_eval.
110111
current_block.add_eval(None, context.new_call(None, memset, &[zero_access.get_address(None), context.new_rvalue_zero(int_ty), size]));
111112
let mut block_stack = vec![];
112113
let mut blocks = 0;

src/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ impl<'ctx> Context<'ctx> {
690690
/// together with LValues and Parameters, for example), so in order to
691691
/// mix the types of the arguments it may be necessary to call to_rvalue()
692692
/// before calling this function.
693+
#[must_use]
693694
pub fn new_call<'a>(&'a self,
694695
loc: Option<Location<'a>>,
695696
func: Function<'a>,

0 commit comments

Comments
 (0)