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.133.124]) by sourceware.org (Postfix) with ESMTPS id 23E493858C36 for ; Thu, 27 Jul 2023 09:00:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 23E493858C36 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=1690448412; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=wQaFvYj0VcjNCwZiAGf+WSPDvcc4QwKG8b6LwDXJSYA=; b=QOZ2gDH6UjlJw4+qDhidtyCZfYQopifUNTUBaFQKVrkLB8j3ohgZUS6Sgtpg6HfQhPpuMT L48rqGkF0FYcimEFdqWlMFSKZSKEPZdMVFF3M8jhuvif8RbM7smyLYnY1UR2TGyYV4WG/v hm+uddvHkqUUBTDWujtjz/Jt1+zjtWA= 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-682-HPBiG0uqMkSmbTENk-SdhQ-1; Thu, 27 Jul 2023 05:00:10 -0400 X-MC-Unique: HPBiG0uqMkSmbTENk-SdhQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 506D83C11C60 for ; Thu, 27 Jul 2023 09:00:10 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.39.193.241]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E8C01121330 for ; Thu, 27 Jul 2023 09:00:10 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id CD1CFA80CB1; Thu, 27 Jul 2023 11:00:08 +0200 (CEST) Date: Thu, 27 Jul 2023 11:00:08 +0200 From: Corinna Vinschen To: newlib@sourceware.org Subject: Re: newlib header breaks restricted pointers in C++ Message-ID: Reply-To: newlib@sourceware.org Mail-Followup-To: newlib@sourceware.org References: <3126b987-ca19-97f6-9c7a-06243add9354@embedded-brains.de> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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,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: On Jul 25 19:48, Steven J Abner wrote: > Curiosity killed the cat, > I might not understand, could you clarify. It mentions 'restrict is not a > keyword in C++'. > So doesn't #if __cpplusplus need to define 'restrict'. Additionally, > shouldn't the below mentioned > '#define'(s) include '__restrict__ ? I don't think the header should really define "restrict" for C++, it would clobber the namespace. We have the following scenario: - GCC defines __restrict (and __restrict__) for C and C++. - Newlib overloads __restrict for all GCC versions != 2.95. - Either to nothing, if the app standard is < C99, or - to "restrict" if the app standard is >= C99. The negated release check for version 2.95 exactly is certainly fishy. Let's compare with the GLibc version: /* __restrict is known in EGCS 1.2 and above, and in clang. It works also in C++ mode (outside of arrays), but only when spelled as '__restrict', not 'restrict'. */ #if !(__GNUC_PREREQ (2,92) || __clang_major__ >= 3) # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L # define __restrict restrict # else # define __restrict /* Ignore */ # endif #endif So the expression is the same, just the version check makes more sense. Shall we match our version expression to the GLibc expression? Corinna