On 2022-07-11 21:57:45 +0800, Ziyao wrote:
> The simpliest example is like below:
> 
> #if 0
> "
> #if 0
> "
> #endif
> #endif

Going back to this example, even if GCC doesn't give an error,
consider a slight variation:

#if 0
R"-(
#if 0
)-"
#endif
#endif

This time, one gets an error with gcc (default GNU dialect or C++):

err.c:6:2: error: #endif without #if
    6 | #endif
      |  ^~~~~

And the following code

#if 0
R"-(
#if 0
)-"
#endif

does not give any warning or error (the behavior is different
if one provides an option like -std=c99 to follow ISO C99).

This is due to the use of a "raw string literal", specified
by C++11 (and this can also be regarded as a C extension),
which allows newline characters.

This shows that you cannot ignore parsing in a skipped block.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to