From dfddcdf1ddb24f6cfa9026f53e5bbe22250221fd Mon Sep 17 00:00:00 2001 From: Hocky Yudhiono Date: Sat, 16 Mar 2024 11:03:32 +0800 Subject: [PATCH] Fix Wall --- include/tcframe/driver/TestCaseDriver.hpp | 4 ++-- include/tcframe/runner/grader/Grader.hpp | 2 +- include/tcframe/runner/os/OperatingSystem.hpp | 3 ++- include/tcframe/spec/constraint/Subtask.hpp | 4 ++-- include/tcframe/spec/core/Magic.hpp | 10 +++++----- include/tcframe/spec/io/IOFormat.hpp | 4 ++-- include/tcframe/spec/io/LinesIOSegment.hpp | 2 +- include/tcframe/spec/io/LinesIOSegmentManipulator.hpp | 2 +- include/tcframe/spec/variable/Vector.hpp | 1 - scripts/tcframe | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/tcframe/driver/TestCaseDriver.hpp b/include/tcframe/driver/TestCaseDriver.hpp index 1de9e0a1..12fb4af6 100644 --- a/include/tcframe/driver/TestCaseDriver.hpp +++ b/include/tcframe/driver/TestCaseDriver.hpp @@ -38,8 +38,8 @@ class TestCaseDriver { IOManipulator* ioManipulator, Verifier* verifier, MultipleTestCasesConfig multipleTestCasesConfig) - : ioManipulator_(ioManipulator) - , rawIOManipulator_(rawIOManipulator) + : rawIOManipulator_(rawIOManipulator) + , ioManipulator_(ioManipulator) , verifier_(verifier) , multipleTestCasesConfig_(move(multipleTestCasesConfig)) {} diff --git a/include/tcframe/runner/grader/Grader.hpp b/include/tcframe/runner/grader/Grader.hpp index bb241440..d5c0f525 100644 --- a/include/tcframe/runner/grader/Grader.hpp +++ b/include/tcframe/runner/grader/Grader.hpp @@ -77,7 +77,7 @@ class Grader { private: map getSubtaskPoints(const GradingOptions& options) { map subtaskPointsByIds; - for (int id = 1; id <= options.subtaskPoints().size(); id++) { + for (unsigned id = 1; id <= options.subtaskPoints().size(); id++) { subtaskPointsByIds[id] = options.subtaskPoints()[id - 1]; } if (subtaskPointsByIds.empty()) { diff --git a/include/tcframe/runner/os/OperatingSystem.hpp b/include/tcframe/runner/os/OperatingSystem.hpp index 620997aa..9c433dba 100644 --- a/include/tcframe/runner/os/OperatingSystem.hpp +++ b/include/tcframe/runner/os/OperatingSystem.hpp @@ -100,7 +100,8 @@ class OperatingSystem { private: static void runCommand(const string& command) { - system(command.c_str()); + int val = system(command.c_str()); + std::cerr << "[tcframe] exit code: " << val << "\n"; } }; diff --git a/include/tcframe/spec/constraint/Subtask.hpp b/include/tcframe/spec/constraint/Subtask.hpp index adece05c..90613b7a 100644 --- a/include/tcframe/spec/constraint/Subtask.hpp +++ b/include/tcframe/spec/constraint/Subtask.hpp @@ -34,8 +34,8 @@ struct Subtask { Subtask(int id, double points, vector constraints) : id_(id) - , points_(points) - , constraints_(move(constraints)) {} + , constraints_(move(constraints)) + , points_(points) {} int id() const { return id_; diff --git a/include/tcframe/spec/core/Magic.hpp b/include/tcframe/spec/core/Magic.hpp index 4d88497f..099dc0fb 100644 --- a/include/tcframe/spec/core/Magic.hpp +++ b/include/tcframe/spec/core/Magic.hpp @@ -36,8 +36,8 @@ namespace tcframe { struct VectorSize { function size; - explicit VectorSize(function size) - : size(move(size)) {} + explicit VectorSize(function _size) + : size(move(_size)) {} }; template @@ -55,9 +55,9 @@ struct MatrixSize { function rows; function columns; - MatrixSize(function rows, function columns) - : rows(move(rows)) - , columns(move(columns)) {} + MatrixSize(function _rows, function _columns) + : rows(move(_rows)) + , columns(move(_columns)) {} }; class VariableNamesExtractor { diff --git a/include/tcframe/spec/io/IOFormat.hpp b/include/tcframe/spec/io/IOFormat.hpp index e5fda074..9f98d818 100644 --- a/include/tcframe/spec/io/IOFormat.hpp +++ b/include/tcframe/spec/io/IOFormat.hpp @@ -49,7 +49,7 @@ struct IOFormat { if (a.size() != b.size()) { return false; } - for (int i = 0; i < a.size(); i++) { + for (unsigned i = 0; i < a.size(); i++) { if (!a[i]->equals(b[i])) { return false; } @@ -61,7 +61,7 @@ struct IOFormat { if (a.size() != b.size()) { return false; } - for (int i = 0; i < a.size(); i++) { + for (unsigned i = 0; i < a.size(); i++) { if (!equals(a[i], b[i])) { return false; } diff --git a/include/tcframe/spec/io/LinesIOSegment.hpp b/include/tcframe/spec/io/LinesIOSegment.hpp index fde3efa7..4bfa12f8 100644 --- a/include/tcframe/spec/io/LinesIOSegment.hpp +++ b/include/tcframe/spec/io/LinesIOSegment.hpp @@ -46,7 +46,7 @@ struct LinesIOSegment : public IOSegment { if (variables_.size() != o.variables_.size()) { return false; } - for (int i = 0; i < variables_.size(); i++) { + for (unsigned i = 0; i < variables_.size(); i++) { if (!variables_[i]->equals(o.variables_[i])) { return false; } diff --git a/include/tcframe/spec/io/LinesIOSegmentManipulator.hpp b/include/tcframe/spec/io/LinesIOSegmentManipulator.hpp index 87a25593..7b9b957d 100644 --- a/include/tcframe/spec/io/LinesIOSegmentManipulator.hpp +++ b/include/tcframe/spec/io/LinesIOSegmentManipulator.hpp @@ -65,7 +65,7 @@ class LinesIOSegmentManipulator { int size = getSize(segment); for (int j = 0; j < size; j++) { - for (int i = 0; i < segment->variables().size(); i++) { + for (unsigned i = 0; i < segment->variables().size(); i++) { Variable *variable = segment->variables()[i]; if (variable->type() == VariableType::VECTOR) { if (i > 0) { diff --git a/include/tcframe/spec/variable/Vector.hpp b/include/tcframe/spec/variable/Vector.hpp index 19a2ccdd..452d171f 100644 --- a/include/tcframe/spec/variable/Vector.hpp +++ b/include/tcframe/spec/variable/Vector.hpp @@ -111,7 +111,6 @@ class RawVectorImpl : public VectorImpl { , var_(&var) {} void parseAndAddElementFrom(istream* in) { - int index = size(); string element; Variable::parseRawLine(in, element); var_->push_back(element); diff --git a/scripts/tcframe b/scripts/tcframe index 742537c4..8dbaa59f 100755 --- a/scripts/tcframe +++ b/scripts/tcframe @@ -54,7 +54,7 @@ build() { exit 1 fi - g++ -std=c++17 -Wunused -Wall -Wshadow -Wunused-type -O3 -D__TCFRAME_SPEC_FILE__="\"$SPEC_FILE\"" -I "$TCFRAME_HOME/include" $TCFRAME_CXX_FLAGS -o "$RUNNER_EXEC" "$TCFRAME_HOME/src/tcframe/runner.cpp" + g++ -std=c++17 -Wunused -Wall -Wshadow -Wreturn-type -O3 -D__TCFRAME_SPEC_FILE__="\"$SPEC_FILE\"" -I "$TCFRAME_HOME/include" $TCFRAME_CXX_FLAGS -o "$RUNNER_EXEC" "$TCFRAME_HOME/src/tcframe/runner.cpp" echo_colored "Build OK" 32 }