]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ppc-sysv-tdep.c
gdb: fix ppc-sysv-tdep.c build on 32-bit platforms
authorJohn Baldwin <jhb@FreeBSD.org>
Fri, 28 Jan 2022 19:22:02 +0000 (11:22 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Fri, 28 Jan 2022 19:22:02 +0000 (11:22 -0800)
commite5783467a342ffdc89cc7fb678eae033c2f7cce1
tree896c2dc7abd1f3cecb2a956eb75c069fd4f5e182
parent00d7af046f12f18759b5b2c909d0b4527ac1857e
gdb: fix ppc-sysv-tdep.c build on 32-bit platforms

The previous code triggered the following error on an i386 host:

/git/gdb/gdb/ppc-sysv-tdep.c:1764:34: error: non-constant-expression cannot be narrowed from type 'ULONGEST' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
              unscaled.read ({writebuf, TYPE_LENGTH (valtype)},
                                        ^~~~~~~~~~~~~~~~~~~~~
/git/gdb/gdb/gdbtypes.h:2043:31: note: expanded from macro 'TYPE_LENGTH'
                              ^~~~~~~~~~~~~~~~~~
/git/gdb/gdb/ppc-sysv-tdep.c:1764:34: note: insert an explicit cast to silence this issue
              unscaled.read ({writebuf, TYPE_LENGTH (valtype)},
                                        ^~~~~~~~~~~~~~~~~~~~~
                                        static_cast<size_t>( )
/git/gdb/gdb/gdbtypes.h:2043:31: note: expanded from macro 'TYPE_LENGTH'
                              ^~~~~~~~~~~~~~~~~~
1 error generated.

Fix this by using gdb::make_array_view.
gdb/ppc-sysv-tdep.c