From c3ccac9232c2684b15f75fa8622a9a290aeca123 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 03:11:54 +0100 Subject: warning: no previous declaration for foobar() [-Wmissing-declarations] Git-Dch: Ignore Reported-By: gcc -Wmissing-declarations --- test/interactive-helper/aptwebserver.cc | 30 +++++++++++++++--------------- test/interactive-helper/extract-control.cc | 2 +- test/interactive-helper/testdeb.cc | 2 +- test/libapt/assert.h | 9 +++++++++ test/libapt/compareversion_test.cc | 6 +++--- test/libapt/sourcelist_test.cc | 2 +- test/libapt/tagfile_test.cc | 2 +- 7 files changed, 31 insertions(+), 22 deletions(-) (limited to 'test') diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 992f802a6..7ed984fa9 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -23,7 +23,7 @@ #include #include -char const * const httpcodeToStr(int const httpcode) /*{{{*/ +static char const * const httpcodeToStr(int const httpcode) /*{{{*/ { switch (httpcode) { @@ -77,7 +77,7 @@ char const * const httpcodeToStr(int const httpcode) /*{{{*/ return NULL; } /*}}}*/ -void addFileHeaders(std::list &headers, FileFd &data) /*{{{*/ +static void addFileHeaders(std::list &headers, FileFd &data)/*{{{*/ { std::ostringstream contentlength; contentlength << "Content-Length: " << data.FileSize(); @@ -88,14 +88,14 @@ void addFileHeaders(std::list &headers, FileFd &data) /*{{{*/ headers.push_back(lastmodified); } /*}}}*/ -void addDataHeaders(std::list &headers, std::string &data) /*{{{*/ +static void addDataHeaders(std::list &headers, std::string &data)/*{{{*/ { std::ostringstream contentlength; contentlength << "Content-Length: " << data.size(); headers.push_back(contentlength.str()); } /*}}}*/ -bool sendHead(int const client, int const httpcode, std::list &headers)/*{{{*/ +static bool sendHead(int const client, int const httpcode, std::list &headers)/*{{{*/ { std::string response("HTTP/1.1 "); response.append(httpcodeToStr(httpcode)); @@ -128,7 +128,7 @@ bool sendHead(int const client, int const httpcode, std::list &head return Success; } /*}}}*/ -bool sendFile(int const client, FileFd &data) /*{{{*/ +static bool sendFile(int const client, FileFd &data) /*{{{*/ { bool Success = true; char buffer[500]; @@ -144,7 +144,7 @@ bool sendFile(int const client, FileFd &data) /*{{{*/ return Success; } /*}}}*/ -bool sendData(int const client, std::string const &data) /*{{{*/ +static bool sendData(int const client, std::string const &data) /*{{{*/ { if (FileFd::Write(client, data.c_str(), data.size()) == false) { @@ -154,7 +154,7 @@ bool sendData(int const client, std::string const &data) /*{{{*/ return true; } /*}}}*/ -void sendError(int const client, int const httpcode, std::string const &request,/*{{{*/ +static void sendError(int const client, int const httpcode, std::string const &request,/*{{{*/ bool content, std::string const &error = "") { std::list headers; @@ -179,13 +179,13 @@ void sendError(int const client, int const httpcode, std::string const &request, if (content == true) sendData(client, response); } -void sendSuccess(int const client, std::string const &request, +static void sendSuccess(int const client, std::string const &request, bool content, std::string const &error = "") { sendError(client, 200, request, content, error); } /*}}}*/ -void sendRedirect(int const client, int const httpcode, std::string const &uri,/*{{{*/ +static void sendRedirect(int const client, int const httpcode, std::string const &uri,/*{{{*/ std::string const &request, bool content) { std::list headers; @@ -222,7 +222,7 @@ void sendRedirect(int const client, int const httpcode, std::string const &uri,/ sendData(client, response); } /*}}}*/ -int filter_hidden_files(const struct dirent *a) /*{{{*/ +static int filter_hidden_files(const struct dirent *a) /*{{{*/ { if (a->d_name[0] == '.') return 0; @@ -236,7 +236,7 @@ int filter_hidden_files(const struct dirent *a) /*{{{*/ #endif return 1; } -int grouped_alpha_case_sort(const struct dirent **a, const struct dirent **b) { +static int grouped_alpha_case_sort(const struct dirent **a, const struct dirent **b) { #ifdef _DIRENT_HAVE_D_TYPE if ((*a)->d_type == DT_DIR && (*b)->d_type == DT_DIR); else if ((*a)->d_type == DT_DIR && (*b)->d_type == DT_REG) @@ -260,7 +260,7 @@ int grouped_alpha_case_sort(const struct dirent **a, const struct dirent **b) { return strcasecmp((*a)->d_name, (*b)->d_name); } /*}}}*/ -void sendDirectoryListing(int const client, std::string const &dir, /*{{{*/ +static void sendDirectoryListing(int const client, std::string const &dir,/*{{{*/ std::string const &request, bool content) { std::list headers; @@ -312,7 +312,7 @@ void sendDirectoryListing(int const client, std::string const &dir, /*{{{*/ sendData(client, response); } /*}}}*/ -bool parseFirstLine(int const client, std::string const &request, /*{{{*/ +static bool parseFirstLine(int const client, std::string const &request,/*{{{*/ std::string &filename, std::string ¶ms, bool &sendContent, bool &closeConnection) { @@ -432,7 +432,7 @@ bool parseFirstLine(int const client, std::string const &request, /*{{{*/ return true; } /*}}}*/ -bool handleOnTheFlyReconfiguration(int const client, std::string const &request, std::vector const &parts)/*{{{*/ +static bool handleOnTheFlyReconfiguration(int const client, std::string const &request, std::vector const &parts)/*{{{*/ { size_t const pcount = parts.size(); if (pcount == 4 && parts[1] == "set") @@ -475,7 +475,7 @@ bool handleOnTheFlyReconfiguration(int const client, std::string const &request, return false; } /*}}}*/ -void * handleClient(void * voidclient) /*{{{*/ +static void * handleClient(void * voidclient) /*{{{*/ { int client = *((int*)(voidclient)); std::clog << "ACCEPT client " << client << std::endl; diff --git a/test/interactive-helper/extract-control.cc b/test/interactive-helper/extract-control.cc index 3f7feabcb..94fe9dca8 100644 --- a/test/interactive-helper/extract-control.cc +++ b/test/interactive-helper/extract-control.cc @@ -7,7 +7,7 @@ using namespace std; -bool ExtractMember(const char *File,const char *Member) +static bool ExtractMember(const char *File,const char *Member) { FileFd Fd(File,FileFd::ReadOnly); debDebFile Deb(Fd); diff --git a/test/interactive-helper/testdeb.cc b/test/interactive-helper/testdeb.cc index d28f20114..89375af13 100644 --- a/test/interactive-helper/testdeb.cc +++ b/test/interactive-helper/testdeb.cc @@ -9,7 +9,7 @@ class NullStream : public pkgDirStream virtual bool DoItem(Item &Itm,int &Fd) {return true;}; }; -bool Test(const char *File) +static bool Test(const char *File) { FileFd Fd(File,FileFd::ReadOnly); debDebFile Deb(Fd); diff --git a/test/libapt/assert.h b/test/libapt/assert.h index 113c057ed..cde6a6351 100644 --- a/test/libapt/assert.h +++ b/test/libapt/assert.h @@ -1,6 +1,11 @@ #include #include +#if __GNUC__ >= 4 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wmissing-declarations" +#endif + #define equals(x,y) assertEquals(y, x, __LINE__) #define equalsNot(x,y) assertEqualsNot(y, x, __LINE__) @@ -111,3 +116,7 @@ void dumpVector(X vec) { v != vec.end(); ++v) std::cout << *v << std::endl; } + +#if __GNUC__ >= 4 + #pragma GCC diagnostic pop +#endif diff --git a/test/libapt/compareversion_test.cc b/test/libapt/compareversion_test.cc index fdb1d5674..44f8e9d78 100644 --- a/test/libapt/compareversion_test.cc +++ b/test/libapt/compareversion_test.cc @@ -31,7 +31,7 @@ using namespace std; -bool callDPkg(const char *val, const char *ref, const char &op) { +static bool callDPkg(const char *val, const char *ref, const char &op) { pid_t Process = ExecFork(); if (Process == 0) { @@ -50,7 +50,7 @@ bool callDPkg(const char *val, const char *ref, const char &op) { return WIFEXITED(Ret) == true && WEXITSTATUS(Ret) == 0; } -void assertVersion(int const &CurLine, string const &A, string const &B, int const &Expected) { +static void assertVersion(int const &CurLine, string const &A, string const &B, int const &Expected) { int Res = debVS.CmpVersion(A.c_str(), B.c_str()); bool const dpkg = callDPkg(A.c_str(),B.c_str(), Expected); Res = (Res < 0) ? -1 : ( (Res > 0) ? 1 : Res); @@ -61,7 +61,7 @@ void assertVersion(int const &CurLine, string const &A, string const &B, int con _error->Error("DPkg differ with line: %u. '%s' '%s' '%s' == false",CurLine,A.c_str(),((Expected == 1) ? "<<" : ( (Expected == 0) ? "=" : ">>")),B.c_str()); } -bool RunTest(const char *File) +static bool RunTest(const char *File) { if (FileExists(File) == false) return _error->Error("Versiontestfile %s doesn't exist!", File); diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc index 0300ce929..e79b6d65e 100644 --- a/test/libapt/sourcelist_test.cc +++ b/test/libapt/sourcelist_test.cc @@ -9,7 +9,7 @@ char *tempfile = NULL; int tempfile_fd = -1; -void remove_tmpfile(void) +static void remove_tmpfile(void) { if (tempfile_fd > 0) close(tempfile_fd); diff --git a/test/libapt/tagfile_test.cc b/test/libapt/tagfile_test.cc index d12c74c95..effc3244b 100644 --- a/test/libapt/tagfile_test.cc +++ b/test/libapt/tagfile_test.cc @@ -9,7 +9,7 @@ char *tempfile = NULL; int tempfile_fd = -1; -void remove_tmpfile(void) +static void remove_tmpfile(void) { if (tempfile_fd > 0) close(tempfile_fd); -- cgit v1.2.3