From 43685d444c89409b3241c992734c8698225572f5 Mon Sep 17 00:00:00 2001 From: Anders Blomdell <anders.blomdell@control.lth.se> Date: Fri, 14 Aug 2015 11:14:26 +0200 Subject: [PATCH] Made void samples more like other samples. --- compiler/2014/C_CodeGen.jrag | 2 +- lib/c/2014/labcomm2014.c | 6 ++++++ lib/c/2014/labcomm2014_private.h | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/compiler/2014/C_CodeGen.jrag b/compiler/2014/C_CodeGen.jrag index b762e58..0b68620 100644 --- a/compiler/2014/C_CodeGen.jrag +++ b/compiler/2014/C_CodeGen.jrag @@ -1038,7 +1038,7 @@ aspect C_Encoder { env.prefix + getName() + ", (labcomm2014_encoder_function)encode_" + env.prefix + getName() + - (!isVoid()?", v":", NULL")+");"); + (!isVoid()?", v":", labcomm_void_instance")+");"); env.unindent(); env.println("}"); } diff --git a/lib/c/2014/labcomm2014.c b/lib/c/2014/labcomm2014.c index 1cd953a..f599e78 100644 --- a/lib/c/2014/labcomm2014.c +++ b/lib/c/2014/labcomm2014.c @@ -37,6 +37,12 @@ #include "labcomm2014_ioctl.h" #include "labcomm2014_dynamic_buffer_writer.h" +/* + * A non-null void sample instance + */ +void *labcomm_void_instance = &labcomm_void_instance; + + /* Unwrapping reader/writer functions */ #define UNWRAP_ac(rw, ac, ...) ac #define UNWRAP(func, ...) \ diff --git a/lib/c/2014/labcomm2014_private.h b/lib/c/2014/labcomm2014_private.h index 8f98fed..964299b 100644 --- a/lib/c/2014/labcomm2014_private.h +++ b/lib/c/2014/labcomm2014_private.h @@ -81,6 +81,11 @@ #define LABCOMM_CONSTRUCTOR __attribute__((constructor)) #endif +/* + * A non-null void sample instance + */ +extern void *labcomm_void_instance; + /* * Semi private dynamic memory declarations */ -- GitLab