diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-02-17 13:33:15 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-02-18 05:01:00 +0000 |
commit | 630f54fbbc05d04ebc7007a2d6762514f5c066aa (patch) | |
tree | 6f7090178d2554b33d033fdb4078b30b2b5ce726 | |
parent | b3f3d669e5f3c1f04d7d6c771da8604e25a71eec (diff) |
Fix various warnings in wireshark-qt.cpp.
Squelch warnings due to (char *) casts.
Use "include_directories(SYSTEM..." in CMakeLists.txt so that we
don't get pedantic warnings about things we can't easily fix such
as QList loop optimizations. Not sure if there's an easy way to do
this in Autotools.
Pass get_gui_compiled_info to init_progfile_dir. C++ don't have to
show you any stinkin' ::main.
warning: ISO C++ forbids taking address of function ‘::main’ [-Wpedantic]
Change-Id: If1c77284ab0d1b4786bce4e926a4109dd9b1ae34
Reviewed-on: https://code.wireshark.org/review/7207
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | wireshark-qt.cpp | 6 | ||||
-rw-r--r-- | wsutil/filesystem.c | 2 | ||||
-rw-r--r-- | wsutil/filesystem.h | 3 |
4 files changed, 9 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a47b95697..3ceeed1e3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -671,7 +671,7 @@ foreach(PACKAGE ${PACKAGELIST}) if (${PACKAGE_VAR}_FOUND) message("${PACKAGE_VAR} FOUND") set(HAVE_LIB${PACKAGE_VAR} 1) - include_directories(${${PACKAGE_VAR}_INCLUDE_DIRS}) + include_directories(SYSTEM ${${PACKAGE_VAR}_INCLUDE_DIRS}) set(WS_ALL_LIBS ${WS_ALL_LIBS} ${${PACKAGE_VAR}_LIBRARIES}) message(STATUS "${PACKAGE} includes: ${${PACKAGE_VAR}_INCLUDE_DIRS}") message(STATUS "${PACKAGE} libs: ${${PACKAGE_VAR}_LIBRARIES}") diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp index c44cc7d1b8..30a1bce60f 100644 --- a/wireshark-qt.cpp +++ b/wireshark-qt.cpp @@ -49,6 +49,7 @@ #endif #include <wsutil/report_err.h> #include <wsutil/u3.h> +#include <wsutil/ws_diag_control.h> #include <wsutil/ws_version_info.h> #include <epan/addr_resolv.h> @@ -481,7 +482,8 @@ int main(int argc, char *argv[]) /* * Attempt to get the pathname of the executable file. */ - /* init_progfile_dir_error = */ init_progfile_dir(argv[0], main); + /* init_progfile_dir_error = */ init_progfile_dir(argv[0], + (progfile_main_t) get_gui_compiled_info); g_log(NULL, G_LOG_LEVEL_DEBUG, "progfile_dir: %s", get_progfile_dir()); /* Get the compile-time version information string */ @@ -528,6 +530,7 @@ int main(int argc, char *argv[]) */ // XXX Should the remaining code be in WiresharkApplcation::WiresharkApplication? #define OPTSTRING OPTSTRING_CAPTURE_COMMON "C:g:Hh" "jJ:kK:lm:nN:o:P:r:R:St:u:vw:X:Y:z:" +DIAG_OFF(cast-qual) static const struct option long_options[] = { {(char *)"help", no_argument, NULL, 'h'}, {(char *)"read-file", required_argument, NULL, 'r' }, @@ -537,6 +540,7 @@ int main(int argc, char *argv[]) LONGOPT_CAPTURE_COMMON {0, 0, 0, 0 } }; +DIAG_ON(cast-qual) static const char optstring[] = OPTSTRING; opterr = 0; diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c index 16e51615b1..c34b95a02b 100644 --- a/wsutil/filesystem.c +++ b/wsutil/filesystem.c @@ -479,7 +479,7 @@ init_progfile_dir(const char *arg0 #ifdef _WIN32 _U_ #endif -, int (*main_addr)(int, char **) +, progfile_main_t main_addr #if defined(_WIN32) || !defined(HAVE_DLADDR) _U_ #endif diff --git a/wsutil/filesystem.h b/wsutil/filesystem.h index bb066d37e3..b8b1d3f433 100644 --- a/wsutil/filesystem.h +++ b/wsutil/filesystem.h @@ -40,7 +40,8 @@ extern "C" { * and save it for future use. Returns NULL on success, and a * g_mallocated string containing an error on failure. */ -WS_DLL_PUBLIC char *init_progfile_dir(const char *arg0, int (*main)(int, char **)); +typedef int (*progfile_main_t)(int, char **); +WS_DLL_PUBLIC char *init_progfile_dir(const char *arg0, progfile_main_t main_addr); /* * Get the directory in which the program resides. |