• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2012 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // This file provides integration with Google-style "base/logging.h" assertions
6 // for Skia SkASSERT. If you don't want this, you can link with another file
7 // that provides integration with the logging of your choice.
8 
9 #include <stdarg.h>
10 #include <stdio.h>
11 
12 #include "third_party/skia/include/core/SkTypes.h"
13 
14 #if defined(SK_BUILD_FOR_WIN) && !defined(__clang__)
15 #include <stdlib.h>
16 #endif
17 
SkDebugf_FileLine(const char * file,int line,const char * format,...)18 void SkDebugf_FileLine(const char* file, int line, const char* format, ...) {
19   va_list ap;
20   va_start(ap, format);
21 
22   fprintf(stderr, "%s:%d ", file, line);
23   vfprintf(stderr, format, ap);
24   va_end(ap);
25 }
26 
27 #if defined(SK_BUILD_FOR_WIN) && !defined(__clang__)
28 
SkDebugf_FileLineOnly(const char * file,int line)29 void SkDebugf_FileLineOnly(const char* file, int line) {
30   fprintf(stderr, "%s:%d\n", file, line);
31 }
32 
SkAbort_FileLine(const char * file,int line,const char * format,...)33 void SkAbort_FileLine(const char* file, int line, const char* format, ...) {
34   va_list ap;
35   va_start(ap, format);
36 
37   fprintf(stderr, "%s:%d ", file, line);
38   vfprintf(stderr, format, ap);
39   va_end(ap);
40 
41   sk_abort_no_print();
42   // Extra safety abort().
43   abort();
44 }
45 
46 #endif  // defined(SK_BUILD_FOR_WIN) && !defined(__clang__)
47