Nmap Development mailing list archives

Re: [nmap-svn] r33802 - in nmap: libnetutil nbase ncat nsock/src


From: Henri Doreau <henri.doreau () gmail com>
Date: Sat, 15 Nov 2014 15:16:37 +0100

2014-11-13 6:28 GMT+01:00 Daniel Miller <bonsaiviking () gmail com>:
On Wed, Nov 12, 2014 at 4:45 PM, Henri Doreau <henri.doreau () gmail com> wrote:
2014-11-12 14:29 GMT+01:00  <commit-mailer () nmap org>:
Author: dmiller
Date: Wed Nov 12 13:29:40 2014
New Revision: 33802

Log:
Let MSVC know about noreturn attribute to help with code analysis


Hi Dan,

Thanks for this work. What about defining a global, portable
__noreturn macro which would evaluate to either __declspec(noreturn)
or  __attribute__ ((noreturn)) according to the build platform?


Henri,

That sounds good, and I considered it. But at the moment I was just
looking for something quick to reduce the noise in MSVC's code
analyzer. Lua does something similar in llimits.h:

/*
** non-return type
*/
#if defined(__GNUC__)
#define l_noret   void __attribute__((noreturn))
#elif defined(_MSC_VER)
#define l_noret   void __declspec(noreturn)
#else
#define l_noret   void
#endif

Does this look like it would work?

Dan

I wouldn't hide "void" behind a macro, but otherwise it looks good.
Both GCC and clang define __GNUC__ so it's probably a correct way to
do it.

-- 
Henri
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: