summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-11-16 13:53:45 -0800
committerVito Caputo <vcaputo@pengaru.com>2020-11-16 14:00:02 -0800
commit7c196762e4cabf5582116091bcf0818f4c2d612d (patch)
tree2a569bd2fd9edd7f1573d4c342ac00545b892ccc
parentafacc269ee1527714bb4f02c155c038c766d9a7f (diff)
thunk: mark functions w/gcc unused attribute
This shuts up gcc warnings w/-Wall for thunked functions. It's expected there will be some unused functions, esp. since there's the split init/alloc variants one may or may not use. It's also nice in some scenarios to write a collection of small closures a project may or may not take advantage of at any given moment in its development. No point making a bunch of noise about it.
-rw-r--r--thunk.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/thunk.h b/thunk.h
index 4a8060e..7fbdfbd 100644
--- a/thunk.h
+++ b/thunk.h
@@ -440,7 +440,12 @@ struct thunk_t {
* function definition, all in one place in one fell swoop.
*/
#define THUNK_DEFINE_STATIC(_name, ...) \
- static int _THUNK_GEN_PROTO(_name, __VA_ARGS__); \
+ static int _THUNK_GEN_PROTO(_name, __VA_ARGS__) __attribute__ ((unused));\
+ static int __thunk_dispatch_##_name(thunk_t *thunk) __attribute__ ((unused));\
+ static thunk_t * __thunk_alloc_##_name(void **payload_ptr, size_t payload_size) __attribute__ ((unused));\
+ static thunk_t * _THUNK_GEN_PROTO(__thunk_instantiate_##_name, __VA_ARGS__) __attribute__ ((unused));\
+ static thunk_t * _THUNK_GEN_INIT_PROTO(__thunk_init_##_name, thunk_t *_thunk, __VA_ARGS__) __attribute__ ((unused));\
+ \
typedef struct __thunk_environment_##_name { \
/* struct for encapsulating the calling environment */ \
thunk_t __thunk; \
@@ -511,7 +516,7 @@ struct thunk_t {
* .h from the implementing .c - not just the consumers.
*/
#define THUNK_DECLARE(_name, ...) \
- int _THUNK_GEN_PROTO(_name, __VA_ARGS__); \
+ int _THUNK_GEN_PROTO(_name, __VA_ARGS__) __attribute__ ((unused)); \
typedef struct __thunk_environment_##_name { \
/* struct for encapsulating the calling environment */ \
thunk_t __thunk; \
@@ -519,10 +524,10 @@ struct thunk_t {
char __payload[]; \
} __thunk_environment_##_name; \
\
- int __thunk_dispatch_##_name(thunk_t *thunk); \
- thunk_t * _THUNK_GEN_INIT_PROTO(__thunk_init_##_name, thunk_t *_thunk, __VA_ARGS__);\
- thunk_t * __thunk_alloc_##_name(void **payload_ptr, size_t payload_size);\
- thunk_t * _THUNK_GEN_PROTO(__thunk_instantiate_##_name, __VA_ARGS__);
+ int __thunk_dispatch_##_name(thunk_t *thunk) __attribute__ ((unused)); \
+ thunk_t * _THUNK_GEN_INIT_PROTO(__thunk_init_##_name, thunk_t *_thunk, __VA_ARGS__) __attribute__ ((unused));\
+ thunk_t * __thunk_alloc_##_name(void **payload_ptr, size_t payload_size) __attribute__ ((unused));\
+ thunk_t * _THUNK_GEN_PROTO(__thunk_instantiate_##_name, __VA_ARGS__) __attribute__ ((unused));
#define THUNK_DEFINE(_name, ...) \
© 2021 All Rights Reserved