Avoid non-C++-enabled babeltrace versions
Commit Message
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(+)
Comments
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
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
@@ -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);
@@ -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);