Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: Pedro Alves <palves@redhat.com>, Philipp Rudo <prudo@linux.vnet.ibm.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH v2] Class-ify ptid_t
Date: Fri, 07 Apr 2017 14:34:00 -0000	[thread overview]
Message-ID: <c90a5c4f-fc7f-616f-8232-315e2c6d6247@ericsson.com> (raw)
In-Reply-To: <5adec1b9-2faf-d8af-0116-c237ee591738@redhat.com>

On 17-04-07 06:48 AM, Pedro Alves wrote:
> On 04/07/2017 10:25 AM, Philipp Rudo wrote:
> 
>> In this context I ask myself what the error message is supposed to
>> say (unfortunately you are the first one in GDB actually using it, all
>> others only use an empty string).  Is it what's expected ...
>>
> 
> That's because the static assertion failure text includes both a
> file:line indicating where's the failure, and modern gcc/clang
> show you the line that failed, so it's not that big of a deal to
> not include a message:
> 
>  src/gdb/thread.c:1589:1: error: static assertion failed: 
>   static_assert (1 == 0, "");
>   ^
>  $
> 
> (and in C++17, static_assert got an overload with no second
> parameter, even.)
> 
>>
>> static_assert (pid == ptid_t (1, 0, 0), "pid operator== returned false")
>>
>>
>> I tend more to what is expected.
> 
> Definitely it should say what is expected, just like regular
> testsuite tests.  Or say nothing when the expression is pretty clear
> already, which works for me too.  :-)

Heh, why did you not say that earlier, it would have saved me some time ;)

@Philipp: To come back to the verb tense thing.  Now that I think of it, when
I read the lines, I mentally insert a "that" in there.  So

  static_assert (!pid.matches (lwp), "pid doesn't match lwp");

becomes mentally

  assert that pid doesn't match lwp

I think it comes from using jUnit's assertThat:

https://github.com/junit-team/junit4/wiki/matchers-and-assertthat

Simon


  reply	other threads:[~2017-04-07 14:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 19:03 Simon Marchi
2017-04-06 22:23 ` Pedro Alves
2017-04-07  0:04   ` Simon Marchi
2017-04-07  1:56     ` Pedro Alves
2017-04-07  3:21       ` Simon Marchi
2017-04-07  3:34   ` [pushed] " Simon Marchi
2017-04-07  9:25 ` [PATCH v2] " Philipp Rudo
2017-04-07 10:48   ` Pedro Alves
2017-04-07 14:34     ` Simon Marchi [this message]
2017-04-07 14:35   ` [pushed] ptid-selftests: Fix erroneous assert messages Simon Marchi

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=c90a5c4f-fc7f-616f-8232-315e2c6d6247@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=prudo@linux.vnet.ibm.com \
    /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