Red Hat Bugzilla – Bug 110813
bad source code
Last modified: 2007-11-30 17:10:34 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
#define UD_RESET "#\r" /* Reset tablet and enable WACOM
#define UD_SENDCOORDS "ST\r" /* Start sending
#define UD_FIRMID "~#\r" /* Request firmware ID
#define UD_COORD "~C\r" /* Request max
#define UD_STOP "\nSP\r" /* stop sending
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):
Steps to Reproduce:
1. by inspection
what compiler are you using? gcc supports nested functions.
and so does iso c-- 1999 spec ISO C that is.
>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.
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".
ISO/IEC 9989-1999 ("C99") does _not_ support nested functions.
Anyway, this probably belongs upstream.