Commit a5eae716 by Paolo Carlini Committed by Paolo Carlini

parser.c (set_and_check_decl_spec_loc): Use rich_location::add_range in error…

parser.c (set_and_check_decl_spec_loc): Use rich_location::add_range in error message about __thread and thread_local...

/cp
2018-07-02  Paolo Carlini  <paolo.carlini@oracle.com>

	* parser.c (set_and_check_decl_spec_loc): Use rich_location::add_range
	in error message about __thread and thread_local at the same time.

/testsuite
2018-07-02  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/diagnostic/thread-thread_local.C: New.

From-SVN: r262321
parent ee896276
2018-07-02 Paolo Carlini <paolo.carlini@oracle.com>
* parser.c (set_and_check_decl_spec_loc): Use rich_location::add_range
in error message about __thread and thread_local at the same time.
2018-06-29 Marek Polacek <polacek@redhat.com> 2018-06-29 Marek Polacek <polacek@redhat.com>
PR c++/86184 PR c++/86184
......
...@@ -28377,12 +28377,15 @@ set_and_check_decl_spec_loc (cp_decl_specifier_seq *decl_specs, ...@@ -28377,12 +28377,15 @@ set_and_check_decl_spec_loc (cp_decl_specifier_seq *decl_specs,
else if (ds == ds_thread) else if (ds == ds_thread)
{ {
bool gnu = token_is__thread (token); bool gnu = token_is__thread (token);
gcc_rich_location richloc (location);
if (gnu != decl_specs->gnu_thread_keyword_p) if (gnu != decl_specs->gnu_thread_keyword_p)
error_at (location, {
"both %<__thread%> and %<thread_local%> specified"); richloc.add_range (decl_specs->locations[ds_thread], false);
error_at (&richloc,
"both %<__thread%> and %<thread_local%> specified");
}
else else
{ {
gcc_rich_location richloc (location);
richloc.add_fixit_remove (); richloc.add_fixit_remove ();
error_at (&richloc, "duplicate %qD", token->u.value); error_at (&richloc, "duplicate %qD", token->u.value);
} }
2018-07-02 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/diagnostic/thread-thread_local.C: New.
2018-07-02 Martin Liska <mliska@suse.cz> 2018-07-02 Martin Liska <mliska@suse.cz>
PR testsuite/86366 PR testsuite/86366
......
// { dg-options "-fdiagnostics-show-caret" }
// { dg-do compile { target c++11 } }
thread_local __thread int a; // { dg-error "14:both .__thread. and .thread_local. specified" }
/* { dg-begin-multiline-output "" }
thread_local __thread int a;
~~~~~~~~~~~~ ^~~~~~~~
{ dg-end-multiline-output "" } */
__thread thread_local int b; // { dg-error "10:both .__thread. and .thread_local. specified" }
/* { dg-begin-multiline-output "" }
__thread thread_local int b;
~~~~~~~~ ^~~~~~~~~~~~
{ dg-end-multiline-output "" } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment