- add sources.
[platform/framework/web/crosswalk.git] / src / third_party / tcmalloc / vendor / src / tcmalloc.h
1 // Copyright (c) 2007, Google Inc.
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 //     * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 //     * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
13 // distribution.
14 //     * Neither the name of Google Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30 // ---
31 // Author: Craig Silverstein <opensource@google.com>
32 //
33 // Some obscure memory-allocation routines may not be declared on all
34 // systems.  In those cases, we'll just declare them ourselves.
35 // This file is meant to be used only internally, for unittests.
36
37 #include <config.h>
38
39 #ifndef _XOPEN_SOURCE
40 # define _XOPEN_SOURCE 600  // for posix_memalign
41 #endif
42 #include <stdlib.h>         // for posix_memalign
43 // FreeBSD has malloc.h, but complains if you use it
44 #if defined(HAVE_MALLOC_H) && !defined(__FreeBSD__)
45 #include <malloc.h>         // for memalign, valloc, pvalloc
46 #endif
47
48 // __THROW is defined in glibc systems.  It means, counter-intuitively,
49 // "This function will never throw an exception."  It's an optional
50 // optimization tool, but we may need to use it to match glibc prototypes.
51 #ifndef __THROW    // I guess we're not on a glibc system
52 # define __THROW   // __THROW is just an optimization, so ok to make it ""
53 #endif
54
55 #if !HAVE_CFREE_SYMBOL
56 extern "C" void cfree(void* ptr) __THROW;
57 #endif
58 #if !HAVE_POSIX_MEMALIGN_SYMBOL
59 extern "C" int posix_memalign(void** ptr, size_t align, size_t size) __THROW;
60 #endif
61 #if !HAVE_MEMALIGN_SYMBOL
62 extern "C" void* memalign(size_t __alignment, size_t __size) __THROW;
63 #endif
64 #if !HAVE_VALLOC_SYMBOL
65 extern "C" void* valloc(size_t __size) __THROW;
66 #endif
67 #if !HAVE_PVALLOC_SYMBOL
68 extern "C" void* pvalloc(size_t __size) __THROW;
69 #endif