static match match_mult_operand (gfc_expr **result) { /* Workaround -Wmaybe-uninitialized false positive during profiledbootstrap by initializing them. */ gfc_expr *e = NULL, *exp, *r; locus where; match m; m = match_level_1 (&e); if (m != MATCH_YES) return m; if (!next_operator (INTRINSIC_POWER)) { *result = e; return MATCH_YES; } where = gfc_current_locus; m = match_ext_mult_operand (&exp); if (m == MATCH_NO) gfc_error ("Expected exponent in expression at %C"); if (m != MATCH_YES) { gfc_free_expr (e); return MATCH_ERROR; } r = gfc_power (e, exp); if (r == NULL) { gfc_free_expr (e); gfc_free_expr (exp); return MATCH_ERROR; } r->where = where; *result = r; return MATCH_YES; }
static match match_ext_mult_operand (gfc_expr **result) { gfc_expr *all, *e; locus where; match m; int i; where = gfc_current_locus; i = match_add_op (); if (i == 0) return match_mult_operand (result); if (gfc_notification_std (GFC_STD_GNU) == ERROR) { gfc_error ("Extension: Unary operator following " "arithmetic operator (use parentheses) at %C"); return MATCH_ERROR; } else gfc_warning (0, "Extension: Unary operator following " "arithmetic operator (use parentheses) at %C"); m = match_ext_mult_operand (&e); if (m != MATCH_YES) return m; if (i == -1) all = gfc_uminus (e); else all = gfc_uplus (e); if (all == NULL) { gfc_free_expr (e); return MATCH_ERROR; } all->where = where; *result = all; return MATCH_YES; }
static match match_mult_operand (gfc_expr **result) { gfc_expr *e, *exp, *r; locus where; match m; m = match_level_1 (&e); if (m != MATCH_YES) return m; if (!next_operator (INTRINSIC_POWER)) { *result = e; return MATCH_YES; } where = gfc_current_locus; m = match_ext_mult_operand (&exp); if (m == MATCH_NO) gfc_error ("Expected exponent in expression at %C"); if (m != MATCH_YES) { gfc_free_expr (e); return MATCH_ERROR; } r = gfc_power (e, exp); if (r == NULL) { gfc_free_expr (e); gfc_free_expr (exp); return MATCH_ERROR; } r->where = where; *result = r; return MATCH_YES; }
static match match_add_operand (gfc_expr **result) { gfc_expr *all, *e, *total; locus where, old_loc; match m; gfc_intrinsic_op i; m = match_mult_operand (&all); if (m != MATCH_YES) return m; for (;;) { /* Build up a string of products or quotients. */ old_loc = gfc_current_locus; if (next_operator (INTRINSIC_TIMES)) i = INTRINSIC_TIMES; else { if (next_operator (INTRINSIC_DIVIDE)) i = INTRINSIC_DIVIDE; else break; } where = gfc_current_locus; m = match_ext_mult_operand (&e); if (m == MATCH_NO) { gfc_current_locus = old_loc; break; } if (m == MATCH_ERROR) { gfc_free_expr (all); return MATCH_ERROR; } if (i == INTRINSIC_TIMES) total = gfc_multiply (all, e); else total = gfc_divide (all, e); if (total == NULL) { gfc_free_expr (all); gfc_free_expr (e); return MATCH_ERROR; } all = total; all->where = where; } *result = all; return MATCH_YES; }