[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 13/15] qemu-common: move error-report
From: |
marcandre . lureau |
Subject: |
[PATCH v2 13/15] qemu-common: move error-report |
Date: |
Tue, 12 Jul 2022 13:35:26 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
.../qemu-common/include}/qemu/error-report.h | 2 ++
.../qemu-common/src}/error-is-detailed.c | 1 -
.../qemu-common/src}/error-report.c | 4 +++-
.../qemu-common/src/error-vprintf.c | 5 ++---
stubs/meson.build | 2 --
subprojects/qemu-common/meson.build | 20 ++++++++++++++++---
subprojects/qemu-common/src/meson.build | 5 +++++
util/meson.build | 2 +-
8 files changed, 30 insertions(+), 11 deletions(-)
rename {include => subprojects/qemu-common/include}/qemu/error-report.h (98%)
rename {stubs => subprojects/qemu-common/src}/error-is-detailed.c (77%)
rename {util => subprojects/qemu-common/src}/error-report.c (99%)
rename stubs/error-printf.c => subprojects/qemu-common/src/error-vprintf.c
(78%)
create mode 100644 subprojects/qemu-common/src/meson.build
diff --git a/include/qemu/error-report.h
b/subprojects/qemu-common/include/qemu/error-report.h
similarity index 98%
rename from include/qemu/error-report.h
rename to subprojects/qemu-common/include/qemu/error-report.h
index 6ab25d458350..c62dd1a633b8 100644
--- a/include/qemu/error-report.h
+++ b/subprojects/qemu-common/include/qemu/error-report.h
@@ -13,6 +13,8 @@
#ifndef QEMU_ERROR_REPORT_H
#define QEMU_ERROR_REPORT_H
+#include "glib-compat.h"
+
typedef struct Location {
/* all members are private to qemu-error.c */
enum { LOC_NONE, LOC_CMDLINE, LOC_FILE } kind;
diff --git a/stubs/error-is-detailed.c
b/subprojects/qemu-common/src/error-is-detailed.c
similarity index 77%
rename from stubs/error-is-detailed.c
rename to subprojects/qemu-common/src/error-is-detailed.c
index c47cd236932f..c3d9c3454d84 100644
--- a/stubs/error-is-detailed.c
+++ b/subprojects/qemu-common/src/error-is-detailed.c
@@ -1,4 +1,3 @@
-#include "qemu/osdep.h"
#include "qemu/error-report.h"
bool error_is_detailed(void)
diff --git a/util/error-report.c b/subprojects/qemu-common/src/error-report.c
similarity index 99%
rename from util/error-report.c
rename to subprojects/qemu-common/src/error-report.c
index 4d1d66fc0650..616428fe9579 100644
--- a/util/error-report.c
+++ b/subprojects/qemu-common/src/error-report.c
@@ -10,7 +10,9 @@
* See the COPYING file in the top-level directory.
*/
-#include "qemu/osdep.h"
+#include <stdio.h>
+#include <assert.h>
+
#include "qemu/error-report.h"
/*
diff --git a/stubs/error-printf.c b/subprojects/qemu-common/src/error-vprintf.c
similarity index 78%
rename from stubs/error-printf.c
rename to subprojects/qemu-common/src/error-vprintf.c
index 1afa0f62ca26..b815d88dfe65 100644
--- a/stubs/error-printf.c
+++ b/subprojects/qemu-common/src/error-vprintf.c
@@ -1,13 +1,12 @@
-#include "qemu/osdep.h"
+#include <stdio.h>
#include "qemu/error-report.h"
-#include "monitor/monitor.h"
int error_vprintf(const char *fmt, va_list ap)
{
int ret;
if (g_test_initialized() && !g_test_subprocess() &&
- getenv("QTEST_SILENT_ERRORS")) {
+ g_getenv("QTEST_SILENT_ERRORS")) {
char *msg = g_strdup_vprintf(fmt, ap);
g_test_message("%s", msg);
ret = strlen(msg);
diff --git a/stubs/meson.build b/stubs/meson.build
index 0f3a782824f9..498b6ee0466e 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -9,8 +9,6 @@ stub_ss.add(files('cpus-get-virtual-clock.c'))
stub_ss.add(files('qemu-timer-notify-cb.c'))
stub_ss.add(files('icount.c'))
stub_ss.add(files('dump.c'))
-stub_ss.add(files('error-is-detailed.c'))
-stub_ss.add(files('error-printf.c'))
stub_ss.add(files('fdset.c'))
stub_ss.add(files('gdbstub.c'))
stub_ss.add(files('get-vm-name.c'))
diff --git a/subprojects/qemu-common/meson.build
b/subprojects/qemu-common/meson.build
index 207e53991061..05bca6d30d49 100644
--- a/subprojects/qemu-common/meson.build
+++ b/subprojects/qemu-common/meson.build
@@ -3,8 +3,22 @@ project('qemu-common', 'c',
default_options: ['c_std=gnu11']
)
-qemu_common_dep = declare_dependency(
- include_directories: include_directories('include'),
-)
+glib_dep = dependency('glib-2.0')
+inc = include_directories('include')
+
+sources = []
subdir('scripts')
+subdir('src')
+
+lib = static_library(
+ 'qemu-common', sources,
+ dependencies: [glib_dep],
+ include_directories: inc,
+)
+
+qemu_common_dep = declare_dependency(
+ link_with: lib,
+ include_directories: inc,
+ dependencies: [glib_dep],
+)
diff --git a/subprojects/qemu-common/src/meson.build
b/subprojects/qemu-common/src/meson.build
new file mode 100644
index 000000000000..d85a314065e5
--- /dev/null
+++ b/subprojects/qemu-common/src/meson.build
@@ -0,0 +1,5 @@
+sources += files(
+ 'error-is-detailed.c',
+ 'error-report.c',
+ 'error-vprintf.c',
+)
diff --git a/util/meson.build b/util/meson.build
index 8cce8f8968f6..4dae6f815e31 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -28,7 +28,7 @@ util_ss.add(files('host-utils.c'))
util_ss.add(files('bitmap.c', 'bitops.c'))
util_ss.add(files('fifo8.c'))
util_ss.add(files('cacheflush.c'))
-util_ss.add(files('error.c', 'error-report.c'))
+util_ss.add(files('error.c'))
util_ss.add(files('qemu-print.c'))
util_ss.add(files('id.c'))
util_ss.add(files('qemu-config.c', 'notify.c'))
--
2.37.0.rc0
- [PATCH v2 08/15] scripts/qapi: add required system includes to visitor, (continued)
- [PATCH v2 08/15] scripts/qapi: add required system includes to visitor, marcandre . lureau, 2022/07/12
- [PATCH v2 09/15] util: move 256-by-128 division helpers to int128, marcandre . lureau, 2022/07/12
- [PATCH v2 10/15] qemu-common: introduce a common subproject, marcandre . lureau, 2022/07/12
- [PATCH v2 11/15] qemu-common: move scripts/qapi, marcandre . lureau, 2022/07/12
- [PATCH v2 14/15] mtest2make.py: teach suite name that are just "PROJECT", marcandre . lureau, 2022/07/12
- [PATCH v2 12/15] qemu-common: move glib-compat.h, marcandre . lureau, 2022/07/12
- [PATCH v2 13/15] qemu-common: move error-report,
marcandre . lureau <=
- [PATCH v2 15/15] qemu-common: add error-report test, marcandre . lureau, 2022/07/12