 |
 |
View previous topic :: View next topic |
Author |
Message |
allenhuffman
Joined: 17 Jun 2019 Posts: 621 Location: Des Moines, Iowa, USA
|
SOLVED: #IGNORE_WARNINGS to ignore #include source files? |
Posted: Fri Apr 23, 2021 9:44 am |
|
|
The Wiznet library has a bunch of warnings in it, and I wanted to quiet them down by doing something like this:
Code: | #IGNORE_WARNINGS 203 // Condition always TRUE
#IGNORE_WARNINGS 204 // Condition always FALSE
#IGNORE_WARNINGS 209 // Assignment to enum is not of the correct type
#IGNORE_WARNINGS 214 // Operator precedance rules may not be as intended, use () to clarify
#include "socket.c"
#include "wizchip_conf.c"
#include "wizchip_conf.h"
#include "w5500/w5500.c"
#include "w5500/w5500.h"
#IGNORE_WARNINGS NONE
|
This does not seem to work. Ideally, we would not want to touch the original source so it can be updated without extra work each time.
Thoughts? _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002.
Last edited by allenhuffman on Fri Apr 30, 2021 1:12 pm; edited 1 time in total |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9506 Location: Greensville,Ontario
|
|
Posted: Fri Apr 23, 2021 12:26 pm |
|
|
hmmm.. does ignorewarnings none defeat the previous commands ? |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 23, 2021 1:35 pm |
|
|
It works for me. I tried all combinations of the #ignore_warnings
lines below (commented out or not) and it works as desired.
This was with CCS vs. 5.103
Code: |
#include <18F46K22.h>
#use delay(internal=4M)
#IGNORE_WARNINGS 203 // Disable Condition always True warning
#include "test.h"
#IGNORE_WARNINGS NONE
//=================================
void main()
{
test_func();
while(1);
} |
test.h file:
Code: |
void test_func()
{
while(1);
} |
|
|
 |
allenhuffman
Joined: 17 Jun 2019 Posts: 621 Location: Des Moines, Iowa, USA
|
|
Posted: Fri Apr 23, 2021 9:13 pm |
|
|
temtronic wrote: | hmmm.. does ignorewarnings none defeat the previous commands ? |
You can turn it on and off that way. We always try to have zero warnings, and use this for places we want to ignore. Like this common one:
Code: |
Switch (x)
{
Case 1:
Function();
Break;
Case 2:
Default:
DefaultFunction();
Break;
}
|
Sorry about the caps. Typing in the tablet.
CCS will give a "missing break" warning which is a good warning in case someone truly did mean those to be two different case statements, but you work around it by muting the warning just around that bit of code:
Code: |
#ignore_warnings 204
Case 2:
Default:
DefaultFunction();
Break;
#ignore_warnings none
|
...or whatever that specific missing break warning is. We use that often when we have a default case like that.
Maybe the issue is including a .c file rather than a .h and if parses it differently. I’ll experiment next week when I am back in the office. _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002. |
|
 |
dyeatman
Joined: 06 Sep 2003 Posts: 1958 Location: Norman, OK
|
|
Posted: Sat Apr 24, 2021 5:11 am |
|
|
FWIW, when I have empty cases back to back I put a pair of empty braces after each case and then I don't get the warnings.
Code: | switch (testit)
{
case 1: {};
case 2: {};
case 3: {};
default: testit=testit+1;
} |
_________________ Google and Forum Search are some of your best tools!!!! |
|
 |
allenhuffman
Joined: 17 Jun 2019 Posts: 621 Location: Des Moines, Iowa, USA
|
|
Posted: Sat Apr 24, 2021 6:18 am |
|
|
dyeatman wrote: | FWIW, when I have empty cases back to back I put a pair of empty braces after each case and then I don't get the warnings.
Code: | switch (testit)
{
case 1: {};
case 2: {};
case 3: {};
default: testit=testit+1;
} |
|
Interesting. That must be a CCS thing, just like while(1) is a warning but using their while(TRUE) is not. Since it definitely is still missing a break. _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19891
|
|
Posted: Sat Apr 24, 2021 7:24 am |
|
|
On the break, why not use the nobreak define given by CCS in their
readme, to avoid this?. |
|
 |
allenhuffman
Joined: 17 Jun 2019 Posts: 621 Location: Des Moines, Iowa, USA
|
|
Posted: Fri Apr 30, 2021 12:23 pm |
|
|
Ttelmah wrote: | On the break, why not use the nobreak define given by CCS in their
readme, to avoid this?. |
Cross-compatibility with other compilers. At a previous job, two of the compilers (one was GCC) had a way to flag this, but each used a different syntax so it made for non-portable code. #defines were used to do all that.
I'm doing the same for "_readonly" in the CCS code so I can still build it externally. We tend to write out routines in ANSI-C on a PC compiler to get all the logic worked out, then do any necessary updates for PIC (like not being able to pass in a constant string by default).
If this works when #including a .h file, it apparently is turned off when doing it for including a .c :( _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002. |
|
 |
allenhuffman
Joined: 17 Jun 2019 Posts: 621 Location: Des Moines, Iowa, USA
|
|
Posted: Fri Apr 30, 2021 12:24 pm |
|
|
Ttelmah wrote: | On the break, why not use the nobreak define given by CCS in their
readme, to avoid this?. |
Where is this? I just did a search and did not find a hit for "nobreak" in the help file. It may be easier than #define the IGNORE_WARNING macro. _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002. |
|
 |
allenhuffman
Joined: 17 Jun 2019 Posts: 621 Location: Des Moines, Iowa, USA
|
|
Posted: Fri Apr 30, 2021 1:11 pm |
|
|
#IGNORE_WARNINGS 203,204,209,214,215,237
Solved: All one one line, with commas, not separate. _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002. |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 30, 2021 1:23 pm |
|
|
It's in the latest readme.txt file:
A new warning has been added to the compiler to indicate when a
case inside a switch does not have a break. For those who know
there is no break and don't need the warning you can do something
like this:
Code: | #define nobreak
...
case 4: handle_four();
nobreak;
case 5: handle_five();
break; |
|
|
 |
allenhuffman
Joined: 17 Jun 2019 Posts: 621 Location: Des Moines, Iowa, USA
|
|
Posted: Fri Apr 30, 2021 1:29 pm |
|
|
PCM programmer wrote: | It's in the latest readme.txt file: |
I just found that in the PICC program directory. I do not remember if I even realized there was a readme with the updates! Thanks! _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19891
|
|
Posted: Fri Apr 30, 2021 10:18 pm |
|
|
Apologies for not seeing that you had asked where this was...
The readme.txt, just occasionally has some absolutely brilliant little bits
like this. Like you, I had hit the case with no break problem, and found
this. I do now make it a 'point' to look in the readme when a change
happens in the compiler.  |
|
 |
|
|
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
|