Nmap Development mailing list archives

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


From: Daniel Roethlisberger <daniel () roe ch>
Date: Sat, 14 Feb 2009 01:18:01 +0100

David Fifield <david () bamsoftware com> 2009-02-13:
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.

FreeBSD currently still uses GCC 4.2.1 as base system compiler,
the last GCC version which was not licensed under the rather
controversial GPLv3 yet.

-- 
Daniel Roethlisberger
http://daniel.roe.ch/

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


Current thread: