unicode whitespace between `#` and directive name not diagnosed in skipped group
Nobody has claimed this yet.
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
As noted in discussion of a [recent C++ NB comment](https://github.com/cplusplus/nbballot/issues/595), Clang treats Unicode whitespace as being whitespace as an extension (issuing a warning diagnostic, which becomes an error under `-pedantic-errors`). This is mostly a conforming extension, but we fail to produce a standard-mandated diagnostic if the whitespace occurs before the directive name in a skipped group:
```c++
#if 0
#line 1
#line 1
#endif
```
This is ill-formed; within a skipped group, the directive syntax is [only relaxed after the directive name](https://eel.is/c++draft/cpp.pre#5), so we're still required to issue a diagnostic for the Unicode whitespace (which forms a single-character pp-token, resulting in a token sequence that does not obey the grammar for a directive) if it occurs before the directive name. In order to conform, we should produce the `ExtWarn` diagnostic in this case too.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Clang's preprocessor handling for directives and skipped groups, using the two shown forms to compare whitespace before the directive name with whitespace after it. Find the existing ExtWarn path for Unicode whitespace and add regression coverage demonstrating that both forms produce the required diagnostic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100