v8/test
Nico Weber 58b386c4de Make v8 build with -Wmicrosoft-cast under clang-cl.
gcc and clang (and the standard) don't allow implicit conversion of
function pointers to object pointers. MSVC does allow that, and since
system headers require this to work, clang-cl allows it too -- but
it emits a -Wmicrosoft-cast warning (which we currently suppress in
the Chromium build, but which we want to enable.)

As a side effect, when printing a function pointer to a stream, MSVC
(and clang-cl) will pick the operator<<(void*) overload, while gcc
and clang will pick operator<<(bool) since the best allowed conversion
they find is from function pointer to bool.

To prevent the clang-cl warning, we need to make sure that we never
directly print a function pointer to a stream. In v8, this requires
two changes:

1. Give PrintCheckOperand() an explicit specialization for function
   pointers and explicitly cast to void* there.  This ports
   https://codereview.chromium.org/2515283002/ to V8, and also fixes a
   bug on non-Windows where DCHECK() of function pointers would print
   "(1 vs 1)" instead of the function's addresses.
   (The bug remains with member function pointers,
   where it's not clear what to print instead of the 1.)

2. has_output_operator<T> must not use operator<< on its argument
   in an evaluated context if T is a function pointer.  This patch
   modifies has_output_operator<> to use an unevaluated context instead,
   which is simpler than the current approach (and matches what Chromium's
   base does), but changes behavior    in minor (boring) ways
   (see template-utils-unittest.cc), since operator<<() is now
   called with a temporary and only operator<<() implementations callable
   with a temporary are considered.
   A more complicated but behavior-preserving alternative would be to
   add an explicit specialization for function pointers. You can see
   this variant in patch set 1 on gerrit.

Bug: chromium:550065
Change-Id: Idc2854d6c258b7fc0b959604006d8952a79eca3d
Reviewed-on: https://chromium-review.googlesource.com/940004
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51636}
2018-02-28 18:06:57 +00:00
..
benchmarks [test] Forgive tests timing out on num-fuzzers 2018-02-08 23:08:05 +00:00
cctest [heap] Move FreeListCategory memory out of the page header. 2018-02-27 15:39:04 +00:00
common [wasm] Add remaining saturating conversions 2018-02-07 19:45:39 +00:00
debugger [debug] remove ScriptBreakPointType from debug test api wrapper. 2018-02-26 11:34:40 +00:00
fuzzer [cleanup] Deprecate EnsureEventLoopInitialized 2018-02-28 15:32:28 +00:00
inspector Reland: [Compiler] Use CompilationCache for StreamedScript compilation. 2018-02-27 15:41:14 +00:00
intl [test] Remove context usage from test processors 2018-02-01 10:35:02 +00:00
js-perf-test [js-perf-tests] Add substring perf tests 2018-02-28 13:03:57 +00:00
memory [snapshot] add tracking for builtin snapshot size. 2017-08-31 07:29:31 +00:00
message [esnext] Remove always-disabled support for function.sent 2018-02-26 20:01:41 +00:00
mjsunit [wasm] Fix prototype property of exported functions 2018-02-28 09:14:57 +00:00
mkgrokdump [test] Remove context usage from test processors 2018-02-01 10:35:02 +00:00
mozilla [test] Remove context usage from test processors 2018-02-01 10:35:02 +00:00
preparser [test] Remove dead code from suites and tests 2018-02-01 14:12:49 +00:00
test262 [test262] Test262 Roll 2018-02-22 22:31:50 +00:00
unittests Make v8 build with -Wmicrosoft-cast under clang-cl. 2018-02-28 18:06:57 +00:00
wasm-spec-tests [wasm] Update spec tests 2018-02-28 13:22:37 +00:00
webkit Revert "[builtins] Mega-revert to address the Dev blocker in crbug.com/808911." 2018-02-08 17:25:13 +00:00
bot_default.isolate [wasm] Add wasm spec tests to the v8 test runner 2017-04-27 13:00:13 +00:00
BUILD.gn [test] Add a d8_default test suite collection 2018-01-12 15:18:04 +00:00
d8_default.isolate [test] Add a d8_default test suite collection 2018-01-12 15:18:04 +00:00
default.isolate [wasm] Add wasm spec tests to the v8 test runner 2017-04-27 13:00:13 +00:00
optimize_for_size.isolate [debugger] basic test infrastructure for new debugger test api. 2016-10-21 06:38:05 +00:00
perf.isolate Reland "Reland "[test] Creating command before execution phase."" 2017-12-04 13:40:29 +00:00