Fix diagnostics macros and squelch a gcc warning.
Both clang and gcc define __GNUC__. Make sure we account for that when defining diagnostic macros. Use DIAG_OFF + DIAG_ON to suppress gcc -pedantic warnings about frame_data. Get rid of packet_char_enc casts. Change-Id: Idbcc61bcdb35c1d20f185461c69451dcdf73bae9 Reviewed-on: https://code.wireshark.org/review/7106 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
5cc0ad8672
commit
e11d7ef08f
|
@ -29,6 +29,7 @@ extern "C" {
|
|||
|
||||
#include <epan/tvbuff.h>
|
||||
#include <wsutil/nstime.h>
|
||||
#include <wsutil/ws_diag_control.h>
|
||||
#include "ws_symbol_export.h"
|
||||
|
||||
struct _packet_info;
|
||||
|
@ -60,6 +61,7 @@ typedef enum {
|
|||
/** The frame number is the ordinal number of the frame in the capture, so
|
||||
it's 1-origin. In various contexts, 0 as a frame number means "frame
|
||||
number unknown". */
|
||||
DIAG_OFF(pedantic)
|
||||
typedef struct _frame_data {
|
||||
GSList *pfd; /**< Per frame proto data */
|
||||
guint32 num; /**< Frame number */
|
||||
|
@ -90,6 +92,7 @@ typedef struct _frame_data {
|
|||
guint32 frame_ref_num; /**< Previous reference frame (0 if this is one) */
|
||||
guint32 prev_dis_num; /**< Previous displayed frame (0 if first one) */
|
||||
} frame_data;
|
||||
DIAG_ON(pedantic)
|
||||
|
||||
/* Utility routines used by packet*.c */
|
||||
WS_DLL_PUBLIC void p_add_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, guint32 key, void *proto_data);
|
||||
|
|
|
@ -104,7 +104,7 @@ proto_tree_print(print_args_t *print_args, epan_dissect_t *edt,
|
|||
data.stream = stream;
|
||||
data.success = TRUE;
|
||||
data.src_list = edt->pi.data_src;
|
||||
data.encoding = (packet_char_enc)edt->pi.fd->flags.encoding;
|
||||
data.encoding = edt->pi.fd->flags.encoding;
|
||||
data.print_dissections = print_args->print_dissections;
|
||||
/* If we're printing the entire packet in hex, don't
|
||||
print uninterpreted data fields in hex as well. */
|
||||
|
@ -877,7 +877,7 @@ print_hex_data(print_stream_t *stream, epan_dissect_t *edt)
|
|||
return TRUE;
|
||||
cp = tvb_get_ptr(tvb, 0, length);
|
||||
if (!print_hex_data_buffer(stream, cp, length,
|
||||
(packet_char_enc)edt->pi.fd->flags.encoding))
|
||||
edt->pi.fd->flags.encoding))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
|
|
@ -1425,11 +1425,9 @@ bytes_view_set_data(BytesView *bv, const guint8 *data, int len)
|
|||
}
|
||||
|
||||
void
|
||||
bytes_view_set_encoding(BytesView *bv, int enc)
|
||||
bytes_view_set_encoding(BytesView *bv, packet_char_enc enc)
|
||||
{
|
||||
g_assert(enc == PACKET_CHAR_ENC_CHAR_ASCII || enc == PACKET_CHAR_ENC_CHAR_EBCDIC);
|
||||
|
||||
bv->encoding = (packet_char_enc)enc;
|
||||
bv->encoding = enc;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -37,7 +37,7 @@ GtkWidget *bytes_view_new(void);
|
|||
void bytes_view_set_font(BytesView *bv, PangoFontDescription *font);
|
||||
|
||||
void bytes_view_set_data(BytesView *bv, const guint8 *data, int len);
|
||||
void bytes_view_set_encoding(BytesView *bv, int enc);
|
||||
void bytes_view_set_encoding(BytesView *bv, packet_char_enc enc);
|
||||
void bytes_view_set_format(BytesView *bv, int format);
|
||||
void bytes_view_set_highlight_style(BytesView *bv, gboolean bold);
|
||||
|
||||
|
|
|
@ -843,7 +843,7 @@ packet_hex_update(GtkWidget *bv, const guint8 *pd, int len, int bstart,
|
|||
int bend, guint64 bmask, int bmask_le,
|
||||
int astart, int aend,
|
||||
int pstart, int pend,
|
||||
int encoding)
|
||||
packet_char_enc encoding)
|
||||
{
|
||||
bytes_view_set_encoding(BYTES_VIEW(bv), encoding);
|
||||
bytes_view_set_format(BYTES_VIEW(bv), recent.gui_bytes_view);
|
||||
|
@ -1057,7 +1057,8 @@ packet_hex_editor_print(GtkWidget *bv, const guint8 *pd, frame_data *fd, int off
|
|||
void
|
||||
packet_hex_reprint(GtkWidget *bv)
|
||||
{
|
||||
int start, end, mask_le, encoding;
|
||||
int start, end, mask_le;
|
||||
packet_char_enc encoding;
|
||||
int astart, aend;
|
||||
int pstart, pend;
|
||||
guint64 mask;
|
||||
|
@ -1075,7 +1076,7 @@ packet_hex_reprint(GtkWidget *bv)
|
|||
pend = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(bv), E_BYTE_VIEW_PROTO_END_KEY));
|
||||
data = get_byte_view_data_and_length(bv, &len);
|
||||
g_assert(data != NULL);
|
||||
encoding = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(bv), E_BYTE_VIEW_ENCODE_KEY));
|
||||
encoding = (packet_char_enc) GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(bv), E_BYTE_VIEW_ENCODE_KEY));
|
||||
|
||||
/* stig: it should be done only for bitview... */
|
||||
if (recent.gui_bytes_view != BYTES_BITS)
|
||||
|
|
|
@ -45,7 +45,7 @@ extern "C" {
|
|||
pragma clang diagnostic error/warning/ignored -Wxxx and
|
||||
pragma clang diagnostic push/pop were introduced in clang 2.8 */
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
|
||||
#if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 && !defined(__clang__)
|
||||
/* gcc version is >= 4.2.0; we can use "GCC diagnostic ignored/warning
|
||||
-Wxxx" */
|
||||
# define DIAG_PRAGMA(x) DIAG_DO_PRAGMA(GCC diagnostic x)
|
||||
|
|
Loading…
Reference in New Issue