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++/8045] Missing "unused variable" warning



------- Comment #4 from flameeyes at gentoo dot org  2008-05-11 16:31 -------
I think this applies to 4.3 as well, as the following code does only warn in
the second function:

#include <stdlib.h>
#include <string.h>

char* oldstyle(const char *foo) {
  size_t foolen;

  if ( foo == NULL )
    return NULL;

  foolen = strlen(foo);

  return strdup(foo);
}

char* newstyle(const char *foo) {
  if ( foo == NULL )
    return NULL;

  const size_t foolen = strlen(foo);

  return strdup(foo);
}

And I could really make use of such a warning in xine-lib's code :)


-- 

flameeyes at gentoo dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |flameeyes at gentoo dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8045


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