From 76882a03f394124b14c37d9f0d0f3455319db696 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 6 Feb 2019 21:02:20 +0000 Subject: [PATCH] Bug 1512541 - Don't force-include mozilla-config.h in rust-built C/C++ code. r=mshal Differential Revision: https://phabricator.services.mozilla.com/D18653 --HG-- extra : moz-landing-system : lando --- config/makefiles/rust.mk | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk index 5b2d6ebc98ce..f2d3dddf6c03 100644 --- a/config/makefiles/rust.mk +++ b/config/makefiles/rust.mk @@ -90,10 +90,13 @@ export CC_$(rust_cc_env_name)=$(CC) export CXX_$(rust_cc_env_name)=$(CXX) export AR_$(rust_cc_env_name)=$(AR) ifeq (,$(MOZ_ASAN)$(MOZ_TSAN)$(MOZ_UBSAN)$(CODE_COVERAGE_GCC)$(FUZZING_INTERFACES)) -export CFLAGS_$(rust_host_cc_env_name)=$(COMPUTED_HOST_CFLAGS) -export CXXFLAGS_$(rust_host_cc_env_name)=$(COMPUTED_HOST_CXXFLAGS) -export CFLAGS_$(rust_cc_env_name)=$(COMPUTED_CFLAGS) -export CXXFLAGS_$(rust_cc_env_name)=$(COMPUTED_CXXFLAGS) +# -DMOZILLA_CONFIG_H is added to prevent mozilla-config.h from injecting anything +# in C/C++ compiles from rust. That's not needed in the other branch because the +# base flags don't force-include mozilla-config.h. +export CFLAGS_$(rust_host_cc_env_name)=$(COMPUTED_HOST_CFLAGS) -DMOZILLA_CONFIG_H +export CXXFLAGS_$(rust_host_cc_env_name)=$(COMPUTED_HOST_CXXFLAGS) -DMOZILLA_CONFIG_H +export CFLAGS_$(rust_cc_env_name)=$(COMPUTED_CFLAGS) -DMOZILLA_CONFIG_H +export CXXFLAGS_$(rust_cc_env_name)=$(COMPUTED_CXXFLAGS) -DMOZILLA_CONFIG_H else # Because cargo doesn't allow to distinguish builds happening for build # scripts/procedural macros vs. those happening for the rust target,