Nmap Development mailing list archives

Reduce warnings from nsock/include/nsock.h


From: Gisle Vanem <gvanem () broadpark no>
Date: Wed, 11 Feb 2009 14:16:05 +0100

The compilation on MingW/gcc is a rather noisy process. E.g:

In file included from ncat/ncat_main.c:3:
./nsock/include/nsock.h:170: warning: "struct timeval" declared inside parameter list
./nsock/include/nsock.h:170: warning: its scope is only this definition or declaration, which is pro
bably not what you want
./nsock/include/nsock.h:319: warning: "struct sockaddr_storage" declared inside parameter list
...

This is due to the fact that <winsock2.h> isn't included. IMHO it
should be included in nsock/include/nsock.h. But that causes new
problems on MingW (and possibly on MSVC too):

In nse_nsock.c:
struct l_dnet_udata {
char *interface;
eth_t *eth;
};

"g++" trips on 'interface' since this is defined in Win32's <basetyps.h> as '_COM_interface' and this again defined as 'struct'!! What a mess MS
have created. This is what's gets emitted by the pre-processor:

struct l_dnet_udata {
char *struct;
eth_t *eth;
};

An easy fix would be to undefine 'interface' in nse_nsock.c
With the attached simple diff-9.txt, I was able to reduce the number of warnings from ~200 to 95. That is with "-Wall -Wcast-align".

--gv

Attachment: diffs-9.txt
Description:


_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: