Unused Variables warnings with global consts.h header file
Unused Variables warnings with global consts.h header file
- Subject: Unused Variables warnings with global consts.h header file
- From: "Jan Barnholt" <email@hidden>
- Date: Sun, 27 Jan 2008 13:51:28 +0100 (MET)
Hi there,
I get these strange warnings from Xcode 2.4.1/GCC 4.0 when compiling with the Unused Variables switch turned on.
The problem is caused by a global consts.h file declaring lots of constants, mostly enums, but also a couple of const definitions, included by almost every file in the project.
For many of these files gcc gives me the warning:
warning: 'kTBButtonDef' defined but not used
for my consts.h file containing these definitions:
#ifndef _H_CONST
#define _H_CONST
struct tTBButtonDefinition {
int ControlIdx;
char IcnsFile[256];
int CommandID;
};
const tTBButtonDefinition kTBButtonDef[kTBMaxConst] = {
{ kTBCtrlIdxNew , "New.icns" , cmd_New },
{ kTBCtrlIdxOpen , "Open.icns" , cmd_Open },
{ kTBCtrlIdxSave , "Save.icns" , cmd_Save }
};
const RGBColor kColMode_BW_BgCol = {0xFF<<8, 0xFF<<8, 0xFF<<8},
kColMode_BW_FgCol = {0x11<<8, 0x11<<8, 0x11<<8};
#endif // _H_CONST
The warning is only given for kTBButtonDef.
A couple of other declarations like the kColMode_BW_BgCol or kColMode_BW_FgCol constants don't yield a warning at all.
I just don't understand what's so special about kTBButtonDef..
Is it a compiler bug? Or is the bug in fact that the warnings are not issued for the other declarations much similar to kTBButtonDef?
Any comments appreciated!
Thanks,
Jan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden