public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Revert change for gnatprove that is no longer needed
@ 2019-08-20  9:51 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2019-08-20  9:51 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

[-- Attachment #1: Type: text/plain, Size: 703 bytes --]

Years ago, we adapted Get_Kind_Of_Unit so that gnatprove could use it to
detect both bodies and specs of predefined units.

However, this wasn't really needed: gnatprove could simply reuse
Lib.In_Predefined_Unit and now it does. This patch simply reverts two
commits mentioned above.

No frontend test provided, because the removed comment is clear that this
doesn't affect the compiler. Other tools similarly should not be affected
(at least they were not when this change was introduced in 2012).

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

2019-08-20  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* impunit.adb (Get_Kind_Of_Unit): Revert change for adapting
	this routine for gnatprove.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1047 bytes --]

--- gcc/ada/impunit.adb
+++ gcc/ada/impunit.adb
@@ -692,19 +692,10 @@ package body Impunit is
          return Not_Predefined_Unit;
       end if;
 
-      --  To be considered predefined, the file name must end in .ads or .adb.
-      --  File names with other extensions (coming from the use of non-standard
-      --  file naming schemes) can never be predefined.
-
-      --  Note that in the context of a compiler, the .adb case will never
-      --  arise. However it can arise for other tools, e.g. gnatprove uses
-      --  this routine to detect when a construct comes from an instance of
-      --  a generic defined in a predefined unit.
-
-      if File (File'Last - 3 .. File'Last) /= ".ads"
-           and then
-         File (File'Last - 3 .. File'Last) /= ".adb"
-      then
+      --  Not predefined if file name does not end in .ads. This can happen
+      --  when non-standard file names are being used.
+
+      if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" then
          return Not_Predefined_Unit;
       end if;
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-20  9:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20  9:51 [Ada] Revert change for gnatprove that is no longer needed Pierre-Marie de Rodat

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).