Skip site navigation (1) Skip section navigation (2)

Compiler warnings in psqloodbc 08.03.0200

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Compiler warnings in psqloodbc 08.03.0200
Date: 2008-09-16 13:12:52
Message-ID: 27825.1221570772@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-odbc
I wrote:
> BTW, isn't anyone paying attention to compiler warnings in this code base?

To be concrete, attached is a list of warnings I see when building .0200
using gcc -Wall on an x86_64 Fedora 9 machine.  If I were in charge of
this project I'd insist on every one of these being cleaned up --- they
are at least evidence of sloppy programming, and a significant fraction
look like they mean certain crashes if the code ever gets executed.

BTW, I've omitted 261 "pointer targets differ in signedness" warnings...
those are probably not interesting, but I'd still recommend cleaning
them up, if only so that more important warnings don't get lost in the
noise.  The core Postgres project has maintained a zero-tolerance policy
on gcc warnings for years, and I think it's served us well.

			regards, tom lane

info.c: In function 'PGAPI_GetInfo':
info.c:827: warning: label 'cleanup' defined but not used
info.c: In function 'PGAPI_GetTypeInfo':
info.c:972: warning: label 'cleanup' defined but not used
info.c: In function 'PGAPI_Tables':
info.c:1919: warning: the address of 'table_name' will always evaluate as 'true'
info.c: In function 'PGAPI_Statistics':
info.c:2935: warning: unused variable 'relkind'
info.c: In function 'PGAPI_ColumnPrivileges':
info.c:3487: warning: label 'cleanup' defined but not used
bind.c: In function 'PGAPI_NumParams':
bind.c:449: warning: unused variable 'dollar_quote'
bind.c:449: warning: unused variable 'identifier_quote'
bind.c:449: warning: unused variable 'literal_quote'
bind.c: In function 'CountParameters':
bind.c:626: warning: unused variable 'func'
connection.c: In function 'CC_Constructor':
connection.c:360: warning: implicit declaration of function 'isMsAccess'
connection.c: In function 'CC_create_errormsg':
connection.c:2091: warning: the address of 'msg' will always evaluate as 'true'
connection.c: In function 'LIBPQ_connect':
connection.c:3704: warning: unused variable 'on'
connection.c: In function 'CurrCat':
connection.c:3781: warning: implicit declaration of function 'isMsQuery'
connection.c: At top level:
connection.c:256: warning: 'CC_globals_init' defined but not used
convert.c: In function 'copy_statement_with_parameters':
convert.c:2512: warning: the address of 'curname' will always evaluate as 'true'
convert.c: In function 'ResolveNumericParam':
convert.c:3236: warning: '0' flag ignored with precision and '%d' printf format
convert.c: In function 'prep_params':
convert.c:2302: warning: 'srvquery' may be used uninitialized in this function
convert.c:2302: warning: 'orgquery' may be used uninitialized in this function
convert.c: In function 'convert_escape':
convert.c:4328: warning: 'param_consumed' may be used uninitialized in this function
drvconn.c: In function 'dconn_get_connect_attributes':
drvconn.c:492: warning: passing argument 1 of 'dconn_get_attributes' from incompatible pointer type
drvconn.c: In function 'dconn_get_common_attributes':
drvconn.c:498: warning: passing argument 1 of 'dconn_get_attributes' from incompatible pointer type
drvconn.c: In function 'dconn_get_attributes':
drvconn.c:430: warning: 'last' may be used uninitialized in this function
environ.c: In function 'EN_Constructor':
environ.c:534: warning: label 'cleanup' defined but not used
environ.c:509: warning: unused variable 'func'
execute.c: In function 'PGAPI_Execute':
execute.c:971: warning: implicit declaration of function 'isSqlServr'
options.c: In function 'PGAPI_SetConnectOption':
options.c:503: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c:509: warning: cast to pointer from integer of different size
options.c: In function 'PGAPI_GetConnectOption':
options.c:581: warning: cast from pointer to integer of different size
pgtypes.c: In function 'getCharColumnSize':
pgtypes.c:721: warning: implicit declaration of function 'isSqlServr'
pgtypes.c: At top level:
pgtypes.c:808: warning: 'getTimestampMaxDecimalDigits' defined but not used
psqlodbc.c: In function 'getMutexAttr':
psqlodbc.c:55: warning: implicit declaration of function 'pthread_mutexattr_settype'
psqlodbc.c: At top level:
psqlodbc.c:96: warning: 'finalize_global_cs' defined but not used
qresult.c: In function 'QR_next_tuple':
qresult.c:869: warning: format '%lu' expects type 'long unsigned int *', but argument 3 has type 'SQLUINTEGER *'
qresult.c:920: warning: format '%lu' expects type 'long unsigned int *', but argument 3 has type 'SQLUINTEGER *'
results.c: At top level:
results.c:2093: warning: 'tupleIsAdding' defined but not used
results.c:2113: warning: 'tupleIsUpdating' defined but not used
results.c:2137: warning: 'tupleIsDeleting' defined but not used
results.c:2719: warning: 'IndexExists' defined but not used
socket.c:186: warning: initialization from incompatible pointer type
socket.c: In function 'format_sockerr':
socket.c:206: warning: cast to pointer from integer of different size
socket.c: In function 'SOCK_wait_for_ready':
socket.c:468: warning: 'no_timeout' may be used uninitialized in this function
parse.c: In function 'CheckHasOids':
parse.c:392: warning: too few arguments for format
parse.c:393: warning: the address of 'query' will always evaluate as 'true'
parse.c:413: warning: the address of 'query' will always evaluate as 'true'
parse.c: At top level:
parse.c:548: warning: return type defaults to 'int'
parse.c: In function 'SC_set_SS_columnkey':
parse.c:993: warning: passing argument 2 of 'PGAPI_AllocStmt' from incompatible pointer type
parse.c: In function 'parse_the_statement':
parse.c:1178: warning: cast to pointer from integer of different size
parse.c:1313: warning: the address of 'token' will always evaluate as 'true'
parse.c:1438: warning: the address of 'token' will always evaluate as 'true'
parse.c:1468: warning: the address of 'token' will always evaluate as 'true'
parse.c:1485: warning: the address of 'token' will always evaluate as 'true'
parse.c:1610: warning: the address of 'token' will always evaluate as 'true'
parse.c:1687: warning: the address of 'token' will always evaluate as 'true'
parse.c:1710: warning: the address of 'token' will always evaluate as 'true'
parse.c:1135: warning: 'allocated_size' may be used uninitialized in this function
parse.c:1142: warning: 'column_has_alias' may be used uninitialized in this function
parse.c:1139: warning: 'parse' may be used uninitialized in this function
statement.c: In function 'SendParseRequest':
statement.c:2490: warning: 'end_pidx' may be used uninitialized in this function
statement.c:2490: warning: 'sta_pidx' may be used uninitialized in this function
dlg_specific.c: In function 'getDSNinfo':
dlg_specific.c:896: warning: pointer type mismatch in conditional expression
dlg_specific.c: In function 'writeDriverCommoninfo':
dlg_specific.c:915: warning: comparison with string literal results in unspecified behavior
multibyte.c: In function 'pg_CS_code':
multibyte.c:85: warning: unused variable 'len'
multibyte.c: In function 'get_environment_encoding':
multibyte.c:515: warning: unused variable 'acp'
descriptor.c: In function 'TI_Constructor':
descriptor.c:36: warning: the address of 'qual' will always evaluate as 'true'
descriptor.c: In function 'DC_create_errorinfo':
descriptor.c:587: warning: unused variable 'func'
pgapi30.c: In function 'PGAPI_GetConnectAttr':
pgapi30.c:401: warning: unused variable 'func'
pgapi30.c: In function 'PGAPI_SetConnectAttr':
pgapi30.c:1667: warning: cast from pointer to integer of different size
pgapi30.c: In function 'PGAPI_SetStmtAttr':
pgapi30.c:1870: warning: cast from pointer to integer of different size
pgapi30.c:1873: warning: cast from pointer to integer of different size
mylog.c: In function 'forcelog':
mylog.c:253: warning: format '%u' expects type 'unsigned int', but argument 3 has type 'pthread_t'

Responses

pgsql-odbc by date

Next:From: Hiroshi SaitoDate: 2008-09-16 14:45:36
Subject: Re: Compiler warnings in psqloodbc 08.03.0200
Previous:From: Tom LaneDate: 2008-09-16 12:35:55
Subject: Re: psqlODBC and IPv6

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group