Bug 110813 - bad source code
bad source code
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: gpm (Show other bugs)
1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Eido Inoue
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-11-24 11:48 EST by d.binderman
Modified: 2007-11-30 17:10 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-11-24 15:29:05 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description d.binderman 2003-11-24 11:48:01 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)

Description of problem:

I just tried to compile package gpm-1_20_1-38 from Fedora.

The compiler said

mice.c(1664): error: expected a ";"
     {

The source code is

static Gpm_Type *I_wacom(int fd, unsigned short flags,
                         struct Gpm_Type *type, int argc, char **argv)
{
/* wacom graphire tablet */
#define UD_RESETBAUD     "\r$"      /* reset baud rate to default 
(wacom V) */
                                    /* or switch to wacom IIs 
(wacomIV)     */
#define UD_RESET         "#\r"      /* Reset tablet and enable WACOM 
IV     */
#define UD_SENDCOORDS    "ST\r"     /* Start sending 
coordinates            */
#define UD_FIRMID        "~#\r"     /* Request firmware ID 
string           */
#define UD_COORD         "~C\r"     /* Request max 
coordinates              */
#define UD_STOP          "\nSP\r"   /* stop sending 
coordinates             */

   void reset_wacom()
   {

This code isn't ISO C code - nested functions are not supported.
Suggest move the definition of reset_wacom outside I_wacom to make the
code ISO C compatible.



Version-Release number of selected component (if applicable):
gpm-1_20_1-38 

How reproducible:
Always

Steps to Reproduce:
1. by inspection
2.
3.
    

Additional info:
Comment 1 Eido Inoue 2003-11-24 12:14:34 EST
what compiler are you using? gcc supports nested functions.

and so does iso c-- 1999 spec ISO C that is.
Comment 2 d.binderman 2003-11-24 12:33:24 EST
>what compiler are you using?

Intel, but that doesn't matter.

>gcc supports nested functions

Not when -ansi is in use.

>and so does iso c-- 1999 spec ISO C that is.

Maybe. I was hoping to get the code compilable 
by ISO C 1989. 

That's the version that 99% of C folks use.

 
Comment 3 Eido Inoue 2003-11-24 15:29:05 EST
Intel does C99 with the -c99 flag. GCC does ISO C99 (and turns off
non-standard GNU extensions) with -std=c99

As C99 is a standard, and all the popular compilers in use support (at
least the nested function part of C99) it, including Intel's and
GNU's, I don't believe this is an example of "bad source code".
Comment 4 Miloslav Trmac 2003-11-25 10:12:37 EST
ISO/IEC 9989-1999 ("C99") does _not_ support nested functions.

Anyway, this probably belongs upstream.

Note You need to log in before you can comment on or make changes to this bug.