Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Lancelot SIX <Lancelot.Six@amd.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/python/python-internal.h: avoid uninitialized constexpr
Date: Tue, 18 Jun 2024 22:01:42 +0100	[thread overview]
Message-ID: <72ea54a7-b6de-42b3-8889-f8921c0d2074@amd.com> (raw)
In-Reply-To: <87wmmmxcat.fsf@tromey.com>



On 18/06/2024 20:48, Tom Tromey wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> Lancelot> Just gave a try to this approach, I end up linker errors regarding
> Lancelot> duplicated symbols:
> 
> Lancelot> I have not really looked if there is a way to work-around that.
> 
> I think s/constexpr/extern probably works.
> Would you mind trying that?
> 
> Tom

G++ complains that "explicit template specialization cannot have a 
storage class":

In file included from ../../gdb/python/py-arch.c:23:
../../gdb/python/python-internal.h:154:13: error: ‘gdbpy_method_format’ 
initialized and declared ‘extern’ [-Werror]
   154 | extern char gdbpy_method_format<gdb_py_longest> = GDB_PY_LL_ARG[0];
       |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gdb/python/python-internal.h:154:1: error: explicit template 
specialization cannot have a storage class
   154 | extern char gdbpy_method_format<gdb_py_longest> = GDB_PY_LL_ARG[0];
       | ^~~~~~

Clang++ complains because "'extern' variable has an initializer".  I 
know the empty struct as a base template, and add static constexpr 
members for template specializations is a bit verbose, but to the best 
of my knowledge it is the "c++ way".

Lancelot.

  reply	other threads:[~2024-06-18 21:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18  9:09 Lancelot SIX
2024-06-18 13:00 ` Tom de Vries
2024-06-18 15:25   ` Tom de Vries
2024-06-18 16:17 ` Tom Tromey
2024-06-18 18:27   ` Lancelot SIX
2024-06-18 19:48     ` Tom Tromey
2024-06-18 21:01       ` Lancelot SIX [this message]
2024-06-18 21:03         ` Tom Tromey
2024-06-18 21:26           ` Lancelot SIX
2024-06-19  0:11             ` Tom Tromey
2024-06-19  9:16               ` Lancelot SIX
2024-06-19 13:41                 ` Tom Tromey
2024-06-19 14:29                   ` Lancelot SIX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=72ea54a7-b6de-42b3-8889-f8921c0d2074@amd.com \
    --to=lancelot.six@amd.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox