CLANG versus GCC question: compiling non-c99 code with CLANG (clang dumps error)

O. Hartmann ohartman at zedat.fu-berlin.de
Mon Sep 24 09:36:29 UTC 2012


Hello,

I have a problem and I guess there is a simple solution - at least, I hope.

I try to compile a "in spe" port which contains some C code that is
definitely Kernighan & Ritchie standard like:

--
my_func(win)
Window win;
{
	[...]
	if ( current->win.data == (lux_data *)NULL ) return;
	[...]
}
--

There is no declaration of the return type of the function, I guess it
is implicitely void in older standards, but is treated as non void
function in CLANG - and there the error comes in.

I can compile the code without any problems with GCC 4.6 - without any
change of compiling standard or anything like that, it simply compiles.

I tried to apply "CFLAGS+= -std=[c89|gnu89]" when compiling with CLANG
since GCC defaults to gnu89 while CLANG defaults to c99 standard, but
this didn't help.

What is the magic switch and where to place it?

Thanks in advance and sorry for the "noob" question.

Oliver

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20120924/d9c88f93/signature.pgp


More information about the freebsd-current mailing list