Fix some more warnings, install headers

This commit is contained in:
Matteo Settenvini 2018-09-25 10:17:29 +02:00
parent 616aef27a8
commit c1ac6f279b
12 changed files with 377 additions and 288 deletions

72
.clang-format Normal file
View File

@ -0,0 +1,72 @@
---
AccessModifierOffset: 0
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine : false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: TopLevelDefinitions
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: true
BreakAfterJavaFieldAnnotations: true
BreakBeforeBraces: Allman
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: "<pre>.*?</pre>"
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
PointerAlignment: Right
ForEachMacros: [ 'BOOST_FOREACH' ]
IncludeCategories:
- Regex: '^<(gtest|gmock)'
Priority: 8
- Regex: '^(<boost/)'
Priority: 7
- Regex: '^<'
Priority: 9
- Regex: '^<sgpemv2/'
Priority: 2
- Regex: '^"'
Priority: 1
IncludeIsMainRegex: "(_test)?$"
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Double
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 8
PenaltyBreakFirstLessLess: 8
PenaltyBreakString: 8
PenaltyExcessCharacter: 1
PenaltyReturnTypeOnItsOwnLine: 16
PointerAlignment: Right
ReflowComments: false
SortIncludes: true
SpaceAfterCStyleCast: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Always
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp17
UseTab: Never

View File

