Hello,
currently our build system adds -DHAVE_XXX options to the compile command
line for various settings, which does not quite scale, and does not cause
relevant files to rebuild, so the common practice nowadays is to use config.h
file(s).
The attached patches implement this change and add one new test (together
with bringing OUStringBuffer::append(bool) in again). Unless somebody sees a
problem with this, I'll push them soon.
There are more such -D options that could be changed, although with some it'd
be better be careful, e.g. OSL_DEBUG can't go there, because it can be
overriden by command-line, and I'm not sure if adding #include
<config_global.h> to sal/config.h would be really included everywhere where
needed.
--
Lubos Lunak
l.lunak@suse.cz
From d525797786b148c742cad298e91183732dc575ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@suse.cz>
Date: Fri, 7 Dec 2012 17:51:21 +0100
Subject: [PATCH 1/2] use config_xxx.h files instead of -DHAVE_XXX on the
command line
As the latter does not quite scale, and also source files depending
on the setting/feature did not rebuild in case of a change.
There are intentionally more config_xxx.h files (so autoheader
from autotools is not used), so that a setting change does not force
automatically a rebuild of everything. Running configure does not
touch those config_xxx.h files that have not changed.
There's config/README with a howto.
Change-Id: I6d6e82050ff8faf5364ed246848b8401aca3e0e5
---
config/.gitignore | 3 +++
config/README | 24 ++++++++++++++++++++
config/config_global.h.in | 14 ++++++++++++
config/config_telepathy.h.in | 6 +++++
config/config_vclplug.h.in | 15 ++++++++++++
configure.ac | 12 ++++++++++
connectivity/source/drivers/kab/KDEInit.h | 2 ++
cui/source/options/optgdlg.cxx | 2 ++
cui/source/options/optmemory.cxx | 2 ++
desktop/source/app/app.cxx | 2 ++
.../source/plugin/inc/plugin/unx/plugcon.hxx | 2 ++
extensions/source/plugin/unx/npnapi.cxx | 2 ++
extensions/source/plugin/unx/npwrap.cxx | 2 ++
sal/inc/rtl/instance.hxx | 2 ++
sal/inc/rtl/stringutils.hxx | 2 ++
sc/source/ui/docshell/docsh.cxx | 2 ++
sc/source/ui/inc/docsh.hxx | 2 ++
sc/source/ui/view/cellsh3.cxx | 2 ++
shell/inc/shell/kde_headers.h | 2 ++
solenv/gbuild/gbuild.mk | 6 -----
solenv/gbuild/platform/com_GCC_defs.mk | 10 +++-----
solenv/gbuild/platform/com_MSC_class.mk | 1 +
solenv/gbuild/platform/macosx.mk | 6 -----
solenv/gbuild/platform/unxgcc.mk | 6 -----
vcl/unx/kde/FPServiceInfo.hxx | 2 ++
vcl/unx/kde/UnxFilePicker.cxx | 2 ++
vcl/unx/kde/fpicker/kdecommandthread.cxx | 2 ++
vcl/unx/kde/fpicker/kdecommandthread.hxx | 2 ++
vcl/unx/kde/fpicker/kdefilepicker.cxx | 2 ++
vcl/unx/kde/fpicker/kdefilepicker.hxx | 2 ++
vcl/unx/kde/fpicker/kdefpmain.cxx | 2 ++
vcl/unx/kde/fpicker/kdemodalityfilter.hxx | 2 ++
vcl/unx/kde/kdedata.cxx | 2 ++
vcl/unx/kde/salnativewidgets-kde.cxx | 2 ++
34 files changed, 124 insertions(+), 25 deletions(-)
create mode 100644 config/.gitignore
create mode 100644 config/README
create mode 100644 config/config_global.h.in
create mode 100644 config/config_telepathy.h.in
create mode 100644 config/config_vclplug.h.in
diff --git a/config/.gitignore b/config/.gitignore
new file mode 100644
index 0000000..325a7fd
--- /dev/null
+++ b/config/.gitignore
@@ -0,0 +1,3 @@
+config_global.h
+config_vclplug.h
+config_telepathy.h
diff --git a/config/README b/config/README
new file mode 100644
index 0000000..fd58b64
--- /dev/null
+++ b/config/README
@@ -0,0 +1,24 @@
+These are configuration files for various features as detected by configure.
+
+Include only those files you need (in order to reduce rebuilds when a setting changes).
+
+Settings here are only C/C++ #define directives, so they apply only to C/C++ source,
+not to Makefiles.
+
+
+
+Adding a new setting:
+=====================
+
+- do AC_DEFINE(HAVE_FOO) in configure.ac when a setting should be set
+- choose the proper config/config_xxx.h file to use
+ - if it is a global setting (such as availability of a compiler feature),
+ use config/config_global.h
+ - otherwise check if there is a matching config/config_hxx.h file
+ - if none matches, add a new one:
+ - add config/config_xxx.h.in here, with just #ifndef include guard
+ - add AC_CONFIG_HEADERS([config/config_xxx.h]) next to the others
+ in configure.ac
+ - add config_hxx.h to config/.gitignore
+- add #undef HAVE_FOO to the config/config_hxx.h , possibly with a comment
+- add #include <config_xxx.h> before any #ifdef HAVE_XXX in a source file
diff --git a/config/config_global.h.in b/config/config_global.h.in
new file mode 100644
index 0000000..a9eb54f
--- /dev/null
+++ b/config/config_global.h.in
@@ -0,0 +1,14 @@
+/*
+Global configuration file.
+
+Only for settings that apply to every source file and are unlikely to change often,
+such as whether a certain C++11 feature is available.
+
+Do NOT use for settings local to some code or for settings that can change often.
+Any change in this header will cause a rebuild of almost everything.
+
+*/
+
+#undef HAVE_GCC_BUILTIN_ATOMIC
+#undef HAVE_SFINAE_ANONYMOUS_BROKEN
+#undef HAVE_THREADSAFE_STATICS
diff --git a/config/config_telepathy.h.in b/config/config_telepathy.h.in
new file mode 100644
index 0000000..f8752b5
--- /dev/null
+++ b/config/config_telepathy.h.in
@@ -0,0 +1,6 @@
+#ifndef CONFIG_TELEPATHY
+#define CONFIG_TELEPATHY
+
+#undef ENABLE_TELEPATHY
+
+#endif
diff --git a/config/config_vclplug.h.in b/config/config_vclplug.h.in
new file mode 100644
index 0000000..46c6bd1
--- /dev/null
+++ b/config/config_vclplug.h.in
@@ -0,0 +1,15 @@
+/*
+
+Settings about which X11 desktops have support enabled.
+
+*/
+
+#ifndef CONFIG_VCLPLUG_H
+#define CONFIG_VCLPLUG_H
+
+#undef ENABLE_GTK
+#undef ENABLE_KDE
+#undef ENABLE_KDE4
+#undef ENABLE_TDE
+
+#endif
diff --git a/configure.ac b/configure.ac
index c6f119c..690b0a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5546,6 +5546,7 @@ if test "$GCC" = "yes"; then
AC_MSG_RESULT([broken (i.e., no)])
else
HAVE_THREADSAFE_STATICS=TRUE
+ AC_DEFINE(HAVE_THREADSAFE_STATICS)
AC_MSG_RESULT([yes])
fi
else
@@ -5613,6 +5614,7 @@ if test "$GCC" = "yes"; then
]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
else
AC_MSG_RESULT([no])
fi
@@ -5659,6 +5661,7 @@ return !(i != 0 && j != 0);
fi
if test "$HAVE_CXX0X" = "TRUE"; then
AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_CXX0X])
else
AC_MSG_RESULT([no])
fi
@@ -5831,6 +5834,7 @@ void test( ... );
AC_MSG_RESULT([$sfinae_anonymous_broken])
if test "$sfinae_anonymous_broken" = "yes"; then
HAVE_SFINAE_ANONYMOUS_BROKEN="TRUE"
+ AC_DEFINE(HAVE_SFINAE_ANONYMOUS_BROKEN)
fi
AC_LANG_POP([C++])
fi
@@ -9399,6 +9403,7 @@ fi
ENABLE_GTK=""
if test "x$enable_gtk" = "xyes"; then
ENABLE_GTK="TRUE"
+ AC_DEFINE(ENABLE_GTK)
R="gtk $R"
fi
AC_SUBST(ENABLE_GTK)
@@ -9411,6 +9416,7 @@ if test "x$enable_tde" = "xyes"; then
AC_MSG_ERROR([enabling both KDE and TDE is not supported])
fi
ENABLE_TDE="TRUE"
+ AC_DEFINE(ENABLE_TDE)
R="$R tde"
fi
AC_SUBST(ENABLE_TDE)
@@ -9418,6 +9424,7 @@ AC_SUBST(ENABLE_TDE)
ENABLE_KDE=""
if test "x$enable_kde" = "xyes"; then
ENABLE_KDE="TRUE"
+ AC_DEFINE(ENABLE_KDE)
R="$R kde"
fi
AC_SUBST(ENABLE_KDE)
@@ -9425,6 +9432,7 @@ AC_SUBST(ENABLE_KDE)
ENABLE_KDE4=""
if test "x$enable_kde4" = "xyes"; then
ENABLE_KDE4="TRUE"
+ AC_DEFINE(ENABLE_KDE4)
R="$R kde4"
fi
AC_SUBST(ENABLE_KDE4)
@@ -9638,6 +9646,7 @@ TELEPATHY_LIBS=""
AC_MSG_CHECKING([whether to enable Telepathy support])
if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_telepathy" = "yes"; then
ENABLE_TELEPATHY="TRUE"
+ AC_DEFINE(ENABLE_TELEPATHY)
AC_MSG_RESULT([yes])
PKG_CHECK_MODULES( TELEPATHY, telepathy-glib >= 0.18.0 glib-2.0 gobject-2.0 gthread-2.0
gio-2.0 )
else
@@ -12428,6 +12437,9 @@ else
fi
AC_CONFIG_FILES([config_host.mk])
+AC_CONFIG_HEADERS([config/config_global.h])
+AC_CONFIG_HEADERS([config/config_telepathy.h])
+AC_CONFIG_HEADERS([config/config_vclplug.h])
AC_OUTPUT
# touch the config timestamp file
diff --git a/connectivity/source/drivers/kab/KDEInit.h b/connectivity/source/drivers/kab/KDEInit.h
index f974ff5..2f59b73 100644
--- a/connectivity/source/drivers/kab/KDEInit.h
+++ b/connectivity/source/drivers/kab/KDEInit.h
@@ -25,6 +25,8 @@
#define KAB_DRIVER_VERSION_MAJOR 0
#define KAB_DRIVER_VERSION_MINOR 2
+#include <config_vclplug.h>
+
#ifdef ENABLE_TDE
// the minimum TDE version which is required at runtime
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 098b550..8f8e664 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -89,6 +89,8 @@
#include <svtools/apearcfg.hxx>
#include <svtools/optionsdrawinglayer.hxx>
+#include <config_vclplug.h>
+
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
diff --git a/cui/source/options/optmemory.cxx b/cui/source/options/optmemory.cxx
index 9fd2c2b..e5c43f7 100644
--- a/cui/source/options/optmemory.cxx
+++ b/cui/source/options/optmemory.cxx
@@ -59,6 +59,8 @@
#include "helpid.hrc"
#include <dialmgr.hxx>
+#include <config_vclplug.h>
+
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 7177e49..12f8048 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -95,6 +95,8 @@
#include "langselect.hxx"
+#include <config_telepathy.h>
+
#ifdef ENABLE_TELEPATHY
#include <tubes/manager.hxx>
#endif
diff --git a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx
b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx
index 8c7175f..cdb8b39 100644
--- a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx
+++ b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx
@@ -92,6 +92,8 @@ extern "C" {
#endif
#endif
+#include <config_vclplug.h>
+
#ifdef ENABLE_GTK
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
diff --git a/extensions/source/plugin/unx/npnapi.cxx b/extensions/source/plugin/unx/npnapi.cxx
index 2159192..bfc6fa1 100644
--- a/extensions/source/plugin/unx/npnapi.cxx
+++ b/extensions/source/plugin/unx/npnapi.cxx
@@ -40,6 +40,8 @@
#include <osl/module.h>
+#include <config_vclplug.h>
+
extern PluginConnector* pConnector;
extern XtAppContext app_context;
extern int wakeup_fd[];
diff --git a/extensions/source/plugin/unx/npwrap.cxx b/extensions/source/plugin/unx/npwrap.cxx
index b2cd532..8229abb 100644
--- a/extensions/source/plugin/unx/npwrap.cxx
+++ b/extensions/source/plugin/unx/npwrap.cxx
@@ -44,6 +44,8 @@
#include <osl/file.h>
#include <osl/module.h>
+#include <config_vclplug.h>
+
PluginConnector* pConnector = NULL;
int nAppArguments = 0;
diff --git a/sal/inc/rtl/instance.hxx b/sal/inc/rtl/instance.hxx
index e2e1f63..9e73af0 100644
--- a/sal/inc/rtl/instance.hxx
+++ b/sal/inc/rtl/instance.hxx
@@ -20,6 +20,8 @@
#ifndef INCLUDED_RTL_INSTANCE_HXX
#define INCLUDED_RTL_INSTANCE_HXX
+#include <config_global.h>
+
#include "osl/doublecheckedlocking.h"
#include "osl/getglobalmutex.hxx"
diff --git a/sal/inc/rtl/stringutils.hxx b/sal/inc/rtl/stringutils.hxx
index c6e44b6..e8909327 100644
--- a/sal/inc/rtl/stringutils.hxx
+++ b/sal/inc/rtl/stringutils.hxx
@@ -31,6 +31,8 @@
#include "sal/config.h"
+#include <config_global.h>
+
// Manually defining RTL_DISABLE_FAST_STRING allows to force turning fast string concatenation off
// (e.g. for debugging).
#ifndef RTL_DISABLE_FAST_STRING
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 22322ba..d801b9b 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -105,6 +105,8 @@
#include "markdata.hxx"
#include "orcusfilters.hxx"
+#include <config_telepathy.h>
+
#ifdef ENABLE_TELEPATHY
#include "sccollaboration.hxx"
#endif
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index eeb0708..aa0afde 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -39,6 +39,8 @@
#include <boost/unordered_map.hpp>
#include <cppuhelper/implbase1.hxx>
+#include <config_telepathy.h>
+
class ScEditEngineDefaulter;
class SfxStyleSheetBasePool;
class SfxStyleSheetHint;
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 4186f86..88a41dd 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -43,6 +43,8 @@
#include "markdata.hxx"
#include "scabstdlg.hxx"
+#include <config_telepathy.h>
+
#ifdef ENABLE_TELEPATHY
#include "sccollaboration.hxx"
#endif
diff --git a/shell/inc/shell/kde_headers.h b/shell/inc/shell/kde_headers.h
index 015fe5f..161e1ff 100644
--- a/shell/inc/shell/kde_headers.h
+++ b/shell/inc/shell/kde_headers.h
@@ -20,6 +20,8 @@
#ifndef INCLUDED_VCL_KDE_HEADERS_H
#define INCLUDED_VCL_KDE_HEADERS_H
+#include <config_vclplug.h>
+
#ifdef ENABLE_TDE
#include "shell/tde_headers.h"
diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk
index 6f3a99c..83a0e1a 100644
--- a/solenv/gbuild/gbuild.mk
+++ b/solenv/gbuild/gbuild.mk
@@ -262,12 +262,6 @@ gb_GLOBALDEFS += \
DISABLE_EXTENSIONS \
DISABLE_SCRIPTING \
ENABLE_GRAPHITE \
- ENABLE_GTK \
- ENABLE_KDE \
- ENABLE_KDE4 \
- ENABLE_TDE \
- ENABLE_TELEPATHY \
- HAVE_THREADSAFE_STATICS \
)
gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 2fa3023..973f476 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -59,12 +59,6 @@ gb_COMPILERDEFS := \
-DCPPU_ENV=$(gb_CPPU_ENV) \
-DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) \
-ifeq ($(HAVE_GCC_BUILTIN_ATOMIC),TRUE)
-gb_COMPILERDEFS += \
- -DHAVE_GCC_BUILTIN_ATOMIC \
-
-endif
-
gb_CFLAGS_COMMON := \
-Wall \
-Wendif-labels \
@@ -158,7 +152,9 @@ gb_DEBUG_CFLAGS := $(GGDB2) $(FINLINE_LIMIT0) $(FNO_INLINE)
gb_DEBUG_CXXFLAGS := $(FNO_DEFAULT_INLINE)
-gb_LinkTarget_INCLUDE := $(subst -I. , ,$(SOLARINC))
+gb_LinkTarget_INCLUDE :=\
+ $(subst -I. , ,$(SOLARINC)) \
+ -I$(SRCDIR)/config \
ifeq ($(COM_GCC_IS_CLANG),TRUE)
ifeq ($(COMPILER_PLUGIN_TOOL),)
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index d0b3cfc..1102da9 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -108,6 +108,7 @@ gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS)
gb_LinkTarget_INCLUDE :=\
$(subst -I. , ,$(SOLARINC)) \
$(foreach inc,$(subst ;, ,$(JDKINC)),-I$(inc)) \
+ -I$(SRCDIR)/config \
gb_LinkTarget_get_pdbfile = $(call gb_LinkTarget_get_target,)pdb/$(1).pdb
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index 2515b45..3a6f097 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -69,12 +69,6 @@ gb_CXXFLAGS := \
#-fsigned-char \ might be removed?
#-malign-natural \ might be removed?
-ifeq ($(HAVE_SFINAE_ANONYMOUS_BROKEN),TRUE)
-gb_COMPILERDEFS += \
- -DHAVE_SFINAE_ANONYMOUS_BROKEN \
-
-endif
-
# Without this I get struct/class clashes for "complex" when compiling
# some source files in vcl, at least with the 10.7 SDK.
ifneq ($(filter 1070,$(MACOSX_SDK_VERSION)),)
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index dbd00a1..4b1f747 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -76,12 +76,6 @@ else
gb_CXXFLAGS += -Wnon-virtual-dtor
endif
-ifeq ($(HAVE_SFINAE_ANONYMOUS_BROKEN),TRUE)
-gb_COMPILERDEFS += \
- -DHAVE_SFINAE_ANONYMOUS_BROKEN \
-
-endif
-
# enable debug STL
ifeq ($(gb_ENABLE_DBGUTIL),$(true))
gb_COMPILERDEFS += \
diff --git a/vcl/unx/kde/FPServiceInfo.hxx b/vcl/unx/kde/FPServiceInfo.hxx
index 2026860..5cddc5f 100644
--- a/vcl/unx/kde/FPServiceInfo.hxx
+++ b/vcl/unx/kde/FPServiceInfo.hxx
@@ -20,6 +20,8 @@
#ifndef _FPSERVICEINFO_HXX_
#define _FPSERVICEINFO_HXX_
+#include <config_vclplug.h>
+
#ifdef ENABLE_TDE
// the service names
diff --git a/vcl/unx/kde/UnxFilePicker.cxx b/vcl/unx/kde/UnxFilePicker.cxx
index afa9db0..19c9e5f 100644
--- a/vcl/unx/kde/UnxFilePicker.cxx
+++ b/vcl/unx/kde/UnxFilePicker.cxx
@@ -51,6 +51,8 @@
#include <iostream>
+#include <config_vclplug.h>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::ui::dialogs;
diff --git a/vcl/unx/kde/fpicker/kdecommandthread.cxx b/vcl/unx/kde/fpicker/kdecommandthread.cxx
index c783556..1f9f663 100644
--- a/vcl/unx/kde/fpicker/kdecommandthread.cxx
+++ b/vcl/unx/kde/fpicker/kdecommandthread.cxx
@@ -21,6 +21,8 @@
#include <kdecommandthread.hxx>
+#include <config_vclplug.h>
+
#ifdef ENABLE_TDE
#include <tqstringlist.h>
#else // ENABLE_TDE
diff --git a/vcl/unx/kde/fpicker/kdecommandthread.hxx b/vcl/unx/kde/fpicker/kdecommandthread.hxx
index 70c790a..acb90d8 100644
--- a/vcl/unx/kde/fpicker/kdecommandthread.hxx
+++ b/vcl/unx/kde/fpicker/kdecommandthread.hxx
@@ -20,6 +20,8 @@
#ifndef _KDECOMMANDTHREAD_HXX_
#define _KDECOMMANDTHREAD_HXX_
+#include <config_vclplug.h>
+
#ifdef ENABLE_TDE
#include <shell/tde_defines.h>
#endif // ENABLE_TDE
diff --git a/vcl/unx/kde/fpicker/kdefilepicker.cxx b/vcl/unx/kde/fpicker/kdefilepicker.cxx
index f937eb9..b0d20e4 100644
--- a/vcl/unx/kde/fpicker/kdefilepicker.cxx
+++ b/vcl/unx/kde/fpicker/kdefilepicker.cxx
@@ -22,6 +22,8 @@
#include <kdecommandthread.hxx>
#include <kdefilepicker.hxx>
+#include <config_vclplug.h>
+
#ifdef ENABLE_TDE
#include <tqcheckbox.h>
diff --git a/vcl/unx/kde/fpicker/kdefilepicker.hxx b/vcl/unx/kde/fpicker/kdefilepicker.hxx
index 2e41667..e7638ea 100644
--- a/vcl/unx/kde/fpicker/kdefilepicker.hxx
+++ b/vcl/unx/kde/fpicker/kdefilepicker.hxx
@@ -20,6 +20,8 @@
#ifndef _KDEFILEPICKER_HXX_
#define _KDEFILEPICKER_HXX_
+#include <config_vclplug.h>
+
#ifdef ENABLE_TDE
#include <shell/tde_defines.h>
#endif // ENABLE_TDE
diff --git a/vcl/unx/kde/fpicker/kdefpmain.cxx b/vcl/unx/kde/fpicker/kdefpmain.cxx
index c794d53..a18a969 100644
--- a/vcl/unx/kde/fpicker/kdefpmain.cxx
+++ b/vcl/unx/kde/fpicker/kdefpmain.cxx
@@ -30,6 +30,8 @@
#include <iostream>
#include <stdlib.h>
+#include <config_vclplug.h>
+
#ifdef ENABLE_TDE
#define THIS_DESKENV_NAME_CAP "TDE"
#define THIS_DESKENV_NAME_LOW "tde"
diff --git a/vcl/unx/kde/fpicker/kdemodalityfilter.hxx b/vcl/unx/kde/fpicker/kdemodalityfilter.hxx
index 607a576..05331fe 100644
--- a/vcl/unx/kde/fpicker/kdemodalityfilter.hxx
+++ b/vcl/unx/kde/fpicker/kdemodalityfilter.hxx
@@ -20,6 +20,8 @@
#ifndef _KDEMODALITYFILTER_HXX_
#define _KDEMODALITYFILTER_HXX_
+#include <config_vclplug.h>
+
#ifdef ENABLE_TDE
#include <shell/tde_defines.h>
#endif // ENABLE_TDE
diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx
index e66475d..7d84c79 100644
--- a/vcl/unx/kde/kdedata.cxx
+++ b/vcl/unx/kde/kdedata.cxx
@@ -45,6 +45,8 @@
#include "vclpluginapi.h"
+#include <config_vclplug.h>
+
#ifdef ENABLE_TDE
#define THIS_DESKENV_NAME_CAP "TDE"
#define THIS_DESKENV_NAME_LOW "tde"
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index 1440b84..8f6c26b 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -32,6 +32,8 @@
#include <vcl/vclenum.hxx>
#include <rtl/ustrbuf.hxx>
+#include <config_vclplug.h>
+
#ifdef ENABLE_TDE
#define QPushButton_String "TQPushButton"
#define QRadioButton_String "TQRadioButton"
--
1.7.10.4
From f5d8f56f3fb4697f469aa0ae1997149297adf1a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@suse.cz>
Date: Fri, 7 Dec 2012 18:13:31 +0100
Subject: [PATCH 2/2] add rtl::OUStringBuffer::append(bool)
The same as 563fa900ba22bf83dfa58e67807ed0337f810576 , but this
time with extra care to not break anything with pointer->bool conversions.
Change-Id: Ifcea840e96da0fbfcf92b54141fb8ef9c5eb94ff
---
config/config_global.h.in | 1 +
configure.ac | 28 ++++++++++++++++++++++++++++
sal/inc/rtl/stringutils.hxx | 23 ++++++++++++++++++++++-
sal/inc/rtl/ustrbuf.hxx | 40 ++++++++++++++++++++++++++++++++++++++++
4 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/config/config_global.h.in b/config/config_global.h.in
index a9eb54f..77980d4 100644
--- a/config/config_global.h.in
+++ b/config/config_global.h.in
@@ -9,6 +9,7 @@ Any change in this header will cause a rebuild of almost everything.
*/
+#undef HAVE_CXX11_DELETE
#undef HAVE_GCC_BUILTIN_ATOMIC
#undef HAVE_SFINAE_ANONYMOUS_BROKEN
#undef HAVE_THREADSAFE_STATICS
diff --git a/configure.ac b/configure.ac
index 690b0a0..c0f6388 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5672,6 +5672,34 @@ AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
AC_SUBST(HAVE_GCC_AVX)
AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
+dnl ==================================
+dnl Check for C++11 "= delete" support
+dnl ==================================
+
+AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax])
+if test "$HAVE_CXX0X" = "TRUE"; then
+ save_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+ AC_LANG_PUSH([C++])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+struct A
+ {
+ void test() = delete;
+ };
+]])],[HAVE_CXX11_DELETE=TRUE],[])
+
+ AC_LANG_POP([C++])
+ CXXFLAGS=$save_CXXFLAGS
+ if test "$HAVE_CXX11_DELETE" = "TRUE"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_CXX11_DELETE])
+ else
+ AC_MSG_RESULT([no])
+ fi
+else
+ AC_MSG_RESULT([no (C++11 disabled)])
+fi
+
dnl ===================================================================
dnl system stl sanity tests
dnl ===================================================================
diff --git a/sal/inc/rtl/stringutils.hxx b/sal/inc/rtl/stringutils.hxx
index e8909327..c972d83 100644
--- a/sal/inc/rtl/stringutils.hxx
+++ b/sal/inc/rtl/stringutils.hxx
@@ -88,19 +88,22 @@ So char[] and const char[] should always be used with their contents specified (
turns them into char[N] or const char[N]), or char* and const char* should be used.
*/
struct Dummy {};
-template< typename T1, typename T2 >
+template< typename T1, typename T2 = void >
struct CharPtrDetector
{
+ static const bool ok = false;
};
template< typename T >
struct CharPtrDetector< const char*, T >
{
typedef T Type;
+ static const bool ok = true;
};
template< typename T >
struct CharPtrDetector< char*, T >
{
typedef T Type;
+ static const bool ok = true;
};
template< typename T1, typename T2 >
@@ -167,6 +170,24 @@ struct ExceptCharArrayDetector< const char[ N ] >
{
};
+template< typename T1, typename T2 = void >
+struct SalUnicodePtrDetector
+{
+ static const bool ok = false;
+};
+template< typename T >
+struct SalUnicodePtrDetector< const sal_Unicode*, T >
+{
+ typedef T Type;
+ static const bool ok = true;
+};
+template< typename T >
+struct SalUnicodePtrDetector< sal_Unicode*, T >
+{
+ typedef T Type;
+ static const bool ok = true;
+};
+
// SFINAE helper class
template< typename T, bool >
struct Enable
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index 1397a18..3814a6f 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -557,6 +557,46 @@ public:
}
/**
+ Appends the string representation of the <code>bool</code>
+ argument to the string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param b a <code>bool</code>.
+ @return this string buffer.
+
+ @since LibreOffice 4.1
+ */
+ OUStringBuffer & append(bool b)
+ {
+ sal_Unicode sz[RTL_USTR_MAX_VALUEOFBOOLEAN];
+ return append( sz, rtl_ustr_valueOfBoolean( sz, b ) );
+ }
+#ifdef HAVE_CXX11_DELETE
+#ifndef HAVE_SFINAE_ANONYMOUS_BROKEN
+ // Pointer can be automatically converted to bool, which is unwanted here.
+ // Explicitly delete all pointer append() overloads to prevent this
+ // (except for char* and sal_Unicode* overloads, which are handled elsewhere).
+ template< typename T >
+ typename internal::Enable< void,
+ !internal::CharPtrDetector< T* >::ok && !internal::SalUnicodePtrDetector< T* >::ok >::Type
+ append( T* ) = delete;
+#endif
+#endif
+
+ // This overload is needed because OUString has a ctor from rtl_uString*, but
+ // the bool overload above would be prefered to the conversion.
+ /**
+ @internal
+ */
+ OUStringBuffer & append(rtl_uString* str)
+ {
+ return append( OUString( str ));
+ }
+
+ /**
Appends the string representation of the <code>sal_Bool</code>
argument to the string buffer.
--
1.7.10.4
Context
- Using config_xxx.h instead of -DHAVE_XXX · Lubos Lunak
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.