coverity_scan_model.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Coverity Scan model.
  3. *
  4. * - A model file can't import any header files.
  5. * - Therefore only some built-in primitives like int, char and void are
  6. * available but not wchar_t, NULL etc.
  7. * - Modeling doesn't need full structs and typedefs. Rudimentary structs
  8. * and similar types are sufficient.
  9. * - An uninitialized local pointer is not an error. It signifies that the
  10. * variable could be either NULL or have some data.
  11. *
  12. * Coverity Scan doesn't pick up modifications automatically. The model file
  13. * must be uploaded by an admin in the analysis settings of
  14. * https://scan.coverity.com/projects/1513
  15. */
  16. namespace std
  17. {
  18. typedef unsigned long size_t;
  19. }
  20. namespace uavcan
  21. {
  22. void handleFatalError(const char* msg)
  23. {
  24. __coverity_panic__();
  25. }
  26. template <std::size_t PoolSize, std::size_t BlockSize>
  27. class PoolAllocator
  28. {
  29. public:
  30. void* allocate(std::size_t size)
  31. {
  32. return __coverity_alloc__(size);
  33. }
  34. void deallocate(const void* ptr)
  35. {
  36. __coverity_free__(ptr);
  37. }
  38. };
  39. }