Print this page
new smatch

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/expression.h
          +++ new/usr/src/tools/smatch/src/expression.h
↓ open down ↓ 56 lines elided ↑ open up ↑
  57   57          EXPR_COMMA,
  58   58          EXPR_COMPARE,
  59   59          EXPR_LABEL,
  60   60          EXPR_INITIALIZER,       // initializer list
  61   61          EXPR_IDENTIFIER,        // identifier in initializer
  62   62          EXPR_INDEX,             // index in initializer
  63   63          EXPR_POS,               // position in initializer
  64   64          EXPR_FVALUE,
  65   65          EXPR_SLICE,
  66   66          EXPR_OFFSETOF,
       67 +        EXPR_ASM_OPERAND,
  67   68  };
  68   69  
  69   70  
  70   71  /*
  71   72   * Flags for tracking the promotion of constness related attributes
  72   73   * from subexpressions to their parents.
  73   74   *
  74   75   * The flags are not independent as one might imply another.
  75   76   * The implications are as follows:
  76   77   * - CEF_INT, CEF_ENUM and
↓ open down ↓ 110 lines elided ↑ open up ↑
 187  188                  struct /* deref_arg */ {
 188  189                          struct expression *deref;
 189  190                          struct ident *member;
 190  191                          int member_offset;
 191  192                  };
 192  193                  // EXPR_SLICE
 193  194                  struct /* slice */ {
 194  195                          struct expression *base;
 195  196                          unsigned r_bitpos, r_nrbits;
 196  197                  };
 197      -                // EXPR_CAST and EXPR_SIZEOF
      198 +                // EXPR_CAST, EXPR_FORCE_CAST, EXPR_IMPLIED_CAST,
      199 +                // EXPR_SIZEOF, EXPR_ALIGNOF and EXPR_PTRSIZEOF
 198  200                  struct /* cast_arg */ {
 199  201                          struct symbol *cast_type;
 200  202                          struct expression *cast_expression;
 201  203                  };
 202  204                  // EXPR_CONDITIONAL
 203  205                  // EXPR_SELECT
 204  206                  struct /* conditional_expr */ {
 205  207                          struct expression *conditional, *cond_true, *cond_false;
 206  208                  };
 207  209                  // EXPR_CALL
↓ open down ↓ 26 lines elided ↑ open up ↑
 234  236                  };
 235  237                  // EXPR_OFFSETOF
 236  238                  struct {
 237  239                          struct symbol *in;
 238  240                          struct expression *down;
 239  241                          union {
 240  242                                  struct ident *ident;
 241  243                                  struct expression *index;
 242  244                          };
 243  245                  };
      246 +                // EXPR_ASM_OPERAND
      247 +                struct {
      248 +                        struct ident *name;
      249 +                        struct expression *constraint;
      250 +                        struct expression *expr;
      251 +                };
 244  252          };
 245  253  };
 246  254  
 247      -/* Constant expression values */
 248      -int is_zero_constant(struct expression *);
      255 +///
      256 +// Constant expression values
      257 +// --------------------------
      258 +
      259 +///
      260 +// test if an expression evaluates to the constant ``0``.
      261 +// @return: ``1`` if @expr evaluate to ``0``,
      262 +//      ``0`` otherwise.
      263 +int is_zero_constant(struct expression *expr);
      264 +
      265 +///
      266 +// test the compile time truth value of an expression
      267 +// @return:
      268 +//      * ``-1`` if @expr is not constant,
      269 +//      * ``0`` or ``1`` depending on the truth value of @expr.
 249  270  int expr_truth_value(struct expression *expr);
      271 +
 250  272  long long get_expression_value(struct expression *);
 251  273  long long const_expression_value(struct expression *);
 252  274  long long get_expression_value_silent(struct expression *expr);
 253  275  
 254  276  /* Expression parsing */
 255  277  struct token *parse_expression(struct token *token, struct expression **tree);
 256  278  struct token *conditional_expression(struct token *token, struct expression **tree);
 257  279  struct token *primary_expression(struct token *token, struct expression **tree);
 258  280  struct token *parens_expression(struct token *token, struct expression **expr, const char *where);
 259  281  struct token *assignment_expression(struct token *token, struct expression **tree);
↓ open down ↓ 53 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX