Bug 167800 - malloc and posix_memalign used without including cstdlib
Summary: malloc and posix_memalign used without including cstdlib
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: bmalloc (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Other
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-03 10:15 PST by Ting-Wei Lan
Modified: 2017-02-03 14:00 PST (History)
2 users (show)

See Also:


Attachments
mmm (1.04 KB, patch)
2017-02-03 10:18 PST, Ting-Wei Lan
no flags Details | Formatted Diff | Diff
Patch (1.04 KB, patch)
2017-02-03 10:19 PST, Ting-Wei Lan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ting-Wei Lan 2017-02-03 10:15:59 PST
This causes compilation error on FreeBSD:

/path/to/WebKit/Source/bmalloc/bmalloc/DebugHeap.cpp:78:20: error: no member named 'malloc' in the global namespace; did you mean simply 'malloc'?
    void* result = ::malloc(size);
                   ^~~~~~~~
                   malloc
/path/to/WebKit/Source/bmalloc/bmalloc/DebugHeap.cpp:76:18: note: 'malloc' declared here
void* DebugHeap::malloc(size_t size)
                 ^
/path/to/WebKit/Source/bmalloc/bmalloc/DebugHeap.cpp:87:9: error: use of undeclared identifier 'posix_memalign'
    if (posix_memalign(&result, alignment, size)) {
        ^
/path/to/WebKit/Source/bmalloc/bmalloc/DebugHeap.cpp:97:20: error: no member named 'realloc' in the global namespace; did you mean simply 'realloc'?
    void* result = ::realloc(object, size);
                   ^~~~~~~~~
                   realloc
/path/to/WebKit/Source/bmalloc/bmalloc/DebugHeap.cpp:95:18: note: 'realloc' declared here
void* DebugHeap::realloc(void* object, size_t size)
                 ^
/path/to/WebKit/Source/bmalloc/bmalloc/DebugHeap.cpp:105:7: error: no type named 'free' in the global namespace
    ::free(object);
    ~~^
/path/to/WebKit/Source/bmalloc/bmalloc/DebugHeap.cpp:103:28: warning: unused parameter 'object' [-Wunused-parameter]
void DebugHeap::free(void* object)
                           ^
1 warning and 4 errors generated.
Comment 1 Ting-Wei Lan 2017-02-03 10:18:34 PST
Created attachment 300543 [details]
mmm
Comment 2 Ting-Wei Lan 2017-02-03 10:19:25 PST
Created attachment 300544 [details]
Patch
Comment 3 Geoffrey Garen 2017-02-03 13:48:39 PST
Comment on attachment 300544 [details]
Patch

r=me
Comment 4 WebKit Commit Bot 2017-02-03 14:00:35 PST
Comment on attachment 300544 [details]
Patch

Clearing flags on attachment: 300544

Committed r211651: <http://trac.webkit.org/changeset/211651>
Comment 5 WebKit Commit Bot 2017-02-03 14:00:39 PST
All reviewed patches have been landed.  Closing bug.