[1/1] newlib: libc: add several missing headers

Message ID 20260211131719.664854-2-vladislav.v.belov@yandex.ru
State New
Headers
Series newlib: libc: add several missing headers |

Commit Message

vbe-sc Feb. 11, 2026, 1:17 p.m. UTC
  This patch is including some several headers to regex.h, stdatomic.h and sys/utime.h to make them self-descriptive for compilers

Signed-off-by: vbe-sc <vladislav.v.belov@yandex.ru>
---
 newlib/libc/include/regex.h     | 1 +
 newlib/libc/include/stdatomic.h | 2 ++
 newlib/libc/include/sys/utime.h | 2 ++
 3 files changed, 5 insertions(+)
  

Comments

Corinna Vinschen Feb. 11, 2026, 3:35 p.m. UTC | #1
Hi Vladislav,

In the light of the discussion started here:
https://sourceware.org/pipermail/newlib/2026/022286.html

On Feb 11 16:17, vbe-sc wrote:
> This patch is including some several headers to regex.h, stdatomic.h and sys/utime.h to make them self-descriptive for compilers
> 
> Signed-off-by: vbe-sc <vladislav.v.belov@yandex.ru>
> ---
>  newlib/libc/include/regex.h     | 1 +
>  newlib/libc/include/stdatomic.h | 2 ++
>  newlib/libc/include/sys/utime.h | 2 ++
>  3 files changed, 5 insertions(+)
> 
> diff --git a/newlib/libc/include/regex.h b/newlib/libc/include/regex.h
> index 4da1a374e..2cb2e6c8a 100644
> --- a/newlib/libc/include/regex.h
> +++ b/newlib/libc/include/regex.h
> @@ -38,6 +38,7 @@
>  #define	_REGEX_H_
>  
>  #include <sys/cdefs.h>
> +#include <sys/types.h>

Shouldn't this be <sys/_types.h>?

> 
>  /* types */
>  typedef off_t regoff_t;
> diff --git a/newlib/libc/include/stdatomic.h b/newlib/libc/include/stdatomic.h
> index 13d1e1762..84cf24708 100644
> --- a/newlib/libc/include/stdatomic.h
> +++ b/newlib/libc/include/stdatomic.h
> @@ -32,6 +32,8 @@
>  
>  #include <sys/cdefs.h>
>  #include <sys/_types.h>
> +#include <stdint.h>
> +#include <wchar.h>

I have a local patch in the loop avoiding to include <stdint.h> and
<wchar.h.>  In fact, <wchar.h> shouldn't be necessary anyway because
wchar_t is already defined through sys/_types.h, which in turn includes
<stddef.h>

>  #if (__has_extension(c_atomic) || __has_extension(cxx_atomic)) && \
>      defined(__clang__)
> diff --git a/newlib/libc/include/sys/utime.h b/newlib/libc/include/sys/utime.h
> index 5e937f103..de86af58f 100644
> --- a/newlib/libc/include/sys/utime.h
> +++ b/newlib/libc/include/sys/utime.h
> @@ -9,6 +9,8 @@
>  extern "C" {
>  #endif
>  
> +#include <sys/_timeval.h>
> +

This looks ok.


Thanks,
Corinna
  

Patch

diff --git a/newlib/libc/include/regex.h b/newlib/libc/include/regex.h
index 4da1a374e..2cb2e6c8a 100644
--- a/newlib/libc/include/regex.h
+++ b/newlib/libc/include/regex.h
@@ -38,6 +38,7 @@ 
 #define	_REGEX_H_
 
 #include <sys/cdefs.h>
+#include <sys/types.h>
 
 /* types */
 typedef off_t regoff_t;
diff --git a/newlib/libc/include/stdatomic.h b/newlib/libc/include/stdatomic.h
index 13d1e1762..84cf24708 100644
--- a/newlib/libc/include/stdatomic.h
+++ b/newlib/libc/include/stdatomic.h
@@ -32,6 +32,8 @@ 
 
 #include <sys/cdefs.h>
 #include <sys/_types.h>
+#include <stdint.h>
+#include <wchar.h>
 
 #if (__has_extension(c_atomic) || __has_extension(cxx_atomic)) && \
     defined(__clang__)
diff --git a/newlib/libc/include/sys/utime.h b/newlib/libc/include/sys/utime.h
index 5e937f103..de86af58f 100644
--- a/newlib/libc/include/sys/utime.h
+++ b/newlib/libc/include/sys/utime.h
@@ -9,6 +9,8 @@ 
 extern "C" {
 #endif
 
+#include <sys/_timeval.h>
+
 struct utimbuf 
 {
   time_t actime;