threads / patch / 46722

patchusage: conditionally compile unleak_memory() definition

Subject: [PATCH] usage: conditionally compile unleak_memory() definition

## tl;dr

2 messages between Sep 7, 2017 and Sep 8, 2017. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Ramsay Jones· Sep 7, 2017, 16:08 UTC · lore
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Jeff,

If you need to re-roll your 'jk/leak-checkers' branch, could you please squash this into the relevant patch (commit c57586d954, "add UNLEAK annotation for reducing leak false positives", 05-09-2017).

This was noticed by sparse, since it is not declared when the SUPPRESS_ANNOTATED_LEAKS pre-processor macro is not defined. (You could move the declaration out of the #ifdef in the header file, I suppose, but it seems pointless to compile the function if it isn't being used).

Thanks!

ATB, Ramsay Jones

 usage.c | 2 ++
 1 file changed, 2 insertions(+)
Show changes to usage.c +2 −0
diff --git a/usage.c b/usage.c
index 780ed73be..cdd534c9d 100644
--- a/usage.c
+++ b/usage.c
@@ -242,6 +242,7 @@ NORETURN void BUG(const char *fmt, ...)
 }
 #endif
 
+#ifdef SUPPRESS_ANNOTATED_LEAKS
 void unleak_memory(const void *ptr, size_t len)
 {
 	static struct suppressed_leak_root {
@@ -254,3 +255,4 @@ void unleak_memory(const void *ptr, size_t len)
 	root->next = suppressed_leaks;
 	suppressed_leaks = root;
 }
+#endif
-- 
2.14.0
Jeff King· Sep 8, 2017, 03:37 UTC · re: Ramsay Jones · lore

Re: [PATCH] usage: conditionally compile unleak_memory() definition

On Thu, Sep 07, 2017 at 05:08:23PM +0100, Ramsay Jones wrote:
Show 11 quoted lines
> Hi Jeff,
> 
> If you need to re-roll your 'jk/leak-checkers' branch, could you
> please squash this into the relevant patch (commit c57586d954,
> "add UNLEAK annotation for reducing leak false positives", 05-09-2017).
> 
> This was noticed by sparse, since it is not declared when the
> SUPPRESS_ANNOTATED_LEAKS pre-processor macro is not defined.
> (You could move the declaration out of the #ifdef in the header
> file, I suppose, but it seems pointless to compile the function
> if it isn't being used).

Thanks, that makes sense. There are a handful of other bits to modify in that final commit, so I will end up with at least one re-roll.

-Peff

← back to recent threads