Make PDFium's compiler_specific.h use clang's UNSAFE_BUFFERS_BUILD This symbol is defined consistently in build/config/clang/BUILD.gn and is a better source of truth than the old PDFium symbol. This allows the UNSAFE_BUFFERS macro to be correctly defined even outside of pdfium_common_config, such as for fuzzers and testing. Change-Id: I5f15147e8eeb28104323b5a58f09707a8df6de7e Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/127730 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Thomas Sepez <tsepez@google.com> Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn index c962350..55422d6 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -226,8 +226,6 @@ } if (clang_use_chrome_plugins) { - defines += [ "PDF_USE_CHROME_PLUGINS" ] - # Catch misuse of C-style pointers. # TODO(crbug.com/1320670): enable for non-debug builds once this stops # interfering with code generation.
diff --git a/core/fxcrt/compiler_specific.h b/core/fxcrt/compiler_specific.h index eb00fc4..5e2b033 100644 --- a/core/fxcrt/compiler_specific.h +++ b/core/fxcrt/compiler_specific.h
@@ -86,7 +86,7 @@ // clang-format off // Formatting is off so that we can put each _Pragma on its own line, as // recommended by the gcc docs. -#if defined(PDF_USE_CHROME_PLUGINS) +#if defined(UNSAFE_BUFFERS_BUILD) #define UNSAFE_BUFFERS(...) \ _Pragma("clang unsafe_buffer_usage begin") \ __VA_ARGS__ \