summaryrefslogtreecommitdiff
path: root/include/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-09-19 11:06:13 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-09-19 21:01:48 +0200
commited510993d7db9a8ca9a3822d107af063aab5b637 (patch)
tree1742f0505c8d04ab253a0faf165356e8843061fe /include/sal
parent1a72dbb390e9cf6e61b6503f3c575ba531d547d8 (diff)
Make compilers combine sUNO_* vars across TUs
...by changing them from internal linkage to being inline (where available). The net effect is that compilers (that HAVE_CPP_INLINE_VARIABLES) are required to combine all uses of a given sUNO_* var across a Library, where before that was only possible if the compiler could prove that placing multiple such vars across TUs at the same address didn't change the program's behavior. (And > $ diff <(nm --def instdir/program/libsdlo.so | grep sUNO_ | cut -d ' ' -f 3 | LC_ALL=C sort) <(nm --def instdir/program/libsdlo.so | grep sUNO_ | cut -d ' ' -f 3 | LC_ALL=C sort | uniq) > 2d1 > < _ZL16sUNO_View_ViewId > 8d6 > < _ZL18sUNO_View_PageKind > 23d20 > < _ZL22sUNO_View_LockedLayers > 30d26 > < _ZL23sUNO_View_VisibleLayers > 39d34 > < _ZL25sUNO_View_PrintableLayers showed that there were duplicates, while > $ nm --def instdir/program/libsdlo.so | grep sUNO_ | cut -d ' ' -f 3 | LC_ALL=C sort | uniq | wc -l > 71 shows that only 71 of the 117 sUNO_* vars are actually used at all---there's still room for clean up.) Introduces LIBO_INTERNAL_ONLY SAL_INLINE_VARIABLE. Change-Id: Icf92116de9ea4019d298e325d2a83009317f7a4c Reviewed-on: https://gerrit.libreoffice.org/60743 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/sal')
-rw-r--r--include/sal/types.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/sal/types.h b/include/sal/types.h
index 474a223a2ff2..08751c33cd53 100644
--- a/include/sal/types.h
+++ b/include/sal/types.h
@@ -697,6 +697,20 @@ template< typename T1, typename T2 > inline T1 static_int_cast(T2 n) {
#endif
/// @endcond
+/// @cond INTERNAL
+/** Inline variables, where supported.
+
+ @since LibreOffice 6.2
+*/
+#if defined LIBO_INTERNAL_ONLY
+#if HAVE_CPP_INLINE_VARIABLES
+#define SAL_INLINE_VARIABLE inline
+#else
+#define SAL_INLINE_VARIABLE
+#endif
+#endif
+/// @endcond
+
#endif // INCLUDED_SAL_TYPES_H
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */