[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] gcc-4.4.3 usage



Hello,

Am Sa, 22.05.2010, 00:11 schrieb Vincent Rivière:

> First, which compiler are you using ?

Native gcc 4.4.3 with aranym

>
> I believe you have not found the correct definition of min().

I found the definition in one of the sources shiped with netsurf, thats
the project I'm trying to port.

> My cross-compiler is shipped with the PML math library, and there is that
> in
> <math.h>:
>
> #  ifndef max
> #   define max(x,y) ({typeof(x) _x=(x); typeof(y) _y=(y); if (_x>_y)
> _y=_x;
> _y;})
> #   define min(x,y) ({typeof(x) _x=(x); typeof(y) _y=(y); if (_x<_y)
> _y=_x;
> _y;})
> #  endif
>
> This is where that famous typeof is.
> However, it should be OK.
> Note that it generates only a warning, not an error.

I did only post the warnings, errors follow after the warning:
expected ; before _x
expected ; before _y

etc.


> And typeof is a GCC built-in (like sizeof), it should not be seen as a
> function. Maybe your project use special compilation settings ?

The projects Makefile is somewhat silent. I found these Flags, but that
doesn't mean there can't be other flags passed to gcc:

-W -Wall -Wundef -Wpointer-arith \
	-Wcast-align -Wwrite-strings -Wstrict-prototypes \
	-Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \
	-Wnested-externs

-std=c99 -g -I. -Dsmall $(WARNFLAGS) \
		-D_BSD_SOURCE \
		-D_XOPEN_SOURCE=600 \
		-D_POSIX_C_SOURCE=200112L  \


>
> To solve your problem temporarily: in layout.c, after all the includes put
> the following lines:
> #undef min
> #define min(a,b) ((a)<(b)?(a):(b))
> #undef max
> #define max(a,b) ((a)>(b)?(a):(b))
>
> Well, basically you have some hints, you should be able to fix your
> problem
> while <math.h> is not yet fixed.

Yes, that fixed the warnings / errors.

Thanks!