[spice-gtk 1/3] Make sure config.h is included first in all .c files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is recommended by autoconf documentation
http://nondot.org/sabre/Mirrored/autoconf-2.12/autoconf_3.html#SEC15
and some #defines in config.h can change what happens in system headers,
so config.h has to be included first.

The only file which does not get this treatment is
gtk/spice-client-gtk-module.c as this breaks the build on gtk+2:

CC       SpiceClientGtk_la-spice-client-gtk-module.lo
In file included from /usr/include/python2.7/pyconfig.h:6:0,
                 from /usr/include/python2.7/Python.h:8,
                 from /usr/include/pygtk-2.0/pygobject.h:5,
                 from spice-client-gtk-module.c:20:
/usr/include/python2.7/pyconfig-64.h:1182:0: error: "_POSIX_C_SOURCE" redefined [-Werror]
 #define _POSIX_C_SOURCE 200112L
 ^
In file included from /usr/include/limits.h:25:0,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/limits.h:168,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/syslimits.h:7,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/limits.h:34,
                 from /usr/lib64/glib-2.0/include/glibconfig.h:11,
                 from /usr/include/glib-2.0/glib/gtypes.h:34,
                 from /usr/include/glib-2.0/glib/galloca.h:34,
                 from /usr/include/glib-2.0/glib.h:32,
                 from /usr/include/glib-2.0/gobject/gbinding.h:30,
                 from /usr/include/glib-2.0/glib-object.h:25,
                 from ./glib-compat.h:24,
                 from ../config.h:201,
                 from spice-client-gtk-module.c:18:
/usr/include/features.h:228:0: note: this is the location of the previous definition
 #  define _POSIX_C_SOURCE 200809L
 ^
cc1: all warnings being treated as errors
---
 gtk/Makefile.am             | 9 ++++++---
 gtk/bio-gio.c               | 1 +
 gtk/channel-base.c          | 2 ++
 gtk/channel-cursor.c        | 2 ++
 gtk/channel-display-mjpeg.c | 2 ++
 gtk/channel-inputs.c        | 2 ++
 gtk/channel-main.c          | 2 ++
 gtk/channel-playback.c      | 2 ++
 gtk/channel-port.c          | 2 ++
 gtk/channel-record.c        | 2 ++
 gtk/decode-glz.c            | 2 ++
 gtk/decode-jpeg.c           | 2 ++
 gtk/decode-zlib.c           | 2 ++
 gtk/gio-coroutine.c         | 1 +
 gtk/glib-compat.c           | 1 +
 gtk/spice-channel.c         | 2 ++
 gtk/spice-client.c          | 2 ++
 gtk/spice-gtk-session.c     | 1 +
 gtk/spice-pulse.c           | 2 ++
 gtk/spice-session.c         | 2 ++
 gtk/spice-uri.c             | 1 +
 gtk/spice-widget-cairo.c    | 6 ++----
 gtk/spice-widget-x11.c      | 6 ++----
 gtk/spice-widget.c          | 6 ++----
 gtk/vmcstream.c             | 2 ++
 gtk/vncdisplaykeymap.c      | 1 +
 26 files changed, 50 insertions(+), 15 deletions(-)

diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 8a16120..75962cf 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -450,14 +450,16 @@ spice-glib-enums.c: spice-glib-enums.h
 spice-widget-enums.c: spice-widget-enums.h
 
 spice-marshal.c: spice-marshal.txt
-	$(AM_V_GEN)echo "#include \"spice-marshal.h\"" > $@ && \
+	$(AM_V_GEN)echo "#include \"config.h\"" > $@ && \
+		echo "#include \"spice-marshal.h\"" > $@ && \
 		glib-genmarshal --body $< >> $@ || (rm -f $@ && exit 1)
 
 spice-marshal.h: spice-marshal.txt
 	$(AM_V_GEN)glib-genmarshal --header $< > $@ || (rm -f $@ && exit 1)
 
 spice-glib-enums.c: spice-channel.h channel-inputs.h spice-session.h
