From owner-svn-src-all@FreeBSD.ORG Tue Apr 16 14:34:35 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B33D05DE; Tue, 16 Apr 2013 14:34:35 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from tux-cave.hellug.gr (tux-cave.hellug.gr [195.134.99.74]) by mx1.freebsd.org (Postfix) with ESMTP id 199DEF0C; Tue, 16 Apr 2013 14:34:34 +0000 (UTC) X-Spam-Status: No X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-2.9, required 5, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_00 -1.90) X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-ID: r3GEYLZR024559 Received: from saturn.laptop (217-162-217-29.dynamic.hispeed.ch [217.162.217.29]) (authenticated bits=0) by tux-cave.hellug.gr (8.14.3/8.14.3/Debian-9.4) with ESMTP id r3GEYLZR024559 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 16 Apr 2013 17:34:29 +0300 Received: from saturn.laptop (localhost [127.0.0.1]) by saturn.laptop (8.14.4/8.14.4/Debian-2.1ubuntu1) with ESMTP id r3GEYFQK003340 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 16 Apr 2013 16:34:15 +0200 Received: (from keramida@localhost) by saturn.laptop (8.14.4/8.14.4/Submit) id r3GEYEdU003337; Tue, 16 Apr 2013 16:34:14 +0200 X-Authentication-Warning: saturn.laptop: keramida set sender to keramida@ceid.upatras.gr using -f From: keramida@ceid.upatras.gr (Giorgos Keramidas) To: Dimitry Andric Subject: Re: svn commit: r246880 - in head: lib/libsm libexec/mail.local libexec/smrsh share/mk usr.bin/vacation usr.sbin/sendmail References: <201302162017.r1GKHVdY022667@svn.freebsd.org> <87a9ozayzk.fsf@saturn.laptop> <516D13C5.70900@FreeBSD.org> <20130416205349.W1783@besplex.bde.org> <516D55C4.1050102@FreeBSD.org> Date: Tue, 16 Apr 2013 16:34:14 +0200 In-Reply-To: <516D55C4.1050102@FreeBSD.org> (Dimitry Andric's message of "Tue, 16 Apr 2013 15:44:36 +0200") Message-ID: <87r4iaa6jd.fsf@saturn.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@FreeBSD.org, Gregory Shapiro , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Bruce Evans X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 14:34:35 -0000 On Tue, 16 Apr 2013 15:44:36 +0200, Dimitry Andric wrote: > On 2013-04-16 13:28, Bruce Evans wrote: >> Extending the example a little gives the answer to my question: >> >> @ #include >> @ >> @ typedef void vb(bool first); >> @ >> @ vb foo; >> @ void bar(vb *p); >> @ >> @ void >> @ foo(first) >> @ bool first; >> @ { >> @ bar(foo); >> @ } >> >> @ z.c:10:7: warning: promoted type 'int' of K&R function parameter is >> not compatible with the parameter type 'bool' declared in a previous >> prototype [-Wknr-promoted-parameter] >> @ bool first; >> @ ^ >> @ z.c:5:4: note: previous declaration is here >> @ vb foo; >> @ ^ >> @ z.c:12:6: warning: incompatible pointer types passing 'void ()' to parameter of type 'vb *' (aka 'void (*)(bool)') [-Wincompatible-pointer-types] >> @ bar(foo); >> @ ^~~ >> @ z.c:6:14: note: passing argument to parameter 'p' here >> @ void bar(vb *p); >> @ ^ >> @ 2 warnings generated. >> >> Apparently clang ignores the mismatched prototype after printing a warning >> about it, and also throws away the type info that it learns by compiling >> the K&R function, so it is left with only 'void ()' for the type. > > Yes, this is basically what happens. The actual definition of the > function overrides the prototype, if it comes before the invocation. > > For example, in the original problem case, the warning could also be > worked around by moving the getsasldata() definition to below > attemptauth(), where it is invoked. This still counts as cheating, > though. :-) And that's precisely why other functions, like esmtp_check() do not have the same problem, even though they have exactly the same signature and they are used in the same way!