Skip to content

Silence Visual Studio warnings for generated or lexer/parser code [blocks: #2310, #2551] #3425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/ansi-c/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ extern char *yyansi_ctext;

#include "ansi_c_y.tab.h"

#ifdef _MSC_VER
// possible loss of data
#pragma warning(disable:4242)
// possible loss of data
#pragma warning(disable:4244)
// signed/unsigned mismatch
#pragma warning(disable:4365)
// switch with default but no case labels
#pragma warning(disable:4065)
// unreachable code
#pragma warning(disable:4702)
#endif

// statements have right recursion, deep nesting of statements thus
// requires more stack space
#define YYMAXDEPTH 25600
Expand Down
8 changes: 8 additions & 0 deletions src/ansi-c/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

%{

#if defined _MSC_VER
// signed/unsigned mismatch
#pragma warning(disable:4365)
// macro re-definition: flex conditonally defines INT32_MAX et al. and thus
// they are set before library headers get to define them
#pragma warning(disable:4005)
#endif

/*
* This scanner is based on:
*
Expand Down
8 changes: 8 additions & 0 deletions src/assembler/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@

%{

#if defined _MSC_VER
// signed/unsigned mismatch
#pragma warning(disable:4365)
// macro re-definition: flex conditonally defines INT32_MAX et al. and thus
// they are set before library headers get to define them
#pragma warning(disable:4005)
#endif

#define PARSER assembler_parser
#define YYSTYPE unsigned
#undef ECHO
Expand Down
14 changes: 14 additions & 0 deletions src/jsil/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ extern char *yyjsiltext;
#include <util/string_constant.h>

#include "jsil_y.tab.h"

#ifdef _MSC_VER
// possible loss of data
#pragma warning(disable:4242)
// possible loss of data
#pragma warning(disable:4244)
// signed/unsigned mismatch
#pragma warning(disable:4365)
// switch with default but no case labels
#pragma warning(disable:4065)
// unreachable code
#pragma warning(disable:4702)
#endif

/*** token declaration **************************************************/
%}

Expand Down
8 changes: 8 additions & 0 deletions src/jsil/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

%{

#if defined _MSC_VER
// signed/unsigned mismatch
#pragma warning(disable:4365)
// macro re-definition: flex conditonally defines INT32_MAX et al. and thus
// they are set before library headers get to define them
#pragma warning(disable:4005)
#endif

#include <util/expr.h>

#include <ansi-c/literals/convert_float_literal.h>
Expand Down
13 changes: 13 additions & 0 deletions src/json/parser.y
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
%{
#ifdef _MSC_VER
// possible loss of data
#pragma warning(disable:4242)
// possible loss of data
#pragma warning(disable:4244)
// signed/unsigned mismatch
#pragma warning(disable:4365)
// switch with default but no case labels
#pragma warning(disable:4065)
// unreachable code
#pragma warning(disable:4702)
#endif

// Strictly follows http://www.json.org/
%}

Expand Down
8 changes: 8 additions & 0 deletions src/json/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@

%{

#if defined _MSC_VER
// signed/unsigned mismatch
#pragma warning(disable:4365)
// macro re-definition: flex conditonally defines INT32_MAX et al. and thus
// they are set before library headers get to define them
#pragma warning(disable:4005)
#endif

#define PARSER json_parser

#include "json_parser.h"
Expand Down
12 changes: 12 additions & 0 deletions src/xmllang/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ int yyxmlerror(const std::string &error)
return 0;
}

#ifdef _MSC_VER
// possible loss of data
#pragma warning(disable:4242)
// possible loss of data
#pragma warning(disable:4244)
// signed/unsigned mismatch
#pragma warning(disable:4365)
// switch with default but no case labels
#pragma warning(disable:4065)
// unreachable code
#pragma warning(disable:4702)
#endif
%}

%error-verbose
Expand Down
8 changes: 8 additions & 0 deletions src/xmllang/scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

%{

#if defined _MSC_VER
// signed/unsigned mismatch
#pragma warning(disable:4365)
// macro re-definition: flex conditonally defines INT32_MAX et al. and thus
// they are set before library headers get to define them
#pragma warning(disable:4005)
#endif

#include <cctype>
#include <cstring>
#include <cstdlib>
Expand Down