Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 99759 - speedtouch-1.3.1-r2 fails with gcc-4.x (suggested patch attached)
Summary: speedtouch-1.3.1-r2 fails with gcc-4.x (suggested patch attached)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Dialup Developers
URL:
Whiteboard:
Keywords: Inclusion
Depends on:
Blocks:
 
Reported: 2005-07-20 23:30 UTC by kfm
Modified: 2005-07-23 14:53 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
speedtouch-1.3.1-r2.ebuild -> speedtouch-1.3.1-r3.ebuild (patch) (speedtouch-1.3.1-r3.ebuild.diff.txt,964 bytes, patch)
2005-07-20 23:36 UTC, kfm
Details | Diff
files/speedtouch-1.3.1-gcc4.patch (speedtouch-1.3.1-gcc4.patch,277 bytes, patch)
2005-07-20 23:37 UTC, kfm
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kfm 2005-07-20 23:30:37 UTC
Hi. Following on from bug 99753 in my bid to get my Alcatel Speedtouch modem
working I discovered that the speedtouch ebuild doesn't get along with gcc-4.0.1
either. But this one seems to be a trivial fix. The problem is that some of the
programs are intended to accept a parameter to set the verbosity of logging. To
that end they each declare the "verbose" variable as a static int in global
scope. However, in the case of "modem_run.c", it includes "modem.h" which has
the following conflicting delaration:

  /* Global Variables */
  extern int verbose;

This unit is unique in that respect; the simplest workaround seems to be to
remove that declaration in the header. Of course, the CVS code looks to be in
much better shape (and takes a different approach) but who knows when the next
release will be?

So, I'm attaching a patch against the prior ebuild revision and a patch
containing the fix. Note that I cannot actually test my modem right now (my
entire system is sitting on a chroot at a remote location). I don't anticipate
any problems but I'll post back in any case just to state whether things work
out OK.
Comment 1 kfm 2005-07-20 23:36:56 UTC
Created attachment 63950 [details, diff]
speedtouch-1.3.1-r2.ebuild -> speedtouch-1.3.1-r3.ebuild (patch)
Comment 2 kfm 2005-07-20 23:37:39 UTC
Created attachment 63951 [details, diff]
files/speedtouch-1.3.1-gcc4.patch
Comment 3 Alin Năstac (RETIRED) gentoo-dev 2005-07-21 10:57:05 UTC
I think it should be done the other way around - verbose should be declared as
global instead as static.

does removal of static keywords solve compilation problem on gcc-4?
Comment 4 kfm 2005-07-21 16:42:02 UTC
OK, I've migrated to the new system. The modem is working fine with these
packages. As your suggested approach apropos of this bug, I'll post back as soon
as I can with news (and probably a revised patch).
Comment 5 kfm 2005-07-23 10:09:28 UTC
I've tried changing the "static int verbose = 0;" declaration at modem_run.c:94
to "int verbose = 0;" as you suggested and yes, that does fix it as well. But
after thinking about it (and seeking some other opinions) I believe that the way
I suggested is best practice in this case. Please allow me to explain why I
think that:

1) The extern implies that the variable is shared between multiple C files which
are compiled into one binary.

2) But ... that isn't actually the case here with the speedtouch code. If you
search for "verbose" in the source tree, it is apparent that each file has its
own method of setting it. It's statically scoped for each program which makes
sense in this case - there should be no sharing.

3) Any C file that /were/ to include that header would in this case end up
redefining it in another scope anyway, after including the header (because of
the use of static modifiers throughout). Indeed, the only C file that does
include the modem.h header is modem_run.c itself so there is no point.

Basically I think the use of static accomplishes what the author had intended
and that the extern declaration is a mistake. They're each independent tools
accepting their own independent parameter to set verbosity within the scope of
themselves only. If the intentions (and code) were different then it would be
the other way around of course.

My feeling is that, for the sake of only 2 extra diff lines one may as well put
in the logically correct fix even if it there happens to be no effective
difference between either approach for this particular case (in terms of getting
it generally working).
Comment 6 Alin Năstac (RETIRED) gentoo-dev 2005-07-23 14:53:24 UTC
you're right.

fixed without bumping the revision - no need for it since it only makes the
package installable on systems with gcc-4.