Example #1
0
void
midrule_value_at (location loc, const char *message, ...)
{
  if (!(warnings_flag & warnings_midrule_values))
    return;
  set_warning_issued ();
  ERROR_MESSAGE (&loc, _("warning"), message);
}
Example #2
0
void
warn (const char *message, ...)
{
  if (!(warnings_flag & warnings_other))
    return;
  set_warning_issued ();
  ERROR_MESSAGE (NULL, _("warning"), message);
}
Example #3
0
void
warn_at (location loc, const char *message, ...)
{
  if (!(warnings_flag & warnings_other))
    return;
  set_warning_issued ();
  ERROR_MESSAGE (&loc, _("warning"), message);
}
Example #4
0
void
warn_at_indent (location loc, unsigned *indent,
                const char *message, ...)
{
  if (!(warnings_flag & warnings_other))
    return;
  set_warning_issued ();
  indent_ptr = indent;
  ERROR_MESSAGE (&loc, _("warning"), message);
}
Example #5
0
void
yacc_at (location loc, const char *message, ...)
{
  if (yacc_flag)
    {
      ERROR_MESSAGE (&loc, NULL, message);
      complaint_issued = true;
    }
  else if (warnings_flag & warnings_yacc)
    {
      set_warning_issued ();
      ERROR_MESSAGE (&loc, _("warning"), message);
    }
}
Example #6
0
void
conflicts_print (void)
{
  /* Is the number of SR conflicts OK?  Either EXPECTED_CONFLICTS is
     not set, and then we want 0 SR, or else it is specified, in which
     case we want equality.  */
  bool src_ok;
  bool rrc_ok;

  int src_total = 0;
  int rrc_total = 0;
  int src_expected;
  int rrc_expected;

  /* Conflicts by state.  */
  {
    state_number i;

    for (i = 0; i < nstates; i++)
      if (conflicts[i])
	{
	  src_total += count_sr_conflicts (states[i]);
	  rrc_total += count_rr_conflicts (states[i], true);
	}
  }

  if (! glr_parser && rrc_total > 0 && expected_rr_conflicts != -1)
    {
      warn (_("%%expect-rr applies only to GLR parsers"));
      expected_rr_conflicts = -1;
    }

  src_expected = expected_sr_conflicts == -1 ? 0 : expected_sr_conflicts;
  rrc_expected = expected_rr_conflicts == -1 ? 0 : expected_rr_conflicts;
  src_ok = src_total == src_expected;
  rrc_ok = rrc_total == rrc_expected;

  /* If there are as many RR conflicts and SR conflicts as
     expected, then there is nothing to report.  */
  if (rrc_ok & src_ok)
    return;

  /* Report the total number of conflicts on STDERR.  */
  if (expected_sr_conflicts == -1 && expected_rr_conflicts == -1)
    {
      if (!(warnings_flag & warnings_conflicts_sr))
        src_total = 0;
      if (!(warnings_flag & warnings_conflicts_rr))
        rrc_total = 0;
    }
  if (src_total | rrc_total)
    {
      if (expected_sr_conflicts == -1 && expected_rr_conflicts == -1)
        set_warning_issued ();
      if (! yacc_flag)
	fprintf (stderr, "%s: ", current_file);
      conflict_report (stderr, src_total, rrc_total);
    }

  if (expected_sr_conflicts != -1 || expected_rr_conflicts != -1)
    {
      if (! src_ok)
	complain (ngettext ("expected %d shift/reduce conflict",
			    "expected %d shift/reduce conflicts",
			    src_expected),
		  src_expected);
      if (! rrc_ok)
	complain (ngettext ("expected %d reduce/reduce conflict",
			    "expected %d reduce/reduce conflicts",
			    rrc_expected),
		  rrc_expected);
    }
}