public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Joern Rennecke <amylaar@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-836] Improve message for wrong number of alternatives.
Date: Mon, 17 May 2021 12:52:46 +0000 (GMT)	[thread overview]
Message-ID: <20210517125246.3B0853846079@sourceware.org> (raw)

https://gcc.gnu.org/g:bdd8e3dd60c4f6080df74fe02b6579451fda6a21

commit r12-836-gbdd8e3dd60c4f6080df74fe02b6579451fda6a21
Author: Joern Rennecke <joern.rennecke@embecosm.com>
Date:   Mon May 17 13:44:49 2021 +0100

    Improve message for wrong number of alternatives.
    
    gcc/
            * genoutput.c (validate_insn_alternatives) Make "wrong number of
            alternatives" message more specific, and remove assumption on where
            the problem is.

Diff:
---
 gcc/genoutput.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/gcc/genoutput.c b/gcc/genoutput.c
index 8e911cce2f5..6d4ab812696 100644
--- a/gcc/genoutput.c
+++ b/gcc/genoutput.c
@@ -757,6 +757,7 @@ validate_insn_alternatives (class data *d)
 	int which_alternative = 0;
 	int alternative_count_unsure = 0;
 	bool seen_write = false;
+	bool alt_mismatch = false;
 
 	for (p = d->operand[start].constraint; (c = *p); p += len)
 	  {
@@ -813,8 +814,19 @@ validate_insn_alternatives (class data *d)
 	    if (n == 0)
 	      n = d->operand[start].n_alternatives;
 	    else if (n != d->operand[start].n_alternatives)
-	      error_at (d->loc, "wrong number of alternatives in operand %d",
-			start);
+	      {
+		if (!alt_mismatch)
+		  {
+		    alt_mismatch = true;
+		    error_at (d->loc,
+			      "alternative number mismatch: "
+			      "operand %d has %d, operand %d has %d",
+			      0, n, start, d->operand[start].n_alternatives);
+		  }
+		else
+		  error_at (d->loc, "operand %d has %d alternatives",
+		    start, d->operand[start].n_alternatives);
+	      }
 	  }
       }


                 reply	other threads:[~2021-05-17 12:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210517125246.3B0853846079@sourceware.org \
    --to=amylaar@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).