- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
how can I delete these warning "typedef 'BOOL' locally defined but not used [-Wunused-local-typedefs]" with PSoc creator ?
Best regards
LuBe
Solved! Go to Solution.
- Labels:
-
PSoC Creator & Designer Software
- Tags:
- PS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
the solution is place the DataType.h on the top of source file.
Best regards
LuBe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
LuBe,
I placed the following line in my main.c.
typedef uint8_t BOOL;
or
typedef _Bool BOOL;
I didn't get ANY errors or warnings as you mentioned.
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
LuBe,
I moved my typedef of BOOL into a header file called datatypes.h. Still no warnings about a locally defined but not used.
It must be how your project is configured.
Please supply the following window shot of the "Build Settings/ARM xxx/Compiler/Command Line"
We can use this to understand what compiler settings you are using.
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
the compiler settings are these:
I am using theCypress project named CE195313 that you can use for test.
Best regards
LuBe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
LuBe,
I believe I have your answer.
The warning comes up because the compile option "-Wunused-local-typedefs" is used. Although you don't directly enable this option the option "-Wall" is used and this enables this option. Here is an excerpt from the "GCC command options" (Chapter 3 pg 79)
-Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
Warn when a typedef locally defined in a function is not used. This warning is
enabled by ‘-Wall’.
Notice the text I highlighted in RED.
I don't get the warning if I place the typedef for BOOL -OR- if I #include the datatypes.h file outside of a function.
Once I place the typedef -OR- #include the datatypes.h file INSIDE a function, I get the warning.
Solution: A typedef should usually be global to the project. Place your include for datatypes.h near the top of the .c file outside any functions.
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
the solution is place the DataType.h on the top of source file.
Best regards
LuBe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
LuBe,
Cypress ha pre-defined CY_BOOL definition, which boils down to uint8
CY_BOOL myFlag=0;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There also _Bool.
"Engineering is an Art. The Art of Compromise."