From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) by sourceware.org (Postfix) with ESMTPS id E8FEA3858D1E for ; Thu, 21 Apr 2022 04:56:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E8FEA3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSw.ab.ca Authentication-Results: sourceware.org; spf=none smtp.mailfrom=systematicsw.ab.ca Received: from shw-obgw-4002a.ext.cloudfilter.net ([10.228.9.250]) by cmsmtp with ESMTP id hESxnrxI443SghOs3nLugn; Thu, 21 Apr 2022 04:56:47 +0000 Received: from [10.0.0.5] ([184.64.124.72]) by cmsmtp with ESMTP id hOs2nfRLPqyyshOs2nvTFQ; Thu, 21 Apr 2022 04:56:46 +0000 X-Authority-Analysis: v=2.4 cv=Y6brDzSN c=1 sm=1 tr=0 ts=6260e40e a=oHm12aVswOWz6TMtn9zYKg==:117 a=oHm12aVswOWz6TMtn9zYKg==:17 a=IkcTkHD0fZMA:10 a=b4LDLZbEAAAA:8 a=uYT-Tk0qkVT609LjNaIA:9 a=QEXdDO2ut3YA:10 a=20T61YgZp4ItGotXEy2O:22 Message-ID: <43656224-9f4e-1443-df56-a7611468eea5@SystematicSw.ab.ca> Date: Wed, 20 Apr 2022 22:56:46 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Reply-To: newlib@sourceware.org Subject: Re: Issue: headers may use non-reserved identifiers Content-Language: en-CA To: newlib@sourceware.org References: From: Brian Inglis Organization: Systematic Software In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfGeNHQMnKEmmolp/f4wogaxUlW5o8k52/5ikRikcomA1TaPS0CodNcJ30e3vexRDm1pnw1PabjbD8zhS25+UJky3L54k7A2aNDzuC3A8dEHPt4LwhEVC 8tnx5BFSITozJbK6AYqxdRKxbRSYa9BCtNleVPkkA5HvEfjGJUa8IgjFZrOyJNalGzVeLglLBtG8XTdF/nWjXxLmAw5JU7ymDE8= X-Spam-Status: No, score=-1164.1 required=5.0 tests=BAYES_00, BODY_8BITS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2022 04:56:49 -0000 On 2022-04-20 20:48, Richard Damon wrote: > On 4/20/22 6:11 PM, C Howland wrote: >> On Wednesday, April 20, 2022 4:35 PM, Pavel Morozkin wrote: >>> Issue: headers may use non-reserved identifiers. >>> Example: >>> #define _reent 0 >>> #include >>> $ gcc t567.c -std=c11 >>> t567.c:1:16: error: expected ‘{’ before numeric constant >>>      1 | #define _reent 0 >>>        |                ^ >>> t567.c:1:16: error: expected ‘{’ before numeric constant >>>      1 | #define _reent 0 >>>        |                ^ >>> and so on... >>> Per C11 _reent, _on_exit_args, etc. are non-reserved identifiers. >>> Consider fixing. >>> P.S. Good if it leads to compile time errors, not good if it >>> doesn't (wrong translation unit produced => wrong code generated >>> => wrong runtime behavior). >> No, the headers do not use non-reserved identifiers. Look at the >> standard >> again, as the second dash item in section 7.1.3 Reserved Identifiers >> reserves all identifiers that start with underscore.  The example program >> violates the standard.  In short, user programs may not use identifiers >> that start with underscore.  (More precisely there are some very-limited >> cases in which they can, but preprocessor identifiers is not one of >> them.) > > Slight correction, identifies that begin with an underscore and followed > by a lowercase letter or a number are reserved only at 'file scope' > level, so user programs CAN use them as local variable names inside some > scope (at least those that don't match the previous cluase of an > underscore followed by an uppercase letter or another underscore as > those are reserved in all conditions). > > Now, in the example, the user program used it for a preprocessor symbol > which conflicts with the reservation for that identifier for the > implementations use. C202X WD (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2731.pdf) 7.1.3 expands and simplifies it somewhat to all identifiers defined and all *potentially* reserved (including future library directions - see 7.31) provided by the implementation are reserved for any use, but not if not provided, with conditions on header inclusion, namespace, and scope. -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada This email may be disturbing to some readers as it contains too much technical detail. Reader discretion is advised. [Data in binary units and prefixes, physical quantities in SI.]