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

ivmai / bdwgc / 1485

17 Apr 2023 05:30PM UTC coverage: 76.519% (+0.02%) from 76.502%
1485

push

travis-ci-com

ivmai
Prevent 'function should return a value' BCC error in CMake script

* CMakeLists.txt [enable_werror && BORLAND && enable_threads]: Pass
"/w-rvl" to add_compile_options; add comment.

7772 of 10157 relevant lines covered (76.52%)

8798128.86 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/gc.h"
35

36
#include <new> // for std, bad_alloc; precedes include of gc_cpp.h
37

38
#include "gc/gc_cpp.h"
39

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

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

49
# ifndef GC_NEW_DELETE_NEED_THROW
50
#   define GC_DECL_NEW_THROW /* empty */
51
# elif __cplusplus >= 201703L || _MSVC_LANG >= 201703L
52
    // The "dynamic exception" syntax had been deprecated in C++11
53
    // and was removed in C++17.
54
#   define GC_DECL_NEW_THROW noexcept(false)
55
# else
56
#   define GC_DECL_NEW_THROW throw(std::bad_alloc)
57
# endif // GC_NEW_DELETE_NEED_THROW
58

59
  void* operator new(std::size_t size) GC_DECL_NEW_THROW {
×
60
    void* obj = GC_MALLOC_UNCOLLECTABLE(size);
×
61
    if (0 == obj)
×
62
      GC_ALLOCATOR_THROW_OR_ABORT();
×
63
    return obj;
×
64
  }
65

66
# ifdef _MSC_VER
67
    // This new operator is used by VC++ in case of Debug builds.
68
    void* operator new(std::size_t size, int /* nBlockUse */,
69
                       const char* szFileName, int nLine)
70
    {
71
#     ifdef GC_DEBUG
72
        void* obj = GC_debug_malloc_uncollectable(size, szFileName, nLine);
73
#     else
74
        void* obj = GC_MALLOC_UNCOLLECTABLE(size);
75
        (void)szFileName; (void)nLine;
76
#     endif
77
      if (0 == obj)
78
        GC_ALLOCATOR_THROW_OR_ABORT();
79
      return obj;
80
    }
81
# endif // _MSC_VER
82

83
  void operator delete(void* obj) GC_NOEXCEPT {
14,000✔
84
    GC_FREE(obj);
14,000✔
85
  }
14,000✔
86

87
# if defined(GC_OPERATOR_NEW_ARRAY) && !defined(CPPCHECK)
88
    void* operator new[](std::size_t size) GC_DECL_NEW_THROW {
14,000✔
89
      void* obj = GC_MALLOC_UNCOLLECTABLE(size);
14,000✔
90
      if (0 == obj)
14,000✔
91
        GC_ALLOCATOR_THROW_OR_ABORT();
×
92
      return obj;
14,000✔
93
    }
94

95
#   ifdef _MSC_VER
96
      // This new operator is used by VC++ 7+ in Debug builds.
97
      void* operator new[](std::size_t size, int nBlockUse,
98
                           const char* szFileName, int nLine)
99
      {
100
        return operator new(size, nBlockUse, szFileName, nLine);
101
      }
102
#   endif // _MSC_VER
103

104
    void operator delete[](void* obj) GC_NOEXCEPT {
14,000✔
105
      GC_FREE(obj);
14,000✔
106
    }
14,000✔
107
# endif // GC_OPERATOR_NEW_ARRAY
108

109
# if __cplusplus >= 201402L || _MSVC_LANG >= 201402L // C++14
110
    void operator delete(void* obj, std::size_t) GC_NOEXCEPT {
111
      GC_FREE(obj);
112
    }
113

114
#   if defined(GC_OPERATOR_NEW_ARRAY) && !defined(CPPCHECK)
115
      void operator delete[](void* obj, std::size_t) GC_NOEXCEPT {
116
        GC_FREE(obj);
117
      }
118
#   endif
119
# endif // C++14
120

121
#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

© 2025 Coveralls, Inc