Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb: unconditionally define _initialize_string_view_selftests
@ 2019-03-14 22:28 Sergei Trofimovich
  2019-03-15 14:24 ` Tom Tromey
  0 siblings, 1 reply; 7+ messages in thread
From: Sergei Trofimovich @ 2019-03-14 22:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Sergei Trofimovich

The build failure was noticed by Helmut Jarausch in
https://bugs.gentoo.org/680232:
    $ ./configure CXXFLAGS='-std=c++17 -Os'
    ...
      CXXLD  gdb
    ld: init.o: in function `initialize_all_files()':
    init.c:(.text+0x113): undefined reference to `_initialize_string_view_selftests()'

It happens because '_initialize_string_view_selftests()' is
conditionally defined based on C++ default.

The change defines '_initialize_string_view_selftests()'
unconditionally and leaves implementation a no-op on c++17
compilers.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 gdb/unittests/string_view-selftests.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/unittests/string_view-selftests.c b/gdb/unittests/string_view-selftests.c
index 21a10e65af..b2a2bf7f2e 100644
--- a/gdb/unittests/string_view-selftests.c
+++ b/gdb/unittests/string_view-selftests.c
@@ -170,10 +170,12 @@ run_tests ()
 } /* namespace string_view */
 } /* namespace selftests */
 
+#endif /* __cplusplus < 201703L */
+
 void
 _initialize_string_view_selftests ()
 {
+#if defined(GDB_STRING_VIEW)
   selftests::register_test ("string_view", selftests::string_view::run_tests);
+#endif
 }
-
-#endif /* __cplusplus < 201703L */
-- 
2.21.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gdb: unconditionally define _initialize_string_view_selftests
  2019-03-14 22:28 [PATCH] gdb: unconditionally define _initialize_string_view_selftests Sergei Trofimovich
@ 2019-03-15 14:24 ` Tom Tromey
  2019-03-17 22:20   ` Sergei Trofimovich
  0 siblings, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2019-03-15 14:24 UTC (permalink / raw)
  To: Sergei Trofimovich; +Cc: gdb-patches

>>>>> "Sergei" == Sergei Trofimovich <slyfox@gentoo.org> writes:

Sergei> The build failure was noticed by Helmut Jarausch in
Sergei> https://bugs.gentoo.org/680232:
Sergei>     $ ./configure CXXFLAGS='-std=c++17 -Os'
Sergei>     ...
Sergei>       CXXLD  gdb
Sergei>     ld: init.o: in function `initialize_all_files()':
Sergei>     init.c:(.text+0x113): undefined reference to `_initialize_string_view_selftests()'

Sergei> It happens because '_initialize_string_view_selftests()' is
Sergei> conditionally defined based on C++ default.

Sergei> The change defines '_initialize_string_view_selftests()'
Sergei> unconditionally and leaves implementation a no-op on c++17
Sergei> compilers.

Thank you.  This is OK with a ChangeLog entry.
Let me know if you need me to check it in for you.

thanks,
Tom


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gdb: unconditionally define _initialize_string_view_selftests
  2019-03-15 14:24 ` Tom Tromey
@ 2019-03-17 22:20   ` Sergei Trofimovich
  2019-03-17 22:28     ` [PATCH v2] " Sergei Trofimovich
  2019-03-18  3:55     ` [PATCH] " Sergio Durigan Junior
  0 siblings, 2 replies; 7+ messages in thread
From: Sergei Trofimovich @ 2019-03-17 22:20 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Fri, 15 Mar 2019 08:24:17 -0600
Tom Tromey <tom@tromey.com> wrote:

> >>>>> "Sergei" == Sergei Trofimovich <slyfox@gentoo.org> writes:  
> 
> Sergei> The build failure was noticed by Helmut Jarausch in
> Sergei> https://bugs.gentoo.org/680232:
> Sergei>     $ ./configure CXXFLAGS='-std=c++17 -Os'
> Sergei>     ...
> Sergei>       CXXLD  gdb
> Sergei>     ld: init.o: in function `initialize_all_files()':
> Sergei>     init.c:(.text+0x113): undefined reference to `_initialize_string_view_selftests()'  
> 
> Sergei> It happens because '_initialize_string_view_selftests()' is
> Sergei> conditionally defined based on C++ default.  
> 
> Sergei> The change defines '_initialize_string_view_selftests()'
> Sergei> unconditionally and leaves implementation a no-op on c++17
> Sergei> compilers.  
> 
> Thank you.  This is OK with a ChangeLog entry.
> Let me know if you need me to check it in for you.

Thank you for the quick review! Yes, I need someone to check the
change in for me. Should I indicate it the patch email next time?

I'll send a follow-up v2 with ChangeLog added and author email
matching the company which has agreement already signed with FSF.

-- 

  Sergei


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] gdb: unconditionally define _initialize_string_view_selftests
  2019-03-17 22:20   ` Sergei Trofimovich
