mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-05 21:15:20 +00:00
ccfe2690f4466c832c388bf86a72f24a96ef041c
Running a project through Clang's scan-build produces countless
warnings like
build/test/mocks/mock_handleTroubleEvents.c:321:5: warning: Value stored to 'call_instance' is never read
call_instance = CMOCK_GUTS_NONE;
^ ~~~~~~~~~~~~~~~
scan-build correctly determines that in the following snippet
UNITY_CLR_DETAILS();
if (Mock.checkForActiveTroubleAfterDebounce_CallbackFunctionPointer != NULL)
call_instance = CMOCK_GUTS_NONE;
call_instance = Mock.startStopTimer_CallInstance;
as generated by Ceedling / CMock, the first assignment to
call_instance is completely unused.
The sheer amount of warnings makes it very hard to impossible to
spot real problems in one's code, and creates huge code analysis
reports that just distract from actual problems in one's code.
Without being too invasive, we can instruct scan-build to ignore
this dead store using
https://clang-analyzer.llvm.org/faq.html#dead_store
Signed-off-by: André Draszik <git@andred.net>
CMock - Mock/stub generator for C
Getting Started
If you're using Ceedling, there is no need to install CMock. It will handle it for you. For everyone else, the simplest way is to grab it off github. You can also download it as a zip if you prefer. The Github method looks something like this:
> git clone --recursive https://github.com/throwtheswitch/cmock.git
> cd cmock
> bundle install # Ensures you have all RubyGems needed
If you plan to help with the development of CMock (or just want to verify that it can perform its self tests on your system) then you can enter the test directory and then ask it to test:
> cd test
> rake # Run all CMock self tests
API Documentation
- Not sure what you're doing?
- Interested in our MIT-style license?
- Are there examples?
- They are all in /examples
- Any other resources to check out?
- Definitely! Check out our developer portal on ThrowTheSwitch.org
Description
Languages
C
58.9%
Ruby
23.2%
Assembly
9.5%
Tcl
7.9%
Batchfile
0.4%
