From owner-freebsd-current@FreeBSD.ORG Mon Sep 24 09:52:19 2012 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 425D21065673 for ; Mon, 24 Sep 2012 09:52:19 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id F2A718FC0C for ; Mon, 24 Sep 2012 09:52:18 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:4c3a:8731:c02a:580a] (unknown [IPv6:2001:7b8:3a7:0:4c3a:8731:c02a:580a]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 7FC225C59; Mon, 24 Sep 2012 11:52:17 +0200 (CEST) Message-ID: <50602D4E.1040304@andric.com> Date: Mon, 24 Sep 2012 11:52:14 +0200 From: Dimitry Andric User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20120905 Thunderbird/16.0 MIME-Version: 1.0 To: "O. Hartmann" References: <50602990.2090408@zedat.fu-berlin.de> In-Reply-To: <50602990.2090408@zedat.fu-berlin.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: Current FreeBSD Subject: Re: CLANG versus GCC question: compiling non-c99 code with CLANG (clang dumps error) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 09:52:19 -0000 On 2012-09-24 11:36, O. Hartmann wrote: > 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. Declarations with no type default to int, the infamous "implicit int" rule, which apparently is very hard to get rid of. :) I'm not even sure the committees managed to ditch it in C11... In any case, in very old C, the 'void' type did not exist; you simply ignored the return value of such a function. > 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. Unfortunately you did not post the actual error message. What was it?