• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ivmai / bdwgc / 1490

28 Apr 2023 10:30AM UTC coverage: 72.923% (+0.001%) from 72.922%
1490

push

travis-ci-com

ivmai
Fix missing extern C for __asan_default_options
(fix of commit 84b695d01)

Issue #206 (bdwgc).

* os_dep.c [ADDRESS_SANITIZER && (UNIX_LIKE || NEED_FIND_LIMIT
|| MPROTECT_VDB) && !CUSTOM_ASAN_DEF_OPTIONS] (__asan_default_options):
Add the declaration wrapped into EXTERN_C_BEGIN.

7231 of 9916 relevant lines covered (72.92%)

11031094.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

62.5
/gc_cpp.cc
1
/*
2
 * Copyright (c) 1994 by Xerox Corporation.  All rights reserved.
3
 *
4
 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
5
 * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
6
 *
7
 * Permission is hereby granted to use or copy this program
8
 * for any purpose,  provided the above notices are retained on all copies.
9
 * Permission to modify the code and to distribute modified code is granted,
10
 * provided the above notices are retained, and a notice that the code was
11
 * modified is included with the above copyright notice.
12
 */
13

14
/*************************************************************************
15
This implementation module for gc_cpp.h provides an implementation of
16
the global operators "new" and "delete" that calls the Boehm
17
allocator.  All objects allocated by this implementation will be
18
uncollectible but part of the root set of the collector.
19

20
You should ensure (using implementation-dependent techniques) that the
21
linker finds this module before the library that defines the default
22
built-in "new" and "delete".
23
**************************************************************************/
24

25
#ifdef HAVE_CONFIG_H
26
# include "config.h"
27
#endif
28

29
#ifndef GC_BUILD
30
# define GC_BUILD
31
#endif
32

33
#define GC_DONT_INCL_WINDOWS_H
34
#include "gc.h"
35

36
#ifndef GC_INCLUDE_NEW
37
# define GC_INCLUDE_NEW
38
#endif
39
#include "gc_cpp.h"
40

41
#if !(defined(_MSC_VER) || defined(__DMC__)) || defined(GC_NO_INLINE_STD_NEW)
42

43
#if defined(GC_NEW_ABORTS_ON_OOM) || defined(_LIBCPP_NO_EXCEPTIONS)
44
# define GC_ALLOCATOR_THROW_OR_ABORT() GC_abort_on_oom()
45
#else
46
// Use bad_alloc() directly instead of GC_throw_bad_alloc() call.
47
# define GC_ALLOCATOR_THROW_OR_ABORT() throw std::bad_alloc()
48
#endif
49

50
  void* operator new(size_t size) GC_DECL_NEW_THROW {
×
51
    void* obj = GC_MALLOC_UNCOLLECTABLE(size);
×
52
    if (0 == obj)
×
53
      GC_ALLOCATOR_THROW_OR_ABORT();
×
54
    return obj;
×
55
  }
56

57
# ifdef _MSC_VER
58
    // This new operator is used by VC++ in case of Debug builds.
59
    void* operator new(size_t size, int /* nBlockUse */,
60
                       const char* szFileName, int nLine)
61
    {
62
#     ifdef GC_DEBUG
63
        void* obj = GC_debug_malloc_uncollectable(size, szFileName, nLine);
64
#     else
65
        void* obj = GC_MALLOC_UNCOLLECTABLE(size);
66
        (void)szFileName; (void)nLine;
67
#     endif
68
      if (0 == obj)
69
        GC_ALLOCATOR_THROW_OR_ABORT();
70
      return obj;
71
    }
72
# endif // _MSC_VER
73

74
  void operator delete(void* obj) GC_NOEXCEPT {
20,000✔
75
    GC_FREE(obj);
20,000✔
76
  }
20,000✔
77

78
# if defined(GC_OPERATOR_NEW_ARRAY) && !defined(CPPCHECK)
79
    void* operator new[](size_t size) GC_DECL_NEW_THROW {
20,000✔
80
      void* obj = GC_MALLOC_UNCOLLECTABLE(size);
20,000✔
81
      if (0 == obj)
20,000✔
82
        GC_ALLOCATOR_THROW_OR_ABORT();
×
83
      return obj;
20,000✔
84
    }
85

86
#   ifdef _MSC_VER
87
      // This new operator is used by VC++ 7+ in Debug builds.
88
      void* operator new[](size_t size, int nBlockUse,
89
                           const char* szFileName, int nLine)
90
      {
91
        return operator new(size, nBlockUse, szFileName, nLine);
92
      }
93
#   endif // _MSC_VER
94

95
    void operator delete[](void* obj) GC_NOEXCEPT {
20,000✔
96
      GC_FREE(obj);
20,000✔
97
    }
20,000✔
98
# endif // GC_OPERATOR_NEW_ARRAY
99

100
# if __cplusplus >= 201402L || _MSVC_LANG >= 201402L // C++14
101
    void operator delete(void* obj, size_t size) GC_NOEXCEPT {
102
      (void)size; // size is ignored
103
      GC_FREE(obj);
104
    }
105

106
#   if defined(GC_OPERATOR_NEW_ARRAY) && !defined(CPPCHECK)
107
      void operator delete[](void* obj, size_t size) GC_NOEXCEPT {
108
        (void)size;
109
        GC_FREE(obj);
110
      }
111
#   endif
112
# endif // C++14
113

114
#endif // !_MSC_VER && !__DMC__ || GC_NO_INLINE_STD_NEW
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc