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

Can you generate your own complier warnings ?

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



Joined: 05 Aug 2006
Posts: 149
Location: Redditch, UK

View user's profile Send private message Visit poster's website

Can you generate your own complier warnings ?
PostPosted: Mon Sep 10, 2007 4:23 am     Reply with quote

Is there a way to generate compliler warnings ? Question

I tried using #ERROR like below but its not accepted. Can't find something like #warnt in help file either. I just want to send myself a reminder that I have compiled for use with ICD and thus I should turn the option off before releasing the code. I have PCM3.249.

Code:
// Running in ICD mode ?
#if getenv("ICD") == 1
#define __ICD__
#endif

#ifdef __ICD__
#ignore_warnings 119
#error Compiled For ICD
#endif
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Mon Sep 10, 2007 5:25 am     Reply with quote

Code:

#if getenv("ICD") 
#error Compiled For ICD 
#ignore_warnings 119
#else
#error Compiled For Releasing
#endif


Humberto
nurquhar



Joined: 05 Aug 2006
Posts: 149
Location: Redditch, UK

View user's profile Send private message Visit poster's website

PostPosted: Mon Sep 10, 2007 6:55 am     Reply with quote

Dear Humberto

I am afraid your version does the same as mine. ie the compiler will not let you ignore code 119 and the #error stops compilation rather than carrying on as if only a warning had been encoutered. I got the following errors for your code :

Code:
*** Error 119 "N:\Projects\RonHaselden\WaterMusic\System\PIC\SysLinRGB_01\SysLinRGB_01.c" Line 27(7,26):  Compiled For ICD
*** Error 103 "N:\Projects\RonHaselden\WaterMusic\System\PIC\SysLinRGB_01\SysLinRGB_01.c" Line 28(17,22): Constant out of the valid range  119 is not 200..299


Neil
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Mon Sep 10, 2007 8:22 am     Reply with quote

Code:

Can you generate your own complier warnings ?

Preprocessor #ERROR enable you to generate Compiler ERROR, not Compiler WARNIG.

Quote:

#ignore_warnings 119

I just copied and pasted your code. Warning 119 as the Compiler says, does not exist.


Humberto
nurquhar



Joined: 05 Aug 2006
Posts: 149
Location: Redditch, UK

View user's profile Send private message Visit poster's website

PostPosted: Mon Sep 10, 2007 9:26 am     Reply with quote

Thats because my question was : "Can you generate your own complier warnings ?", ie not errors !
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Mon Sep 10, 2007 10:02 am     Reply with quote

At compiling time I guess you have not options, but at power up time, you could do something like this:
Code:

// Insert this code after init procedure and before main()

#if getenv("ICD") 
printf("*** Warning ICD Enabled ! ***");
#else
printf("Release Version #1.%02d", version);
#endif



Humberto
nurquhar



Joined: 05 Aug 2006
Posts: 149
Location: Redditch, UK

View user's profile Send private message Visit poster's website

PostPosted: Mon Sep 10, 2007 11:09 pm     Reply with quote

Unfortunaly my project requires that all 250 PIC units will be using the serial port to connect to my RS485 multi drop netowrk. So they are only supposed to "speek" when "spoken" to. Also I don't want to program 250 units and then realise, oops I forgot to turn ICD option off.

Thanks for your thoughts. It was more in hope than expectation that user warnings were possible.
Neil
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Sep 11, 2007 3:35 am     Reply with quote

I do agree the possiblity to define your own warning messages can be a nice feature. I don't think in the current CCS versions this is possible, but why don't you send CCS a message requesting this feature? It's not a big issue, so you might be lucky and they will put it in soon.
Guest








PostPosted: Thu Feb 12, 2009 7:02 am     Reply with quote

Hi

Try pre processor directive
Code:
#error/warning Text


cheers Simon
dyeatman



Joined: 06 Sep 2003
Posts: 1923
Location: Norman, OK

View user's profile Send private message

PostPosted: Thu Feb 12, 2009 8:31 am     Reply with quote

Reading the current manual Page 139 shows the
preprocessor directive: #WARNING
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