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] Cleanup of Namet


CodePeer detected some questionable code in the Namet package.
This patch cleans it up. No actual bugs, but some dead code
was detected. The main impact of this patch is to clarify
which subprogram parameters are allowed to be the special
"null"-ish Name_Id values (almost none). No change in
compiler behavior; no test available.

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

2017-11-09  Bob Duff  <duff@adacore.com>

	* namet.ads, namet.adb (Valid_Name_Id): New subtype that excludes
	Error_Name and No_Name.  Use this (versus Name_Id) to indicate which
	objects can have those special values. Valid_Name_Id could usefully be
	used all over the compiler front end, but that's too much trouble for
	now. If we did that, we might want to rename:
	Name_Id --> Optional_Name_Id, Valid_Name_Id --> Name_Id.
	For parameters of type Valid_Name_Id, remove some redundant tests,
	including the ones found by CodePeer.  Use Is_Valid_Name instead of
	membership test when appropriate.
	(Error_Name_Or_No_Name): Delete this; it's no longer needed.
	* sem_ch2.adb (Analyze_Identifier): Use "not Is_Valid_Name" instead of
	"in Error_Name_Or_No_Name".
	(Check_Parameterless_Call): Use "not Is_Valid_Name" instead of "in
	Error_Name_Or_No_Name".

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]