aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/namet.h
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2016-04-18 12:44:09 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2016-04-18 12:44:09 +0200
commit3e20cb680fae4486f196dcc807237d573ad6d207 (patch)
treedfe52b487e1b48a7b4d25170ac1661d0d4d33e22 /gcc/ada/namet.h
parent1f55088db5038881cc4836ba600edb1bb8fe0141 (diff)
downloadgcc-3e20cb680fae4486f196dcc807237d573ad6d207.zip
gcc-3e20cb680fae4486f196dcc807237d573ad6d207.tar.gz
gcc-3e20cb680fae4486f196dcc807237d573ad6d207.tar.bz2
[multiple changes]
2016-04-18 Ed Schonberg <schonberg@adacore.com> * sem_prag.adb (Build_Pragma_Check_Equivalent): The mapping that relates operations of the parent type to the operations of the derived type has three distinct sources: a) explicit operations of the derived type carry an Overridden_Operation that designates the operation in the ancestor. b) Implicit operations that are inherited by the derived type carry an alias that may be an explicit subprogram (in which case it may have an Overridden_ Operation indicator) or may also be inherited and carry its own alias. c) If the parent type is an interface, the operation of the derived type does not override, but the interface operation indicates the operation that implements it. * sem_prag.adb: Minor reformatting. * sem_prag.adb (Check_External_Property): Update the comment on usage. Reimplement. 2016-04-18 Ed Schonberg <schonberg@adacore.com> * exp_ch5.adb (Expand_Assignment_Statement): In restricted profiles such as ZFP, ceiling priority is not available. 2016-04-18 Bob Duff <duff@adacore.com> * namet-sp.ads: Minor typo fix, ironically in 'Spelling_Checker'. 2016-04-18 Bob Duff <duff@adacore.com> * sem_elab.adb (Output_Calls): Use Get_Name_String, to clearly indicate that the global Name_Buffer is being used. The previous code used Is_Internal_Name, which returns a Boolean, but also has a side effect of setting the Name_Buffer. Then it called the other Is_Internal_Name, which uses the Name_Buffer for its input. And then it called Error_Msg_N, again using the Name_Buffer. We haven't eliminated the global usage here, but we've made it a bit clearer. This also allows us to have a side-effect-free version of Is_Internal_Name. * namet.ads, namet.adb: Provide a type Bounded_String, along with routines that can be used without using global variables. Provide Global_Name_Buffer so existing code can continue to use the global. Mark the routines that use globals as obsolete. New code shouldn't call the obsolete ones, and we should clean up existing code from time to time. Name_Find_Str is renamed as Name_Find. * namet.h: Changed as necessary to interface to the new version of Namet. * bindgen.adb, exp_unst.adb: Name_Find_Str is renamed as Name_Find. From-SVN: r235123
Diffstat (limited to 'gcc/ada/namet.h')
-rw-r--r--gcc/ada/namet.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/gcc/ada/namet.h b/gcc/ada/namet.h
index 82af02d..32d110b 100644
--- a/gcc/ada/namet.h
+++ b/gcc/ada/namet.h
@@ -25,7 +25,7 @@
/* This is the C file that corresponds to the Ada package specification
Namet. It was created manually from files namet.ads and namet.adb.
- Some subprograms from Sinput are also made acessable here. */
+ Some subprograms from Sinput are also made accessible here. */
#ifdef __cplusplus
extern "C" {
@@ -52,16 +52,26 @@ extern struct Name_Entry *Names_Ptr;
#define Name_Chars_Ptr namet__name_chars__table
extern char *Name_Chars_Ptr;
-#define Name_Buffer namet__name_buffer
-extern char Name_Buffer[];
+/* The global name buffer. */
+struct Bounded_String
+{
+ Nat Max_Length;
+ Nat Length;
+ char Chars[1];
+ /* The 1 here is wrong, but it doesn't matter, because all the code either
+ goes by Length, or NUL-terminates the string before processing it. */
+};
+
+#define Global_Name_Buffer namet__global_name_buffer
+extern struct Bounded_String Global_Name_Buffer;
-extern Int namet__name_len;
-#define Name_Len namet__name_len
+#define Name_Buffer Global_Name_Buffer.Chars
+#define Name_Len Global_Name_Buffer.Length
-/* Get_Name_String returns a null terminated C string for the specified name.
+/* Get_Name_String returns a NUL terminated C string for the specified name.
We could use the official Ada routine for this purpose, but since the
strings we want are sitting in the name strings table in exactly the form
- we need them (null terminated), we just point to the name directly. */
+ we need them (NUL terminated), we just point to the name directly. */
static char *Get_Name_String (Name_Id);