1 // RUN: %clang_cc1 -std=c++20 -Wunsafe-buffer-usage \
2 // RUN: -fsafe-buffer-usage-suggestions -verify %s
4 void beginUnclosed(int * x
) {
5 #pragma clang unsafe_buffer_usage begin
7 #pragma clang unsafe_buffer_usage begin // expected-error{{already inside '#pragma unsafe_buffer_usage'}}
9 #pragma clang unsafe_buffer_usage end
12 void endUnopened(int *x
) {
13 #pragma clang unsafe_buffer_usage end // expected-error{{not currently inside '#pragma unsafe_buffer_usage'}}
15 #pragma clang unsafe_buffer_usage begin
17 #pragma clang unsafe_buffer_usage end
21 #pragma clang unsafe_buffer_usage start // expected-error{{expected 'begin' or 'end'}}
22 #pragma clang unsafe_buffer_usage close // expected-error{{expected 'begin' or 'end'}}
25 void unclosed(int * p1
) {
26 #pragma clang unsafe_buffer_usage begin
27 // End of the included file will not raise the unclosed region warning:
28 #define _INCLUDE_NO_WARN
29 #include "warn-unsafe-buffer-usage-pragma.h"
30 #pragma clang unsafe_buffer_usage end
32 // End of this file raises the warning:
33 #pragma clang unsafe_buffer_usage begin // expected-error{{'#pragma unsafe_buffer_usage' was not ended}}