diff options
author | Alejandro Colomar <alx@kernel.org> | 2023-08-12 14:48:56 +0200 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2023-08-12 15:55:03 +0200 |
commit | 7a81d791a4f58afb29197c5bbe960163bf471c42 (patch) | |
tree | a96bcd2f641c991f42aa1632cb38c425c489fc68 | |
parent | 767fca36cc7b55db45ac77e8aa87840a499f80c4 (diff) |
tests/: Fix includesoffsetof
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r-- | tests/cxx/badinc-inl.h | 2 | ||||
-rw-r--r-- | tests/cxx/badinc.cc | 6 | ||||
-rw-r--r-- | tests/cxx/badinc.h | 6 | ||||
-rw-r--r-- | tests/cxx/std_size_t.cc | 2 |
4 files changed, 10 insertions, 6 deletions
diff --git a/tests/cxx/badinc-inl.h b/tests/cxx/badinc-inl.h index 58c5147..4b261fd 100644 --- a/tests/cxx/badinc-inl.h +++ b/tests/cxx/badinc-inl.h @@ -10,7 +10,7 @@ #ifndef INCLUDE_WHAT_YOU_USE_TESTS_CXX_BADINC_INL_H_ #define INCLUDE_WHAT_YOU_USE_TESTS_CXX_BADINC_INL_H_ -#include <locale.h> // the way to get NULL without size_t +#include <stddef.h> #include "tests/cxx/badinc-private.h" #include "tests/cxx/badinc-private2.h" diff --git a/tests/cxx/badinc.cc b/tests/cxx/badinc.cc index 2986798..0c42ea2 100644 --- a/tests/cxx/badinc.cc +++ b/tests/cxx/badinc.cc @@ -57,6 +57,8 @@ // Some of the #include lines are deliberately formatted wrong, in // order to test that IWYU handles them correctly. #include <math.h> // not actually used +#include <stdarg.h> + #include <typeinfo> // for typeid #include "tests/cxx/badinc-inl.h" #include "tests/cxx/badinc.h" @@ -1063,9 +1065,6 @@ int main() { // IWYU: I1_PtrDereferenceClass needs a declaration I1_PtrDereferenceClass* local_i1_ptrdereference_class = 0; int x; - // va_list is normally in <stdarg.h>, but we already have <stdio.h> - // available, so mappings will source it from there. - // IWYU: va_list is...*<stdio.h> va_list vl; D1_I1_Typedef d1_i1_typedef; // IWYU: i1_int is...*badinc-i1.h @@ -1837,6 +1836,7 @@ The full include-list for tests/cxx/badinc.cc: #include <ctype.h> // for isascii #include <setjmp.h> #include <stddef.h> // for offsetof +#include <stdarg.h> // for va_list #include <algorithm> // for find #include <fstream> // for fstream #include <list> // for list diff --git a/tests/cxx/badinc.h b/tests/cxx/badinc.h index 75cbf4d..fae667e 100644 --- a/tests/cxx/badinc.h +++ b/tests/cxx/badinc.h @@ -14,8 +14,11 @@ #include <ctype.h> // used only in badinc.cc #include <errno.h> // used both here and in badinc.cc #include <math.h> +#include <stddef.h> + #include <queue> // used only in this .h file, not in any other file. #include <string> + #include "tests/cxx/badinc-d2.h" #include "tests/cxx/badinc-d3.h" @@ -391,7 +394,8 @@ tests/cxx/badinc.h should remove these lines: The full include-list for tests/cxx/badinc.h: #include <errno.h> // for errno -#include <stdio.h> // for NULL, printf +#include <stddef.h> // for NULL +#include <stdio.h> // for printf #include <queue> // for queue #include <set> // for set #include <string> // for string diff --git a/tests/cxx/std_size_t.cc b/tests/cxx/std_size_t.cc index 9f9824a..d5f45d2 100644 --- a/tests/cxx/std_size_t.cc +++ b/tests/cxx/std_size_t.cc @@ -21,7 +21,7 @@ #include <stdio.h> std::size_t f() { - const size_t x = 100; + const std::size_t x = 100; printf("%zu\n", x); return sizeof(int); } |