Lists: | pgsql-patches |
---|
From: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | Suppress compiler warnings on mingw |
Date: | 2008-03-14 02:54:34 |
Message-ID: | 20080314114059.63D8.52131E4D@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Here is a patch to suppress compiler warnings in mingw build.
- Remove unused local variables.
- Cast DWORD to unsigned integer explicitly.
DWORD is always 32bit integer on both 32bit and 64bit Windows.
Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center
Attachment | Content-Type | Size |
---|---|---|
mingw-warnings.patch | application/octet-stream | 1.9 KB |
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Cc: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
Subject: | Re: Suppress compiler warnings on mingw |
Date: | 2008-03-14 04:40:45 |
Message-ID: | 200803140540.46540.peter_e@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
ITAGAKI Takahiro wrote:
> - Cast DWORD to unsigned integer explicitly.
> DWORD is always 32bit integer on both 32bit and 64bit Windows.
I think if that is so, you wouldn't need to add any casts. Instead you would
only need to use the right format specifier.
From: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: Suppress compiler warnings on mingw |
Date: | 2008-03-14 05:34:49 |
Message-ID: | 20080314141544.63DB.52131E4D@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> ITAGAKI Takahiro wrote:
> > - Cast DWORD to unsigned integer explicitly.
> > DWORD is always 32bit integer on both 32bit and 64bit Windows.
>
> I think if that is so, you wouldn't need to add any casts. Instead you would
> only need to use the right format specifier.
DWORD is an alias for 'unsigned long' in 32bit Windows.
Do you know how it defined in 64bit Windows?
Postgres requires sizeof(long) = sizeof(void *), but sizeof(DWORD) is
always 4. I fear the formatter for long integer might be broken
in 64bit platform.
If we could expect C99 is always available, 'PRIu32' would be the best choice.
Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center
From: | Jeremy Drake <pgsql(at)jdrake(dot)com> |
---|---|
To: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: Suppress compiler warnings on mingw |
Date: | 2008-03-14 15:40:30 |
Message-ID: | Pine.BSO.4.64.0803140836250.14567@resin.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
On Fri, 14 Mar 2008, ITAGAKI Takahiro wrote:
> DWORD is an alias for 'unsigned long' in 32bit Windows.
> Do you know how it defined in 64bit Windows?
sizeof(DWORD) is always 4, even on 64-bit windows. sizeof(long) is also
always 4. If you want the unsigned integral type that is the same size as
pointers, there are some MS-defined types you can use: DWORD_PTR,
LONG_PTR, ULONG_PTR. Or use the standard size_t and ptrdiff_t.
>
> Postgres requires sizeof(long) = sizeof(void *)
Which is why 64-bit windows is not supported. Hopefully at some point
someone can remove this restriction, but it is likely to be a major
undertaking...
>, but sizeof(DWORD) is
> always 4. I fear the formatter for long integer might be broken
> in 64bit platform.
>
> If we could expect C99 is always available, 'PRIu32' would be the best choice.
>
> Regards,
> ---
> ITAGAKI Takahiro
> NTT Open Source Software Center
>
>
>
>
--
Worst Month of 1981 for Downhill Skiing:
August. The lines are the shortest, though.
-- Steve Rubenstein
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Cc: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
Subject: | Re: Suppress compiler warnings on mingw |
Date: | 2008-03-14 21:18:22 |
Message-ID: | 200803142218.23658.peter_e@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
ITAGAKI Takahiro wrote:
> DWORD is an alias for 'unsigned long' in 32bit Windows.
Then try using %lu and no casts. That should get rid of the warnings the
proper way.
From: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>, Jeremy Drake <pgsql(at)jdrake(dot)com> |
Subject: | Re: Suppress compiler warnings on mingw |
Date: | 2008-03-17 03:04:08 |
Message-ID: | 20080317115020.652C.52131E4D@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> Then try using %lu and no casts. That should get rid of the warnings the
> proper way.
Ok, I rewrote it to use %lu for format strings.
Jeremy Drake <pgsql(at)jdrake(dot)com> wrote:
> sizeof(DWORD) is always 4, even on 64-bit windows. sizeof(long) is also
> always 4.
I got it. This change will work on 64-bit windows, because DWORD is
defined as 'unsigned long' there, too. We need to support LLP64
compliers in advance, though.
Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center
Attachment | Content-Type | Size |
---|---|---|
mingw-warnings.patch | application/octet-stream | 4.6 KB |
From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
Cc: | pgsql-patches(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>, Jeremy Drake <pgsql(at)jdrake(dot)com> |
Subject: | Re: Suppress compiler warnings on mingw |
Date: | 2008-04-16 22:40:05 |
Message-ID: | 48068045.5090903@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Applied, Thanks.
wiki updated.
cheers
andrew
ITAGAKI Takahiro wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
>
>
>> Then try using %lu and no casts. That should get rid of the warnings the
>> proper way.
>>
>
> Ok, I rewrote it to use %lu for format strings.
>
>
> Jeremy Drake <pgsql(at)jdrake(dot)com> wrote:
>
>> sizeof(DWORD) is always 4, even on 64-bit windows. sizeof(long) is also
>> always 4.
>>
>
> I got it. This change will work on 64-bit windows, because DWORD is
> defined as 'unsigned long' there, too. We need to support LLP64
> compliers in advance, though.
>
> Regards,
> ---
> ITAGAKI Takahiro
> NTT Open Source Software Center
>
>
>
> ------------------------------------------------------------------------
>
>
>