GNOME Bugzilla – Bug 660038
Add preprocessor macro for version checking
Last modified: 2011-09-27 22:11:51 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.
Created attachment 197415 [details] [review] Add version check preprocessor macros
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.
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
(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!
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.
Pushed to master with the requested modification. Thanks!