After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 728031 - Use visibility attributes/__declspec (dllexport) to export public symbols
Use visibility attributes/__declspec (dllexport) to export public symbols
Status: RESOLVED FIXED
Product: atk
Classification: Platform
Component: build
unspecified
Other All
: Normal normal
: ---
Assigned To: ATK maintainer(s)
ATK maintainer(s)
: 720203 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-04-11 11:46 UTC by Fan, Chun-wei
Modified: 2014-04-25 00:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add atk/atkmacros.h (2.76 KB, patch)
2014-04-11 11:52 UTC, Fan, Chun-wei
none Details | Review
Update the Public Headers to include atk/atkmacros.h and Annotate the public symbols (57.17 KB, patch)
2014-04-11 12:07 UTC, Fan, Chun-wei
none Details | Review
Update the ATK c-sources to all include config.h (8.53 KB, patch)
2014-04-11 12:09 UTC, Fan, Chun-wei
committed Details | Review
Update the generation of the enumeration sources (2.50 KB, patch)
2014-04-11 12:18 UTC, Fan, Chun-wei
accepted-commit_now Details | Review
Add atk/atkmacros.h (take ii) (2.76 KB, patch)
2014-04-14 05:04 UTC, Fan, Chun-wei
needs-work Details | Review
Annotate the public headers to decorate the public symbols for export (54.90 KB, patch)
2014-04-14 05:07 UTC, Fan, Chun-wei
none Details | Review
Annotate the public headers to decorate the public symbols for export (take ii) (55.56 KB, patch)
2014-04-14 06:16 UTC, Fan, Chun-wei
needs-work Details | Review
Update the autotools files for using visibility to export the public symbols (12.03 KB, patch)
2014-04-14 06:18 UTC, Fan, Chun-wei
committed Details | Review
Add Version/Deprecation Macros in atk/atkversion.h.in (10.74 KB, patch)
2014-04-24 11:31 UTC, Fan, Chun-wei
committed Details | Review
atk/Makefile.am: Update Generation of Enumeration Sources (take ii) (2.50 KB, patch)
2014-04-24 11:33 UTC, Fan, Chun-wei
committed Details | Review
Annotate the public headers to decorate the public symbols for export (take iii) (54.79 KB, patch)
2014-04-24 11:39 UTC, Fan, Chun-wei
committed Details | Review

Description Fan, Chun-wei 2014-04-11 11:46:13 UTC
Hi,

Following a conversation in e-mail with Piñeiro, it seems that it would be a good idea to make ATK like GLib and GTK+, to export the APIs using a visibility-based approach (for GCC builds) or a __declspec (dllexport) based approach.  This is my attempt to do this part.
Comment 1 Fan, Chun-wei 2014-04-11 11:52:53 UTC
Created attachment 274078 [details] [review]
Add atk/atkmacros.h

Hi,

This adds a public header to be included by all the other public headers of ATK so that it can be used to annotate all the public functions in the headers that can be defined in config.h to export the public symbols with compiler-specific directives.
Comment 2 Fan, Chun-wei 2014-04-11 12:07:38 UTC
Created attachment 274082 [details] [review]
Update the Public Headers to include atk/atkmacros.h and Annotate the public symbols

Hi,

This updates the public headers to include atk/atkmacros.h, and annotates the public symbols accordingly with ATK_AVAILABLE_IN_ALL.  The G_DEPRECATED* items are also updated to ATK_DEPRECATED*, as in atk/atkmacros.h, so that the _ATK_EXTERN  can be used on all the symbols, where it can be defined during build-time to compiler directives to export the symbols.

p.s. for atk/atkmacros.h, I did not use things like ATK_AVAILABLE_IN* as I am not sure how this should be defined there.
Comment 3 Fan, Chun-wei 2014-04-11 12:09:02 UTC
Created attachment 274083 [details] [review]
Update the ATK c-sources to all include config.h

Hi,

This updates all the ATK c-sources to include config.h before anything else.  This makes sure that we use the build-time definition of _ATK_EXTERN.
Comment 4 Fan, Chun-wei 2014-04-11 12:18:01 UTC
Created attachment 274085 [details] [review]
Update the generation of the enumeration sources

Hi,

This updates the generation of the enumeration sources so that atk/atkmacros.h is included, the symbols are decorated with ATK_AVAILABLE_IN_ALL, and that config.h is included in the generated enumeration c-source.

