delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/11/04/13:39:42

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 385B13857C66
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
X-Authority-Analysis: v=2.4 cv=Ov8sdwzt c=1 sm=1 tr=0 ts=61841a97
a=T+ovY1NZ+FAi/xYICV7Bgg==:117 a=T+ovY1NZ+FAi/xYICV7Bgg==:17
a=IkcTkHD0fZMA:10 a=uZvujYp8AAAA:8 a=iZHh56OG1PI-kLWuoTwA:9 a=QEXdDO2ut3YA:10
a=nWmG9tzP0yIA:10 a=SLzB8X_8jTLwj6mN0q5r:22
To: cygwin AT cygwin DOT com
References: <CAL9Mx1t0nFY37paR+CiQP8-vCRYN=UMaHeaXNeX=XdAmqEv6TA AT mail DOT gmail DOT com>
<YYPUoagJv/Vfcflr AT calimero DOT vinschen DOT de>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Organization: Systematic Software
Subject: Re: C standard library: standard headers may reserve non-standard
identifiers which don't begin with an underscore
Message-ID: <d1ac361f-a89f-84c4-9772-c8cfe24266a2@SystematicSw.ab.ca>
Date: Thu, 4 Nov 2021 11:38:30 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
MIME-Version: 1.0
In-Reply-To: <YYPUoagJv/Vfcflr@calimero.vinschen.de>
X-CMAE-Envelope: MS4xfBGlSGxRXyPhDoGs37VY5AQOy+LoqDmasNoqjyJUUnbcNvP9Vzs8ZeIedO+wlcwW1TVoyhxlDaw5b1djnrnjxZQJRXFNl3F22W+UgM+FCssLquEm7dvM
mYeKVyM7bpXAbq6dj+kZ/7dFJVZLcjWOlaUx31n2a0ERWe5V36fsEHs2cGeXgJ5fLWI4f+1elj94bahdGPDdhOn5avDM1QkAI/k=
X-Spam-Status: No, score=-1165.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL,
RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,
SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Reply-To: cygwin AT cygwin DOT com
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On 2021-11-04 06:40, Corinna Vinschen via Cygwin wrote:
> On Nov  4 00:23, Pavel M via Cygwin wrote:
>> Observation: C standard library: standard headers may reserve non-standard
>> identifiers which don't begin with an underscore.
>>
>> Invocations:
>> $ echo -e "#include <limits.h>\n#define NL_NMAX" | gcc -xc - -std=c11
>> -pedantic -Wall -Wextra -E > /dev/null
>> <stdin>:2: warning: "NL_NMAX" redefined
>> In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/limits.h:203,
>>                   from
>> /usr/lib/gcc/x86_64-pc-cygwin/11/include/syslimits.h:7,
>>                   from /usr/lib/gcc/x86_64-pc-cygwin/11/include/limits.h:34,
>>                   from <stdin>:1:
>> /usr/include/limits.h:507: note: this is the location of the previous
>> definition
>>    507 | #define NL_NMAX                              INT_MAX
>>
>> $ echo -e "#include <limits.h>\n#define PAGESIZE" | gcc -xc - -std=c11
>> -pedantic -Wall -Wextra -E > /dev/null
>> <stdin>:2: warning: "PAGESIZE" redefined
>> In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/limits.h:203,
>>                   from
>> /usr/lib/gcc/x86_64-pc-cygwin/11/include/syslimits.h:7,
>>                   from /usr/lib/gcc/x86_64-pc-cygwin/11/include/limits.h:34,
>>                   from <stdin>:1:
>> /usr/include/limits.h:220: note: this is the location of the previous
>> definition
>>    220 | #define PAGESIZE __PAGESIZE
>>
>> # and so on...
> 
> That's ok for limits.h, see
> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
> 
> Some of the values also use feature test macros.

Most Unix implementations follow POSIX over C and those compilers 
default to POSIX and/or GNU over strict C standards.
As they use feature test macros, most/all of these should be suppressed 
if your compiler supports -stdXX or equivalent and issue standard 
required diagnostics with -pedantic{,-errors} or equivalent.
Library interfaces may also provide means to prefer certain standard 
calling sequences over de facto alternatives.
See your compiler and library newlib/libc documentation under Standards 
or equivalent e.g

	$ info gcc Standards
	$ info libc Standards

-- 
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.]

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019