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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Henri Doreau
2014-11-12 14:29 GMT+01:00  <[hidden email]>:
> 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?

Regards

Henri
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/
Reply | Threaded
Open this post in threaded view
|

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

Daniel Miller-10
On Wed, Nov 12, 2014 at 4:45 PM, Henri Doreau <[hidden email]> wrote:

> 2014-11-12 14:29 GMT+01:00  <[hidden email]>:
>> 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
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/
Reply | Threaded
Open this post in threaded view
|

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

Henri Doreau
2014-11-13 6:28 GMT+01:00 Daniel Miller <[hidden email]>:

> On Wed, Nov 12, 2014 at 4:45 PM, Henri Doreau <[hidden email]> wrote:
>> 2014-11-12 14:29 GMT+01:00  <[hidden email]>:
>>> 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/