I will go back to the configure.ac regarding the compiler directive to be used for _ATK_EXTERN later, and will update config.h.win32.in after this is deemed ok.

With blessings, thank you!
Comment 5 Alejandro Piñeiro Iglesias (IRC: infapi00) 2014-04-11 16:53:57 UTC
(In reply to comment #0)
> Hi,

Hi, thanks for the patches. Today I will not have time to review them, will try next week, but I have one question.

> Following a conversation in e-mail with Piñeiro, it seems that it would be a
> good idea to make ATK like GLib and GTK+, to export the APIs using a
> visibility-based approach (for GCC builds) or a __declspec (dllexport) based
> approach.  This is my attempt to do this part.

Due that conversation I created bug 720203. So just to confirm, is that bug and this one the same? If that so, feel free to close 720203 as duplicate (as current one is the one with the patches).
Comment 6 Fan, Chun-wei 2014-04-12 00:32:00 UTC
*** Bug 720203 has been marked as a duplicate of this bug. ***
Comment 7 Fan, Chun-wei 2014-04-14 05:04:03 UTC
Created attachment 274225 [details] [review]
Add atk/atkmacros.h (take ii)

Hi,

This updates the original version of the patch so that the inclusion guard macros are more consistent with the other header files.
Comment 8 Fan, Chun-wei 2014-04-14 05:07:40 UTC
Created attachment 274226 [details] [review]
Annotate the public headers to decorate the public symbols for export

Hi,

As the original patch (#274082) tried to include atk/atkmacros.h in all the public headers, simplify a bit by  having atk/atkmacros.h included before any other headers in atk/atkobject.h, which will be included by most of the public headers, and include atk/atkmacros.h only when atk/atkobject.h is not included in the headers.
Comment 9 Fan, Chun-wei 2014-04-14 06:16:48 UTC
Created attachment 274227 [details] [review]
Annotate the public headers to decorate the public symbols for export (take ii)

Hi,

Sorry, I forgot that I needed to update the definitions for ATK_VAR so that public variables/constants can be exported as well.
Comment 10 Fan, Chun-wei 2014-04-14 06:18:22 UTC
Created attachment 274228 [details] [review]
Update the autotools files for using visibility to export the public symbols

Hi,

The last patch for this set is to update the autotools files to export the public symbols using visibility attributes during the build.

With blessings, thank you!
Comment 11 Alejandro Piñeiro Iglesias (IRC: infapi00) 2014-04-23 15:05:34 UTC
Review of attachment 274083 [details] [review]:

Looks ok to me.
Comment 12 Alejandro Piñeiro Iglesias (IRC: infapi00) 2014-04-23 15:06:08 UTC
Review of attachment 274085 [details] [review]:

Looks good to me.
Comment 13 Alejandro Piñeiro Iglesias (IRC: infapi00) 2014-04-23 15:11:47 UTC
Review of attachment 274225 [details] [review]:

Looks good, just a minor issue. But feel free to commit it by fixing it.

::: atk/atkmacros.h
@@ +1,2 @@
+/* ATK -  Accessibility Toolkit
+ * Copyright 2001 Sun Microsystems Inc.

We are not on 2001 anymore ;) And AFAIK Sun Microsystems is not around anymore.

So please update the date and the copyright assignment (to your employer if this was related to working with it, or directly to you if was made on personal time)
Comment 14 Alejandro Piñeiro Iglesias (IRC: infapi00) 2014-04-23 15:23:35 UTC
Review of attachment 274225 [details] [review]:

Second review. Sorry I realized something when I started to review the following patch.

::: atk/atkmacros.h
@@ +43,3 @@
+#endif
+
+#define ATK_AVAILABLE_IN_ALL _ATK_EXTERN

So only an ATK_AVAILABLE_IN_ALL is defined, so that means that currently all the public methods will be marked as available since the beginning of time. And Im not really comfortable with exposing that. I made some effort to improve the documentation in order to list the added methods for each major release. See following link at the end:
https://developer.gnome.org/atk/2.12/

Would it be possible to add some ATK_VERSION_AVAILABLE_IN_X_Y macros (like those available for gtk and clutter)?

Anyway, it is true that doing it for all the symbols would be a big job. So what about refining for the symbols added after the 2.0 release? After all 2.0 is API compatible with 1.0. We can consider that any method coming from 1.0 is available for any 2.X releases. That would mean that you would only need mark the following methods:
https://developer.gnome.org/atk/2.12/api-index-2-2.html
https://developer.gnome.org/atk/2.12/api-index-2-8.html
https://developer.gnome.org/atk/2.12/api-index-2-10.html
https://developer.gnome.org/atk/2.12/api-index-2-12.html

Being 2.12 the one that added more methods.
Comment 15 Alejandro Piñeiro Iglesias (IRC: infapi00) 2014-04-23 15:25:25 UTC
Review of attachment 274227 [details] [review]:

Looks good in general. The only problem is that every public method is marked as ATK_AVAILABLE_IN_ALL, when some of those public methods were published on recent releases (ie 2.12). See the review of "Add atk/atkmacros.h (take ii)" patch for more info about it.
Comment 16 Alejandro Piñeiro Iglesias (IRC: infapi00) 2014-04-23 15:27:05 UTC
Review of attachment 274228 [details] [review]:

Looks good to me. And having the atk.symbols removed  is a good step forward, as it was a source of several mistakes.
Comment 17 Fan, Chun-wei 2014-04-24 11:31:37 UTC
Created attachment 275046 [details] [review]
Add Version/Deprecation Macros in atk/atkversion.h.in

Hi,

Coming to think of it, as it is desirable to add ATK_AVAILABLE_IN_X_Y and so on for the new symbol exporting mechanism, probably it is better to add these in atk/atkversion.h.in, and make sure later that it is included in some way by the header files, as we also needed to check against the version of ATK that is being built/linked to.

So, this is my take on this...
Comment 18 Fan, Chun-wei 2014-04-24 11:33:22 UTC
Created attachment 275047 [details] [review]
atk/Makefile.am: Update Generation of Enumeration Sources (take ii)

Hi,

This updates on the previous patch for the same purpose, as we need to include atk/atkversion.h instead of atk/atkmacros.h.
Comment 19 Fan, Chun-wei 2014-04-24 11:39:45 UTC
Created attachment 275048 [details] [review]
Annotate the public headers to decorate the public symbols for export (take iii)

Hi,

According to Piñeiro's suggestions, this annotates the public APIs according to the 2.x stable release series (the ones introduced/deprecaed at or before atk-2.0.0 is still marked as ATK_AVAILABLE_IN_ALL/ATK_DEPRECATED (or ATK_DEPRECATED_FOR).  The _get_type() APIs in the public headers, if the header was introduced after 2.0.0, is also marked with the macro for the stable 2.x release series, for consistency reasons.

Oh, I forgot to mention, in my patch for atk/atkversion.h.in, I added macros for 2.4 and 2.6, even when there were no new APIs, to maintain consistency (as this is done for GLib/GTK+/Clutter).  Please let me know if these are preferred to be not included.

So, these are my take for now.

With blessings, thank you!
Comment 20 Alejandro Piñeiro Iglesias (IRC: infapi00) 2014-04-24 14:00:52 UTC
Review of attachment 275046 [details] [review]:

Looks good to me.
Comment 21 Alejandro Piñeiro Iglesias (IRC: infapi00) 2014-04-24 14:01:40 UTC
Review of attachment 275047 [details] [review]:

Looks good to me.
Comment 22 Alejandro Piñeiro Iglesias (IRC: infapi00) 2014-04-24 14:02:30 UTC
Review of attachment 275048 [details] [review]:

Looks good to me. Thanks for all those patches!
Comment 23 Fan, Chun-wei 2014-04-25 00:37:38 UTC
Review of attachment 275046 [details] [review]:

Hi,

This patch was committed as 122236e1, ...
Comment 24 Fan, Chun-wei 2014-04-25 00:38:31 UTC
Review of attachment 275048 [details] [review]:

... this patch was committed as ca5ea1bd, ...
Comment 25 Fan, Chun-wei 2014-04-25 00:39:21 UTC
Review of attachment 274083 [details] [review]:

... this patch as d6ecbbbe, ...
Comment 26 Fan, Chun-wei 2014-04-25 00:39:54 UTC
Review of attachment 275047 [details] [review]:

... this patch as 9a1ae853, ...
Comment 27 Fan, Chun-wei 2014-04-25 00:41:16 UTC
Review of attachment 274228 [details] [review]:

... and last but not least, this patch was commited as 41442d82.

Thanks for the reviews, I will close this bug shortly.

With blessings, thank you!