From 9fcf2a0bdc78fbb25b2eb2feb7bd19caebcc82bf Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 20 Apr 2009 10:09:46 +0200 Subject: [multiple changes] 2009-04-20 Arnaud Charlet * gnat_ugn.texi: Fix typos. 2009-04-20 Robert Dewar * debug.adb, gnat1drv.adb, sem_ch13.adb: Add circuitry to Validate_Unchecked_Warnings to suppress warnings about size or alignment or extra bits if either type involved has pragma Warnings (Off) set for the type entity. From-SVN: r146366 --- gcc/ada/ChangeLog | 11 +++++++++++ gcc/ada/debug.adb | 6 +++++- gcc/ada/gnat1drv.adb | 6 ++++++ gcc/ada/gnat_ugn.texi | 14 +++++++------- gcc/ada/sem_ch13.adb | 31 +++++++++++++++++++++++++------ 5 files changed, 54 insertions(+), 14 deletions(-) (limited to 'gcc/ada') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6d5ef8e..ca9d4a8 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2009-04-20 Arnaud Charlet + + * gnat_ugn.texi: Fix typos. + +2009-04-20 Robert Dewar + + * debug.adb, gnat1drv.adb, sem_ch13.adb: Add circuitry to + Validate_Unchecked_Warnings to suppress warnings about size or + alignment or extra bits if either type involved has pragma Warnings + (Off) set for the type entity. + 2009-04-19 Eric Botcazou * gcc-interface/trans.c (gigi): Make the special IA-64 descriptor type diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb index 3dcd414..0ce0db6 100644 --- a/gcc/ada/debug.adb +++ b/gcc/ada/debug.adb @@ -91,7 +91,7 @@ package body Debug is -- dY Enable configurable run-time mode -- dZ Generate listing showing the contents of the dispatch tables - -- d.a + -- d.a Force Target_Strict_Alignment mode to True -- d.b -- d.c Generate inline concatenation, do not call procedure -- d.d @@ -498,6 +498,10 @@ package body Debug is -- - In case of abstract subprograms the text "is abstract" is -- added at the end of the line. + -- d.a Force Target_Strict_Alignment to True, even on targets where it + -- would normally be false. Can be used for testing strict alignment + -- circuitry in the compiler. + -- d.c Generate inline concatenation, instead of calling one of the -- System.Concat_n.Str_Concat_n routines in cases where the latter -- routines would normally be called. diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index a59fc30..3d495ce 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -339,6 +339,12 @@ begin List_Representation_Info_Mechanisms := True; end if; + -- Force Target_Strict_Alignment true if debug flag -gnatd.a is set + + if Debug_Flag_Dot_A then + Ttypes.Target_Strict_Alignment := True; + end if; + -- Disable static allocation of dispatch tables if -gnatd.t or if layout -- is enabled. The front end's layout phase currently treats types that -- have discriminant-dependent arrays as not being static even when a diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 771aff7b..70022f3 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -22263,8 +22263,8 @@ headers which is intended to do 95% of the tedious work of generating Ada specs from C or C++ header files. Note that this still is a work in progress, not designed to generate 100% correct Ada specs. -Note that the code generated is using the Ada 2005 syntax, which makes it -easier to inteface with other languages than previous versions of Ada. +The code generated is using the Ada 2005 syntax, which makes it +easier to interface with other languages than previous versions of Ada. @menu * Running the binding generator:: @@ -22286,8 +22286,8 @@ $ g++ -c -fdump-ada-spec -C /usr/include/time.h $ gcc -c -gnat05 *.ads @end smallexample -will generate, under GNU/Linux, the following files: @file{bits_time_h.ads}, -@code{bits_types_h.ads}, @code{stddef_h.ads}, @code{time_h.ads} which +will generate, under GNU/Linux, the following files: @file{time_h.ads}, +@file{bits_time_h.ads}, @file{stddef_h.ads}, @file{bits_types_h.ads} which correspond to the files @file{/usr/include/time.h}, @file{/usr/include/bits/time.h}, etc@dots{}, and will then compile in Ada 2005 mode these Ada specs. @@ -22333,7 +22333,7 @@ procedure foo (variable : int); @end smallexample In some cases, the generated bindings will be more complete or more meaningful -when defining some macros, which you can do via the @option{-D} switch. this +when defining some macros, which you can do via the @option{-D} switch. This is for example the case with @file{Xlib.h} under GNU/Linux: @smallexample @@ -22347,7 +22347,7 @@ In other cases, it is not possible to parse a header file in a stand alone manner, because other include files need to be included first. In this case, the solution is to create a small header file including the needed @code{#include} and possible @code{#define} directives. For example, to -generate Ada bindings for @file{readline/readlin.h}, you need to first +generate Ada bindings for @file{readline/readline.h}, you need to first include @file{stdio.h}, so you can create a file with the following two lines in e.g. @file{readline1.h}: @@ -22390,7 +22390,7 @@ Generate Ada spec files for the header files specified on the command line only. @item -C -@item @option{-C} (@command{gcc}) +@cindex @option{-C} (@command{gcc}) Extract comments from headers and generate Ada comments in the Ada spec files. @end table diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index bed8070..b5a3c6b 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -4476,6 +4476,14 @@ package body Sem_Ch13 is if Serious_Errors_Detected = 0 and then Known_Static_RM_Size (Source) and then Known_Static_RM_Size (Target) + + -- Don't do the check if warnings off for either type, note the + -- deliberate use of OR here instead of OR ELSE to get the flag + -- Warnings_Off_Used set for both types if appropriate. + + and then not (Has_Warnings_Off (Source) + or + Has_Warnings_Off (Target)) then Source_Siz := RM_Size (Source); Target_Siz := RM_Size (Target); @@ -4568,6 +4576,20 @@ package body Sem_Ch13 is begin if Source_Align < Target_Align and then not Is_Tagged_Type (D_Source) + + -- Suppress warning if warnings suppressed on either + -- type or either designated type. Note the use of + -- OR here instead of OR ELSE. That is intentional, + -- we would like to set flag Warnings_Off_Used in + -- all types for which warnings are suppressed. + + and then not (Has_Warnings_Off (D_Source) + or + Has_Warnings_Off (D_Target) + or + Has_Warnings_Off (Source) + or + Has_Warnings_Off (Target)) then Error_Msg_Uint_1 := Target_Align; Error_Msg_Uint_2 := Source_Align; @@ -4576,12 +4598,9 @@ package body Sem_Ch13 is Error_Msg ("?alignment of & (^) is stricter than " & "alignment of & (^)!", Eloc); - - if All_Errors_Mode then - Error_Msg - ("\?resulting access value may have invalid " & - "alignment!", Eloc); - end if; + Error_Msg + ("\?resulting access value may have invalid " & + "alignment!", Eloc); end if; end; end if; -- cgit v1.1