[Bug default/26672] detection of changes to an abstract base class

jiyong at google dot com sourceware-bugzilla@sourceware.org
Tue Sep 29 00:26:23 GMT 2020


https://sourceware.org/bugzilla/show_bug.cgi?id=26672

--- Comment #2 from jiyong at google dot com ---
>  I am genuiously curious to know how the code in its whole is supposed to
work

The abstract class `MyCallback` is expected to be implemented by a client, not
by the library that is implementing `MyClass`.

I see that abidiff works as expected for the C-equivalent of the example.

~/temp $ cat foo1.c

struct MyCallback {
  void (*event1)();
  void (*event2)();
};

static struct MyCallback* saved_cb;

void doSomething() { saved_cb->event1(); saved_cb->event2(); }
void registerCallback(struct MyCallback *cb) { saved_cb = cb;}

~/temp $ cat foo2.c

struct MyCallback {
  void (*event1)();
  void (*event2)();
  void (*event3)();
};

static struct MyCallback* saved_cb;

void doSomething() { saved_cb->event1(); saved_cb->event2();
saved_cb->event3(); }
void registerCallback(struct MyCallback *cb) { saved_cb = cb;}

~/temp $ gcc -c -g foo1.c -o out1.o
~/temp $ gcc -c -g foo2.c -o out2.o
~/temp $ abidiff out1.o out2.o
Functions changes summary: 0 Removed, 1 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

1 function with some indirect sub-type change:

  [C] 'function void registerCallback(MyCallback*)' at foo2.c:11:1 has some
indirect sub-type changes:
    parameter 1 of type 'MyCallback*' has sub-type changes:
      in pointed to type 'struct MyCallback' at foo2.c:2:1:
        type size changed from 128 to 192 (in bits)
        1 data member insertion:
          'void (variadic parameter type)* MyCallback::event3', at offset 128
(in bits) at foo2.c:5:1

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Libabigail mailing list