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