not matched by @var{regexp} then the check fails and @var{comment} is
included in the @code{FAIL} message.
+@item @{ dg-note @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @}
+The line is expected to get a @samp{note} message.
+If there is no message for that line or if the text of that message is
+not matched by @var{regexp} then the check fails and @var{comment} is
+included in the @code{FAIL} message.
+
+By default, any @emph{excess} @samp{note} messages are pruned, meaning
+their appearance doesn't trigger @emph{excess errors}.
+However, if @samp{dg-note} is used at least once in a testcase,
+they're not pruned and instead must @emph{all} be handled explicitly.
+Thus, if looking for just single instances of messages with
+@samp{note: } prefixes without caring for all of them, use
+@samp{dg-message "note: [@dots{}]"} instead of @samp{dg-note}, or use
+@samp{dg-note} together with @samp{dg-prune-output "note: "}.
+
@item @{ dg-bogus @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @}
This DejaGnu directive appears on a source line that should not get a
message matching @var{regexp}, or else specifies the source line
@item @{ dg-line @var{linenumvar} @}
This DejaGnu directive sets the variable @var{linenumvar} to the line number of
the source line. The variable @var{linenumvar} can then be used in subsequent
-@code{dg-error}, @code{dg-warning}, @code{dg-message} and @code{dg-bogus}
+@code{dg-error}, @code{dg-warning}, @code{dg-message}, @code{dg-note}
+and @code{dg-bogus}
directives. For example:
@smallexample
@item @{ dg-excess-errors @var{comment} [@{ target/xfail @var{selector} @}] @}
This DejaGnu directive indicates that the test is expected to fail due
to compiler messages that are not handled by @samp{dg-error},
-@samp{dg-warning} or @samp{dg-bogus}. For this directive @samp{xfail}
+@samp{dg-warning}, @code{dg-message}, @samp{dg-note} or
+@samp{dg-bogus}.
+For this directive @samp{xfail}
has the same effect as @samp{target}.
@item @{ dg-prune-output @var{regexp} @}
// PR c++/82414
// { dg-lto-do link }
enum vals {aa,cc}; // { dg-lto-warning "6: type 'vals' violates the C\\+\\+ One Definition Rule" }
+// { dg-lto-note "name 'cc' differs from name 'bb' defined in another translation unit" "" { target *-*-* } .-1 }
struct a { // { dg-lto-warning "8: type 'struct a' violates the C\\+\\+ One Definition Rule" }
- struct b *ptr; // { dg-lto-message "13: the first difference of corresponding definitions is field 'ptr'" }
+ struct b *ptr; // { dg-lto-note "13: the first difference of corresponding definitions is field 'ptr'" }
+ // { dg-lto-note "the incompatible type defined in another translation unit" "" { target *-*-* } .-1 }
enum vals vals;
};
void test(struct a *a)
namespace {
- struct b; // { dg-lto-message "type 'struct b' defined in anonymous namespace cannot match across the translation unit boundary" }
+ struct b; // { dg-lto-note "type 'struct b' defined in anonymous namespace cannot match across the translation unit boundary" }
}
-enum vals {aa,bb,cc}; // { dg-lto-message "an enum with different value name is defined in another translation unit" }
-struct a { // { dg-lto-message "a different type is defined in another translation unit" }
- struct b *ptr; // { dg-lto-message "a field of same name but different type is defined in another translation unit" }
+enum vals {aa,bb,cc}; // { dg-lto-note "an enum with different value name is defined in another translation unit" }
+// { dg-lto-note "mismatching definition" "" { target *-*-* } .-1 }
+struct a { // { dg-lto-note "a different type is defined in another translation unit" }
+ struct b *ptr; // { dg-lto-note "a field of same name but different type is defined in another translation unit" }
enum vals vals;
} a;
void test(struct a *);
-class a { // { dg-lto-message "a different type is defined in another translation unit" }
+class a { // { dg-lto-note "a different type is defined in another translation unit" }
int *b() const;
};
int *a::b() const { return 0; }
extern void accumulate (int x, int *a);
-int test_missing_function_defn (int *arr, int n) /* { dg-message "vectorized 0 loops in function" } */
+int test_missing_function_defn (int *arr, int n) /* { dg-note "5: vectorized 0 loops in function" } */
+/* { dg-prune-output "note: " } as we're not interested in matching any further
+ notes. */
{
int sum = 0;
for (int i = 0; i < n; ++i) /* { dg-missed "21: couldn't vectorize loop" } */
! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
do j = 1, n
call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
+! { dg-bogus "note: routine 'workerr' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 }
+! { dg-bogus "note: routine 'workerr_' declared here" "TODO" { xfail offloading_enabled } .-2 }
end do
end do
!$acc end parallel loop
! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
do i = 1, n
!$acc loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do j = 1, n
call gangr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
+! { dg-bogus "note: routine 'gangr' declared here" "TODO" { xfail { ! offloading_enabled } } .-2 }
+! { dg-bogus "note: routine 'gangr_' declared here" "TODO" { xfail offloading_enabled } .-3 }
end do
end do
!$acc end parallel loop
!$acc end parallel loop
!$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
call gangr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
!$acc end parallel loop
!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
!$acc end parallel loop
!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
!$acc end parallel loop
!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
call workerr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
!$acc end parallel loop
!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
!$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" }
do i = 1, n
call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-bogus "note: routine 'vectorr' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 }
+! { dg-bogus "note: routine 'vectorr_' declared here" "TODO" { xfail offloading_enabled } .-2 }
end do
!$acc end parallel loop
!$acc end parallel loop
!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
do j = 1, n
a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
+! { dg-bogus "note: routine 'workerf' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 }
+! { dg-bogus "note: routine 'workerf_' declared here" "TODO" { xfail offloading_enabled } .-2 }
end do
end do
!$acc end parallel loop
! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
do i = 1, n
!$acc loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do j = 1, n
a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
+! { dg-bogus "note: routine 'gangf' declared here" "TODO" { xfail { ! offloading_enabled } } .-2 }
+! { dg-bogus "note: routine 'gangf_' declared here" "TODO" { xfail offloading_enabled } .-3 }
end do
end do
!$acc end parallel loop
!$acc end parallel loop
!$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
!$acc end parallel loop
!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
!$acc end parallel loop
!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
!$acc end parallel loop
!$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
!$acc end parallel loop
!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
!$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" }
do i = 1, n
a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-bogus "note: routine 'vectorf' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 }
+! { dg-bogus "note: routine 'vectorf_' declared here" "TODO" { xfail offloading_enabled } .-2 }
end do
!$acc end parallel loop
!$acc end parallel loop
!$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" }
+! { dg-note "containing loop here" "" { target *-*-* } .-1 }
do i = 1, n
a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" }
! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 }
}
unset save_linenr_varnames
}
+
+ initialize_prune_notes
}
proc dg-test { args } {
process-message saved-dg-warning "missed:" "$args"
}
+# Look for messages with 'note: ' prefixes.
+# In addition to standard compiler diagnostics ('DK_NOTE', 'inform' functions,
+# "for additional details on an error message"),
+# this also includes output from '-fopt-info' for 'MSG_NOTE':
+# a general optimization info.
+# By default, any *excess* notes are pruned, meaning their appearance doesn't
+# trigger *excess errors*. However, if 'dg-note' is used at least once in a
+# testcase, they're not pruned and instead must *all* be handled explicitly.
+# Thus, if looking for just single instances of messages with 'note: ' prefixes
+# without caring for all of them, use 'dg-message "note: [...]"' instead of
+# 'dg-note', or use 'dg-note' together with 'dg-prune-output "note: "'.
+
+variable prune_notes
+
+proc initialize_prune_notes { } {
+ global prune_notes
+ set prune_notes 1
+}
+
+initialize_prune_notes
+
+proc dg-note { args } {
+ upvar dg-messages dg-messages
+
+ global prune_notes
+ set prune_notes 0
+
+ process-message saved-dg-warning "note:" "$args"
+}
+
# Check the existence of a gdb in the path, and return true if there
# is one.
#
# Ignore missing jobserver for tests that do more than 1 LTRANS unit
regsub -all "(^|\n)\[^\n\]*: warning: using serial compilation of \[^\n\]*" $text "" text
+ regsub -all "(^|\n)\[^\n\]*: note: see the \[^\n\]*'-flto' option documentation\[^\n\]* for more information" $text "" text
- # Ignore informational notes.
- regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text
+ global prune_notes
+ if { $prune_notes } {
+ # Ignore informational notes.
+ regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text
+ }
verbose "lto_prune_warns: exit: $text" 2
# A list of directives to recognize, and a list of directives
# to remap them to.
# For example, "dg-lto-warning" is implemented by calling "dg-warning".
- set directives { dg-lto-warning dg-lto-message }
- set remapped_directives { dg-warning dg-message }
+ set directives { dg-lto-warning dg-lto-message dg-lto-note }
+ set remapped_directives { dg-warning dg-message dg-note }
set idx [lsearch -exact $directives $cmd]
if { $idx != -1 } {
#
# SRC1 is the full pathname of the main file of the testcase.
# SID identifies a test suite in the names of temporary files.
-proc lto-execute { src1 sid } {
+proc lto-execute-1 { src1 sid } {
global srcdir tmpdir
global lto_option_list
global tool
}
}
+proc lto-execute { src1 sid } {
+ lto-execute-1 $src1 $sid
+
+ # LTO testing doesn't use 'dg-runtest'/'dg-test', and thus doesn't call
+ # 'cleanup-after-saved-dg-test', so we have to clean up manually.
+ initialize_prune_notes
+}
+
# Call pass if object readelf is ok, otherwise fail.
# example: /* { dg-final { object-readelf Tag_ABI_enum_size int} } */
proc object-readelf { args } {
regsub -all "(^|\n)\[ \]+from \[^\n\]*" $text "" text
regsub -all "(^|\n)(In|of) module( \[^\n \]*,)? imported at \[^\n\]*" $text "" text
- # Ignore informational notes.
- regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text
+ global prune_notes
+ if { $prune_notes } {
+ # Ignore informational notes.
+ regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text
+ }
# Ignore harmless -fpic warnings.
regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC) ignored for target\[^\n\]*" $text "" text
regsub -all "(^|\n)\[ \t\]*from \[^\n\]*" $text "" text
# Ignore informational notes.
+ #TODO As this isn't even using 'gcc-dg.exp', cannot consider its
+ # 'variable prune_notes' (for 'dg-note') here.
regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text
# Ignore errata warning from IA64 assembler.