Bug 195604 - WTF::Expected should use std::addressof instead of operator&
Summary: WTF::Expected should use std::addressof instead of operator&
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-03-11 21:27 PDT by Alex Christensen
Modified: 2019-03-12 09:34 PDT (History)
9 users (show)

See Also:


Attachments
Patch (5.50 KB, patch)
2019-03-11 21:30 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (5.49 KB, patch)
2019-03-11 22:26 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2019-03-11 21:27:28 PDT
WTF::Expected should use std::addressof instead of operator&
Comment 1 Alex Christensen 2019-03-11 21:30:13 PDT
Created attachment 364350 [details]
Patch
Comment 2 EWS Watchlist 2019-03-11 21:34:32 PDT
Attachment 364350 [details] did not pass style-queue:


ERROR: Source/WTF/wtf/Expected.h:346:  Use 'WTFMove()' instead of 'std::move()'.  [runtime/wtf_move] [4]
ERROR: Source/WTF/wtf/Expected.h:348:  Use 'WTFMove()' instead of 'std::move()'.  [runtime/wtf_move] [4]
ERROR: Source/WTF/wtf/Expected.h:396:  Use 'WTFMove()' instead of 'std::move()'.  [runtime/wtf_move] [4]
ERROR: Source/WTF/wtf/Expected.h:465:  Use 'WTFMove()' instead of 'std::move()'.  [runtime/wtf_move] [4]
ERROR: Source/WTF/wtf/Expected.h:467:  Use 'WTFMove()' instead of 'std::move()'.  [runtime/wtf_move] [4]
ERROR: Source/WTF/wtf/Expected.h:472:  Use 'WTFMove()' instead of 'std::move()'.  [runtime/wtf_move] [4]
ERROR: Source/WTF/wtf/Expected.h:474:  Use 'WTFMove()' instead of 'std::move()'.  [runtime/wtf_move] [4]
ERROR: Source/WTF/wtf/Expected.h:543:  Use 'WTFMove()' instead of 'std::move()'.  [runtime/wtf_move] [4]
Total errors found: 8 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 WebKit Commit Bot 2019-03-11 22:16:07 PDT
Comment on attachment 364350 [details]
Patch

Rejecting attachment 364350 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'build', '--no-clean', '--no-update', '--build-style=release', '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 5000 characters of output:
o-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 -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DNDEBUG -DENABLE_3D_TRANSFORMS -DENABLE_APPLE_PAY -DENABLE_APPLE_PAY_SESSION_V3 -DENABLE_APPLICATION_MANIFEST -DENABLE_ATTACHMENT_ELEMENT -DENABLE_AVF_CAPTIONS -DENABLE_CACHE_PARTITIONING -DENABLE_CHANNEL_MESSAGING -DENABLE_CONTENT_FILTERING -DENABLE_CSS_BOX_DECORATION_BREAK -DENABLE_CSS_COMPOSITING -DENABLE_CSS_PAINTING_API -DENABLE_CSS_SCROLL_SNAP -DENABLE_CSS_SELECTORS_LEVEL4 -DENABLE_CSS_TRAILING_WORD -DENABLE_CSS_TYPED_OM -DENABLE_CURSOR_VISIBILITY -DENABLE_DARK_MODE_CSS -DENABLE_DASHBOARD_SUPPORT -DENABLE_DATACUE_VALUE -DENABLE_DATALIST_ELEMENT -DENABLE_EXPERIMENTAL_FEATURES -DENABLE_FILTERS_LEVEL_2 -DENABLE_FTL_JIT -DENABLE_FULLSCREEN_API -DENABLE_GAMEPAD -DENABLE_GEOLOCATION -DENABLE_ICONDATABASE -DENABLE_INDEXED_DATABASE -DENABLE_INDEXED_DATABASE_IN_WORKERS -DENABLE_INPUT_TYPE_COLOR -DENABLE_INTERSECTION_OBSERVER -DENABLE_INTL -DENABLE_KEYBOARD_CODE_ATTRIBUTE -DENABLE_KEYBOARD_KEY_ATTRIBUTE -DENABLE_LAYOUT_FORMATTING_CONTEXT -DENABLE_LEGACY_CSS_VENDOR_PREFIXES -DENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER -DENABLE_LEGACY_ENCRYPTED_MEDIA -DENABLE_MATHML -DENABLE_MEDIA_CONTROLS_SCRIPT -DENABLE_MEDIA_SOURCE -DENABLE_MEDIA_STREAM -DENABLE_METER_ELEMENT -DENABLE_MOUSE_CURSOR_SCALE -DENABLE_NOTIFICATIONS -DENABLE_PAYMENT_REQUEST -DENABLE_PDFKIT_PLUGIN -DENABLE_POINTER_EVENTS -DENABLE_POINTER_LOCK -DENABLE_PUBLIC_SUFFIX_LIST -DENABLE_REMOTE_INSPECTOR -DENABLE_RESOURCE_LOAD_STATISTICS -DENABLE_RESOURCE_USAGE -DENABLE_RUBBER_BANDING -DENABLE_SERVICE_CONTROLS -DENABLE_SERVICE_WORKER -DENABLE_SPEECH_SYNTHESIS -DENABLE_STREAMS_API -DENABLE_WEB_CRYPTO -DENABLE_SVG_FONTS -DENABLE_TELEPHONE_NUMBER_DETECTION -DENABLE_TEXT_AUTOSIZING -DENABLE_USER_MESSAGE_HANDLERS -DENABLE_USERSELECT_ALL -DENABLE_VARIATION_FONTS -DENABLE_VIDEO -DENABLE_VIDEO_PRESENTATION_MODE -DENABLE_VIDEO_TRACK -DENABLE_VIDEO_USES_ELEMENT_FULLSCREEN -DENABLE_WEB_AUDIO -DENABLE_WEB_AUTHN -DENABLE_WEB_RTC -DENABLE_WEBGL -DENABLE_WEBGL2 -DENABLE_WEBGPU -DENABLE_WEBMETAL -DENABLE_WIRELESS_PLAYBACK_TARGET -DENABLE_XSLT -DU_DISABLE_RENAMING=1 -DU_SHOW_CPLUSPLUS_API=0 -DENABLE_DASHBOARD_SUPPORT -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -fasm-blocks -fstrict-aliasing -Wno-deprecated-declarations -Winvalid-offsetof -mmacosx-version-min=10.13 -g -fvisibility=hidden -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -I/Volumes/Data/EWS/WebKit/WebKitBuild/TestWebKitAPI.build/Release/TestWTFLibrary.build/TestWTF.hmap -I/Volumes/Data/EWS/WebKit/WebKitBuild/Release/include -I/Volumes/Data/EWS/WebKit/WebKitBuild/Release/usr/local/include -I/Volumes/Data/EWS/WebKit/WebKitBuild/Release/WebCore.framework/PrivateHeaders/ForwardingHeaders -I/Volumes/Data/EWS/WebKit/WebKitBuild/Release/WebCoreTestSupport -I/Volumes/Data/EWS/WebKit/WebKitBuild/TestWebKitAPI.build/Release/TestWTFLibrary.build/DerivedSources/x86_64 -I/Volumes/Data/EWS/WebKit/WebKitBuild/TestWebKitAPI.build/Release/TestWTFLibrary.build/DerivedSources -Wall -W -Wno-unused-parameter -F/Volumes/Data/EWS/WebKit/WebKitBuild/Release --system-header-prefix=WebKit/ -iframework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/PrivateFrameworks -ftemplate-depth=256 -MMD -MT dependencies -MF /Volumes/Data/EWS/WebKit/WebKitBuild/TestWebKitAPI.build/Release/TestWTFLibrary.build/Objects-normal/x86_64/Markable.d --serialize-diagnostics /Volumes/Data/EWS/WebKit/WebKitBuild/TestWebKitAPI.build/Release/TestWTFLibrary.build/Objects-normal/x86_64/Markable.dia -c /Volumes/Data/EWS/WebKit/Tools/TestWebKitAPI/Tests/WTF/Markable.cpp -o /Volumes/Data/EWS/WebKit/WebKitBuild/TestWebKitAPI.build/Release/TestWTFLibrary.build/Objects-normal/x86_64/Markable.o

