mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-16 15:04:46 +00:00
Bug 27267 - Better support for opaque enum types
Upon a request to build the IR for a opaque enum type, get_opaque_version_of_type wrongly returns a nil type even though the code is in there to construct an opaque variant of the enum. This patch cleans up that code to let it build an opaque enum type. It also ensures the opaque enum type is properly added to its lexical scope to ensure proper life cycle management. * src/abg-dwarf-reader.cc (get_opaque_version_of_type): Do not quit early for enum types, because the code that comes a bit later can handle enums. Add the newly built enum to its scope for proper life cycle management. * tests/data/test-diff-suppr/PR27267/include-dir-v{0,1}/include.h: New include files for the input test library. * tests/data/test-diff-suppr/PR27267/libtestpr27267-v{0,1}.so: New input test library. * tests/data/test-diff-suppr/PR27267/report-1.txt: New reference output for the comparison. * tests/data/test-diff-suppr/PR27267/v{0,1}.c: Source code for the new input test library. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new test input above to the test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
013a19c5fe
commit
e5c7fd3400
@ -15906,12 +15906,6 @@ get_opaque_version_of_type(read_context &ctxt,
|
||||
&& tag != DW_TAG_enumeration_type)
|
||||
return result;
|
||||
|
||||
if (tag == DW_TAG_union_type)
|
||||
// TODO: also handle declaration-only unions. To do that, we mostly
|
||||
// need to adapt add_or_update_union_type to make it schedule
|
||||
// declaration-only unions for resolution too.
|
||||
return result;
|
||||
|
||||
string type_name, linkage_name;
|
||||
location type_location;
|
||||
die_loc_and_name(ctxt, type_die, type_location, type_name, linkage_name);
|
||||
@ -15973,6 +15967,7 @@ get_opaque_version_of_type(read_context &ctxt,
|
||||
underlying_type,
|
||||
enumeratorz,
|
||||
linkage_name));
|
||||
add_decl_to_scope(enum_type, scope);
|
||||
result = enum_type;
|
||||
}
|
||||
}
|
||||
|
@ -1482,6 +1482,13 @@ test-diff-suppr/libtest48-soname-abixml-suppr.txt \
|
||||
test-diff-suppr/libtest48-soname-abixml-suppr-2.txt \
|
||||
test-diff-suppr/libtest48-soname-abixml-suppr-3.txt \
|
||||
test-diff-suppr/libtest48-soname-abixml-suppr-4.txt \
|
||||
test-diff-suppr/PR27267/include-dir-v0/include.h \
|
||||
test-diff-suppr/PR27267/include-dir-v1/include.h \
|
||||
test-diff-suppr/PR27267/v0.c \
|
||||
test-diff-suppr/PR27267/v1.c \
|
||||
test-diff-suppr/PR27267/libtestpr27267-v0.so \
|
||||
test-diff-suppr/PR27267/libtestpr27267-v1.so \
|
||||
test-diff-suppr/PR27267/report-1.txt \
|
||||
\
|
||||
test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1 \
|
||||
test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi \
|
||||
|
@ -0,0 +1,8 @@
|
||||
enum opaque_enum;
|
||||
struct opaque_struct;
|
||||
|
||||
typedef enum opaque_enum opaque_enum;
|
||||
typedef struct opaque_struct opaque_struct;
|
||||
|
||||
void
|
||||
fn(opaque_struct *, opaque_enum *e);
|
@ -0,0 +1,8 @@
|
||||
enum opaque_enum;
|
||||
struct opaque_struct;
|
||||
|
||||
typedef enum opaque_enum opaque_enum;
|
||||
typedef struct opaque_struct opaque_struct;
|
||||
|
||||
void
|
||||
fn(opaque_struct *, opaque_enum *e);
|
BIN
tests/data/test-diff-suppr/PR27267/libtestpr27267-v0.so
Executable file
BIN
tests/data/test-diff-suppr/PR27267/libtestpr27267-v0.so
Executable file
Binary file not shown.
BIN
tests/data/test-diff-suppr/PR27267/libtestpr27267-v1.so
Executable file
BIN
tests/data/test-diff-suppr/PR27267/libtestpr27267-v1.so
Executable file
Binary file not shown.
0
tests/data/test-diff-suppr/PR27267/report-1.txt
Normal file
0
tests/data/test-diff-suppr/PR27267/report-1.txt
Normal file
25
tests/data/test-diff-suppr/PR27267/v0.c
Normal file
25
tests/data/test-diff-suppr/PR27267/v0.c
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
*
|
||||
* Compile with:
|
||||
* gcc -shared -g -Wall -o libtestpr27267-v0.so v0.c
|
||||
*
|
||||
*/
|
||||
|
||||
#include "include-dir-v0/include.h"
|
||||
|
||||
enum opaque_enum
|
||||
{
|
||||
e0,
|
||||
e1
|
||||
};
|
||||
|
||||
struct opaque_struct
|
||||
{
|
||||
opaque_enum m0;
|
||||
};
|
||||
|
||||
void
|
||||
fn(opaque_struct * s, opaque_enum *e)
|
||||
{
|
||||
s->m0 = *e;
|
||||
}
|
28
tests/data/test-diff-suppr/PR27267/v1.c
Normal file
28
tests/data/test-diff-suppr/PR27267/v1.c
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
*
|
||||
* Compile with:
|
||||
* gcc -shared -g -Wall -o libtestpr27267-v1.so v1.c
|
||||
*
|
||||
*/
|
||||
|
||||
#include "include-dir-v1/include.h"
|
||||
|
||||
enum opaque_enum
|
||||
{
|
||||
e0,
|
||||
e1,
|
||||
e2
|
||||
};
|
||||
|
||||
struct opaque_struct
|
||||
{
|
||||
opaque_enum m0;
|
||||
opaque_enum m1;
|
||||
};
|
||||
|
||||
void
|
||||
fn(opaque_struct * s, opaque_enum *e)
|
||||
{
|
||||
s->m0 = *e;
|
||||
s->m1 = s->m0;
|
||||
}
|
@ -2026,6 +2026,16 @@ InOutSpec in_out_specs[] =
|
||||
"data/test-diff-suppr/libtest48-soname-abixml-report-1.txt",
|
||||
"output/test-diff-suppr/libtest48-soname-abixml-report-1_suppr4.txt"
|
||||
},
|
||||
{
|
||||
"data/test-diff-suppr/PR27267/libtestpr27267-v0.so",
|
||||
"data/test-diff-suppr/PR27267/libtestpr27267-v1.so",
|
||||
"data/test-diff-suppr/PR27267/include-dir-v0",
|
||||
"data/test-diff-suppr/PR27267/include-dir-v1",
|
||||
"",
|
||||
"--drop-private-types --no-default-suppression",
|
||||
"data/test-diff-suppr/PR27267/report-1.txt",
|
||||
"output/test-diff-suppr/PR27267/report-1.txt"
|
||||
},
|
||||
// This should be the last entry
|
||||
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user