public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Get rid of warning in dwarf2out.c
@ 2011-04-18 17:57 Eric Botcazou
  2011-04-26  9:04 ` Hans-Peter Nilsson
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Botcazou @ 2011-04-18 17:57 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 539 bytes --]

Compiling dwarf2out.c with older versions of GCC yields a warning because 
is_redundant_typedef has a prototype without the 'inline' keyboard and a 
declaration with it, and is called from another function in-between.

The attached patchlet adds 'inline' to the prototype, as is done for other 
functions in the file.  Tested on i586-suse-linux, applied on mainline and 
4.6/4.5 branches as obvious.

2011-04-18  Eric Botcazou  <ebotcazou@adacore.com>

	* dwarf2out.c (is_redundant_typedef): Add 'inline' to prototype.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 619 bytes --]

Index: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 172617)
+++ dwarf2out.c	(working copy)
@@ -6565,7 +6565,7 @@ static void gen_typedef_die (tree, dw_di
 static void gen_type_die (tree, dw_die_ref);
 static void gen_block_die (tree, dw_die_ref, int);
 static void decls_for_scope (tree, dw_die_ref, int);
-static int is_redundant_typedef (const_tree);
+static inline int is_redundant_typedef (const_tree);
 static bool is_naming_typedef_decl (const_tree);
 static inline dw_die_ref get_context_die (tree);
 static void gen_namespace_die (tree, dw_die_ref);

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

* Re: Get rid of warning in dwarf2out.c
  2011-04-18 17:57 Get rid of warning in dwarf2out.c Eric Botcazou
@ 2011-04-26  9:04 ` Hans-Peter Nilsson
  2011-04-28 16:15   ` Eric Botcazou
  0 siblings, 1 reply; 3+ messages in thread
From: Hans-Peter Nilsson @ 2011-04-26  9:04 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

On Mon, 18 Apr 2011, Eric Botcazou wrote:
> Compiling dwarf2out.c with older versions of GCC yields a warning because
> is_redundant_typedef has a prototype without the 'inline' keyboard and a
> declaration with it, and is called from another function in-between.

Shouldn't there be a warning from newer gcc, i.e. from trunk?

brgds, H-P

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

* Re: Get rid of warning in dwarf2out.c
  2011-04-26  9:04 ` Hans-Peter Nilsson
@ 2011-04-28 16:15   ` Eric Botcazou
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Botcazou @ 2011-04-28 16:15 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: gcc-patches

> Shouldn't there be a warning from newer gcc, i.e. from trunk?

The code in GCC 4.3 reads:

      /* Inline declaration after use or definition.
	 ??? Should we still warn about this now we have unit-at-a-time
	 mode and can get it right?
	 Definitely don't complain if the decls are in different translation
	 units.
	 C99 permits this, so don't warn in that case.  (The function
	 may not be inlined everywhere in function-at-a-time mode, but
	 we still shouldn't warn.)  */
     if (DECL_DECLARED_INLINE_P (newdecl) && !DECL_DECLARED_INLINE_P (olddecl)
	  && same_translation_unit_p (olddecl, newdecl)
	  && flag_gnu89_inline)
	{
	  if (TREE_USED (olddecl))
	    {
	      warning (0, "%q+D declared inline after being called", olddecl);
	      warned = true;
	    }
	  else if (DECL_INITIAL (olddecl))
	    {
	      warning (0, "%q+D declared inline after its definition", olddecl);
	      warned = true;
	    }
	}

It was removed by:

2008-07-24  Jan Hubicka  <jh@suse.cz>

	* cgraphbuild.c (record_reference): Drop non-unit-at-a-time code.
	(build_cgraph_edges): Likewise.
[...]
	* c-decl.c (diagnose_mismatched_decls): Do not require inline keyword
	early in GNU dialect.


so I presume that the answer is no.

-- 
Eric Botcazou

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

end of thread, other threads:[~2011-04-28 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-18 17:57 Get rid of warning in dwarf2out.c Eric Botcazou
2011-04-26  9:04 ` Hans-Peter Nilsson
2011-04-28 16:15   ` Eric Botcazou

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).