Bug 253111 - Kmix define OSS4 if only OSS3 is present
Summary: Kmix define OSS4 if only OSS3 is present
Status: RESOLVED FIXED
Alias: None
Product: kmix
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Christian Esken
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-03 11:51 UTC by Lóránt Farkas
Modified: 2011-09-17 17:23 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lóránt Farkas 2010-10-03 11:51:27 UTC
Version:           4.5 (using KDE 4.5.1) 
OS:                Linux


kmix didn't compiled on my system got error:

In file included from /var/tmp/portage/kde-base/kmix-4.5.1/work/kmix-4.5.1/kmix/kmix-platforms.cpp:107,
                 from /var/tmp/portage/kde-base/kmix-4.5.1/work/kmix-4.5.1/kmix/mixer.cpp:32:
/var/tmp/portage/kde-base/kmix-4.5.1/work/kmix-4.5.1/kmix/mixer_oss4.cpp:68: warning: unused parameter ‘id’
/var/tmp/portage/kde-base/kmix-4.5.1/work/kmix-4.5.1/kmix/mixer_oss4.cpp:68: warning: unused parameter ‘on’
/var/tmp/portage/kde-base/kmix-4.5.1/work/kmix-4.5.1/kmix/mixer_oss4.cpp: In member function ‘MixDevice::ChannelType Mixer_OSS4::classifyAndRename(QString&, int)’:
/var/tmp/portage/kde-base/kmix-4.5.1/work/kmix-4.5.1/kmix/mixer_oss4.cpp:80: error: ‘MIXF_MONVOL’ was not declared in this scope

However I didn't installed OSS4. I think the problem is in kmix-platforms.cpp see below.

Reproducible: Always

Steps to Reproduce:
Try to compile kmix with 

define SOUND_VERSION = 0x030000

in e.g. soundcard.h on linux.

Actual Results:  
kmix didn't compiled.

Expected Results:  
kmix should cmpile cleanly.

The relevant code segment is in kmix/kmix-platforms.cpp:

// OSS 3 / 4

...

#if !defined(__FreeBSD__) && SOUND_VERSION >= 0x040000
#define OSS4_MIXER
#endif

which is true if SOUND_VERSION is defined and not 0. Thus the compilation fail if no OSS4 is installed.

This should be correct to 

#if !defined(__FreeBSD__) && (SOUND_VERSION >= 0x040000)
#define OSS4_MIXER
#endif

and all ok.
Comment 1 Christian Esken 2011-09-09 23:21:33 UTC
Thanks for notifying. It must be some special compiler issue. Because I don't have the issue. I am compiling with the following and the mentioned #if does not return true:
#define SOUND_VERSION   0x030802

Also there are a lot of standard headers that have checks without  ( ), like:

/usr/include/string.h:#if defined __GNUC__ && __GNUC__ >= 2

/usr/include/regex.h:# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))

So I wonder what really triggers the issue. Your change look sensible, but I fear to break other platforms unless I have good faith of not doing harm. Do you have any explanation or can point to documentation about C preprocessor evaluation?
Comment 2 Christian Esken 2011-09-09 23:30:51 UTC
Additional info: http://gcc.gnu.org/onlinedocs/cpp/Defined.html#Defined also shows an example with "defined" and ">=":
#if defined BUFSIZE && BUFSIZE >= 1024
Comment 3 Christian Esken 2011-09-17 17:20:16 UTC
There is no reply from the bug reporter yet. While I do not understand why the patch is necessary, the patch does not seem to do any harm, and I think it is safe to apply the patch.
Comment 4 Christian Esken 2011-09-17 17:22:54 UTC
SVN commit 1254098 by esken:

BUGS: 253111
Resolve build trouble (OSSv4 vs OSSv3)

 M  +1 -1      kmix-backends.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1254098
Comment 5 Christian Esken 2011-09-17 17:23:34 UTC
SVN commit 1254099 by esken:

BUGS: 253111
Resolve build trouble (OSSv4 vs OSSv3) backport to trunk

 M  +1 -1      kmix-backends.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1254099