-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Open
Labels
clang:bounds-safetyIssue/PR relating to the experimental -fbounds-safety feature in ClangIssue/PR relating to the experimental -fbounds-safety feature in Clangclang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second partyVerified by a second party
Description
This code generates a warning when compiled in C++ mode, but not in C mode: https://godbolt.org/z/7zTW63exP
#include <stddef.h>
#include <stdint.h>
struct slice {
size_t len;
uint32_t* data __attribute__((counted_by(len)));
};<source>:6:35: warning: 'counted_by' attribute ignored [-Wignored-attributes]
6 | uint32_t* data __attribute__((counted_by(len)));
| ^
This warning could be improved by telling the user that counted_by is only allowed in C mode, and will be ignored in C++ mode. The documentation could also be improved to state this explicitly.
Metadata
Metadata
Assignees
Labels
clang:bounds-safetyIssue/PR relating to the experimental -fbounds-safety feature in ClangIssue/PR relating to the experimental -fbounds-safety feature in Clangclang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second partyVerified by a second party