[Intel-gfx] [PATCH i-g-t 1/3] lib/core: Avoid unused result in backtrace printing
Chris Wilson
chris at chris-wilson.co.uk
Fri Nov 3 12:10:48 UTC 2017
Quoting Tvrtko Ursulin (2017-11-03 12:04:15)
>
> On 03/11/2017 11:52, Chris Wilson wrote:
> > Quoting Tvrtko Ursulin (2017-11-03 11:47:54)
> >> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> >>
> >> Add helpers for direct write to stderr to consolidate the code
> >> and avoid the unused result warning in build.
> >>
> >> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> >> ---
> >> lib/igt_core.c | 23 ++++++++++++++++-------
> >> 1 file changed, 16 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/lib/igt_core.c b/lib/igt_core.c
> >> index 538a4472e209..351859eaa04c 100644
> >> --- a/lib/igt_core.c
> >> +++ b/lib/igt_core.c
> >> @@ -1239,7 +1239,7 @@ static const char hex[] = "0123456789abcdef";
> >> static void
> >> xputch(int c)
> >> {
> >> - write(STDERR_FILENO, (const void *) &c, 1);
> >> + igt_assert_eq(write(STDERR_FILENO, (const void *) &c, 1), 1);
> >
> > Infinite recursion, you can't use an assert from inside the assert
> > handler.
>
> I thought it is the signal handler. Tested sending some signals and it
> survived. If there is a flaw there could instead nerf them with void
> cast, don't know.
I do recall these are meant to be fail safe, so using something like
assert which may end up here again is no-no. igt_ignore_warn()?
-Chris
More information about the Intel-gfx
mailing list