@ 2019-03-17 22:28     ` Sergei Trofimovich
  2019-03-18  4:02       ` Sergio Durigan Junior
  2019-03-18  3:55     ` [PATCH] " Sergio Durigan Junior
  1 sibling, 1 reply; 7+ messages in thread
From: Sergei Trofimovich @ 2019-03-17 22:28 UTC (permalink / raw)
  To: gdb-patches, Tom Tromey; +Cc: Sergei Trofimovich

From: Sergei Trofimovich <siarheit@google.com>

The build failure was noticed by Helmut Jarausch in
https://bugs.gentoo.org/680232:
    $ ./configure CXXFLAGS='-std=c++17 -Os'
    ...
      CXXLD  gdb
    ld: init.o: in function `initialize_all_files()':
    init.c:(.text+0x113): undefined reference to `_initialize_string_view_selftests()'

It happens because '_initialize_string_view_selftests()' is
conditionally defined based on C++ default.

The change defines '_initialize_string_view_selftests()'
unconditionally and leaves implementation a no-op on c++17
compilers.
---
 gdb/ChangeLog                         | 6 ++++++
 gdb/unittests/string_view-selftests.c | 6 ++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 862c89e821..7684d9be60 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2019-03-17  Sergei Trofimovich <siarheit@google.com>
+
+	* unittests/string_view-selftests.c: define
+	_initialize_string_view_selftests unconditionally.  This
+	fixes build failure on CXXFLAGS="-std=c++17" setup.
+
 2019-03-14  Eli Zaretskii  <eliz@gnu.org>
 
 	The MS-Windows port of ncurses fails to switch to a color pair if
diff --git a/gdb/unittests/string_view-selftests.c b/gdb/unittests/string_view-selftests.c
index 21a10e65af..b2a2bf7f2e 100644
--- a/gdb/unittests/string_view-selftests.c
+++ b/gdb/unittests/string_view-selftests.c
@@ -170,10 +170,12 @@ run_tests ()
 } /* namespace string_view */
 } /* namespace selftests */
 
+#endif /* __cplusplus < 201703L */
+
 void
 _initialize_string_view_selftests ()
 {
+#if defined(GDB_STRING_VIEW)
   selftests::register_test ("string_view", selftests::string_view::run_tests);
+#endif
 }
-
-#endif /* __cplusplus < 201703L */
-- 
2.21.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gdb: unconditionally define _initialize_string_view_selftests
  2019-03-17 22:20   ` Sergei Trofimovich
  2019-03-17 22:28     ` [PATCH v2] " Sergei Trofimovich
@ 2019-03-18  3:55     ` Sergio Durigan Junior
  2019-03-18 16:00       ` Tom Tromey
  1 sibling, 1 reply; 7+ messages in thread
From: Sergio Durigan Junior @ 2019-03-18  3:55 UTC (permalink / raw)
  To: Sergei Trofimovich; +Cc: Tom Tromey, gdb-patches

On Sunday, March 17 2019, Sergei Trofimovich wrote:

> On Fri, 15 Mar 2019 08:24:17 -0600
> Tom Tromey <tom@tromey.com> wrote:
>
>> >>>>> "Sergei" == Sergei Trofimovich <slyfox@gentoo.org> writes:  
>> 
>> Sergei> The build failure was noticed by Helmut Jarausch in
>> Sergei> https://bugs.gentoo.org/680232:
>> Sergei>     $ ./configure CXXFLAGS='-std=c++17 -Os'
>> Sergei>     ...
>> Sergei>       CXXLD  gdb
>> Sergei>     ld: init.o: in function `initialize_all_files()':
>> Sergei>     init.c:(.text+0x113): undefined reference to `_initialize_string_view_selftests()'  
>> 
>> Sergei> It happens because '_initialize_string_view_selftests()' is
>> Sergei> conditionally defined based on C++ default.  
>> 
>> Sergei> The change defines '_initialize_string_view_selftests()'
>> Sergei> unconditionally and leaves implementation a no-op on c++17
>> Sergei> compilers.  
>> 
>> Thank you.  This is OK with a ChangeLog entry.
>> Let me know if you need me to check it in for you.
>
> Thank you for the quick review! Yes, I need someone to check the
> change in for me. Should I indicate it the patch email next time?

Either that, or you can request commit access to the repository here:

  https://sourceware.org/cgi-bin/pdw/ps_form.cgi

I'm not a global maintainer, but I believe Tom wouldn't mind if you put
him as the person who approved the request.

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] gdb: unconditionally define _initialize_string_view_selftests
  2019-03-17 22:28     ` [PATCH v2] " Sergei Trofimovich
