public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Piotr Trojanek <trojanek@adacore.com>
Subject: [Ada] Sync wide Ada.String hashing units
Date: Thu, 26 Nov 2020 03:41:00 -0500	[thread overview]
Message-ID: <20201126084100.GA20639@adacore.com> (raw)

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

The Wide_Wide_Hash version of Ada.Strings.Hash was instantiated as a
library unit. Now all versions are instantiated in wrapper functions.

Minor inconsistency, spotted while cleaning up code for categorization
pragmas on instance units.

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

gcc/ada/

	* libgnat/a-stzhas.adb (Wide_Wide_Hash): Instantiate inside a
	wrapper function.
	* libgnat/a-stzhas.ads (Wide_Wide_Hash): Likewise; remove wrong
	comment, because this is indeed a RM unit, as described in Ada
	RM A.4.8 (1/3).

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

diff --git a/gcc/ada/libgnat/a-stzhas.adb b/gcc/ada/libgnat/a-stzhas.adb
--- a/gcc/ada/libgnat/a-stzhas.adb
+++ b/gcc/ada/libgnat/a-stzhas.adb
@@ -29,8 +29,14 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  This package does not require a body, since it is an instantiation. We
---  provide a dummy file containing a No_Body pragma so that previous versions
---  of the body (which did exist) will not interfere.
+with System.String_Hash;
 
-pragma No_Body;
+function Ada.Strings.Wide_Wide_Hash
+  (Key : Wide_Wide_String) return Containers.Hash_Type
+is
+   use Ada.Containers;
+   function Hash_Fun is new System.String_Hash.Hash
+     (Wide_Wide_Character, Wide_Wide_String, Hash_Type);
+begin
+   return Hash_Fun (Key);
+end Ada.Strings.Wide_Wide_Hash;


diff --git a/gcc/ada/libgnat/a-stzhas.ads b/gcc/ada/libgnat/a-stzhas.ads
--- a/gcc/ada/libgnat/a-stzhas.ads
+++ b/gcc/ada/libgnat/a-stzhas.ads
@@ -13,13 +13,9 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  Is this really an RM unit? Doc needed???
-
 with Ada.Containers;
-with System.String_Hash;
 
 function Ada.Strings.Wide_Wide_Hash
-is new System.String_Hash.Hash
-  (Wide_Wide_Character, Wide_Wide_String, Containers.Hash_Type);
+  (Key : Wide_Wide_String) return Containers.Hash_Type;
 
 pragma Pure (Ada.Strings.Wide_Wide_Hash);



                 reply	other threads:[~2020-11-26  8:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201126084100.GA20639@adacore.com \
    --to=derodat@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=trojanek@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).