[Bug c++/13527] New: __attribute__ ((unused)) ignored

robin at robindaugherty dot net gcc-bugzilla@gcc.gnu.org
Wed Dec 31 02:35:00 GMT 2003


In a number of seperate files, the ((unused)) attribute went ignored, causing
warnings for these lines:

static char bugs_doc[] __attribute__ ((unused)) = "Robin Daugherty";
static char version[] __attribute__ ((unused)) = "hsmdr 1.0 (2003-APR-29)";

But only if the mysql header files are included first:

// MySQL client headers
#include <mysql/my_global.h>
#include <mysql/my_sys.h>
#include <mysql/m_string.h>
#include <mysql/mysql.h>
#include <mysql/mysql_embed.h>
#include <mysql/errmsg.h>
#include <mysql/my_getopt.h>

Moving this block before the two declarations causes warnings to be issued:

hsmdr.cpp:48: warning: `char bugs_doc[16]' defined but not used
hsmdr.cpp:49: warning: `char version[24]' defined but not used

But these warnings are gone if the declaration is first.

-- 
           Summary: __attribute__ ((unused)) ignored
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: robin at robindaugherty dot net
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list