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.
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.
the compiler settings are these:
I am using theCypress project named CE195313 that you can use for test.
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.