Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some Compiler Warnings to prepare for Pedantic Mode #99

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/IO/Appearance/Color.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,15 @@ class Color {
~Color(){}


bool operator== ( const Color& rhs ) {
bool operator== ( Color const & rhs ) {
return Red() == rhs.Red() && Green() == rhs.Green() && Blue() == rhs.Blue();
}

bool operator!= ( const Color& rhs ) {
bool operator!= ( Color const & rhs ) {
return !operator==(rhs);
}

friend std::ostream& operator<<(std::ostream& os, const Name color ) {
friend std::ostream& operator<<(std::ostream& os, Name const color ) {
switch ( color ) {
case Name::KITgreen: os << "KITgreen"; break;
case Name::KITgreen70: os << "KITgreen70"; break;
Expand Down
2 changes: 1 addition & 1 deletion src/Runnables/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*

Check notice on line 1 in src/Runnables/main.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (ubuntu-latest, Debug, gcc, g++)

Run clang-format on src/Runnables/main.cpp

File src/Runnables/main.cpp does not conform to Custom style guidelines. (lines 8, 12, 25, 29, 43, 57, 61, 62, 69, 70, 71, 72, 76, 77, 78, 79, 83, 84, 85, 86, 90, 91, 92, 93, 99, 100, 104, 105, 106, 107, 111, 112, 113, 114, 118, 119, 120, 121, 125, 126, 127, 128, 130, 134, 135, 136, 139, 140, 141, 142, 150, 151, 152, 155, 156, 159, 160, 167, 169, 173, 175, 179, 180, 181, 183, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 204, 205, 206, 207, 208, 211, 214, 217, 223, 224, 225, 226, 227, 228, 229, 230, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 245, 246, 247, 248, 254, 255, 257, 258, 261, 264, 265, 266, 267, 272, 276, 277, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 290, 291, 292, 293, 296, 297, 298, 299, 302, 303, 304, 305, 306, 307, 312, 313, 314, 315, 318, 319, 320, 321, 322, 323, 328, 329, 340, 343, 348, 349, 350, 352, 353, 354, 356, 357, 358, 359, 360, 362, 363, 364, 365, 366, 368, 370, 371, 372, 373)
* main.cpp
*
* Created on: Sep 13, 2018
Expand All @@ -15,7 +15,7 @@
#include <set>
#include <tuple>

#include <QFile>

Check failure on line 18 in src/Runnables/main.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (ubuntu-latest, Debug, gcc, g++)

src/Runnables/main.cpp:18:10 [clang-diagnostic-error]

'QFile' file not found
#include <QStringList>

#include "DataStructures/Labels/Label.hpp"
Expand Down Expand Up @@ -57,58 +57,58 @@
#include "IO/PowerGridIO.hpp"
#include "IO/Appearance/Color.hpp"

QString inputFile(""), outputDir("");

Check warning on line 60 in src/Runnables/main.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (ubuntu-latest, Debug, gcc, g++)

src/Runnables/main.cpp:60:9 [cppcoreguidelines-avoid-non-const-global-variables]

variable 'inputFile' is non-const and globally accessible, consider making it const
void addCommandLineOptions ( const QCoreApplication &application,

Check warning on line 61 in src/Runnables/main.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (ubuntu-latest, Debug, gcc, g++)

src/Runnables/main.cpp:61:54 [misc-unused-parameters]

parameter 'application' is unused
QCommandLineParser &parser )

Check warning on line 62 in src/Runnables/main.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (ubuntu-latest, Debug, gcc, g++)

src/Runnables/main.cpp:62:54 [misc-unused-parameters]

parameter 'parser' is unused
{
parser.setApplicationDescription("Power Grid Tool");
parser.addHelpOption();
parser.addVersionOption();

#pragma mark COMMANDLINE_OPTIONS
QCommandLineOption algorithmOption(

Check warning on line 69 in src/Runnables/main.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (ubuntu-latest, Debug, gcc, g++)

src/Runnables/main.cpp:69:24 [cppcoreguidelines-init-variables]

variable 'algorithmOption' is not initialized
"algo",
QCoreApplication::translate("main", "Algorithm for the problem (default: MILP)."),
QCoreApplication::translate("main", "algo"), "MILP"
);
parser.addOption(algorithmOption);

QCommandLineOption variantOption(

Check warning on line 76 in src/Runnables/main.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (ubuntu-latest, Debug, gcc, g++)

src/Runnables/main.cpp:76:24 [cppcoreguidelines-init-variables]

variable 'variantOption' is not initialized
"variant",
QCoreApplication::translate("main", "Variant for the algorithm (default: ?."),
QCoreApplication::translate("main", "variant"), "?"
);
parser.addOption(variantOption);

QCommandLineOption networkSettingOption(

Check warning on line 83 in src/Runnables/main.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (ubuntu-latest, Debug, gcc, g++)

src/Runnables/main.cpp:83:24 [cppcoreguidelines-init-variables]

variable 'networkSettingOption' is not initialized
"networkSetting",
QCoreApplication::translate("main", "Network setting (default: exact for PF (not changeable), bounded for DCMPF and DCMTSF)."),
QCoreApplication::translate("main", "networkSetting"), "bounded"
);
parser.addOption(networkSettingOption);

QCommandLineOption solverOption(

Check warning on line 90 in src/Runnables/main.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (ubuntu-latest, Debug, gcc, g++)

src/Runnables/main.cpp:90:24 [cppcoreguidelines-init-variables]

variable 'solverOption' is not initialized
"solver",
QCoreApplication::translate("main", "Solver if necessary (default: gurobi)."),
QCoreApplication::translate("main", "solver"), "gurobi"
);
parser.addOption(solverOption);

QCommandLineOption inputFileWarmStartOption(

Check warning on line 97 in src/Runnables/main.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (ubuntu-latest, Debug, gcc, g++)

src/Runnables/main.cpp:97:24 [cppcoreguidelines-init-variables]

variable 'inputFileWarmStartOption' is not initialized
QStringList() << "inputFileWarmStart",
QCoreApplication::translate("main", "Input file for the warm start (default: ../Data/windfarm-benchmarksets/testset-0-instance-1.gml)."),
QCoreApplication::translate("main", "inputFileWarmStart"), "WS-testset-0-instance-1.gml"
);
parser.addOption(inputFileWarmStartOption);

QCommandLineOption timeOption(

Check warning on line 104 in src/Runnables/main.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (ubuntu-latest, Debug, gcc, g++)

src/Runnables/main.cpp:104:24 [cppcoreguidelines-init-variables]

variable 'timeOption' is not initialized
"time",
QCoreApplication::translate("main", "--time <time> -- specify time limit in seconds (default: 1h)."),
QCoreApplication::translate("main", "time"), "3600"
);
parser.addOption(timeOption);

QCommandLineOption traceSolutionOption(

Check warning on line 111 in src/Runnables/main.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (ubuntu-latest, Debug, gcc, g++)

src/Runnables/main.cpp:111:24 [cppcoreguidelines-init-variables]

variable 'traceSolutionOption' is not initialized
"trace",
QCoreApplication::translate("main", "--trace <true|false> -- Trace solution. (default: false)."),
QCoreApplication::translate("main", "trace"), "false"
Expand Down Expand Up @@ -208,7 +208,7 @@
else if ( networkSetting == "EXACT" ) { network.MakeExact(); }
}

int main(int argc, char *argv[]) {
auto main(int argc, char * argv []) -> int {

// Command line parsing
auto application = std::unique_ptr<QCoreApplication>(std::make_unique<QCoreApplication>(argc, argv));
Expand Down
2 changes: 1 addition & 1 deletion tests/DataStructures/Container/TestMappingBinaryHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace egoa::test {

std::string buildAssertionString(std::string function, std::string message) {
auto buildAssertionString(std::string const & function, std::string const & message) -> std::string {

Check warning on line 16 in tests/DataStructures/Container/TestMappingBinaryHeap.cpp

View check run for this annotation

Codecov / codecov/patch

tests/DataStructures/Container/TestMappingBinaryHeap.cpp#L16

Added line #L16 was not covered by tests
return buildAssertionString("MappingBinaryHeap.hpp", "MappingBinaryHeap", function, message);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/DataStructures/Graphs/TestPowerGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3223,12 +3223,12 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4a
TEST_F ( TestPowerGridAcm2018MtsfFigure4a
, AddLoadAtUsingVertexId )
{
auto vertexId = static_cast<Types::vertexId>(2);
auto const vertexId = static_cast<Types::vertexId>(2);
EXPECT_EQ ( 1, network_.NumberOfLoads() );
EXPECT_FALSE ( network_.HasLoadAt ( vertexId ) );
// Add load at vertex 2
TLoadProperties loadProperties;
Types::loadId loadId = network_.AddLoadAt ( vertexId, loadProperties );
Types::loadId const loadId = network_.AddLoadAt ( vertexId, loadProperties );
// Check
EXPECT_TRUE ( network_.HasLoadAt ( vertexId ) );
EXPECT_TRUE ( network_.HasLoad ( loadId ) );
Expand Down
4 changes: 2 additions & 2 deletions tests/DataStructures/TestBound.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*

Check notice on line 1 in tests/DataStructures/TestBound.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (ubuntu-latest, Debug, gcc, g++)

Run clang-format on tests/DataStructures/TestBound.cpp

File tests/DataStructures/TestBound.cpp does not conform to Custom style guidelines. (lines 19, 21, 23, 25, 27, 29, 32, 37, 41, 44, 48, 52, 53, 55, 56, 59, 62, 66, 67, 68, 69, 70)
* TestBound.cpp
*
* Created on: Jan 28, 2019
Expand All @@ -18,9 +18,9 @@

namespace egoa::test {

TestBound::TestBound () {}
TestBound::TestBound () = default;

TestBound::~TestBound () {}
TestBound::~TestBound () = default;

void TestBound::SetUp () {}

Expand Down
Loading