This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] remove in_system_header variable and fields


2008/7/17 Rafael Espindola <espindola@google.com>:
> What this patch does is create a warning_at and a warning0_at. In
> places where we would incorrectly issue or suppress a warning because
> of the new value of in_system_headers, it is very simple to switch to
> warning_at. I have changed the necessary locations to fix all the
> regressions on the testsuite.

I obviously think this is the way forward. Whether we want to switch
completely to warning_at in one patch or do it incrementally is up to
the maintainers. Switching incrementally is that we have to tolerate
ugly things like:

+	      warning_at (location, OPT_Wreturn_type, "%Hcontrol reaches end
of non-void function", &location);

which, when the transition is completed, could be replaced by just:

warning (location, OPT_Wreturn_type, "control reaches end of non-void
function");

However, a complete transition would mean to update a lot of warning()
calls depending on whether they use %H, %J or %K. Then, I think those
can go away (are they used for anything else apart from diagnostics?).

>
> It bootstraps and all tests are OK. Is it good for trunk?

I have a minor suggestion. Do we need to expose LOCATION_SYSP at all?
Wouldn't it be better to just use in_system_header_at everywhere?

For example here:

+++ b/gcc/tree.h
@@ -3051,7 +3051,7 @@ struct tree_parm_decl GTY(())
 /* Nonzero for a given ..._DECL node means that no warnings should be
    generated just because this node is unused.  */
 #define DECL_IN_SYSTEM_HEADER(NODE) \
-  (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.in_system_header_flag)
+  (LOCATION_SYSP (DECL_SOURCE_LOCATION (NODE)) != 0)

and here:

@@ -15391,7 +15386,7 @@ cp_parser_member_declaration (cp_parser* parser)
       if (!decl_specifiers.any_specifiers_p)
 	{
 	  cp_token *token = cp_lexer_peek_token (parser->lexer);
-	  if (pedantic && !token->in_system_header)
+	  if (pedantic && !LOCATION_SYSP (token->location))
 	    pedwarn ("%Hextra %<;%>", &token->location);
 	}

Cheers,

Manuel.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]