Examples of errors detected by the V1040 diagnostic
V1040. Possible typo in the spelling of a pre-defined macro name.
Erlang
V1040 Possible typo in the spelling of a pre-defined macro name. The '__WIN_32__' macro is similar to '__WIN32__'. inet_drv.c 13506
static int tcp_send_error(tcp_descriptor* desc, int err)
{
/* EPIPE errors usually occur in one of three ways:
* 1. We write to a socket when we've already shutdown() the write side.
* On Windows the error returned for this is ESHUTDOWN
* rather than EPIPE.
* 2. The TCP peer sends us an RST through no fault of our own (perhaps
* by aborting the connection using SO_LINGER) and we then attempt
* to write to the socket. On Linux and Windows we would actually
* receive an ECONNRESET error for this, but on the BSDs, Darwin,
* Illumos and presumably Solaris, it's an EPIPE.
* 3. We cause the TCP peer to send us an RST by writing to a socket
* after we receive a FIN from them. Our first write will be
* successful, but if the they have closed the connection (rather
* than just shutting down the write side of it) this will cause their
* OS to send us an RST. Then, when we attempt to write to the socket
* a second time, we will get an EPIPE error. On Windows we get an
* ECONNABORTED.
*
* What we are going to do here is to treat all EPIPE messages that aren't
* of type 1 as ECONNRESET errors. This will allow users who have the
* show_econnreset socket option enabled to receive {error, econnreset} on
* both send and recv operations to indicate that an RST
* has been received.
*/
#ifdef __WIN_32__ // <=
if (err == ECONNABORTED)
err = ECONNRESET;
#endif
if (err == EPIPE && !(desc->tcp_add_flags & TCP_ADDF_SHUTDOWN_WR_DONE))
err = ECONNRESET;
return tcp_send_or_shutdown_error(desc, err);
}
SimpleIni
V1040 Possible typo in the spelling of a pre-defined macro name. The '_linux' macro is similar to '__linux'. SimpleIni.h 2923
#if defined(SI_NO_MBSTOWCS_NULL) || (!defined(_MSC_VER) && !defined(_linux))
libuv
V1040 Possible typo in the spelling of a pre-defined macro name. The '__MINGW32_' macro is similar to '__MINGW32__'. winapi.h 4112
/* from winternl.h */
#if !defined(__UNICODE_STRING_DEFINED) && defined(__MINGW32_)
#define __UNICODE_STRING_DEFINED
#endif