From e7d7f7845a87885e02e316501e6b09f7793db672 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 26 Sep 2017 01:42:58 +0000 Subject: [PATCH] win: Try to make midl.py work with midl.exe 8.1.620 Bug: 756607 Change-Id: I78e1fdf2411c067efd5423987ab9812f14b93736 Reviewed-on: https://chromium-review.googlesource.com/680041 Reviewed-by: Scott Graham Commit-Queue: Nico Weber Cr-Original-Commit-Position: refs/heads/master@{#504255} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 7b9ef85965bb7f997a4564dba09e257d4d7d21ea --- config/win/BUILD.gn | 10 ---------- toolchain/win/midl.gni | 2 -- toolchain/win/midl.py | 10 ++++++++++ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/config/win/BUILD.gn b/config/win/BUILD.gn index 3e7d80487..f2c7b2526 100644 --- a/config/win/BUILD.gn +++ b/config/win/BUILD.gn @@ -427,13 +427,3 @@ config("target_winrt") { "/EHsc", ] } - -# Internal stuff -------------------------------------------------------------- - -# Config used by the MIDL template to disable warnings. -config("midl_warnings") { - if (is_clang) { - # MIDL generates code like "#endif !_MIDL_USE_GUIDDEF_". - cflags = [ "-Wno-extra-tokens" ] - } -} diff --git a/toolchain/win/midl.gni b/toolchain/win/midl.gni index 90f9810b0..c15a500f7 100644 --- a/toolchain/win/midl.gni +++ b/toolchain/win/midl.gni @@ -92,7 +92,5 @@ template("midl") { public_deps = [ ":$action_name", ] - - configs += [ "//build/config/win:midl_warnings" ] } } diff --git a/toolchain/win/midl.py b/toolchain/win/midl.py index 1b9e1fc1a..c8134fb8d 100644 --- a/toolchain/win/midl.py +++ b/toolchain/win/midl.py @@ -36,6 +36,16 @@ def ZapTimestamp(filename): 'target_arch=(AMD64|X86) 8\.\d\d\.\d{4}', ' Oicf, W1, Zp8, env=\\1 (32b run), target_arch=\\2 8.xx.xxxx', contents) + # TODO(thakis): If we need more hacks than these, try to verify checked-in + # outputs when we're using the hermetic toolchain. + # midl.exe older than 8.1.622 omit '//' after #endif, fix that: + contents = contents.replace('#endif !_MIDL_USE_GUIDDEF_', + '#endif // !_MIDL_USE_GUIDDEF_') + # midl.exe puts the midl version into code in one place. To have + # predictable output, lie about the midl version if it's not 8.1.622. + # This is unfortunate, but remember that there's beauty too in imperfection. + contents = contents.replace('0x801026c, /* MIDL Version 8.1.620 */', + '0x801026e, /* MIDL Version 8.1.622 */') open(filename, 'wb').write(contents)