-
Notifications
You must be signed in to change notification settings - Fork 13.4k
diagnostics missing from -Wc++-compat #21898
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
Comments
@llvm/issue-subscribers-c Author: None (ec04fc15-fa35-46f2-80e1-5d271f2ef708)
| | |
| --- | --- |
| Bugzilla Link | [21524](https://llvm.org/bz21524) |
| Version | trunk |
| OS | Linux |
| CC | @DougGregor |
Extended DescriptionFrom http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-November/039875.html clang doesn't print warning for following test-case: compiled with: clang -fsyntax-only -Wc++-compat int new; gcc -fsyntax-only -Wc++-compat prints following warnings (gcc-4.9.1 ubuntu): t.c:1:5: warning: identifier ‘new’ conflicts with C++ keyword [-Wc++-compat] |
This still exists in post 17 trunk(e68c265) https://godbolt.org/z/fGcnGTrn5 code
clang gives no warnings with on the other hand gcc gives the following warning
|
This adds a new diagnostic group, -Widentifier-is-c++-keyword, which is off by default and grouped under -Wc++-compat. The diagnostic catches use of C++ keywords in C code. This change additionally fixes an issue with -Wreserved-identifier not diagnosing use of reserved identifiers in function parameter lists. Partially fixes llvm#21898
This introduces a new diagnostic, -Wc++-hidden-decl, which is grouped under -Wc++-compat, that diagnoses declarations which are valid in C but invalid in C++ due to the type being at the wrong scope. e.g., struct S { struct T { int x; } t; }; struct T t; // Valid C, invalid C++ This is implementing the other half of llvm#21898
This introduces a new diagnostic, -Wc++-hidden-decl, which is grouped under -Wc++-compat, that diagnoses declarations which are valid in C but invalid in C++ due to the type being at the wrong scope. e.g., ``` struct S { struct T { int x; } t; }; struct T t; // Valid C, invalid C++ ``` This is implementing the other half of #21898
This adds a new diagnostic group, -Wc++-keyword, which is off by default and grouped under -Wc++-compat. The diagnostic catches use of C++ keywords in C code. This change additionally fixes an issue with -Wreserved-identifier not diagnosing use of reserved identifiers in function parameter lists in a function declaration which is not a definition. Fixes #21898
This introduces a new diagnostic, -Wc++-hidden-decl, which is grouped under -Wc++-compat, that diagnoses declarations which are valid in C but invalid in C++ due to the type being at the wrong scope. e.g., ``` struct S { struct T { int x; } t; }; struct T t; // Valid C, invalid C++ ``` This is implementing the other half of llvm#21898
This adds a new diagnostic group, -Wc++-keyword, which is off by default and grouped under -Wc++-compat. The diagnostic catches use of C++ keywords in C code. This change additionally fixes an issue with -Wreserved-identifier not diagnosing use of reserved identifiers in function parameter lists in a function declaration which is not a definition. Fixes llvm#21898
This introduces a new diagnostic, -Wc++-hidden-decl, which is grouped under -Wc++-compat, that diagnoses declarations which are valid in C but invalid in C++ due to the type being at the wrong scope. e.g., ``` struct S { struct T { int x; } t; }; struct T t; // Valid C, invalid C++ ``` This is implementing the other half of llvm#21898
This adds a new diagnostic group, -Wc++-keyword, which is off by default and grouped under -Wc++-compat. The diagnostic catches use of C++ keywords in C code. This change additionally fixes an issue with -Wreserved-identifier not diagnosing use of reserved identifiers in function parameter lists in a function declaration which is not a definition. Fixes llvm#21898
This introduces a new diagnostic, -Wc++-hidden-decl, which is grouped under -Wc++-compat, that diagnoses declarations which are valid in C but invalid in C++ due to the type being at the wrong scope. e.g., ``` struct S { struct T { int x; } t; }; struct T t; // Valid C, invalid C++ ``` This is implementing the other half of llvm#21898
This adds a new diagnostic group, -Wc++-keyword, which is off by default and grouped under -Wc++-compat. The diagnostic catches use of C++ keywords in C code. This change additionally fixes an issue with -Wreserved-identifier not diagnosing use of reserved identifiers in function parameter lists in a function declaration which is not a definition. Fixes llvm#21898
This adds a new diagnostic group, -Wc++-keyword, which is off by default and grouped under -Wc++-compat. The diagnostic catches use of C++ keywords in C code. This change additionally fixes an issue with -Wreserved-identifier not diagnosing use of reserved identifiers in function parameter lists in a function declaration which is not a definition. Fixes llvm/llvm-project#21898
This introduces a new diagnostic, -Wc++-hidden-decl, which is grouped under -Wc++-compat, that diagnoses declarations which are valid in C but invalid in C++ due to the type being at the wrong scope. e.g., ``` struct S { struct T { int x; } t; }; struct T t; // Valid C, invalid C++ ``` This is implementing the other half of llvm#21898
This adds a new diagnostic group, -Wc++-keyword, which is off by default and grouped under -Wc++-compat. The diagnostic catches use of C++ keywords in C code. This change additionally fixes an issue with -Wreserved-identifier not diagnosing use of reserved identifiers in function parameter lists in a function declaration which is not a definition. Fixes llvm#21898
Extended Description
From http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-November/039875.html
clang doesn't print warning for following test-case:
compiled with: clang -fsyntax-only -Wc++-compat
int new;
struct A
{
struct B
{
int x;
}bs;
int y;
};
struct B b;
gcc -fsyntax-only -Wc++-compat prints following warnings (gcc-4.9.1 ubuntu):
t.c:1:5: warning: identifier ‘new’ conflicts with C++ keyword [-Wc++-compat]
int new;
^
t.c:13:8: warning: struct defined in struct or union is not visible in
C++ [-Wc++-compat]
struct B b;
^
t.c:5:10: note: struct defined here
struct B
^
The text was updated successfully, but these errors were encountered: