From 18e5eb77b7eb185b83795ab47f1ec52dd88c1c98 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sun, 27 Nov 2016 20:23:31 +0000 Subject: [PATCH] re PR ada/78531 (bootstrap broken with _FORTIFY_SOURCE enabled) PR ada/78531 * namet.h (Max_Line_Length): Define. (struct Bounded_String): Declare Chars with exact size. (namet__get_decoded_name_string): Delete. (Get_Decoded_Name_String): Likewise. (casing__set_all_upper_case): Likewise. From-SVN: r242901 --- gcc/ada/ChangeLog | 9 +++++++++ gcc/ada/namet.h | 36 +++++++----------------------------- 2 files changed, 16 insertions(+), 29 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ae124deb1f1d..d89b9674556c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2016-11-27 Eric Botcazou + + PR ada/78531 + * namet.h (Max_Line_Length): Define. + (struct Bounded_String): Declare Chars with exact size. + (namet__get_decoded_name_string): Delete. + (Get_Decoded_Name_String): Likewise. + (casing__set_all_upper_case): Likewise. + 2016-11-22 Uros Bizjak * gcc-interface/Make-lang.in (check-acats): Fix detection diff --git a/gcc/ada/namet.h b/gcc/ada/namet.h index 32d110b2d275..a016f93b93d0 100644 --- a/gcc/ada/namet.h +++ b/gcc/ada/namet.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2015, Free Software Foundation, Inc. * + * Copyright (C) 1992-2016, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -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 accessible here. */ + Subprograms from Exp_Dbug and Sinput are also made accessible here. */ #ifdef __cplusplus extern "C" { @@ -52,14 +52,15 @@ extern struct Name_Entry *Names_Ptr; #define Name_Chars_Ptr namet__name_chars__table extern char *Name_Chars_Ptr; -/* The global name buffer. */ +/* This is Hostparm.Max_Line_Length. */ +#define Max_Line_Length (32767 - 1) + +/* 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. */ + char Chars[4 * Max_Line_Length]; /* Exact value for overflow detection. */ }; #define Global_Name_Buffer namet__global_name_buffer @@ -81,32 +82,9 @@ Get_Name_String (Name_Id Id) return Name_Chars_Ptr + Names_Ptr[Id - First_Name_Id].Name_Chars_Index + 1; } -/* Get_Decoded_Name_String returns a null terminated C string in the same - manner as Get_Name_String, except that it is decoded (i.e. upper half or - wide characters are put back in their external form, and character literals - are also returned in their external form (with surrounding apostrophes) */ - -extern void namet__get_decoded_name_string (Name_Id); - -static char *Get_Decoded_Name_String (Name_Id); - -INLINE char * -Get_Decoded_Name_String (Name_Id Id) -{ - namet__get_decoded_name_string (Id); - Name_Buffer[Name_Len] = 0; - return Name_Buffer; -} - #define Name_Equals namet__name_equals extern Boolean Name_Equals (Name_Id, Name_Id); -/* Like Get_Decoded_Name_String, but the result has all qualification and - package body entity suffixes stripped, and also all letters are upper - cased. This is used for building the enumeration literal table. */ - -extern void casing__set_all_upper_case (void); - /* The following routines and variables are not part of Namet, but we include the header here since it seems the best place for it. */ -- 2.43.5