GNOME Bugzilla – Bug 677373
Only enable _FORTIFY_SOURCE if optimization enabled
Last modified: 2012-06-06 16:07:15 UTC
When building with optimization disabled (for example for debugging) then _FORTIFY_SOURCE produces a massive amount of warnings about optimization being disabled. The attached patch fixes the issue by disabling _FORTIFY_SOURCE for non-optimized builds (for which it doesn't work anyway). Just a few lines of the warning output: In file included from /usr/include/limits.h:27:0, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:169, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/syslimits.h:7, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:34, from /opt/build/lib64/glib-2.0/include/glibconfig.h:11, from /opt/build/include/glib-2.0/glib/gtypes.h:34, from /opt/build/include/glib-2.0/glib/galloca.h:34, from /opt/build/include/glib-2.0/glib.h:32, from cc-notebook.c:25: /usr/include/features.h:314:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] CC cc-shell-category-view.o In file included from /usr/include/limits.h:27:0, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:169, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/syslimits.h:7, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:34, from /opt/build/lib64/glib-2.0/include/glibconfig.h:11, from /opt/build/include/glib-2.0/glib/gtypes.h:34, from /opt/build/include/glib-2.0/glib/galloca.h:34, from /opt/build/include/glib-2.0/glib.h:32, from /opt/build/include/gtk-3.0/gdk/gdkconfig.h:13, from /opt/build/include/gtk-3.0/gdk/gdk.h:30, from /opt/build/include/gtk-3.0/gtk/gtk.h:30, from cc-shell-category-view.h:25, from cc-shell-category-view.c:21: /usr/include/features.h:314:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] CC cc-shell-item-view.o In file included from /usr/include/limits.h:27:0, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:169, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/syslimits.h:7, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:34, from /opt/build/lib64/glib-2.0/include/glibconfig.h:11, from /opt/build/include/glib-2.0/glib/gtypes.h:34, from /opt/build/include/glib-2.0/glib/galloca.h:34, from /opt/build/include/glib-2.0/glib.h:32, from /opt/build/include/gtk-3.0/gdk/gdkconfig.h:13, from /opt/build/include/gtk-3.0/gdk/gdk.h:30, from /opt/build/include/gtk-3.0/gtk/gtk.h:30, from cc-shell-item-view.h:24, from cc-shell-item-view.c:21: /usr/include/features.h:314:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] CC cc-shell-model.o In file included from /usr/include/limits.h:27:0, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:169, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/syslimits.h:7, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:34, from /opt/build/lib64/glib-2.0/include/glibconfig.h:11, from /opt/build/include/glib-2.0/glib/gtypes.h:34, from /opt/build/include/glib-2.0/glib/galloca.h:34, from /opt/build/include/glib-2.0/glib.h:32, from /opt/build/include/gtk-3.0/gdk/gdkconfig.h:13, from /opt/build/include/gtk-3.0/gdk/gdk.h:30, from /opt/build/include/gtk-3.0/gtk/gtk.h:30, from cc-shell-model.h:25, from cc-shell-model.c:22: /usr/include/features.h:314:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] CC cc-editable-entry.o In file included from /usr/include/limits.h:27:0, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:169, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/syslimits.h:7, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:34, from /opt/build/lib64/glib-2.0/include/glibconfig.h:11, from /opt/build/include/glib-2.0/glib/gtypes.h:34, from /opt/build/include/glib-2.0/glib/galloca.h:34, from /opt/build/include/glib-2.0/glib.h:32, from /opt/build/include/gtk-3.0/gdk/gdkconfig.h:13, from /opt/build/include/gtk-3.0/gdk/gdk.h:30, from /opt/build/include/gtk-3.0/gtk/gtk.h:30, from cc-editable-entry.h:25, from cc-editable-entry.c:23: /usr/include/features.h:314:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] CC cc-strength-bar.o In file included from /usr/include/limits.h:27:0, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:169, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/syslimits.h:7, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:34, from /opt/build/lib64/glib-2.0/include/glibconfig.h:11, from /opt/build/include/glib-2.0/glib/gtypes.h:34, from /opt/build/include/glib-2.0/glib/galloca.h:34, from /opt/build/include/glib-2.0/glib.h:32, from cc-strength-bar.c:26: /usr/include/features.h:314:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] CC cc-panel.o In file included from /usr/include/limits.h:27:0, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:169, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/syslimits.h:7, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:34, from /opt/build/lib64/glib-2.0/include/glibconfig.h:11, from /opt/build/include/glib-2.0/glib/gtypes.h:34, from /opt/build/include/glib-2.0/glib/galloca.h:34, from /opt/build/include/glib-2.0/glib.h:32, from /opt/build/include/glib-2.0/gobject/gbinding.h:30, from /opt/build/include/glib-2.0/glib-object.h:25, from cc-panel.h:28, from cc-panel.c:36: /usr/include/features.h:314:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] CC cc-shell.o In file included from /usr/include/limits.h:27:0, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:169, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/syslimits.h:7, from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/limits.h:34, from /opt/build/lib64/glib-2.0/include/glibconfig.h:11, from /opt/build/include/glib-2.0/glib/gtypes.h:34, from /opt/build/include/glib-2.0/glib/galloca.h:34, from /opt/build/include/glib-2.0/glib.h:32, from /opt/build/include/gtk-3.0/gdk/gdkconfig.h:13, from /opt/build/include/gtk-3.0/gdk/gdk.h:30, from /opt/build/include/gtk-3.0/gtk/gtk.h:30, from cc-shell.h:25, from cc-shell.c:33: /usr/include/features.h:314:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp] CC cc-shell-marshal.o ^Cmake[3]: *** [cc-shell-marshal.o] Interrupt make[2]: *** [all] Interrupt make[1]: *** [all-recursive] Interrupt
Created attachment 215530 [details] [review] Only enable _FORTIFY_SOURCE if optimization enabled * Otherwise we get a spew of warnings when building non-optimized
Review of attachment 215530 [details] [review]: No idea who added that.
Prepend "build: " to the commit subject, and remove the "*" from the commit message.
Thanks. Merged into master