diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-03-12 19:25:31 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-03-25 16:35:34 -0400 |
commit | beedadbeacc00222e1bdebec638c1e8cd48a8b14 (patch) | |
tree | f3471895cbdd8335c8e4533aa8671d35fb2b8fb9 | |
parent | 94feec59cf2f4c28578ba9c75c7ece781ed6f19b (diff) | |
download | tor-beedadbeacc00222e1bdebec638c1e8cd48a8b14.tar.gz tor-beedadbeacc00222e1bdebec638c1e8cd48a8b14.zip |
Try a different approach to making publish function seem used.
We want the DISPATCH_ADD_PUB() macro to count as making a
DECLARE_PUBLISH() invocation "used", so let's try a new approach
that preserves that idea. The old one apparently did not work for
some versions of osx clang.
-rw-r--r-- | src/lib/pubsub/pubsub_macros.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/pubsub/pubsub_macros.h b/src/lib/pubsub/pubsub_macros.h index e4fdd15aec..12cfa7d39e 100644 --- a/src/lib/pubsub/pubsub_macros.h +++ b/src/lib/pubsub/pubsub_macros.h @@ -268,12 +268,20 @@ } \ EAT_SEMICOLON +/** + * Add a fake use of the publish function for 'messagename', so that + * the compiler does not call it unused. + */ +#define DISPATCH__FAKE_USE_OF_PUBFN_(messagename) \ + ( 0 ? (publish_fn__ ##messagename((msg_arg_type__##messagename)0), 1) \ + : 1) + /* * This macro is for internal use. It backs DISPATCH_ADD_PUB*() */ #define DISPATCH_ADD_PUB_(connector, channel, messagename, flags) \ ( \ - ((void)publish_fn__ ##messagename), \ + DISPATCH__FAKE_USE_OF_PUBFN_(messagename), \ pubsub_add_pub_((connector), \ &pub_binding__ ##messagename, \ get_channel_id(# channel), \ |