diff --git a/include/wx/string.h b/include/wx/string.h index 5bcb6cb4ee..eb54eb24c7 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -82,10 +82,18 @@ class WXDLLIMPEXP_FWD_BASE wxString; #endif // enforce consistency among encoding-related macros -#if defined wxNO_IMPLICIT_WXSTRING_ENCODING && !defined wxNO_UNSAFE_WXSTRING_CONV +#ifdef wxNO_IMPLICIT_WXSTRING_ENCODING + +#ifndef wxNO_UNSAFE_WXSTRING_CONV #define wxNO_UNSAFE_WXSTRING_CONV #endif +#if wxUSE_UTF8_LOCALE_ONLY +#error wxNO_IMPLICIT_WXSTRING_ENCODING cannot be used in UTF-8 only builds +#endif + +#endif + namespace wxPrivate { template struct wxStringAsBufHelper; diff --git a/tests/Makefile.in b/tests/Makefile.in index 56dcb6f73a..f203d05156 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -275,8 +275,8 @@ TEST_ALLHEADERS_CXXFLAGS = $(__test_allheaders_PCH_INC) $(WX_CPPFLAGS) \ -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \ $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \ -I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../samples \ - -I$(top_srcdir)/3rdparty/catch/include -DwxNO_IMPLICIT_WXSTRING_ENCODING \ - $(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) + -I$(top_srcdir)/3rdparty/catch/include $(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) \ + $(CPPFLAGS) $(CXXFLAGS) TEST_ALLHEADERS_OBJECTS = \ $(__test_allheaders___win32rc) \ test_allheaders_asserthelper.o \ @@ -371,6 +371,8 @@ COND_MONOLITHIC_0___WXLIB_HTML_p = \ @COND_TOOLKIT_OSX_IPHONE@____test_allheaders_BUNDLE_TGT_REF_DEP \ @COND_TOOLKIT_OSX_IPHONE@ = \ @COND_TOOLKIT_OSX_IPHONE@ $(__test_allheaders_app_Contents_PkgInfo___depname) +@COND_PLATFORM_WIN32_1@__test_allheaders___win32rc = \ +@COND_PLATFORM_WIN32_1@ test_allheaders_sample_rc.o @COND_GCC_PCH_1@__test_allheaders_PCH_INC = \ @COND_GCC_PCH_1@ -I./.pch/testprec_test_allheaders @COND_ICC_PCH_1@__test_allheaders_PCH_INC = \ @@ -378,8 +380,6 @@ COND_MONOLITHIC_0___WXLIB_HTML_p = \ @COND_ICC_PCH_1@ ./.pch/testprec_test_allheaders/testprec.h.gch @COND_USE_PCH_1@_____pch_testprec_test_allheaders_testprec_h_gch___depname \ @COND_USE_PCH_1@ = ./.pch/testprec_test_allheaders/testprec.h.gch -@COND_PLATFORM_WIN32_1@__test_allheaders___win32rc = \ -@COND_PLATFORM_WIN32_1@ test_allheaders_sample_rc.o COND_MONOLITHIC_0___WXLIB_XML_p = \ -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml-$(WX_RELEASE)$(HOST_SUFFIX) @COND_MONOLITHIC_0@__WXLIB_XML_p = $(COND_MONOLITHIC_0___WXLIB_XML_p) @@ -1155,7 +1155,7 @@ test_gui_xrctest.o: $(srcdir)/xml/xrctest.cpp $(TEST_GUI_ODEP) $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/xml/xrctest.cpp test_allheaders_sample_rc.o: $(srcdir)/../samples/sample.rc $(TEST_ALLHEADERS_ODEP) - $(WINDRES) -i$< -o$@ $(__WIN32_DPI_MANIFEST_p) --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) --include-dir $(srcdir) $(__DLLFLAG_p_0) --include-dir $(srcdir)/../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --include-dir $(top_srcdir)/3rdparty/catch/include --define wxNO_IMPLICIT_WXSTRING_ENCODING + $(WINDRES) -i$< -o$@ $(__WIN32_DPI_MANIFEST_p) --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) --include-dir $(srcdir) $(__DLLFLAG_p_0) --include-dir $(srcdir)/../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --include-dir $(top_srcdir)/3rdparty/catch/include test_allheaders_asserthelper.o: $(srcdir)/asserthelper.cpp $(TEST_ALLHEADERS_ODEP) $(CXXC) -c -o $@ $(TEST_ALLHEADERS_CXXFLAGS) $(srcdir)/asserthelper.cpp @@ -1200,7 +1200,7 @@ failtest_weakref: failtest_allheaders: @$(RM) test_allheaders.o - if $(MAKE) CPPFLAGS=-DTEST_IMPLICIT_WXSTRING_ENCODING test_allheaders.o 2>/dev/null; then \ + if $(MAKE) CPPFLAGS=-DwxNO_IMPLICIT_WXSTRING_ENCODING -DTEST_IMPLICIT_WXSTRING_ENCODING test_allheaders.o 2>/dev/null; then \ echo "*** Compilation with TEST_IMPLICIT_WXSTRING_ENCODING unexpectedly succeeded.">&2; \ exit 1; \ fi; \ diff --git a/tests/allheaders.cpp b/tests/allheaders.cpp index 34a5b572e3..bcf0581a8f 100644 --- a/tests/allheaders.cpp +++ b/tests/allheaders.cpp @@ -10,12 +10,19 @@ // headers // ---------------------------------------------------------------------------- -#include "testprec.h" - +// Avoid pre-compiled headers at all #ifdef __BORLANDC__ #pragma hdrstop #endif +#include "wx/setup.h" + +#if !wxUSE_UTF8_LOCALE_ONLY +#define wxNO_IMPLICIT_WXSTRING_ENCODING +#endif + +#include "testprec.h" + #include "allheaders.h" TEST_CASE("wxNO_IMPLICIT_WXSTRING_ENCODING", "[string]") diff --git a/tests/test.bkl b/tests/test.bkl index 4c13a06a8b..2588593b05 100644 --- a/tests/test.bkl +++ b/tests/test.bkl @@ -301,8 +301,6 @@ - - wxNO_IMPLICIT_WXSTRING_ENCODING console @@ -405,7 +403,7 @@ failtest_weakref: failtest_allheaders: @$(RM) test_allheaders.o - if $(MAKE) CPPFLAGS=-DTEST_IMPLICIT_WXSTRING_ENCODING test_allheaders.o 2>/dev/null; then \ + if $(MAKE) CPPFLAGS=-DwxNO_IMPLICIT_WXSTRING_ENCODING -DTEST_IMPLICIT_WXSTRING_ENCODING test_allheaders.o 2>/dev/null; then \ echo "*** Compilation with TEST_IMPLICIT_WXSTRING_ENCODING unexpectedly succeeded.">&2; \ exit 1; \ fi; \ diff --git a/tests/test_vc7_test_allheaders.vcproj b/tests/test_vc7_test_allheaders.vcproj index 3b0e7c3446..ded0ef4915 100644 --- a/tests/test_vc7_test_allheaders.vcproj +++ b/tests/test_vc7_test_allheaders.vcproj @@ -28,7 +28,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=".\..\lib\vc_lib\mswud;.\..\include;.;.\..\samples;.\..\3rdparty\catch\include" - PreprocessorDefinitions="WIN32;_DEBUG;__WXMSW__;_UNICODE;NOPCH;wxNO_IMPLICIT_WXSTRING_ENCODING;_CONSOLE" + PreprocessorDefinitions="WIN32;_DEBUG;__WXMSW__;_UNICODE;NOPCH;_CONSOLE" MinimalRebuild="TRUE" ExceptionHandling="TRUE" BasicRuntimeChecks="3" @@ -60,7 +60,7 @@ TargetMachine="1"/> @@ -70,7 +70,7 @@ Name="VCPreLinkEventTool"/> @@ -137,7 +137,7 @@ Name="VCPreLinkEventTool"/> @@ -205,7 +205,7 @@ Name="VCPreLinkEventTool"/> @@ -272,7 +272,7 @@ Name="VCPreLinkEventTool"/> @@ -147,14 +147,14 @@ /> @@ -246,14 +246,14 @@ /> @@ -346,14 +346,14 @@ /> @@ -445,14 +445,14 @@ /> @@ -545,14 +545,14 @@ /> @@ -644,14 +644,14 @@ /> @@ -744,14 +744,14 @@ /> diff --git a/tests/test_vc9_test_allheaders.vcproj b/tests/test_vc9_test_allheaders.vcproj index 4375bd9865..51e927e366 100644 --- a/tests/test_vc9_test_allheaders.vcproj +++ b/tests/test_vc9_test_allheaders.vcproj @@ -47,7 +47,7 @@ /> @@ -143,7 +143,7 @@ /> @@ -239,7 +239,7 @@ /> @@ -335,7 +335,7 @@ /> @@ -431,7 +431,7 @@ /> @@ -527,7 +527,7 @@ /> @@ -623,7 +623,7 @@ /> @@ -719,7 +719,7 @@ />