libctf: create: forwards are always in the namespace of their referent
authorNick Alcock <nick.alcock@oracle.com>
Tue, 5 Nov 2019 17:57:55 +0000 (17:57 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 26 Jun 2020 14:56:39 +0000 (15:56 +0100)
commit8ffcdf1823d186c94eb3a1781e366a155646140a
treeb848d89e552b17c12a6fef2824a24d372cd5e821
parentd04a47ac53b7e3ae572021711c91f2f3d333417b
libctf: create: forwards are always in the namespace of their referent

The C namespace a forward is located in is always the same as the
namespace of the corresponding complete type: 'struct foo' is in the
struct namespace and does not collide with, say, 'union foo'.

libctf allowed for this in many places, but inconsistently: in
particular, forward *addition* never allowed for this, and was interning
forwards in the default namespace, which is always wrong, since you can
only forward structs, unions and enums, all of which are in their own
namespaces in C.

Forward removal needs corresponding adjustment to remove the names form
the right namespace, as does ctf_rollback.

libctf/
* ctf-create.c (ctf_add_forward): Intern in the right namespace.
(ctf_dtd_delete): Remove correspondingly.
(ctf_rollback): Likewise.
libctf/ChangeLog
libctf/ctf-create.c