Edit

kc3-lang/libxkbcommon/src/xkbcomp/expr.h

Branch :

  • Show log

    Commit

  • Author : Ran Benita
    Date : 2025-02-07 14:10:16
    Hash : aa3e4c71
    Message : xkbcomp/expr: remove unused ExprResolveKeyCode This function was added in commit 4e22851141d89436c0659e68da57e91bbf971461. But that commit also changed the grammar: -KeyNameDecl : KeyName EQUALS Expr SEMI +KeyNameDecl : KeyName EQUALS KeyCode SEMI i.e. while before you could write <AE01> = 9+1; now this is a syntax error, an integer literal is expected. I'm not sure if it was intended to remove this ability. In any case, this rendered `ExprResolveKeyCode` useless since there's no longer an expression to evaluate, and after some refactoring it went unused. Even if we choose to restore Expr here, I don't see a reason for the specialized function over `ExprResolveInteger` except the type (which we should probably widen from int to int64_t...). So remove it. Signed-off-by: Ran Benita <ran@unusedvar.com>

  • src/xkbcomp/expr.h
  • /*
     * Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
     * SPDX-License-Identifier: HPND
     */
    #pragma once
    
    #include "ast.h"
    #include "keymap.h"
    #include "text.h"
    
    bool
    ExprResolveLhs(struct xkb_context *ctx, const ExprDef *expr,
                   const char **elem_rtrn, const char **field_rtrn,
                   ExprDef **index_rtrn);
    
    bool
    ExprResolveModMask(struct xkb_context *ctx, const ExprDef *expr,
                       enum mod_type mod_type, const struct xkb_mod_set *mods,
                       xkb_mod_mask_t *mask_rtrn);
    
    bool
    ExprResolveMod(struct xkb_context *ctx, const ExprDef *def,
                   enum mod_type mod_type, const struct xkb_mod_set *mods,
                   xkb_mod_index_t *ndx_rtrn);
    
    bool
    ExprResolveBoolean(struct xkb_context *ctx, const ExprDef *expr,
                       bool *set_rtrn);
    
    bool
    ExprResolveInteger(struct xkb_context *ctx, const ExprDef *expr,
                       int *val_rtrn);
    
    bool
    ExprResolveLevel(struct xkb_context *ctx, const ExprDef *expr,
                     xkb_level_index_t *level_rtrn);
    
    bool
    ExprResolveGroup(struct xkb_context *ctx, const ExprDef *expr,
                     xkb_layout_index_t *group_rtrn);
    
    bool
    ExprResolveButton(struct xkb_context *ctx, const ExprDef *expr,
                      int *btn_rtrn);
    
    bool
    ExprResolveString(struct xkb_context *ctx, const ExprDef *expr,
                      xkb_atom_t *val_rtrn);
    
    bool
    ExprResolveEnum(struct xkb_context *ctx, const ExprDef *expr,
                    unsigned int *val_rtrn, const LookupEntry *values);
    
    bool
    ExprResolveMask(struct xkb_context *ctx, const ExprDef *expr,
                    unsigned int *mask_rtrn, const LookupEntry *values);
    
    bool
    ExprResolveKeySym(struct xkb_context *ctx, const ExprDef *expr,
                      xkb_keysym_t *sym_rtrn);