Bug 195262 - fails to compile - kpixmapcache.cpp: argument is being passed void*
Summary: fails to compile - kpixmapcache.cpp: argument is being passed void*
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Unmaintained
Component: kdeui (show other bugs)
Version: unspecified
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-04 22:37 UTC by tropikhajma
Modified: 2009-10-25 00:06 UTC (History)
2 users (show)

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


Attachments
POSIX_MADV_WILLNEED patch (1001 bytes, patch)
2009-10-23 08:50 UTC, Yaakov Selkowitz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tropikhajma 2009-06-04 22:37:04 UTC
Version:           4.2.89 (using Devel)
Compiler:          Sun Studio 12 U1 (beta) 
OS:                Solaris
Installed from:    Compiled sources

compiling kdelibs fails with:
...
"/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/util/kpixmapcache.cpp", line 475: Error: Formal argument addr of type char* in call to madvise(char*, unsigned, int) is being passed void*.
1 Error(s) and 1 Warning(s) detected.


the command leading to this is:
cd /export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/build-kdelibs-4.2.89svn977047/kdeui && /usr/bin/CC  -library=no%Cstd  -DQT_NO_STL -DQT_NO_CAST_TO_ASCII -D_REENTRANT -DKDE_DEPRECATED_WARNINGS -DMAKE_KDEUI_LIB -D__EXTENSIONS__ -DSOLARIS -D_REENTRANT -D__EXTENSIONS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_POSIX_PTHREAD_SEMANTICS -DSOLARIS -DSOLARIS10 -DNDEBUG -DNO_DEBUG -D_UNICODE -DUNICODE -D_RWSTD_REENTRANT  -D_XOPEN_SOURCE=500 -D_XPG5  -I/opt/foss/include/stdcxx/ansi -I/opt/foss/include/stdcxx -I/opt/foss/include -D_REENTRANT -D__EXTENSIONS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_POSIX_PTHREAD_SEMANTICS -DSOLARIS -DSOLARIS10 -DNDEBUG -DNO_DEBUG -D_UNICODE -DUNICODE -D_RWSTD_REENTRANT  -D_XOPEN_SOURCE=500 -D_XPG5  -I/opt/foss/include/stdcxx/ansi -I/opt/foss/include/stdcxx -I/opt/foss/include -xtarget=pentium4 -m32 -xarch=sse2 -xchip=pentium4 -xcache=8/64/4:256/128/8 -library=no%Cstd -features=anachronisms,except,rtti,export,extensions,nestedaccess,tmplife,tmplrefstatic -instances=global -template=geninlinefuncs -s -xlang=c99 -xalias_level=compatible -xustr=ascii_utf16_ushort -Qoption ccfe -features=gcc -Qoption ccfe -features=zla -Qoption ccfe ++boolflag:sunwcch=false -mt   -DQT_NO_DEBUG -KPIC -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/build-kdelibs-4.2.89svn977047/kdeui -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047 -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/build-kdelibs-4.2.89svn977047 -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/interfaces -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/interfaces/kregexpeditor -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore/sonnet -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kjs -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/build-kdelibs-4.2.89svn977047/kjs -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/build-kdelibs-4.2.89svn977047/kdecore -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore/compression -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore/config -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore/date -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore/io -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore/jobs -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore/kernel -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore/network -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore/services -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore/localization -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore/sycoca -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore/text -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdecore/util -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/actions -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/colors -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/config -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/dialogs -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/findreplace -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/fonts -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/icons -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/itemviews -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/jobs -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/kernel -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/paged -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/plotting -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/shortcuts -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/sonnet -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/util -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/widgets -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/windowmanagement -I/export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/xmlgui -I/opt/foss/qt4/include/phonon -I/opt/foss/qt4/include/QtXmlPatterns -I/opt/foss/qt4/include/QtWebKit -I/opt/foss/qt4/include/QtHelp -I/opt/foss/qt4/include/QtAssistant -I/opt/foss/qt4/include/QtDBus -I/opt/foss/qt4/include/QtTest -I/opt/foss/qt4/include/QtUiTools -I/opt/foss/qt4/include/QtScript -I/opt/foss/qt4/include/QtSvg -I/opt/foss/qt4/include/QtXml -I/opt/foss/qt4/include/QtSql -I/opt/foss/qt4/include/QtOpenGL -I/opt/foss/qt4/include/QtNetwork -I/opt/foss/qt4/include/QtDesigner -I/opt/foss/qt4/include/Qt3Support -I/opt/foss/qt4/include/QtGui -I/opt/foss/qt4/include/QtCore -I/opt/foss/qt4/include/Qt -I/opt/foss/qt4/share/mkspecs/default -I/opt/foss/qt4/include -I/usr/X11/include    -D_LARGEFILE64_SOURCE -o CMakeFiles/kdeui.dir/util/kpixmapcache.o -c /export/home/test/packages/BUILD/kdelibs-4.2.89svn977047/kdeui/util/kpixmapcache.cpp


