From: Gunnar Beutner Date: Thu, 13 Nov 2014 08:02:43 +0000 (+0100) Subject: Remove unions from the DebugInfo class X-Git-Tag: v2.2.0~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02fef3f84a9737180922e962e68f38a38f1c7d16;p=icinga2 Remove unions from the DebugInfo class --- diff --git a/lib/base/debuginfo.hpp b/lib/base/debuginfo.hpp index 43829ec2e..316dc8286 100644 --- a/lib/base/debuginfo.hpp +++ b/lib/base/debuginfo.hpp @@ -36,29 +36,11 @@ struct DebugInfo { String Path; - union - { - int FirstLine; - int first_line; - }; + int FirstLine; + int FirstColumn; - union - { - int FirstColumn; - int first_column; - }; - - union - { - int LastLine; - int last_line; - }; - - union - { - int LastColumn; - int last_column; - }; + int LastLine; + int LastColumn; }; I2_BASE_API std::ostream& operator<<(std::ostream& out, const DebugInfo& val); diff --git a/lib/config/config_lexer.ll b/lib/config/config_lexer.ll index 90f03577b..81777bff8 100644 --- a/lib/config/config_lexer.ll +++ b/lib/config/config_lexer.ll @@ -41,6 +41,21 @@ do { \ yycolumn += yyleng; \ } while (0); +#define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } else { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC(Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC(Rhs, 0).last_column; \ + } \ + while (YYID(0)) + #define YY_INPUT(buf, result, max_size) \ do { \ result = yyextra->ReadInput(buf, max_size); \