[gnome-photos] build: Restore optimized builds by default
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] build: Restore optimized builds by default
- Date: Mon, 13 Aug 2018 13:30:41 +0000 (UTC)
commit cfc3985f0bc6004438df2dacf43ef98da98af03f
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Aug 13 13:42:42 2018 +0200
build: Restore optimized builds by default
Building with AX_CHECK_ENABLE_DEBUG([yes]), which is what happens by
default for non-release builds, turns off compiler optimizations and
overrides any optimization specified via CFLAGS in the build
environment. This means that the nightly Flatpaks, and almost all
other non-release builds, are built without any optimization. It's
very likely that this has a negative impact on the image processing
loops in the built-in GeglOperations.
It can be useful to turn off compiler optimizations to get a better
debugging experience, but it becomes a problem if it stomps over the
build environment while doing so. The person doing the builds should
should get to decide between ease of debugging and reasonable
performance. After all, debugging is not the only thing that a
developer does. Performance measurements are important too, and one can
use GDB reasonably well with the Autoconf default, which also happens
to be what most distributions use, of "-g O2".
This wouldn't have been such a problem if AX_CHECK_ENABLE_DEBUG
attached its flags before the values from the environment instead of
after, because in case of multiple -O options, the last such option is
the one that's effective.
Thankfully, "no" doesn't override the environment, which is what
happens for release builds, and distributions generally set their own
CFLAGS. Otherwise every single user-facing build would have been
broken. Note that any release build without CFLAGS set in the
environment would neither get debug symbols (ie., no "-g") nor any
compiler optimization because AX_CHECK_ENABLE_DEBUG always suppresses
the Autoconf defaults of "-g -O2".
One solution could have been to default to "info" for non-release
builds and recommend the use of --enable-debug=info while building from
Git, but that would not address release builds without CFLAGS.
Given that the only other thing the macro does is to define the NDEBUG
pre-processor macro when debugging is set to "no", which isn't widely
used in the GLib-based GNOME platform [1], it seems better to just
remove it altogether.
Interestingly, this also seems to unmask some valid cases of
-Wclobbered and -Wmaybe-uninitialized with Fedora's
gcc-7.3.1-6.fc27.x86_64 build.
Fallout from 8f6fb6864a3ccbfac86c5968f8495cc04d5dbf6f. The deprecated
GNOME_DEBUG_CHECK macro didn't set any debugging or optimization flags.
[1] glib/gio/xdgmime is the only widely used code path where assert(3)
is used. It's also used in gio/kqueue/dep-list.c, which is
*BSD-specific and in GTK+'s Broadway backend. All those can
probably be replaced with g_assert*.
configure.ac | 1 -
m4/ax_check_enable_debug.m4 | 124 ---------------------------------
src/photos-image-view.c | 3 +-
src/photos-operation-png-guess-sizes.c | 5 +-
4 files changed, 6 insertions(+), 127 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e910abdc..0caf282c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,6 @@ AM_MAINTAINER_MODE([enable])
AX_IS_RELEASE([git-directory])
-AX_CHECK_ENABLE_DEBUG([yes],,, [$ax_is_release])
AX_COMPILER_FLAGS([WARN_CFLAGS],
[WARN_LDFLAGS],
[$ax_is_release],
diff --git a/src/photos-image-view.c b/src/photos-image-view.c
index 5ebd25bb..3722b640 100644
--- a/src/photos-image-view.c
+++ b/src/photos-image-view.c
@@ -132,13 +132,14 @@ photos_image_view_calculate_best_fit_zoom (PhotosImageView *self, gdouble *out_z
gint allocation_width_scaled;
gint scale_factor;
+ scale_factor = gtk_widget_get_scale_factor (GTK_WIDGET (self));
+
if (!photos_image_view_has_allocation_and_extent (self))
goto out;
gtk_widget_get_allocation (GTK_WIDGET (self), &allocation);
bbox = *gegl_buffer_get_extent (self->buffer);
- scale_factor = gtk_widget_get_scale_factor (GTK_WIDGET (self));
allocation_height_scaled = allocation.height * scale_factor;
allocation_width_scaled = allocation.width * scale_factor;
diff --git a/src/photos-operation-png-guess-sizes.c b/src/photos-operation-png-guess-sizes.c
index e3a04876..6319e1cf 100644
--- a/src/photos-operation-png-guess-sizes.c
+++ b/src/photos-operation-png-guess-sizes.c
@@ -117,7 +117,10 @@ photos_operation_png_guess_sizes_count (GeglBuffer *buffer,
goto out;
if (setjmp (png_jmpbuf (png_ptr)))
- goto out;
+ {
+ ret_val = 0;
+ goto out;
+ }
if (compression >= 0)
png_set_compression_level (png_ptr, compression);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]