this is on opensolaris 2009.06/x86_32
Comment 1 Michael Pyne 2009-06-05 01:20:17 UTC
> this is on opensolaris 2009.06/x86_32

You'd think they'd have fixed madvise() by now.  The first parameter should be void*, not char* (or caddr_t), both by POSIX and the original BSD implementation.

Is this something we should have in kdefakes? I don't like the idea of #ifdef'ing it here.  Alternatively, it there a configure flag we can add for Solaris to get more POSIX-ish #includes?
Comment 2 tropikhajma 2009-06-05 12:59:17 UTC
the sys/mman.h on opensolaris defines posix_madvise, which is probably what is needed:

#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
extern int posix_madvise(void *, size_t, int);
#endif
Comment 3 Michael Pyne 2009-06-08 23:28:03 UTC
SVN commit 979086 by mpyne:

Fix compilation errors on Solaris for good by using a different function that
does the exact same thing but has a different name, except this time the
interface is defined properly.

Or in other words s/madvise/posix_madvise/

Configure checks have also been updated.  Not backporting to 4.2, but will be
in KDE 4.3.

BUG:195262


 M  +3 -3      ConfigureChecks.cmake  
 M  +3 -7      kdecore/sycoca/ksycoca.cpp  
 M  +2 -2      kdeui/util/kpixmapcache.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=979086
Comment 4 Michael Pyne 2009-06-08 23:32:09 UTC
tropikhajma: I said "for good" in the commit log but I'm not sure if we need to add any defines to the command line to actually get access to posix_madvise -- please reopen if it still doesn't compile (preferably with a patch containing the appropriate Sun magic incantation to get POSIX support).
Comment 5 Yaakov Selkowitz 2009-10-23 08:50:46 UTC
Created attachment 37754 [details]
POSIX_MADV_WILLNEED patch

According to POSIX.1-2008[1], you also need to s/MADV_WILLNEED/POSIX_MADV_WILLNEED/ to those two source files.  This is necessary to compile on Cygwin (where the first is not supported but the latter is).

Patch against 4.3.2 attached.

[1] http://www.opengroup.org/onlinepubs/9699919799/functions/posix_madvise.html
Comment 6 Michael Pyne 2009-10-24 22:37:11 UTC
SVN commit 1039881 by mpyne:

Fix a compile error with posix_madvise noted on Cygwin by yselkowitz,
who also provided the patch.

This is for KDE 4.4, will backport to KDE 4.3.3.
CCBUG:195262


 M  +1 -1      kdecore/sycoca/ksycoca.cpp  
 M  +1 -1      kdeui/util/kpixmapcache.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1039881
Comment 7 Michael Pyne 2009-10-25 00:06:51 UTC
SVN commit 1039910 by mpyne:

Backport compile fix for Cygwin usage of posix_madvise to KDE 4.3.3.

Note: This code was wrong but happened to work on non-Cygwin, this is not a
Cygwin-specific change.

Patch provided, and issue reported by yselkowitz.

CCBUG:195262


 M  +1 -1      kdecore/sycoca/ksycoca.cpp  
 M  +1 -1      kdeui/util/kpixmapcache.cpp  


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