Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a8763a6

Browse files
committed
Fix clang warning.
1 parent 407333e commit a8763a6

10 files changed

+200
-25
lines changed

‎test/main.c

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@
2424
// For more information, please refer to <http://unlicense.org/>
2525

2626
#include "utest.h"
27+
28+
// TODO: Fix in subprocess.h!
29+
#if defined(__clang__)
30+
#if __has_warning("-Wunsafe-buffer-usage")
31+
#pragma clang diagnostic push
32+
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
33+
#endif
34+
#endif
35+
2736
#include "subprocess.h"
2837

2938
// TODO: Broken under MINGW for some reason.

‎test/test.c

+13
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,13 @@ UTEST(c, ULong) {
224224
ASSERT_NE(a, b);
225225
}
226226

227+
#if defined(__clang__)
228+
#if __has_warning("-Wunsafe-buffer-usage")
229+
#pragma clang diagnostic push
230+
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
231+
#endif
232+
#endif
233+
227234
UTEST(c, Ptr) {
228235
char foo = 42;
229236
EXPECT_NE(&foo, &foo + 1);
@@ -238,6 +245,12 @@ static const int data[4] = {42, 13, 6, -53};
238245

239246
UTEST(c, Array) { EXPECT_NE(data, data + 1); }
240247

248+
#if defined(__clang__)
249+
#if __has_warning("-Wunsafe-buffer-usage")
250+
#pragma clang diagnostic pop
251+
#endif
252+
#endif
253+
241254
UTEST(c, Near) {
242255
float a = 42.0f;
243256
float b = 42.01f;

‎test/test.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,13 @@ UTEST(cpp, ULong) {
221221
ASSERT_NE(a, b);
222222
}
223223

224+
#if defined(__clang__)
225+
#if __has_warning("-Wunsafe-buffer-usage")
226+
#pragma clang diagnostic push
227+
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
228+
#endif
229+
#endif
230+
224231
UTEST(cpp, Ptr) {
225232
char foo = 42;
226233
EXPECT_NE(&foo, &foo + 1);
@@ -230,6 +237,12 @@ static const int data[4] = {42, 13, 6, -53};
230237

231238
UTEST(cpp, Array) { EXPECT_NE(data, data + 1); }
232239

240+
#if defined(__clang__)
241+
#if __has_warning("-Wunsafe-buffer-usage")
242+
#pragma clang diagnostic pop
243+
#endif
244+
#endif
245+
233246
UTEST(cpp, Near) {
234247
float a = 42.0f;
235248
float b = 42.01f;

‎test/test11.c

+13
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ UTEST(c11, ULong) {
216216
ASSERT_NE(a, b);
217217
}
218218

219+
#if defined(__clang__)
220+
#if __has_warning("-Wunsafe-buffer-usage")
221+
#pragma clang diagnostic push
222+
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
223+
#endif
224+
#endif
225+
219226
UTEST(c11, Ptr) {
220227
char foo = 42;
221228
EXPECT_NE(&foo, &foo + 1);
@@ -230,6 +237,12 @@ static const int data[4] = {42, 13, 6, -53};
230237

231238
UTEST(c11, Array) { EXPECT_NE(data, data + 1); }
232239

240+
#if defined(__clang__)
241+
#if __has_warning("-Wunsafe-buffer-usage")
242+
#pragma clang diagnostic pop
243+
#endif
244+
#endif
245+
233246
UTEST(c11, Near) {
234247
float a = 42.0f;
235248
float b = 42.01f;

‎test/test11.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,13 @@ UTEST(cpp11, ULongLong) {
244244
#pragma clang diagnostic pop
245245
#endif
246246

247+
#if defined(__clang__)
248+
#if __has_warning("-Wunsafe-buffer-usage")
249+
#pragma clang diagnostic push
250+
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
251+
#endif
252+
#endif
253+
247254
UTEST(cpp11, Ptr) {
248255
char foo = 42;
249256
EXPECT_NE(&foo, &foo + 1);
@@ -258,6 +265,12 @@ static const int data[4] = {42, 13, 6, -53};
258265

259266
UTEST(cpp11, Array) { EXPECT_NE(data, data + 1); }
260267

268+
#if defined(__clang__)
269+
#if __has_warning("-Wunsafe-buffer-usage")
270+
#pragma clang diagnostic pop
271+
#endif
272+
#endif
273+
261274
UTEST(cpp11, Near) {
262275
float a = 42.0f;
263276
float b = 42.01f;

‎test/test14.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,13 @@ UTEST(cpp14, ULongLong) {
244244
#pragma clang diagnostic pop
245245
#endif
246246

247+
#if defined(__clang__)
248+
#if __has_warning("-Wunsafe-buffer-usage")
249+
#pragma clang diagnostic push
250+
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
251+
#endif
252+
#endif
253+
247254
UTEST(cpp14, Ptr) {
248255
char foo = 42;
249256
EXPECT_NE(&foo, &foo + 1);
@@ -258,6 +265,12 @@ static const int data[4] = {42, 13, 6, -53};
258265

259266
UTEST(cpp14, Array) { EXPECT_NE(data, data + 1); }
260267

268+
#if defined(__clang__)
269+
#if __has_warning("-Wunsafe-buffer-usage")
270+
#pragma clang diagnostic pop
271+
#endif
272+
#endif
273+
261274
UTEST(cpp14, Near) {
262275
float a = 42.0f;
263276
float b = 42.01f;

‎test/test17.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,13 @@ UTEST(cpp17, ULongLong) {
244244
#pragma clang diagnostic pop
245245
#endif
246246

247+
#if defined(__clang__)
248+
#if __has_warning("-Wunsafe-buffer-usage")
249+
#pragma clang diagnostic push
250+
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
251+
#endif
252+
#endif
253+
247254
UTEST(cpp17, Ptr) {
248255
char foo = 42;
249256
EXPECT_NE(&foo, &foo + 1);
@@ -258,6 +265,12 @@ static const int data[4] = {42, 13, 6, -53};
258265

259266
UTEST(cpp17, Array) { EXPECT_NE(data, data + 1); }
260267

268+
#if defined(__clang__)
269+
#if __has_warning("-Wunsafe-buffer-usage")
270+
#pragma clang diagnostic pop
271+
#endif
272+
#endif
273+
261274
UTEST(cpp17, Near) {
262275
float a = 42.0f;
263276
float b = 42.01f;

‎test/test99.c

+13
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ UTEST(c99, ULong) {
216216
ASSERT_NE(a, b);
217217
}
218218

219+
#if defined(__clang__)
220+
#if __has_warning("-Wunsafe-buffer-usage")
221+
#pragma clang diagnostic push
222+
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
223+
#endif
224+
#endif
225+
219226
UTEST(c99, Ptr) {
220227
char foo = 42;
221228
EXPECT_NE(&foo, &foo + 1);
@@ -230,6 +237,12 @@ static const int data[4] = {42, 13, 6, -53};
230237

231238
UTEST(c99, Array) { EXPECT_NE(data, data + 1); }
232239

240+
#if defined(__clang__)
241+
#if __has_warning("-Wunsafe-buffer-usage")
242+
#pragma clang diagnostic pop
243+
#endif
244+
#endif
245+
233246
UTEST(c99, Near) {
234247
float a = 42.0f;
235248
float b = 42.01f;

‎test/test_no_exceptions.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,13 @@ UTEST(cpp_no_exceptions, ULong) {
229229
ASSERT_NE(a, b);
230230
}
231231

232+
#if defined(__clang__)
233+
#if __has_warning("-Wunsafe-buffer-usage")
234+
#pragma clang diagnostic push
235+
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
236+
#endif
237+
#endif
238+
232239
UTEST(cpp_no_exceptions, Ptr) {
233240
char foo = 42;
234241
EXPECT_NE(&foo, &foo + 1);
@@ -238,6 +245,12 @@ static const int data[4] = {42, 13, 6, -53};
238245

239246
UTEST(cpp_no_exceptions, Array) { EXPECT_NE(data, data + 1); }
240247

248+
#if defined(__clang__)
249+
#if __has_warning("-Wunsafe-buffer-usage")
250+
#pragma clang diagnostic pop
251+
#endif
252+
#endif
253+
241254
UTEST(cpp_no_exceptions, Near) {
242255
float a = 42.0f;
243256
float b = 42.01f;

0 commit comments

Comments
 (0)