From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 426C6385DC14; Thu, 20 Oct 2022 04:09:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 426C6385DC14 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666238972; bh=q2Vi/raewlkQAgLFqGT/YLffLFH0uoeP+X/DuOE09WU=; h=From:To:Subject:Date:From; b=hPUvMUWMwqsDwWglOGJLq3TtgkNri3lkmG5SP/Sfz+Qh6517YEasyhy159pfi4R2y hX5/tSS/zBPu+Nk8ltZsB/LLaR2pBslV6WO08TVhJPSLVUMNWny+0Nv/D9l80uzT0O shYVNM7lkc7mxrj10p1jNu9lM4YYJ7M+u1k5pgNg= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] Expose expected_throw attribute X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: 20c7519c2eef3f4ea541f0c2d0d8b98e13b21bf8 X-Git-Newrev: b96bdb8e2028adaaa21b5bcb1b993329043e8527 Message-Id: <20221020040932.426C6385DC14@sourceware.org> Date: Thu, 20 Oct 2022 04:09:32 +0000 (GMT) List-Id: https://gcc.gnu.org/g:b96bdb8e2028adaaa21b5bcb1b993329043e8527 commit b96bdb8e2028adaaa21b5bcb1b993329043e8527 Author: Alexandre Oliva Date: Wed Oct 19 20:36:23 2022 -0300 Expose expected_throw attribute Diff: --- gcc/ada/gcc-interface/utils.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc index 5942de150b9..9b3d60099fa 100644 --- a/gcc/ada/gcc-interface/utils.cc +++ b/gcc/ada/gcc-interface/utils.cc @@ -87,6 +87,7 @@ tree gnat_raise_decls_ext[(int) LAST_REASON_CODE + 1]; /* Forward declarations for handlers of attributes. */ static tree handle_const_attribute (tree *, tree, tree, int, bool *); static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *); +static tree handle_expected_throw_attribute (tree *, tree, tree, int, bool *); static tree handle_pure_attribute (tree *, tree, tree, int, bool *); static tree handle_novops_attribute (tree *, tree, tree, int, bool *); static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *); @@ -143,6 +144,8 @@ const struct attribute_spec gnat_internal_attribute_table[] = handle_const_attribute, NULL }, { "nothrow", 0, 0, true, false, false, false, handle_nothrow_attribute, NULL }, + { "expected_throw", 0, 0, true, false, false, false, + handle_expected_throw_attribute, NULL }, { "pure", 0, 0, true, false, false, false, handle_pure_attribute, NULL }, { "no vops", 0, 0, true, false, false, false, @@ -6378,6 +6381,22 @@ handle_nothrow_attribute (tree *node, tree ARG_UNUSED (name), return NULL_TREE; } +/* Handle a "nothrow" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_expected_throw_attribute (tree *node, tree ARG_UNUSED (name), + tree ARG_UNUSED (args), int ARG_UNUSED (flags), + bool *no_add_attrs) +{ + if (TREE_CODE (*node) == FUNCTION_DECL) + /* No flag to set here. */; + else + *no_add_attrs = true; + + return NULL_TREE; +} + /* Handle a "pure" attribute; arguments as in struct attribute_spec.handler. */