public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Avoid non-C++-enabled babeltrace versions
@ 2016-04-27 11:16 Andreas Arnez
  2016-04-27 12:02 ` Pedro Alves
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Arnez @ 2016-04-27 11:16 UTC (permalink / raw)
  To: gdb-patches

In some babeltrace versions before 1.2.0, the header file iterator.h is
not fully enabled for use from C++, since it contains an anonymous enum
in a struct declaration.  This is fixed in later babeltrace versions:

  https://lists.lttng.org/pipermail/lttng-dev/2013-September/021411.html

Now that GDB is compiled with C++, the GDB build fails on a system with
such a babeltrace version: the compiler complains about a missing
declaration of BT_SEEK_BEGIN in ctf.c.

This patch enhances the configure check to recognize such babeltrace
versions as unusable for GDB.

gdb/ChangeLog:

	* configure.ac: Enhance configure check for babeltrace to reject
	non-C++-enabled versions.
	* configure: Regenerate.
---
 gdb/configure    | 1 +
 gdb/configure.ac | 1 +
 2 files changed, 2 insertions(+)

diff --git a/gdb/configure b/gdb/configure
index 3cf95e7..228cb99 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -16390,6 +16390,7 @@ struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL));
 			struct bt_ctf_event *event = NULL;
 			const struct bt_definition *scope;
 
+			pos.type = BT_SEEK_BEGIN;
 			bt_iter_set_pos (bt_ctf_get_iter (NULL), pos);
 			scope = bt_ctf_get_top_level_scope (event,
 			      				   BT_STREAM_EVENT_HEADER);
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 70452d3..3aa132a 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -2286,6 +2286,7 @@ else
 			struct bt_ctf_event *event = NULL;
 			const struct bt_definition *scope;
 
+			pos.type = BT_SEEK_BEGIN;
 			bt_iter_set_pos (bt_ctf_get_iter (NULL), pos);
 			scope = bt_ctf_get_top_level_scope (event,
 			      				   BT_STREAM_EVENT_HEADER);
-- 
2.3.0

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

* Re: [PATCH] Avoid non-C++-enabled babeltrace versions
  2016-04-27 11:16 [PATCH] Avoid non-C++-enabled babeltrace versions Andreas Arnez
@ 2016-04-27 12:02 ` Pedro Alves
  2016-04-27 14:24   ` Andreas Arnez
  0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2016-04-27 12:02 UTC (permalink / raw)
  To: Andreas Arnez, gdb-patches

On 04/27/2016 12:04 PM, Andreas Arnez wrote:
> In some babeltrace versions before 1.2.0, the header file iterator.h is
> not fully enabled for use from C++, since it contains an anonymous enum
> in a struct declaration.  This is fixed in later babeltrace versions:
> 
>   https://lists.lttng.org/pipermail/lttng-dev/2013-September/021411.html
> 

The rationale for that commit is actually wrong.  There's nothing 
wrong with anonymous enums in structs in C++, and being anonymous is
actually irrelevant.   The problem is that a struct/class establishes a scope
in C++, but not in C.  So outside the struct, to refer to the enum values,
you'd have to write bt_iter_pos::BT_SEEK_TIME etc.

Anyway ...

> Now that GDB is compiled with C++, the GDB build fails on a system with
> such a babeltrace version: the compiler complains about a missing
> declaration of BT_SEEK_BEGIN in ctf.c.
> 
> This patch enhances the configure check to recognize such babeltrace
> versions as unusable for GDB.
> 
> gdb/ChangeLog:
> 
> 	* configure.ac: Enhance configure check for babeltrace to reject
> 	non-C++-enabled versions.
> 	* configure: Regenerate.

OK.

Thanks,
Pedro Alves

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

* Re: [PATCH] Avoid non-C++-enabled babeltrace versions
  2016-04-27 12:02 ` Pedro Alves
