public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PR 91770 - emit a warning in a system header
@ 2019-10-10 12:34 Nathan Sidwell
  2019-10-10 13:06 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Sidwell @ 2019-10-10 12:34 UTC (permalink / raw)
  To: GCC Patches

In addressing 91770, I need to emit a warning for a location inside a 
system header file[1].  The diagnostics machinery elides warnings when 
the location is in a system header :(

As I happen to have located the appropriate line_map in the process of 
determining the nested extern "C", I could clear the map's 
in-system-header flag around the warning emission.  But that's, well, urgh:(

Is there a neater way?

nathan

[1] The user may have included the system header inside an extern "C" 
region, but this is also so the glibc maintainers can locate where glibc 
does it itself.
-- 
Nathan Sidwell

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PR 91770 - emit a warning in a system header
  2019-10-10 12:34 PR 91770 - emit a warning in a system header Nathan Sidwell
@ 2019-10-10 13:06 ` Jakub Jelinek
  2019-10-10 19:01   ` Marek Polacek
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2019-10-10 13:06 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: GCC Patches

On Thu, Oct 10, 2019 at 08:24:29AM -0400, Nathan Sidwell wrote:
> In addressing 91770, I need to emit a warning for a location inside a system
> header file[1].  The diagnostics machinery elides warnings when the location
> is in a system header :(
> 
> As I happen to have located the appropriate line_map in the process of
> determining the nested extern "C", I could clear the map's in-system-header
> flag around the warning emission.  But that's, well, urgh:(
> 
> Is there a neater way?

  bool save_warn_system_headers = global_dc->dc_warn_system_headers;
  global_dc->dc_warn_system_headers = 1;
...
  global_dc->dc_warn_system_headers = save_warn_system_headers;

?

I'm afraid warning_sentinel can't be used here, because that clears, rather
than sets it.

	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PR 91770 - emit a warning in a system header
  2019-10-10 13:06 ` Jakub Jelinek
@ 2019-10-10 19:01   ` Marek Polacek
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Polacek @ 2019-10-10 19:01 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Nathan Sidwell, GCC Patches

On Thu, Oct 10, 2019 at 02:34:36PM +0200, Jakub Jelinek wrote:
> On Thu, Oct 10, 2019 at 08:24:29AM -0400, Nathan Sidwell wrote:
> > In addressing 91770, I need to emit a warning for a location inside a system
> > header file[1].  The diagnostics machinery elides warnings when the location
> > is in a system header :(
> > 
> > As I happen to have located the appropriate line_map in the process of
> > determining the nested extern "C", I could clear the map's in-system-header
> > flag around the warning emission.  But that's, well, urgh:(
> > 
> > Is there a neater way?
> 
>   bool save_warn_system_headers = global_dc->dc_warn_system_headers;
>   global_dc->dc_warn_system_headers = 1;
> ...
>   global_dc->dc_warn_system_headers = save_warn_system_headers;
> 
> ?
> 
> I'm afraid warning_sentinel can't be used here, because that clears, rather
> than sets it.

We also have temp_override, that looks like it could be used instead.

Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-10 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 12:34 PR 91770 - emit a warning in a system header Nathan Sidwell
2019-10-10 13:06 ` Jakub Jelinek
2019-10-10 19:01   ` Marek Polacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).