From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6703 Path: news.gmane.org!not-for-mail From: Bobby Bingham Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] don't shadow functions with macros in C++ Date: Mon, 8 Dec 2014 20:18:12 -0600 Message-ID: <20141209021810.GA13045@duality.lan> References: <20141209000614.GL4574@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="82I3+IH0IqGh5yIs" X-Trace: ger.gmane.org 1418092066 19289 80.91.229.3 (9 Dec 2014 02:27:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Dec 2014 02:27:46 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-6716-gllmg-musl=m.gmane.org@lists.openwall.com Tue Dec 09 03:27:39 2014 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XyAWZ-0004tq-2G for gllmg-musl@m.gmane.org; Tue, 09 Dec 2014 03:27:39 +0100 Original-Received: (qmail 15769 invoked by uid 550); 9 Dec 2014 02:27:38 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 15758 invoked from network); 9 Dec 2014 02:27:37 -0000 Content-Disposition: inline In-Reply-To: <20141209000614.GL4574@brightrain.aerifal.cx> X-Operating-System: Linux duality 3.13.5-gentoo User-Agent: Mutt/1.5.22 (2013-10-16) Xref: news.gmane.org gmane.linux.lib.musl.general:6703 Archived-At: --82I3+IH0IqGh5yIs Content-Type: text/plain; charset=utf-8 Content-Disposition: inline C++ programmers typically expect something like "::function(x,y)" to work and may be surprised to find that "(::function)(x,y)" is actually required due to the headers declaring a macro version of some standard functions. We already omit function-like macros for C++ in most cases where there is a real function available. This commit extends this to the remaining function-like macros which have a real function version. --- include/complex.h | 2 ++ include/pthread.h | 2 ++ include/threads.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/include/complex.h b/include/complex.h index 13a45c5..e1af0d5 100644 --- a/include/complex.h +++ b/include/complex.h @@ -101,6 +101,7 @@ double creal(double complex); float crealf(float complex); long double creall(long double complex); +#ifndef __cplusplus #define __CIMAG(x, t) \ ((union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1]) @@ -111,6 +112,7 @@ long double creall(long double complex); #define cimag(x) __CIMAG(x, double) #define cimagf(x) __CIMAG(x, float) #define cimagl(x) __CIMAG(x, long double) +#endif #define __CMPLX(x, y, t) \ ((union { _Complex t __z; t __xy[2]; }){.__xy = {(x),(y)}}.__z) diff --git a/include/pthread.h b/include/pthread.h index f7c9568..2697e8b 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -84,7 +84,9 @@ __attribute__((const)) pthread_t pthread_self(void); int pthread_equal(pthread_t, pthread_t); +#ifndef __cplusplus #define pthread_equal(x,y) ((x)==(y)) +#endif int pthread_setcancelstate(int, int *); int pthread_setcanceltype(int, int *); diff --git a/include/threads.h b/include/threads.h index 0e5836c..0179482 100644 --- a/include/threads.h +++ b/include/threads.h @@ -51,7 +51,9 @@ void thrd_yield(void); thrd_t thrd_current(void); int thrd_equal(thrd_t, thrd_t); +#ifndef __cplusplus #define thrd_equal(A, B) ((A) == (B)) +#endif void call_once(once_flag *, void (*)(void)); -- Bobby Bingham --82I3+IH0IqGh5yIs Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJUhlviAAoJEFedFv6RmqC9KNQP/0NK2pexQMizWMxWjrh9adR3 R91sEfvL2fAz6gHBtVSO89MaBfWeR+cd2lNWB2g7CBQJURMz4uM9e17fROOJRafg a4OpiXRTvtbTcmOrpjJxcGtbIUsdVcssuOr04W+01GswPV2zX467aQs8rWRRG9Vz 2i3feJ7Xbwp7oUhTFv1LKp03vBoRvhA3GfXgG1nKbJ122OCVPrmcCNlPS6jWmBKy zoxxpfmGlAD2OCCrYzOLVxLbJpJz+ihEzrttAPzMkWSGdLdIROKu0Izp4L3KsyEd LdK3tcQ82vDBeg2RlW88i6KUuR+OwEwkO9TqPGYYvHXhf/I9Q/jqeQcfwPrpGO4p hBEPq7cbqFBPGfXuvuxZ57oFVGP8vx6aMGRQ9JkErZnjKy/nTwjK80JhYj1AmyzP 92WvK/2+1r0jIi8H35XEDFCm7yvwNtv27q+97gpMkyRbdFVQpzbwy2CyANL/K3Lt UqIj2H3JsiXaOFAu8y0yB4HzIbiCR+T/3IeZXEx6Blpe6N2dmrqOYt9VT6oAXX7r uVOS23S19OKjoUReVZIApHste+vmibKNGBdUp3A+eKoiyvptnBERw70LAvOwOXvs OZh3Y7kC2bYv4gzG8hygY6Zex/zcG8JWWMjFLpQEMl4DO00NNujKcnz7zZzbINEI wELqRFBG4k26O1yET3CA =tafE -----END PGP SIGNATURE----- --82I3+IH0IqGh5yIs--