Revert "Don't evaluate short-circuited preprocessor expressions"
Build break on Clang:
FAILED: /b/build/goma/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/third_party/angle/src/compiler/preprocessor/preprocessor.ExpressionParser.o.d -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=245965-1 -DUSE_LIBJPEG_TURBO=1 -DENABLE_ONE_CLICK_SIGNIN -DENABLE_PRE_SYNC_BACKUP -DENABLE_WEBRTC=1 -DENABLE_MEDIA_ROUTER=1 -DUSE_PROPRIETARY_CODECS -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS -DENABLE_HIDPI=1 -DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA -DDCHECK_ALWAYS_ON=1 -DFIELDTRIAL_TESTING_ENABLED -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PDF=1 -DENABLE_PLUGIN_INSTALLATION=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_BACKGROUND=1 -DENABLE_GOOGLE_NOW=1 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DUSE_BROWSER_SPELLCHECKER=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_SERVICE_DISCOVERY=1 -DENABLE_WIFI_BOOTSTRAPPING=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DSAFE_BROWSING_SERVICE -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -Igen -isysroot /Applications/Xcode5.1.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -O2 -gdwarf-2 -fvisibility=hidden -Werror -Wnewline-eof -mmacosx-version-min=10.6 -arch x86_64 -Wendif-labels -Wno-unused-parameter -Wno-missing-field-initializers -Wno-selector-type-mismatch -Wpartial-availability -Wheader-hygiene -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing -Wno-deprecated-register -Wno-inconsistent-missing-override -Wno-shift-negative-value -Wno-unused-function -Wno-unused-variable -std=c++11 -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -fno-threadsafe-statics -Xclang -load -Xclang /b/build/slave/GPU_Mac_Builder/build/src/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-templates -fcolor-diagnostics -fno-strict-aliasing -c ../../third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp -o obj/third_party/angle/src/compiler/preprocessor/preprocessor.ExpressionParser.o
../../third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp:1372:35: error: use of logical '||' with constant operand [-Werror,-Wconstant-logical-operand]
(yyval) = (yyvsp[-3]) || 0;
^ ~
../../third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp:1372:35: note: use '|' for a bitwise operation
(yyval) = (yyvsp[-3]) || 0;
^~
|
../../third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp:1406:35: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
(yyval) = (yyvsp[-3]) && 0;
^ ~
../../third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp:1406:35: note: use '&' for a bitwise operation
(yyval) = (yyvsp[-3]) && 0;
^~
&
../../third_party/angle/src/compiler/preprocessor/ExpressionParser.cpp:1406:35: note: remove constant to silence this warning
(yyval) = (yyvsp[-3]) && 0;
~^~~~
BUG=angleproject:347
This reverts commit 6ffe613518482b966b913013c51221ce06ca7c33.
Change-Id: I6d81666cca573f320bfb1164a6c794b6f75f7463
Reviewed-on: https://chromium-review.googlesource.com/298020
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/preprocessor/ExpressionParser.cpp b/src/compiler/preprocessor/ExpressionParser.cpp
index 19944dc..683195c 100644
--- a/src/compiler/preprocessor/ExpressionParser.cpp
+++ b/src/compiler/preprocessor/ExpressionParser.cpp
@@ -122,13 +122,6 @@
pp::Lexer* lexer;
pp::Token* token;
int* result;
-
- void startIgnoreErrors() { ++ignoreErrors; }
- void endIgnoreErrors() { --ignoreErrors; }
-
- bool isIgnoringErrors() { return ignoreErrors > 0; }
-
- int ignoreErrors;
};
} // namespace
@@ -169,16 +162,15 @@
enum yytokentype
{
TOK_CONST_INT = 258,
- TOK_IDENTIFIER = 259,
- TOK_OP_OR = 260,
- TOK_OP_AND = 261,
- TOK_OP_EQ = 262,
- TOK_OP_NE = 263,
- TOK_OP_LE = 264,
- TOK_OP_GE = 265,
- TOK_OP_LEFT = 266,
- TOK_OP_RIGHT = 267,
- TOK_UNARY = 268
+ TOK_OP_OR = 259,
+ TOK_OP_AND = 260,
+ TOK_OP_EQ = 261,
+ TOK_OP_NE = 262,
+ TOK_OP_LE = 263,
+ TOK_OP_GE = 264,
+ TOK_OP_LEFT = 265,
+ TOK_OP_RIGHT = 266,
+ TOK_UNARY = 267
};
#endif
@@ -437,23 +429,23 @@
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 15
+#define YYFINAL 14
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 176
+#define YYLAST 175
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 28
+#define YYNTOKENS 27
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 5
+#define YYNNTS 3
/* YYNRULES -- Number of rules. */
-#define YYNRULES 29
+#define YYNRULES 26
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 55
+#define YYNSTATES 52
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 268
+#define YYMAXUTOK 267
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -465,16 +457,16 @@
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 24, 2, 2, 2, 22, 9, 2,
- 26, 27, 20, 18, 2, 19, 2, 21, 2, 2,
+ 2, 2, 2, 23, 2, 2, 2, 21, 8, 2,
+ 25, 26, 19, 17, 2, 18, 2, 20, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 12, 2, 13, 2, 2, 2, 2, 2, 2, 2,
+ 11, 2, 12, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 8, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 7, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 7, 2, 25, 2, 2, 2,
+ 2, 2, 2, 2, 6, 2, 24, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -488,16 +480,16 @@
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 10, 11, 14, 15, 16, 17, 23
+ 5, 9, 10, 13, 14, 15, 16, 22
};
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
-static const yytype_uint16 yyrline[] =
+static const yytype_uint8 yyrline[] =
{
- 0, 105, 105, 111, 112, 118, 118, 141, 141, 164,
- 167, 170, 173, 176, 179, 182, 185, 188, 191, 194,
- 197, 200, 203, 226, 249, 252, 255, 258, 261, 264
+ 0, 97, 97, 104, 105, 108, 111, 114, 117, 120,
+ 123, 126, 129, 132, 135, 138, 141, 144, 147, 150,
+ 163, 176, 179, 182, 185, 188, 191
};
#endif
@@ -506,11 +498,11 @@
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "TOK_CONST_INT", "TOK_IDENTIFIER",
- "TOK_OP_OR", "TOK_OP_AND", "'|'", "'^'", "'&'", "TOK_OP_EQ", "TOK_OP_NE",
- "'<'", "'>'", "TOK_OP_LE", "TOK_OP_GE", "TOK_OP_LEFT", "TOK_OP_RIGHT",
- "'+'", "'-'", "'*'", "'/'", "'%'", "TOK_UNARY", "'!'", "'~'", "'('",
- "')'", "$accept", "input", "expression", "$@1", "$@2", YY_NULLPTR
+ "$end", "error", "$undefined", "TOK_CONST_INT", "TOK_OP_OR",
+ "TOK_OP_AND", "'|'", "'^'", "'&'", "TOK_OP_EQ", "TOK_OP_NE", "'<'",
+ "'>'", "TOK_OP_LE", "TOK_OP_GE", "TOK_OP_LEFT", "TOK_OP_RIGHT", "'+'",
+ "'-'", "'*'", "'/'", "'%'", "TOK_UNARY", "'!'", "'~'", "'('", "')'",
+ "$accept", "input", "expression", YY_NULLPTR
};
#endif
@@ -519,16 +511,16 @@
(internal) symbol number NUM (which must be that of a token). */
static const yytype_uint16 yytoknum[] =
{
- 0, 256, 257, 258, 259, 260, 261, 124, 94, 38,
- 262, 263, 60, 62, 264, 265, 266, 267, 43, 45,
- 42, 47, 37, 268, 33, 126, 40, 41
+ 0, 256, 257, 258, 259, 260, 124, 94, 38, 261,
+ 262, 60, 62, 263, 264, 265, 266, 43, 45, 42,
+ 47, 37, 267, 33, 126, 40, 41
};
# endif
-#define YYPACT_NINF -12
+#define YYPACT_NINF -11
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-12)))
+ (!!((Yystate) == (-11)))
#define YYTABLE_NINF -1
@@ -539,12 +531,12 @@
STATE-NUM. */
static const yytype_int16 yypact[] =
{
- 31, -12, -12, 31, 31, 31, 31, 31, 51, 76,
- -12, -12, -12, -12, 53, -12, -12, -12, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, -12, 31, 31, 124, 138, 26,
- 149, 149, -11, -11, -11, -11, 154, 154, -8, -8,
- -12, -12, -12, 93, 109
+ 46, -11, 46, 46, 46, 46, 46, 12, 68, -11,
+ -11, -11, -11, 27, -11, 46, 46, 46, 46, 46,
+ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+ 46, 46, 46, -11, 85, 101, 116, 130, 143, 154,
+ 154, -10, -10, -10, -10, 37, 37, 31, 31, -11,
+ -11, -11
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -552,24 +544,24 @@
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 3, 4, 0, 0, 0, 0, 0, 0, 2,
- 28, 27, 25, 26, 0, 1, 5, 7, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 2, 25,
+ 24, 22, 23, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 29, 0, 0, 9, 10, 11,
- 13, 12, 17, 16, 15, 14, 19, 18, 21, 20,
- 24, 23, 22, 6, 8
+ 0, 0, 0, 26, 4, 5, 6, 7, 8, 10,
+ 9, 14, 13, 12, 11, 16, 15, 18, 17, 21,
+ 20, 19
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -12, -12, -3, -12, -12
+ -11, -11, -2
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 8, 9, 35, 36
+ -1, 7, 8
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -577,74 +569,74 @@
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] =
{
- 10, 11, 12, 13, 14, 27, 28, 29, 30, 31,
- 32, 33, 31, 32, 33, 37, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 0, 53, 54, 1, 2, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 3,
- 4, 15, 0, 0, 0, 5, 6, 7, 16, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, 33, 0, 0, 0, 0,
- 34, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, 33, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 20, 21, 22,
+ 9, 10, 11, 12, 13, 26, 27, 28, 29, 30,
+ 31, 32, 14, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 32, 1,
+ 30, 31, 32, 33, 28, 29, 30, 31, 32, 0,
+ 0, 0, 0, 2, 3, 0, 0, 0, 0, 4,
+ 5, 6, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 29, 30, 31, 32, 33
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 31, 32, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32
};
static const yytype_int8 yycheck[] =
{
- 3, 4, 5, 6, 7, 16, 17, 18, 19, 20,
- 21, 22, 20, 21, 22, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, -1, 35, 36, 3, 4, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 18,
- 19, 0, -1, -1, -1, 24, 25, 26, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, -1, -1, -1, -1,
- 27, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 9, 10, 11,
+ 2, 3, 4, 5, 6, 15, 16, 17, 18, 19,
+ 20, 21, 0, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 3,
+ 19, 20, 21, 26, 17, 18, 19, 20, 21, -1,
+ -1, -1, -1, 17, 18, -1, -1, -1, -1, 23,
+ 24, 25, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 18, 19, 20, 21, 22
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 3, 4, 18, 19, 24, 25, 26, 29, 30,
- 30, 30, 30, 30, 30, 0, 5, 6, 7, 8,
+ 0, 3, 17, 18, 23, 24, 25, 28, 29, 29,
+ 29, 29, 29, 29, 0, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 27, 31, 32, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30
+ 19, 20, 21, 26, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 28, 29, 30, 30, 31, 30, 32, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30
+ 0, 27, 28, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 1, 1, 1, 0, 4, 0, 4, 3,
+ 0, 2, 1, 1, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 2, 2, 2, 2, 3
+ 3, 3, 2, 2, 2, 2, 3
};
@@ -1330,6 +1322,7 @@
{
*(context->result) = static_cast<int>((yyvsp[0]));
+ YYACCEPT;
}
break;
@@ -1337,10 +1330,7 @@
case 4:
{
- if (!context->isIgnoringErrors())
- {
- YYABORT;
- }
+ (yyval) = (yyvsp[-2]) || (yyvsp[0]);
}
break;
@@ -1348,15 +1338,7 @@
case 5:
{
- if ((yyvsp[-1]) != 0)
- {
- // Ignore errors in the short-circuited part of the expression.
- // ESSL3.00 section 3.4:
- // If an operand is not evaluated, the presence of undefined identifiers
- // in the operand will not cause an error.
- // Unevaluated division by zero should not cause an error either.
- context->startIgnoreErrors();
- }
+ (yyval) = (yyvsp[-2]) && (yyvsp[0]);
}
break;
@@ -1364,17 +1346,7 @@
case 6:
{
- if ((yyvsp[-3]) != 0)
- {
- context->endIgnoreErrors();
- // Make sure that short-circuited version of || works consistently
- // with the normal version even for values other than 0 and 1.
- (yyval) = (yyvsp[-3]) || 0;
- }
- else
- {
- (yyval) = (yyvsp[-3]) || (yyvsp[0]);
- }
+ (yyval) = (yyvsp[-2]) | (yyvsp[0]);
}
break;
@@ -1382,15 +1354,7 @@
case 7:
{
- if ((yyvsp[-1]) == 0)
- {
- // Ignore errors in the short-circuited part of the expression.
- // ESSL3.00 section 3.4:
- // If an operand is not evaluated, the presence of undefined identifiers
- // in the operand will not cause an error.
- // Unevaluated division by zero should not cause an error either.
- context->startIgnoreErrors();
- }
+ (yyval) = (yyvsp[-2]) ^ (yyvsp[0]);
}
break;
@@ -1398,17 +1362,7 @@
case 8:
{
- if ((yyvsp[-3]) == 0)
- {
- context->endIgnoreErrors();
- // Make sure that short-circuited version of && works consistently
- // with the normal version even for values other than 0 and 1.
- (yyval) = (yyvsp[-3]) && 0;
- }
- else
- {
- (yyval) = (yyvsp[-3]) && (yyvsp[0]);
- }
+ (yyval) = (yyvsp[-2]) & (yyvsp[0]);
}
break;
@@ -1416,7 +1370,7 @@
case 9:
{
- (yyval) = (yyvsp[-2]) | (yyvsp[0]);
+ (yyval) = (yyvsp[-2]) != (yyvsp[0]);
}
break;
@@ -1424,7 +1378,7 @@
case 10:
{
- (yyval) = (yyvsp[-2]) ^ (yyvsp[0]);
+ (yyval) = (yyvsp[-2]) == (yyvsp[0]);
}
break;
@@ -1432,7 +1386,7 @@
case 11:
{
- (yyval) = (yyvsp[-2]) & (yyvsp[0]);
+ (yyval) = (yyvsp[-2]) >= (yyvsp[0]);
}
break;
@@ -1440,7 +1394,7 @@
case 12:
{
- (yyval) = (yyvsp[-2]) != (yyvsp[0]);
+ (yyval) = (yyvsp[-2]) <= (yyvsp[0]);
}
break;
@@ -1448,7 +1402,7 @@
case 13:
{
- (yyval) = (yyvsp[-2]) == (yyvsp[0]);
+ (yyval) = (yyvsp[-2]) > (yyvsp[0]);
}
break;
@@ -1456,7 +1410,7 @@
case 14:
{
- (yyval) = (yyvsp[-2]) >= (yyvsp[0]);
+ (yyval) = (yyvsp[-2]) < (yyvsp[0]);
}
break;
@@ -1464,7 +1418,7 @@
case 15:
{
- (yyval) = (yyvsp[-2]) <= (yyvsp[0]);
+ (yyval) = (yyvsp[-2]) >> (yyvsp[0]);
}
break;
@@ -1472,7 +1426,7 @@
case 16:
{
- (yyval) = (yyvsp[-2]) > (yyvsp[0]);
+ (yyval) = (yyvsp[-2]) << (yyvsp[0]);
}
break;
@@ -1480,7 +1434,7 @@
case 17:
{
- (yyval) = (yyvsp[-2]) < (yyvsp[0]);
+ (yyval) = (yyvsp[-2]) - (yyvsp[0]);
}
break;
@@ -1488,7 +1442,7 @@
case 18:
{
- (yyval) = (yyvsp[-2]) >> (yyvsp[0]);
+ (yyval) = (yyvsp[-2]) + (yyvsp[0]);
}
break;
@@ -1496,7 +1450,17 @@
case 19:
{
- (yyval) = (yyvsp[-2]) << (yyvsp[0]);
+ if ((yyvsp[0]) == 0) {
+ std::ostringstream stream;
+ stream << (yyvsp[-2]) << " % " << (yyvsp[0]);
+ std::string text = stream.str();
+ context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
+ context->token->location,
+ text.c_str());
+ YYABORT;
+ } else {
+ (yyval) = (yyvsp[-2]) % (yyvsp[0]);
+ }
}
break;
@@ -1504,7 +1468,17 @@
case 20:
{
- (yyval) = (yyvsp[-2]) - (yyvsp[0]);
+ if ((yyvsp[0]) == 0) {
+ std::ostringstream stream;
+ stream << (yyvsp[-2]) << " / " << (yyvsp[0]);
+ std::string text = stream.str();
+ context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
+ context->token->location,
+ text.c_str());
+ YYABORT;
+ } else {
+ (yyval) = (yyvsp[-2]) / (yyvsp[0]);
+ }
}
break;
@@ -1512,7 +1486,7 @@
case 21:
{
- (yyval) = (yyvsp[-2]) + (yyvsp[0]);
+ (yyval) = (yyvsp[-2]) * (yyvsp[0]);
}
break;
@@ -1520,27 +1494,7 @@
case 22:
{
- if ((yyvsp[0]) == 0)
- {
- if (context->isIgnoringErrors())
- {
- (yyval) = static_cast<YYSTYPE>(0);
- }
- else
- {
- std::ostringstream stream;
- stream << (yyvsp[-2]) << " % " << (yyvsp[0]);
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
- context->token->location,
- text.c_str());
- YYABORT;
- }
- }
- else
- {
- (yyval) = (yyvsp[-2]) % (yyvsp[0]);
- }
+ (yyval) = ! (yyvsp[0]);
}
break;
@@ -1548,27 +1502,7 @@
case 23:
{
- if ((yyvsp[0]) == 0)
- {
- if (context->isIgnoringErrors())
- {
- (yyval) = static_cast<YYSTYPE>(0);
- }
- else
- {
- std::ostringstream stream;
- stream << (yyvsp[-2]) << " / " << (yyvsp[0]);
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
- context->token->location,
- text.c_str());
- YYABORT;
- }
- }
- else
- {
- (yyval) = (yyvsp[-2]) / (yyvsp[0]);
- }
+ (yyval) = ~ (yyvsp[0]);
}
break;
@@ -1576,7 +1510,7 @@
case 24:
{
- (yyval) = (yyvsp[-2]) * (yyvsp[0]);
+ (yyval) = - (yyvsp[0]);
}
break;
@@ -1584,36 +1518,12 @@
case 25:
{
- (yyval) = ! (yyvsp[0]);
- }
-
- break;
-
- case 26:
-
- {
- (yyval) = ~ (yyvsp[0]);
- }
-
- break;
-
- case 27:
-
- {
- (yyval) = - (yyvsp[0]);
- }
-
- break;
-
- case 28:
-
- {
(yyval) = + (yyvsp[0]);
}
break;
- case 29:
+ case 26:
{
(yyval) = (yyvsp[-1]);
@@ -1871,15 +1781,6 @@
type = TOK_CONST_INT;
break;
}
- case pp::Token::IDENTIFIER:
- if (!context->isIgnoringErrors())
- {
- context->diagnostics->report(pp::Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
- token->location, token->text);
- }
- *lvalp = static_cast<YYSTYPE>(-1);
- type = TOK_IDENTIFIER;
- break;
case pp::Token::OP_OR:
type = TOK_OP_OR;
break;
@@ -1954,7 +1855,6 @@
context.lexer = mLexer;
context.token = token;
context.result = result;
- context.ignoreErrors = 0;
int ret = yyparse(&context);
switch (ret)
{