>>>> "David" == David Malcolm
<dmalcolm(a)redhat.com> writes:
David> Tom: I'm attaching a patch for gdb which gives an example of how this
David> might be used for gdb's Python code.
Awesome.
David> The patch isn't ready as-is, but hopefully gives an idea of what's
David> possible, and takes another bite out of the big wall of false positives
David> that the checker currently emits.
The patch seems pretty close to me.
I looked at this this morning, before I read your mail, and came up with
nearly the same thing :)
If you want, we can make a branch in archer.git for this sort of thing.
Then once you think the plugin is really ready, we can push it all
upstream into gdb. Let me know; I can give you write access or set up
the branch or whatever.
David> + #define CPYCHECKER_RETURNS_BORROWED_REF() \
David> + __attribute__((cpychecker_returns_borrowed_ref))
The gdb style is to use object-like, not function-like, macros for this
kind of thing.
E.g., from src/include/ansidecl.h:
#if (GCC_VERSION < 2007)
# define __attribute__(x)
#endif
[...]
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif /* ATTRIBUTE_UNUSED */
David> +#else
David> + #define CPYCHECKER_RETURNS_BORROWED_REF()
David> + #error (This should have been defined)
David> +#endif
I think having a #error here is wrong.
It is ok not to use the plugin ;-)
Tom