-	$(AM_V_GEN)glib-mkenums --fhead "#include <glib-object.h>\n" \
+	$(AM_V_GEN)glib-mkenums --fhead "#include \"config.h\"\n\n" \
+			--fhead "#include <glib-object.h>\n" \
 			--fhead "#include \"spice-glib-enums.h\"\n\n" \
 			--fprod "\n#include \"spice-session.h\"\n" \
 			--fprod "\n#include \"spice-channel.h\"\n" \
@@ -486,7 +488,8 @@ spice-glib-enums.h: spice-channel.h channel-inputs.h spice-session.h
 		$^ >  $@
 
 spice-widget-enums.c: spice-widget.h
-	$(AM_V_GEN)glib-mkenums --fhead "#include <glib-object.h>\n" \
+	$(AM_V_GEN)glib-mkenums --fhead "#include \"config.h\"\n\n" \
+			--fhead "#include <glib-object.h>\n" \
 			--fhead "#include \"spice-widget-enums.h\"\n\n" \
 			--fprod "\n#include \"spice-widget.h\"\n" \
 			--vhead "static const G@Type@Value _@enum_name@_values[] = {" \
diff --git a/gtk/bio-gio.c b/gtk/bio-gio.c
index 22d58b6..cad904e 100644
--- a/gtk/bio-gio.c
+++ b/gtk/bio-gio.c
@@ -15,6 +15,7 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
 
 #include <string.h>
 #include <glib.h>
diff --git a/gtk/channel-base.c b/gtk/channel-base.c
index 363dda5..77d339c 100644
--- a/gtk/channel-base.c
+++ b/gtk/channel-base.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include "spice-client.h"
 #include "spice-common.h"
 
diff --git a/gtk/channel-cursor.c b/gtk/channel-cursor.c
index d33b90a..d7242a6 100644
--- a/gtk/channel-cursor.c
+++ b/gtk/channel-cursor.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include "glib-compat.h"
 #include "spice-client.h"
 #include "spice-common.h"
diff --git a/gtk/channel-display-mjpeg.c b/gtk/channel-display-mjpeg.c
index 627aab4..2ad653e 100644
--- a/gtk/channel-display-mjpeg.c
+++ b/gtk/channel-display-mjpeg.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include "spice-client.h"
 #include "spice-common.h"
 #include "spice-channel-priv.h"
diff --git a/gtk/channel-inputs.c b/gtk/channel-inputs.c
index a69dbe6..8a726e0 100644
--- a/gtk/channel-inputs.c
+++ b/gtk/channel-inputs.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include "spice-client.h"
 #include "spice-common.h"
 #include "spice-channel-priv.h"
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index d44ac23..58f5d31 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include <math.h>
 #include <spice/vd_agent.h>
 #include <common/rect.h>
diff --git a/gtk/channel-playback.c b/gtk/channel-playback.c
index bff5428..7789aa8 100644
--- a/gtk/channel-playback.c
+++ b/gtk/channel-playback.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include "spice-client.h"
 #include "spice-common.h"
 #include "spice-channel-priv.h"
diff --git a/gtk/channel-port.c b/gtk/channel-port.c
index 5512713..ad85afd 100644
--- a/gtk/channel-port.c
+++ b/gtk/channel-port.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include "spice-client.h"
 #include "spice-common.h"
 #include "spice-channel-priv.h"
diff --git a/gtk/channel-record.c b/gtk/channel-record.c
index 6b5e944..d4f47ba 100644
--- a/gtk/channel-record.c
+++ b/gtk/channel-record.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include "spice-client.h"
 #include "spice-common.h"
 #include "spice-channel-priv.h"
diff --git a/gtk/decode-glz.c b/gtk/decode-glz.c
index e2626ef..b09de00 100644
--- a/gtk/decode-glz.c
+++ b/gtk/decode-glz.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include <stdio.h>
 #include <stdbool.h>
 #include <inttypes.h>
diff --git a/gtk/decode-jpeg.c b/gtk/decode-jpeg.c
index 85976d0..cce7b53 100644
--- a/gtk/decode-jpeg.c
+++ b/gtk/decode-jpeg.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include "decode.h"
 
 #ifdef WIN32
