[clang] [SafeBuffers] Check if unsafe-buffers* warnings are enabled earlier (PR #128603)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 25 05:11:56 PST 2025
================
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -std=c++17 -Wno-all -Wunsafe-buffer-usage \
+// RUN: -verify %s
+
+// Previously we had a bug where we would diagnose *no* unsafe buffer warnings
+// if the warning was disabled by pragma and left disabled until end-of-TU.
+// This is a reasonable way to disable unsafe buffer warnings on an entire
+// .c/cpp file, and it shouldn't disable the warnings in headers or previous
+// source locations, so we test that this works.
+
+// FIXME: This RUNX line should pass, but it does not, because we check if the
----------------
zmodem wrote:
This is unfortunate, but enabling warnings with pragmas seems much less common than ignoring them, so if we have to choose this seems better.
https://github.com/llvm/llvm-project/pull/128603
More information about the cfe-commits
mailing list