diff --git a/Makefile.am b/Makefile.am index 8dd514f..079fb53 100644 --- a/Makefile.am +++ b/Makefile.am @@ -347,6 +347,7 @@ bin_PROGRAMS += sgpemv2 sgpemv2_CPPFLAGS = \ -I@top_srcdir@ \ -I@top_srcdir@/src/backend \ + -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED \ -DEXAMPLESDIR="\"$(examplesdir)\"" \ -DLOCALEDIR="\"$(localedir)\"" \ -DSHAREDIR="\"$(sharedir)\"" \ diff --git a/configure.ac b/configure.ac index 10c6c85..70fc814 100644 --- a/configure.ac +++ b/configure.ac @@ -44,6 +44,7 @@ AC_CANONICAL_TARGET dnl starting automake AM_INIT_AUTOMAKE([dejagnu dist-bzip2 subdir-objects]) +AM_SILENT_RULES([yes]) dnl HACK to avoid multiple definition of macros when dnl including spgemv2-config.h (autoheader generated) @@ -66,7 +67,8 @@ AC_CHECK_CXXFLAG([CXXFLAGS], [Wall]) AC_CHECK_CXXFLAG([CXXFLAGS], [pedantic]) AC_CHECK_CXXFLAG([CXXFLAGS], [Wextra]) AC_CHECK_CXXFLAG([CXXFLAGS], [Wno-long-long]) -AC_CHECK_LDFLAG([LDFLAGS],[--as-needed]) +AC_CHECK_CXXFLAG([CXXFLAGS], [Wno-strict-aliasing]) +AC_CHECK_LDFLAG([LDFLAGS], [--as-needed]) dnl see if we've to enable debug flags AC_ARG_ENABLE([debug], @@ -86,7 +88,7 @@ AC_ARG_ENABLE([visibility-support], AS_HELP_STRING([--enable-visibility-support], [enable the new GCC visibility support; requires GCC >= 4.0 to work.]), [enable_gcc_visibility="$enableval"], - [enable_gcc_visibility="no"]) + [enable_gcc_visibility="yes"]) AC_MSG_CHECKING([whether to use new GCC visibility attributes]) AC_MSG_RESULT([$enable_gcc_visibility]) if test "x$enable_gcc_visibility" = "xno"; then diff --git a/plugins/pyloader/configure.ac b/plugins/pyloader/configure.ac index a515a57..2493bed 100644 --- a/plugins/pyloader/configure.ac +++ b/plugins/pyloader/configure.ac @@ -44,6 +44,7 @@ AC_CANONICAL_TARGET dnl starting automake AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects]) +AM_SILENT_RULES([yes]) dnl gettext & libtool LT_INIT @@ -86,7 +87,7 @@ AC_ARG_ENABLE([visibility-support], AS_HELP_STRING([--enable-visibility-support], [enable the new GCC visibility support; requires GCC >= 4.0 to work.]), [enable_gcc_visibility="$enableval"], - [enable_gcc_visibility="no"]) + [enable_gcc_visibility="yes"]) AC_MSG_CHECKING([whether to use new GCC visibility attributes]) AC_MSG_RESULT([$enable_gcc_visibility]) if test "x$enable_gcc_visibility" = "xno"; then diff --git a/plugins/pyloader/src/python_cpu_policy.cc b/plugins/pyloader/src/python_cpu_policy.cc index a1fdbca..072e07f 100644 --- a/plugins/pyloader/src/python_cpu_policy.cc +++ b/plugins/pyloader/src/python_cpu_policy.cc @@ -88,8 +88,9 @@ PythonCPUPolicy::PythonCPUPolicy(const char* name) throw(MalformedPolicyExceptio // Now takes the user-defined policy class from pUserCPUPolicyDict PyObject* pCPUPolicyClass = PyDict_GetItemString(_upolicy_dict, name); if (pCPUPolicyClass == NULL) - throw MalformedPolicyException(Glib::ustring(_("Cannot find a class named ")) + - name + _(" into the corresponding .py file.")); + throw new MalformedPolicyException (Glib::ustring::compose ( + _("Cannot find a class named %1 into the corresponding .py file."), + name)); // Retrieve a description for the policy using the __doc__ attribute PyObject* pDescriptionString = PyObject_GetAttrString(pCPUPolicyClass, "__doc__"); diff --git a/plugins/xmlsave/configure.ac b/plugins/xmlsave/configure.ac index 78ea068..7943e1e 100644 --- a/plugins/xmlsave/configure.ac +++ b/plugins/xmlsave/configure.ac @@ -44,6 +44,7 @@ AC_CANONICAL_TARGET dnl starting automake AM_INIT_AUTOMAKE([dejagnu dist-bzip2 subdir-objects]) +AM_SILENT_RULES([yes]) dnl gettext & libtool AC_PROG_LIBTOOL @@ -83,7 +84,7 @@ AC_ARG_ENABLE([visibility-support], AS_HELP_STRING([--enable-visibility-support], [enable the new GCC visibility support; requires GCC >= 4.0 to work.]), [enable_gcc_visibility="$enableval"], - [enable_gcc_visibility="no"]) + [enable_gcc_visibility="yes"]) AC_MSG_CHECKING([whether to use new GCC visibility attributes]) AC_MSG_RESULT([$enable_gcc_visibility]) if test "x$enable_gcc_visibility" = "xno"; then diff --git a/plugins/xmlsave/src/xml_serializer.cc b/plugins/xmlsave/src/xml_serializer.cc index c1729a6..75ee6fc 100644 --- a/plugins/xmlsave/src/xml_serializer.cc +++ b/plugins/xmlsave/src/xml_serializer.cc @@ -137,7 +137,7 @@ void XMLSerializer::fill_doc(xmlDocPtr doc, const History& hist) /* * Creates a DTD declaration. Isn't mandatory. */ - xmlDtdPtr dtd = xmlCreateIntSubset(doc, (const xmlChar *) "sgpem", NULL, (const xmlChar *) "sgpem.dtd"); + /* xmlDtdPtr dtd = */ xmlCreateIntSubset(doc, (const xmlChar *) "sgpem", NULL, (const xmlChar *) "sgpem.dtd"); //TODO: check for DTD compliance?? diff --git a/src/add_request_dialog.cc b/src/add_request_dialog.cc index d61cd85..4c57db1 100644 --- a/src/add_request_dialog.cc +++ b/src/add_request_dialog.cc @@ -233,13 +233,13 @@ AddRequestDialog::_on_list_selection_changed() } void -AddRequestDialog::_on_row_added(const Gtk::TreePath& path, const Gtk::TreeIter& it) +AddRequestDialog::_on_row_added(const Gtk::TreePath&, const Gtk::TreeIter&) { _ok_button->set_sensitive(true); } void -AddRequestDialog::_on_row_removed(const Gtk::TreePath& path) +AddRequestDialog::_on_row_removed(const Gtk::TreePath&) { _ok_button->set_sensitive(static_cast(_list_model->children())); } diff --git a/src/backend/module.cc b/src/backend/module.cc index 4e11560..49772f3 100644 --- a/src/backend/module.cc +++ b/src/backend/module.cc @@ -17,9 +17,6 @@ // You should have received a copy of the GNU General Public License // along with SGPEMv2. If not, see http://www.gnu.org/licenses/. - - - #include using namespace sgpem; @@ -39,12 +36,12 @@ Module::Module(const Glib::ustring& identifier) throw(InvalidPluginException) : // Type-safeness here is an optional, as always. :-) std::string prefix = "sgpem__Plugin__"; - if (!(get_symbol(prefix + "on_init", (void*&) on_init_ptr) && - get_symbol(prefix + "on_exit", (void*&) on_exit_ptr) && - get_symbol(prefix + "describe", (void*&) describe_ptr) && - get_symbol(prefix + "get_name", (void*&) get_name_ptr) && - get_symbol(prefix + "get_author", (void*&) get_author_ptr) && - get_symbol(prefix + "get_version", (void*&) get_version_ptr))) + if (!(get_symbol(prefix + "on_init", reinterpret_cast(on_init_ptr)) && + get_symbol(prefix + "on_exit", reinterpret_cast(on_exit_ptr)) && + get_symbol(prefix + "describe", reinterpret_cast(describe_ptr)) && + get_symbol(prefix + "get_name", reinterpret_cast(get_name_ptr)) && + get_symbol(prefix + "get_author", reinterpret_cast(get_author_ptr)) && + get_symbol(prefix + "get_version", reinterpret_cast(get_version_ptr)))) throw InvalidPluginException("incomplete/wrong exported interface"); } diff --git a/src/backend/serializers_gatekeeper.cc b/src/backend/serializers_gatekeeper.cc index 5640c4b..adc14b1 100644 --- a/src/backend/serializers_gatekeeper.cc +++ b/src/backend/serializers_gatekeeper.cc @@ -35,7 +35,7 @@ using std::runtime_error; using namespace sgpem; // Explicit template instantiation to allow to export symbols from the DSO. -template class SG_DLLEXPORT Singleton; +template class Singleton; typedef vector::iterator SerializerIterator; diff --git a/src/backend/sgpemv2/templates/singleton.hh b/src/backend/sgpemv2/templates/singleton.hh index 1692af5..ed45690 100644 --- a/src/backend/sgpemv2/templates/singleton.hh +++ b/src/backend/sgpemv2/templates/singleton.hh @@ -32,7 +32,7 @@ namespace sgpem * thread-safeness. */ template - class SG_DLLEXPORT Singleton + class Singleton { public: diff --git a/src/gui_builder.cc b/src/gui_builder.cc index 320b363..0a14957 100644 --- a/src/gui_builder.cc +++ b/src/gui_builder.cc @@ -217,14 +217,15 @@ GuiBuilder::open_file(const std::string& basedir) sim.stop(); // It would work anyhow, but it'd look strange History& history = sim.get_history(); serializer.restore_snapshot(_filename, history); - msg = _("File: ") + _filename + _(" loaded."); + msg = Glib::ustring::compose (_("File: %1 loaded."), _filename); } // end - if(result==Gtk::RESPONSE_OK) } catch (std::out_of_range e) { Gtk::MessageDialog error(get_initial_window(), - _("No serializer available.\nThere's no registered serializer. Please check the loaded plugins."), + _("No serializer available.\nThere's no " + "registered serializer. Please check the loaded plugins."), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); error.run(); msg = _("ERROR: No registered serializer available"); diff --git a/src/parse_opts.cc b/src/parse_opts.cc index 9ef35d0..83160d8 100644 --- a/src/parse_opts.cc +++ b/src/parse_opts.cc @@ -165,8 +165,9 @@ parse_options(int argc, char** argv) } // ~ try catch (Glib::OptionError e) { - std::cout << _("Bad invocation: ") << e.what() << std::endl; - std::cout << _("Use the `-?' or `--help' option to see the help") << std::endl; + std::cout << Glib::ustring::compose (_("Bad invocation: %1\nUse the `-?' " + "or `--help' option to see the help."), + e.what()) << std::endl; } } diff --git a/src/resources_widget.cc b/src/resources_widget.cc index 6922276..26424ef 100644 --- a/src/resources_widget.cc +++ b/src/resources_widget.cc @@ -51,7 +51,7 @@ ResourcesWidget::CellRendererTextMarkup::_property_renderable() return Glib::PropertyProxy_Base(this, "markup"); } -ResourcesWidget::ResourcesWidget(BaseObjectType* cobject, const RefPtr& ui) : +ResourcesWidget::ResourcesWidget(BaseObjectType* cobject, const RefPtr&) : TreeView(cobject), _add_resource_dialog_ui(Builder::create_from_file(UIDIR "/add-resource-dialog.ui")) { diff --git a/src/schedulables_tree_widget.cc b/src/schedulables_tree_widget.cc index a6a0c29..a0fdeea 100644 --- a/src/schedulables_tree_widget.cc +++ b/src/schedulables_tree_widget.cc @@ -269,7 +269,7 @@ SchedulablesTreeWidget::_update_expanded_vector(Gtk::TreeView*, const Gtk::TreeM } void -SchedulablesTreeWidget::update(const History& history) +SchedulablesTreeWidget::update(const History&) { using std::vector; @@ -642,9 +642,8 @@ SchedulablesTreeWidget::markup_schedulable(const Schedulable& s) oss << "" << Markup::escape_text(s.get_name()) << "" - << _(" (") << s.get_elapsed_time() - << _("/") << s.get_total_cpu_time() << ")" - << _(", current priority: ") << s.get_current_priority() + << Glib::ustring::compose(_(" (%1/%2), current_priority: %3"), + s.get_elapsed_time(), s.get_total_cpu_time(), s.get_current_priority()) << ""; return oss.str(); diff --git a/src/simulation_controller.cc b/src/simulation_controller.cc index 0bc8f94..411eff3 100644 --- a/src/simulation_controller.cc +++ b/src/simulation_controller.cc @@ -195,14 +195,14 @@ SimulationController::run_simulation_adaptor() catch(const UserInterruptException& uie) { // Show the user a dialog - MessageDialog diag(_("The selected user CPU policy stopped before returning:\n") + Markup::escape_text(uie.what()), + MessageDialog diag (_("The selected user CPU policy stopped before returning:\n") + Markup::escape_text(uie.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); diag.run(); } catch(const MalformedPolicyException& mpe) { // Show user a dialog - MessageDialog diag(_("The selected user CPU policy was malformed and failed to sort the queue:\n") + + MessageDialog diag (_("The selected user CPU policy was malformed and failed to sort the queue:\n") + Markup::escape_text(mpe.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); diag.run(); @@ -214,8 +214,9 @@ SimulationController::run_simulation_adaptor() catch(const CPUPolicyException& cpe) { // Fatal error. We should never get here. - std::cerr << _(" [EE] Fatal error. Impossible to deactivate the policy in ") << __FILE__ << ":" << __LINE__ - << std::endl << _(" [EE] ") << cpe.what() << std::endl; + std::cerr << Glib::ustring::compose( + _(" [EE] Fatal error. Impossible to deactivate the policy in file %1:%2"), __FILE__, __LINE__) + << std::endl << _(" [EE] ") << cpe.what() << std::endl; ; abort(); } diff --git a/src/testsuite/test-cairo_widget.cc b/src/testsuite/test-cairo_widget.cc index 40d0ebc..e73a7c0 100644 --- a/src/testsuite/test-cairo_widget.cc +++ b/src/testsuite/test-cairo_widget.cc @@ -81,7 +81,7 @@ TestWidget::~TestWidget() } bool -TestWidget::on_button_press_event(GdkEventButton* event) +TestWidget::on_button_press_event(GdkEventButton*) { std::cout << " on_button_press_event " << std::endl; change_scaling_mode(); @@ -151,7 +151,7 @@ TestWidget::draw_widget(cairo_t* ctx) void -TestWidget::calc_drawing_size(cairo_t* ctx, size_t& width, size_t& height) +TestWidget::calc_drawing_size(cairo_t*, size_t& width, size_t& height) { width = _desired_w; height = _desired_h; diff --git a/src/testsuite/test-history.cc b/src/testsuite/test-history.cc index 4d16463..7035ed4 100644 --- a/src/testsuite/test-history.cc +++ b/src/testsuite/test-history.cc @@ -44,7 +44,7 @@ class DummyObserver : public HistoryObserver { public: DummyObserver() : _i(0) {} - void update(const History& history) + void update(const History&) { cout << "Observer.update() : " << ++_i << endl; } @@ -136,7 +136,7 @@ find_thread(const ConcreteEnvironment& env, const Thread& _thread) } int -main(int argc, char** argv) +main(int, char**) { ostream& info = cout; ostream& test = cerr; @@ -217,7 +217,7 @@ main(int argc, char** argv) threads[2].arrival_time, threads[2].base_priority); - DynamicThread& p2_2 = h.add_thread(threads[3].name, + /*DynamicThread& p2_2 = */ h.add_thread(threads[3].name, *threads[3].parent, threads[3].cpu_time, threads[3].arrival_time, @@ -256,7 +256,7 @@ main(int argc, char** argv) { &req2, res1.first, 1 } }; - const DynamicSubRequest& sreq1 = h.add_subrequest(*subrequests[0].request, +/*const DynamicSubRequest& sreq1 = */ h.add_subrequest(*subrequests[0].request, subrequests[0].resource_key, subrequests[0].duration); @@ -264,7 +264,7 @@ main(int argc, char** argv) subrequests[1].resource_key, subrequests[1].duration); - const DynamicSubRequest& sreq3 = h.add_subrequest(*subrequests[2].request, + /* const DynamicSubRequest& sreq3 = */ h.add_subrequest(*subrequests[2].request, subrequests[2].resource_key, subrequests[2].duration); @@ -421,7 +421,7 @@ main(int argc, char** argv) ThreadCreationData p1_3_d = { "p1_3", &p1, 3, 4, 0 }; - Thread& p1_3 = h.add_thread(p1_3_d.name, + /* Thread& p1_3 = */ h.add_thread(p1_3_d.name, *p1_3_d.parent, p1_3_d.cpu_time, p1_3_d.arrival_time, diff --git a/src/testsuite/test-simulation_widget.cc b/src/testsuite/test-simulation_widget.cc index e278fc4..841ff2f 100644 --- a/src/testsuite/test-simulation_widget.cc +++ b/src/testsuite/test-simulation_widget.cc @@ -102,9 +102,9 @@ public: ReadyQueue* sl = Scheduler::get_instance().get_ready_queue(); if(sl && sl->size()>=2) { - for (int i = 0; i < sl->size(); i++) + for (guint i = 0; i < sl->size(); i++) { - for (int j = 0; j < sl->size() - 1; j++) + for (guint j = 0; j < sl->size() - 1; j++) { if ( (sl->get_item_at(j).get_current_priority() < sl->get_item_at(j + 1).get_current_priority()) || ((sl->get_item_at(j).get_current_priority() == sl->get_item_at(j + 1).get_current_priority()) @@ -247,7 +247,6 @@ protected: virtual bool on_timer_timeout(); // TestWidget _test_widget; - SimulationWidget _simulation_widget; Gtk::Button _start_button; Gtk::Button _stop_button; Gtk::Button _pause_button; @@ -255,6 +254,7 @@ protected: Gtk::HBox _buttons_box; Gtk::VBox _main_box; Gtk::ScrolledWindow _scroller; + SimulationWidget _simulation_widget; Simulation::state _sim_state; }; @@ -407,7 +407,7 @@ int main(int argc, char** argv) { ostream& info = cout; - ostream& test = cerr; + /*ostream& test = cerr;*/ Gtk::Main kit(argc, argv); @@ -493,7 +493,7 @@ void fillHistory(History &hist) Thread& p1_t1 = hist.add_thread(Glib::ustring("P1 - Thread 1"), p1, 14, 0, 2); // add a thread - name, parent, cpu time, arrival time, priority - Thread& p1_t2 = hist.add_thread(Glib::ustring("P1 - Thread 2"), p1, 8, 0, 5); + /* Thread& p1_t2 = */ hist.add_thread(Glib::ustring("P1 - Thread 2"), p1, 8, 0, 5); // add a thread - name, parent, cpu time, arrival time, priority Thread& p2_t1 = hist.add_thread(Glib::ustring("P2 - Thread 1"), p2, 20, 0, 2); @@ -502,31 +502,31 @@ void fillHistory(History &hist) Thread& p3_t1 = hist.add_thread(Glib::ustring("P3 - Thread 2"), p3, 12, 0, 2); // add a thread - name, parent, cpu time, arrival time, priority - Thread& p4_t1 = hist.add_thread(Glib::ustring("P4 - Thread 1"), p4, 3, 0, 2); + /* Thread& p4_t1 = */ hist.add_thread(Glib::ustring("P4 - Thread 1"), p4, 3, 0, 2); // add a request - Thread, time Request& req1 = hist.add_request(p1_t1, 3); // add a sub request - Request, resource_key, duration, places - SubRequest& req1_sub1 = hist.add_subrequest(req1, respair.first, 6); + /* SubRequest& req1_sub1 = */ hist.add_subrequest(req1, respair.first, 6); // add a request - Thread, time Request& req2 = hist.add_request(p2_t1, 1); // add a sub request - Request, resource_key, duration, places - SubRequest& req2_sub1 = hist.add_subrequest(req2, respair.first, 4); + /* SubRequest& req2_sub1 = */ hist.add_subrequest(req2, respair.first, 4); // add a request - Thread, time Request& req3 = hist.add_request(p3_t1, 0); // add a sub request - Request, resource_key, duration, places - SubRequest& req3_sub1 = hist.add_subrequest(req3, respair.first, 5); + /* SubRequest& req3_sub1 = */ hist.add_subrequest(req3, respair.first, 5); // add a request - Thread, time Request& req3bis = hist.add_request(p3_t1, 7); // add a sub request - Request, resource_key, duration, places - SubRequest& req3bis_sub1 = hist.add_subrequest(req3bis, respair.first, 5); + /* SubRequest& req3bis_sub1 = */ hist.add_subrequest(req3bis, respair.first, 5); } @@ -536,19 +536,16 @@ Glib::ustring get_schedulable_state_name(Schedulable::state st) { case Schedulable::state_running: return Glib::ustring("Schedulable::state_running"); - break; case Schedulable::state_ready: return Glib::ustring("Schedulable::state_ready"); - break; case Schedulable::state_blocked: return Glib::ustring("Schedulable::state_blocked"); - break; case Schedulable::state_future: return Glib::ustring("Schedulable::state_future"); - break; case Schedulable::state_terminated: return Glib::ustring("Schedulable::state_terminated"); - break; + default: + return Glib::ustring("Unhandled Schedulable::state!"); } } @@ -558,19 +555,16 @@ Glib::ustring get_request_state_name(Request::state st) { case Request::state_unallocable: return Glib::ustring("state_unallocable"); - break; case Request::state_allocated: return Glib::ustring("state_allocated"); - break; case Request::state_future: return Glib::ustring("state_future"); - break; case Request::state_exhausted: return Glib::ustring("state_exhausted"); - break; case Request::state_allocable: return Glib::ustring("state_allocable"); - break; + default: + return Glib::ustring("Unhandled Request::state!"); } } @@ -581,13 +575,12 @@ Glib::ustring get_simulation_state_name(Simulation::state st) { case Simulation::state_running: return Glib::ustring("Simulation::state_running"); - break; case Simulation::state_paused: return Glib::ustring("Simulation::state_paused"); - break; case Simulation::state_stopped: return Glib::ustring("Simulation::state_stopped"); - break; + default: + return Glib::ustring("Unhandled Simulation state!"); } } diff --git a/src/testsuite/test-statistics.cc b/src/testsuite/test-statistics.cc index b3855c7..ff8f899 100644 --- a/src/testsuite/test-statistics.cc +++ b/src/testsuite/test-statistics.cc @@ -53,7 +53,7 @@ using Glib::ustring; int -main(int argc, char** argv) +main(int, char**) { // Set up Glib thread support Glib::thread_init(); diff --git a/src/text_simulation.cc b/src/text_simulation.cc index b89bd16..e512304 100644 --- a/src/text_simulation.cc +++ b/src/text_simulation.cc @@ -18,6 +18,8 @@ // along with SGPEMv2. If not, see http://www.gnu.org/licenses/. +// TODO: refactor this file from the first line to the last line. + #include "text_simulation.hh" #include