Re: Fixed some compiler warnings

From: Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: Fixed some compiler warnings
Date: 2014-02-06 07:49:48
Message-ID: CANxoLDd8BP-b_sF2x_MwFUKeuhVVH752aB8J3=YNO_mXSRSi8g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Wed, Feb 5, 2014 at 7:49 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

> Hi
>
>
> On Wed, Feb 5, 2014 at 7:42 AM, Akshay Joshi <
> akshay(dot)joshi(at)enterprisedb(dot)com> wrote:
>
>> Hi Dave
>>
>> I have removed the check like "if (i > 0 || i ==0)" from many places
>> except one. I have tried to fix compiler warnings either by modifying the
>> logic or putting some other checks. Attached is the modified patch, please
>> review it.
>>
>
> Any reason you can see for not just replacing:
>
> if (selStart >= 0 && selStart != (size_t)(-1))
>
> with
>
> if (selStart != (size_t)(-1))
>
Fixed the above. I have also fixed some more compiler warnings that I
have faced on Windows. Attached is the new patch.

>
> Also, did you check that these changes don't introduce new warning on
> Windows/Linux?
>

Yes. I have checked no other warnings has been introduce.

>
>
>>
>> On Mon, Feb 3, 2014 at 3:13 PM, Akshay Joshi <
>> akshay(dot)joshi(at)enterprisedb(dot)com> wrote:
>>
>>>
>>>
>>>
>>> On Mon, Feb 3, 2014 at 2:51 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>>
>>>>
>>>>
>>>>
>>>> On Mon, Feb 3, 2014 at 6:50 AM, Akshay Joshi <
>>>> akshay(dot)joshi(at)enterprisedb(dot)com> wrote:
>>>>
>>>>> Thanks Ashesh,
>>>>>
>>>>>
>>>>> On Mon, Feb 3, 2014 at 11:49 AM, Ashesh Vashi <ashesh.vashi@
>>>>> enterprisedb.com> wrote:
>>>>>
>>>>>> Akshay,
>>>>>>
>>>>>> wxGetSingleChoiceIndex returns integer not "unsigned integer"
>>>>>> And, this syntax is definitely wrong in any case for unsigned integers
>>>>>>
>>>>>
>>>>> Fixed the above by changing the data type from "unsigned int" to
>>>>> "int", but for the other cases in the patch where I have applied the logic
>>>>> like if (i > 0 || i==0) to fix compiler warnings, we have already
>>>>> discussed the same solution on Friday.
>>>>>
>>>>> Attached is the modified patch.
>>>>>
>>>>
>>>> What did you discuss on Friday?
>>>>
>>>
>>> To fix compiler warnings we have to modify the condition in such a
>>> way that it will work. So we talked about modifying the condition like
>>> "((i > 0 || i ==0) && i != (size_t)-1)".
>>>
>>>>
>>>>
>>>>
>>>>>
>>>>>> if (i > 0 || i == 0)
>>>>>>
>>>>>>
>>>>>> On Mon, Feb 3, 2014 at 11:34 AM, Akshay Joshi <
>>>>>> akshay(dot)joshi(at)enterprisedb(dot)com> wrote:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Jan 31, 2014 at 7:26 PM, Dave Page <dpage(at)pgadmin(dot)org>wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, Jan 31, 2014 at 6:03 AM, Akshay Joshi <
>>>>>>>> akshay(dot)joshi(at)enterprisedb(dot)com> wrote:
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Thu, Jan 30, 2014 at 7:35 PM, Dave Page <dpage(at)pgadmin(dot)org>wrote:
>>>>>>>>>
>>>>>>>>>> Hi
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Thu, Jan 30, 2014 at 9:35 AM, Akshay Joshi <
>>>>>>>>>> akshay(dot)joshi(at)enterprisedb(dot)com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi Dave
>>>>>>>>>>>
>>>>>>>>>>> I have fixed some compiler warnings which we are facing on OSXMavericks. Attached
>>>>>>>>>>> is the patch file. Can you please review it.
>>>>>>>>>>>
>>>>>>>>>>> If patch looks good to you then can you please commit it.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> It mostly looks good, but what's with the operator changes? Why
>>>>>>>>>> is it complaining about x >= 0 ?
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> In all such cases x is unsigned int and compiler complaining about
>>>>>>>>> condition "x >=0" will always true.
>>>>>>>>>
>>>>>>>>
>>>>>>>> Ahh yes. However, the proposed fix will always evaluate to true
>>>>>>>> won't it?
>>>>>>>>
>>>>>>>> if (i > 0 || i == 0)
>>>>>>>> {
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>
>>>>>>> Yes it will, but in this case compiler didn't generate any
>>>>>>> warning.
>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Dave Page
>>>>>>>> Blog: http://pgsnake.blogspot.com
>>>>>>>> Twitter: @pgsnake
>>>>>>>>
>>>>>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>>>>> The Enterprise PostgreSQL Company
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> *Akshay Joshi*
>>>>>>> *Principal Software Engineer *
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517> Mobile: +91
>>>>>>> 976-788-8246 <%2B91%20976-788-8246>*
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> --
>>>>>>
>>>>>> Thanks & Regards,
>>>>>>
>>>>>> Ashesh Vashi
>>>>>> EnterpriseDB INDIA: Enterprise PostgreSQL Company<http://www.enterprisedb.com>
>>>>>>
>>>>>>
>>>>>>
>>>>>> *http://www.linkedin.com/in/asheshvashi*<http://www.linkedin.com/in/asheshvashi>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Akshay Joshi*
>>>>> *Principal Software Engineer *
>>>>>
>>>>>
>>>>>
>>>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517> Mobile: +91
>>>>> 976-788-8246 <%2B91%20976-788-8246>*
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Dave Page
>>>> Blog: http://pgsnake.blogspot.com
>>>> Twitter: @pgsnake
>>>>
>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>> The Enterprise PostgreSQL Company
>>>>
>>>
>>>
>>>
>>> --
>>> *Akshay Joshi*
>>> *Principal Software Engineer *
>>>
>>>
>>>
>>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517> Mobile: +91 976-788-8246
>>> <%2B91%20976-788-8246>*
>>>
>>
>>
>>
>> --
>> *Akshay Joshi*
>> *Principal Software Engineer *
>>
>>
>>
>> *Phone: +91 20-3058-9517 <%2B91%2020-3058-9517> Mobile: +91 976-788-8246
>> <%2B91%20976-788-8246>*
>>
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

--
*Akshay Joshi*
*Principal Software Engineer *

*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*

Attachment Content-Type Size
Fixed_Compiler_Warnings_V3.patch application/octet-stream 8.4 KB

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Michal Kozusznik 2014-02-06 10:25:45 Re: Format SQL (external tool)
Previous Message suhas_bt022 2014-02-06 06:37:10 Tool for translation of Oracle PL/SQL into Postgresql PL/pgSQL