From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 15303385840F for ; Tue, 25 Jul 2023 17:35:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 15303385840F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690306534; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=GJGEYsvV78ruI/JbOUF80xilPfA+xcHOerUwsucfBhc=; b=YRLiNxSQOh/zdDejojHCIH4iW9gRbzJeNVBFQFPBY3eozmvGee00CWh9ug0HnLuztxAO46 GhP51MQGTp6YTT+DzXvvixwYj28jRYVNQZtJuHT59vfbjhiKVeXHFswcEKOmGezwhvIhdY oSWHw9eBKNV+C1ULfqXg/m/zWmSJiHw= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-481-5UJwIm_RN7Kxf8v9wVbkfw-1; Tue, 25 Jul 2023 13:35:33 -0400 X-MC-Unique: 5UJwIm_RN7Kxf8v9wVbkfw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E09DF2808E63; Tue, 25 Jul 2023 17:35:32 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.39.193.241]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A2A482166B26; Tue, 25 Jul 2023 17:35:32 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 4786BA80D29; Tue, 25 Jul 2023 19:35:31 +0200 (CEST) Date: Tue, 25 Jul 2023 19:35:31 +0200 From: Corinna Vinschen To: Bruno De Fraine Cc: "newlib@sourceware.org" , Sebastian Huber Subject: Re: newlib header breaks restricted pointers in C++ Message-ID: Reply-To: newlib@sourceware.org Mail-Followup-To: Bruno De Fraine , "newlib@sourceware.org" , Sebastian Huber References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Bruno, On Jul 24 22:23, Bruno De Fraine wrote: > Hello, > > As an extension, GCC and clang offer C99-style restricted pointers in C++ mode: > https://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html > > We notice that this extension is broken when including newlib headers: restricted pointers are treated as ordinary pointers. > > We traced this to the following section of newlib/libc/include/sys/cdefs.h: > > /* > * GCC 2.95 provides `__restrict' as an extension to C90 to support the > * C99-specific `restrict' type qualifier. We happen to use `__restrict' as > * a way to define the `restrict' type qualifier without disturbing older > * software that is unaware of C99 keywords. > */ > #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95) > #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 > #define __restrict > #else > #define __restrict restrict > #endif > #endif > > While the GCC __restrict extension was indeed introduced in GCC 2.95, it is not limited to this version; the extension is also not limited to C90: > https://gcc.gnu.org/gcc-2.95/c++features.html Either way, the above has been taken from FreeBSD, and it is still, as of today, the same expression as used in FreeBSDs sys/cdefs.h file. Seb, any input on this? Corinna