aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/errout.ads
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2022-10-17 11:56:27 -0400
committerMarc Poulhiès <poulhies@adacore.com>2022-11-07 09:36:35 +0100
commit2702882fdbd14ad647ea2a88c7f9ea2cd62fa23e (patch)
tree6f87bf0c0fb3ca2e3f67ad5d6c54f7fef7d6e2fc /gcc/ada/errout.ads
parent9b07c1752b9bf49143a41c810e2db86f633fdb1c (diff)
downloadgcc-2702882fdbd14ad647ea2a88c7f9ea2cd62fa23e.zip
gcc-2702882fdbd14ad647ea2a88c7f9ea2cd62fa23e.tar.gz
gcc-2702882fdbd14ad647ea2a88c7f9ea2cd62fa23e.tar.bz2
ada: New warning about noncomposing user-defined "="
Print warning for a user-defined "=" that does not compose as might be expected (i.e. is ignored for predefined "=" of a containing record or array type). This warning is enabled by -gnatw_q; we don't enable it by default because it generates too many false positives. We also don't enable it via -gnatwa. gcc/ada/ * exp_ch4.adb (Expand_Array_Equality): Do not test Ltyp = Rtyp here, because that is necessarily true. Move assertion thereof to more general place. (Expand_Composite_Equality): Pass in Outer_Type, for use in warnings. Rename Typ to be Comp_Type, to more clearly distinguish it from Outer_Type. Print warning when appropriate. * exp_ch4.ads: Minor comment fix. * errout.ads: There is no such pragma as Warning_As_Pragma -- Warning_As_Error must have been intended. Improve comment for ?x?. * exp_ch3.adb (Build_Untagged_Equality): Update comment to be accurate for more recent versions of Ada. * sem_case.adb (Choice_Analysis): Declare user-defined "=" functions as abstract. * sem_util.ads (Is_Bounded_String): Give RM reference in comment. * warnsw.ads, warnsw.adb (Warn_On_Ignored_Equality): Implement new warning switch -gnatw_q. * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Document new warning switch. * gnat_ugn.texi: Regenerate.
Diffstat (limited to 'gcc/ada/errout.ads')
-rw-r--r--gcc/ada/errout.ads9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/ada/errout.ads b/gcc/ada/errout.ads
index 78fe514..846a4a6 100644
--- a/gcc/ada/errout.ads
+++ b/gcc/ada/errout.ads
@@ -64,7 +64,7 @@ package Errout is
-- sequences in error messages generate appropriate tags for the output
-- error messages. If this switch is False, then these sequences are still
-- recognized (for the purposes of implementing the pattern matching in
- -- pragmas Warnings (Off,..) and Warning_As_Pragma(...) but do not result
+ -- pragmas Warnings (Off,..) and Warning_As_Error(...) but do not result
-- in adding the error message tag. The -gnatw.d switch sets this flag
-- True, -gnatw.D sets this flag False.
@@ -314,10 +314,11 @@ package Errout is
-- continuations, use this in each continuation message.
-- Insertion character ?x? ?.x? ?_x? (warning with switch)
- -- Like ?, but if the flag Warn_Doc_Switch is True, adds the string
+ -- "x" is a (lower-case) warning switch character.
+ -- Like ??, but if the flag Warn_Doc_Switch is True, adds the string
-- "[-gnatwx]", "[-gnatw.x]", or "[-gnatw_x]", at the end of the
- -- warning message. x must be lower case. For continuations, use this
- -- on each continuation message.
+ -- warning message. For continuations, use this on each continuation
+ -- message.
-- Insertion character ?*? (restriction warning)
-- Like ?, but if the flag Warn_Doc_Switch is True, adds the string