forked from osmocom/wireshark
Use DIAG_OFF_FLEX/DIAG_ON_FLEX more consistently.
Add warning C4267 (size_t to int conversion) with MSVC to DIAG_OFF_FLEX. Addd -Wshorten-64-to-32 with Clang and GCC to DIAG_OFF_FLEX. Don't explicitly use #pragma to turn off warnings; use DIAG_OFF_FLEX for all of them. If we use DIAG_OFF_FLEX, use DIAG_ON_FLEX, even if we have no section of entirely included code at the end. Change-Id: Ibfd44e8954704e9a8bcb1bd8e54f31d28357fffb Reviewed-on: https://code.wireshark.org/review/25817 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
09671923ad
commit
72b57ac4ef
|
@ -1,12 +1,6 @@
|
||||||
%top {
|
%top {
|
||||||
/* Include this before everything else, for various large-file definitions */
|
/* Include this before everything else, for various large-file definitions */
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
// warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4267)
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -106,7 +100,10 @@
|
||||||
#include <epan/to_str.h>
|
#include <epan/to_str.h>
|
||||||
#include <wsutil/file_util.h>
|
#include <wsutil/file_util.h>
|
||||||
|
|
||||||
DIAG_OFF(sign-compare)
|
/*
|
||||||
|
* Disable diagnostics in the code generated by Flex.
|
||||||
|
*/
|
||||||
|
DIAG_OFF_FLEX
|
||||||
|
|
||||||
typedef struct entity_t {
|
typedef struct entity_t {
|
||||||
char* name;
|
char* name;
|
||||||
|
@ -626,14 +623,12 @@ description_attr description=\042
|
||||||
|
|
||||||
<OUTSIDE>. ;
|
<OUTSIDE>. ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
DIAG_ON(sign-compare)
|
/*
|
||||||
|
* Turn diagnostics back on, so we check the code that we've written.
|
||||||
|
*/
|
||||||
|
DIAG_ON_FLEX
|
||||||
|
|
||||||
static int debugging = 0;
|
static int debugging = 0;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
%top {
|
%top {
|
||||||
/* Include this before everything else, for various large-file definitions */
|
/* Include this before everything else, for various large-file definitions */
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
// warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4267)
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -94,7 +88,10 @@
|
||||||
#include "dtd_grammar.h"
|
#include "dtd_grammar.h"
|
||||||
#include "dtd_parse.h"
|
#include "dtd_parse.h"
|
||||||
|
|
||||||
DIAG_OFF(sign-compare)
|
/*
|
||||||
|
* Disable diagnostics in the code generated by Flex.
|
||||||
|
*/
|
||||||
|
DIAG_OFF_FLEX
|
||||||
|
|
||||||
struct _proto_xmlpi_attr {
|
struct _proto_xmlpi_attr {
|
||||||
const gchar* name;
|
const gchar* name;
|
||||||
|
@ -352,7 +349,10 @@ squoted ['][^\']*[']
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
DIAG_ON(sign-compare)
|
/*
|
||||||
|
* Turn diagnostics back on, so we check the code that we've written.
|
||||||
|
*/
|
||||||
|
DIAG_ON_FLEX
|
||||||
|
|
||||||
static dtd_token_data_t* new_token(gchar* text, gchar* location) {
|
static dtd_token_data_t* new_token(gchar* text, gchar* location) {
|
||||||
dtd_token_data_t* t = g_new(dtd_token_data_t,1);
|
dtd_token_data_t* t = g_new(dtd_token_data_t,1);
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
%top {
|
%top {
|
||||||
/* Include this before everything else, for various large-file definitions */
|
/* Include this before everything else, for various large-file definitions */
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
// warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4267)
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
%top {
|
%top {
|
||||||
/* Include this before everything else, for various large-file definitions */
|
/* Include this before everything else, for various large-file definitions */
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
// warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4267)
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -106,7 +100,10 @@
|
||||||
|
|
||||||
#include "wimaxasncp_dict.h"
|
#include "wimaxasncp_dict.h"
|
||||||
|
|
||||||
DIAG_OFF(sign-compare)
|
/*
|
||||||
|
* Disable diagnostics in the code generated by Flex.
|
||||||
|
*/
|
||||||
|
DIAG_OFF_FLEX
|
||||||
|
|
||||||
typedef struct entity_t {
|
typedef struct entity_t {
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
@ -514,14 +511,12 @@ since_attr since=\042
|
||||||
|
|
||||||
<OUTSIDE>. ;
|
<OUTSIDE>. ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
DIAG_ON(sign-compare)
|
/*
|
||||||
|
* Turn diagnostics back on, so we check the code that we've written.
|
||||||
|
*/
|
||||||
|
DIAG_ON_FLEX
|
||||||
|
|
||||||
static int debugging = 0;
|
static int debugging = 0;
|
||||||
|
|
||||||
|
|
|
@ -106,3 +106,10 @@ eol \r?\n\r?
|
||||||
if (parse_token(T_EOL, NULL) != EXIT_SUCCESS) return EXIT_FAILURE; }
|
if (parse_token(T_EOL, NULL) != EXIT_SUCCESS) return EXIT_FAILURE; }
|
||||||
{comment} { if (parse_token(T_EOL, NULL) != EXIT_SUCCESS) return EXIT_FAILURE; }
|
{comment} { if (parse_token(T_EOL, NULL) != EXIT_SUCCESS) return EXIT_FAILURE; }
|
||||||
{text} { if (parse_token(T_TEXT, yytext) != EXIT_SUCCESS) return EXIT_FAILURE; }
|
{text} { if (parse_token(T_TEXT, yytext) != EXIT_SUCCESS) return EXIT_FAILURE; }
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Turn diagnostics back on, so we check the code that we've written.
|
||||||
|
*/
|
||||||
|
DIAG_ON_FLEX
|
||||||
|
|
|
@ -135,3 +135,10 @@ eol \r?\n\r?
|
||||||
{text} { parse_token(T_TEXT, yytext); }
|
{text} { parse_token(T_TEXT, yytext); }
|
||||||
|
|
||||||
<<EOF>> { write_current_packet(); yyterminate(); }
|
<<EOF>> { write_current_packet(); yyterminate(); }
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Turn diagnostics back on, so we check the code that we've written.
|
||||||
|
*/
|
||||||
|
DIAG_ON_FLEX
|
||||||
|
|
|
@ -65,7 +65,10 @@
|
||||||
#include "ascend.h"
|
#include "ascend.h"
|
||||||
#include "file_wrappers.h"
|
#include "file_wrappers.h"
|
||||||
|
|
||||||
DIAG_OFF(sign-compare)
|
/*
|
||||||
|
* Disable diagnostics in the code generated by Flex.
|
||||||
|
*/
|
||||||
|
DIAG_OFF_FLEX
|
||||||
|
|
||||||
#define YY_INPUT(buf,result,max_size) { \
|
#define YY_INPUT(buf,result,max_size) { \
|
||||||
ascend_state_t *parser_state = ascendget_extra(yyscanner); \
|
ascend_state_t *parser_state = ascendget_extra(yyscanner); \
|
||||||
|
@ -372,3 +375,10 @@ task:|task|at|time:|octets { return KEYWORD; }
|
||||||
<<EOF>> { yyterminate(); }
|
<<EOF>> { yyterminate(); }
|
||||||
|
|
||||||
(.|\n) ;
|
(.|\n) ;
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Turn diagnostics back on, so we check the code that we've written.
|
||||||
|
*/
|
||||||
|
DIAG_ON_FLEX
|
||||||
|
|
|
@ -101,7 +101,10 @@
|
||||||
#define YY_NO_UNISTD_H
|
#define YY_NO_UNISTD_H
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DIAG_OFF(sign-compare)
|
/*
|
||||||
|
* Disable diagnostics in the code generated by Flex.
|
||||||
|
*/
|
||||||
|
DIAG_OFF_FLEX
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* State kept by the scanner.
|
* State kept by the scanner.
|
||||||
|
@ -233,7 +236,10 @@ hdlc HDLC
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
DIAG_ON(sign-compare)
|
/*
|
||||||
|
* Turn diagnostics back on, so we check the code that we've written.
|
||||||
|
*/
|
||||||
|
DIAG_ON_FLEX
|
||||||
|
|
||||||
/* Fill in pkthdr */
|
/* Fill in pkthdr */
|
||||||
|
|
||||||
|
|
|
@ -100,15 +100,49 @@ extern "C" {
|
||||||
* generated by that version of Flex triggers?
|
* generated by that version of Flex triggers?
|
||||||
*/
|
*/
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
/*
|
||||||
|
* Suppress:
|
||||||
|
*
|
||||||
|
* warning C4018: signed/unsigned mismatch
|
||||||
|
* warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
|
||||||
|
*/
|
||||||
#define DIAG_OFF_FLEX \
|
#define DIAG_OFF_FLEX \
|
||||||
__pragma(warning(push)) \
|
__pragma(warning(push)) \
|
||||||
__pragma(warning(disable:4018))
|
__pragma(warning(disable:4018)) \
|
||||||
|
__pragma(warning(disable:4267))
|
||||||
#define DIAG_ON_FLEX __pragma(warning(pop))
|
#define DIAG_ON_FLEX __pragma(warning(pop))
|
||||||
#else
|
#else
|
||||||
|
/*
|
||||||
|
* Suppress:
|
||||||
|
*
|
||||||
|
* -Wsigned-compare warnings
|
||||||
|
* -Wshorten-64-to-32 warnings, if the compiler *has* -Wshorten-64-to-32
|
||||||
|
*
|
||||||
|
* We use DIAG_OFF() and DIAG_ON(), so we only use features that the
|
||||||
|
* compiler supports.
|
||||||
|
*
|
||||||
|
* We disable -Wshorten-64-to-32 if we're using Clang, or if __APPLE__
|
||||||
|
* is defined; that option was originally added to an Apple version of
|
||||||
|
* GCC, and at least some versions of Clang support it - given that
|
||||||
|
* the Clang work started at Apple, it may be in all versions of Clang.
|
||||||
|
*
|
||||||
|
* (Does no version of GCC or Clang support the same generic "you're
|
||||||
|
* narrowing a value, and you didn't throw in a cast to assert that
|
||||||
|
* you know what you're doing" warning that MSVC does?)
|
||||||
|
*/
|
||||||
|
#if defined(__clang__) || defined(__APPLE__)
|
||||||
|
#define DIAG_OFF_FLEX \
|
||||||
|
DIAG_OFF(sign-compare) \
|
||||||
|
DIAG_OFF(shorten-64-to-32)
|
||||||
|
#define DIAG_ON_FLEX \
|
||||||
|
DIAG_ON(shorten-64-to-32) \
|
||||||
|
DIAG_ON(sign-compare)
|
||||||
|
#else
|
||||||
#define DIAG_OFF_FLEX \
|
#define DIAG_OFF_FLEX \
|
||||||
DIAG_OFF(sign-compare)
|
DIAG_OFF(sign-compare)
|
||||||
#define DIAG_ON_FLEX \
|
#define DIAG_ON_FLEX \
|
||||||
DIAG_ON(sign-compare)
|
DIAG_ON(sign-compare)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue