[Crash-utility] [PATCH v2] Fix gcc-11 compiler warnings on gdb-10.2/gdb/symtab.c

lijiang lijiang at redhat.com
Fri Sep 2 05:48:13 UTC 2022


On Thu, Sep 1, 2022 at 12:56 PM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab at nec.com>
wrote:

> Without the patch, the following gcc-11 compiler warnings are emitted
> for gdb-10.2/gdb/symtab.c:
>
> symtab.c: In function 'void gdb_get_datatype(gnu_request*)':
> symtab.c:7131:31: warning: ISO C++17 does not allow 'register' storage
> class specifier [-Wregister]
>    7131 |         register struct type *type;
>         |                               ^~~~
> symtab.c:7132:31: warning: ISO C++17 does not allow 'register' storage
> class specifier [-Wregister]
>    7132 |         register struct type *typedef_type;
>         |                               ^~~~~~~~~~~~
> ...
>
> Usually we don't fix compiler warnings for gdb, but these are emitted
> even by "make clean ; make warn", which doesn't recompile the whole
> gdb, so it would be better to fix.
>
> Signed-off-by: Kazuhito Hagio <k-hagio-ab at nec.com>
> ---
> v2
> - rebased to the current gdb-10.2.patch.
>
>   gdb-10.2.patch | 41 +++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 41 insertions(+)
>
>
Looks good to me. So: Ack

Thanks.
Lianbo


> diff --git a/gdb-10.2.patch b/gdb-10.2.patch
> index 642cd6a78a1d..91edfb338445 100644
> --- a/gdb-10.2.patch
> +++ b/gdb-10.2.patch
> @@ -9,6 +9,7 @@
>   # to all subsequent patch applications.
>
>   tar xvzmf gdb-10.2.tar.gz \
> +       gdb-10.2/gdb/symtab.c \
>         gdb-10.2/gdb/printcmd.c \
>         gdb-10.2/gdb/symfile.c \
>         gdb-10.2/gdb/Makefile.in
> @@ -1696,3 +1697,43 @@ exit 0
>
>      /* If the nearest symbol is too far away, don't print anything
> symbolic.  */
>
> +--- gdb-10.2/gdb/symtab.c.orig
> ++++ gdb-10.2/gdb/symtab.c
> +@@ -7128,8 +7128,8 @@ gdb_get_line_number(struct gnu_request *
> + static void
> + gdb_get_datatype(struct gnu_request *req)
> + {
> +-        register struct type *type;
> +-        register struct type *typedef_type;
> ++        struct type *type;
> ++        struct type *typedef_type;
> +         expression_up expr;
> +         struct symbol *sym;
> +         struct value *val;
> +@@ -7235,7 +7235,7 @@ gdb_get_datatype(struct gnu_request *req
> + static void
> + dump_enum(struct type *type, struct gnu_request *req)
> + {
> +-        register int i;
> ++        int i;
> +         int len;
> +         long long lastval;
> +
> +@@ -7271,7 +7271,7 @@ dump_enum(struct type *type, struct gnu_
> + static void
> + eval_enum(struct type *type, struct gnu_request *req)
> + {
> +-        register int i;
> ++        int i;
> +         int len;
> +         long long lastval;
> +
> +@@ -7298,7 +7298,7 @@ eval_enum(struct type *type, struct gnu_
> + static void
> + get_member_data(struct gnu_request *req, struct type *type, long offset,
> int is_first)
> + {
> +-        register short i;
> ++        short i;
> +         struct field *nextfield;
> +         short nfields;
> +         struct type *typedef_type, *target_type;
> --
> 2.31.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20220902/4742d6e3/attachment.htm>


More information about the Crash-utility mailing list