** BUILD FAILED **


The following build commands failed:
	CompileC /Volumes/Data/EWS/WebKit/WebKitBuild/TestWebKitAPI.build/Release/TestWTFLibrary.build/Objects-normal/x86_64/Expected.o Tests/WTF/Expected.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Failed to run "['Tools/Scripts/build-webkit', '--release']" exit_code: 65
x86_64/Markable.o

** BUILD FAILED **


The following build commands failed:
	CompileC /Volumes/Data/EWS/WebKit/WebKitBuild/TestWebKitAPI.build/Release/TestWTFLibrary.build/Objects-normal/x86_64/Expected.o Tests/WTF/Expected.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Full output: https://webkit-queues.webkit.org/results/11467762
Comment 4 Myles C. Maxfield 2019-03-11 22:20:29 PDT
Comment on attachment 364350 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=364350&action=review

> Tools/TestWebKitAPI/Tests/WTF/Expected.cpp:483
> +    std::NeedsStdAddress_ptr<int> m_ref;

Shouldn't this be int*?

> Tools/TestWebKitAPI/Tests/WTF/Expected.cpp:488
> +    NeedsStdAddress a(*new int(3));

Doesn't this leak an int?
Comment 5 Alex Christensen 2019-03-11 22:22:57 PDT
(In reply to Myles C. Maxfield from comment #4)
> Comment on attachment 364350 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=364350&action=review
> 
> > Tools/TestWebKitAPI/Tests/WTF/Expected.cpp:483
> > +    std::NeedsStdAddress_ptr<int> m_ref;
> 
> Shouldn't this be int*?
This should be std::unique_ptr<int>. This was me getting over eager with copying and pasting from an earlier version of the test.
Comment 6 Alex Christensen 2019-03-11 22:26:41 PDT
Created attachment 364353 [details]
Patch
Comment 7 WebKit Commit Bot 2019-03-11 23:04:28 PDT
Comment on attachment 364353 [details]
Patch

Clearing flags on attachment: 364353

Committed r242778: <https://trac.webkit.org/changeset/242778>
Comment 8 WebKit Commit Bot 2019-03-11 23:04:30 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2019-03-11 23:32:40 PDT
<rdar://problem/48799379>
Comment 10 JF Bastien 2019-03-12 09:34:25 PDT
Thanks for fixing this, looks great.