Hi frieds,

There seems to be a problem with NS_GNUC_NONNULL macro definition
when compiling the code on Windows. This is how/where this beast
is defined:

#if __GNUC_PREREQ(3,3)
# define NS_GNUC_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
# define NS_GNUC_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
# define NS_GNUC_MAYALIAS __attribute__((__may_alias__))
#else
# define NS_GNUC_NONNULL(...)
# define NS_GNUC_WARN_UNUSED_RESULT
# define NS_GNUC_MAYALIAS
#endif

Unfortunately, the

   # define NS_GNUC_NONNULL(...)

will not be accepted by the Microsoft compilers since it is
a varargs macro. They do not support varargs macros. Well.

Now, idea is to just scrap the NS_GNUC_NONNULL entirely
when compiling with non-gcc compilers. Why? Because this
macro is really only used IF gcc, and, as far as I can
see it is used only here:

#if __GNUC_PREREQ(2,7)
# define NS_GNUC_UNUSED __attribute__((__unused__))
# define NS_GNUC_NORETURN __attribute__((__noreturn__))
# define NS_GNUC_PRINTF(m, n) __attribute__((__format__ (__printf__, m, n))) NS_GNUC_NONNULL(m) # define NS_GNUC_SCANF(m, n) __attribute__((__format__ (__scanf__, m, n))) NS_GNUC_NONNULL(m)
#else
# define NS_GNUC_UNUSED
# define NS_GNUC_NORETURN
# define NS_GNUC_PRINTF(fmtarg, firstvararg)
# define NS_GNUC_SCANF(fmtarg, firstvararg)
#endif

Are there any objections to remove the NS_GNUC_NONNULL?
Are there any better ideas?

Cheers
Zoran


Reply via email to