1 // Copyright 2020 The Pigweed Authors
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
7 // https://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
16 #include "pw_preprocessor/compiler.h"
17 #include "pw_preprocessor/util.h"
19 // This is needed for testing the basic crash handler.
20 // TODO(pwbug/17): Replace when Pigweed config system is added.
21 #define PW_ASSERT_BASIC_DISABLE_NORETURN 0
22 #if PW_ASSERT_BASIC_DISABLE_NORETURN
23 #define PW_ASSERT_NORETURN
25 #define PW_ASSERT_NORETURN PW_NO_RETURN
30 // Application-defined assert failure handler for pw_assert_basic.
31 // file_name - may be nullptr if not available
32 // line_number - may be -1 if not available
33 // function_name - may be nullptr if not available
34 // format & varags - The assert reason can be built using the format string and
37 // Applications must define this function; it is not defined by pw_assert_basic.
38 void pw_assert_basic_HandleFailure(const char* file_name,
40 const char* function_name,
43 PW_PRINTF_FORMAT(4, 5) PW_ASSERT_NORETURN;