From patchwork Tue Aug 15 17:45:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel F. T. Gomes" X-Patchwork-Id: 801700 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-83171-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="FKpl+HtM"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xX0Vt3XKFz9t3m for ; Wed, 16 Aug 2017 03:55:02 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:in-reply-to:references :message-id; q=dns; s=default; b=j4lgN/PGjWumJxOCHyWhLJY7JNRnY6x rvzcYuvk+jN8a7+hqXgJyYTe/V9UHtlKxqXPvn2aC9qKAMF0j9OUta0PLjZrAbHL pQ0mCicAomhELjQgL89j6LRl3vbutduWw7pgZ2J+UBYm+RdCMmtx11h/jAa0LQAI vL5Ev5/by4sk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:in-reply-to:references :message-id; s=default; bh=NQwehE+TgdFczFkhBv9JcKKb9UU=; b=FKpl+ HtMYQRpPDabNy7CY5dWq8ddak//SRFAbs1IT6mBZN/ICzmYBU21DxSVzCNQdmG3H wkephppvBHp+S4xPyHFZGb2MCiGQrpfwHvj1XEq7QfVehfxvmNKi/BJ78Pdu8k0P 2SiCEDdAsnzmKi+p9IhOSJhPxAJJ+zCpAunQXg= Received: (qmail 90766 invoked by alias); 15 Aug 2017 17:47:53 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 88676 invoked by uid 89); 15 Aug 2017 17:45:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: "Gabriel F. T. Gomes" To: libc-alpha@sourceware.org Subject: [PATCH 3/3] Do not use generic selection in C++ mode Date: Tue, 15 Aug 2017 14:45:01 -0300 In-Reply-To: <20170815174501.4143-1-gftg@linux.vnet.ibm.com> References: <20170815174501.4143-1-gftg@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17081517-0008-0000-0000-00000866ED84 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007550; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000221; SDB=6.00902759; UDB=6.00452170; IPR=6.00682975; BA=6.00005534; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016707; XFM=3.00000015; UTC=2017-08-15 17:45:25 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17081517-0009-0000-0000-0000438D80FD Message-Id: <20170815174501.4143-4-gftg@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-08-15_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1708150298 The logic to protect the use of generic selection (_Generic) does not check for C or C++ mode, however, generic selection is a C-only feature. Tested for powerpc64le. * misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): Define to 0, if in C++ mode. --- misc/sys/cdefs.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index b3e7f3be96..cfd39d5302 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -463,17 +463,18 @@ # define __glibc_macro_warning(msg) #endif -/* Support for generic selection (ISO C11) is available in GCC since - version 4.9. Previous versions do not provide generic selection, - even though they might set __STDC_VERSION__ to 201112L, when in - -std=c11 mode. Thus, we must check for !defined __GNUC__ when - testing __STDC_VERSION__ for generic selection support. +/* Generic selection (ISO C11) is a C-only feature, available in GCC + since version 4.9. Previous versions do not provide generic + selection, even though they might set __STDC_VERSION__ to 201112L, + when in -std=c11 mode. Thus, we must check for !defined __GNUC__ + when testing __STDC_VERSION__ for generic selection support. On the other hand, Clang also defines __GNUC__, so a clang-specific check is required to enable the use of generic selection. */ -#if __GNUC_PREREQ (4, 9) \ - || __glibc_clang_has_extension (c_generic_selections) \ - || (!defined __GNUC__ && defined __STDC_VERSION__ \ - && __STDC_VERSION__ >= 201112L) +#if !defined __cplusplus \ + && (__GNUC_PREREQ (4, 9) \ + || __glibc_clang_has_extension (c_generic_selections) \ + || (!defined __GNUC__ && defined __STDC_VERSION__ \ + && __STDC_VERSION__ >= 201112L)) # define __HAVE_GENERIC_SELECTION 1 #else # define __HAVE_GENERIC_SELECTION 0