- ack

On 07/16/2012 09:35 AM, Jakub Filak wrote:
If I build libreport with -O0 GCC option I get an error because of this
warning:
"/usr/include/features.h:314:4: warning: #warning _FORTIFY_SOURCE
requires compiling with optimization (-O) [-Wcpp]"

_FORTIFY_SOURCE is required by Python bindings thus I can't get rid of
FORTIFY_SOUCE but I really want to compile without optimizations.

Therefore we have decided to use -Werror option only for rpm builds. It
allows me to make a local build without optimizations and, on the
contrary, a source code with a single warning will break a nightly build
hence nobody is allowed to push a code with warnings.

Signed-off-by: Jakub Filak <[email protected]>
---
  configure.ac                   |    4 ++--
  libreport.spec.in              |    3 +--
  src/cli/Makefile.am            |    3 +--
  src/client-python/Makefile.am  |    3 +--
  src/gtk-helpers/Makefile.am    |    1 -
  src/gui-wizard-gtk/Makefile.am |    3 +--
  src/lib/Makefile.am            |    3 ---
  src/plugins/Makefile.am        |   24 ++++++++----------------
  src/report-newt/report-newt.c  |    2 +-
  src/report-python/Makefile.am  |    3 +--
  10 files changed, 16 insertions(+), 33 deletions(-)

diff --git a/configure.ac b/configure.ac
index fbaa53c..fb4937d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,12 +13,12 @@ AC_PROG_LN_S

  AC_SYS_LARGEFILE
  CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
-          -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -std=gnu99 -Wall"
+          -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -std=gnu99 -Wall 
-Wwrite-strings"

  AC_ARG_ENABLE(debug,
                [AC_HELP_STRING([--enable-debug],
                               [Enable debug information])],
-              [CFLAGS="$CFLAGS -DDEBUG -ggdb -g"])
+              [CFLAGS="$CFLAGS -DDEBUG -ggdb -g -O0"])

  AC_ARG_ENABLE([bodhi],
        AC_HELP_STRING([--disable-bodhi], [do not use bodhi plugin]))
diff --git a/libreport.spec.in b/libreport.spec.in
index 6f6da01..fa1b15f 100644
--- a/libreport.spec.in
+++ b/libreport.spec.in
@@ -228,8 +228,7 @@ Plugin to report bugs into anonymous FTP site associated 
with ticketing system.

  %build
  autoconf
-%configure
-CFLAGS="-fno-strict-aliasing"
+CFLAGS="%{optflags} -Werror" %configure
  make %{?_smp_mflags}

  %install
diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am
index 5295658..5edc119 100644
--- a/src/cli/Makefile.am
+++ b/src/cli/Makefile.am
@@ -12,8 +12,7 @@ report_cli_CPPFLAGS = \
      -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
      $(GLIB_CFLAGS) \
      -D_GNU_SOURCE \
-    $(LIBREPORT_CFLAGS) \
-    -Wall -Wwrite-strings -Werror
+    $(LIBREPORT_CFLAGS)
  #    $(GTK_CFLAGS)
  report_cli_LDADD = \
      ../lib/libreport.la \
diff --git a/src/client-python/Makefile.am b/src/client-python/Makefile.am
index 74486f2..ad6f98e 100644
--- a/src/client-python/Makefile.am
+++ b/src/client-python/Makefile.am
@@ -18,8 +18,7 @@ _reportclient_la_CPPFLAGS = \
      -DLOCALSTATEDIR='"$(localstatedir)"' \
      $(GLIB_CFLAGS) \
      $(PYTHON_CFLAGS) \
-    -D_GNU_SOURCE \
-    -Wall -Wwrite-strings -Werror
+    -D_GNU_SOURCE
  _reportclient_la_LDFLAGS = \
      -module \
      -avoid-version \