diff --git a/gtk/decode-zlib.c b/gtk/decode-zlib.c
index a692020..966fc16 100644
--- a/gtk/decode-zlib.c
+++ b/gtk/decode-zlib.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include "decode.h"
 
 #ifndef __GNUC__
diff --git a/gtk/gio-coroutine.c b/gtk/gio-coroutine.c
index 9de9b54..d3ac16c 100644
--- a/gtk/gio-coroutine.c
+++ b/gtk/gio-coroutine.c
@@ -18,6 +18,7 @@
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 */
+#include "config.h"
 
 #include "gio-coroutine.h"
 
diff --git a/gtk/glib-compat.c b/gtk/glib-compat.c
index 20cbc8b..f940e0a 100644
--- a/gtk/glib-compat.c
+++ b/gtk/glib-compat.c
@@ -16,6 +16,7 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
 
 #include <string.h>
 
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index da4a3e6..122dd91 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include "spice-client.h"
 #include "spice-common.h"
 #include "glib-compat.h"
diff --git a/gtk/spice-client.c b/gtk/spice-client.c
index 59f2918..4e7242f 100644
--- a/gtk/spice-client.c
+++ b/gtk/spice-client.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include <glib.h>
 
 #include "spice-client.h"
diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index eab7e2f..a9ce025 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -15,6 +15,7 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
 
 #include <gtk/gtk.h>
 #include <spice/vd_agent.h>
diff --git a/gtk/spice-pulse.c b/gtk/spice-pulse.c
index c4241d0..32d6347 100644
--- a/gtk/spice-pulse.c
+++ b/gtk/spice-pulse.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include "spice-pulse.h"
 #include "spice-common.h"
 #include "spice-session-priv.h"
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 9b2828f..8ef90cf 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include <gio/gio.h>
 #include <glib.h>
 
diff --git a/gtk/spice-uri.c b/gtk/spice-uri.c
index 03b8c22..c379075 100644
--- a/gtk/spice-uri.c
+++ b/gtk/spice-uri.c
@@ -15,6 +15,7 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
 
 #include <stdlib.h>
 #include <string.h>
diff --git a/gtk/spice-widget-cairo.c b/gtk/spice-widget-cairo.c
index e0fe1ed..107b0dc 100644
--- a/gtk/spice-widget-cairo.c
+++ b/gtk/spice-widget-cairo.c
@@ -15,13 +15,11 @@
   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include "spice-widget.h"
 #include "spice-widget-priv.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 /* Some compatibility defines to let us build on both Gtk2 and Gtk3 */
 #if GTK_CHECK_VERSION (2, 91, 0)
 
diff --git a/gtk/spice-widget-x11.c b/gtk/spice-widget-x11.c
index 05b8d56..f76bf2c 100644
--- a/gtk/spice-widget-x11.c
+++ b/gtk/spice-widget-x11.c
@@ -15,13 +15,11 @@
   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include "spice-widget.h"
 #include "spice-widget-priv.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #ifdef HAVE_SYS_SHM_H
 #include <sys/shm.h>
 #endif
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index f5adf66..504a0b5 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -15,11 +15,9 @@
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
+
+#include <math.h>
 
 #if HAVE_X11_XKBLIB_H
 #include <X11/XKBlib.h>
diff --git a/gtk/vmcstream.c b/gtk/vmcstream.c
index 8cef1b0..483dd5a 100644
--- a/gtk/vmcstream.c
+++ b/gtk/vmcstream.c
@@ -15,6 +15,8 @@
   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
+#include "config.h"
+
 #include <string.h>
 
 #include "vmcstream.h"
diff --git a/gtk/vncdisplaykeymap.c b/gtk/vncdisplaykeymap.c
index 7162d63..22c6b07 100644
--- a/gtk/vncdisplaykeymap.c
+++ b/gtk/vncdisplaykeymap.c
@@ -7,6 +7,7 @@
  * published by the Free Software Foundation.
  *
  */
+#include "config.h"
 
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
-- 
1.8.5.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]