mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +00:00
Fix MSVC compiler noreturn related warnings and add extra
safety asserts to the functions that do not return on all control paths.
This commit is contained in:
@@ -121,11 +121,18 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
__declspec(noreturn)
|
||||||
|
#endif
|
||||||
void fatal(const char *fmt, ...)
|
void fatal(const char *fmt, ...)
|
||||||
__attribute__ ((noreturn))
|
__attribute__ ((noreturn))
|
||||||
__attribute__ ((format (printf, 1, 2)));
|
__attribute__ ((format (printf, 1, 2)));
|
||||||
void error(const char *fmt, ...)
|
void error(const char *fmt, ...)
|
||||||
__attribute__ ((format (printf, 1, 2)));
|
__attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
__declspec(noreturn)
|
||||||
|
#endif
|
||||||
void pfatal(const char *err, ...)
|
void pfatal(const char *err, ...)
|
||||||
__attribute__ ((noreturn))
|
__attribute__ ((noreturn))
|
||||||
__attribute__ ((format (printf, 1, 2)));
|
__attribute__ ((format (printf, 1, 2)));
|
||||||
|
|||||||
3
tcpip.cc
3
tcpip.cc
@@ -499,6 +499,9 @@ int send_ip_packet(int sd, struct eth_nfo *eth, u8 *packet,
|
|||||||
return send_ipv6_packet(sd, eth, packet, packetlen);
|
return send_ipv6_packet(sd, eth, packet, packetlen);
|
||||||
|
|
||||||
fatal("%s only understands IP versions 4 and 6 (got %u)", __func__, ip->ip_v);
|
fatal("%s only understands IP versions 4 and 6 (got %u)", __func__, ip->ip_v);
|
||||||
|
|
||||||
|
/* This should not be reached. Just in case. */
|
||||||
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -724,6 +724,9 @@ public:
|
|||||||
} else {
|
} else {
|
||||||
fatal("Unknown address family %u in %s.", source->ss_family, __func__);
|
fatal("Unknown address family %u in %s.", source->ss_family, __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This should not be reached. Just in case. */
|
||||||
|
assert(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user