Issue Details (XML | Word | Printable)

Key: CORE-3022
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Alexander Peshkov
Reporter: Alexander Peshkov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Firebird Core

gpre C++ compiler warnings with GCC 4.4.1

Created: 28/May/10 07:30 AM   Updated: 04/Feb/11 12:10 PM
Component/s: None
Affects Version/s: 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.1.0, 2.0.4, 2.5 Alpha 1, 2.1.1, 2.0.5, 2.1.2, 2.5 Beta 1, 2.5 Beta 2, 2.1.3, 3.0 Initial, 2.5 RC1, 2.5 RC2, 2.0.6, 2.5 RC3, 2.5.0
Fix Version/s: 2.1.4, 2.5.1, 2.0.7, 3.0 Alpha 1

Time Tracking:
Not Specified

File Attachments: 1. Text File AmbigiousElseWarning.patch (0.7 kB)


Target: 2.5.1
Planning Status: Unspecified


 Description  « Hide
Issue was reported and patch provided by Daniel Dodson <zabbit@yahoo.com>

When compiling generated C++ from gpre I was receiving a warning "ambiguous else statement". From the following kind of statement...

    EXEC SQL
        SELECT COUNT(*)
        INTO :count
        FROM RDB$RELATIONS
        WHERE RDB$RELATION_NAME=:a_tablename;

 it was outputting, in part, the following code

       if (!SQLCODE)
          if (isc_4.isc_6)
             {
             count = isc_4.isc_5;
             }
          else
             SQLCODE = 100;

Legally I don't think this is a problem because the else statement applies to the nearest 'if' statement (so the second one in this case). However I didn't want to add a rule to ignore this warning because that would be bad practise in hand crafted C++ and I would want it highlighted. So rather than add a rule for different flags I decided to modify gpre so that the following is produced...

       if (!SQLCODE)
          {

          if (isc_4.isc_6)

             {

             count = isc_4.isc_5;

             }

          else
             {

             SQLCODE = 100;
             }
          }

 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alexander Peshkov added a comment - 14/Oct/10 11:35 AM
Applied suggested patch