Date: Sat, 20 Feb 2016 15:53:57 +0100 From: Dimitry Andric <dim@FreeBSD.org> To: Alex Denisov <1101.debian@gmail.com> Cc: Steve Kargl <sgk@troutmask.apl.washington.edu>, freebsd-toolchain@freebsd.org Subject: Re: confusing messages from clang Message-ID: <8468C8EA-A503-40FD-8379-2A957CE47C77@FreeBSD.org> In-Reply-To: <FAEB3132-FABB-42B7-B64B-32810931E9B8@gmail.com> References: <20160220005749.GA84382@troutmask.apl.washington.edu> <FAEB3132-FABB-42B7-B64B-32810931E9B8@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 = <sgk@troutmask.apl.washington.edu> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8468C8EA-A503-40FD-8379-2A957CE47C77>