Skip to contentSkip to conversation

modules: Fix building with --enable-modules

PATCH Applied Fam Zheng 4 participants 4 messages Feb 26, 2014 – Feb 28, 2014

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH v2 1/1 modules: Fix building with --enable-modules

Compiling util/modules.c with modules enabled fails now.

Fix it by including qemu-common.h before #ifdef testing in module.c.

---
 util/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
util/module.c +1 -1
index dc08c16..863a8a3 100644
@@ -14,10 +14,10 @@
  */
 
 #include <stdlib.h>
+#include "qemu-common.h"
 #ifdef CONFIG_MODULES
 #include <gmodule.h>
 #endif
-#include "qemu-common.h"
 #include "qemu/queue.h"
 #include "qemu/module.h"
 
Signature · 1 line
1.9.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 27 lines · Fam Zheng

Compiling util/modules.c with modules enabled fails now.

Fix it by including qemu-common.h before #ifdef testing in module.c.

---
 util/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
util/module.c +1 -1
index dc08c16..863a8a3 100644
@@ -14,10 +14,10 @@
  */
 
 #include <stdlib.h>
+#include "qemu-common.h"
 #ifdef CONFIG_MODULES
 #include <gmodule.h>
 #endif
-#include "qemu-common.h"
 #include "qemu/queue.h"
 #include "qemu/module.h"
 
Signature · 1 line
1.9.0
#2 lore raw
In reply to Fam Zheng
Quoted 14 lines · Fam Zheng

Compiling util/modules.c with modules enabled fails now.

Fix it by including qemu-common.h before #ifdef testing in module.c.

---
 util/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
util/module.c +0 -0
index dc08c16..863a8a3 100644

util/module.c line 22

Quoted 10 lines
util/module.c +1 -1
@@ -14,10 +14,10 @@
  */
 
 #include <stdlib.h>
+#include "qemu-common.h"
 #ifdef CONFIG_MODULES
 #include <gmodule.h>
 #endif
-#include "qemu-common.h"
 #include "qemu/queue.h"
 #include "qemu/module.h"

I'm not objecting to quickly fixing the build this way.

However, your patch violates the rule "external headers before our own headers". The rule exists to avoid our headers messing up the external ones.

I like Autoconf's convention to solve this problem: every .c includes the header generated by configure before anything else, and nothing else includes it. This ensures that all our code sees the configuration defines, and that external headers get only exposed to configuration defines, not to random other crap.

Opinions?