Skip to Content.
Sympa Menu

freetds - RE: [freetds] warnings and oddities

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO Frediano" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] warnings and oddities
  • Date: Tue, 9 Dec 2003 11:31:12 +0100

>
> I might be the first person to compile yesterday's snapshow
> with gcc 3.3 on Tru64. It griped 114 warnings, and some
> apparent misdetections, too. Attached.
>

Good!

> Some of the complaints are about not declaring vsnprintf(3),
> even though it's installed and recognized by configure.
> Evidence below.
>
> There are some warnings I just don't know how to avoid, and
> some I think we should advise be turned off, e.g.:
>
> replacements/iconv.c:200: warning: cast from pointer to
> integer of different size
>
> That line is:
>
> if ((int)cd == UCS2LE_ASCII && !isascii(**inbuf)) {
>
> We know perfectly well that "cd", while declared an iconv_t,
> contains an enumerated value, an int. So we *cast* it, and
> still the warning? What warning-proof syntax can we use?
>
> Here's my favorite:
>
> tds/config.c:810: warning: subscript has type `char'
>
> Uh huh. Rules of the game are that a C char is implicitly
> promoted to int, and sizeof(char)<=sizeof(int) on *every*
> platform. It can't be an issue unless the array has >127 elements.
>
> <<warnings.txt>> Anyway, the whole list is attached for your
> perusal.
>
> --jkl
>
> Setup:
>
> $ uname -a
> OSF1 dec050.beehive.com V4.0 1530 alpha
> $ ../configure --prefix=/usr/users/jklowden/local
> --with-tdsver=7.0 --disable-libiconv
>
> Installed flavors of printf:
>
> $ nm /usr/lib/libc.a |grep ^[a-z]*printf |cut -f1 -d' ' |sort
> |uniq fprintf fwprintf printf snprintf sprintf swprintf
> vfprintf vfwprintf vprintf vsnprintf vsprintf vswprintf
> vwprintf wprintf
>
> $ grep -i print include/config.h
> /* Define to 1 if you have the `asprintf' function. */
> /* #undef HAVE_ASPRINTF */
> /* Define to 1 if you have the `vasprintf' function. */
> /* #undef HAVE_VASPRINTF */
> /* Define to 1 if you have the `vsnprintf' function. */
> #define HAVE_VSNPRINTF 1
> /* Define to 1 if you have the `_bprintf' function. */
> /* #undef HAVE__BPRINTF */
> /* Define to 1 if you have the `_vbprintf' function. */
> /* #undef HAVE__VBPRINTF */
>

Detailed warnings:

../../../src/replacements/iconv.c:125: warning: cast to pointer from
integer of different size
../../../src/replacements/iconv.c:153: warning: cast from pointer to
integer of different size
../../../src/replacements/iconv.c:178: warning: cast from pointer to
integer of different size
../../../src/replacements/iconv.c:200: warning: cast from pointer to
integer of different size

Shouldn't be a problem as noted...

../../../src/replacements/vasprintf.c:58: warning: implicit declaration
of function `vsnprintf'

Is implicitly declared as int vsnprintf(...), so it's not a problem,
however I it's better to find where it's defined...

../../../src/tds/token.c:1980: warning: cast from pointer to integer of
different size

It's just a log... we do not support %p in tdsdump_log, don't we?

../../../src/tds/write.c:159: warning: passing arg 5 of `tds_iconv' from
incompatible pointer type
../../../src/tds/write.c:159: warning: passing arg 7 of `tds_iconv' from
incompatible pointer type
../../../src/tds/convert.c:890: warning: long long int format, TDS_INT8
arg (arg 3)
../../../src/tds/convert.c:949: warning: long long int format, TDS_INT8
arg (arg 3)

You can ignore them...

../../../src/tds/convert.c:1715: warning: implicit declaration of
function `strtok_r'

Is implicitly declared as int strtok_r!!! This IS a problem. strtok_r
returns a pointer so conversion pointer -> int -> pointer where
sizeof(int) < sizeof(pointer) can cause a pointer to garbage...

../../../src/tds/convert.c:1715: warning: assignment makes pointer from
integer without a cast
../../../src/tds/convert.c:1904: warning: assignment makes pointer from
integer without a cast

Due to strtok_r not declared

../../../src/tds/config.c:319: warning: subscript has type `char'
../../../src/tds/config.c:330: warning: subscript has type `char'
../../../src/tds/config.c:330: warning: subscript has type `char'
../../../src/tds/config.c:332: warning: subscript has type `char'
../../../src/tds/config.c:333: warning: subscript has type `char'
../../../src/tds/config.c:344: warning: subscript has type `char'
../../../src/tds/config.c:351: warning: subscript has type `char'
../../../src/tds/config.c:351: warning: subscript has type `char'
../../../src/tds/config.c:353: warning: subscript has type `char'
../../../src/tds/config.c:368: warning: subscript has type `char'
../../../src/tds/config.c:810: warning: subscript has type `char'

Fixed in CVS, this can be a real problem too...

...

../../../src/tds/iconv.c:731: warning: passing arg 3 of `iconv' from
incompatible pointer type

Ignore.

...

../../../src/ctlib/ct.c:134: warning: implicit declaration of function
`asprintf'
../../../src/dblib/bcp.c:950: warning: passing arg 6 of
`tds_iconv_fread' from incompatible pointer type
../../../src/dblib/bcp.c:1738: warning: implicit declaration of function
`asprintf'

Same problem for my HP/UX. We compile some replace functions but we do
not define them anywhere...

../../../src/odbc/odbc.c:564: warning: dereferencing type-punned pointer
will break strict-aliasing rules
../../../src/odbc/odbc.c:579: warning: dereferencing type-punned pointer
will break strict-aliasing rules
../../../src/odbc/odbc.c:581: warning: dereferencing type-punned pointer
will break strict-aliasing rules

Fixed in CVS ?

../../../src/odbc/odbc.c:715: warning: cast from pointer to integer of
different size
../../../src/odbc/odbc.c:723: warning: cast from pointer to integer of
different size
../../../src/odbc/odbc.c:727: warning: cast from pointer to integer of
different size

Due to many pointer -> int conversions in ODBC... Is intptr_t portable
??

../../../src/odbc/odbc.c:1438: warning: pointer type mismatch in
conditional expression
../../../src/odbc/odbc.c:1441: warning: pointer type mismatch in
conditional expression
../../../src/odbc/odbc.c:1447: warning: pointer type mismatch in
conditional expression
../../../src/odbc/odbc.c:1487: warning: pointer type mismatch in
conditional expression
../../../src/odbc/odbc.c:1495: warning: pointer type mismatch in
conditional expression
../../../src/odbc/odbc.c:1498: warning: pointer type mismatch in
conditional expression
../../../src/odbc/odbc.c:1501: warning: pointer type mismatch in
conditional expression
../../../src/odbc/odbc.c:1507: warning: pointer type mismatch in
conditional expression
../../../src/odbc/odbc.c:1538: warning: pointer type mismatch in
conditional expression
../../../src/odbc/odbc.c:1544: warning: pointer type mismatch in
conditional expression
../../../src/odbc/odbc.c:1550: warning: pointer type mismatch in
conditional expression

Fixed in CVS

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page