POSIX says stddef.h provides size_t, which is the only thing we care about here. unistd.h can be missing in non-POSIX runtimes, so include stddef.h instead. Signed-off-by: Kostiantyn Kostiuk --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 6c712f8b0d..1087e8c106 100644 --- a/meson.build +++ b/meson.build @@ -1057,7 +1057,7 @@ endif if not cc.compiles(''' #include - #include + #include #define QEMU_BUILD_BUG_ON(x) \ typedef char qemu_build_bug_on[(x)?-1:1] __attribute__((unused)); -- 2.52.0 This is a change in semantics. g_ascii_strcasecmp() doesn't honour locale but strcasecmp() does. But this is OK for at least one reason: (1) QEMU always runs with the C locale so there's not an actual behaviour change here (2) we want the comparison on class names to be a plain ASCII one, not to do weird things with "I" in Turkish locales, so g_ascii_strcasecmp() is better as it's explicit about that Reviewed-by: Peter Maydell Signed-off-by: Kostiantyn Kostiuk --- qom/object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qom/object.c b/qom/object.c index ff8ede8a32..e5c0c2f53e 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1193,8 +1193,8 @@ GSList *object_class_get_list(const char *implements_type, static gint object_class_cmp(gconstpointer a, gconstpointer b, gpointer d) { - return strcasecmp(object_class_get_name((ObjectClass *)a), - object_class_get_name((ObjectClass *)b)); + return g_ascii_strcasecmp(object_class_get_name((ObjectClass *)a), + object_class_get_name((ObjectClass *)b)); } GSList *object_class_get_list_sorted(const char *implements_type, -- 2.52.0 This is a change in semantics. g_ascii_strcasecmp() doesn't honour locale but strcasecmp() does. But this is OK for at least one reason: (1) QEMU always runs with the C locale so there's not an actual behaviour change here (2) we want the comparison on url prefix and it should be a plain ASCII one, not to do weird things with "I" in Turkish locales, so g_ascii_strcasecmp() is better as it's explicit about that Signed-off-by: Kostiantyn Kostiuk --- block/curl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/curl.c b/block/curl.c index 66aecfb20e..bb72962d25 100644 --- a/block/curl.c +++ b/block/curl.c @@ -871,8 +871,8 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, goto out; } - if ((!strncasecmp(s->url, "http://", strlen("http://")) - || !strncasecmp(s->url, "https://", strlen("https://"))) + if ((!g_ascii_strncasecmp(s->url, "http://", strlen("http://")) + || !g_ascii_strncasecmp(s->url, "https://", strlen("https://"))) && !s->accept_range) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, "Server does not support 'range' (byte ranges)."); -- 2.52.0 This is a change in semantics. g_ascii_strcasecmp() doesn't honour locale but strcasecmp() does. But this is OK for at least one reason: (1) QEMU always runs with the C locale so there's not an actual behaviour change here (2) we want the comparison data in HTTP header and it should be a plain ASCII one, not to do weird things with "I" in Turkish locales, so g_ascii_strcasecmp() is better as it's explicit about that Signed-off-by: Kostiantyn Kostiuk --- io/channel-websock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/io/channel-websock.c b/io/channel-websock.c index 9902b014f7..85b22a8822 100644 --- a/io/channel-websock.c +++ b/io/channel-websock.c @@ -457,7 +457,7 @@ static void qio_channel_websock_handshake_process(QIOChannelWebsock *ioc, connectionv = g_strsplit(connection, ",", 0); for (i = 0; connectionv != NULL && connectionv[i] != NULL; i++) { g_strstrip(connectionv[i]); - if (strcasecmp(connectionv[i], + if (g_ascii_strcasecmp(connectionv[i], QIO_CHANNEL_WEBSOCK_CONNECTION_UPGRADE) == 0) { upgraded = true; } @@ -468,7 +468,7 @@ static void qio_channel_websock_handshake_process(QIOChannelWebsock *ioc, goto bad_request; } - if (strcasecmp(upgrade, QIO_CHANNEL_WEBSOCK_UPGRADE_WEBSOCKET) != 0) { + if (g_ascii_strcasecmp(upgrade, QIO_CHANNEL_WEBSOCK_UPGRADE_WEBSOCKET) != 0) { error_setg(errp, "Incorrect upgrade method '%s'", upgrade); goto bad_request; } -- 2.52.0 This is a change in semantics. g_ascii_strcasecmp() doesn't honour locale but strcasecmp() does. But this is OK for at least one reason: (1) QEMU always runs with the C locale so there's not an actual behaviour change here (2) we want the comparison on boot names to be a plain ASCII one, not to do weird things with "I" in Turkish locales, so g_ascii_strcasecmp() is better as it's explicit about that Signed-off-by: Kostiantyn Kostiuk --- hw/arm/xilinx_zynq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index d43f36b718..e3cfeb4c08 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -186,13 +186,13 @@ static void zynq_set_boot_mode(Object *obj, const char *str, ZynqMachineState *m = ZYNQ_MACHINE(obj); uint8_t mode = 0; - if (!strncasecmp(str, "qspi", 4)) { + if (!g_ascii_strncasecmp(str, "qspi", 4)) { mode = 1; - } else if (!strncasecmp(str, "sd", 2)) { + } else if (!g_ascii_strncasecmp(str, "sd", 2)) { mode = 5; - } else if (!strncasecmp(str, "nor", 3)) { + } else if (!g_ascii_strncasecmp(str, "nor", 3)) { mode = 2; - } else if (!strncasecmp(str, "jtag", 4)) { + } else if (!g_ascii_strncasecmp(str, "jtag", 4)) { mode = 0; } else { error_setg(errp, "%s boot mode not supported", str); -- 2.52.0 This is a change in semantics. g_ascii_strcasecmp() doesn't honour locale but strcasecmp() does. But this is OK for at least one reason: (1) QEMU always runs with the C locale so there's not an actual behaviour change here (2) we want the comparison on boolean property value to be a plain ASCII one, not to do weird things with "I" in Turkish locales, so g_ascii_strcasecmp() is better as it's explicit about that Signed-off-by: Kostiantyn Kostiuk --- target/sparc/cpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 1493336e7a..7704610428 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -174,10 +174,10 @@ static void sparc_cpu_parse_features(const char *typename, char *features, * TODO: remove minus-override-plus semantics after * warning for a few releases */ - if (!strcasecmp(val, "on") || - !strcasecmp(val, "off") || - !strcasecmp(val, "true") || - !strcasecmp(val, "false")) { + if (!g_ascii_strcasecmp(val, "on") || + !g_ascii_strcasecmp(val, "off") || + !g_ascii_strcasecmp(val, "true") || + !g_ascii_strcasecmp(val, "false")) { error_setg(errp, "Boolean properties in format %s=%s" " are not supported", name, val); return; -- 2.52.0 This is a change in semantics. g_ascii_strcasecmp() doesn't honour locale but strcasecmp() does. But this is OK for at least one reason: (1) QEMU always runs with the C locale so there's not an actual behaviour change here Signed-off-by: Kostiantyn Kostiuk --- target/riscv/monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c index a9d3111444..bca04a7580 100644 --- a/target/riscv/monitor.c +++ b/target/riscv/monitor.c @@ -303,7 +303,7 @@ static bool reg_is_vreg(const char *name) } for (int i = 0; i < 32; i++) { - if (strcasecmp(name, riscv_rvv_regnames[i]) == 0) { + if (g_ascii_strcasecmp(name, riscv_rvv_regnames[i]) == 0) { return true; } } @@ -358,7 +358,7 @@ int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval) continue; } - if (strcasecmp(csr_ops[csrno].name, name) != 0) { + if (g_ascii_strcasecmp(csr_ops[csrno].name, name) != 0) { continue; } -- 2.52.0 This is a change in semantics. g_ascii_strcasecmp() doesn't honour locale but strcasecmp() does. But this is OK for at least one reason: (1) QEMU always runs with the C locale so there's not an actual behaviour change here Signed-off-by: Kostiantyn Kostiuk --- target/ppc/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 41bd03ec2a..25c28ad089 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2653,7 +2653,7 @@ static int kvm_ppc_register_host_cpu_type(void) */ dc = DEVICE_CLASS(ppc_cpu_get_family_class(pvr_pcc)); for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) { - if (strcasecmp(ppc_cpu_aliases[i].alias, dc->desc) == 0) { + if (g_ascii_strcasecmp(ppc_cpu_aliases[i].alias, dc->desc) == 0) { char *suffix; ppc_cpu_aliases[i].model = g_strdup(object_class_get_name(oc)); -- 2.52.0 This is a change in semantics. g_ascii_strcasecmp() doesn't honour locale but strcasecmp() does. But this is OK for at least one reason: (1) QEMU always runs with the C locale so there's not an actual behaviour change here Signed-off-by: Kostiantyn Kostiuk --- target/xtensa/xtensa-isa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/xtensa/xtensa-isa.c b/target/xtensa/xtensa-isa.c index 630b4f9da1..c564af340f 100644 --- a/target/xtensa/xtensa-isa.c +++ b/target/xtensa/xtensa-isa.c @@ -370,7 +370,7 @@ int xtensa_isa_name_compare(const void *v1, const void *v2) xtensa_lookup_entry *e1 = (xtensa_lookup_entry *)v1; xtensa_lookup_entry *e2 = (xtensa_lookup_entry *)v2; - return strcasecmp(e1->key, e2->key); + return g_ascii_strcasecmp(e1->key, e2->key); } @@ -513,7 +513,7 @@ xtensa_format xtensa_format_lookup(xtensa_isa isa, const char *fmtname) } for (fmt = 0; fmt < intisa->num_formats; fmt++) { - if (strcasecmp(fmtname, intisa->formats[fmt].name) == 0) { + if (g_ascii_strcasecmp(fmtname, intisa->formats[fmt].name) == 0) { return fmt; } } -- 2.52.0 This is a change in semantics. g_ascii_strcasecmp() doesn't honour locale but strcasecmp() does. But this is OK for at least one reason: (1) QEMU always runs with the C locale so there's not an actual behaviour change here Signed-off-by: Kostiantyn Kostiuk --- hw/ppc/spapr_caps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 170795ad6a..f4a26a85b5 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -129,7 +129,7 @@ static void spapr_cap_set_string(Object *obj, Visitor *v, const char *name, return; } for (i = 0; i < cap->possible->num; i++) { - if (!strcasecmp(val, cap->possible->vals[i])) { + if (!g_ascii_strcasecmp(val, cap->possible->vals[i])) { spapr->cmd_line_caps[cap->index] = true; spapr->eff.caps[cap->index] = i; return; -- 2.52.0 We don't use strcasecmp/strncasecmp anymore. Also, we don't use any other strings.h function. So this include is no more needed. Signed-off-by: Kostiantyn Kostiuk --- include/qemu/osdep.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 92856decd4..3718fae351 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -114,7 +114,6 @@ QEMU_EXTERN_C int daemon(int, int); #include #include -#include #include #include /* Put unistd.h before time.h as that triggers localtime_r/gmtime_r -- 2.52.0 This one is OK to drop, because the rewrite of path.c in commit f3a8bdc1d5b26 removed the uses of the dirent.h functions. Signed-off-by: Kostiantyn Kostiuk --- util/path.c | 1 - 1 file changed, 1 deletion(-) diff --git a/util/path.c b/util/path.c index 8e174eb436..72a255890e 100644 --- a/util/path.c +++ b/util/path.c @@ -5,7 +5,6 @@ */ #include "qemu/osdep.h" #include -#include #include "qemu/cutils.h" #include "qemu/path.h" #include "qemu/thread.h" -- 2.52.0 We dropped the use of PATH_MAX in commit f3a8bdc1d5b26 (which basically completely rewrote the path handling). Now we don't need any sys/param.h defines. Reviewed-by: Peter Maydell Signed-off-by: Kostiantyn Kostiuk --- util/path.c | 1 - 1 file changed, 1 deletion(-) diff --git a/util/path.c b/util/path.c index 72a255890e..e1565894d2 100644 --- a/util/path.c +++ b/util/path.c @@ -4,7 +4,6 @@ The assumption is that this area does not change. */ #include "qemu/osdep.h" -#include #include "qemu/cutils.h" #include "qemu/path.h" #include "qemu/thread.h" -- 2.52.0 From: Paolo Bonzini Reviewed-by: Kevin Wolf Signed-off-by: Paolo Bonzini --- meson.build | 8 ++++---- storage-daemon/meson.build | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/meson.build b/meson.build index 1087e8c106..4a3fc306b7 100644 --- a/meson.build +++ b/meson.build @@ -4507,15 +4507,15 @@ if xkbcommon.found() endif if have_tools - link_args = enable_modules ? ['@block.syms'] : [] + tools_link_args = enable_modules ? ['@block.syms'] : [] qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep], - link_args: link_args, link_depends: block_syms, + link_args: tools_link_args, link_depends: block_syms, dependencies: [authz, block, crypto, io, qom, qemuutil], install: true) qemu_io = executable('qemu-io', files('qemu-io.c'), - link_args: link_args, link_depends: block_syms, + link_args: tools_link_args, link_depends: block_syms, dependencies: [block, qemuutil], install: true) qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'), - link_args: link_args, link_depends: block_syms, + link_args: tools_link_args, link_depends: block_syms, dependencies: [blockdev, qemuutil, selinux], install: true) diff --git a/storage-daemon/meson.build b/storage-daemon/meson.build index 5e61a9d1bd..fc088cbea7 100644 --- a/storage-daemon/meson.build +++ b/storage-daemon/meson.build @@ -1,14 +1,14 @@ +assert(have_tools) + qsd_ss = ss.source_set() qsd_ss.add(files('qemu-storage-daemon.c')) qsd_ss.add(blockdev, chardev, qmp, qom, qemuutil) subdir('qapi') -if have_tools - qsd_ss = qsd_ss.apply({}) - qsd = executable('qemu-storage-daemon', - qsd_ss.sources(), - link_args: '@block.syms', link_depends: block_syms, - dependencies: qsd_ss.dependencies(), - install: true) -endif +qsd_ss = qsd_ss.apply({}) +qsd = executable('qemu-storage-daemon', + qsd_ss.sources(), + link_args: tools_link_args, link_depends: block_syms, + dependencies: qsd_ss.dependencies(), + install: true) -- 2.52.0 In the MSVC build environment, nm is missing; at the same time, scripts/undefsym.py exits with code 0 at the beginning for non-modular builds. So, this change is harmless because it already didn't do anything in non-modular builds, but remove the additional tool requirements. Signed-off-by: Kostiantyn Kostiuk --- meson.build | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/meson.build b/meson.build index 4a3fc306b7..cc9e9784e9 100644 --- a/meson.build +++ b/meson.build @@ -3908,6 +3908,9 @@ modinfo_generate = find_program('scripts/modinfo-generate.py') modinfo_files = [] audio_modinfo_files = [] +block_syms = [] +qemu_syms = [] + block_mods = [] system_mods = [] emulator_modules = [] @@ -4023,18 +4026,18 @@ if enable_modules if emulator_modules.length() > 0 alias_target('modules', emulator_modules) endif -endif -nm = find_program('nm') -undefsym = find_program('scripts/undefsym.py') -block_syms = custom_target('block.syms', output: 'block.syms', - input: [libqemuutil, block_mods], - capture: true, - command: [undefsym, nm, '@INPUT@']) -qemu_syms = custom_target('qemu.syms', output: 'qemu.syms', - input: [libqemuutil, system_mods], - capture: true, - command: [undefsym, nm, '@INPUT@']) + nm = find_program('nm') + undefsym = find_program('scripts/undefsym.py') + block_syms = custom_target('block.syms', output: 'block.syms', + input: [libqemuutil, block_mods], + capture: true, + command: [undefsym, nm, '@INPUT@']) + qemu_syms = custom_target('qemu.syms', output: 'qemu.syms', + input: [libqemuutil, system_mods], + capture: true, + command: [undefsym, nm, '@INPUT@']) +endif authz_ss = authz_ss.apply({}) libauthz = static_library('authz', authz_ss.sources() + genh, -- 2.52.0