[Ada] Do not expand code inside ignored ghost bodies

While ignored ghost code is not compiled into the executable, it may
lead to compilation errors when it makes use of language features
requiring runtime support that is not available in the available runtime
library.  These errors are spurious, as the executable will never call
in these runtime units.

This patch deactivates the expansion of code inside ignored ghost bodies
of subprograms and packages, so that this code is still checked for
possible semantic errors, but it does not force the presence of useless
runtime units.

There is no impact on the executable produced.

2018-12-11  Yannick Moy  <moy@adacore.com>

gcc/ada/

	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Deactivate
	expansion in ignored ghost subprogram body.
	* sem_ch7.adb (Analyze_Package_Body_Helper): Deactivate
	expansion in ignored ghost package body.

gcc/testsuite/

	* gnat.dg/ghost4.adb: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267015 138bc75d-0d04-0410-961f-82ee72b054a4
5 files changed