@ 2016-04-27 14:24   ` Andreas Arnez
  2016-07-03 15:43     ` [patch] babeltrace compilation regression [Re: [PATCH] Avoid non-C++-enabled babeltrace versions] Jan Kratochvil
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Arnez @ 2016-04-27 14:24 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Wed, Apr 27 2016, Pedro Alves wrote:

> On 04/27/2016 12:04 PM, Andreas Arnez wrote:
>> In some babeltrace versions before 1.2.0, the header file iterator.h is
>> not fully enabled for use from C++, since it contains an anonymous enum
>> in a struct declaration.  This is fixed in later babeltrace versions:
>> 
>>   https://lists.lttng.org/pipermail/lttng-dev/2013-September/021411.html
>> 
>
> The rationale for that commit is actually wrong.  There's nothing 
> wrong with anonymous enums in structs in C++, and being anonymous is
> actually irrelevant.   The problem is that a struct/class establishes a scope
> in C++, but not in C.  So outside the struct, to refer to the enum values,
> you'd have to write bt_iter_pos::BT_SEEK_TIME etc.

Right, the enum being anonymous does not cause a problem by itself.
Changed the commit message to avoid that impression.

>
> Anyway ...
>
>> Now that GDB is compiled with C++, the GDB build fails on a system with
>> such a babeltrace version: the compiler complains about a missing
>> declaration of BT_SEEK_BEGIN in ctf.c.
>> 
>> This patch enhances the configure check to recognize such babeltrace
>> versions as unusable for GDB.
>> 
>> gdb/ChangeLog:
>> 
>> 	* configure.ac: Enhance configure check for babeltrace to reject
>> 	non-C++-enabled versions.
>> 	* configure: Regenerate.
>
> OK.

Thanks, pushed after adjusting the commit message.

--
Andreas

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

* [patch] babeltrace compilation regression  [Re: [PATCH] Avoid non-C++-enabled babeltrace versions]
  2016-04-27 14:24   ` Andreas Arnez
@ 2016-07-03 15:43     ` Jan Kratochvil
  2016-07-04  8:39       ` Andreas Arnez
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2016-07-03 15:43 UTC (permalink / raw)
  To: Andreas Arnez; +Cc: Pedro Alves, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 949 bytes --]

On Wed, 27 Apr 2016 16:24:23 +0200, Andreas Arnez wrote:
> Thanks, pushed after adjusting the commit message.

Since:
	commit 2d681be471cf8aff8f296cb7713c39e9aa4fc2bb
	Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
	Date:   Wed Apr 27 15:52:16 2016 +0200
	    Avoid non-C++-enabled babeltrace versions
tested with:
	libbabeltrace-devel-1.2.4-4.fc24.x86_64
	libbabeltrace-devel-1.4.0-2.fc25.x86_64
it can no longer build due to:
	configure:16435: gcc -o conftest -m64 -g3 -pipe -Wall -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -fno-diagnostics-show-caret  -Werror  -static-libstdc++ -static-libgcc  conftest.c -ldl -ldl -lncurses -lm -ldl  -lbabeltrace -lbabeltrace-ctf >&5
	conftest.c: In function 'main':
	conftest.c:208:7: error: 'pos' is a pointer; did you mean to use '->'?

Have you tested that your line
	pos.type = BT_SEEK_BEGIN;
with some libbabeltrace version or was that just a typo?

OK for check-in?


Thanks,
Jan

[-- Attachment #2: 1 --]
[-- Type: text/plain, Size: 599 bytes --]

gdb/ChangeLog
2016-07-03  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* configure: Regenerate.
	* configure.ac (HAVE_LIBBABELTRACE): Fix pos variable dereference.

diff --git a/gdb/configure.ac b/gdb/configure.ac
index 920c228..5e2e938 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -2309,7 +2309,7 @@ else
 			struct bt_ctf_event *event = NULL;
 			const struct bt_definition *scope;
 
-			pos.type = BT_SEEK_BEGIN;
+			pos->type = BT_SEEK_BEGIN;
 			bt_iter_set_pos (bt_ctf_get_iter (NULL), pos);
 			scope = bt_ctf_get_top_level_scope (event,
 			      				   BT_STREAM_EVENT_HEADER);

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

* Re: [patch] babeltrace compilation regression  [Re: [PATCH] Avoid non-C++-enabled babeltrace versions]
  2016-07-03 15:43     ` [patch] babeltrace compilation regression [Re: [PATCH] Avoid non-C++-enabled babeltrace versions] Jan Kratochvil
