[PATCH] Fix 2 clang warnings.

Martin Sebor msebor@gmail.com
Thu Jun 27 15:16:00 GMT 2019


On 6/27/19 8:03 AM, Martin Liška wrote:
> Hi.
> 
> This reduces 2 warnings reported by clang.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2019-06-27  Martin Liska  <mliska@suse.cz>
> 
> 	* edit-context.c (test_applying_fixits_unreadable_file): Do not
> 	use () for a constructor call.
> 	(test_applying_fixits_line_out_of_range): Likewise.
> 	* ggc-page.c (free_page): Use (char *) for %p printf format
> 	argument.
> ---
>   gcc/edit-context.c | 4 ++--
>   gcc/ggc-page.c     | 2 +-
>   2 files changed, 3 insertions(+), 3 deletions(-)

Just as a side note:

diff --git a/gcc/edit-context.c b/gcc/edit-context.c
index d3246ab0334..93d10664ae9 100644
--- a/gcc/edit-context.c
+++ b/gcc/edit-context.c
@@ -1639,7 +1639,7 @@ static void
  test_applying_fixits_unreadable_file ()
  {
    const char *filename = "this-does-not-exist.txt";
-  line_table_test ltt ();
+  line_table_test ltt;
    linemap_add (line_table, LC_ENTER, false, filename, 1);

    location_t loc = linemap_position_for_column (line_table, 1);

I'm guessing the warning above is about declaring a function
returning line_table_test rather than declaring an object of
the type.  (It would be helpful to show those warnings when
fixing them.  A small test case confirms it's -Wvexing-parse:
warning: empty parentheses interpreted as a function declaration.)

This is a common mistake to make so it would be a useful
warning to add to GCC as well.  And in fact, I see at least
one request for it in Bugzilla: 25814 (with the related
pr86564).

Martin



More information about the Gcc-patches mailing list