translator: Fix C++11-deprecated register usage.
Define 'register' as an empty string if we're in a modern version
of C++.
BUG=255186
BUG=angleproject:463
Change-Id: Ied044fb87a9b05c91cb419c54295c39f0f0ab776
Reviewed-on: https://chromium-review.googlesource.com/268512
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
diff --git a/src/compiler/preprocessor/Tokenizer.cpp b/src/compiler/preprocessor/Tokenizer.cpp
index b006d40..76bd873 100644
--- a/src/compiler/preprocessor/Tokenizer.cpp
+++ b/src/compiler/preprocessor/Tokenizer.cpp
@@ -552,6 +552,13 @@
#pragma warning(disable: 4244)
#endif
+// Workaround for flex using the register keyword, deprecated in C++11.
+#ifdef __cplusplus
+#if __cplusplus > 199711L
+#define register
+#endif
+#endif
+
typedef std::string YYSTYPE;
typedef pp::SourceLocation YYLTYPE;
diff --git a/src/compiler/preprocessor/Tokenizer.l b/src/compiler/preprocessor/Tokenizer.l
index 3a6a260..160d508 100644
--- a/src/compiler/preprocessor/Tokenizer.l
+++ b/src/compiler/preprocessor/Tokenizer.l
@@ -35,6 +35,13 @@
#pragma warning(disable: 4244)
#endif
+// Workaround for flex using the register keyword, deprecated in C++11.
+#ifdef __cplusplus
+#if __cplusplus > 199711L
+#define register
+#endif
+#endif
+
typedef std::string YYSTYPE;
typedef pp::SourceLocation YYLTYPE;
diff --git a/src/compiler/translator/glslang.l b/src/compiler/translator/glslang.l
index 309839b..1d2a640 100644
--- a/src/compiler/translator/glslang.l
+++ b/src/compiler/translator/glslang.l
@@ -51,6 +51,13 @@
#pragma warning(disable : 4102)
#endif
+// Workaround for flex using the register keyword, deprecated in C++11.
+#ifdef __cplusplus
+#if __cplusplus > 199711L
+#define register
+#endif
+#endif
+
#define YY_USER_ACTION \
yylloc->first_file = yylloc->last_file = yycolumn; \
yylloc->first_line = yylloc->last_line = yylineno;
diff --git a/src/compiler/translator/glslang_lex.cpp b/src/compiler/translator/glslang_lex.cpp
index 39d0ba7..1d5c049 100644
--- a/src/compiler/translator/glslang_lex.cpp
+++ b/src/compiler/translator/glslang_lex.cpp
@@ -1034,6 +1034,13 @@
#pragma warning(disable : 4102)
#endif
+// Workaround for flex using the register keyword, deprecated in C++11.
+#ifdef __cplusplus
+#if __cplusplus > 199711L
+#define register
+#endif
+#endif
+
#define YY_USER_ACTION \
yylloc->first_file = yylloc->last_file = yycolumn; \
yylloc->first_line = yylloc->last_line = yylineno;