Kaydet (Commit) ed510993 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 1a72dbb3
......@@ -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: */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment