PSoC >> PSoC Mixed-Signal Array

Pages: 1
rflores
Cypress FAE


Reged: Jul 10 2007
Posts: 52
Unused Member warning sometimes unjustified
      #48732 - Thu Apr 03 2008 01:25 PM

Compiler issues "(350) unused member" warning for uninitialized members when a structure pointer is passed to a fastcall16 function. Since a struct pointer is passed, the called function may write these values (which happens in this case), so initializing all members is wasteful. While it's a minor thing and I'm being picky, I want to avoid warnings.

Code:

{
struct {
BYTE bARG_BlockId; // block ID
BYTE *pARG_FlashBuffer; // flash buffer pointer - 2 bytes
CHAR cARG_Temperature; // die Temperature, -40 to 100
BYTE bDATA_PWErase; // Temporary storage (reserved)
BYTE bDATA_PWProgram; // Temporary storage (reserved)
BYTE bDATA_PWMultiplier; // Temporary storage (reserved)
} fooStruct;
fooStruct.bARG_BlockId = SNP_EEP_BLK_NUM;
fooStruct.pARG_FlashBuffer = (char *)&net;
fooStruct.cARG_Temperature = 25;
if (bFlashWriteBlock((FLASH_WRITE_STRUCT*)&fooStruct) == 0) {
######################
!W ./snp_protocol.c(931):(350) unused member "bDATA_PWErase" (from line 921) (warning)
!W ./snp_protocol.c(931):(350) unused member "bDATA_PWProgram" (from line 922) (warning)
!W ./snp_protocol.c(931):(350) unused member "bDATA_PWMultiplier" (from line 923) (warning)


Post Extras: Print Post   Remind Me!   Notify Moderator  
clydeAdministrator
HI-TECH team member
*****

Reged: Oct 16 2003
Posts: 623
Re: Unused Member warning sometimes unjustified [Re: rflores]
      #48792 - Thu Apr 03 2008 08:51 PM

Rick, I'll get this warning reviewed to see if it serves any useful purpose for structure members, but you can turn it off. I believe you only get the warning if you have a structure definition inside a function, and you can add this pragma to disable specific warnings:

Code:

#pragma warning disable 350


Note however that this will disable all instances of warning 350. There is a corresponding "enable" pragma, and also push and pop, e.g.
Code:

#pragma warning push

#pragma warning disable 350

#pragma warning pop
// at this point warning 350 is re-enabled.



These pragmas appear to have been omitted from the manual (although they are mentioned under "Changing message behaviour".) I'll also get that attended to.

Clyde


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 0 anonymous users are browsing this forum.

Moderator:  ndouglas, Dan Henry, jtemples, jeff, Andrew L, mikerj, dave g, meisty, josh stevo 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is enabled
      UBBCode is enabled

Rating:
Topic views: 826

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5