-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
clang: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 analyzer
Description
Like with other diagnostics it's possible to control -Wunsafe-buffer-usage with #pragma clang diagnostic within a source file. However, there's a weird nonlocal effect: for any instances of the warning to fire, it seems the warning must be enabled at the point of occurrence and at the end of the file.
This isn't true for other warnings like -Wsign-compare.
You can see an example here: https://godbolt.org/z/4eGc5hdzd
Initially there are no -Wunsafe-buffer-usage warnings. But if you uncomment the last line of the input (#pragma clang diagnostic warning "-Wunsafe-buffer-usage") then warnings that appear earlier in the file will show up.
Metadata
Metadata
Assignees
Labels
clang: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 analyzer