Merge lp:~michihenning/unity-api/rename-config into lp:unity-api
- rename-config
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Michi Henning | ||||
Approved revision: | 50 | ||||
Merged at revision: | 56 | ||||
Proposed branch: | lp:~michihenning/unity-api/rename-config | ||||
Merge into: | lp:unity-api | ||||
Diff against target: |
275 lines (+14/-115) 14 files modified
include/unity/Exception.h (+1/-1) include/unity/SymbolExport.h (+2/-2) include/unity/api/Version.h.cmake (+0/-101) include/unity/api/Version.h.in (+1/-1) include/unity/shell/notifications/Enums.h (+1/-1) include/unity/shell/notifications/ModelInterface.h (+1/-1) include/unity/shell/notifications/NotificationInterface.h (+1/-1) include/unity/shell/notifications/SourceInterface.h (+1/-1) include/unity/util/FileIO.h (+1/-1) include/unity/util/NonCopyable.h (+1/-1) test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockActionModel.h (+1/-1) test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockModel.h (+1/-1) test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockNotification.h (+1/-1) test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockSource.h (+1/-1) |
||||
To merge this branch: | bzr merge lp:~michihenning/unity-api/rename-config | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Jussi Pakkanen (community) | Approve | ||
Review via email: mp+166408@code.launchpad.net |
Commit message
Renamed config.h -> DllExport.h. Removed Version.h.cmake, which is was moldy oldie, now called Version.h.in.
Description of the change
Renamed config.h -> DllExport.h. Removed Version.h.cmake, which is was moldy oldie, now called Version.h.in.
PS Jenkins bot (ps-jenkins) wrote : | # |
Ted Gould (ted) wrote : | # |
Uhm, DLL's as in Dynamically Linked Libraries is a Microsoft Windows feature. Seems like a bad name.
Michi Henning (michihenning) wrote : | # |
Hmmm... I was under the impression that "dynamically linked library" was a generic term, rather than a Windows-specific one (although I may be mistaken here).
If you feel strongly about it, I can rename it again. ShlibExport.h acceptable? If not, please suggest a name.
Ted Gould (ted) wrote : | # |
On Thu, 2013-05-30 at 04:03 +0000, Michi Henning wrote:
> Hmmm... I was under the impression that "dynamically linked library"
> was a generic term, rather than a Windows-specific one (although I may
> be mistaken here).
The Wikipedia entry starts with:
Dynamic-link library (also written unhyphenated), or DLL, is Microsoft's
implementation of the shared library concept in the Microsoft Windows
and OS�2 operating systems.
http:��
> If you feel strongly about it, I can rename it again. ShlibExport.h
> acceptable? If not, please suggest a name.
I'm not sure what the file actually does, so I don't have a good idea
for a name. But considering every header file in �usr�include
represents something exported by a shared library, I don't think that's
a very useful name. Honestly, even looking at the file, I have no clue
what it does or why an application author needs that. Seems like an
internal file to me. I don't know why an application would want to
change the visibility of symbols by setting a define.
Also, as an aside, it seems that file's header says it's GNU GPL. Is
that on purpose or should it be GNU LGPL?
Michi Henning (michihenning) wrote : | # |
Not sure whether Wikipedia is the best authority here. I can find quite a few web pages that talk about "dynamically linked shared libraries" in a Linux context.
Anyway, I can call it ShlibExport.h instead.
The whole thing is there to limit public symbols for the .so to only those are part of the public API. The entire thing is inspired by this article: http://
The library is compiled with -fvisibility=hidden so, by default, no symbols are exported. To turn on exporting for the parts of the API that are public, I do:
#include <unity/
class UNITY_API MyClass { ... };
This makes MyClass visible in the .so as a public symbol.
When compiling the library, we compile with -DUNITY_
__attribute_
This overrides the -fvisibility=hidden command-line argument.
When the code is compiled without -DUNITY_
Removing the file altogether would be possible, but only at the cost of explicitly redefining the same thing over and over again in each public API header, which is worse, IMO.
The file is installed in /usr/include/unity. We can't not install it because then the public header files would no longer compile.
We could avoid installing it if we were to include it like this in our headers everywhere:
#ifndef UNITY_DLL_EXPORTS
#include <unity/
#endif
But that's a pain too...
Michi Henning (michihenning) wrote : | # |
> Also, as an aside, it seems that file's header says it's GNU GPL. Is
> that on purpose or should it be GNU LGPL?
I have no idea what it is supposed to be. I picked up the copyright notice some time last year from somewhere on the company Wiki.
Personally, I'm having a problem with including such a copyright message in every source and header file because, if it ever needs to change, fixing it is a massive pain. It would be nicer to have something that includes the license by reference.
At any rate, if you know someone who can tell me definitely what text we should put into every source file, I'll happily put it there. But I'd rather go through the exercise only once.
Jussi Pakkanen (jpakkane) wrote : | # |
AFAIK "dll" is a windowsism and the corresponding unix term is "shared library".
Semantic fine tuning aside, since this header is about symbol visibility in Unity, how about calling it "unity-
Michi Henning (michihenning) wrote : | # |
I would suggest SymbolExport.h. Can everyone live with that? No need for unity prefix--the header is in a unity directory already.
Jussi Pakkanen (jpakkane) wrote : | # |
No file of that name exists in any Ubuntu package, so fine by me.
- 50. By Michi Henning
-
Renamed DllExport.h to SymbolExport.h
Ted Gould (ted) wrote : | # |
On Thu, 2013-05-30 at 04:37 +0000, Michi Henning wrote:
> This overrides the -fvisibility=hidden command-line argument.
What we're doing in the HUD header files there is this pragma statment:
#pragma GCC visibility push(default)
At the start and then at the end:
#pragma GCC visibility pop
Which makes it so that everything in between those two lines is visible.
And it is independent of the compiler parameters. Makes it so that you
don't have to do anything on a per-object basis.
Ted Gould (ted) wrote : | # |
On Thu, 2013-05-30 at 04:39 +0000, Michi Henning wrote:
> Personally, I'm having a problem with including such a copyright
> message in every source and header file because, if it ever needs to
> change, fixing it is a massive pain. It would be nicer to have
> something that includes the license by reference.
Short story, would be nice, but probably not going to happen. Gotten in
that discussion more than once. :-)
> At any rate, if you know someone who can tell me definitely what text
> we should put into every source file, I'll happily put it there. But
> I'd rather go through the exercise only once.
I can't tell you definitely. By default the Canonical policy is that
all code is GPLv3. Generally, there is an exception granted for
libraries that are expected to be used by external programs that they
can be LGPLv2�LGPLv3. But, that exception needs to be granted. If a
library is GPL it means that any program linking to that library needs
to be GPL as well.
Michi Henning (michihenning) wrote : | # |
> What we're doing in the HUD header files there is this pragma statment:
Thanks for that! I'll have a look at this. That might be a better option than the header file.
I'll have a tinker with this tomorrow.
Michi Henning (michihenning) wrote : | # |
> I can't tell you definitely. By default the Canonical policy is that
> all code is GPLv3.
Well, I guess it's OK for now, seeing that the current copyright is GPLv3.
If someone wants to change it LGPLv3 later, they can let us know, and we can change all the copyright message. I'm glad McMahon wrote sed a long time ago...
Jussi Pakkanen (jpakkane) wrote : | # |
Both approaches work and give the same results so this is an issue of taste. The first approach is more explicit while the #pragma one is simpler if you want to expose a bunch of stuff all at once (though it is basically a global variable with all the downsides that come with it).
For what it's worth, GCC wiki recommends the former approach:
Michi Henning (michihenning) wrote : | # |
> Both approaches work and give the same results so this is an issue of taste.
> The first approach is more explicit while the #pragma one is simpler if you
> want to expose a bunch of stuff all at once (though it is basically a global
> variable with all the downsides that come with it).
>
> For what it's worth, GCC wiki recommends the former approach:
>
> http://
Hmmm... I'm sitting on the fence right now with this one. With the strict separation into public header files and private header files (in an internal subdirectory), we could blindly go and just add the #pragma push/pop to every header file that's public, which is attractive.
I agree with you, either approach achieves the same thing. But I've never been fond of the extra clutter that is added by the macro:
class UNITY_API MyClass
is not as easy to read as
class MyClass
Of course, the counter-argument is that, by having the macro, we make it explicit at each particular definition that this thing is meant for public consumption, instead of having a global push/pop pragma that brackets everything in between. With the pragmas, if I add something in the middle of a header that isn't meant for public consumption, I end up exporting it when it wasn't meant to be exported.
Overall, I'm leaning slightly towards the header approach with the explicit macro, by a slim margin. Talk about splitting hairs...
Now, getting down to reality, I don't think that either approach would significantly compromise the quality of our software...
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:50
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ted Gould (ted) wrote : | # |
On Thu, 2013-05-30 at 13:45 +0000, Michi Henning wrote:
> Of course, the counter-argument is that, by having the macro, we make
> it explicit at each particular definition that this thing is meant for
> public consumption, instead of having a global push�pop pragma that
> brackets everything in between. With the pragmas, if I add something
> in the middle of a header that isn't meant for public consumption, I
> end up exporting it when it wasn't meant to be exported.
My thought is that if you put something in a header file
in �usr�include, and you don't expect people to use it, you're a
jerk :-) Don't do that!
Which is why I prefer to say "this file is public" and "this file is
not" instead of doing it on a class by class basis.
Michi Henning (michihenning) wrote : | # |
Let's run with the current scheme. It does what we need.
Preview Diff
1 | === modified file 'include/unity/Exception.h' |
2 | --- include/unity/Exception.h 2013-05-13 11:39:49 +0000 |
3 | +++ include/unity/Exception.h 2013-05-30 12:25:31 +0000 |
4 | @@ -19,7 +19,7 @@ |
5 | #ifndef UNITY_EXCEPTION_H |
6 | #define UNITY_EXCEPTION_H |
7 | |
8 | -#include <unity/config.h> |
9 | +#include <unity/SymbolExport.h> |
10 | |
11 | #include <exception> |
12 | #include <string> |
13 | |
14 | === renamed file 'include/unity/config.h' => 'include/unity/SymbolExport.h' |
15 | --- include/unity/config.h 2013-05-13 11:39:49 +0000 |
16 | +++ include/unity/SymbolExport.h 2013-05-30 12:25:31 +0000 |
17 | @@ -16,8 +16,8 @@ |
18 | * Authored by: Michi Henning <michi.henning@canonical.com> |
19 | */ |
20 | |
21 | -#ifndef UNITY_CONFIG_H |
22 | -#define UNITY_CONFIG_H |
23 | +#ifndef SYMBOL_EXPORT_H |
24 | +#define SYMBOL_EXPORT_H |
25 | |
26 | #define UNITY_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) |
27 | |
28 | |
29 | === removed file 'include/unity/api/Version.h.cmake' |
30 | --- include/unity/api/Version.h.cmake 2013-04-03 02:01:36 +0000 |
31 | +++ include/unity/api/Version.h.cmake 1970-01-01 00:00:00 +0000 |
32 | @@ -1,101 +0,0 @@ |
33 | -// |
34 | -// DO NOT EDIT Version.h (this file)! It is generated from Version.h.cmake. |
35 | -// |
36 | - |
37 | -/* |
38 | - * Copyright (C) 2013 Canonical Ltd |
39 | - * |
40 | - * This program is free software: you can redistribute it and/or modify |
41 | - * it under the terms of the GNU General Public License version 3 as |
42 | - * published by the Free Software Foundation. |
43 | - * |
44 | - * This program is distributed in the hope that it will be useful, |
45 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
46 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
47 | - * GNU General Public License for more details. |
48 | - * |
49 | - * You should have received a copy of the GNU General Public License |
50 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
51 | - * |
52 | - * Authored by: Michi Henning <michi.henning@canonical.com> |
53 | - */ |
54 | - |
55 | -#ifndef UNITY_API_VERSION_H |
56 | -#define UNITY_API_VERSION_H |
57 | - |
58 | -#define UNITY_API_VERSION_MAJOR @UNITY_API_MAJOR@ |
59 | -#define UNITY_API_VERSION_MINOR @UNITY_API_MINOR@ |
60 | -#define UNITY_API_VERSION_MICRO @UNITY_API_MICRO@ |
61 | - |
62 | -#define UNITY_API_VERSION_STRING "@UNITY_API_VERSION@" |
63 | - |
64 | -namespace unity |
65 | -{ |
66 | - |
67 | -namespace api |
68 | -{ |
69 | - |
70 | -/** |
71 | -\brief Class to obtain version information for the Unity API at run time. |
72 | - |
73 | -Version information is represented as |
74 | -<i><<code>major</code>></i>.<i><<code>minor</code>></i>.<i><<code>micro</code>></i>. |
75 | - |
76 | -Releases that differ in the major or minor version number are binary incompatible. |
77 | - |
78 | -Releases of the library that differ only in the micro version number are binary compatible with older releases, |
79 | -so client code does not need to be recompiled to use the newer library version. |
80 | - |
81 | -A different minor version is compatible at the API level, that is, it may add new APIs, but does not change existing |
82 | -ones. API clients must be recompiled for a new major version. |
83 | - |
84 | -A different major version indicates incompatible API changes. |
85 | -*/ |
86 | - |
87 | -// Version could be a namespace instead of a class, but that requires a lower-case name, |
88 | -// which is inconsistent with the remainder of the API. |
89 | - |
90 | -class Version |
91 | -{ |
92 | -public: |
93 | - /** |
94 | - \brief Returns the major version number of the Unity API library. |
95 | - |
96 | - The major version number is also available as the macro <code>UNITY_API_VERSION_MAJOR</code>. |
97 | - */ |
98 | - static int major_version(); |
99 | - |
100 | - /** |
101 | - \brief Returns the minor version number of the Unity API library. |
102 | - |
103 | - The minor version number is also available as the macro <code>UNITY_API_VERSION_MINOR</code>. |
104 | - */ |
105 | - static int minor_version(); |
106 | - |
107 | - /** |
108 | - \brief Returns the micro version number of the Unity API library. |
109 | - |
110 | - The micro version number is also available as the macro <code>UNITY_API_VERSION_MICRO</code>. |
111 | - */ |
112 | - static int micro_version(); |
113 | - |
114 | - /** |
115 | - \brief Returns the Unity API version as a string in the format |
116 | - <i><<code>major</code>></i>.<i><<code>minor</code>></i>.<i><<code>micro</code>></i>. |
117 | - |
118 | - The version string is also available as the macro <code>UNITY_API_VERSION_STRING</code>. |
119 | - */ |
120 | - static const char* str(); // Returns "major.minor.micro" |
121 | - |
122 | - // TODO: Add methods to report compiler version and compiler flags |
123 | - |
124 | -private: |
125 | - Version() = delete; |
126 | - ~Version() = delete; |
127 | -}; |
128 | - |
129 | -} // namespace api |
130 | - |
131 | -} // namespace unity |
132 | - |
133 | -#endif |
134 | |
135 | === modified file 'include/unity/api/Version.h.in' |
136 | --- include/unity/api/Version.h.in 2013-05-16 11:48:42 +0000 |
137 | +++ include/unity/api/Version.h.in 2013-05-30 12:25:31 +0000 |
138 | @@ -20,7 +20,7 @@ |
139 | * Authored by: Michi Henning <michi.henning@canonical.com> |
140 | */ |
141 | |
142 | -#include <unity/config.h> |
143 | +#include <unity/SymbolExport.h> |
144 | |
145 | #ifndef UNITY_API_VERSION_H |
146 | #define UNITY_API_VERSION_H |
147 | |
148 | === modified file 'include/unity/shell/notifications/Enums.h' |
149 | --- include/unity/shell/notifications/Enums.h 2013-05-16 07:43:20 +0000 |
150 | +++ include/unity/shell/notifications/Enums.h 2013-05-30 12:25:31 +0000 |
151 | @@ -21,7 +21,7 @@ |
152 | #ifndef UNITY_SHELL_NOTIFICATIONS_ENUMS_H |
153 | #define UNITY_SHELL_NOTIFICATIONS_ENUMS_H |
154 | |
155 | -#include <unity/config.h> |
156 | +#include <unity/SymbolExport.h> |
157 | |
158 | #include <QtCore/QObject> |
159 | |
160 | |
161 | === modified file 'include/unity/shell/notifications/ModelInterface.h' |
162 | --- include/unity/shell/notifications/ModelInterface.h 2013-05-16 10:24:52 +0000 |
163 | +++ include/unity/shell/notifications/ModelInterface.h 2013-05-30 12:25:31 +0000 |
164 | @@ -21,7 +21,7 @@ |
165 | #ifndef UNITY_SHELL_NOTIFICATIONS_MODELINTERFACE_H |
166 | #define UNITY_SHELL_NOTIFICATIONS_MODELINTERFACE_H |
167 | |
168 | -#include <unity/config.h> |
169 | +#include <unity/SymbolExport.h> |
170 | |
171 | #include <QtCore/QAbstractListModel> |
172 | |
173 | |
174 | === modified file 'include/unity/shell/notifications/NotificationInterface.h' |
175 | --- include/unity/shell/notifications/NotificationInterface.h 2013-05-16 07:51:36 +0000 |
176 | +++ include/unity/shell/notifications/NotificationInterface.h 2013-05-30 12:25:31 +0000 |
177 | @@ -21,7 +21,7 @@ |
178 | #ifndef UNITY_SHELL_NOTIFICATIONS_NOTIFICATIONINTERFACE_H |
179 | #define UNITY_SHELL_NOTIFICATIONS_NOTIFICATIONINTERFACE_H |
180 | |
181 | -#include <unity/config.h> |
182 | +#include <unity/SymbolExport.h> |
183 | |
184 | #include <QtCore/QObject> |
185 | |
186 | |
187 | === modified file 'include/unity/shell/notifications/SourceInterface.h' |
188 | --- include/unity/shell/notifications/SourceInterface.h 2013-05-16 10:24:52 +0000 |
189 | +++ include/unity/shell/notifications/SourceInterface.h 2013-05-30 12:25:31 +0000 |
190 | @@ -21,7 +21,7 @@ |
191 | #ifndef UNITY_SHELL_NOTIFICATIONS_SOURCEINTERFACE_H |
192 | #define UNITY_SHELL_NOTIFICATIONS_SOURCEINTERFACE_H |
193 | |
194 | -#include <unity/config.h> |
195 | +#include <unity/SymbolExport.h> |
196 | |
197 | #include <QtCore/QObject> |
198 | |
199 | |
200 | === modified file 'include/unity/util/FileIO.h' |
201 | --- include/unity/util/FileIO.h 2013-05-13 11:39:49 +0000 |
202 | +++ include/unity/util/FileIO.h 2013-05-30 12:25:31 +0000 |
203 | @@ -19,7 +19,7 @@ |
204 | #ifndef UNITY_UTIL_FILEIO_H |
205 | #define UNITY_UTIL_FILEIO_H |
206 | |
207 | -#include <unity/config.h> |
208 | +#include <unity/SymbolExport.h> |
209 | |
210 | #include <string> |
211 | #include <vector> |
212 | |
213 | === modified file 'include/unity/util/NonCopyable.h' |
214 | --- include/unity/util/NonCopyable.h 2013-05-13 11:39:49 +0000 |
215 | +++ include/unity/util/NonCopyable.h 2013-05-30 12:25:31 +0000 |
216 | @@ -31,7 +31,7 @@ |
217 | #ifndef UNITY_UTIL_NONCOPYABLE_H |
218 | #define UNITY_UTIL_NONCOPYABLE_H |
219 | |
220 | -#include <unity/config.h> |
221 | +#include <unity/SymbolExport.h> |
222 | |
223 | namespace unity |
224 | { |
225 | |
226 | === modified file 'test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockActionModel.h' |
227 | --- test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockActionModel.h 2013-05-14 08:12:15 +0000 |
228 | +++ test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockActionModel.h 2013-05-30 12:25:31 +0000 |
229 | @@ -21,7 +21,7 @@ |
230 | #ifndef MOCKACTIONMODEL_H |
231 | #define MOCKACTIONMODEL_H |
232 | |
233 | -#include <unity/config.h> |
234 | +#include <unity/SymbolExport.h> |
235 | |
236 | #include <QtCore/QAbstractListModel> |
237 | |
238 | |
239 | === modified file 'test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockModel.h' |
240 | --- test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockModel.h 2013-05-14 08:12:15 +0000 |
241 | +++ test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockModel.h 2013-05-30 12:25:31 +0000 |
242 | @@ -21,7 +21,7 @@ |
243 | #ifndef MOCKMODEL_H |
244 | #define MOCKMODEL_H |
245 | |
246 | -#include <unity/config.h> |
247 | +#include <unity/SymbolExport.h> |
248 | |
249 | #include <unity/shell/notifications/ModelInterface.h> |
250 | |
251 | |
252 | === modified file 'test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockNotification.h' |
253 | --- test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockNotification.h 2013-05-15 13:42:26 +0000 |
254 | +++ test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockNotification.h 2013-05-30 12:25:31 +0000 |
255 | @@ -21,7 +21,7 @@ |
256 | #ifndef MOCKNOTIFICATION_H |
257 | #define MOCKNOTIFICATION_H |
258 | |
259 | -#include <unity/config.h> |
260 | +#include <unity/SymbolExport.h> |
261 | |
262 | #include <unity/shell/notifications/NotificationInterface.h> |
263 | |
264 | |
265 | === modified file 'test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockSource.h' |
266 | --- test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockSource.h 2013-05-14 08:12:15 +0000 |
267 | +++ test/qmltest/mocks/plugins/Unity/Notifications/Mocks/MockSource.h 2013-05-30 12:25:31 +0000 |
268 | @@ -21,7 +21,7 @@ |
269 | #ifndef MOCKSOURCE_H |
270 | #define MOCKSOURCE_H |
271 | |
272 | -#include <unity/config.h> |
273 | +#include <unity/SymbolExport.h> |
274 | |
275 | #include <unity/shell/notifications/SourceInterface.h> |
276 |
PASSED: Continuous integration, rev:49 jenkins. qa.ubuntu. com/job/ unity-api- ci/42/ jenkins. qa.ubuntu. com/job/ unity-api- raring- armhf-ci/ 42 jenkins. qa.ubuntu. com/job/ unity-api- raring- armhf-ci/ 42/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity-api- raring- i386-ci/ 42
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ unity-api- ci/42/rebuild
http://