diff --git a/src/gtk-helpers/Makefile.am b/src/gtk-helpers/Makefile.am
index 188e48f..06c3ec8 100644
--- a/src/gtk-helpers/Makefile.am
+++ b/src/gtk-helpers/Makefile.am
@@ -15,7 +15,6 @@ libreport_gtk_la_SOURCES = \
      autowrapped_label.c

  libreport_gtk_la_CPPFLAGS = \
-    -Wall -Wwrite-strings -Werror \
      -I$(srcdir)/../include \
      -I$(srcdir)/../lib \
      $(GTK_CFLAGS) \
diff --git a/src/gui-wizard-gtk/Makefile.am b/src/gui-wizard-gtk/Makefile.am
index 29df95b..ecd1887 100644
--- a/src/gui-wizard-gtk/Makefile.am
+++ b/src/gui-wizard-gtk/Makefile.am
@@ -21,8 +21,7 @@ report_gtk_CFLAGS = \
      -DICON_DIR=\"${datadir}/abrt/icons/hicolor/48x48/status\" \
      $(GLIB_CFLAGS) \
      $(GTK_CFLAGS) \
-    -D_GNU_SOURCE \
-    -Wall -Wwrite-strings -Werror
+    -D_GNU_SOURCE

  # Required for gtk_builder_connect_signals() to work correctly:
  # -lgmodule-2.0
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index d2282db..5befe7d 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -49,7 +49,6 @@ libreport_la_SOURCES = \
      client.c \
      utf8.c
  libreport_la_CPPFLAGS = \
-    -Wall -Wwrite-strings -Werror \
      -I$(srcdir)/../include \
      -DLOCALSTATEDIR='"$(localstatedir)"' \
      -DVAR_RUN=\"$(VAR_RUN)\" \
@@ -81,7 +80,6 @@ libabrt_dbus_la_CPPFLAGS = \
      -DEVENTS_DIR=\"$(EVENTS_DIR)\" \
      $(GLIB_CFLAGS) \
      $(DBUS_CFLAGS) \
-    -Wall -Wwrite-strings -Werror \
      -D_GNU_SOURCE
  libabrt_dbus_la_LDFLAGS = \
      -version-info 0:1:0
@@ -96,7 +94,6 @@ libreport_web_la_SOURCES = \
      proxies.h proxies.c \
      ureport.h json.c
  libreport_web_la_CPPFLAGS = \
-    -Wall -Wwrite-strings -Werror \
      -I$(srcdir)/../include \
      -DLOCALSTATEDIR='"$(localstatedir)"' \
      -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index f40f27e..967596f 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -72,8 +72,7 @@ reporter_bugzilla_CPPFLAGS = \
      $(GLIB_CFLAGS) \
      $(LIBREPORT_CFLAGS) \
      $(XMLRPC_CFLAGS) $(XMLRPC_CLIENT_CFLAGS) \
-    -D_GNU_SOURCE \
-    -Wall -Wwrite-strings
+    -D_GNU_SOURCE
  reporter_bugzilla_LDADD = \
      $(GLIB_LIBS) \
      $(XMLRPC_LIBS) $(XMLRPC_CLIENT_LIBS) \
@@ -99,8 +98,7 @@ reporter_rhtsupport_CPPFLAGS = \
      $(LIBREPORT_CFLAGS) \
      $(XMLRPC_CFLAGS) $(XMLRPC_CLIENT_CFLAGS) \
      $(LIBXML_CFLAGS) \
-    -D_GNU_SOURCE \
-    -Wall -Wwrite-strings -Werror
+    -D_GNU_SOURCE
  reporter_rhtsupport_LDFLAGS = -ltar
  reporter_rhtsupport_LDADD = \
      $(GLIB_LIBS) \
@@ -123,8 +121,7 @@ reporter_upload_CPPFLAGS = \
      $(GLIB_CFLAGS) \
      $(CURL_CFLAGS) \
      $(LIBREPORT_CFLAGS) \
