abort.h 986 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
  2. // SPDX-License-Identifier: Apache-2.0
  3. // SPDX-License-Identifier: BSD-3-Clause
  4. #ifndef HIGHWAY_HWY_ABORT_H_
  5. #define HIGHWAY_HWY_ABORT_H_
  6. #include "hwy/highway_export.h"
  7. namespace hwy {
  8. // Interface for custom abort handler
  9. typedef void (*AbortFunc)(const char* file, int line,
  10. const char* formatted_err);
  11. // Retrieve current abort handler
  12. // Returns null if no abort handler registered, indicating Highway should print and abort
  13. HWY_DLLEXPORT AbortFunc& GetAbortFunc();
  14. // Sets a new abort handler and returns the previous abort handler
  15. // If this handler does not do the aborting itself Highway will use its own abort mechanism
  16. // which allows this to be used to customize the handling of the error itself.
  17. // Returns null if no previous abort handler registered
  18. HWY_DLLEXPORT AbortFunc SetAbortFunc(AbortFunc func);
  19. } // namespace hwy
  20. #endif // HIGHWAY_HWY_ABORT_H_