This is the mail archive of the gcc-bugs@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]

[Bug c/68582] -Wunused-function doesn't warn about unused static __attribute__((noreturn)) functions


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68582

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Probably because noreturn uses the volatile bit, TREE_THIS_VOLATILE:

  /* Warn about static fns or vars defined but not used.  */
  if (((warn_unused_function && TREE_CODE (decl) == FUNCTION_DECL)
       || (((warn_unused_variable && ! TREE_READONLY (decl))
            || (warn_unused_const_variable && TREE_READONLY (decl)))
           && TREE_CODE (decl) == VAR_DECL))
      && ! DECL_IN_SYSTEM_HEADER (decl)
...
      /* A volatile variable might be used in some non-obvious way.  */
      && ! TREE_THIS_VOLATILE (decl)

this flag check should be gated on VAR_DECLs.

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