Undefined static functions

Joseph S. Myers jsm@polyomino.org.uk
Tue Aug 31 09:11:00 GMT 2004


On Mon, 30 Aug 2004, Richard Henderson wrote:

> On Tue, Aug 31, 2004 at 12:11:20AM +0000, Joseph S. Myers wrote:
> > (b) Is there any reason this shouldn't be a hard error rather than just a 
> > pedwarn?
> 
> The function implementation is contained within a file-scope asm.  I need
> to tell the compiler that the symbol is locally defined (static as opposed
> to extern), so that the proper set of relocations are selected.
> 
> I have used this often in kernel and libc code.

This does rather make me wonder whether what check_global_declarations 
does after warning,

          /* This symbol is effectively an "extern" declaration now.  */
          TREE_PUBLIC (decl) = 1;

is particularly safe.  Certainly it looks like setting TREE_PUBLIC after 
pedwarning in the front end wouldn't be a particularly good way to stop 
check_global_declarations from warning - defining TREE_NO_WARNING to apply 
to decls as well as expressions looks safer.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
  http://www.srcf.ucam.org/~jsm28/gcc/#c90status - status of C90 for GCC 3.5
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)



More information about the Gcc mailing list