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
diff --git a/internal/ceres/file.cc b/internal/ceres/file.cc
index 387f359..5226c85 100644
--- a/internal/ceres/file.cc
+++ b/internal/ceres/file.cc
@@ -30,6 +30,8 @@
//
// Really simple file IO.
+#include "ceres/file.h"
+
#include <cstdio>
#include "glog/logging.h"
diff --git a/internal/ceres/linear_least_squares_problems.cc b/internal/ceres/linear_least_squares_problems.cc
index bc6ff00..6c886a1 100644
--- a/internal/ceres/linear_least_squares_problems.cc
+++ b/internal/ceres/linear_least_squares_problems.cc
@@ -573,6 +573,7 @@
return problem;
}
+namespace {
bool DumpLinearLeastSquaresProblemToConsole(const string& directory,
int iteration,
const SparseMatrix* A,
@@ -732,6 +733,7 @@
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 ff18e21..4d88a9f 100644
--- a/internal/ceres/residual_block_utils.cc
+++ b/internal/ceres/residual_block_utils.cc
@@ -63,6 +63,7 @@
// 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 @@
}
}
}
+} // 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 7f85fbe..5bcfdc6 100644
--- a/internal/ceres/solver_impl.cc
+++ b/internal/ceres/solver_impl.cc
@@ -1228,8 +1228,8 @@
// 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 4fa1bd4..3edbc28 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 <string>
#include <vector>
#include <iterator>
diff --git a/internal/ceres/stringprintf.cc b/internal/ceres/stringprintf.cc
index c0f3522..ce20467 100644
--- a/internal/ceres/stringprintf.cc
+++ b/internal/ceres/stringprintf.cc
@@ -28,6 +28,8 @@
//
// Author: Sanjay Ghemawat
+#include "ceres/stringprintf.h"
+
#include <cerrno>
#include <cstdarg> // For va_list and related operations
#include <cstdio> // MSVC requires this for _vsnprintf
diff --git a/internal/ceres/types.cc b/internal/ceres/types.cc
index 1c8a986..2e19322 100644
--- a/internal/ceres/types.cc
+++ b/internal/ceres/types.cc
@@ -39,7 +39,7 @@
#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 9d80654..8e80fd1 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 <cmath>
#include <ctime>
#include <algorithm>