CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Warning 202: "Variable never used rs232_errors"

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
object01



Joined: 13 May 2004
Posts: 90
Location: Nashville, TN

View user's profile Send private message Send e-mail Visit poster's website

Warning 202: "Variable never used rs232_errors"
PostPosted: Sun Mar 27, 2005 1:55 am     Reply with quote

Is there a way to ignore this warning? Wrapping my #use rs232 declarations in an #ignore_warnings 202 block doesn't seem to do the trick. I keep "errors" in those declarations because it's my understanding that that causes the compiler to generate error-flag cleanup code, and I'd just as soon keep that. But the warning is just annoying.

--
Jeff S.
bluetooth



Joined: 08 Jan 2005
Posts: 74

View user's profile Send private message

PostPosted: Sun Mar 27, 2005 7:56 am     Reply with quote

If removing this annoyance is worth one instruction word, add the following early in your program:

Code:

rs232_errors = 0;


This is one of the other ways to make this error go away....
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

Re: Warning 202: "Variable never used rs232_errors"
PostPosted: Sun Mar 27, 2005 8:21 am     Reply with quote

object01 wrote:
Is there a way to ignore this warning? Wrapping my #use rs232 declarations in an #ignore_warnings 202 block doesn't seem to do the trick. I keep "errors" in those declarations because it's my understanding that that causes the compiler to generate error-flag cleanup code, and I'd just as soon keep that. But the warning is just annoying.

--
Jeff S.


I believe that you should be using "ERRORS" and not "RS232_ERRORS" according to the manual.
bluetooth



Joined: 08 Jan 2005
Posts: 74

View user's profile Send private message

PostPosted: Sun Mar 27, 2005 8:30 am     Reply with quote

Mark:

RS232_errors is a variable that holds that USART status.... ERRORS is the directive for the #use RS232 command....
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Mar 27, 2005 12:20 pm     Reply with quote

Quote:

Wrapping my #use rs232 declarations in an #ignore_warnings 202 block
doesn't seem to do the trick.

Not sure what you mean by a "block". The placement shown below
stops the warnings.

Code:
#include <16F877.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#ignore_warnings 202
//--------------------------------------------

void main()
{

while(1);
}
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Sun Mar 27, 2005 4:17 pm     Reply with quote

bluetooth wrote:
Mark:

RS232_errors is a variable that holds that USART status.... ERRORS is the directive for the #use RS232 command....


Yeah I know that, I thought he was using RS232_errors in the #use rs232. I don't use those functions except when helping others out. I don't get the warning either so I figured he must be doing something different.
object01



Joined: 13 May 2004
Posts: 90
Location: Nashville, TN

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Mon Mar 28, 2005 8:26 am     Reply with quote

PCM programmer wrote:

Not sure what you mean by a "block". The placement shown below
stops the warnings.


"Block" = the habit of including #ignore_warnings NONE after any #ignore_warnings x directive.

*smack* I'll leave that out this time.

--
Jeff S.
object01



Joined: 13 May 2004
Posts: 90
Location: Nashville, TN

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Mon Mar 28, 2005 9:38 am     Reply with quote

PCM programmer wrote:
Not sure what you mean by a "block". The placement shown below
stops the warnings.

Code:
#include <16F877.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#ignore_warnings 202
//--------------------------------------------

void main()
{

while(1);
}


Well, I thought it'd work too... but it doesn't seem to do the trick. I've put it immediately before main(), immediately after my #use rs232 directives, immediately before them, etc. Even made it the first line in my program. No luck.

And I remembered why a single #ignore_warnings 202 line wasn't acceptable in the first place without an #ignore_warnings NONE; 'cause I want to be notified about all unused variables except rs232_errors.

--
Jeff S.
bluetooth



Joined: 08 Jan 2005
Posts: 74

View user's profile Send private message

PostPosted: Mon Mar 28, 2005 6:51 pm     Reply with quote

Quote:

And I remembered why a single #ignore_warnings 202 line wasn't acceptable in the first place without an #ignore_warnings NONE; 'cause I want to be notified about all unused variables except rs232_errors.

--
Jeff S.


Then use my suggestion:

rs232_errors = 0;

inserted near the beginning of the program will eliminate the error.

Edited to add:

You can make this error go away WITHOUT generating code by defining a function you never call. In that function, put:

rs232_errors = 0;

This will satisfy the compiler that the variable was used, but the optimizer won't generate the code!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group