With a wider integer width than a pointer, gcc can still warn
when you cast a pointer. Strange but true. To see these warnings
compile with gcc -m32, 32-bit target, and enable UNITY_SUPPORT_64
Using this option changes the control flow of Unity, but is useful on
constrained embedded systems. You can't fully simulate the power of
'longjmp' with just 'return', but Unity still works well, all tests pass.
Originated from commit c6dc96f3 but are rarely used and not in math.h
Removes float to double promotion warning and simplifies the code
'gcc -std=gnu99 -Wdouble-promotion' spits out these warnings
Remove UNITY_FLOAT_VERBOSE entirely, add option UNITY_EXCLUDE_FLOAT_PRINT
Remove some questionable float casts from doubles
Default to Round Ties to Even behavior, add option to Round Ties Away from Zero
This solves the warnings from -Wredundant-decls when overriding the
OUTPUT function with a function declared in another header.
It's better this is the non-default option, since using it requires either
a declaration of the new function OR a preprocessor guard on declaring
UNITY_OUTPUT_CHAR (as in unity.c here), in every file using the function.
See Pull Request #185 for more.
These were aimed at preventing the internals header from declaring
a prototype for 'int UNITY_OUTPUT_CHAR(int);'. The second part fixed
an omitted declaration in the tests caused by the first commit.
Will replace the default behavior & add an option for this in next commit
Revert the previous commit. Add tests for extended enum cases.
Fix crash due to accessing 'trait_names' array out of bounds.
Adding an extra invalid value to the end of an enum causes '-Wswitch' flag
to warn unless there is a switch default case - also enabled by '-Wall'.
Make subtraction result unsigned, change prototype & casts in internals.
If "actual - expected" overflowed, it wrapped to a negative number,
but would fit in an unsigned type, example is INT_MAX - (-1) = INT_MIN
For correctness, 'delta' should be unsigned too. Passing in a negative
number always passed. The delta can be between INT_MAX & UINT_MAX.
Delete the { ;} braces and semicolon from UNITY_PRINT_EOL to give it expected
behavior: 1) requires a semicolon 2) works in one-liner if-else statements
If you need "\r\n" for EOL, define as the following to get the same behavior:
do{UNITY_OUTPUT_CHAR('\r'); UNITY_OUTPUT_CHAR('\n');}while(0)
Added parentheses around all macro parameters to resolve MISRA 2004
rule 19.10, "in the definition of a function-like macro, each instance
of a parameter shall be enclosed in parenthesis" as tested with the
IAR EW for 8051 compiler, version 9.20.2.
The only questionable change is in "unity_fixture.h" where the nested
macro DECLARE_TEST_CASE in RUN_TEST_CASE prevents surrounding params
"group" and "name" with parentheses.
However, it appears that macro DECLARE_TEST_CASE isn't used elsewhere,
so I eliminated DECLARE_TEST_CASE and put its expansion directly in
RUN_TEST_CASE. Now the following header files pass rule 19.10:
* unity.h
* unity_internals.h
* unity_fixture.h
For my own project, this change to the Unity test framework allows me
to include my unit test code to be tested against MISRA rules as well,
instead of just production code, to help enforce style and team
guidelines.
- `UNITY_WEAK_ATTRIBUTE`, if defined, is placed before declarations of weakly
linked symbols. If not manually defined, it will be automatically set to
`__attribute__((weak))` on GCC and Clang, except for Clang for Win32.
- `UNITY_WEAK_PRAGMA`, if defined, will cause preprocessor to emit
`#pragma weak setUp`, etc. Ignored if `UNITY_WEAK_ATTRIBUTE` is defined.
- `UNITY_NO_WEAK` undefines both of the above resulting in no weakly
linked symbols.
Work around for ThrowTheSwitch/Unity#93