REOPENED 124186
WTF, JavaScriptCore fails to build with trunk clang: operators new, new[], delete, delete[] cannot be declared inline
https://bugs.webkit.org/show_bug.cgi?id=124186
Summary WTF, JavaScriptCore fails to build with trunk clang: operators new, new[], de...
David Farler
Reported 2013-11-11 22:26:18 PST
CompileC /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/JavaScriptCore.build/Debug/JSCLLIntOffsetsExtractor.build/Objects-normal/x86_64/LLIntOffsetsExtractor.o llint/LLIntOffsetsExtractor.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler cd /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/Source/JavaScriptCore /Volumes/Data/BuildSlave/build-asan-webkit/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/clang -x c++ -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu++11 -stdlib=libc++ -Wno-trigraphs -fno-exceptions -fno-rtti -fpascal-strings -O0 -Wno-missing-field-initializers -Wmissing-prototypes -Wnon-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wsign-compare -Wno-shorten-64-to-32 -Wnewline-eof -Wno-c++11-extensions -DHAVE_DTRACE=1 -DWEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST -DHAVE_HEADER_DETECTION_H -DJSC_OBJC_API_AVAILABLE_MAC_OS_X_1080 -DENABLE_3D_RENDERING -DENABLE_BLOB -DENABLE_CACHE_PARTITIONING -DENABLE_CANVAS_PATH -DENABLE_CHANNEL_MESSAGING -DENABLE_CSS_BOX_DECORATION_BREAK -DENABLE_CSS_COMPOSITING -DENABLE_CSS_EXCLUSIONS -DENABLE_CSS_FILTERS -DENABLE_CSS_REGIONS -DENABLE_CSS_SHADERS -DENABLE_CSS_SHAPES -DENABLE_CSS_STICKY_POSITION -DENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED -DENABLE_CSS3_TEXT_DECORATION -DENABLE_CURSOR_VISIBILITY -DENABLE_DASHBOARD_SUPPORT -DENABLE_DETAILS_ELEMENT -DENABLE_DOM4_EVENTS_CONSTRUCTOR -DENABLE_ENCRYPTED_MEDIA -DENABLE_ENCRYPTED_MEDIA_V2 -DENABLE_FILTERS -DENABLE_FULLSCREEN_API -DENABLE_GEOLOCATION -DENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING -DENABLE_ICONDATABASE -DENABLE_IFRAME_SEAMLESS -DENABLE_INDEXED_DATABASE -DENABLE_INDIE_UI -DENABLE_INPUT_TYPE_COLOR -DENABLE_INPUT_TYPE_COLOR_POPOVER -DENABLE_JAVASCRIPT_DEBUGGER -DENABLE_LEGACY_CSS_VENDOR_PREFIXES -DENABLE_LEGACY_NOTIFICATIONS -DENABLE_LEGACY_VENDOR_PREFIXES -DENABLE_LEGACY_WEB_AUDIO -DENABLE_MATHML -DENABLE_MEDIA_CONTROLS_SCRIPT -DENABLE_METER_ELEMENT -DENABLE_MOUSE_CURSOR_SCALE -DENABLE_NOTIFICATIONS -DENABLE_PAGE_VISIBILITY_API -DENABLE_PDFKIT_PLUGIN -DENABLE_PROGRESS_ELEMENT -DENABLE_PROMISES -DENABLE_PUBLIC_SUFFIX_LIST -DENABLE_REQUEST_ANIMATION_FRAME -DENABLE_REMOTE_INSPECTOR -DENABLE_SHARED_WORKERS -DENABLE_SPEECH_SYNTHESIS -DENABLE_SQL_DATABASE -DENABLE_SUBTLE_CRYPTO -DENABLE_SVG -DENABLE_SVG_FONTS -DENABLE_USERSELECT_ALL -DENABLE_VIDEO -DENABLE_VIDEO_TRACK -DENABLE_WEBGL -DENABLE_WEB_ANIMATIONS -DENABLE_WEB_AUDIO -DENABLE_WEB_SOCKETS -DENABLE_WORKERS -DENABLE_XHR_TIMEOUT -DENABLE_XSLT -isysroot /Volumes/Data/BuildSlave/build-asan-webkit/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.Internal.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -mmacosx-version-min=10.9 -g -fvisibility=hidden -fvisibility-inlines-hidden -fno-threadsafe-statics -Wno-sign-conversion -I/Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/JavaScriptCore.build/Debug/JSCLLIntOffsetsExtractor.build/JSCLLIntOffsetsExtractor.hmap -I/Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/include -I. -Iicu -I/Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include -I/Volumes/Data/BuildSlave/build-asan-webkit/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/JavaScriptCore.build/Debug/JSCLLIntOffsetsExtractor.build/DerivedSources/x86_64 -I/Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/JavaScriptCore.build/Debug/JSCLLIntOffsetsExtractor.build/DerivedSources -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -F/Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug -MMD -MT dependencies -MF /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/JavaScriptCore.build/Debug/JSCLLIntOffsetsExtractor.build/Objects-normal/x86_64/LLIntOffsetsExtractor.d --serialize-diagnostics /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/JavaScriptCore.build/Debug/JSCLLIntOffsetsExtractor.build/Objects-normal/x86_64/LLIntOffsetsExtractor.dia -c /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp -o /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/JavaScriptCore.build/Debug/JSCLLIntOffsetsExtractor.build/Objects-normal/x86_64/LLIntOffsetsExtractor.o In file included from /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp:26: In file included from /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/Source/JavaScriptCore/config.h:60: /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:266:1: error: replacement function 'operator new' cannot be declared 'inline' WTF_PRIVATE_INLINE void* operator new(size_t size) throw (std::bad_alloc) { return fastMalloc(size); } ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:242:47: note: expanded from macro 'WTF_PRIVATE_INLINE' #define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline)) ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:267:1: error: replacement function 'operator new' cannot be declared 'inline' WTF_PRIVATE_INLINE void* operator new(size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); } ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:242:47: note: expanded from macro 'WTF_PRIVATE_INLINE' #define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline)) ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:268:1: error: replacement function 'operator delete' cannot be declared 'inline' WTF_PRIVATE_INLINE void operator delete(void* p) throw() { fastFree(p); } ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:242:47: note: expanded from macro 'WTF_PRIVATE_INLINE' #define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline)) ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:269:1: error: replacement function 'operator delete' cannot be declared 'inline' WTF_PRIVATE_INLINE void operator delete(void* p, const std::nothrow_t&) throw() { fastFree(p); } ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:242:47: note: expanded from macro 'WTF_PRIVATE_INLINE' #define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline)) ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:270:1: error: replacement function 'operator new[]' cannot be declared 'inline' WTF_PRIVATE_INLINE void* operator new[](size_t size) throw (std::bad_alloc) { return fastMalloc(size); } ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:242:47: note: expanded from macro 'WTF_PRIVATE_INLINE' #define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline)) ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:271:1: error: replacement function 'operator new[]' cannot be declared 'inline' WTF_PRIVATE_INLINE void* operator new[](size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); } ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:242:47: note: expanded from macro 'WTF_PRIVATE_INLINE' #define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline)) ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:272:1: error: replacement function 'operator delete[]' cannot be declared 'inline' WTF_PRIVATE_INLINE void operator delete[](void* p) throw() { fastFree(p); } ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:242:47: note: expanded from macro 'WTF_PRIVATE_INLINE' #define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline)) ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:273:1: error: replacement function 'operator delete[]' cannot be declared 'inline' WTF_PRIVATE_INLINE void operator delete[](void* p, const std::nothrow_t&) throw() { fastFree(p); } ^ /Volumes/Data/BuildSlave/build-asan-webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/FastMalloc.h:242:47: note: expanded from macro 'WTF_PRIVATE_INLINE' #define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline)) ^ 8 errors generated.
Attachments
Workaround (2.32 KB, patch)
2013-12-18 10:37 PST, Daniel Bates
no flags
Workaround (2.33 KB, patch)
2013-12-18 10:42 PST, Daniel Bates
no flags
For EWS: Workaround (3.24 KB, patch)
2013-12-18 11:28 PST, Daniel Bates
no flags
Anders Carlsson
Comment 1 2013-11-12 07:13:02 PST
Yup. What we do is violating the C++ spec :(
Geoffrey Garen
Comment 2 2013-11-12 11:23:25 PST
Will these overrides still work if we declare them out-of-line? NOTE: In the short term, un-inlining these functions will cause us to crash on launch, due to bugs in other components, which are masked by our current strategy. Stephanie knows the details.
Anders Carlsson
Comment 3 2013-11-12 11:30:03 PST
(In reply to comment #2) > Will these overrides still work if we declare them out-of-line? If we declare them out of line they will replace the global operators everywhere. > NOTE: In the short term, un-inlining these functions will cause us to crash on launch, due to bugs in other components, which are masked by our current strategy. Stephanie knows the details. I’d love to hear the details. Stephanie?
David Farler
Comment 4 2013-11-12 13:51:32 PST
ddkilzer mentioned that this file isn't building with USE_SYSTEM_MALLOC=1. The reason for that is that this particular target doesn't build with ASAN since it's an intermediate tool for building. I'm going to try building with USE_SYSTEM_MALLOC=1 at least for all targets regardless of building with ASAN and see if I can work around this.
David Farler
Comment 5 2013-11-14 09:21:15 PST
I’ll be able to work around this for now with https://bugs.webkit.org/show_bug.cgi?id=124362 but anything using FastMalloc will run into this problem.
Daniel Bates
Comment 6 2013-12-18 10:32:43 PST
I ran into this issue when building WTF with trunk clang as of 12/16/2013.
Daniel Bates
Comment 7 2013-12-18 10:37:13 PST
Created attachment 219547 [details] Workaround
Daniel Bates
Comment 8 2013-12-18 10:38:35 PST
Comment on attachment 219547 [details] Workaround As a workaround, disable the inline new, delete warnings. Ideally, we should fix our violation of the C++ standard.
Daniel Bates
Comment 9 2013-12-18 10:40:51 PST
For completeness, the LLVM warnings were implemented in <http://llvm.org/bugs/show_bug.cgi?id=17591>.
Daniel Bates
Comment 10 2013-12-18 10:42:45 PST
Created attachment 219548 [details] Workaround
Geoffrey Garen
Comment 11 2013-12-18 10:44:10 PST
Comment on attachment 219547 [details] Workaround r=me Do we need a follow-up bug to figure out what we should do instead? Do we know what we should do instead? What are the consequences of continuing to inline new/delete, even though C++ says we can't?
David Farler
Comment 12 2013-12-18 10:46:58 PST
(In reply to comment #11) > (From update of attachment 219547 [details]) > r=me > > Do we need a follow-up bug to figure out what we should do instead? Do we know what we should do instead? > > What are the consequences of continuing to inline new/delete, even though C++ says we can't? I believe it has to do with the number of matching compiled allocation / freeing of memory with optimizations. There is an example in the bugzilla: http://llvm.org/bugs/show_bug.cgi?id=17591
Daniel Bates
Comment 13 2013-12-18 11:16:35 PST
(In reply to comment #11) > (From update of attachment 219547 [details]) > r=me > > Do we need a follow-up bug to figure out what we should do instead? Unless you prefer a new bug, I'll keep this bug open after I land the patch so that we can use it to follow up on this issue. Notice that I reference this bug in the FIXME comment in the patch. > Do we know what we should do instead? At this time, I don't have a good solution. From talking with Anders Carlson, one solution is to sprinkle more WTF_MAKE_FAST_ALLOCATED in the code. Alternatively, we can un-inline the operator new, delete functions assuming we resolve the issues you mentioned in your note in comment 2.
Build Bot
Comment 14 2013-12-18 11:18:04 PST
Comment on attachment 219548 [details] Workaround Attachment 219548 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/50548030
Daniel Bates
Comment 15 2013-12-18 11:28:23 PST
Created attachment 219553 [details] For EWS: Workaround
Daniel Bates
Comment 16 2013-12-19 09:46:50 PST
Daniel Bates
Comment 17 2013-12-21 12:42:13 PST
Re-opening this bug so that we can follow up with the appropriate fix. Let me know if it's preferred to file a new bug.
Csaba Osztrogonác
Comment 18 2014-02-13 04:15:14 PST
Comment on attachment 219548 [details] Workaround Cleared Geoffrey Garen's review+ from obsolete attachment 219548 [details] so that this bug does not appear in http://webkit.org/pending-commit.
Blaze Burg
Comment 19 2016-08-01 10:42:48 PDT
Is this bug still relevant? If so, please fix the title.
Note You need to log in before you can comment on or make changes to this bug.