Include <array> in ui-style.h

Message ID 20260826153256.907020-1-Nikita.Venkatesh@arm.com
State New
Headers
Series Include <array> in ui-style.h |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Nikita.Venkatesh@arm.com Aug. 26, 2026, 3:32 p.m. UTC
  From: Nikita Venkatesh <Nikita.Venkatesh@arm.com>

ui-style.h uses std::array without including <array> directly.

This builds successfully with GCC 8 and libstdc++ as its <tuple> header
includes <array>. However, libc++'s <tuple> does not include <array> with
Apple Clang 13.0.0. This causes the GDB builds to fail on macOS with:

	error: implicit instantiation of undefined template
	'std::array<unsigned char, 3>'

Include <array> directly in ui-style.h rather than relying on the
include from <tuple>.

OK for trunk and gdb-18 branch?
---
 gdb/ui-style.h | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Andrew Burgess Aug. 26, 2026, 4:34 p.m. UTC | #1
Nikita.Venkatesh@arm.com writes:

> From: Nikita Venkatesh <Nikita.Venkatesh@arm.com>
>
> ui-style.h uses std::array without including <array> directly.
>
> This builds successfully with GCC 8 and libstdc++ as its <tuple> header
> includes <array>. However, libc++'s <tuple> does not include <array> with
> Apple Clang 13.0.0. This causes the GDB builds to fail on macOS with:
>
> 	error: implicit instantiation of undefined template
> 	'std::array<unsigned char, 3>'
>
> Include <array> directly in ui-style.h rather than relying on the
> include from <tuple>.
>
> OK for trunk and gdb-18 branch?

LGTM.

Approved-By: Andrew Burgess <aburgess@redhat.com>

thanks,
Andrew

> ---
>  gdb/ui-style.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/gdb/ui-style.h b/gdb/ui-style.h
> index fc40b93709d..201a6f302d9 100644
> --- a/gdb/ui-style.h
> +++ b/gdb/ui-style.h
> @@ -19,6 +19,8 @@
>  #ifndef GDB_UI_STYLE_H
>  #define GDB_UI_STYLE_H
>  
> +#include <array>
> +
>  /* One of the color spaces that usually supported by terminals.  */
>  enum class color_space
>  {
> -- 
> 2.34.1
  

Patch

diff --git a/gdb/ui-style.h b/gdb/ui-style.h
index fc40b93709d..201a6f302d9 100644
--- a/gdb/ui-style.h
+++ b/gdb/ui-style.h
@@ -19,6 +19,8 @@ 
 #ifndef GDB_UI_STYLE_H
 #define GDB_UI_STYLE_H
 
+#include <array>
+
 /* One of the color spaces that usually supported by terminals.  */
 enum class color_space
 {