gfc_current_locus = old_loc;
break;
}
- if (old_linear_modifier)
- gfc_warning (OPT_Wdeprecated_openmp,
- "Specification of the list items as arguments to "
- "the modifiers at %L is deprecated since "
- "OpenMP 5.2", &saved_loc);
if (linear_op != OMP_LINEAR_DEFAULT)
{
if (gfc_match (" :") == MATCH_YES)
goto error;
}
}
+ if (old_linear_modifier)
+ {
+ char var_names[512]{};
+ int count, offset = 0;
+ for (gfc_omp_namelist *n = *head; n; n = n->next)
+ {
+ if (!n->next)
+ count = snprintf (var_names + offset,
+ sizeof (var_names) - offset,
+ "%s", n->sym->name);
+ else
+ count = snprintf (var_names + offset,
+ sizeof (var_names) - offset,
+ "%s, ", n->sym->name);
+ if (count < 0 || count >= ((int)sizeof (var_names))
+ - offset)
+ {
+ snprintf (var_names, 512, "%s, ..., ",
+ (*head)->sym->name);
+ while (n->next)
+ n = n->next;
+ offset = strlen (var_names);
+ snprintf (var_names + offset,
+ sizeof (var_names) - offset,
+ "%s", n->sym->name);
+ break;
+ }
+ offset += count;
+ }
+ char *var_names_for_warn = var_names;
+ const char *op_name;
+ switch (linear_op)
+ {
+ case OMP_LINEAR_REF: op_name = "ref"; break;
+ case OMP_LINEAR_VAL: op_name = "val"; break;
+ case OMP_LINEAR_UVAL: op_name = "uval"; break;
+ default: gcc_unreachable ();
+ }
+ gfc_warning (OPT_Wdeprecated_openmp,
+ "Specification of the list items as "
+ "arguments to the modifiers at %L is "
+ "deprecated; since OpenMP 5.2, use "
+ "%<linear(%s : %s%s)%>", &saved_loc,
+ var_names_for_warn, op_name,
+ step == nullptr ? "" : ", step(...)");
+ }
else if (end_colon)
{
bool has_error = false;
! { dg-options "-fno-inline" }
! { dg-additional-options "-msse2" { target sse2_runtime } }
! { dg-additional-options "-mavx" { target avx_runtime } }
+! { dg-warning "Specification of the list items as arguments to the modifiers at \\(1\\) is deprecated; since OpenMP 5.2, use 'linear\\(x, y : ref\\)' \\\[-Wdeprecated-openmp\\\]" "" { target *-*-* } 24 }
real :: a(1024), b(1024), c(1024)
integer :: i
contains
real function foo (x, y)
real :: x, y
- !$omp declare simd linear (ref (x, y)) ! { dg-warning "Specification of the list items as arguments to the modifiers at \\(1\\) is deprecated since OpenMP 5.2 \\\[-Wdeprecated-openmp\\\]" }
+ !$omp declare simd linear (ref (x, y))
foo = x + y
end function
end