Nmap Development mailing list archives

NORETURN macro broke compilation on VS 2010


From: nnposter () users sourceforge net
Date: Wed, 31 Dec 2014 22:42:25 +0000

The NORETURN macro, as defined in commit 85bb2d3[1] from November 17,
seems to be disliked by VS 2010. Specifically, the double parentheses
in __declspec((noreturn)) are causing a syntax error whenever the macro
is used. Is anybody else experiencing this?

Reducing the parentheses to a single pair in the three different include
files where the same macro is defined seems to resolve the issue. (Note
that this is also the form that was originally discussed in [2].)

[1] https://github.com/nmap/nmap/commit/85bb2d388d1fbbf2b7ee010ee9ff2c2868f165d3
[2] http://seclists.org/nmap-dev/2014/q4/204


Cheers,
nnposter


Patch against r33886 follows:

--- nbase/nbase.h.orig  2014-12-29 11:50:01.000000000 -0700
+++ nbase/nbase.h       2014-12-31 13:19:04.622431600 -0700
@@ -374,7 +374,7 @@
 #if defined(__GNUC__)
 #define NORETURN __attribute__((noreturn))
 #elif defined(_MSC_VER)
-#define NORETURN __declspec((noreturn))
+#define NORETURN __declspec(noreturn)
 #else
 #define NORETURN
 #endif
--- libnetutil/netutil.h.orig   2014-12-29 11:49:37.000000000 -0700
+++ libnetutil/netutil.h        2014-12-31 13:17:20.102431600 -0700
@@ -165,7 +165,7 @@
 #if defined(__GNUC__)
 #define NORETURN __attribute__((noreturn))
 #elif defined(_MSC_VER)
-#define NORETURN __declspec((noreturn))
+#define NORETURN __declspec(noreturn)
 #else
 #define NORETURN
 #endif
--- nsock/src/error.h.orig      2014-12-29 11:50:00.000000000 -0700
+++ nsock/src/error.h   2014-12-31 13:20:59.287231600 -0700
@@ -77,7 +77,7 @@
 #if defined(__GNUC__)
 #define NORETURN __attribute__((noreturn))
 #elif defined(_MSC_VER)
-#define NORETURN __declspec((noreturn))
+#define NORETURN __declspec(noreturn)
 #else
 #define NORETURN
 #endif
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: