Closed CurtisAMU closed 10 months ago
Does it warn with void;
Forget that last suggestion
What about void(0);
ETL_DECLARE_DEBUG_COUNT;
is a declaration and (void)0;
does not work there; it's an expression.
The former
ETL_DECLARE_DEBUG_COUNT ///< Internal debugging.
without the semicolon worked. What was the problem with that? It looks odd without the semicolon but should work.
This also works with armcc:
#define ETL_DECLARE_DEBUG_COUNT struct SDebugCountDummy {}
A dummy typedef would also do.
I added the semicolons as my IDE would not format following statements correctly without them. Everything would be indented.
There will also be this warning if ETL_NO_CHECKS
is defined for ETL_ASSERT
etc.
Do the other macros cause a warning?
ETL_INCREMENT_DEBUG_COUNT
etc
There will also be this warning if ETL_NO_CHECKS is defined for ETL_ASSERT etc.
Actually no. Empty statements are okay, it seems.
Do the other macros cause a warning?
ETL_INCREMENT_DEBUG_COUNT
etc
Not as far as I can see.
They are not used in a class declaration.
If I try an empty statement in a Keil project using ARM compiler V6 I get
warning: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
One of those complementary differences between compiler V5 and V6. There, (void)0;
would help in both cases, I'd expect.
Can you try this for me? (It says it accepts zip files, but it doesn't) debug_count.h.txt
Ignore that file, there's an error.
Can you try this patch? 749-9465468-Removed semicolon warnings.patch
Looks good, the warning is gone.
Fixed 20.38.1
https://github.com/ETLCPP/etl/blob/b38afd7fc98f50a00b207b184506049f05ab7120/include/etl/private/vector_base.h#L171
The extra semicolon causes a warning if
ETL_DEBUG_COUNT
is not defined:We have a zero warning policy for our project, which treats this as an error. It would be okay for debugging to have a warning to ignore but preferably not on release builds.