Subject: dmalloc and fvwm problem

From: "Nils Lohner" <[email-masked]>
Date: Fri, 15 Dec 2000 12:44:38 +0100

Hello Gray,

here's a problem I'm having with dmalloc (just got the latest from 
http://dmalloc.com) and fvwm 2.3.25

/sup/build/fvwmdevel/fvwm-2.3.25 > make
make  all-recursive
make[1]: Entering directory `/mnt/build/fvwmdevel/fvwm-2.3.25'
Making all in libs
make[2]: Entering directory `/mnt/build/fvwmdevel/fvwm-2.3.25/libs'
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I..  -I/usr/openwin/include  
-DDMALLOC_FUNC_CHECK  -g -O2 -c Graphics.c
In file included from ../libs/fvwmlib.h:471,
                 from Graphics.c:20:
/sup/include/dmalloc.h:119: conflicting types for `malloc'
/usr/include/stdlib.h:139: previous declaration of `malloc'
/sup/include/dmalloc.h:128: conflicting types for `calloc'
/usr/include/stdlib.h:137: previous declaration of `calloc'
/sup/include/dmalloc.h:140: conflicting types for `realloc'
/usr/include/stdlib.h:140: previous declaration of `realloc'
/sup/include/dmalloc.h:163: conflicting types for `memalign'
/usr/include/stdlib.h:235: previous declaration of `memalign'
/sup/include/dmalloc.h:172: conflicting types for `valloc'
/usr/include/stdlib.h:216: previous declaration of `valloc'
/sup/include/dmalloc.h:191: conflicting types for `free'
/usr/include/stdlib.h:138: previous declaration of `free'
Graphics.c: In function `RelieveRectangle':
Graphics.c:67: warning: passing arg 3 of `_free_leap' from incompatible 
pointer type
Graphics.c: In function `AllocNonlinearGradient':
Graphics.c:287: warning: passing arg 3 of `_free_leap' from 
incompatible pointer type
Graphics.c:340: warning: passing arg 3 of `_free_leap' from 
incompatible pointer type
Graphics.c:358: warning: passing arg 3 of `_free_leap' from 
incompatible pointer type
Graphics.c: In function `AllocAllGradientColors':
Graphics.c:381: warning: passing arg 3 of `_free_leap' from 
incompatible pointer type
Graphics.c:382: warning: passing arg 3 of `_free_leap' from 
incompatible pointer type
Graphics.c: In function `ParseGradient':
Graphics.c:476: warning: passing arg 3 of `_free_leap' from 
incompatible pointer type
Graphics.c:477: warning: passing arg 3 of `_free_leap' from 
incompatible pointer type
Graphics.c: In function `CreateGradientPixmapFromString':
Graphics.c:832: warning: passing arg 3 of `_free_leap' from 
incompatible pointer type
make[2]: *** [Graphics.o] Error 1
make[2]: Leaving directory `/mnt/build/fvwmdevel/fvwm-2.3.25/libs'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/mnt/build/fvwmdevel/fvwm-2.3.25'
make: *** [all-recursive-am] Error 2
/sup/build/fvwmdevel/fvwm-2.3.25 > gcc --version
2.95.2
/sup/build/fvwmdevel/fvwm-2.3.25 > dmalloc --version
dmalloc: = 4.8.1
/sup/build/fvwmdevel/fvwm-2.3.25 > uname -a
SunOS topaze 5.7 Generic_106541-02 sun4u sparc SUNW,Ultra-5_10
/sup/build/fvwmdevel/fvwm-2.3.25 > 

dmalloc.h has:
extern
DMALLOC_PNT     malloc(DMALLOC_SIZE size);

which with cpp translates to:
extern
void *  malloc(size_t  size);

and in stdlib.h there is:
extern void *malloc(size_t);

so I don't see where the problem is... but when I change dmalloc.h to 
have the header
extern
void *  malloc(DMALLOC_SIZE size);

it works.  So:

#if (defined(__STDC__) && __STDC__ == 1) || defined(__cplusplus)
#define DMALLOC_PNT             void *
#define DMALLOC_FREE_RET        void
#else
#define DMALLOC_PNT             char *
#define DMALLOC_FREE_RET        int
#endif

Should that be STDC_HEADERS instead of __STDC__ maybe?
config.h:#define STDC_HEADERS 1

putting in these two lines in dmalloc.h hides the problem and lets me 
compile...
#define DMALLOC_PNT             void *
#define DMALLOC_FREE_RET        void

Nils.

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]