From owner-freebsd-toolchain@freebsd.org Sat Feb 20 14:54:07 2016 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70A96AAF54E for ; Sat, 20 Feb 2016 14:54:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3927EB19 for ; Sat, 20 Feb 2016 14:54:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from coleburn.home.andric.com (coleburn.home.andric.com [192.168.0.15]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 5ACB42044F; Sat, 20 Feb 2016 15:54:05 +0100 (CET) Subject: Re: confusing messages from clang Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Content-Type: multipart/signed; boundary="Apple-Mail=_F9809CE0-4FDE-456C-B1D7-E33BEB87B999"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.6b2 (ebbf3ef) From: Dimitry Andric In-Reply-To: Date: Sat, 20 Feb 2016 15:53:57 +0100 Cc: Steve Kargl , freebsd-toolchain@freebsd.org Message-Id: <8468C8EA-A503-40FD-8379-2A957CE47C77@FreeBSD.org> References: <20160220005749.GA84382@troutmask.apl.washington.edu> To: Alex Denisov <1101.debian@gmail.com> X-Mailer: Apple Mail (2.3112) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2016 14:54:07 -0000 --Apple-Mail=_F9809CE0-4FDE-456C-B1D7-E33BEB87B999 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On 20 Feb 2016, at 08:33, Alex Denisov <1101.debian@gmail.com> wrote: >> On 20 Feb 2016, at 01:57, Steve Kargl = wrote: >>=20 >> If anyone is interesting fixing FreeBSD's C compiler, it >> would be appreciated. ... >> foo.c:21:1: error: use of undeclared identifier 'corrupt'; did you = mean 'crypt'? >> corrupt: >> ^~~~~~~ >> crypt >> /usr/include/unistd.h:450:7: note: 'crypt' declared here >> char *crypt(const char *, const char *); >> ^ >> foo.c:21:8: error: expected ';' after return statement >> corrupt: >> ^ >> ; >> foo.c:14:12: error: use of undeclared label 'corrupt' >> goto corrupt; >> ^ ... > I=E2=80=99ve submitted the bug to LLVM=E2=80=99s bugzilla: = https://llvm.org/bugs/show_bug.cgi?id=3D26678 >=20 > Also, it looks like OS agnostic. At least I see the same behaviour on = OSX as well. Yes, the messages could definitely be improved. But for a compiler, it is sometimes hard to guess the 'intent' of the code, though. :) Note that gcc (I used 6.0 from ports) gives similarly confused messages: foo.c: In function 'foo': foo.c:21:1: error: 'corrupt' undeclared (first use in this function) corrupt: ^~~~~~~ foo.c:21:1: note: each undeclared identifier is reported only once for = each function it appears in foo.c:21:1: warning: 'return' with a value, in function returning void foo.c:5:1: note: declared here foo(int i) ^~~ foo.c:21:8: error: expected ';' before ':' token corrupt: ^ foo.c:14:6: error: label 'corrupt' used but not defined goto corrupt; ^~~~ In gcc's case, it appears to read the statement as "return corrupt:", causing it to first complain about the undeclared identifier, and then about a missing semicolon. Later, the label is of course still not defined, so it complains again. -Dimitry --Apple-Mail=_F9809CE0-4FDE-456C-B1D7-E33BEB87B999 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.29 iEYEARECAAYFAlbIfgwACgkQsF6jCi4glqMLPQCfQZGgjWHQuxPLD1WFpHaUpkwd NSkAnA9f/zlG5JkB2LNrppcipKNnuTBg =0J1D -----END PGP SIGNATURE----- --Apple-Mail=_F9809CE0-4FDE-456C-B1D7-E33BEB87B999--