/* Auto-generated by genfincode.sh - DO NOT EDIT! */
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include "rtpp_types.h"
#include "rtpp_debug.h"
#include "rtpp_ttl.h"
#include "rtpp_ttl_fin.h"
static void rtpp_ttl_decr_fin(void *pub) {
    fprintf(stderr, "Method rtpp_ttl@%p::decr (rtpp_ttl_decr) is invoked after destruction\x0a", pub);
    RTPP_AUTOTRAP();
}
static void rtpp_ttl_get_remaining_fin(void *pub) {
    fprintf(stderr, "Method rtpp_ttl@%p::get_remaining (rtpp_ttl_get_remaining) is invoked after destruction\x0a", pub);
    RTPP_AUTOTRAP();
}
static void rtpp_ttl_reset_fin(void *pub) {
    fprintf(stderr, "Method rtpp_ttl@%p::reset (rtpp_ttl_reset) is invoked after destruction\x0a", pub);
    RTPP_AUTOTRAP();
}
static void rtpp_ttl_reset_with_fin(void *pub) {
    fprintf(stderr, "Method rtpp_ttl@%p::reset_with (rtpp_ttl_reset_with) is invoked after destruction\x0a", pub);
    RTPP_AUTOTRAP();
}
void rtpp_ttl_fin(struct rtpp_ttl *pub) {
    RTPP_DBG_ASSERT(pub->decr != (rtpp_ttl_decr_t)NULL);
    RTPP_DBG_ASSERT(pub->decr != (rtpp_ttl_decr_t)&rtpp_ttl_decr_fin);
    pub->decr = (rtpp_ttl_decr_t)&rtpp_ttl_decr_fin;
    RTPP_DBG_ASSERT(pub->get_remaining != (rtpp_ttl_get_remaining_t)NULL);
    RTPP_DBG_ASSERT(pub->get_remaining != (rtpp_ttl_get_remaining_t)&rtpp_ttl_get_remaining_fin);
    pub->get_remaining = (rtpp_ttl_get_remaining_t)&rtpp_ttl_get_remaining_fin;
    RTPP_DBG_ASSERT(pub->reset != (rtpp_ttl_reset_t)NULL);
    RTPP_DBG_ASSERT(pub->reset != (rtpp_ttl_reset_t)&rtpp_ttl_reset_fin);
    pub->reset = (rtpp_ttl_reset_t)&rtpp_ttl_reset_fin;
    RTPP_DBG_ASSERT(pub->reset_with != (rtpp_ttl_reset_with_t)NULL);
    RTPP_DBG_ASSERT(pub->reset_with != (rtpp_ttl_reset_with_t)&rtpp_ttl_reset_with_fin);
    pub->reset_with = (rtpp_ttl_reset_with_t)&rtpp_ttl_reset_with_fin;
}
#if defined(RTPP_FINTEST)
#include <assert.h>
#include <stddef.h>
#include "rtpp_mallocs.h"
#include "rtpp_refcnt.h"
#include "rtpp_linker_set.h"
#define CALL_TFIN(pub, fn) ((void (*)(typeof(pub)))((pub)->fn))(pub)

void
rtpp_ttl_fintest()
{
    int naborts_s;

    struct {
        struct rtpp_ttl pub;
    } *tp;

    naborts_s = _naborts;
    tp = rtpp_rzmalloc(sizeof(*tp), offsetof(typeof(*tp), pub.rcnt));
    assert(tp != NULL);
    assert(tp->pub.rcnt != NULL);
    tp->pub.decr = (rtpp_ttl_decr_t)((void *)0x1);
    tp->pub.get_remaining = (rtpp_ttl_get_remaining_t)((void *)0x1);
    tp->pub.reset = (rtpp_ttl_reset_t)((void *)0x1);
    tp->pub.reset_with = (rtpp_ttl_reset_with_t)((void *)0x1);
    CALL_SMETHOD(tp->pub.rcnt, attach, (rtpp_refcnt_dtor_t)&rtpp_ttl_fin,
      &tp->pub);
    CALL_SMETHOD(tp->pub.rcnt, decref);
    CALL_TFIN(&tp->pub, decr);
    CALL_TFIN(&tp->pub, get_remaining);
    CALL_TFIN(&tp->pub, reset);
    CALL_TFIN(&tp->pub, reset_with);
    assert((_naborts - naborts_s) == 4);
}
const static void *_rtpp_ttl_ftp = (void *)&rtpp_ttl_fintest;
DATA_SET(rtpp_fintests, _rtpp_ttl_ftp);
#endif /* RTPP_FINTEST */
