Skip to content

Commit bad89cb

Browse files
committed
Properly stub the pthread.h header in the tests.
1 parent 7c3f0b2 commit bad89cb

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#define __SIZEOF_PTHREAD_MUTEX_T 40
2+
3+
typedef union {
4+
struct __pthread_mutex_s {
5+
int __lock;
6+
unsigned int __count;
7+
} __data;
8+
char __size[__SIZEOF_PTHREAD_MUTEX_T];
9+
long int __align;
10+
} pthread_mutex_t;

clang-tools-extra/test/clang-tidy/checkers/bugprone/tagged-union-member-count.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t
1+
// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t -- -- \
2+
// RUN: -isystem %S/Inputs/tagged-union-member-count/system
23

34
typedef enum Tags3 {
45
tags3_1,
@@ -150,7 +151,7 @@ DECLARE_TAGGED_UNION_STRUCT(Tags3, Union4, TaggedUnionStructFromMacro);
150151

151152
// Typedefed unions from system header files should be ignored when
152153
// we are trying to pinpoint the union part in a user-defined tagged union.
153-
#include "pthread.h"
154+
#include <pthread.h>
154155

155156
// This should not be analyzed as a user-defined tagged union,
156157
// even though pthread_mutex_t may be declared as a typedefed union.

clang-tools-extra/test/clang-tidy/checkers/bugprone/tagged-union-member-count.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %check_clang_tidy -std=c++98-or-later %s bugprone-tagged-union-member-count %t
1+
// RUN: %check_clang_tidy -std=c++98-or-later %s bugprone-tagged-union-member-count %t -- -- \
2+
// RUN: -isystem %S/Inputs/tagged-union-member-count/system
23
// Test check with C++ features
34

45
typedef enum Tags3 {
@@ -311,7 +312,7 @@ void DoNotMatchLambdas() {
311312

312313
// Typedefed unions from system header files should be ignored when
313314
// we are trying to pinpoint the union part in a user-defined tagged union.
314-
#include "pthread.h"
315+
#include <pthread.h>
315316

316317
// This should not be analyzed as a user-defined tagged union,
317318
// even though pthread_mutex_t may be declared as a typedefed union.

clang-tools-extra/test/clang-tidy/checkers/bugprone/tagged-union-member-count.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t
1+
// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t -- -- \
2+
// RUN: -isystem %S/Inputs/tagged-union-member-count/system
23

34
typedef enum Tags3 {
45
tags3_1,
@@ -150,7 +151,7 @@
150151

151152
// Typedefed unions from system header files should be ignored when
152153
// we are trying to pinpoint the union part in a user-defined tagged union.
153-
#include "pthread.h"
154+
#include <pthread.h>
154155

155156
// This should not be analyzed as a user-defined tagged union,
156157
// even though pthread_mutex_t may be declared as a typedefed union.

clang-tools-extra/test/clang-tidy/checkers/bugprone/tagged-union-member-count.mm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t
1+
// RUN: %check_clang_tidy %s bugprone-tagged-union-member-count %t -- -- \
2+
// RUN: -isystem %S/Inputs/tagged-union-member-count/system
23

34
typedef enum Tags3 {
45
tags3_1,
@@ -310,7 +311,7 @@ void DoNotMatchLambdas() {
310311

311312
// Typedefed unions from system header files should be ignored when
312313
// we are trying to pinpoint the union part in a user-defined tagged union.
313-
#include "pthread.h"
314+
#include <pthread.h>
314315

315316
// This should not be analyzed as a user-defined tagged union,
316317
// even though pthread_mutex_t may be declared as a typedefed union.

0 commit comments

Comments
 (0)