@ -163,6 +163,7 @@ set(localedir ${CMAKE_INSTALL_FULL_LOCALEDIR})
set(uidir ${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/ui)
set(policiesdir ${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/policies)
set(plugindir ${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME}/plugins)
set(examplesdir ${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/examples)
configure_file(src/backend/sgpemv2/config.h.in
src/backend/sgpemv2/config.h
@ -176,7 +177,6 @@ set_target_properties(sgpemv2-backend PROPERTIES
target_include_directories(sgpemv2-backend
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/backend>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src/backend>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/backend
${Intl_INCLUDE_DIRS})
target_link_libraries(sgpemv2-backend
@ -609,6 +609,16 @@ target_sources(sgpemv2
# -------------------------------------------
install(TARGETS sgpemv2 sgpemv2-backend
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/backend/sgpemv2
${CMAKE_CURRENT_BINARY_DIR}/src/backend/sgpemv2
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PATTERN "*.in" EXCLUDE)
install(FILES data/logo.png
ui/add-process-dialog.ui
ui/add-request-dialog.ui

View File

@ -4,4 +4,5 @@
#define UIDIR "@uidir@"
#define POLDIR "@policiesdir@"
#define PLUGDIR "@plugindir@"
#define EXAMPLESDIR "@examplesdir@"

View File

@ -163,8 +163,8 @@ CairoWidget::on_draw (const Cairo::RefPtr<Cairo::Context>& ctx)
if (!_ref_gdk_window) return true;
// save actual size
size_t actual_w = get_width();
size_t actual_h = get_height();
auto actual_w = get_width();
auto actual_h = get_height();
// the widget must be redrawn if
// - there's an explicit request(_need_redraw)
@ -187,8 +187,8 @@ CairoWidget::on_draw (const Cairo::RefPtr<Cairo::Context>& ctx)
{
// previdence in the code:
// allocate more than actually needed
_pixbuf_w = (size_t) (_client_w*1.2);
_pixbuf_h = (size_t) (_client_h*1.2);
_pixbuf_w = static_cast<int>(_client_w * 1.2);
_pixbuf_h = static_cast<int>(_client_h * 1.2);
// allocate the pixmap
_buf = Gdk::Pixbuf::create (_ref_gdk_window, 0, 0, _pixbuf_w, _pixbuf_h);

View File

@ -206,7 +206,7 @@ namespace sgpem
* The user can implement this method to give default dimensions.
* It isn't necessary because scaling (and resizing) take care of calc_drawing_size() results.
*/
virtual void calc_widget_size(size_t& width, size_t& height);
virtual void calc_widget_size(int& width, int& height);
/**
* \brief Calculate scaling factors to apply during widget's redrawing.
@ -230,22 +230,22 @@ namespace sgpem
/**
* \brief Client area width of widget.
*/
size_t _client_w;
int _client_w;
/**
* \brief Client area height of widget.
*/
size_t _client_h;
int _client_h;
/**
* \brief Client area width of pixmap.
*/
size_t _pixbuf_w;
int _pixbuf_w;
/**
* \brief Client area width of pixmap.
*/
size_t _pixbuf_h;
int _pixbuf_h;
/**
* \brief Cairo x scale factor.

View File

@ -21,6 +21,7 @@
#ifndef GRAPHICAL_PREFERENCES_EDITOR_HH
#define GRAPHICAL_PREFERENCES_EDITOR_HH 1
#include "sgpemv2/config.h"
#include "sgpemv2/global_preferences.hh"
#include <gtkmm/builder.h>

View File

@ -221,7 +221,7 @@ GuiBuilder::open_file(const std::string& basedir)
} // end - if(result==Gtk::RESPONSE_OK)
}
catch (std::out_of_range e)
catch (std::out_of_range& e)
{
Gtk::MessageDialog error(get_initial_window(),
_("<b>No serializer available.</b>\nThere's no "
@ -230,7 +230,7 @@ GuiBuilder::open_file(const std::string& basedir)
error.run();
msg = _("ERROR: No registered serializer available");
}
catch (SerializerError e)
catch (SerializerError& e)
{
Gtk::MessageDialog error(get_initial_window(), e.what(), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
error.run();
@ -272,7 +272,7 @@ GuiBuilder::on_file_save_activate()
serializer.save_snapshot(_filename, history);
msg = _("File: ") + _filename + _(" saved.");
}
catch (std::out_of_range e)
catch (std::out_of_range& e)
{
Gtk::MessageDialog error(get_initial_window(),
_("<b>No serializer available.</b>\nThere's no registered serializer. Please check the loaded plugins."),
@ -280,7 +280,7 @@ GuiBuilder::on_file_save_activate()
error.run();
msg = _("ERROR: No registered serializer available");
}
catch (SerializerError e)
catch (SerializerError& e)
{
Gtk::MessageDialog error(get_initial_window(), e.what(), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
error.run();
@ -349,7 +349,7 @@ GuiBuilder::on_file_saveas_activate()
} // end - if(result==Gtk::RESPONSE_OK)
}
catch (std::out_of_range e)
catch (std::out_of_range& e)
{
Gtk::MessageDialog error(get_initial_window(),
_("<b>No serializer available.</b>\nThere's no registered serializer. Please check the loaded plugins."),
@ -357,7 +357,7 @@ GuiBuilder::on_file_saveas_activate()
error.run();
msg = _("ERROR: No registered serializer available");
}
catch (SerializerError e)
catch (SerializerError& e)
{
Gtk::MessageDialog error(get_initial_window(), e.what(), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
error.run();

View File

@ -26,6 +26,7 @@
#include "statistics_container_window.hh"
#include "simulation_widget.hh"
#include "sgpemv2/config.h"
#include "sgpemv2/cpu_policy.hh"
#include "sgpemv2/resource_policy.hh"

View File

@ -107,7 +107,7 @@ parse_options(int argc, char** argv)
{
prefs.load_configrc();
}
catch (std::exception e)
catch (std::exception& e)
{
std::cout << std::endl
<< _("Error while loading preferences") << std::endl;
@ -163,7 +163,7 @@ parse_options(int argc, char** argv)
}
} // ~ try
catch (Glib::OptionError e)
catch (Glib::OptionError& e)
{
std::cout << Glib::ustring::compose (_("Bad invocation: %1\nUse the `-?' "
"or `--help' option to see the help."),

View File

@ -20,6 +20,8 @@
#include "resources_widget.hh"
#include "sgpemv2/config.h"
#include <sgpemv2/templates/sequences.tcc>
#include <sgpemv2/history.hh>

View File

@ -20,6 +20,7 @@
#include "gettext.h"
#include "sgpemv2/config.h"
#include "schedulables_tree_widget.hh"
#include <sgpemv2/history.hh>
#include <sgpemv2/simulation.hh>

View File

@ -26,6 +26,7 @@
#include "gettext.h"
#include "sgpemv2/config.h"
#include "sgpemv2/simulation.hh"
#include <gtkmm/window.h>