tasen / leptonica

Automatically exported from code.google.com/p/leptonica
0 stars 0 forks source link

Warnings (and errors) on Visual Studio Compile of 1.62 #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. compiling without NO_CONSOLE_IO defined.
2. compiling the release configuration.

What is the expected output? What do you see instead?

Release configuration fails. Warnings worth fixing in both. Can mask the 
warnings that are cluttering the build.

There are a number of warnings as follow:

..\src\conncomp.c(1042) : warning C4098: 'pushFillsegBB'
 : 'void' function returning a value
..\src\conncomp.c(1051) : warning C4098: 'pushFillsegBB'
 : 'void' function returning a value
..\src\conncomp.c(1058) : warning C4098: 'pushFillsegBB'
 : 'void' function returning a value
..\src\conncomp.c(1101) : warning C4098: 'pushFillseg'
 : 'void' function returning a value
..\src\conncomp.c(1105) : warning C4098: 'pushFillseg'
 : 'void' function returning a value
..\src\conncomp.c(1112) : warning C4098: 'pushFillseg'
 : 'void' function returning a value
..\src\conncomp.c(1153) : warning C4098: 'popFillseg'
 : 'void' function returning a value
..\src\conncomp.c(1155) : warning C4098: 'popFillseg'
 : 'void' function returning a value
..\src\pix1.c(218) : warning C4098: 'pix_free'
 : 'void' function returning a value

..\src\pix1.c(247) : warning C4028:
 formal parameter 2 different from declaration

..\src\pixalloc.c(350) : warning C4098:
 'pmsCustomDealloc' : 'void' function returning a value
..\src\pixalloc.c(353) : warning C4098:
 'pmsCustomDealloc' : 'void' function returning a value

..\src\pixalloc.c(343) : warning C4101:
 'fp' : unreferenced local variable

..\src\watershed.c(555) : warning C4098: 'wshedSaveBasin' : 'void' 
function returning a value
..\src\watershed.c(814) : warning C4098: 'pushNewPixel' : 'void' function 
returning a value
..\src\watershed.c(857) : warning C4098: 'popNewPixel' : 'void' function 
returning a value
..\src\watershed.c(895) : warning C4098: 'pushWSPixel' : 'void' function 
returning a value
..\src\watershed.c(897) : warning C4098: 'pushWSPixel' : 'void' function 
returning a value
..\src\watershed.c(942) : warning C4098: 'popWSPixel' : 'void' function 
returning a value
..\src\watershed.c(944) : warning C4098: 'popWSPixel' : 'void' function 
returning a value
..\src\watershed.c(946) : warning C4098: 'popWSPixel' : 'void' function 
returning a value

While there are also a large number of casting to smaller size warnings, 
these seem as "works as intended" and it might be easier to simply remove 
the warnings than change the code.

Add the following to command line options: /wd4244 /wd4305 /wd4018

Finally, it looks like the release configuration of the Visual Studio 
solution does not define the correct pre-processor definitions to compile 
correctly.

What version of the product are you using? On what operating system?

Version 1.62 running under XP and building using Visual Studio solution 
file. After removing the huge number of warnings by the three options 
above, the remaining warnings looked like they were worth fixing.

Please provide any additional information below.

Original issue reported on code.google.com by gldray...@gmail.com on 3 Oct 2009 at 6:15

GoogleCodeExporter commented 8 years ago
Sorry i forgot, it would be worth adding the _CRT_SECURE_NO_WARNINGS define to 
clear 
the security warning clutter as well.

Original comment by gldray...@gmail.com on 3 Oct 2009 at 6:18

GoogleCodeExporter commented 8 years ago
The "void function returning a value" error seems pretty dumb,
because we're returning (literally) "void".  However, it's easy to
fix.   Done.

The "unreferenced local value" in pixalloc.c has been removed.

Will verify and make these changes if they are useful:

(1) Add the following to command line options: /wd4244 /wd4305 /wd4018

(2) it would be worth adding the _CRT_SECURE_NO_WARNINGS define to clear 
the security warning clutter

Original comment by dan.bloo...@gmail.com on 3 Oct 2009 at 11:01

GoogleCodeExporter commented 8 years ago
The v1.65 leptonlib.vcprog doesn't define NO_CONSOLE_IO.

LIB Release, LIB Debug, DLL Release, and DLL Debug have all been successfully 
built
on Windows XP Pro SP3.

The following C/C++ command line options are used to reduce the Warning noise:

/wd4018
http://msdn.microsoft.com/en-us/library/y92ktdf2%28v=VS.90%29.aspx
'expression' : signed/unsigned mismatch

/wd4244
http://msdn.microsoft.com/en-us/library/th7a07tz%28v=VS.90%29.aspx
'conversion' conversion from 'type1' to 'type2', possible loss of data

/wd4267
http://msdn.microsoft.com/en-us/library/6kck0s93%28v=VS.90%29.aspx
'var' : conversion from 'size_t' to 'type', possible loss of data

/wd4305
http://msdn.microsoft.com/en-us/library/0as1ke3f%28v=VS.90%29.aspx
'identifier' : truncation from 'type1' to 'type2'

/wd4996
http://msdn.microsoft.com/en-us/library/ttcz0bys%28v=VS.90%29.aspx
'function': was declared deprecated

The only warnings that remain are "warning C4028: formal parameter 2 different 
from
declaration" which has been determined to be unfixable, and the expected 
"LNK4221: no
public symbols found; archive member will be inaccessible" messages for the 
*iostub.c
functions.

I believe this issue is "resolved".

Original comment by tomp2...@gmail.com on 10 Apr 2010 at 11:35

GoogleCodeExporter commented 8 years ago

Original comment by dan.bloo...@gmail.com on 11 Apr 2010 at 5:24