From af74be994739581bd086c715429828aec7f545a9 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Mon, 4 Nov 2019 15:26:03 +0100 Subject: [PATCH] :art: Update --- src/import/udef.c | 2 - tests/import/func_fail2.c | 21 +++++++ tests/import/func_fail3.c | 21 +++++++ tests/import/test.log | 105 ++++++++++++++++++++++++++++++++ tests/import/typedef_tmpl.c | 2 +- tests/import/union_tmpl_fail2.c | 22 +++++++ tests/sh/import.sh | 2 +- 7 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 tests/import/func_fail2.c create mode 100644 tests/import/func_fail3.c create mode 100644 tests/import/union_tmpl_fail2.c diff --git a/src/import/udef.c b/src/import/udef.c index e30c9c6b..24412fb1 100644 --- a/src/import/udef.c +++ b/src/import/udef.c @@ -92,6 +92,4 @@ ANN void ck_clean_udef(MemPool mp, ImportCK* ck) { free_decl_list(mp, ck->list); if(ck->tmpl) free_id_list(mp, ck->tmpl); - if(ck->td) - free_type_decl(mp, ck->td); } diff --git a/tests/import/func_fail2.c b/tests/import/func_fail2.c new file mode 100644 index 00000000..ffaa5daa --- /dev/null +++ b/tests/import/func_fail2.c @@ -0,0 +1,21 @@ +#include "gwion_util.h" +#include "gwion_ast.h" +#include "oo.h" +#include "vm.h" +#include "env.h" +#include "type.h" +#include "instr.h" +#include "object.h" +#include "gwion.h" +#include "value.h" +#include "operator.h" +#include "import.h" +#include "instr.h" + +GWION_IMPORT(too_many_args) { + GWI_BB(gwi_func_ini(gwi, "int", "test")) + GWI_BB(gwi_func_arg(gwi, "int", "i[][]")) + GWI_BB(gwi_func_arg(gwi, "int", "me")) + GWI_BB(gwi_func_end(gwi, (f_xfun)1, ae_flag_none)) + return GW_OK; +} diff --git a/tests/import/func_fail3.c b/tests/import/func_fail3.c new file mode 100644 index 00000000..ed79d1bc --- /dev/null +++ b/tests/import/func_fail3.c @@ -0,0 +1,21 @@ +#include "gwion_util.h" +#include "gwion_ast.h" +#include "oo.h" +#include "vm.h" +#include "env.h" +#include "type.h" +#include "instr.h" +#include "object.h" +#include "gwion.h" +#include "value.h" +#include "operator.h" +#include "import.h" +#include "instr.h" + +GWION_IMPORT(too_many_args) { + GWI_BB(gwi_func_ini(gwi, "int", "test")) + GWI_BB(gwi_func_ini(gwi, "int", "test")) + GWI_BB(gwi_func_arg(gwi, "int", "i[][]")) + GWI_BB(gwi_func_end(gwi, (f_xfun)1, ae_flag_none)) + return GW_OK; +} diff --git a/tests/import/test.log b/tests/import/test.log index 72896812..5e4c6f95 100644 --- a/tests/import/test.log +++ b/tests/import/test.log @@ -50,3 +50,108 @@ coverage.gw ==219564== Memcheck, a memory error detector ==219564== ==219564== For lists of detected and suppressed errors, rerun with: -s ==219564== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) +class_template.gw ==347445== Memcheck, a memory error detector +==347445== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. +==347445== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info +==347445== Command: ./../../gwion -p. -m dummy -d dummy class_template.gw +==347445== Parent PID: 347195 +==347445== +==347445== +==347445== HEAP SUMMARY: +==347445== in use at exit: 9,102,463 bytes in 496 blocks +==347445== total heap usage: 1,005 allocs, 509 frees, 9,211,355 bytes allocated +==347445== +==347445== LEAK SUMMARY: +==347445== definitely lost: 0 bytes in 0 blocks +==347445== indirectly lost: 0 bytes in 0 blocks +==347445== possibly lost: 0 bytes in 0 blocks +==347445== still reachable: 9,102,463 bytes in 496 blocks +==347445== suppressed: 0 bytes in 0 blocks +==347445== Rerun with --leak-check=full to see details of leaked memory +==347445== +==347445== For lists of detected and suppressed errors, rerun with: -s +==347445== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) +coverage.gw ==347621== Memcheck, a memory error detector +==347621== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. +==347621== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info +==347621== Command: ./../../gwion -p. -m dummy -d dummy coverage.gw +==347621== Parent PID: 347195 +==347621== +==347621== +==347621== HEAP SUMMARY: +==347621== in use at exit: 9,098,349 bytes in 468 blocks +==347621== total heap usage: 916 allocs, 448 frees, 9,204,177 bytes allocated +==347621== +==347621== LEAK SUMMARY: +==347621== definitely lost: 0 bytes in 0 blocks +==347621== indirectly lost: 0 bytes in 0 blocks +==347621== possibly lost: 0 bytes in 0 blocks +==347621== still reachable: 9,098,349 bytes in 468 blocks +==347621== suppressed: 0 bytes in 0 blocks +==347621== Rerun with --leak-check=full to see details of leaked memory +==347621== +==347621== For lists of detected and suppressed errors, rerun with: -s +==347621== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) +enum.gw ==347758== Memcheck, a memory error detector +==347758== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. +==347758== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info +==347758== Command: ./../../gwion -p. -m dummy -d dummy enum.gw +==347758== Parent PID: 347195 +==347758== +==347758== +==347758== HEAP SUMMARY: +==347758== in use at exit: 9,101,889 bytes in 467 blocks +==347758== total heap usage: 920 allocs, 453 frees, 9,211,349 bytes allocated +==347758== +==347758== LEAK SUMMARY: +==347758== definitely lost: 0 bytes in 0 blocks +==347758== indirectly lost: 0 bytes in 0 blocks +==347758== possibly lost: 0 bytes in 0 blocks +==347758== still reachable: 9,101,889 bytes in 467 blocks +==347758== suppressed: 0 bytes in 0 blocks +==347758== Rerun with --leak-check=full to see details of leaked memory +==347758== +==347758== For lists of detected and suppressed errors, rerun with: -s +==347758== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) +extend_array.gw ==347895== Memcheck, a memory error detector +==347895== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. +==347895== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info +==347895== Command: ./../../gwion -p. -m dummy -d dummy extend_array.gw +==347895== Parent PID: 347195 +==347895== +==347895== +==347895== HEAP SUMMARY: +==347895== in use at exit: 9,092,505 bytes in 463 blocks +==347895== total heap usage: 886 allocs, 423 frees, 9,196,621 bytes allocated +==347895== +==347895== LEAK SUMMARY: +==347895== definitely lost: 0 bytes in 0 blocks +==347895== indirectly lost: 0 bytes in 0 blocks +==347895== possibly lost: 0 bytes in 0 blocks +==347895== still reachable: 9,092,505 bytes in 463 blocks +==347895== suppressed: 0 bytes in 0 blocks +==347895== Rerun with --leak-check=full to see details of leaked memory +==347895== +==347895== For lists of detected and suppressed errors, rerun with: -s +==347895== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) +fptr.gw ==348011== Memcheck, a memory error detector +==348011== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. +==348011== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info +==348011== Command: ./../../gwion -p. -m dummy -d dummy fptr.gw +==348011== Parent PID: 347195 +==348011== +==348011== +==348011== HEAP SUMMARY: +==348011== in use at exit: 9,097,889 bytes in 485 blocks +==348011== total heap usage: 914 allocs, 429 frees, 9,202,357 bytes allocated +==348011== +==348011== LEAK SUMMARY: +==348011== definitely lost: 0 bytes in 0 blocks +==348011== indirectly lost: 0 bytes in 0 blocks +==348011== possibly lost: 0 bytes in 0 blocks +==348011== still reachable: 9,097,889 bytes in 485 blocks +==348011== suppressed: 0 bytes in 0 blocks +==348011== Rerun with --leak-check=full to see details of leaked memory +==348011== +==348011== For lists of detected and suppressed errors, rerun with: -s +==348011== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) diff --git a/tests/import/typedef_tmpl.c b/tests/import/typedef_tmpl.c index d0201319..f4a738dc 100644 --- a/tests/import/typedef_tmpl.c +++ b/tests/import/typedef_tmpl.c @@ -13,6 +13,6 @@ GWION_IMPORT(typedef_test) { GWI_BB(gwi_typedef_ini(gwi, "Ptr<~A~>", "Typedef<~A~>")) - GWI_BB(gwi_typedef_end(gwi, ae_flag_none)) + GWI_OB(gwi_typedef_end(gwi, ae_flag_none)) return GW_OK; } diff --git a/tests/import/union_tmpl_fail2.c b/tests/import/union_tmpl_fail2.c new file mode 100644 index 00000000..7a0bbf18 --- /dev/null +++ b/tests/import/union_tmpl_fail2.c @@ -0,0 +1,22 @@ +#include "gwion_util.h" +#include "gwion_ast.h" +#include "oo.h" +#include "vm.h" +#include "env.h" +#include "type.h" +#include "object.h" +#include "instr.h" +#include "gwion.h" +#include "value.h" +#include "operator.h" +#include "import.h" + +GWION_IMPORT(union_test) { + GWI_BB(gwi_union_ini(gwi, "U<~A~>", NULL)) + GWI_BB(gwi_union_add(gwi,"float", "f")) + GWI_BB(gwi_union_add(gwi,"int", "i")) + GWI_BB(gwi_union_add(gwi,"A", "a")) + GWI_BB(gwi_union_ini(gwi, "U<~A~>", NULL)) + GWI_OB(gwi_union_end(gwi, 0)) + return GW_OK; +} diff --git a/tests/sh/import.sh b/tests/sh/import.sh index ca0a55f6..dd71344c 100644 --- a/tests/sh/import.sh +++ b/tests/sh/import.sh @@ -1,5 +1,5 @@ #!/bin/bash -# [test] #62 +# [test] #71 n=0 [ "$1" ] && n="$1" -- 2.43.0