this repo has no description
at trunk 34 lines 1.1 kB view raw
1// Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) 2#include "asserts.h" 3 4#include <cstdarg> 5#include <cstdio> 6 7#include "globals.h" 8#include "utils.h" 9 10void checkFailed(const char* file, int line, const char* func, const char* expr, 11 ...) { 12 std::fprintf(stderr, "%s:%d %s: %s: ", file, line, func, expr); 13 va_list args; 14 ::va_start(args, expr); 15 const char* fmt = va_arg(args, const char*); 16 std::vfprintf(stderr, fmt, args); 17 ::va_end(args); 18 std::fputc('\n', stderr); 19 py::Utils::printDebugInfoAndAbort(); 20} 21 22void checkIndexFailed(const char* file, int line, const char* func, word index, 23 word high) { 24 std::fprintf(stderr, "%s:%d %s: index out of range, %ld not in [0..%ld) : \n", 25 file, line, func, index, high); 26 py::Utils::printDebugInfoAndAbort(); 27} 28 29void checkBoundFailed(const char* file, int line, const char* func, word value, 30 word high) { 31 std::fprintf(stderr, "%s:%d %s: bounds violation, %ld not in [0..%ld] : \n", 32 file, line, func, value, high); 33 py::Utils::printDebugInfoAndAbort(); 34}