delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/11/03/17:24:23

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D54023858026
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1635974662;
bh=zdqM/MoPKSQ84+d9jNU7a4zZwUjmdwQI4B+4MsiqGSM=;
h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=DNm4lsATM/Z57F2+V8Fu/LKyS2IfEq5Oy6HEGn5wCQYLmUj5wtr8MWCG1qiGRA2jJ
vmr2J4PhNYkqMw0osBAobRWrtb9UDEIRbR3DCkA8MKzIn5JqB9akEOn2+omnlrQdh6
FdAbXbsemeA4fk/1cSUJvjg6d4crVH9SY/zJAy6o=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 708913858409
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
bh=tv67l+eBzagmwQa4LIO8fP9Wu2sYpUtQvQsKdbcT/O8=;
b=4XWVTmnkqmfxhEUJ2Q3S4xmJTimczoR40o7ceJQnIEDwbd46KH6pAyZTh3rgLIp8ff
K/ExDCqKkHXjSb7nKnTxVDFYMttCFIYw8U4n06cjfjORgZd99qjxT71Xu6vFLk2miOw6
mdNjVXHAhXevipl/famJznuU6r8NQJ81NNSYvjcrFol4WIUMhW7HJxIRZmph6JdOmjn7
VKlhJGtEHrzW6ukShk7MIJdnFyPQu+O+N5+OsjnnbX99T1/7oQ4LT8PiNOE4r5HcKfk/
tFK5xaf/86fsuNlllDxm+X+VQd4lgLUNrxFn6ASeprny8UF1Tyn2paMvhsuUgucmzeTH
gQhQ==
X-Gm-Message-State: AOAM532d0pmC0FAQUYfE7dpm7EDQqRGJ3xF3EX6ILdJj5AQ0Q1sTUJPI
86XS6+fPgsO5A5OQNOVYIFybsmlfjtLFo3a9mmudHZDR8tNvWg==
X-Google-Smtp-Source: ABdhPJxwrrEmIYfJAdfnANtpznT5sl8eSnTlvf14PW8rohDA2kC4Yd2+1jwV5ii1EOblCJMAGE3GEy+mg7Hxm/dsZfg=
X-Received: by 2002:a25:5545:: with SMTP id j66mr48044077ybb.288.1635974629930;
Wed, 03 Nov 2021 14:23:49 -0700 (PDT)
MIME-Version: 1.0
Date: Thu, 4 Nov 2021 00:23:13 +0300
Message-ID: <CAL9Mx1t0nFY37paR+CiQP8-vCRYN=UMaHeaXNeX=XdAmqEv6TA@mail.gmail.com>
Subject: C standard library: standard headers may reserve non-standard
identifiers which don't begin with an underscore
To: cygwin AT cygwin DOT com
X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE,
RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS,
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-Content-Filtered-By: Mailman/MimeDel 2.1.29
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-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>
From: Pavel M via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Pavel M <pavel DOT morozkin AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
Note-from-DJ: This may be spam

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

Here we see that NL_NMAX and PAGESIZE are non-standard identifiers, which
don't begin with an underscore, and which are reserved by standard header
limits.h. As I understand, these identifiers cannot be reserved due to "No
other identifiers are reserved" (C11, 7.1.3 Reserved identifiers, 1). Do I
miss something?

$ gcc --version
gcc (GCC) 11.1.0

$ uname -a
CYGWIN_NT-10.0 xxx 3.2.0(0.340/5/3) 2021-03-29 08:42 x86_64 Cygwin

Extra: compared to Linux:
$ echo -e "#include <limits.h>\n#define NL_NMAX" | gcc -xc - -std=c11
-pedantic -Wall -Wextra -E > /dev/null
<nothing> (expected)

$ echo -e "#include <limits.h>\n#define PAGESIZE" | gcc -xc - -std=c11
-pedantic -Wall -Wextra -E > /dev/null
<nothing> (expected)

$ gcc --version
gcc-8.2 (GCC) 8.2.0

$ uname -a
Linux xxx 4.10.0-27-generic #30~16.04.2-Ubuntu SMP Thu Jun 29 16:07:46 UTC
2017 x86_64 x86_64 x86_64 GNU/Linux

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