Commit 0eccd3dd authored by Maksim Ivanov's avatar Maksim Ivanov Committed by Commit Bot

Fix policy_fuzzer proto redefinition compile error

Fix the GN file to avoid the policy_fuzzer compilation errors,
by removing the "proto_in_dir" parameter that was added in r803915.
As per trybot results, it seems that this parameter isn't actually
needed.

The reason why this parameter was causing troubles in policy_fuzzer
is that we're compiling chrome_device_policy.proto twice:

(1) "gen/components/policy/proto/chrome_device_policy.pb.h", which
    is the standard compilation location used for compiling both
    normal Chrome and the fuzzer;
(2) "gen/chrome/browser/chromeos/policy/fuzzer/chrome_device_policy.pb.h",
    which is compiled specifically for fuzzer, with the LITE_RUNTIME
    option suppressed.

Previously, before "proto_in_dir" was introduced in r803915, both of
these header files had the same preprocessor include guard that is
based on the "chrome_device_policy" string:

  #ifndef GOOGLE_PROTOBUF_INCLUDED_chrome_5fdevice_5fpolicy_2eproto
  #define GOOGLE_PROTOBUF_INCLUDED_chrome_5fdevice_5fpolicy_2eproto

The fact that the include guard was the same allowed to include both
of these headers in the same .cc file without any compilation issues.

With "proto_in_dir" introduced in r803915, the include guard for file
#1 changed, because protoc started to consider the full path to the
file:

  #ifndef GOOGLE_PROTOBUF_INCLUDED_components_2fpolicy_2fproto_2fchrome_5fdevice_5fpolicy_2eproto
  #define GOOGLE_PROTOBUF_INCLUDED_components_2fpolicy_2fproto_2fchrome_5fdevice_5fpolicy_2eproto

This caused compilation issues of policy_fuzzer, since the include
guards didn't protect from redefining the contents of
chrome_device_policy.proto twice.

The fix is to remove this "proto_in_dir" directive, which seems to be
unnecessary.

A future long-term fix (potentially also addressing other compilation
issues that we saw in https://crbug.com/1093407) would be to get rid
of double-compilation of the .proto files.

Bug: 1124880,1094675
Change-Id: I3b1ba1c1591940a846a3ec323a9fa16aa01778e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2392816
Auto-Submit: Maksim Ivanov <emaxx@chromium.org>
Reviewed-by: default avatarZach Trudo <zatrudo@google.com>
Commit-Queue: Zach Trudo <zatrudo@google.com>
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804489}
parent 8d40bcfa
......@@ -76,8 +76,6 @@ proto_library("proto_internal") {
".",
]
proto_in_dir = "//"
link_deps = [
":policy_common_definitions_compile_proto",
"//third_party/private_membership:private_membership_proto",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment