commit 4c198657abe467404ec28d3614c8f6c615bc3112 Author: Jean-Marc Lasgouttes <lasgout...@lyx.org> Date: Wed Jun 25 18:50:48 2025 +0200
Drop usage of BOOST_ASSERT It did not offer any substantial feature, since we already handle our assertions by ourselves. The various boost.cpp files are removed too. With this change, boost is not used at all in our code base. The infrastructure to use it is still present, though. --- configure.ac | 5 - development/cmake/configCompiler.h.cmake | 5 - development/cmake/configCompiler.h.msvc | 7 +- lib/doc/Development.lyx | 273 ++++--------------------------- src/Makefile.am | 6 - src/boost.cpp | 55 ------- src/client/Makefile.am | 1 - src/client/boost.cpp | 47 ------ src/frontends/Makefile.am | 3 +- src/frontends/tests/CMakeLists.txt | 2 +- src/frontends/tests/boost.cpp | 35 ---- src/support/Makefile.am | 12 +- src/support/lassert.cpp | 15 +- src/support/tests/CMakeLists.txt | 2 +- src/support/tests/boost.cpp | 35 ---- src/tests/CMakeLists.txt | 8 +- src/tests/boost.cpp | 35 ---- src/tex2lyx/Makefile.am | 1 - src/tex2lyx/boost.cpp | 43 ----- 19 files changed, 52 insertions(+), 538 deletions(-) diff --git a/configure.ac b/configure.ac index 2b93b8b187..c7666c4596 100644 --- a/configure.ac +++ b/configure.ac @@ -284,11 +284,6 @@ char * strerror(int n); #define BOOST_USER_CONFIG <config.h> -#if !defined(ENABLE_ASSERTIONS) -# define BOOST_DISABLE_ASSERTS 1 -#endif -#define BOOST_ENABLE_ASSERT_HANDLER 1 - #define BOOST_DISABLE_THREADS 1 #ifdef __CYGWIN__ diff --git a/development/cmake/configCompiler.h.cmake b/development/cmake/configCompiler.h.cmake index fcc16f6035..6c14681528 100644 --- a/development/cmake/configCompiler.h.cmake +++ b/development/cmake/configCompiler.h.cmake @@ -86,11 +86,6 @@ # define ENABLE_ASSERTIONS 1 #endif -#ifndef ENABLE_ASSERTIONS -# define BOOST_DISABLE_ASSERTS 1 -#endif -#define BOOST_ENABLE_ASSERT_HANDLER 1 - //#define BOOST_DISABLE_THREADS 1 #ifdef __CYGWIN__ diff --git a/development/cmake/configCompiler.h.msvc b/development/cmake/configCompiler.h.msvc index b4e97a450d..9a9a1a878c 100644 --- a/development/cmake/configCompiler.h.msvc +++ b/development/cmake/configCompiler.h.msvc @@ -118,7 +118,7 @@ #define PATH_MAX 512 #endif -#ifdef _WIN32 +#ifdef _WIN32 #undef HAVE_MKDIR // use _mkdir instead #endif @@ -128,11 +128,6 @@ # define ENABLE_ASSERTIONS 1 #endif -#ifndef ENABLE_ASSERTIONS -# define BOOST_DISABLE_ASSERTS 1 -#endif -#define BOOST_ENABLE_ASSERT_HANDLER 1 - #define BOOST_DISABLE_THREADS 1 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 diff --git a/lib/doc/Development.lyx b/lib/doc/Development.lyx index c5529c976a..25f82d3a4e 100644 --- a/lib/doc/Development.lyx +++ b/lib/doc/Development.lyx @@ -1,5 +1,5 @@ -#LyX 2.4 created this file. For more info see https://www.lyx.org/ -\lyxformat 620 +#LyX 2.5 created this file. For more info see https://www.lyx.org/ +\lyxformat 640 \begin_document \begin_header \save_transient_properties true @@ -73,14 +73,24 @@ logicalmkup \paperorientation portrait \suppress_date false \justification true -\use_refstyle 0 +\crossref_package prettyref +\use_formatted_ref 0 \use_minted 0 \use_lineno 0 -\notefontcolor #0000ff +\customcolor lyxnotefontcolor 0000ff +\backgroundcolor none +\fontcolor none +\notefontcolor lyxnotefontcolor +\boxbgcolor red +\table_border_color default +\table_odd_row_color default +\table_even_row_color default +\table_alt_row_colors_start 1 \index Index \shortcut idx \color #008000 \end_index +\spellchecker_ignore english namespaces \secnumdepth 4 \tocdepth 2 \paragraph_separation indent @@ -102,6 +112,7 @@ logicalmkup \html_be_strict true \docbook_table_output 0 \docbook_mathml_prefix 1 +\docbook_mathml_version 0 \end_header \begin_body @@ -112,7 +123,7 @@ Developing \SpecialChar LyX \end_layout \begin_layout Subtitle -Version 2.4.x +Version 2.5.x \end_layout \begin_layout Author @@ -968,7 +979,6 @@ status open status open \begin_layout Plain Layout - https://www.lyx.org/trac/ticket/9794 \end_layout @@ -3582,7 +3592,6 @@ WILL_FAIL status collapsed \begin_layout Plain Layout - https://cmake.org/cmake/help/v3.0/command/set_tests_properties.html \end_layout @@ -5431,9 +5440,9 @@ nolink "false" \end_layout \begin_layout Itemize -As of LyX 2.4.0, - you can use features of C++11. - Accordingly you have to use C++11 standard conforming compiler, +As of LyX 2.5.0, + you can use features of C++17. + Accordingly you have to use C++17 standard conforming compiler, e. \begin_inset space \thinspace{} \end_inset @@ -5489,7 +5498,6 @@ Document all variables, status open \begin_layout Plain Layout - https://www.stack.nl/~dimitri/doxygen/ \end_layout @@ -5658,12 +5666,10 @@ inline false status open \begin_layout Plain Layout - ++T; \end_layout \begin_layout Plain Layout - --U; \end_layout @@ -5683,13 +5689,11 @@ inline false status open \begin_layout Plain Layout - T++; // not used in LyX \end_layout \begin_layout Plain Layout - U--; // not used in LyX \end_layout @@ -5722,24 +5726,20 @@ inline false status open \begin_layout Plain Layout - Container::iterator end = large.end(); \end_layout \begin_layout Plain Layout - for (Container::iterator it = large.begin(); it != end; ++it) { \end_layout \begin_layout Plain Layout - ...; \end_layout \begin_layout Plain Layout - } \end_layout @@ -5759,18 +5759,15 @@ inline false status open \begin_layout Plain Layout - for (auto const & it : large) { \end_layout \begin_layout Plain Layout - ...; \end_layout \begin_layout Plain Layout - } \end_layout @@ -5790,19 +5787,16 @@ inline false status open \begin_layout Plain Layout - for (Container::iterator it = large.begin(); it != large.end(); ++it) { \end_layout \begin_layout Plain Layout - ...; \end_layout \begin_layout Plain Layout - } \end_layout @@ -5865,7 +5859,6 @@ inline false status open \begin_layout Plain Layout - T const add(...); \end_layout @@ -5885,7 +5878,6 @@ inline false status open \begin_layout Plain Layout - T add(...); \end_layout @@ -5907,22 +5899,18 @@ inline false status open \begin_layout Plain Layout - enum Foo { \end_layout \begin_layout Plain Layout - FOO_BAR1, \end_layout \begin_layout Plain Layout - FOO_BAR2 \end_layout \begin_layout Plain Layout - }; \end_layout @@ -5931,7 +5919,6 @@ enum Foo { \end_layout \begin_layout Plain Layout - Foo f = ...; \end_layout @@ -5940,59 +5927,48 @@ Foo f = ...; \end_layout \begin_layout Plain Layout - switch (f) { \end_layout \begin_layout Plain Layout - case FOO_BAR1: \end_layout \begin_layout Plain Layout - ...; \end_layout \begin_layout Plain Layout - break; \end_layout \begin_layout Plain Layout - case FOO_BAR2: \end_layout \begin_layout Plain Layout - ...; \end_layout \begin_layout Plain Layout - break; \end_layout \begin_layout Plain Layout - default: // not needed and would shadow a wrong use of Foo \end_layout \begin_layout Plain Layout - ...; \end_layout \begin_layout Plain Layout - break; \end_layout \begin_layout Plain Layout - } \end_layout @@ -6008,12 +5984,10 @@ inline false status open \begin_layout Plain Layout - int i = 0; \end_layout \begin_layout Plain Layout - Class * ptr = nullptr; \end_layout @@ -6025,12 +5999,10 @@ inline false status open \begin_layout Plain Layout - int i {}; \end_layout \begin_layout Plain Layout - Class * ptr {}; \end_layout @@ -6097,7 +6069,6 @@ Strong guarantee: status open \begin_layout Plain Layout - http://www.stlport.org/doc/exception_safety.html \end_layout @@ -6167,12 +6138,10 @@ inline false status open \begin_layout Plain Layout - int a; \end_layout \begin_layout Plain Layout - int b; \end_layout @@ -6192,7 +6161,6 @@ inline false status open \begin_layout Plain Layout - int a, b; // not used in LyX @@ -6218,12 +6186,10 @@ inline false status open \begin_layout Plain Layout - string a = "Lars"; \end_layout \begin_layout Plain Layout - string b = "Gullik"; \end_layout @@ -6243,7 +6209,6 @@ inline false status open \begin_layout Plain Layout - string a = "Lars", b = "Gullik"; // not used in LyX @@ -6314,12 +6279,10 @@ inline false status open \begin_layout Plain Layout - char * p = "flop"; \end_layout \begin_layout Plain Layout - char & c = *p; \end_layout @@ -6339,13 +6302,11 @@ inline false status open \begin_layout Plain Layout - char *p = "flop"; // not used in LyX \end_layout \begin_layout Plain Layout - char &c = *p; // not used in LyX \end_layout @@ -6367,7 +6328,6 @@ inline false status open \begin_layout Plain Layout - char const * p; \end_layout @@ -6387,7 +6347,6 @@ inline false status open \begin_layout Plain Layout - const char * p; // not used in LyX \end_layout @@ -6414,7 +6373,6 @@ inline false status open \begin_layout Plain Layout - operator==(type) \end_layout @@ -6434,7 +6392,6 @@ inline false status open \begin_layout Plain Layout - operator == (type) // not used in LyX \end_layout @@ -6465,7 +6422,6 @@ inline false status open \begin_layout Plain Layout - void mangle() \end_layout @@ -6485,7 +6441,6 @@ inline false status open \begin_layout Plain Layout - void mangle () // not used in LyX \end_layout @@ -6511,27 +6466,22 @@ inline false status open \begin_layout Plain Layout - enum Foo { \end_layout \begin_layout Plain Layout - FOO_ONE = 1, \end_layout \begin_layout Plain Layout - FOO_TWO = 2, \end_layout \begin_layout Plain Layout - FOO_THREE = 3 \end_layout \begin_layout Plain Layout - }; \end_layout @@ -6551,27 +6501,22 @@ inline false status open \begin_layout Plain Layout - enum class Foo { \end_layout \begin_layout Plain Layout - One = 1, \end_layout \begin_layout Plain Layout - Two = 2, \end_layout \begin_layout Plain Layout - Three = 3 \end_layout \begin_layout Plain Layout - }; \end_layout @@ -6587,7 +6532,6 @@ inline false status open \begin_layout Plain Layout - enum { one = 1, two = 2, three 3 }; @@ -6610,27 +6554,22 @@ inline false status open \begin_layout Plain Layout - enum { \end_layout \begin_layout Plain Layout - One = 1, \end_layout \begin_layout Plain Layout - Two = 2, \end_layout \begin_layout Plain Layout - Three = 3 \end_layout \begin_layout Plain Layout - }; \end_layout @@ -6660,7 +6599,6 @@ inline false status open \begin_layout Plain Layout - void * p = nullptr; \end_layout @@ -6680,7 +6618,6 @@ inline false status open \begin_layout Plain Layout - void * p = NULL; // not used in LyX \end_layout @@ -6701,7 +6638,6 @@ inline false status open \begin_layout Plain Layout - void * p = ' \backslash 0'; @@ -6724,7 +6660,6 @@ inline false status open \begin_layout Plain Layout - void * p = 42 - 7 * 6; // not used in LyX \end_layout @@ -6986,57 +6921,47 @@ inline false status open \begin_layout Plain Layout - /** \end_layout \begin_layout Plain Layout - * \backslash file NewFile.cpp \end_layout \begin_layout Plain Layout - * This file is part of LyX, the document processor. \end_layout \begin_layout Plain Layout - * Licence details can be found in the file COPYING. \end_layout \begin_layout Plain Layout - * \end_layout \begin_layout Plain Layout - * \backslash author Kaiser Sose \end_layout \begin_layout Plain Layout - * \end_layout \begin_layout Plain Layout - * Full author contact details are available \end_layout \begin_layout Plain Layout - * in file CREDITS. \end_layout \begin_layout Plain Layout - */ \end_layout @@ -7182,72 +7107,58 @@ inline false status open \begin_layout Plain Layout - if (f needs to be virtual) \end_layout \begin_layout Plain Layout - make f a member function of C; \end_layout \begin_layout Plain Layout - else if (f is operator>> or operator<<) { \end_layout \begin_layout Plain Layout - make f a non-member function; \end_layout \begin_layout Plain Layout - if (f needs access to non-public members of C) \end_layout \begin_layout Plain Layout - make f a friend of C; \end_layout \begin_layout Plain Layout - } else if (f needs type conversions on its left-most argument) { \end_layout \begin_layout Plain Layout - make f a non-member function; \end_layout \begin_layout Plain Layout - if (f needs access to non-public members of C) \end_layout \begin_layout Plain Layout - make f a friend of C; \end_layout \begin_layout Plain Layout - } else if (f can be implemented via C's public interface) \end_layout \begin_layout Plain Layout - make f a non-member function; \end_layout \begin_layout Plain Layout - else \end_layout \begin_layout Plain Layout - make f a member function of C; \end_layout @@ -7518,112 +7429,16 @@ Given that there seems to be an unconditional "typedef unsigned int quint32;" in \end_layout \begin_layout Standard -The idea is to create something that's not compilable as soon as the condition is violated. - There are lots of possibilities to achieve this, - some examples follow: -\end_layout - -\begin_layout Standard -In C++11 there's a "built-in": -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "basicstyle={\ttfamily},showstringspaces=false,tabsize=4" -inline false -status open - -\begin_layout Plain Layout - -static_assert(sizeof(int) == 4, - "Funny platform") -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -until then on namespace scope: - -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "basicstyle={\ttfamily},showstringspaces=false,tabsize=4" -inline false -status open - -\begin_layout Plain Layout - -#include <boost/static_assert.hpp> -\end_layout - -\begin_layout Plain Layout - -BOOST_STATIC_ASSERT(sizeof(int) == 4) -\end_layout - +The idea is to create something that does not compile as soon as the condition is violated. + In C++11 there's a +\begin_inset Quotes eld \end_inset - -\end_layout - -\begin_layout Standard -or without boost: -\end_layout - -\begin_layout Standard -\begin_inset listings -lstparams "basicstyle={\ttfamily},showstringspaces=false,tabsize=4" -inline false -status open - -\begin_layout Plain Layout - -template<bool Condition> -\end_layout - -\begin_layout Plain Layout - -struct static_assert_helper; -\end_layout - -\begin_layout Plain Layout - -template <> -\end_layout - -\begin_layout Plain Layout - -struct static_assert_helper<true> {}; - -\end_layout - -\begin_layout Plain Layout - -enum { -\end_layout - -\begin_layout Plain Layout - - dummy = sizeof(static_assert_helper<sizeof(int) == 4>) -\end_layout - -\begin_layout Plain Layout - -}; -\end_layout - +built-in +\begin_inset Quotes erd \end_inset - -\end_layout - -\begin_layout Standard -or somewhat brutish without templates, - in any function: +: \end_layout \begin_layout Standard @@ -7633,36 +7448,8 @@ inline false status open \begin_layout Plain Layout - -const int d = sizeof(int) - 4; -\end_layout - -\begin_layout Plain Layout - -switch (0) { -\end_layout - -\begin_layout Plain Layout - -case 0: - -\end_layout - -\begin_layout Plain Layout - -case !(d*d): - -\end_layout - -\begin_layout Plain Layout - - break; - -\end_layout - -\begin_layout Plain Layout - -} +static_assert(sizeof(int) == 4, + "Funny platform") \end_layout \end_inset @@ -7671,7 +7458,7 @@ case !(d*d): \end_layout \begin_layout Standard -Any of them in a .cpp file will break compilation as soon as +This will break compilation as soon as \begin_inset Flex Code status collapsed @@ -7682,8 +7469,7 @@ sizeof(int) \end_inset is not equal 4. - Personally I prefer something like the third version (or the first, - if using C++11 is allowed). + \end_layout \end_deeper @@ -7704,7 +7490,6 @@ On dynamics_casts status open \begin_layout Plain Layout - https://www.lyx.org/trac/changeset/573500dd04f154f27318ac5ec469a337f97fe9f0/lyxgit \end_layout diff --git a/src/Makefile.am b/src/Makefile.am index f3edd9d339..77cf752394 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -116,7 +116,6 @@ liblyxcore_a_SOURCES = \ Author.h \ BiblioInfo.cpp \ BiblioInfo.h \ - boost.cpp \ Box.h \ BranchList.cpp \ BranchList.h \ @@ -651,7 +650,6 @@ liblyxinsets_a_SOURCES = \ ############################## Tests ################################## EXTRA_DIST += \ - tests/boost.cpp \ tests/dummy_functions.cpp \ tests/regfiles/ExternalTransforms \ tests/regfiles/Length \ @@ -696,7 +694,6 @@ check_layout_CPPFLAGS = $(AM_CPPFLAGS) check_layout_LDADD = $(check_layout_LYX_OBJS) $(TESTS_LIBS) check_layout_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS) check_layout_SOURCES = \ - tests/boost.cpp \ tests/check_layout.cpp \ tests/dummy_functions.cpp \ tests/dummy4checklayout.cpp @@ -719,7 +716,6 @@ check_ExternalTransforms_CPPFLAGS = $(AM_CPPFLAGS) check_ExternalTransforms_LDADD = $(check_ExternalTransforms_LYX_OBJS) $(TESTS_LIBS) check_ExternalTransforms_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS) check_ExternalTransforms_SOURCES = \ - tests/boost.cpp \ tests/check_ExternalTransforms.cpp \ tests/dummy_functions.cpp check_ExternalTransforms_LYX_OBJS = \ @@ -730,7 +726,6 @@ check_Length_CPPFLAGS = $(AM_CPPFLAGS) check_Length_LDADD = $(TESTS_LIBS) check_Length_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS) check_Length_SOURCES = \ - tests/boost.cpp \ tests/check_Length.cpp \ tests/dummy_functions.cpp @@ -738,7 +733,6 @@ check_ListingsCaption_CPPFLAGS = $(AM_CPPFLAGS) check_ListingsCaption_LDADD = $(check_ListingsCaption_LYX_OBJS) $(TESTS_LIBS) check_ListingsCaption_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS) check_ListingsCaption_SOURCES = \ - tests/boost.cpp \ tests/check_ListingsCaption.cpp \ tests/dummy_functions.cpp check_ListingsCaption_LYX_OBJS = diff --git a/src/boost.cpp b/src/boost.cpp deleted file mode 100644 index a07d443bbe..0000000000 --- a/src/boost.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/** - * \file boost.cpp - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Lars Gullik Bjønnes - * - * Full author contact details are available in file CREDITS. - */ - -#include <config.h> - -#include "LyX.h" - -#include "support/debug.h" - -#include "support/lassert.h" - -#include <exception> -#include <iomanip> -#include <ostream> - -using namespace std; -using lyx::lyxerr; - -namespace boost { - -void assertion_failed(char const * expr, char const * function, - char const * file, long line) -{ - lyxerr << "Assertion triggered in " << function - << " by failing check \"" << expr << "\"" - << " in file " << file << ":" << line << endl; - - // FIXME: by default we exit here but we could also inform the user - // about the assertion and do the emergency cleanup without exiting. - // FIXME: do we have a list of exit codes defined somewhere? - lyx::lyx_exit(1); -} - -void assertion_failed_msg(char const * expr, char const * msg, - char const * function, char const * file, long line) -{ - lyxerr << "Assertion triggered in " << function - << " by failing check \"" << expr << "\"" - << " with message \"" << msg << "\"" - << " in file " << file << ":" << line << endl; - - // FIXME: by default we exit here but we could also inform the user - // about the assertion and do the emergency cleanup without exiting. - // FIXME: do we have a list of exit codes defined somewhere? - lyx::lyx_exit(1); -} - -} // namespace boost diff --git a/src/client/Makefile.am b/src/client/Makefile.am index 580556d6b1..6a8c0b5400 100644 --- a/src/client/Makefile.am +++ b/src/client/Makefile.am @@ -24,7 +24,6 @@ lyxclient_LDFLAGS = -framework AppKit \ endif SOURCEFILES = \ - boost.cpp \ client.cpp HEADERFILES = diff --git a/src/client/boost.cpp b/src/client/boost.cpp deleted file mode 100644 index f303a1a66f..0000000000 --- a/src/client/boost.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/** - * \file boost.cpp - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Lars Gullik Bjønnes - * - * Full author contact details are available in file CREDITS. - */ - -#include <config.h> - -#include "support/debug.h" - -#include <boost/assert.hpp> - -#include <cstdlib> -#include <exception> -#include <iostream> - -using namespace std; -using lyx::lyxerr; - -namespace boost { - -void assertion_failed(char const * expr, char const * function, - char const * file, long line) -{ - lyxerr << "Assertion triggered in " << function - << " by failing check \"" << expr << "\"" - << " in file " << file << ":" << line << endl; - ::abort(); -} - - -void assertion_failed_msg(char const * expr, char const * msg, - char const * function, char const * file, long line) -{ - lyxerr << "Assertion triggered in " << function - << " by failing check \"" << expr << "\"" - << " with message \"" << msg << "\"" - << " in file " << file << ":" << line << endl; - - ::abort(); -} - -} // namespace boost diff --git a/src/frontends/Makefile.am b/src/frontends/Makefile.am index c019f9115f..bd6a71f3de 100644 --- a/src/frontends/Makefile.am +++ b/src/frontends/Makefile.am @@ -45,8 +45,7 @@ check_PROGRAMS = \ biblio_LDADD = $(ICONV_LIBS) $(ZLIB_LIBS) biblio_SOURCES = \ - tests/biblio.cpp \ - tests/boost.cpp + tests/biblio.cpp makeregfiles: ${check_PROGRAMS} for all in ${check_PROGRAMS} ; do \ diff --git a/src/frontends/tests/CMakeLists.txt b/src/frontends/tests/CMakeLists.txt index f7712e5f18..2ce6c44dce 100644 --- a/src/frontends/tests/CMakeLists.txt +++ b/src/frontends/tests/CMakeLists.txt @@ -7,7 +7,7 @@ project(testFrontends) set(TESTS "test_biblio") -add_executable(biblio biblio.cpp boost.cpp) +add_executable(biblio biblio.cpp) target_link_libraries(biblio ${Lyx_Boost_Libraries}) add_dependencies(lyx_run_tests biblio) set_target_properties(biblio PROPERTIES FOLDER "tests/frontends") diff --git a/src/frontends/tests/boost.cpp b/src/frontends/tests/boost.cpp deleted file mode 100644 index 3343df4aed..0000000000 --- a/src/frontends/tests/boost.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * \file boost.cpp - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Lars Gullik Bjønnes - * - * Full author contact details are available in file CREDITS. - */ - -#include <config.h> - -#include <boost/assert.hpp> - -#include <cstdlib> -#include <exception> - -using namespace std; - -namespace boost { - -void assertion_failed(char const * /*expr*/, char const * /*function*/, - char const * /*file*/, long /*line*/) -{ - ::abort(); -} - - -void assertion_failed_msg(char const * /*expr*/, char const * /*msg*/, - char const * /*function*/, char const * /*file*/, long /*line*/) -{ - ::abort(); -} - -} // namespace boost diff --git a/src/support/Makefile.am b/src/support/Makefile.am index 1cfab1791a..b4ae948059 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -173,29 +173,25 @@ check_convert_LDADD = liblyxsupport.a $(LIBICONV) $(ZLIB_LIBS) $(QT_LIB) $(LIBSH check_convert_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS) check_convert_SOURCES = \ tests/check_convert.cpp \ - tests/dummy_functions.cpp \ - tests/boost.cpp + tests/dummy_functions.cpp check_filetools_LDADD = liblyxsupport.a $(LIBICONV) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI) @LIBS@ check_filetools_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS) check_filetools_SOURCES = \ tests/check_filetools.cpp \ - tests/dummy_functions.cpp \ - tests/boost.cpp + tests/dummy_functions.cpp check_lstrings_LDADD = liblyxsupport.a $(LIBICONV) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI) @LIBS@ check_lstrings_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS) check_lstrings_SOURCES = \ tests/check_lstrings.cpp \ - tests/dummy_functions.cpp \ - tests/boost.cpp + tests/dummy_functions.cpp check_trivstring_LDADD = liblyxsupport.a $(LIBICONV) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI) @LIBS@ check_trivstring_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS) check_trivstring_SOURCES = \ tests/check_trivstring.cpp \ - tests/dummy_functions.cpp \ - tests/boost.cpp + tests/dummy_functions.cpp makeregfiles: ${check_PROGRAMS} for all in ${check_PROGRAMS} ; do \ diff --git a/src/support/lassert.cpp b/src/support/lassert.cpp index 31ebfeb0d9..d48925f1a7 100644 --- a/src/support/lassert.cpp +++ b/src/support/lassert.cpp @@ -20,8 +20,6 @@ #include "support/gettext.h" #include "support/lstrings.h" -#include <boost/assert.hpp> - #include <iostream> #ifdef LYX_CALLSTACK_PRINTING @@ -38,12 +36,18 @@ namespace lyx { using namespace std; using namespace support; +// This is implemented in LyX.cpp +void lyx_exit(int); void doAssertWithCallstack(bool value) { if (!value) { printCallStack(); - BOOST_ASSERT(false); + // FIXME: by default we exit here but we could also inform the + // user about the assertion and do the emergency cleanup + // without exiting. + // FIXME: do we have a list of exit codes defined somewhere? + lyx::lyx_exit(1); } } @@ -59,7 +63,10 @@ void doAssert(char const * expr, char const * file, long line) void doAssertStatic(char const * expr, char const * file, long line) { cerr << "ASSERTION " << expr << " VIOLATED IN " << file << ":" << line << endl; - BOOST_ASSERT(false); + // FIXME: by default we exit here but we could also inform the user + // about the assertion and do the emergency cleanup without exiting. + // FIXME: do we have a list of exit codes defined somewhere? + lyx::lyx_exit(1); } diff --git a/src/support/tests/CMakeLists.txt b/src/support/tests/CMakeLists.txt index cbfa70a0c0..9c371a5436 100644 --- a/src/support/tests/CMakeLists.txt +++ b/src/support/tests/CMakeLists.txt @@ -40,7 +40,7 @@ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/regfiles") set(_depends) foreach(_src ${check_PROGRAMS}) - sources(${_src} ${_src}.cpp dummy_functions.cpp boost.cpp) + sources(${_src} ${_src}.cpp dummy_functions.cpp) string(REPLACE "check_" "" _srcx ${_src}) set(src_data_file "${TOP_SRC_DIR}/src/support/tests/regfiles/${_srcx}") if (MSVC AND EXISTS "${src_data_file}.MSVC") diff --git a/src/support/tests/boost.cpp b/src/support/tests/boost.cpp deleted file mode 100644 index 3343df4aed..0000000000 --- a/src/support/tests/boost.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * \file boost.cpp - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Lars Gullik Bjønnes - * - * Full author contact details are available in file CREDITS. - */ - -#include <config.h> - -#include <boost/assert.hpp> - -#include <cstdlib> -#include <exception> - -using namespace std; - -namespace boost { - -void assertion_failed(char const * /*expr*/, char const * /*function*/, - char const * /*file*/, long /*line*/) -{ - ::abort(); -} - - -void assertion_failed_msg(char const * /*expr*/, char const * /*msg*/, - char const * /*function*/, char const * /*file*/, long /*line*/) -{ - ::abort(); -} - -} // namespace boost diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index d921dbb7c3..366a548b55 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -8,7 +8,7 @@ set(check_layout_SOURCES) foreach(_f insets/InsetLayout.cpp CiteEnginesList.cpp Color.cpp Counters.cpp Floating.cpp FloatList.cpp FontInfo.cpp Layout.cpp LayoutFile.cpp support/Lexer.cpp ModuleList.cpp Spacing.cpp TextClass.cpp tests/check_layout.cpp - tests/boost.cpp tests/dummy_functions.cpp tests/dummy4checklayout.cpp) + tests/dummy_functions.cpp tests/dummy4checklayout.cpp) list(APPEND check_layout_SOURCES "${TOP_SRC_DIR}/src/${_f}") endforeach() @@ -67,7 +67,7 @@ endforeach() set(check_ExternalTransforms_SOURCES) foreach(_f graphics/GraphicsParams.cpp insets/ExternalTransforms.cpp tests/check_ExternalTransforms.cpp - tests/boost.cpp tests/dummy_functions.cpp) + tests/dummy_functions.cpp) list(APPEND check_ExternalTransforms_SOURCES ${TOP_SRC_DIR}/src/${_f}) endforeach() @@ -90,7 +90,7 @@ add_test(NAME "check_ExternalTransforms" add_dependencies(lyx_run_tests check_ExternalTransforms) set(check_Length_SOURCES) -foreach(_f tests/check_Length.cpp tests/boost.cpp tests/dummy_functions.cpp) +foreach(_f tests/check_Length.cpp tests/dummy_functions.cpp) list(APPEND check_Length_SOURCES ${TOP_SRC_DIR}/src/${_f}) endforeach() add_executable(check_Length ${check_Length_SOURCES}) @@ -112,7 +112,7 @@ add_dependencies(lyx_run_tests check_Length) include_directories(${TOP_SRC_DIR}/src/tests) set(check_ListingsCaption_SOURCES) -foreach(_f tests/check_ListingsCaption.cpp tests/boost.cpp tests/dummy_functions.cpp) +foreach(_f tests/check_ListingsCaption.cpp tests/dummy_functions.cpp) list(APPEND check_ListingsCaption_SOURCES ${TOP_SRC_DIR}/src/${_f}) endforeach() add_executable(check_ListingsCaption ${check_ListingsCaption_SOURCES}) diff --git a/src/tests/boost.cpp b/src/tests/boost.cpp deleted file mode 100644 index 3343df4aed..0000000000 --- a/src/tests/boost.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * \file boost.cpp - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Lars Gullik Bjønnes - * - * Full author contact details are available in file CREDITS. - */ - -#include <config.h> - -#include <boost/assert.hpp> - -#include <cstdlib> -#include <exception> - -using namespace std; - -namespace boost { - -void assertion_failed(char const * /*expr*/, char const * /*function*/, - char const * /*file*/, long /*line*/) -{ - ::abort(); -} - - -void assertion_failed_msg(char const * /*expr*/, char const * /*msg*/, - char const * /*function*/, char const * /*file*/, long /*line*/) -{ - ::abort(); -} - -} // namespace boost diff --git a/src/tex2lyx/Makefile.am b/src/tex2lyx/Makefile.am index 896a712083..0c5a044f1b 100644 --- a/src/tex2lyx/Makefile.am +++ b/src/tex2lyx/Makefile.am @@ -110,7 +110,6 @@ LYX_OBJS = \ ../version.o tex2lyx_SOURCES = \ - boost.cpp \ Context.cpp \ Context.h \ dummy_impl.cpp \ diff --git a/src/tex2lyx/boost.cpp b/src/tex2lyx/boost.cpp deleted file mode 100644 index 1b360160a8..0000000000 --- a/src/tex2lyx/boost.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/** - * \file boost.cpp - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Lars Gullik Bjønnes - * - * Full author contact details are available in file CREDITS. - */ - -#include <config.h> - -#include <boost/assert.hpp> - -#include <cstdlib> -#include <exception> -#include <iostream> - -using namespace std; - -namespace boost { - -void assertion_failed(char const * expr, char const * function, - char const * file, long line) -{ - cerr << "Assertion triggered in " << function - << " by failing check \"" << expr << "\"" - << " in file " << file << ":" << line << endl; - ::abort(); -} - -void assertion_failed_msg(char const * expr, char const * msg, - char const * function, char const * file, long line) -{ - cerr << "Assertion triggered in " << function - << " by failing check \"" << expr << "\"" - << " with message \"" << msg << "\"" - << " in file " << file << ":" << line << endl; - - ::abort(); -} - -} // namespace boost -- lyx-cvs mailing list lyx-cvs@lists.lyx.org https://lists.lyx.org/mailman/listinfo/lyx-cvs