@ 2016-07-04  8:39       ` Andreas Arnez
  2016-07-05  8:50         ` [commit] " Jan Kratochvil
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Arnez @ 2016-07-04  8:39 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: Pedro Alves, gdb-patches

On Sun, Jul 03 2016, Jan Kratochvil wrote:

> On Wed, 27 Apr 2016 16:24:23 +0200, Andreas Arnez wrote:
>> Thanks, pushed after adjusting the commit message.
>
> Since:
> 	commit 2d681be471cf8aff8f296cb7713c39e9aa4fc2bb
> 	Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
> 	Date:   Wed Apr 27 15:52:16 2016 +0200
> 	    Avoid non-C++-enabled babeltrace versions
> tested with:
> 	libbabeltrace-devel-1.2.4-4.fc24.x86_64
> 	libbabeltrace-devel-1.4.0-2.fc25.x86_64
> it can no longer build due to:
> 	configure:16435: gcc -o conftest -m64 -g3 -pipe -Wall -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -fno-diagnostics-show-caret  -Werror  -static-libstdc++ -static-libgcc  conftest.c -ldl -ldl -lncurses -lm -ldl  -lbabeltrace -lbabeltrace-ctf >&5
> 	conftest.c: In function 'main':
> 	conftest.c:208:7: error: 'pos' is a pointer; did you mean to use '->'?
>
> Have you tested that your line
> 	pos.type = BT_SEEK_BEGIN;
> with some libbabeltrace version or was that just a typo?

Phew, curious... this sure looks like a typo.  IIRC, I've tested that
GDB *builds*, but probably forgot to verify that the babeltrace
configure check actually succeeds.  Sorry about that.

--
Andreas

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

* [commit] babeltrace compilation regression  [Re: [PATCH] Avoid non-C++-enabled babeltrace versions]
  2016-07-04  8:39       ` Andreas Arnez
@ 2016-07-05  8:50         ` Jan Kratochvil
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kratochvil @ 2016-07-05  8:50 UTC (permalink / raw)
  To: Andreas Arnez; +Cc: Pedro Alves, gdb-patches

On Mon, 04 Jul 2016 10:39:42 +0200, Andreas Arnez wrote:
> On Sun, Jul 03 2016, Jan Kratochvil wrote:
> > Have you tested that your line
> > 	pos.type = BT_SEEK_BEGIN;
> > with some libbabeltrace version or was that just a typo?
> 
> Phew, curious... this sure looks like a typo.  IIRC, I've tested that
> GDB *builds*, but probably forgot to verify that the babeltrace
> configure check actually succeeds.  Sorry about that.

Checked in as obvious:
	13cdc2afb7873547ec2910ba647fb4a68602252f


Jan

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

end of thread, other threads:[~2016-07-05  8:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-27 11:16 [PATCH] Avoid non-C++-enabled babeltrace versions Andreas Arnez
2016-04-27 12:02 ` Pedro Alves
2016-04-27 14:24   ` Andreas Arnez
2016-07-03 15:43     ` [patch] babeltrace compilation regression [Re: [PATCH] Avoid non-C++-enabled babeltrace versions] Jan Kratochvil
2016-07-04  8:39       ` Andreas Arnez
2016-07-05  8:50         ` [commit] " Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).