public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/101628] New: Preprocessor errors on extended characters in #if 0 code block
@ 2021-07-26 17:19 david.post at ohyonghao dot com
2021-07-26 18:43 ` [Bug preprocessor/101628] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: david.post at ohyonghao dot com @ 2021-07-26 17:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101628
Bug ID: 101628
Summary: Preprocessor errors on extended characters in #if 0
code block
Product: gcc
Version: 10.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: david.post at ohyonghao dot com
Target Milestone: ---
In a #if 0 code block, the presence of characters outside the extended
character set being used as an identifier still gets passed to the C++ compiler
and errors out with the message:
error: extended character ∂ is not valid in an identifier
Sample code:
int main(int argc, char **argv){
#if 0
Q_∂(false)
#endif
return 0;
}
The code within the #if 0 block should never be compiled which is the behavior
of other compilers such as clang++ which gleefully ignores bad code within #if
0 block.
To clarify, with clang++ the code errors without the #if 0 block, which is
expected behavior, and compiles with the #if 0 block around the bad code. g++
errors in both cases.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/101628] Preprocessor errors on extended characters in #if 0 code block
2021-07-26 17:19 [Bug preprocessor/101628] New: Preprocessor errors on extended characters in #if 0 code block david.post at ohyonghao dot com
@ 2021-07-26 18:43 ` pinskia at gcc dot gnu.org
2021-07-27 11:04 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-26 18:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101628
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Related to PR 62661 which was closed as invalid.
Basically the C++ standard says the tokens inside the #if blocks need to be
valid tokens still.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/101628] Preprocessor errors on extended characters in #if 0 code block
2021-07-26 17:19 [Bug preprocessor/101628] New: Preprocessor errors on extended characters in #if 0 code block david.post at ohyonghao dot com
2021-07-26 18:43 ` [Bug preprocessor/101628] " pinskia at gcc dot gnu.org
@ 2021-07-27 11:04 ` rguenth at gcc dot gnu.org
2021-07-27 16:58 ` david.post at ohyonghao dot com
2021-07-27 17:23 ` schwab@linux-m68k.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-27 11:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101628
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
thus dup
*** This bug has been marked as a duplicate of bug 62661 ***
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/101628] Preprocessor errors on extended characters in #if 0 code block
2021-07-26 17:19 [Bug preprocessor/101628] New: Preprocessor errors on extended characters in #if 0 code block david.post at ohyonghao dot com
2021-07-26 18:43 ` [Bug preprocessor/101628] " pinskia at gcc dot gnu.org
2021-07-27 11:04 ` rguenth at gcc dot gnu.org
@ 2021-07-27 16:58 ` david.post at ohyonghao dot com
2021-07-27 17:23 ` schwab@linux-m68k.org
3 siblings, 0 replies; 5+ messages in thread
From: david.post at ohyonghao dot com @ 2021-07-27 16:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101628
--- Comment #3 from David Post <david.post at ohyonghao dot com> ---
This seems to be implementation dependent. As per 15.1.6:
The implementation can process and skip sections of source files conditionally,
include other source files, import macros from header units, and replace
macros. These capabilities are called preprocessing, because conceptually they
occur before translation of the resulting translation unit.
and 15.2.14
Each directive's condition is checked in order. If it evaluates to false
(zero), the group that it controls is skipped:
But what you are implying is that skipped means that you process it anyway,
then ignore the result, whereas other implementations take this to mean that
the group is skipped over and not processed.
This seems to be an implementation decision rather than a requirement by the
standard, or am I missing the part of the standard which states that those
tokens must still be valid?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/101628] Preprocessor errors on extended characters in #if 0 code block
2021-07-26 17:19 [Bug preprocessor/101628] New: Preprocessor errors on extended characters in #if 0 code block david.post at ohyonghao dot com
` (2 preceding siblings ...)
2021-07-27 16:58 ` david.post at ohyonghao dot com
@ 2021-07-27 17:23 ` schwab@linux-m68k.org
3 siblings, 0 replies; 5+ messages in thread
From: schwab@linux-m68k.org @ 2021-07-27 17:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101628
--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> ---
15.1.6 isn't about implementation options, it is the definition of the term
preprocessing. The whole chapter always talks about sequences of preprocessing
tokens, whether skipped over or processed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-07-27 17:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 17:19 [Bug preprocessor/101628] New: Preprocessor errors on extended characters in #if 0 code block david.post at ohyonghao dot com
2021-07-26 18:43 ` [Bug preprocessor/101628] " pinskia at gcc dot gnu.org
2021-07-27 11:04 ` rguenth at gcc dot gnu.org
2021-07-27 16:58 ` david.post at ohyonghao dot com
2021-07-27 17:23 ` schwab@linux-m68k.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).