]> granicus.if.org Git - icinga2/commitdiff
Remove unions from the DebugInfo class
authorGunnar Beutner <gunnar.beutner@netways.de>
Thu, 13 Nov 2014 08:02:43 +0000 (09:02 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Thu, 13 Nov 2014 08:02:43 +0000 (09:02 +0100)
lib/base/debuginfo.hpp
lib/config/config_lexer.ll

index 43829ec2e92e606228a37f313d0cd6b3f763e500..316dc828698cf5243c0d033037ed56774b48bd77 100644 (file)
@@ -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);
index 90f03577bb057f56080e14e3d08ee054759283fa..81777bff8179f4bf7328f9957be5e58aacc86cdf 100644 (file)
@@ -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);     \