-    -D_GNU_SOURCE \
-    -Wall -Wwrite-strings -Werror
+    -D_GNU_SOURCE
  reporter_upload_LDFLAGS = -ltar
  reporter_upload_LDADD = \
      $(GLIB_LIBS) \
@@ -144,8 +141,7 @@ reporter_kerneloops_CPPFLAGS = \
      -DPLUGINS_CONF_DIR=\"$(REPORT_PLUGINS_CONF_DIR)\" \
      $(GLIB_CFLAGS) \
      $(LIBREPORT_CFLAGS) \
-    -D_GNU_SOURCE \
-    -Wall -Wwrite-strings -Werror
+    -D_GNU_SOURCE
  reporter_kerneloops_LDADD = \
      ../lib/libreport-web.la \
      ../lib/libreport.la
@@ -165,8 +161,7 @@ reporter_mailx_CPPFLAGS = \
      -DPLUGINS_CONF_DIR=\"$(REPORT_PLUGINS_CONF_DIR)\" \
      $(GLIB_CFLAGS) \
      $(LIBREPORT_CFLAGS) \
-    -D_GNU_SOURCE \
-    -Wall -Wwrite-strings -Werror
+    -D_GNU_SOURCE
  reporter_mailx_LDADD = \
      ../lib/libreport.la

@@ -183,8 +178,7 @@ reporter_print_CPPFLAGS = \
      -DPLUGINS_CONF_DIR=\"$(REPORT_PLUGINS_CONF_DIR)\" \
      $(GLIB_CFLAGS) \
      $(LIBREPORT_CFLAGS) \
-    -D_GNU_SOURCE \
-    -Wall -Wwrite-strings -Werror
+    -D_GNU_SOURCE
  reporter_print_LDADD = \
      ../lib/libreport.la

@@ -202,8 +196,7 @@ report_CPPFLAGS = \
      -DPLUGINS_CONF_DIR=\"$(REPORT_PLUGINS_CONF_DIR)\" \
      $(GLIB_CFLAGS) \
      $(LIBREPORT_CFLAGS) \
-    -D_GNU_SOURCE \
-    -Wall -Wwrite-strings -Werror
+    -D_GNU_SOURCE
  report_LDADD = \
      ../lib/libreport.la

@@ -214,8 +207,7 @@ reporter_ureport_CPPFLAGS = \
      -I$(srcdir)/../lib \
      $(GLIB_CFLAGS) \
      $(LIBREPORT_CFLAGS) \
-    -D_GNU_SOURCE \
-    -Wall -Wwrite-strings -Werror
+    -D_GNU_SOURCE
  reporter_ureport_LDADD = \
      ../lib/libreport.la \
      ../lib/libreport-web.la
diff --git a/src/report-newt/report-newt.c b/src/report-newt/report-newt.c
index 3a94896..6287445 100644
--- a/src/report-newt/report-newt.c
+++ b/src/report-newt/report-newt.c
@@ -334,7 +334,7 @@ static int report(const char *dump_dir_name)
                              reason ?: _("(no description)"));

          dd_close(dd);
-        newtWinMessage(_("Error"), _("Ok"), "%s", t);
+        newtWinMessage(_("Error"), _("Ok"), (char *)"%s", t);
          free(t);
          return -1;
      }
diff --git a/src/report-python/Makefile.am b/src/report-python/Makefile.am
index e12479f..43a58f2 100644
--- a/src/report-python/Makefile.am
+++ b/src/report-python/Makefile.am
@@ -22,8 +22,7 @@ _pyreport_la_CPPFLAGS = \
      -DVAR_RUN=\"$(VAR_RUN)\" \
      $(GLIB_CFLAGS) \
      $(PYTHON_CFLAGS) \
-    -D_GNU_SOURCE \
-    -Wall -Wwrite-strings -Werror
+    -D_GNU_SOURCE
  _pyreport_la_LDFLAGS = \
      -module \
      -avoid-version \



Reply via email to