From owner-svn-src-all@FreeBSD.ORG Tue Apr 16 13:44:41 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 E0DAD707; Tue, 16 Apr 2013 13:44:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) by mx1.freebsd.org (Postfix) with ESMTP id 6C767BE1; Tue, 16 Apr 2013 13:44:40 +0000 (UTC) Received: from spaceball.andric.com (spaceball.andric.com [IPv6:2001:7b8:3a7:0:204:4bff:fe01:de8a]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id F37FD5C44; Tue, 16 Apr 2013 15:44:37 +0200 (CEST) Message-ID: <516D55C4.1050102@FreeBSD.org> Date: Tue, 16 Apr 2013 15:44:36 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Thunderbird/21.0 MIME-Version: 1.0 To: Bruce Evans 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> In-Reply-To: <20130416205349.W1783@besplex.bde.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Cc: =?UTF-8?B?zpPOuc+Oz4HOs86/z4IgzprOtc+BzrHOvM6vzrTOsc+C?= , svn-src-head@FreeBSD.org, Gregory Shapiro , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org 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 13:44:42 -0000 On 2013-04-16 13:28, Bruce Evans wrote: > On Tue, 16 Apr 2013, Dimitry Andric wrote: >> On 2013-04-16 06:19, =CE=93=CE=B9=CF=8E=CF=81=CE=B3=CE=BF=CF=82 =CE=9A= =CE=B5=CF=81=CE=B1=CE=BC=CE=AF=CE=B4=CE=B1=CF=82 wrote: =2E.. >>> : cc -O2 -pipe -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/s= rc >>> -I/usr/src/usr.sbin/sendmail/../../contrib/sendmail/include -I. -DNEW= DB >>> -DNIS -DTCPWRAPPERS -DMAP_REGEX -DDNSMAP -DNETINET6 -DSTARTTLS -D_FFR= _TLS_1 >>> -I/usr/local/include -DSASL=3D20126 -std=3Dgnu99 -Qunused-arguments >>> -fstack-protector -Wsystem-headers -Wno-pointer-sign -Wno-empty-body >>> -Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value >>> -Wno-parentheses-equality -Wno-unused-function -Wno-conversion -Wno-s= witch >>> -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -c >>> /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c >>> : /usr/src/usr.sbin/sendmail/../../contrib/sendmail/src/usersmtp.c:17= 97:50: >>> warning: incompatible pointer types passing 'void ()' to parameter of= type >>> 'void (*)(char *, bool, MAILER *, struct >>> : mailer_con_info *, ENVELOPE *)' [-Wincompatible-pointer-types= ] >>> : smtpresult =3D reply(m, mci, e, TimeOuts.to_auth, getsaslda= ta, >>> NULL, >>> : ^~~~~~~~~~~= =2E.. > stdbool is certainly incompatible with simple use of __P(()), but why d= oes > the error message say that the function type is 'void ()', and why does= n't > it say that the prototype doesn't match the function? Because we pass -Wno-knr-promoted-parameter to suppress the warning. Before clang grew this flag, we had to set NO_WERROR to make it non-fatal. =2E.. > 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 n= ot compatible with the parameter type 'bool' declared in a previous proto= type [-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 pa= rameter of type 'vb *' (aka 'void (*)(bool)') [-Wincompatible-pointer-typ= es] > @ 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 warn= ing > about it, and also throws away the type info that it learns by compilin= g > 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. :-)