aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-11-30 14:11:22 -0800
committerGerald Combs <gerald@wireshark.org>2015-12-01 01:19:33 +0000
commitb8f90de70efa2d271274fbb48df12737f6eddd12 (patch)
tree25561156e54bf3185e9d5285b18940761c18cc52
parentd487c8c7e72666d5e926c4c6a499a0821796c694 (diff)
ws80211: Disable shorten-64-to-32.
Disable shorten-64-to-32 in ws80211_create_on_demand_interface, which calls NLA_PUT_STRING, which passes the output of strlen to an int parameter. NLA_PUT_STRING is defined in netlink/attr.h so there's not much we can do to fix it directly. Suppress -Wpragmas before suppressing warnings in gcc so that we can use DIAG_OFF with clang-only warnings. Change-Id: I1180950edd93c056b8fbfbed164e482024aee90a Reviewed-on: https://code.wireshark.org/review/12314 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--caputils/ws80211_utils.c3
-rw-r--r--wsutil/ws_diag_control.h12
2 files changed, 14 insertions, 1 deletions
diff --git a/caputils/ws80211_utils.c b/caputils/ws80211_utils.c
index 2db292bf9d..a83f5365a2 100644
--- a/caputils/ws80211_utils.c
+++ b/caputils/ws80211_utils.c
@@ -680,6 +680,8 @@ out_err:
return -1;
}
+/* Needed for NLA_PUT_STRING, which passes strlen as an int */
+DIAG_OFF(shorten-64-to-32)
static int ws80211_create_on_demand_interface(const char *name)
{
int devidx, phyidx, err;
@@ -716,6 +718,7 @@ nla_put_failure:
fprintf(stderr, "building message failed\n");
return 2;
}
+DIAG_ON(shorten-64-to-32)
int ws80211_set_freq(const char *name, int freq, int chan_type)
{
diff --git a/wsutil/ws_diag_control.h b/wsutil/ws_diag_control.h
index be6df0353c..cc0e9eec25 100644
--- a/wsutil/ws_diag_control.h
+++ b/wsutil/ws_diag_control.h
@@ -53,7 +53,17 @@ extern "C" {
* gcc supports "-Wpedantic".
*/
# define DIAG_PRAGMA(x) DIAG_DO_PRAGMA(GCC diagnostic x)
-# define DIAG_OFF(x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
+ /*
+ * DIAG_OFF generates
+ *
+ * #pragma GCC diagnostic push
+ * #pragma GCC diagnostic ignored "-Wpragmas"
+ * #pragma GCC diagnostic ignored "-Wx-aka-the-warning-in-question"
+ *
+ * Ignoring "-Wpragmas" lets us turn off diagnostics for clang warnings
+ * that might not be recognized by gcc.
+ */
+# define DIAG_OFF(x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,pragmas)) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
# define DIAG_ON(x) DIAG_PRAGMA(pop)
# endif
#elif defined(__clang__)