Bug 110813 - bad source code
Summary: bad source code
Alias: None
Product: Fedora
Classification: Fedora
Component: gpm   
(Show other bugs)
Version: 1
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Eido Inoue
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2003-11-24 16:48 UTC by d.binderman
Modified: 2007-11-30 22:10 UTC (History)
2 users (show)

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

Attachments (Terms of Use)

Description d.binderman 2003-11-24 16:48:01 UTC
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):

How reproducible:

Steps to Reproduce:
1. by inspection

Additional info:

Comment 1 Eido Inoue 2003-11-24 17:14:34 UTC
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 17:33:24 UTC
>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 20:29:05 UTC
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 15:12:37 UTC
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.