From: Jakub Jelinek <jakub@redhat.com>
To: Siddhesh Poyarekar <siddhesh@gotplt.org>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 1/2] testsuite: Run __bos tests to completion
Date: Tue, 31 Jan 2023 13:33:41 +0100 [thread overview]
Message-ID: <Y9kKpVXrbrhl2Ywm@tucnak> (raw)
In-Reply-To: <20221221222554.4141678-2-siddhesh@gotplt.org>
On Wed, Dec 21, 2022 at 05:25:53PM -0500, Siddhesh Poyarekar wrote:
> gcc/testsuite/ChangeLog:
>
> * gcc.dg/builtin-dynamic-object-size-0.c: Move FAIL and nfail
> into...
> * gcc.dg/builtin-object-size-common.h: ... new file.
> * g++.dg/ext/builtin-object-size1.C: Include
> builtin-object-size-common.h. Replace all abort with FAIL.
> (main): Call DONE.
> * g++.dg/ext/builtin-object-size2.C: Likewise.
> * gcc.dg/builtin-object-size-1.c: Likewise.
> * gcc.dg/builtin-object-size-12.c: Likewise.
> * gcc.dg/builtin-object-size-13.c: Likewise.
> * gcc.dg/builtin-object-size-15.c: Likewise.
> * gcc.dg/builtin-object-size-2.c: Likewise.
> * gcc.dg/builtin-object-size-3.c: Likewise.
> * gcc.dg/builtin-object-size-4.c: Likewise.
> * gcc.dg/builtin-object-size-6.c: Likewise.
> * gcc.dg/builtin-object-size-7.c: Likewise.
> * gcc.dg/builtin-object-size-8.c: Likewise.
> * gcc.dg/pr101836.c: Likewise.
> * gcc.dg/strict-flex-array-3.c: Likewise.
> --- a/gcc/testsuite/g++.dg/ext/builtin-object-size1.C
> +++ b/gcc/testsuite/g++.dg/ext/builtin-object-size1.C
> @@ -1,8 +1,9 @@
> // { dg-do run }
> // { dg-options "-O2" }
>
> +#include "../../gcc.dg/builtin-object-size-common.h"
> +
> typedef __SIZE_TYPE__ size_t;
> -extern "C" void abort ();
> extern "C" void exit (int);
> extern "C" void *malloc (size_t);
> extern "C" void free (void *);
I'd then wonder if size_t shouldn't be typedefed and perhaps
even exit/malloc/free etc. shouldn't be prototyped in
builtin-object-size-common.h too (of course, with extern "C"
conditionalized on __cplusplus).
> if (__builtin_object_size (r + 6, 0) != res - 6)
> - abort ();
> + FAIL ();
There should be a tab, not 8 spaces.
> @@ -335,13 +336,13 @@ test2 (void)
> if (res >= 12)
> {
> if (__builtin_object_size (r + 12, 0) != res - 12)
> - abort ();
> + FAIL ();
Ditto.
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/builtin-object-size-common.h
> @@ -0,0 +1,12 @@
> +unsigned nfails = 0;
> +
> +#define FAIL() ({ \
> + __builtin_printf ("Failure at line: %d\n", __LINE__); \
> + nfails++; \
> +})
> +
> +#define DONE() ({ \
> + if (nfails > 0) \
> + __builtin_abort (); \
> + return 0; \
> +})
Why the statement expressions? do { and } while (0) would work too...
> - printf("WAT: %s == %zd (expected %zd)\n", #p, p, v); \
> - __builtin_abort (); \
> + __builtin_printf("WAT: %s == %zd (expected %zd)\n", #p, p, v); \
> + FAIL (); \
The above has rightly indented FAIL, but the line before that uses
10 spaces rather than tab + 2 spaces.
Otherwise LGTM.
Jakub
next prev parent reply other threads:[~2023-01-31 12:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-21 22:25 [PATCH 0/2] __bos and flex arrays Siddhesh Poyarekar
2022-12-21 22:25 ` [PATCH 1/2] testsuite: Run __bos tests to completion Siddhesh Poyarekar
2023-01-31 12:33 ` Jakub Jelinek [this message]
2023-02-01 16:46 ` [committed v2] " Siddhesh Poyarekar
2022-12-21 22:25 ` [PATCH 2/2] tree-object-size: More consistent behaviour with flex arrays Siddhesh Poyarekar
2023-01-26 16:20 ` Qing Zhao
2023-01-26 17:16 ` Siddhesh Poyarekar
2023-01-26 17:42 ` Qing Zhao
2023-01-31 12:46 ` Jakub Jelinek
2023-01-31 13:01 ` Siddhesh Poyarekar
2023-01-03 14:30 ` [ping][PATCH 0/2] __bos and " Siddhesh Poyarekar
2023-01-11 13:14 ` [ping2][PATCH " Siddhesh Poyarekar
2023-01-20 19:38 ` [ping3][PATCH " Siddhesh Poyarekar
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=Y9kKpVXrbrhl2Ywm@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=siddhesh@gotplt.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).