@ 2019-03-18  4:02       ` Sergio Durigan Junior
  0 siblings, 0 replies; 7+ messages in thread
From: Sergio Durigan Junior @ 2019-03-18  4:02 UTC (permalink / raw)
  To: Sergei Trofimovich; +Cc: gdb-patches, Tom Tromey

On Sunday, March 17 2019, Sergei Trofimovich wrote:

> From: Sergei Trofimovich <siarheit@google.com>
>
> The build failure was noticed by Helmut Jarausch in
> https://bugs.gentoo.org/680232:
>     $ ./configure CXXFLAGS='-std=c++17 -Os'
>     ...
>       CXXLD  gdb
>     ld: init.o: in function `initialize_all_files()':
>     init.c:(.text+0x113): undefined reference to `_initialize_string_view_selftests()'
>
> It happens because '_initialize_string_view_selftests()' is
> conditionally defined based on C++ default.
>
> The change defines '_initialize_string_view_selftests()'
> unconditionally and leaves implementation a no-op on c++17
> compilers.
> ---
>  gdb/ChangeLog                         | 6 ++++++
>  gdb/unittests/string_view-selftests.c | 6 ++++--
>  2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index 862c89e821..7684d9be60 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,9 @@
> +2019-03-17  Sergei Trofimovich <siarheit@google.com>
> +
> +	* unittests/string_view-selftests.c: define

Uppercase "D" on "Define".

> +	_initialize_string_view_selftests unconditionally.  This
> +	fixes build failure on CXXFLAGS="-std=c++17" setup.

FWIW, a ChangeLog entry should mention *what* changed, not *why*.  So
something like:

2019-03-17  Sergei Trofimovich <siarheit@google.com>

	* unittests/string_view-selftests.c: Define
	_initialize_string_view_selftests unconditionally.

is fine.

Since Tom has already approved the patch, I went ahead and checked it
in:

58785d9888c699770154ef1d42fcea7598e8d704

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] gdb: unconditionally define _initialize_string_view_selftests
  2019-03-18  3:55     ` [PATCH] " Sergio Durigan Junior
@ 2019-03-18 16:00       ` Tom Tromey
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2019-03-18 16:00 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: Sergei Trofimovich, Tom Tromey, gdb-patches

>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

Sergio> I'm not a global maintainer, but I believe Tom wouldn't mind if you put
Sergio> him as the person who approved the request.

Indeed.  The rule is you need one accepted patch to get
write-after-review access.  If you go this route then you should send
and commit a patch to update the MAINTAINERS file to add your name.

thanks,
Tom


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-03-18 16:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14 22:28 [PATCH] gdb: unconditionally define _initialize_string_view_selftests Sergei Trofimovich
2019-03-15 14:24 ` Tom Tromey
2019-03-17 22:20   ` Sergei Trofimovich
2019-03-17 22:28     ` [PATCH v2] " Sergei Trofimovich
2019-03-18  4:02       ` Sergio Durigan Junior
2019-03-18  3:55     ` [PATCH] " Sergio Durigan Junior
2019-03-18 16:00       ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox