compiler-explorer / compiler-explorer/compiler-explorer

[FEATURE] Support user-supplied `#` directives with library filtering

Open
#2,505 3 comments 0 reactions 0 assignees View on GitHub
Status: triaged
Dominant language
TypeScript
Stars
19.1k
Forks
2.1k
Avg merge
3d 15h
Merged PRs (30d)
67

Description

**Describe the bug**
```
# 1 "toto.c"

int f(){return 0;}
```
This will be entirely filtered out by the 'library filter'. This is most certainly correct (as this is really 'toto.i' referencing 'toto.c'), but this is also what is produced by using `-save-temps` with GCC.

Maybe the filter could guess that if the first directive points to .c file at line 1, then this may be the main file?

I've spent some time this morning wondering which optimization decided to completely empty the result. Now that I know this is the filter not playing well with GCC preprocessed files that's ok, but I guess some people may have the same issue. Using `-P` when creating the preprocessed file can also help.

**Link**

https://godbolt.org/z/nocdcY

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.