From b53c9667f508c125b8aa833e7a063fa44ef8a98e Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 25 Feb 2013 01:14:26 +0600 Subject: [PATCH] Solve No Previous Prototype GCC warning In some cases there were missing includes of own header files from implementation files. In other cases moved function which are only used within single file into an anonymous namespace. Change-Id: I2c6b411bcfbc521e2a5f21265dc8e009a548b1c8 --- internal/ceres/file.cc | 2 ++ internal/ceres/linear_least_squares_problems.cc | 2 ++ internal/ceres/residual_block_utils.cc | 2 ++ internal/ceres/solver_impl.cc | 4 ++-- internal/ceres/split.cc | 2 ++ internal/ceres/stringprintf.cc | 2 ++ internal/ceres/types.cc | 2 +- internal/ceres/visibility.cc | 2 ++ 8 files changed, 15 insertions(+), 3 deletions(-) diff --git a/internal/ceres/file.cc b/internal/ceres/file.cc index 387f359b2..5226c85e6 100644 --- a/internal/ceres/file.cc +++ b/internal/ceres/file.cc @@ -30,6 +30,8 @@ // // Really simple file IO. +#include "ceres/file.h" + #include #include "glog/logging.h" diff --git a/internal/ceres/linear_least_squares_problems.cc b/internal/ceres/linear_least_squares_problems.cc index bc6ff00c1..6c886a1be 100644 --- a/internal/ceres/linear_least_squares_problems.cc +++ b/internal/ceres/linear_least_squares_problems.cc @@ -573,6 +573,7 @@ LinearLeastSquaresProblem* LinearLeastSquaresProblem3() { return problem; } +namespace { bool DumpLinearLeastSquaresProblemToConsole(const string& directory, int iteration, const SparseMatrix* A, @@ -732,6 +733,7 @@ bool DumpLinearLeastSquaresProblemToTextFile(const string& directory, WriteStringToFileOrDie(matlab_script, matlab_filename); return true; } +} // namespace bool DumpLinearLeastSquaresProblem(const string& directory, int iteration, diff --git a/internal/ceres/residual_block_utils.cc b/internal/ceres/residual_block_utils.cc index ff18e21f0..4d88a9f4f 100644 --- a/internal/ceres/residual_block_utils.cc +++ b/internal/ceres/residual_block_utils.cc @@ -63,6 +63,7 @@ void InvalidateEvaluation(const ResidualBlock& block, // Utility routine to print an array of doubles to a string. If the // array pointer is NULL, it is treated as an array of zeros. +namespace { void AppendArrayToString(const int size, const double* x, string* result) { for (int i = 0; i < size; ++i) { if (x == NULL) { @@ -76,6 +77,7 @@ void AppendArrayToString(const int size, const double* x, string* result) { } } } +} // namespace string EvaluationToString(const ResidualBlock& block, double const* const* parameters, diff --git a/internal/ceres/solver_impl.cc b/internal/ceres/solver_impl.cc index 7f85fbea2..5bcfdc631 100644 --- a/internal/ceres/solver_impl.cc +++ b/internal/ceres/solver_impl.cc @@ -1228,8 +1228,8 @@ bool SolverImpl::ApplyUserOrdering( // Find the minimum index of any parameter block to the given residual. // Parameter blocks that have indices greater than num_eliminate_blocks are // considered to have an index equal to num_eliminate_blocks. -int MinParameterBlock(const ResidualBlock* residual_block, - int num_eliminate_blocks) { +static int MinParameterBlock(const ResidualBlock* residual_block, + int num_eliminate_blocks) { int min_parameter_block_position = num_eliminate_blocks; for (int i = 0; i < residual_block->NumParameterBlocks(); ++i) { ParameterBlock* parameter_block = residual_block->parameter_blocks()[i]; diff --git a/internal/ceres/split.cc b/internal/ceres/split.cc index 4fa1bd468..3edbc2813 100644 --- a/internal/ceres/split.cc +++ b/internal/ceres/split.cc @@ -28,6 +28,8 @@ // // Author: keir@google.com (Keir Mierle) +#include "ceres/split.h" + #include #include #include diff --git a/internal/ceres/stringprintf.cc b/internal/ceres/stringprintf.cc index c0f35225b..ce204674d 100644 --- a/internal/ceres/stringprintf.cc +++ b/internal/ceres/stringprintf.cc @@ -28,6 +28,8 @@ // // Author: Sanjay Ghemawat +#include "ceres/stringprintf.h" + #include #include // For va_list and related operations #include // MSVC requires this for _vsnprintf diff --git a/internal/ceres/types.cc b/internal/ceres/types.cc index 1c8a986b2..2e19322cc 100644 --- a/internal/ceres/types.cc +++ b/internal/ceres/types.cc @@ -39,7 +39,7 @@ namespace ceres { #define CASESTR(x) case x: return #x #define STRENUM(x) if (value == #x) { *type = x; return true;} -void UpperCase(string* input) { +static void UpperCase(string* input) { std::transform(input->begin(), input->end(), input->begin(), ::toupper); } diff --git a/internal/ceres/visibility.cc b/internal/ceres/visibility.cc index 9d8065415..8e80fd121 100644 --- a/internal/ceres/visibility.cc +++ b/internal/ceres/visibility.cc @@ -28,6 +28,8 @@ // // Author: kushalav@google.com (Avanish Kushal) +#include "ceres/visibility.h" + #include #include #include