This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Suppress Import-In-Pure-Unit warning if Pure_Function given


The warning for use of Import in a Pure unit is refined so that it is
omitted if an explicit Pure_Function aspect is given, as shown by
the following test, compiled with -gnatl

     1. package PureImportF is
     2. pragma Pure (PureImportF);
     3.    function F (A : integer) return integer;
     4.    pragma Import (C, F);
           |
        >>> warning: pragma Import in Pure unit
        >>> warning: calls to "F" may be omitted (RM 10.2.1(18/3))

     5.    function F2 (A : integer) return integer;
     6.    pragma Pure_Function (F2);
     7.    pragma Import (C, F2);
     8. end PureImportF;

Tested on x86_64-pc-linux-gnu, committed on trunk

2015-01-30  Robert Dewar  <dewar@adacore.com>

	* freeze.adb (Freeze_Profile): Add test for suspicious import
	in pure unit.
	* sem_prag.adb (Process_Import_Or_Interface): Test for suspicious
	use in Pure unit is now moved to Freeze (to properly catch
	Pure_Function exemption).

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]