- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'd like to disable a single warning that I get in a header file. I have trouble finding it in the GCC documentation. Is there a way to do it?
I'm using the Protothread library, and I get a warning in one of the header files (pt.h). Here's the warning:
"variable 'PT_YIELD_FLAG' set but not used [-Wunused-but-set-variable]"
Thanks,
Fred
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just found it by googling the error.
I needed to add __attribute__ ((unused)) to the declaration of the variable.
So the line
#define PT_BEGIN(pt) { char PT_YIELD_FLAG = 1; LC_RESUME((pt)->lc)
became
#define PT_BEGIN(pt) { char __attribute__ ((unused)) PT_YIELD_FLAG = 1; LC_RESUME((pt)->lc)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just found it by googling the error.
I needed to add __attribute__ ((unused)) to the declaration of the variable.
So the line
#define PT_BEGIN(pt) { char PT_YIELD_FLAG = 1; LC_RESUME((pt)->lc)
became
#define PT_BEGIN(pt) { char __attribute__ ((unused)) PT_YIELD_FLAG = 1; LC_RESUME((pt)->lc)