Le 01/09/2017 à 11:35, Leon Romanovsky a écrit : > On Fri, Sep 01, 2017 at 09:00:01AM +0200, Nicolas Morey-Chaisemartin wrote: >> >> Le 01/09/2017 à 06:56, Leon Romanovsky a écrit : >>> On Thu, Aug 31, 2017 at 02:50:56PM -0600, Jason Gunthorpe wrote: >>>> To avoid clashing with user variables. >>>> >>>> Signed-off-by: Jason Gunthorpe <jgunthorpe@xxxxxxxxxxxxxxxxxxxx> >>>> --- >>>> util/util.h | 4 ++-- >>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/util/util.h b/util/util.h >>>> index cbf0deca2dde7b..30d32ee6b51e24 100644 >>>> --- a/util/util.h >>>> +++ b/util/util.h >>>> @@ -8,8 +8,8 @@ >>>> * error */ >>>> #define check_snprintf(buf, len, fmt, ...) \ >>>> ({ \ >>>> - int rc = snprintf(buf, len, fmt, ##__VA_ARGS__); \ >>>> - (rc < len && rc >= 0); \ >>>> + int __rc__ = snprintf(buf, len, fmt, ##__VA_ARGS__); \ >>> It can't clash, because it is declared in the scope {..} of that define and >>> it is local to check_snprintf macro. >> It does if any of the va-args is called rc. >> This is "valid" C although not sure what printfs does print here (probably random stack value) >> { >> int i = printf("i = %d\n", i); >> } > So how does this rename solve the issue? > Now, we can clash with __rc__ variable. > > Thanks There is no safe way to handle that. It can be detected with -Wshadow though. But rc is quite a common name (39 definitions in the code base), __rc__ much less (unused... yet) If you want some real fun, try writing macros with local variables that can be called recursively ;) Nicolas -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html