gcc-4.5. checks enums more strictly

Bug #624740 reported by Peter Pearse
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
freetype (Ubuntu)
Fix Released
Undecided
Unassigned
Maverick
Fix Released
Undecided
Unassigned

Bug Description

Stricter checking of enums used in switch statements results in -Wall -Werror builds failing

arm-linux-gnueabi-gcc (Ubuntu 4.5.1-1ubuntu1) 4.5.1

Errors of the form "error: case value ‘’ not in enumerated type '’ are issued, causing build to fail

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: freetype2-demos (not installed)
ProcVersionSignature: Ubuntu 2.6.32-22.36-generic 2.6.32.11+drm33.2
Uname: Linux 2.6.32-22-generic i686
Architecture: i386
Date: Thu Aug 26 16:51:21 2010
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release i386 (20100429)
ProcEnviron:
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: freetype

Revision history for this message
Peter Pearse (peter-pearse) wrote :

Patch ft2demos-2.4.2/graph/grevents.h to prevent warnings.

tags: added: patch
Revision history for this message
Steve Langasek (vorlon) wrote :

I question the utility of having an exhaustive enum for all of the possible keypresses; I think it makes more sense to just redefine the grEvent struct to use an unsigned short instead of the enum:

Index: ft2demos-2.4.2/graph/grevents.h
===================================================================
--- ft2demos-2.4.2.orig/graph/grevents.h
+++ ft2demos-2.4.2/graph/grevents.h
@@ -106,7 +106,7 @@
   typedef struct grEvent_
   {
     int type;
- grKey key;
+ unsigned short key;
     int x, y;

   } grEvent;

Tested with gcc 4.5, and this appears to work. Do you have an opinion on this?

Revision history for this message
Peter Pearse (peter-pearse) wrote :

My opinion was - "If the author(s) thought an enum was a good idea they must have had a good reason......"

Revision history for this message
David Sugar (dyfet-deactivatedaccount) wrote :

I also agree we should not violate the authors original intent. Hence I agree with the original patch. However, there is clearly enough information in this bug report to make a decision and to implement a fix.

Steve Langasek (vorlon)
Changed in freetype (Ubuntu Maverick):
status: New → Won't Fix
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package freetype - 2.4.2-2

---------------
freetype (2.4.2-2) unstable; urgency=low

  * debian/patches-ft2demos/f2tdemos-grkey.patch: update to fix another
    problem when building under gcc-4.5 that was overlooked in the previous
    version of the patch. LP: #624740.
 -- Steve Langasek <email address hidden> Wed, 08 Sep 2010 07:45:46 +0100

Changed in freetype (Ubuntu Maverick):
status: Won't Fix → Fix Released
Steve Langasek (vorlon)
Changed in freetype (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.