From d9ee4d97ced5ca50aab8d877062fa0503c7164d1 Mon Sep 17 00:00:00 2001 From: eidheim Date: Fri, 21 Jul 2017 19:04:05 +0200 Subject: [PATCH] Cleanup: removed support for older libraries --- CMakeLists.txt | 2 +- src/dialogs.cc | 14 -------------- src/directories.cc | 19 ------------------- src/entrybox.cc | 14 -------------- src/git.cc | 21 --------------------- src/info.cc | 14 -------------- src/notebook.cc | 24 +----------------------- src/selection_dialog.cc | 14 -------------- src/source.cc | 18 ------------------ src/source_clang.cc | 16 +--------------- src/source_diff.cc | 14 -------------- src/source_spellcheck.cc | 14 -------------- src/tooltips.cc | 14 -------------- src/window.cc | 16 ---------------- tests/CMakeLists.txt | 2 +- 15 files changed, 4 insertions(+), 212 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 174e495..7cd4bce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A lightweight, platform independent C++-IDE with support for C++11, C++14, and experimental C++17 features depending on libclang version.") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) -set(CPACK_DEBIAN_PACKAGE_DEPENDS "cmake, make, g++, libclang-dev, liblldb-3.5-dev, clang-format-3.5, pkg-config, libboost-system-dev, libboost-filesystem-dev, libgtksourceviewmm-3.0-dev, aspell-en, libaspell-dev, libgit2-dev, exuberant-ctags") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "cmake, make, g++, libclang-3.8-dev, liblldb-3.8-dev, clang-format, pkg-config, libboost-system-dev, libboost-filesystem-dev, libgtksourceviewmm-3.0-dev, aspell-en, libaspell-dev, libgit2-dev, exuberant-ctags") set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/cppit/jucipp") set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) include(CPack) diff --git a/src/dialogs.cc b/src/dialogs.cc index 5a44703..af4549b 100644 --- a/src/dialogs.cc +++ b/src/dialogs.cc @@ -1,20 +1,6 @@ #include "dialogs.h" #include -namespace sigc { -#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE - template - struct functor_trait { - typedef decltype (::sigc::mem_fun(std::declval(), - &Functor::operator())) _intermediate; - typedef typename _intermediate::result_type result_type; - typedef Functor functor_type; - }; -#else - SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE -#endif -} - Dialog::Message::Message(const std::string &text): Gtk::MessageDialog(text, false, Gtk::MessageType::MESSAGE_INFO, Gtk::ButtonsType::BUTTONS_NONE, true) { auto g_application=g_application_get_default(); auto gio_application=Glib::wrap(g_application, true); diff --git a/src/directories.cc b/src/directories.cc index ffbca40..b5085ec 100644 --- a/src/directories.cc +++ b/src/directories.cc @@ -6,20 +6,6 @@ #include "filesystem.h" #include "entrybox.h" -namespace sigc { -#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE - template - struct functor_trait { - typedef decltype (::sigc::mem_fun(std::declval(), - &Functor::operator())) _intermediate; - typedef typename _intermediate::result_type result_type; - typedef Functor functor_type; - }; -#else - SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE -#endif -} - bool Directories::TreeStore::row_drop_possible_vfunc(const Gtk::TreeModel::Path &path, const Gtk::SelectionData &selection_data) const { return true; } @@ -525,12 +511,7 @@ void Directories::add_or_update_path(const boost::filesystem::path &dir_path, co if(path_it==directories.end()) { auto g_file=Glib::wrap(g_file_new_for_path(dir_path.string().c_str())); //TODO: report missing constructor in giomm - -#if GLIBMM_MAJOR_VERSION>2 || (GLIBMM_MAJOR_VERSION==2 && GLIBMM_MINOR_VERSION>=45) auto monitor=g_file->monitor_directory(Gio::FileMonitorFlags::FILE_MONITOR_WATCH_MOVES); -#else - auto monitor=g_file->monitor_directory(Gio::FileMonitorFlags::FILE_MONITOR_SEND_MOVED); -#endif auto path_and_row=std::make_shared >(dir_path, row); auto connection=std::make_shared(); diff --git a/src/entrybox.cc b/src/entrybox.cc index eda6f42..b5cd663 100644 --- a/src/entrybox.cc +++ b/src/entrybox.cc @@ -1,19 +1,5 @@ #include "entrybox.h" -namespace sigc { -#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE - template - struct functor_trait { - typedef decltype (::sigc::mem_fun(std::declval(), - &Functor::operator())) _intermediate; - typedef typename _intermediate::result_type result_type; - typedef Functor functor_type; - }; -#else - SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE -#endif -} - std::unordered_map > EntryBox::entry_histories; EntryBox::Entry::Entry(const std::string& content, std::function on_activate, unsigned width_chars) : Gtk::Entry(), on_activate(on_activate) { diff --git a/src/git.cc b/src/git.cc index 901bca4..1f6490f 100644 --- a/src/git.cc +++ b/src/git.cc @@ -46,11 +46,7 @@ Git::Repository::Diff::Lines Git::Repository::Diff::get_lines(const std::string Lines lines; Error error; std::lock_guard lock(mutex); -#if LIBGIT2_SOVERSION>=23 error.code=git_diff_blob_to_buffer(blob.get(), nullptr, buffer.c_str(), buffer.size(), nullptr, &options, nullptr, nullptr, hunk_cb, nullptr, &lines); -#else - error.code=git_diff_blob_to_buffer(blob.get(), nullptr, buffer.c_str(), buffer.size(), nullptr, &options, nullptr, hunk_cb, nullptr, &lines); -#endif if(error) throw std::runtime_error(error.message()); return lines; @@ -74,11 +70,7 @@ std::string Git::Repository::Diff::get_details(const std::string &buffer, int li details.second=line_nr; Error error; std::lock_guard lock(mutex); -#if LIBGIT2_SOVERSION>=23 error.code=git_diff_blob_to_buffer(blob.get(), nullptr, buffer.c_str(), buffer.size(), nullptr, &options, nullptr, nullptr, nullptr, line_cb, &details); -#else - error.code=git_diff_blob_to_buffer(blob.get(), nullptr, buffer.c_str(), buffer.size(), nullptr, &options, nullptr, nullptr, line_cb, &details); -#endif if(error) throw std::runtime_error(error.message()); return details.first; @@ -102,12 +94,7 @@ Git::Repository::Repository(const boost::filesystem::path &path) { auto git_path_str=get_path().string(); auto git_directory=Glib::wrap(g_file_new_for_path(git_path_str.c_str())); //TODO: report missing constructor in giomm -#if GLIBMM_MAJOR_VERSION>2 || (GLIBMM_MAJOR_VERSION==2 && GLIBMM_MINOR_VERSION>=45) monitor=git_directory->monitor_directory(Gio::FileMonitorFlags::FILE_MONITOR_WATCH_MOVES); -#else - monitor=git_directory->monitor_directory(Gio::FileMonitorFlags::FILE_MONITOR_SEND_MOVED); -#endif - monitor_changed_connection=monitor->signal_changed().connect([this](const Glib::RefPtr &file, const Glib::RefPtr&, Gio::FileMonitorEvent monitor_event) { @@ -150,16 +137,12 @@ int Git::Repository::status_callback(const char *path, unsigned int status_flags status=STATUS::RENAMED; else if((status_flags&(GIT_STATUS_INDEX_TYPECHANGE|GIT_STATUS_WT_TYPECHANGE))>0) status=STATUS::TYPECHANGE; -#if LIBGIT2_SOVERSION>=23 else if((status_flags&(GIT_STATUS_WT_UNREADABLE))>0) status=STATUS::UNREADABLE; -#endif else if((status_flags&(GIT_STATUS_IGNORED))>0) status=STATUS::IGNORED; -#if LIBGIT2_SOVERSION>=23 else if((status_flags&(GIT_STATUS_CONFLICTED))>0) status=STATUS::CONFLICTED; -#endif else status=STATUS::CURRENT; @@ -266,11 +249,7 @@ std::string Git::Repository::get_branch() noexcept { void Git::initialize() noexcept { std::lock_guard lock(mutex); if(!initialized) { -#if LIBGIT2_SOVERSION>=22 git_libgit2_init(); -#else - git_threads_init(); -#endif initialized=true; } } diff --git a/src/info.cc b/src/info.cc index 043df5f..90f752f 100644 --- a/src/info.cc +++ b/src/info.cc @@ -1,19 +1,5 @@ #include "info.h" -namespace sigc { -#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE - template - struct functor_trait { - typedef decltype (::sigc::mem_fun(std::declval(), - &Functor::operator())) _intermediate; - typedef typename _intermediate::result_type result_type; - typedef Functor functor_type; - }; -#else - SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE -#endif -} - Info::Info() { set_hexpand(false); set_halign(Gtk::Align::ALIGN_END); diff --git a/src/notebook.cc b/src/notebook.cc index 9cb1c31..59747f8 100644 --- a/src/notebook.cc +++ b/src/notebook.cc @@ -6,24 +6,7 @@ #include "project.h" #include "filesystem.h" #include "selection_dialog.h" - -#if GTKSOURCEVIEWMM_MAJOR_VERSION > 3 || (GTKSOURCEVIEWMM_MAJOR_VERSION == 3 && GTKSOURCEVIEWMM_MINOR_VERSION >= 18) #include "gtksourceview-3.0/gtksourceview/gtksourcemap.h" -#endif - -namespace sigc { -#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE - template - struct functor_trait { - typedef decltype (::sigc::mem_fun(std::declval(), - &Functor::operator())) _intermediate; - typedef typename _intermediate::result_type result_type; - typedef Functor functor_type; - }; -#else - SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE -#endif -} Notebook::TabLabel::TabLabel(const boost::filesystem::path &path, std::function on_close) { set_can_focus(false); @@ -290,10 +273,9 @@ void Notebook::open(const boost::filesystem::path &file_path_, size_t notebook_i scrolled_windows.back()->add(*source_views.back()); hboxes.back()->pack_start(*scrolled_windows.back()); -#if GTKSOURCEVIEWMM_MAJOR_VERSION > 3 || (GTKSOURCEVIEWMM_MAJOR_VERSION == 3 && GTKSOURCEVIEWMM_MINOR_VERSION >= 18) source_maps.emplace_back(Glib::wrap(gtk_source_map_new())); gtk_source_map_set_view(GTK_SOURCE_MAP(source_maps.back()->gobj()), source_views.back()->gobj()); -#endif + configure(source_views.size()-1); //Set up tab label @@ -436,7 +418,6 @@ void Notebook::open(const boost::filesystem::path &file_path_, size_t notebook_i } void Notebook::configure(size_t index) { -#if GTKSOURCEVIEWMM_MAJOR_VERSION > 3 || (GTKSOURCEVIEWMM_MAJOR_VERSION == 3 && GTKSOURCEVIEWMM_MINOR_VERSION >= 18) auto source_font_description=Pango::FontDescription(Config::get().source.font); auto source_map_font_desc=Pango::FontDescription(static_cast(source_font_description.get_family())+" "+Config::get().source.map_font_size); source_maps.at(index)->override_font(source_map_font_desc); @@ -446,7 +427,6 @@ void Notebook::configure(size_t index) { } else if(hboxes.at(index)->get_children().size()==2) hboxes.at(index)->remove(*source_maps.at(index)); -#endif } bool Notebook::save(size_t index) { @@ -520,9 +500,7 @@ bool Notebook::close(size_t index) { auto notebook_page=get_notebook_page(index); notebooks[notebook_page.first].remove_page(notebook_page.second); -#if GTKSOURCEVIEWMM_MAJOR_VERSION > 3 || (GTKSOURCEVIEWMM_MAJOR_VERSION == 3 && GTKSOURCEVIEWMM_MINOR_VERSION >= 18) source_maps.erase(source_maps.begin()+index); -#endif if(on_close_page) on_close_page(view); diff --git a/src/selection_dialog.cc b/src/selection_dialog.cc index 94bdfce..116068d 100644 --- a/src/selection_dialog.cc +++ b/src/selection_dialog.cc @@ -1,20 +1,6 @@ #include "selection_dialog.h" #include -namespace sigc { -#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE - template - struct functor_trait { - typedef decltype (::sigc::mem_fun(std::declval(), - &Functor::operator())) _intermediate; - typedef typename _intermediate::result_type result_type; - typedef Functor functor_type; - }; -#else - SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE -#endif -} - SelectionDialogBase::ListViewText::ListViewText(bool use_markup) : Gtk::TreeView(), use_markup(use_markup) { list_store = Gtk::ListStore::create(column_record); set_model(list_store); diff --git a/src/source.cc b/src/source.cc index 8ff9921..5f543be 100644 --- a/src/source.cc +++ b/src/source.cc @@ -15,20 +15,6 @@ #include #include -namespace sigc { -#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE - template - struct functor_trait { - typedef decltype (::sigc::mem_fun(std::declval(), - &Functor::operator())) _intermediate; - typedef typename _intermediate::result_type result_type; - typedef Functor functor_type; - }; -#else - SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE -#endif -} - Glib::RefPtr Source::guess_language(const boost::filesystem::path &file_path) { auto language_manager=Gsv::LanguageManager::get_default(); bool result_uncertain = false; @@ -720,12 +706,10 @@ void Source::View::configure() { property_show_line_numbers() = Config::get().source.show_line_numbers; if(Config::get().source.font.size()>0) override_font(Pango::FontDescription(Config::get().source.font)); -#if GTKSOURCEVIEWMM_MAJOR_VERSION > 3 || (GTKSOURCEVIEWMM_MAJOR_VERSION == 3 && GTKSOURCEVIEWMM_MINOR_VERSION >= 16) if(Config::get().source.show_background_pattern) gtk_source_view_set_background_pattern(this->gobj(), GTK_SOURCE_BACKGROUND_PATTERN_TYPE_GRID); else gtk_source_view_set_background_pattern(this->gobj(), GTK_SOURCE_BACKGROUND_PATTERN_TYPE_NONE); -#endif //Create tags for diagnostic warnings and errors: auto scheme = get_source_buffer()->get_style_scheme(); @@ -762,9 +746,7 @@ void Source::View::configure() { error_property=style->property_background().get_value(); diagnostic_tag_underline->property_underline()=Pango::Underline::UNDERLINE_ERROR; -#if GTK_VERSION_GE(3, 16) diagnostic_tag_underline->set_property("underline-rgba", Gdk::RGBA(error_property)); -#endif } //TODO: clear tag_class and param_spec? diff --git a/src/source_clang.cc b/src/source_clang.cc index 26be942..a2fd301 100644 --- a/src/source_clang.cc +++ b/src/source_clang.cc @@ -11,20 +11,6 @@ #include "selection_dialog.h" #include "filesystem.h" -namespace sigc { -#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE - template - struct functor_trait { - typedef decltype (::sigc::mem_fun(std::declval(), - &Functor::operator())) _intermediate; - typedef typename _intermediate::result_type result_type; - typedef Functor functor_type; - }; -#else - SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE -#endif -} - clangmm::Index Source::ClangViewParse::clang_index(0, 0); Source::ClangViewParse::ClangViewParse(const boost::filesystem::path &file_path, Glib::RefPtr language): @@ -227,7 +213,7 @@ std::vector Source::ClangViewParse::get_compilation_commands() { auto clang_version=sm[1].str(); arguments.emplace_back("-I/usr/lib/clang/"+clang_version+"/include"); arguments.emplace_back("-I/usr/lib64/clang/"+clang_version+"/include"); // For Fedora -#if defined(__APPLE__) && CINDEX_VERSION_MAJOR==0 && CINDEX_VERSION_MINOR<32 +#if defined(__APPLE__) && CINDEX_VERSION_MAJOR==0 && CINDEX_VERSION_MINOR<32 // TODO: remove during 2018 if llvm3.7 is no longer in homebrew (CINDEX_VERSION_MINOR=32 equals clang-3.8 I think) arguments.emplace_back("-I/usr/local/Cellar/llvm/"+clang_version+"/lib/clang/"+clang_version+"/include"); arguments.emplace_back("-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1"); arguments.emplace_back("-I/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1"); //Added for OS X 10.11 diff --git a/src/source_diff.cc b/src/source_diff.cc index 0cbd637..1b46118 100644 --- a/src/source_diff.cc +++ b/src/source_diff.cc @@ -5,20 +5,6 @@ #include "info.h" #include -namespace sigc { -#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE - template - struct functor_trait { - typedef decltype (::sigc::mem_fun(std::declval(), - &Functor::operator())) _intermediate; - typedef typename _intermediate::result_type result_type; - typedef Functor functor_type; - }; -#else - SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE -#endif -} - Source::DiffView::Renderer::Renderer() : Gsv::GutterRenderer() { set_padding(4, 0); } diff --git a/src/source_spellcheck.cc b/src/source_spellcheck.cc index cb60a03..24e1aac 100644 --- a/src/source_spellcheck.cc +++ b/src/source_spellcheck.cc @@ -4,20 +4,6 @@ #include "selection_dialog.h" #include -namespace sigc { -#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE - template - struct functor_trait { - typedef decltype (::sigc::mem_fun(std::declval(), - &Functor::operator())) _intermediate; - typedef typename _intermediate::result_type result_type; - typedef Functor functor_type; - }; -#else - SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE -#endif -} - AspellConfig* Source::SpellCheckView::spellcheck_config=nullptr; Source::SpellCheckView::SpellCheckView() : Gsv::View() { diff --git a/src/tooltips.cc b/src/tooltips.cc index b07ca36..e73d5d7 100644 --- a/src/tooltips.cc +++ b/src/tooltips.cc @@ -1,20 +1,6 @@ #include "tooltips.h" #include "selection_dialog.h" -namespace sigc { -#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE - template - struct functor_trait { - typedef decltype (::sigc::mem_fun(std::declval(), - &Functor::operator())) _intermediate; - typedef typename _intermediate::result_type result_type; - typedef Functor functor_type; - }; -#else - SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE -#endif -} - Gdk::Rectangle Tooltips::drawn_tooltips_rectangle=Gdk::Rectangle(); Tooltip::Tooltip(std::function()> create_tooltip_buffer, Gtk::TextView *text_view, diff --git a/src/window.cc b/src/window.cc index f6d514a..8d25f90 100644 --- a/src/window.cc +++ b/src/window.cc @@ -11,20 +11,6 @@ #include "ctags.h" #include "selection_dialog.h" -namespace sigc { -#ifndef SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE - template - struct functor_trait { - typedef decltype (::sigc::mem_fun(std::declval(), - &Functor::operator())) _intermediate; - typedef typename _intermediate::result_type result_type; - typedef Functor functor_type; - }; -#else - SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE -#endif -} - Window::Window() { set_title("juCi++"); set_events(Gdk::POINTER_MOTION_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::SCROLL_MASK|Gdk::LEAVE_NOTIFY_MASK); @@ -93,9 +79,7 @@ Window::Window() { auto overlay=Gtk::manage(new Gtk::Overlay()); overlay->add(*vbox); overlay->add_overlay(*overlay_hbox); -#if GTKMM_MAJOR_VERSION>3 || (GTKMM_MAJOR_VERSION==3 && GTKMM_MINOR_VERSION>=18) overlay->set_overlay_pass_through(*overlay_hbox, true); -#endif add(*overlay); show_all_children(); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1837a07..086f345 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -54,7 +54,7 @@ add_executable(source_key_test source_key_test.cc target_link_libraries(source_key_test ${global_libraries}) add_test(source_key_test source_key_test) -if(LIBLLDB_FOUND AND (NOT LIBCLANG_LIBRARIES STREQUAL "/usr/lib/llvm-3.5/lib/libclang.so")) +if(LIBLLDB_FOUND) add_executable(lldb_test lldb_test.cc $ $) target_link_libraries(lldb_test ${global_libraries})