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

Re: Compiler warnings in psqloodbc 08.03.0200

From: Zoltan Boszormenyi <zb(at)cybertec(dot)at>
To: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>
Cc: Hiroshi Saito <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp>, pgsql-odbc(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hans-Juergen Schoenig <hs(at)cybertec(dot)at>
Subject: Re: Compiler warnings in psqloodbc 08.03.0200
Date: 2008-10-01 16:04:48
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc
Hiroshi Inoue írta:
> Zoltan Boszormenyi wrote:
>> Hiroshi Inoue írta:
>>> Zoltan Boszormenyi wrote:
>>>> Hi,
>>>> here's the fix for all non-pointer-signedness warnings,
>>>> against 08.03.0300 that was released meanwhile. Now
>>>> the compilation only emits 246 "differ in signedness"
>>>> warnings, which is still too much noise. I agree with
>>>> Tom Lane that those should be cleaned up if for nothing
>>>> else, than the real bugs don't get lost in the noise.
> I forgot to mention that I don't think it's very nice
> to remove all the warnings.
>>> Thanks.
>>>> In pgapi30.c, two instances of
>>>> "cast from pointer to integer of different size"
>>> They may come from the strange handling of unixODBC's
>>> 64bit ODBC. Honestly I don't understand how to use
>>> 64-bit unixODBC correctly. Probably you can remove the
>>>  warnings by #defining BUILD_REAL_64_BIT_MODE somewhere.
>> I'll try it but the CAST_PTR() seems to be working
>> in both 32 and 64-bit.
> Because I've implemeted the driver with the assmption
> sizeof(SQLLEN) == sizeof(POINTER), I don't think the
> warnings should be removed in such a way.
>> should be defined by the autoconf machinery if needed.
> As I already mentioned, I don't understand 64-bit unixODBC.
> Maybe you have to use 64-bit unixODBC carefully.
>>>> In psqlodbc.c()::finalize_global_cs() is only used inside
>>>> "#ifdef WIN32" but was defined outside causing a
>>>> "defined but not used" warning.
>>> It is also used in _fini() when __GNUC__ isn't defined.
>>> Though I'm not familiar with *nix systems, it seems
>>> strange to me that there's no function with
>>> __attribute__((destructor)) while init() function
>>> with __attribute__((constrcutor)) is used under
>>>  __GNUC__ mode.
>> So, because of boolean logic:
>> A v (!A ^ !B) = A v !B
>> something like below would work:
>> #if defined(WIN32) || !defined(__GNUC__)
>> ...
>> #endif
>> around finalize_global_cs().
> IMHO initialize and finalize functions should be
>  cosidered as a pair and it seems appropriate to issue
> warnings when the corresponding finalize function is
> not used whereas the initialize function is used.

You can register your finalize function with atexit()
to cleanup when the app finishes.

Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH

In response to

pgsql-odbc by date

Next:From: Hiroshi InoueDate: 2008-10-01 16:06:52
Subject: Re: ODBC Driver crash with MS Access 2007 (from GENERAL)
Previous:From: Hiroshi InoueDate: 2008-10-01 16:01:44
Subject: Re: Compiler warnings in psqloodbc 08.03.0200

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