Nmap Development mailing list archives

Re: [PATCH] Eliminate compiler warnings in scan_engine.cc


From: David Fifield <david () bamsoftware com>
Date: Fri, 13 Feb 2009 09:12:26 -0700

On Fri, Feb 13, 2009 at 03:01:19PM +0100, Daniel Roethlisberger wrote:
The attached patch eliminates these (bogus) warnings by
initializing numprobes and portno respectively:

  scan_engine.cc: In member function 'unsigned int UltraScanInfo::numProbesPerHost()':
  scan_engine.cc:1560: warning: 'numprobes' may be used uninitialized in this function
  scan_engine.cc: In function 'bool ultrascan_port_pspec_update(UltraScanInfo*, HostScanStats*, const probespec*, 
int)':
  scan_engine.cc:2406: warning: 'portno' may be used uninitialized in this function

The warnings are due to GCC not recognizing that assert(0) never
returns.  It is not strictly necessary to initialize these two
vars, but I guess it can prevent errors creeping up in future
changes to that code.

Thanks, applied. I never got the warnings with GCC 4.3.1.

David Fifield

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


Current thread: