===================================================================
@@ -149,6 +149,7 @@ warn_uninit (enum opt_code wc, tree t,
location = (context != NULL && gimple_has_location (context))
? gimple_location (context)
: DECL_SOURCE_LOCATION (var);
+ location = map_discriminator_location (location);
location = linemap_resolve_location (line_table, location,
LRK_SPELLING_LOCATION,
NULL);
===================================================================
@@ -108,6 +108,8 @@ maybe_unwind_expanded_macro_loc (diagnostic_contex
unsigned ix;
loc_map_pair loc, *iter;
+ if (has_discriminator (where))
+ where = map_discriminator_location (where);
map = linemap_lookup (line_table, where);
if (!linemap_macro_expansion_map_p (map))
return;
===================================================================
@@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. If not see
#include "builtins.h"
#include "ubsan.h"
#include "cilk.h"
+#include "input.h"
static tree do_mpc_arg1 (tree, tree, int (*)(mpc_ptr, mpc_srcptr, mpc_rnd_t));
@@ -12064,6 +12065,10 @@ fold_builtin_next_arg (tree exp, bool va_start_p)
tree fntype = TREE_TYPE (current_function_decl);
int nargs = call_expr_nargs (exp);
tree arg;
+ location_t loc = LOCATION_LOCUS (input_location);
+ if (has_discriminator (loc))
+ loc = map_discriminator_location (loc);
+
/* There is good chance the current input_location points inside the
definition of the va_start macro (perhaps on the token for
builtin) in a system header, so warnings will not be emitted.
===================================================================
@@ -188,6 +188,7 @@ diagnostic_set_info_translated (diagnostic_info *d
va_list *args, location_t location,
diagnostic_t kind)
{
+ location = map_discriminator_location (location);
diagnostic->message.err_no = errno;
diagnostic->message.args_ptr = args;
diagnostic->message.format_spec = msg;
@@ -514,6 +515,9 @@ diagnostic_report_current_module (diagnostic_conte
if (where <= BUILTINS_LOCATION)
return;
+ if (has_discriminator (where))
+ where = map_discriminator_location (where);
+
linemap_resolve_location (line_table, where,
LRK_MACRO_DEFINITION_LOCATION,
&map);