From bce992c9220e3309eab49d6ebc9b735292f1901f Mon Sep 17 00:00:00 2001 From: charlet Date: Mon, 30 Nov 2009 16:16:55 +0000 Subject: [PATCH] 2009-11-30 Ed Schonberg * par_sco.adb (Traverse_Handled_Statement_Sequence): Do not emit SCO's for null statements that do not come from source. * sinfo.ads: Clarify documentation of Comes_From_Source 2009-11-30 Vincent Celier * prj-nmsc.adb (Add_Source): Use Display_Name for both projects when displaying the paths in error message. 2009-11-30 Emmanuel Briot * adaint.h, adaint.c (file_attributes): force the use of unsigned char. On some platforms, "char" is signed, on others unsigned, so we explicitly specify the one we expect git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154826 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 17 +++++++++++++++++ gcc/ada/adaint.c | 30 ++++++++++++++++-------------- gcc/ada/adaint.h | 14 +++++++------- gcc/ada/par_sco.adb | 9 ++++++++- gcc/ada/prj-nmsc.adb | 2 +- gcc/ada/sinfo.ads | 16 ++++++++++++---- 6 files changed, 61 insertions(+), 27 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8152f3d5dc2..2d93b5d2eca 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,20 @@ +2009-11-30 Ed Schonberg + + * par_sco.adb (Traverse_Handled_Statement_Sequence): Do not emit SCO's + for null statements that do not come from source. + * sinfo.ads: Clarify documentation of Comes_From_Source + +2009-11-30 Vincent Celier + + * prj-nmsc.adb (Add_Source): Use Display_Name for both projects when + displaying the paths in error message. + +2009-11-30 Emmanuel Briot + + * adaint.h, adaint.c (file_attributes): force the use of unsigned char. + On some platforms, "char" is signed, on others unsigned, so we + explicitly specify the one we expect + 2009-11-30 Matthew Heaney * a-coinve.adb (Insert): Move exception handler closer to point where diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index b4446f7af3a..54b32232bb8 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -377,19 +377,21 @@ to_ptr32 (char **ptr64) #define MAYBE_TO_PTR32(argv) argv #endif +const char ATTR_UNSET = 127; + void __gnat_reset_attributes (struct file_attributes* attr) { - attr->exists = -1; + attr->exists = ATTR_UNSET; - attr->writable = -1; - attr->readable = -1; - attr->executable = -1; + attr->writable = ATTR_UNSET; + attr->readable = ATTR_UNSET; + attr->executable = ATTR_UNSET; - attr->regular = -1; - attr->symbolic_link = -1; - attr->directory = -1; + attr->regular = ATTR_UNSET; + attr->symbolic_link = ATTR_UNSET; + attr->directory = ATTR_UNSET; attr->timestamp = (OS_Time)-2; attr->file_length = -1; @@ -1799,7 +1801,7 @@ __gnat_stat (char *name, GNAT_STRUCT_STAT *statbuf) int __gnat_file_exists_attr (char* name, struct file_attributes* attr) { - if (attr->exists == -1) { + if (attr->exists == ATTR_UNSET) { #ifdef __MINGW32__ /* On Windows do not use __gnat_stat() because of a bug in Microsoft _stat() routine. When the system time-zone is set with a negative @@ -1865,7 +1867,7 @@ __gnat_is_absolute_path (char *name, int length) int __gnat_is_regular_file_attr (char* name, struct file_attributes* attr) { - if (attr->regular == -1) { + if (attr->regular == ATTR_UNSET) { __gnat_stat_to_attr (-1, name, attr); } @@ -1883,7 +1885,7 @@ __gnat_is_regular_file (char *name) int __gnat_is_directory_attr (char* name, struct file_attributes* attr) { - if (attr->directory == -1) { + if (attr->directory == ATTR_UNSET) { __gnat_stat_to_attr (-1, name, attr); } @@ -2091,7 +2093,7 @@ __gnat_can_use_acl (TCHAR *wname) int __gnat_is_readable_file_attr (char* name, struct file_attributes* attr) { - if (attr->readable == -1) { + if (attr->readable == ATTR_UNSET) { #if defined (_WIN32) && !defined (RTX) TCHAR wname [GNAT_MAX_PATH_LEN + 2]; GENERIC_MAPPING GenericMapping; @@ -2125,7 +2127,7 @@ __gnat_is_readable_file (char *name) int __gnat_is_writable_file_attr (char* name, struct file_attributes* attr) { - if (attr->writable == -1) { + if (attr->writable == ATTR_UNSET) { #if defined (_WIN32) && !defined (RTX) TCHAR wname [GNAT_MAX_PATH_LEN + 2]; GENERIC_MAPPING GenericMapping; @@ -2163,7 +2165,7 @@ __gnat_is_writable_file (char *name) int __gnat_is_executable_file_attr (char* name, struct file_attributes* attr) { - if (attr->executable == -1) { + if (attr->executable == ATTR_UNSET) { #if defined (_WIN32) && !defined (RTX) TCHAR wname [GNAT_MAX_PATH_LEN + 2]; GENERIC_MAPPING GenericMapping; @@ -2314,7 +2316,7 @@ __gnat_set_non_readable (char *name) int __gnat_is_symbolic_link_attr (char* name, struct file_attributes* attr) { - if (attr->symbolic_link == -1) { + if (attr->symbolic_link == ATTR_UNSET) { #if defined (__vxworks) || defined (__nucleus__) attr->symbolic_link = 0; diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h index 41b6357656f..7af079e35a9 100644 --- a/gcc/ada/adaint.h +++ b/gcc/ada/adaint.h @@ -74,15 +74,15 @@ typedef long OS_Time; */ struct file_attributes { - char exists; + unsigned char exists; - char writable; - char readable; - char executable; + unsigned char writable; + unsigned char readable; + unsigned char executable; - char symbolic_link; - char regular; - char directory; + unsigned char symbolic_link; + unsigned char regular; + unsigned char directory; OS_Time timestamp; long file_length; diff --git a/gcc/ada/par_sco.adb b/gcc/ada/par_sco.adb index ea7726395a1..dddc3fffc71 100644 --- a/gcc/ada/par_sco.adb +++ b/gcc/ada/par_sco.adb @@ -989,7 +989,14 @@ package body Par_SCO is Handler : Node_Id; begin - if Present (N) then + + -- for package bodies without a statement part, the parser adds an + -- empty one, to normalize the representation. The null statement + -- therein, which does not come from source, does not get a SCO. + + if Present (N) + and then Comes_From_Source (N) + then Traverse_Declarations_Or_Statements (Statements (N)); if Present (Exception_Handlers (N)) then diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index a3f5100e8a7..35d7e041bb6 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -655,7 +655,7 @@ package body Prj.Nmsc is Location, Project); Error_Msg_Name_1 := Project.Name; - Error_Msg_Name_2 := Name_Id (Path.Name); + Error_Msg_Name_2 := Name_Id (Path.Display_Name); Error_Msg (Data.Flags, "\ project %%, %%", Location, Project); diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index cbafd19dd94..bb6012904a9 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -462,10 +462,18 @@ package Sinfo is -- reasons. -- Comes_From_Source (Flag2) - -- This flag is on for any nodes built by the scanner or parser from the - -- source program, and off for any nodes built by the analyzer or - -- expander. It indicates that a node comes from the original source. - -- This flag is defined in Atree. + -- This flag is set if the node comes directly from an explicit construct + -- in the source. It is normally on for any nodes built by the scanner or + -- parser from the source program, with the exception that in a few cases + -- the parser adds nodes to normalize the representation (in particular + -- a null statement is added to a package body if there is no begin/end + -- initialization section. + -- + -- Most nodes inserted by the analyzer or expander are not considered + -- as coming from source, so the flag is off for such nodes. In a few + -- cases, the expander constructs nodes closely equivalent to nodes + -- from the source program (e.g. the allocator built for build-in-place + -- case), and the Comes_From_Source flag is deliberately set. -- Error_Posted (Flag3) -- This flag is used to avoid multiple error messages being posted on or -- 2.11.0