View previous topic :: View next topic |
Author |
Message |
nurquhar
Joined: 05 Aug 2006 Posts: 149 Location: Redditch, UK
|
Can you generate your own complier warnings ? |
Posted: Mon Sep 10, 2007 4:23 am |
|
|
Is there a way to generate compliler warnings ?
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
|
|
|
![](templates/subSilver/images/spacer.gif) |
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Mon Sep 10, 2007 5:25 am |
|
|
Code: |
#if getenv("ICD")
#error Compiled For ICD
#ignore_warnings 119
#else
#error Compiled For Releasing
#endif
|
Humberto |
|
![](templates/subSilver/images/spacer.gif) |
nurquhar
Joined: 05 Aug 2006 Posts: 149 Location: Redditch, UK
|
|
Posted: Mon Sep 10, 2007 6:55 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Mon Sep 10, 2007 8:22 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
nurquhar
Joined: 05 Aug 2006 Posts: 149 Location: Redditch, UK
|
|
Posted: Mon Sep 10, 2007 9:26 am |
|
|
Thats because my question was : "Can you generate your own complier warnings ?", ie not errors ! |
|
![](templates/subSilver/images/spacer.gif) |
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Mon Sep 10, 2007 10:02 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
nurquhar
Joined: 05 Aug 2006 Posts: 149 Location: Redditch, UK
|
|
Posted: Mon Sep 10, 2007 11:09 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Sep 11, 2007 3:35 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Thu Feb 12, 2009 7:02 am |
|
|
Hi
Try pre processor directive
Code: | #error/warning Text |
cheers Simon |
|
![](templates/subSilver/images/spacer.gif) |
dyeatman
Joined: 06 Sep 2003 Posts: 1924 Location: Norman, OK
|
|
Posted: Thu Feb 12, 2009 8:31 am |
|
|
Reading the current manual Page 139 shows the
preprocessor directive: #WARNING |
|
![](templates/subSilver/images/spacer.gif) |
|