Skip to content

Commit

Permalink
ada: hardcfr: mark throw-expected functions
Browse files Browse the repository at this point in the history
Adjust documentation to reflect the introduction of
-fhardcfr-check-noreturn-calls=no-xthrow.

gcc/ada/

	* doc/gnat_rm/security_hardening_features.rst (Control Flow
	Redundancy): Add -fhardcfr-check-noreturn-calls=no-xthrow.
	* gnat_rm.texi: Regenerate.

Tested on x86_64-pc-linux-gnu, committed on master.
  • Loading branch information
Alexandre Oliva authored and ouuleilei-bot committed Jul 10, 2023
1 parent c2d62cd commit 072da17
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
17 changes: 9 additions & 8 deletions gcc/ada/doc/gnat_rm/security_hardening_features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -487,17 +487,18 @@ gets modified as follows:
end;
Verification may also be performed before No_Return calls, whether
only nothrow ones, with
:switch:`-fhardcfr-check-noreturn-calls=nothrow`, or all of them, with
:switch:`-fhardcfr-check-noreturn-calls=always`. The default is
:switch:`-fhardcfr-check-noreturn-calls=never` for this feature, that
disables checking before No_Return calls.
Verification may also be performed before No_Return calls, whether all
of them, with :switch:`-fhardcfr-check-noreturn-calls=always`; all but
internal subprograms involved in exception-raising or -reraising, with
:switch:`-fhardcfr-check-noreturn-calls=no-xthrow` (default); only
nothrow ones, with :switch:`-fhardcfr-check-noreturn-calls=nothrow`;
or none, with :switch:`-fhardcfr-check-noreturn-calls=never`.

When a No_Return call returns control to its caller through an
exception, verification may have already been performed before the
call, if :switch:`-fhardcfr-check-noreturn-calls=always` is in effect.
The compiler arranges for already-checked No_Return calls without a
call, if :switch:`-fhardcfr-check-noreturn-calls=always` or
:switch:`-fhardcfr-check-noreturn-calls=no-xthrow` is in effect. The
compiler arranges for already-checked No_Return calls without a
preexisting handler to bypass the implicitly-added cleanup handler and
thus the redundant check, but a local exception or cleanup handler, if
present, will modify the set of visited blocks, and checking will take
Expand Down
17 changes: 9 additions & 8 deletions gcc/ada/gnat_rm.texi
Original file line number Diff line number Diff line change
Expand Up @@ -29136,17 +29136,18 @@ exception
end;
@end example

Verification may also be performed before No_Return calls, whether
only nothrow ones, with
@code{-fhardcfr-check-noreturn-calls=nothrow}, or all of them, with
@code{-fhardcfr-check-noreturn-calls=always}. The default is
@code{-fhardcfr-check-noreturn-calls=never} for this feature, that
disables checking before No_Return calls.
Verification may also be performed before No_Return calls, whether all
of them, with @code{-fhardcfr-check-noreturn-calls=always}; all but
internal subprograms involved in exception-raising or -reraising, with
@code{-fhardcfr-check-noreturn-calls=no-xthrow} (default); only
nothrow ones, with @code{-fhardcfr-check-noreturn-calls=nothrow};
or none, with @code{-fhardcfr-check-noreturn-calls=never}.

When a No_Return call returns control to its caller through an
exception, verification may have already been performed before the
call, if @code{-fhardcfr-check-noreturn-calls=always} is in effect.
The compiler arranges for already-checked No_Return calls without a
call, if @code{-fhardcfr-check-noreturn-calls=always} or
@code{-fhardcfr-check-noreturn-calls=no-xthrow} is in effect. The
compiler arranges for already-checked No_Return calls without a
preexisting handler to bypass the implicitly-added cleanup handler and
thus the redundant check, but a local exception or cleanup handler, if
present, will modify the set of visited blocks, and checking will take
Expand Down

0 comments on commit 072da17

Please sign in to comment.