Skip to contentSkip to conversation

libvixl: Correct ordering of includes and fix NetBSD build

PATCH In review Kamil Rytarowski 3 participants 5 messages May 13, 2017 – May 15, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libvixl: Correct ordering of includes and fix NetBSD build

The __STDC_CONSTANT_MACROS symbol must be defined before including directly or indirectly <stdint.h> in order to get support for macros for integer constants like INT8_C().

The vixl/globals.h headers defines __STDC_CONSTANT_MACROS and must be included before other system headers.

This change fixes build failures on NetBSD.

---
 disas/libvixl/vixl/a64/disasm-a64.cc | 2 +-
 disas/libvixl/vixl/utils.h           | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
disas/libvixl/vixl/a64/disasm-a64.cc +1 -1
index 7a58a5c087..fc87306893 100644
@@ -24,8 +24,8 @@
 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-#include <cstdlib>
 #include "vixl/a64/disasm-a64.h"
+#include <cstdlib>
 
 namespace vixl {
 
disas/libvixl/vixl/utils.h +2 -2
index 5ab134e240..17034addbc 100644
@@ -27,10 +27,10 @@
 #ifndef VIXL_UTILS_H
 #define VIXL_UTILS_H
 
-#include <string.h>
-#include <cmath>
 #include "vixl/globals.h"
 #include "vixl/compiler-intrinsics.h"
+#include <string.h>
+#include <cmath>
 
 namespace vixl {
 
Signature · 1 line
2.12.2
#1 lore raw

Hi Kamil,

I think it is safer to add it in disas/libvixl/Makefile.objs where QEMU_CFLAGS are tuned for libvixl. This way you don't need to modify upstream libvixl.

Regards,

Phil.

Quoted 47 lines · Kamil Rytarowski

The __STDC_CONSTANT_MACROS symbol must be defined before including directly or indirectly <stdint.h> in order to get support for macros for integer constants like INT8_C().

The vixl/globals.h headers defines __STDC_CONSTANT_MACROS and must be included before other system headers.

This change fixes build failures on NetBSD.

---
 disas/libvixl/vixl/a64/disasm-a64.cc | 2 +-
 disas/libvixl/vixl/utils.h           | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
disas/libvixl/vixl/a64/disasm-a64.cc +1 -1
index 7a58a5c087..fc87306893 100644
@@ -24,8 +24,8 @@
 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-#include <cstdlib>
 #include "vixl/a64/disasm-a64.h"
+#include <cstdlib>
 
 namespace vixl {
 
disas/libvixl/vixl/utils.h +2 -2
index 5ab134e240..17034addbc 100644
@@ -27,10 +27,10 @@
 #ifndef VIXL_UTILS_H
 #define VIXL_UTILS_H
 
-#include <string.h>
-#include <cmath>
 #include "vixl/globals.h"
 #include "vixl/compiler-intrinsics.h"
+#include <string.h>
+#include <cmath>
 
 namespace vixl {
 
#2 lore raw

Hello,

I will give it a try and submit as a new patch.

Quoted 61 lines · Philippe Mathieu-Daudé

Hi Kamil,

I think it is safer to add it in disas/libvixl/Makefile.objs where QEMU_CFLAGS are tuned for libvixl.
This way you don't need to modify upstream libvixl.

Regards,

Phil.

Quoted 49 lines · Kamil Rytarowski

The __STDC_CONSTANT_MACROS symbol must be defined before including directly or indirectly <stdint.h> in order to get support for macros for integer constants like INT8_C().

The vixl/globals.h headers defines __STDC_CONSTANT_MACROS and must be included before other system headers.

This change fixes build failures on NetBSD.

---
 disas/libvixl/vixl/a64/disasm-a64.cc | 2 +-
 disas/libvixl/vixl/utils.h           | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
disas/libvixl/vixl/a64/disasm-a64.cc +0 -0
index 7a58a5c087..fc87306893 100644
@@ -24,8 +24,8 @@
 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT

OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

disas/libvixl/vixl/a64/disasm-a64.cc +1 -1
-#include <cstdlib>
 #include "vixl/a64/disasm-a64.h"
+#include <cstdlib>
 
 namespace vixl {
disas/libvixl/vixl/utils.h +2 -2
index 5ab134e240..17034addbc 100644
@@ -27,10 +27,10 @@
 #ifndef VIXL_UTILS_H
 #define VIXL_UTILS_H
 
-#include <string.h>
-#include <cmath>
 #include "vixl/globals.h"
 #include "vixl/compiler-intrinsics.h"
+#include <string.h>
+#include <cmath>
 
 namespace vixl {
 
#3 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

Hi Kamil,

I think it is safer to add it in disas/libvixl/Makefile.objs where QEMU_CFLAGS are tuned for libvixl.
This way you don't need to modify upstream libvixl.

Ah, right. disas/libvixl is one of the directories exempt from our normal rules of including osdep.h first (otherwise I would have said that including stdint.h first should be the job of osdep.h).

But indeed, that's because we are trying to leave libvixl as untouched as possible, so if there IS a solution that can be done through makefiles rather than direct file editing, it is worth considering.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#4 lore raw
Quoted 8 lines · Eric Blake
Quoted 6 lines · Philippe Mathieu-Daudé

Hi Kamil,

I think it is safer to add it in disas/libvixl/Makefile.objs where QEMU_CFLAGS are tuned for libvixl.
This way you don't need to modify upstream libvixl.

Quoted 8 lines

Ah, right. disas/libvixl is one of the directories exempt from our normal rules of including osdep.h first (otherwise I would have said that including stdint.h first should be the job of osdep.h).

But indeed, that's because we are trying to leave libvixl as untouched as possible, so if there IS a solution that can be done through makefiles rather than direct file editing, it is worth considering.

http://lists.nongnu.org/archive/html/qemu-devel/2017-05/msg03321.html