Skip to content

Commit

Permalink
Convert rewrite_fn_ptr_eq
Browse files Browse the repository at this point in the history
  • Loading branch information
sim-immunant committed Sep 27, 2023
1 parent 230d272 commit 95fd3ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions rewriter/tests/rewrite_fn_ptr_eq/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ define_shared_lib(
define_test(
SRCS main.c
NEEDS_LD_WRAP
CRITERION_TEST
)

define_ia2_wrapper()
6 changes: 4 additions & 2 deletions rewriter/tests/rewrite_fn_ptr_eq/lib.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
/*
RUN: cat rewrite_fn_ptr_eq_call_gates_1.ld | FileCheck --check-prefix=LINKARGS %s
*/
#include <criterion/criterion.h>
#include <criterion/logging.h>
#include <lib.h>
#include <stddef.h>
#include <stdio.h>
#include <assert.h>

// LINKARGS: --wrap=call_fn
int call_fn(bin_op fn, int x, int y) {
assert(fn != NULL);
cr_assert(fn != NULL);
int res = fn(x, y);
printf("%d\n", res);
cr_log_info("%d\n", res);
return res;
}
3 changes: 2 additions & 1 deletion rewriter/tests/rewrite_fn_ptr_eq/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
RUN: cat main.c | FileCheck --match-full-lines --check-prefix=REWRITER %S/main.c
*/
#include <criterion/criterion.h>
#include <stdio.h>
#include <lib.h>
#include <ia2.h>
Expand All @@ -22,7 +23,7 @@ struct module {
bin_op fn;
};

int main() {
Test(rewrite_fn_ptr_eq, main) {
int res;
int *y = &res;
void *x = NULL;
Expand Down

0 comments on commit 95fd3ff

Please sign in to comment.