summaryrefslogtreecommitdiff
path: root/src/xkbcomp
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2014-02-13 23:57:22 +0200
committerRan Benita <ran234@gmail.com>2014-02-14 00:37:15 +0200
commit1b2bb204e0baa2246a6232aea762c1edb00cd44a (patch)
tree4ac7ea2268d876954bec40fb5f14c6394ec59eca /src/xkbcomp
parent6248b09feb6d960e2c6775b1cb3a801a5c91136d (diff)
downloadlibxkbcommon-1b2bb204e0baa2246a6232aea762c1edb00cd44a.tar.gz
libxkbcommon-1b2bb204e0baa2246a6232aea762c1edb00cd44a.tar.bz2
libxkbcommon-1b2bb204e0baa2246a6232aea762c1edb00cd44a.zip
ast: cast to ParseCommon explictly instead of using ->common
Some tools were getting mighty confused with what we were doing. Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/xkbcomp')
-rw-r--r--src/xkbcomp/ast-build.c39
-rw-r--r--src/xkbcomp/parser.y56
2 files changed, 49 insertions, 46 deletions
diff --git a/src/xkbcomp/ast-build.c b/src/xkbcomp/ast-build.c
index 1982b32..11bc091 100644
--- a/src/xkbcomp/ast-build.c
+++ b/src/xkbcomp/ast-build.c
@@ -53,7 +53,6 @@
#include "xkbcomp-priv.h"
#include "ast-build.h"
-#include "parser-priv.h"
#include "include.h"
ParseCommon *
@@ -533,7 +532,7 @@ XkbFileFromComponents(struct xkb_context *ctx,
if (!include)
goto err;
- file = XkbFileCreate(type, NULL, &include->common, 0);
+ file = XkbFileCreate(type, NULL, (ParseCommon *) include, 0);
if (!file) {
FreeInclude(include);
goto err;
@@ -565,7 +564,7 @@ FreeExpr(ExprDef *expr)
case EXPR_UNARY_PLUS:
case EXPR_NOT:
case EXPR_INVERT:
- FreeStmt(&expr->unary.child->common);
+ FreeStmt((ParseCommon *) expr->unary.child);
break;
case EXPR_DIVIDE:
@@ -573,16 +572,16 @@ FreeExpr(ExprDef *expr)
case EXPR_SUBTRACT:
case EXPR_MULTIPLY:
case EXPR_ASSIGN:
- FreeStmt(&expr->binary.left->common);
- FreeStmt(&expr->binary.right->common);
+ FreeStmt((ParseCommon *) expr->binary.left);
+ FreeStmt((ParseCommon *) expr->binary.right);
break;
case EXPR_ACTION_DECL:
- FreeStmt(&expr->action.args->common);
+ FreeStmt((ParseCommon *) expr->action.args);
break;
case EXPR_ARRAY_REF:
- FreeStmt(&expr->array_ref.entry->common);
+ FreeStmt((ParseCommon *) expr->array_ref.entry);
break;
case EXPR_KEYSYM_LIST:
@@ -619,12 +618,10 @@ void
FreeStmt(ParseCommon *stmt)
{
ParseCommon *next;
- YYSTYPE u;
while (stmt)
{
next = stmt->next;
- u.any = stmt;
switch (stmt->type) {
case STMT_INCLUDE:
@@ -633,36 +630,36 @@ FreeStmt(ParseCommon *stmt)
stmt = NULL;
break;
case STMT_EXPR:
- FreeExpr(u.expr);
+ FreeExpr((ExprDef *) stmt);
break;
case STMT_VAR:
- FreeStmt(&u.var->name->common);
- FreeStmt(&u.var->value->common);
+ FreeStmt((ParseCommon *) ((VarDef *) stmt)->name);
+ FreeStmt((ParseCommon *) ((VarDef *) stmt)->value);
break;
case STMT_TYPE:
- FreeStmt(&u.keyType->body->common);
+ FreeStmt((ParseCommon *) ((KeyTypeDef *) stmt)->body);
break;
case STMT_INTERP:
- FreeStmt(&u.interp->match->common);
- FreeStmt(&u.interp->def->common);
+ FreeStmt((ParseCommon *) ((InterpDef *) stmt)->match);
+ FreeStmt((ParseCommon *) ((InterpDef *) stmt)->def);
break;
case STMT_VMOD:
- FreeStmt(&u.vmod->value->common);
+ FreeStmt((ParseCommon *) ((VModDef *) stmt)->value);
break;
case STMT_SYMBOLS:
- FreeStmt(&u.syms->symbols->common);
+ FreeStmt((ParseCommon *) ((SymbolsDef *) stmt)->symbols);
break;
case STMT_MODMAP:
- FreeStmt(&u.modMask->keys->common);
+ FreeStmt((ParseCommon *) ((ModMapDef *) stmt)->keys);
break;
case STMT_GROUP_COMPAT:
- FreeStmt(&u.groupCompat->def->common);
+ FreeStmt((ParseCommon *) ((GroupCompatDef *) stmt)->def);
break;
case STMT_LED_MAP:
- FreeStmt(&u.ledMap->body->common);
+ FreeStmt((ParseCommon *) ((LedMapDef *) stmt)->body);
break;
case STMT_LED_NAME:
- FreeStmt(&u.ledName->name->common);
+ FreeStmt((ParseCommon *) ((LedNameDef *) stmt)->name);
break;
default:
break;
diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y
index d9f6cbc..d94e7cb 100644
--- a/src/xkbcomp/parser.y
+++ b/src/xkbcomp/parser.y
@@ -240,7 +240,7 @@ XkbFile : XkbCompositeMap
XkbCompositeMap : OptFlags XkbCompositeType OptMapName OBRACE
XkbMapConfigList
CBRACE SEMI
- { $$ = XkbFileCreate($2, $3, &$5->common, $1); }
+ { $$ = XkbFileCreate($2, $3, (ParseCommon *) $5, $1); }
;
XkbCompositeType: XKB_KEYMAP { $$ = FILE_TYPE_KEYMAP; }
@@ -253,7 +253,8 @@ XkbMapConfigList : XkbMapConfigList XkbMapConfig
if (!$2)
$$ = $1;
else
- $$ = (XkbFile *)AppendStmt(&$1->common, &$2->common);
+ $$ = (XkbFile *) AppendStmt((ParseCommon *) $1,
+ (ParseCommon *) $2);
}
| XkbMapConfig
{ $$ = $1; }
@@ -307,64 +308,64 @@ DeclList : DeclList Decl
Decl : OptMergeMode VarDecl
{
$2->merge = $1;
- $$ = &$2->common;
+ $$ = (ParseCommon *) $2;
}
| OptMergeMode VModDecl
{
$2->merge = $1;
- $$ = &$2->common;
+ $$ = (ParseCommon *) $2;
}
| OptMergeMode InterpretDecl
{
$2->merge = $1;
- $$ = &$2->common;
+ $$ = (ParseCommon *) $2;
}
| OptMergeMode KeyNameDecl
{
$2->merge = $1;
- $$ = &$2->common;
+ $$ = (ParseCommon *) $2;
}
| OptMergeMode KeyAliasDecl
{
$2->merge = $1;
- $$ = &$2->common;
+ $$ = (ParseCommon *) $2;
}
| OptMergeMode KeyTypeDecl
{
$2->merge = $1;
- $$ = &$2->common;
+ $$ = (ParseCommon *) $2;
}
| OptMergeMode SymbolsDecl
{
$2->merge = $1;
- $$ = &$2->common;
+ $$ = (ParseCommon *) $2;
}
| OptMergeMode ModMapDecl
{
$2->merge = $1;
- $$ = &$2->common;
+ $$ = (ParseCommon *) $2;
}
| OptMergeMode GroupCompatDecl
{
$2->merge = $1;
- $$ = &$2->common;
+ $$ = (ParseCommon *) $2;
}
| OptMergeMode LedMapDecl
{
$2->merge = $1;
- $$ = &$2->common;
+ $$ = (ParseCommon *) $2;
}
| OptMergeMode LedNameDecl
{
$2->merge = $1;
- $$ = &$2->common;
+ $$ = (ParseCommon *) $2;
}
| OptMergeMode ShapeDecl { $$ = NULL; }
| OptMergeMode SectionDecl { $$ = NULL; }
| OptMergeMode DoodadDecl { $$ = NULL; }
| MergeMode STRING
{
- $$ = &IncludeCreate(param->ctx, $2, $1)->common;
+ $$ = (ParseCommon *) IncludeCreate(param->ctx, $2, $1);
free($2);
}
;
@@ -390,7 +391,8 @@ VModDecl : VIRTUAL_MODS VModDefList SEMI
;
VModDefList : VModDefList COMMA VModDef
- { $$ = (VModDef *)AppendStmt(&$1->common, &$3->common); }
+ { $$ = (VModDef *) AppendStmt((ParseCommon *) $1,
+ (ParseCommon *) $3); }
| VModDef
{ $$ = $1; }
;
@@ -414,7 +416,8 @@ InterpretMatch : KeySym PLUS Expr
;
VarDeclList : VarDeclList VarDecl
- { $$ = (VarDef *)AppendStmt(&$1->common, &$2->common); }
+ { $$ = (VarDef *) AppendStmt((ParseCommon *) $1,
+ (ParseCommon *) $2); }
| VarDecl
{ $$ = $1; }
;
@@ -432,7 +435,8 @@ SymbolsDecl : KEY KEYNAME OBRACE
;
SymbolsBody : SymbolsBody COMMA SymbolsVarDecl
- { $$ = (VarDef *)AppendStmt(&$1->common, &$3->common); }
+ { $$ = (VarDef *) AppendStmt((ParseCommon *) $1,
+ (ParseCommon *) $3); }
| SymbolsVarDecl
{ $$ = $1; }
| { $$ = NULL; }
@@ -486,11 +490,11 @@ SectionBody : SectionBody SectionBodyItem { $$ = NULL;}
SectionBodyItem : ROW OBRACE RowBody CBRACE SEMI
{ $$ = NULL; }
| VarDecl
- { FreeStmt(&$1->common); $$ = NULL; }
+ { FreeStmt((ParseCommon *) $1); $$ = NULL; }
| DoodadDecl
{ $$ = NULL; }
| LedMapDecl
- { FreeStmt(&$1->common); $$ = NULL; }
+ { FreeStmt((ParseCommon *) $1); $$ = NULL; }
| OverlayDecl
{ $$ = NULL; }
;
@@ -501,7 +505,7 @@ RowBody : RowBody RowBodyItem { $$ = NULL;}
RowBodyItem : KEYS OBRACE Keys CBRACE SEMI { $$ = NULL; }
| VarDecl
- { FreeStmt(&$1->common); $$ = NULL; }
+ { FreeStmt((ParseCommon *) $1); $$ = NULL; }
;
Keys : Keys COMMA Key { $$ = NULL; }
@@ -511,7 +515,7 @@ Keys : Keys COMMA Key { $$ = NULL; }
Key : KEYNAME
{ $$ = NULL; }
| OBRACE ExprList CBRACE
- { FreeStmt(&$2->common); $$ = NULL; }
+ { FreeStmt((ParseCommon *) $2); $$ = NULL; }
;
OverlayDecl : OVERLAY String OBRACE OverlayKeyList CBRACE SEMI
@@ -536,7 +540,7 @@ OutlineInList : OBRACE CoordList CBRACE
| Ident EQUALS OBRACE CoordList CBRACE
{ $$ = NULL; }
| Ident EQUALS Expr
- { FreeStmt(&$3->common); $$ = NULL; }
+ { FreeStmt((ParseCommon *) $3); $$ = NULL; }
;
CoordList : CoordList COMMA Coord
@@ -550,7 +554,7 @@ Coord : OBRACKET SignedNumber COMMA SignedNumber CBRACKET
;
DoodadDecl : DoodadType String OBRACE VarDeclList CBRACE SEMI
- { FreeStmt(&$4->common); $$ = NULL; }
+ { FreeStmt((ParseCommon *) $4); $$ = NULL; }
;
DoodadType : TEXT { $$ = 0; }
@@ -610,7 +614,8 @@ OptExprList : ExprList { $$ = $1; }
;
ExprList : ExprList COMMA Expr
- { $$ = (ExprDef *)AppendStmt(&$1->common, &$3->common); }
+ { $$ = (ExprDef *) AppendStmt((ParseCommon *) $1,
+ (ParseCommon *) $3); }
| Expr
{ $$ = $1; }
;
@@ -648,7 +653,8 @@ Term : MINUS Term
;
ActionList : ActionList COMMA Action
- { $$ = (ExprDef *)AppendStmt(&$1->common, &$3->common); }
+ { $$ = (ExprDef *) AppendStmt((ParseCommon *) $1,
+ (ParseCommon *) $3); }
| Action
{ $$ = $1; }
;