Forward declarations with --rebuild-sections



Hi all,

I'm having some problems using --rebuild-sections. With a
container-child relationship between two types I need this
forward declaration:


/* File: adg-entity.h */
typedef struct _AdgContainer AdgContainer;


/* File: adg-container.h */
#include <adg/adg-entity.h>
struct _AdgContainer {
...
};


With the above code, gtk-doc added AdgContainer both in
<FILE>adg-entity</FILE> and <FILE>adg-container</FILE> sections,
resulting in tons of these warnings when building the HTML:

Warning: multiple "IDs" for constraint linkend: AdgContainer.

To solve this issue I had to trick gtk-doc using the preprocessor:


#define ADG_FORWARD_DECL(id)    typedef struct _##id id


/* File: adg-entity.h */
ADG_FORWARD_DECL(AdgContainer);


/* File: adg-container.h */
#include <adg/adg-entity.h>
#if 0
/* AdgContainer declared in adg-entity.h */
typedef struct _AdgContainer AdgContainer;
#endif
struct _AdgContainer {
...
};


This gives the expected result, that is AdgContainer defined only in
<FILE>adg-container</FILE> section.

After taking a look at gtkdoc-scan it seems (from the comments) that
forward declarations of enum are treated properly while struct not
(after all, both of them can be opaque).

I'm not able to provide a valid patch: do you want I submit a bug or
something else? I'll keep the above workaround alive to be backward
compatible with gtk-doc so this is no more a big issue for me.

Ciao
-- 
Nicola


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]