From c0be14cb6934073508ccf9fb2d7db4bd4f3c5b3d Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 22 Jul 2015 11:04:32 -0400 Subject: [PATCH] Bug 1186444 - part 1 - move uses of MODULE_OPTIMIZE_FLAGS to moz.build's CFLAGS; r=mshal Now that we have moz.build, we can be guaranteed that any flags we add in moz.build will be added after everything else has been setup. So any uses of MODULE_OPTIMIZE_FLAGS can be moved to moz.build's CFLAGS/CXXFLAGS without any unusual repercussions. We do have to verify that MOZ_OPTIMIZE is in effect, though. --- config/Makefile.in | 4 ---- config/moz.build | 3 +++ gfx/cairo/cairo/src/Makefile.in | 6 ------ gfx/cairo/cairo/src/moz.build | 5 +++++ gfx/cairo/libpixman/src/Makefile.in | 4 ---- gfx/cairo/libpixman/src/moz.build | 4 ++++ memory/mozjemalloc/Makefile.in | 6 ------ memory/mozjemalloc/moz.build | 5 +++++ 8 files changed, 17 insertions(+), 20 deletions(-) diff --git a/config/Makefile.in b/config/Makefile.in index e73d3a0ce3a..62683ac0aa8 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -10,10 +10,6 @@ ifdef NSBUILDROOT override NSBUILDROOT := endif -ifdef GNU_CC -MODULE_OPTIMIZE_FLAGS = -O3 -endif - include $(topsrcdir)/config/config.mk # L10n jobs are doing make -C config manually before anything else, diff --git a/config/moz.build b/config/moz.build index dbf819cb989..180e070de38 100644 --- a/config/moz.build +++ b/config/moz.build @@ -39,3 +39,6 @@ PYTHON_UNIT_TESTS += [ 'tests/unit-nsinstall.py', 'tests/unit-printprereleasesuffix.py', ] + +if CONFIG['GNU_CC'] and CONFIG['MOZ_OPTIMIZE']: + CFLAGS += ['-O3'] diff --git a/gfx/cairo/cairo/src/Makefile.in b/gfx/cairo/cairo/src/Makefile.in index f707f65534d..3f9653ee3dc 100644 --- a/gfx/cairo/cairo/src/Makefile.in +++ b/gfx/cairo/cairo/src/Makefile.in @@ -2,12 +2,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -ifdef GNU_CC -ifeq ($(OS_TARGET),Android) -MODULE_OPTIMIZE_FLAGS = -O2 -endif -endif - INSTALL_TARGETS += cairo_features cairo_features_FILES := cairo-features.h cairo_features_DEST = $(DIST)/include/cairo diff --git a/gfx/cairo/cairo/src/moz.build b/gfx/cairo/cairo/src/moz.build index e99fcc97a95..88babf740a5 100644 --- a/gfx/cairo/cairo/src/moz.build +++ b/gfx/cairo/cairo/src/moz.build @@ -234,6 +234,11 @@ if CONFIG['GNU_CC']: '-Wno-error=uninitialized', ] +# See bug 386897. +if CONFIG['GNU_CC'] and CONFIG['OS_TARGET'] == 'Android' and CONFIG['MOZ_OPTIMIZE']: + CFLAGS += ['-O2'] + CXXFLAGS += ['-O2'] + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt': CFLAGS += CONFIG['MOZ_QT_CFLAGS'] CXXFLAGS += CONFIG['MOZ_QT_CFLAGS'] diff --git a/gfx/cairo/libpixman/src/Makefile.in b/gfx/cairo/libpixman/src/Makefile.in index 041c7bf73ab..f119333b446 100644 --- a/gfx/cairo/libpixman/src/Makefile.in +++ b/gfx/cairo/libpixman/src/Makefile.in @@ -2,10 +2,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -ifeq ($(OS_TARGET),Android) -MODULE_OPTIMIZE_FLAGS = -O2 -endif - include $(topsrcdir)/config/rules.mk # The ARM asm functions here don't appreciate being called by functions diff --git a/gfx/cairo/libpixman/src/moz.build b/gfx/cairo/libpixman/src/moz.build index f1bfd83642d..2eb6ef62e57 100644 --- a/gfx/cairo/libpixman/src/moz.build +++ b/gfx/cairo/libpixman/src/moz.build @@ -145,3 +145,7 @@ if CONFIG['GNU_CC']: '-Wno-tautological-compare', '-Wno-tautological-constant-out-of-range-compare', ] + +# See bug 386897. +if CONFIG['OS_TARGET'] == 'Android' and CONFIG['MOZ_OPTIMIZE']: + CFLAGS += ['-O2'] diff --git a/memory/mozjemalloc/Makefile.in b/memory/mozjemalloc/Makefile.in index ac7ff1eeb61..88aeccf6fc6 100644 --- a/memory/mozjemalloc/Makefile.in +++ b/memory/mozjemalloc/Makefile.in @@ -9,11 +9,5 @@ ifndef MOZ_JEMALLOC3 # broken when compiling without optimization, while avoiding to add yet another # configure test. MOZ_OPTIMIZE = 1 - -ifeq ($(OS_ARCH),SunOS) -ifndef GNU_CC -MODULE_OPTIMIZE_FLAGS = -xO5 -endif -endif endif diff --git a/memory/mozjemalloc/moz.build b/memory/mozjemalloc/moz.build index b912bc95f1b..2b223f4817a 100644 --- a/memory/mozjemalloc/moz.build +++ b/memory/mozjemalloc/moz.build @@ -16,6 +16,11 @@ if not CONFIG['MOZ_JEMALLOC3']: STATIC_LIBRARY_NAME = 'jemalloc' FORCE_STATIC_LIB = True + # See bug 422055. + if CONFIG['OS_ARCH'] == 'SunOS' and not CONFIG['GNU_CC'] \ + and CONFIG['MOZ_OPTIMIZE']: + CFLAGS += ['-xO5'] + # For non release/esr builds, enable (some) fatal jemalloc assertions. This # helps us catch memory errors. if CONFIG['MOZ_UPDATE_CHANNEL'] not in ('release', 'esr'):