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 660038 - Add preprocessor macro for version checking
Add preprocessor macro for version checking
Status: RESOLVED FIXED
Product: libgdata
Classification: Platform
Component: General
git master
Other All
: Normal enhancement
: ---
Assigned To: libgdata-maint
libgdata-maint
Depends on:
Blocks:
 
 
Reported: 2011-09-25 01:30 UTC by Holger Berndt
Modified: 2011-09-27 22:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add version check preprocessor macros (5.27 KB, patch)
2011-09-25 01:30 UTC, Holger Berndt
needs-work Details | Review
Add version check preprocessor macros (5.34 KB, patch)
2011-09-26 22:29 UTC, Holger Berndt
accepted-commit_now Details | Review

Description Holger Berndt 2011-09-25 01:30:06 UTC
Having a preprocessor macro for version checking would make it easier for applications to support multiple versions of libgdata when the library changed its interface, or to optionally support new interfaces.

Attached patch implements a preprocessor version check analogous to what gtk+ has.
Comment 1 Holger Berndt 2011-09-25 01:30:09 UTC
Created attachment 197415 [details] [review]
Add version check preprocessor macros
Comment 2 Philip Withnall 2011-09-26 16:25:37 UTC
Review of attachment 197415 [details] [review]:

::: gdata/gdata-version.h.in
@@ +2,3 @@
+/*
+ * GData Client
+ * Copyright (C) Philip Withnall 2008-2009 <philip@tecnocode.co.uk>

Your name should go here!

@@ +23,3 @@
+ * @Title: Version Information
+ *
+ * libgdata provides compile-time version information.

This doc comment needs a “Since: 0.11.0” line.

@@ +33,3 @@
+ *
+ * Returns the major version of the GData headers at compile time
+ * (e.g. in libgdata version 1.2.3 this is 1).

“Since: 0.11.0” needed here too.

@@ +41,3 @@
+ *
+ * Returns the minor version of the GData headers at compile time.
+ * (e.g. in libgdata version 1.2.3 this is 2).

…and here.

@@ +49,3 @@
+ *
+ * Returns the micro version of the GData headers at compile time.
+ * (e.g. in libgdata version 1.2.3 this is 3).

…and here.

@@ +59,3 @@
+ * @micro: micro version (e.g. 3 for version 1.2.3)
+ *
+ * Returns %TRUE if the version of the GData header files

Probably best to say “Evaluates to %TRUE” rather than “Returns %TRUE”, since this is a macro.

@@ +60,3 @@
+ *
+ * Returns %TRUE if the version of the GData header files
+ * is the same as or newer than the passed-in version.

…and here.
Comment 3 Holger Berndt 2011-09-26 22:29:32 UTC
Created attachment 197527 [details] [review]
Add version check preprocessor macros

Thanks for the fast review! I made modifications according to your comments,
except the following:

-----------------------------------------------------------------------
@@ +23,3 @@
+ * @Title: Version Information
+ *
+ * libgdata provides compile-time version information.

This doc comment needs a “Since: 0.11.0” line.
-----------------------------------------------------------------------

... because gtk-doc didn't seem to pick that up. I guess having the "since"
line on individual macros is good already.

In addition to that, I changed

+ * @Short_description: Variables and functions to check the libgdata version

to the more suitable

+ * @Short_description: Macros to check the libgdata version
Comment 4 Philip Withnall 2011-09-26 22:45:33 UTC
(In reply to comment #3)
> Created an attachment (id=197527) [details] [review]
> Add version check preprocessor macros
> 
> Thanks for the fast review! I made modifications according to your comments,
> except the following:
> 
> -----------------------------------------------------------------------
> @@ +23,3 @@
> + * @Title: Version Information
> + *
> + * libgdata provides compile-time version information.
> 
> This doc comment needs a “Since: 0.11.0” line.
> -----------------------------------------------------------------------
> 
> ... because gtk-doc didn't seem to pick that up. I guess having the "since"
> line on individual macros is good already.

I try to add the “Since” line to section documentation comments even though gtk-doc doesn't pick it up, since it's sometimes helpful when reading the C file again afterwards.

> In addition to that, I changed
> 
> + * @Short_description: Variables and functions to check the libgdata version
> 
> to the more suitable
> 
> + * @Short_description: Macros to check the libgdata version

Great!
Comment 5 Philip Withnall 2011-09-26 22:46:41 UTC
Review of attachment 197527 [details] [review]:

Please commit to master after adding the “Since” line. Thanks!

::: gdata/gdata-version.h.in
@@ +23,3 @@
+ * @Title: Version Information
+ *
+ * libgdata provides compile-time version information.

So, for the reason given in comment #4, please do add the “Since: 0.11.0” line here.
Comment 6 Holger Berndt 2011-09-27 22:11:51 UTC
Pushed to master with the requested modification.

Thanks!