llvm / llvm/llvm-project

Diagnostics in #line directives reported at the wrong line

Open
#211,535 1 comment 0 reactions 0 assignees View on GitHub
clang:diagnostics clang:frontend
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

For the following code

```c
#line 0
```

we print

```
:1:7: warning: #line directive with zero argument is a GNU extension [-Wgnu-zero-line-directive]
1 | #line 0
| ^
:4294967295:9: warning: no newline at end of file
```

ideally we'd place both warnings on line 0, but at least the second one should be

https://godbolt.org/z/Wac35Gvj8

Contributor guide

Open the contributing guide

Research direction

Reproduce the diagnostic with the C snippet from the issue, using the linked Godbolt example as the starting point. Trace how the #line 0 directive affects the source location used for the end-of-file warning; done means the second warning reports line 0, with both warnings ideally reported there.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.