Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Issue 650393002: Modify ALLOW_UNUSED to allow enabling unused local warnings on MSVC. (Closed)

Created:
6 years, 2 months ago by Peter Kasting
Modified:
6 years, 1 month ago
CC:
chromium-reviews, mkwst+moarreviews-ipc_chromium.org, darin-cc_chromium.org, cc-bugs_chromium.org, erikwright+watch_chromium.org, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Modify ALLOW_UNUSED to allow enabling unused local warnings on MSVC. This splits the macro into two: int a = 1; ALLOW_UNUSED_LOCAL(a); and typedef Foo Bar ALLOW_UNUSED_TYPE; void foo() ALLOW_UNUSED_TYPE; // ALLOW_UNUSED_TYPE_OR_FUNC seemed too verbose This matches changes that have already been made in Blink. BUG=81439 TEST=none TBR=ben Committed: https://crrev.com/99867ef78bf14ad37e263860248d0a2d61b51a73 Cr-Commit-Position: refs/heads/master@{#300014}

Patch Set 1 #

Patch Set 2 : Remove extraneous use #

Total comments: 2

Patch Set 3 : Review comments #

Patch Set 4 : Try removing the attribute entirely #

Patch Set 5 : Revert review comment #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+36 lines, -23 lines) Patch
M base/compiler_specific.h View 1 2 1 chunk +9 lines, -3 lines 2 comments Download
M base/logging_unittest.cc View 3 4 1 chunk +2 lines, -1 line 0 comments Download
M base/mac/foundation_util_unittest.mm View 1 chunk +4 lines, -4 lines 0 comments Download
M base/tuple_unittest.cc View 1 chunk +2 lines, -1 line 0 comments Download
M cc/quads/draw_quad_unittest.cc View 2 chunks +8 lines, -4 lines 0 comments Download
M ipc/ipc_message_macros.h View 2 chunks +6 lines, -6 lines 0 comments Download
M ppapi/proxy/dispatch_reply_message.h View 1 chunk +1 line, -1 line 0 comments Download
M ui/gl/generate_bindings.py View 1 2 1 chunk +4 lines, -3 lines 0 comments Download

Messages

Total messages: 25 (8 generated)
Peter Kasting
6 years, 2 months ago (2014-10-14 00:15:37 UTC) #2
Peter Kasting
ping beng
6 years, 2 months ago (2014-10-16 01:03:46 UTC) #3
danakj
LGTM https://codereview.chromium.org/650393002/diff/20001/base/logging_unittest.cc File base/logging_unittest.cc (right): https://codereview.chromium.org/650393002/diff/20001/base/logging_unittest.cc#newcode243 base/logging_unittest.cc:243: ALLOW_UNUSED_TYPE std::ostream& operator<<(std::ostream& out, nit: can you put ...
6 years, 2 months ago (2014-10-16 15:27:06 UTC) #5
danakj
On 2014/10/16 15:27:06, danakj wrote: > LGTM (for base/ and cc/)
6 years, 2 months ago (2014-10-16 15:27:53 UTC) #6
Peter Kasting
Moving Ben to TBR for the remaining couple of files. https://codereview.chromium.org/650393002/diff/20001/base/logging_unittest.cc File base/logging_unittest.cc (right): https://codereview.chromium.org/650393002/diff/20001/base/logging_unittest.cc#newcode243 ...
6 years, 2 months ago (2014-10-16 17:39:06 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/650393002/40001
6 years, 2 months ago (2014-10-16 17:40:13 UTC) #9
commit-bot: I haz the power
Try jobs failed on following builders: android_chromium_gn_compile_dbg on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_chromium_gn_compile_dbg/builds/8359)
6 years, 2 months ago (2014-10-16 17:53:25 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/650393002/60001
6 years, 2 months ago (2014-10-16 19:39:21 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: android_chromium_gn_compile_dbg on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_chromium_gn_compile_dbg/builds/8403)
6 years, 2 months ago (2014-10-16 19:53:03 UTC) #15
Peter Kasting
So apparently I can't move the ALLOW_UNUSED_TYPE in logging_unittest.cc, or remove it, because both cause ...
6 years, 2 months ago (2014-10-16 20:06:26 UTC) #16
danakj
On 2014/10/16 20:06:26, Peter Kasting wrote: > So apparently I can't move the ALLOW_UNUSED_TYPE in ...
6 years, 2 months ago (2014-10-16 20:08:52 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/650393002/80001
6 years, 2 months ago (2014-10-16 20:12:07 UTC) #19
commit-bot: I haz the power
Committed patchset #5 (id:80001)
6 years, 2 months ago (2014-10-16 23:49:46 UTC) #20
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/99867ef78bf14ad37e263860248d0a2d61b51a73 Cr-Commit-Position: refs/heads/master@{#300014}
6 years, 2 months ago (2014-10-16 23:50:47 UTC) #21
Nico
https://codereview.chromium.org/650393002/diff/80001/base/compiler_specific.h File base/compiler_specific.h (right): https://codereview.chromium.org/650393002/diff/80001/base/compiler_specific.h#newcode99 base/compiler_specific.h:99: #define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0 How is ...
6 years, 1 month ago (2014-10-25 22:56:08 UTC) #23
Peter Kasting
https://codereview.chromium.org/650393002/diff/80001/base/compiler_specific.h File base/compiler_specific.h (right): https://codereview.chromium.org/650393002/diff/80001/base/compiler_specific.h#newcode99 base/compiler_specific.h:99: #define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0 On 2014/10/25 ...
6 years, 1 month ago (2014-10-27 17:58:44 UTC) #24
Nico
6 years, 1 month ago (2014-10-27 18:52:32 UTC) #25
Message was sent while issue was closed.
Makes sense, thanks.

On Mon, Oct 27, 2014 at 10:58 AM, <pkasting@chromium.org> wrote:

>
> https://codereview.chromium.org/650393002/diff/80001/base/
> compiler_specific.h
> File base/compiler_specific.h (right):
>
> https://codereview.chromium.org/650393002/diff/80001/base/
> compiler_specific.h#newcode99
> base/compiler_specific.h:99: #define ALLOW_UNUSED_LOCAL(x) false ?
> (void)x : (void)0
> On 2014/10/25 22:56:08, Nico wrote:
>
>> How is this different from ignore_result()?
>>
>
> It doesn't implicitly take the address of |x| or in any other way
> evaluate it (see below).
>
> It would also be strange for code to write "ignore_result(x)" as a way
> of marking |x| as "allowed to be unused" -- that could be very confusing
> to a reader depending on the situation.
>
>  Why not just (void)x, why the `false?:`?
>>
>
> This references |x| without any possibility of actually evaluating it,
> just in case evaluating the argument has some effect (e.g. x is declared
> volatile and so we generate a load the compiler can't optimize away, or
> I suppose maybe this gets used inside another macro and |x| turns out to
> be some expression with side effects).
>
> I think it's unlikely the distinction actually matters, but this form is
> at least as safe as the other, so I don't see anything wrong with using
> it.
>
> https://codereview.chromium.org/650393002/
>

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698