Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings emitted when utilizing -pedantic -save-temps flags. #63802

Open
milos1397 opened this issue Jul 11, 2023 · 3 comments
Open

Warnings emitted when utilizing -pedantic -save-temps flags. #63802

milos1397 opened this issue Jul 11, 2023 · 3 comments
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@milos1397
Copy link

milos1397 commented Jul 11, 2023

int main(void)
{
    return 0;
}

when compiled with -pedantic -save-temps flags:

clang test.c -O3 -S  -Wall -pedantic -save-temps

causes the following warnings, regarding usage of GNU line directives, to appear:

example.i:1:5: warning: this style of line directive is a GNU extension [-Wgnu-line-marker] 
# 1 "<source>"
<source>:1:5: warning: this style of line directive is a GNU extension [-Wgnu-line-marker]
# 1 "<built-in>" 1
    ^
2 warnings generated.

(you can see it here https://godbolt.org/z/ffMePa77o)

This is because Clang has some hardcoded GNU line directives, which it adds during preprocessing in the function clang::InitializePreprocessor.

Can they be cleaned?

@shafik
Copy link
Collaborator

shafik commented Jul 11, 2023

Maybe related: #63284

CC @AaronBallman

@AaronBallman
Copy link
Collaborator

Yeah, this seems like a slightly different facet to the issue in #63284 (same problem, just with different line markers).

@Endilll Endilll added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed new issue labels Sep 28, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 28, 2023

@llvm/issue-subscribers-clang-frontend

```cpp int main(void) { return 0; } ```

when compiled with -pedantic -save-temps flags:

clang test.c -O3 -S  -Wall -pedantic -save-temps

causes the following warnings, regarding usage of GNU line directives, to appear:

example.i:1:5: warning: this style of line directive is a GNU extension [-Wgnu-line-marker] 
# 1 "&lt;source&gt;"
&lt;source&gt;:1:5: warning: this style of line directive is a GNU extension [-Wgnu-line-marker]
# 1 "&lt;built-in&gt;" 1
    ^
2 warnings generated.

(you can see it here https://godbolt.org/z/ffMePa77o)

This is because Clang has some hardcoded GNU line directives, which it adds during preprocessing in the function clang::InitializePreprocessor.

Can they be cleaned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

No branches or pull requests

5 participants