qemu-patch-raspberry4/ui
Markus Armbruster d2623129a7 qom: Drop parameter @errp of object_property_add() & friends
The only way object_property_add() can fail is when a property with
the same name already exists.  Since our property names are all
hardcoded, failure is a programming error, and the appropriate way to
handle it is passing &error_abort.

Same for its variants, except for object_property_add_child(), which
additionally fails when the child already has a parent.  Parentage is
also under program control, so this is a programming error, too.

We have a bit over 500 callers.  Almost half of them pass
&error_abort, slightly fewer ignore errors, one test case handles
errors, and the remaining few callers pass them to their own callers.

The previous few commits demonstrated once again that ignoring
programming errors is a bad idea.

Of the few ones that pass on errors, several violate the Error API.
The Error ** argument must be NULL, &error_abort, &error_fatal, or a
pointer to a variable containing NULL.  Passing an argument of the
latter kind twice without clearing it in between is wrong: if the
first call sets an error, it no longer points to NULL for the second
call.  ich9_pm_add_properties(), sparc32_ledma_realize(),
sparc32_dma_realize(), xilinx_axidma_realize(), xilinx_enet_realize()
are wrong that way.

When the one appropriate choice of argument is &error_abort, letting
users pick the argument is a bad idea.

Drop parameter @errp and assert the preconditions instead.

There's one exception to "duplicate property name is a programming
error": the way object_property_add() implements the magic (and
undocumented) "automatic arrayification".  Don't drop @errp there.
Instead, rename object_property_add() to object_property_try_add(),
and add the obvious wrapper object_property_add().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200505152926.18877-15-armbru@redhat.com>
[Two semantic rebase conflicts resolved]
2020-05-15 07:07:58 +02:00
..
icons ui: install logo icons to $prefix/share/icons 2019-01-21 09:43:13 +01:00
keycodemapdb@6b3d716e2b ui: update keycodemapdb to get py3 fixes 2018-02-05 19:53:55 -02:00
shader opengl: add flipping vertex shader 2017-10-17 10:25:42 +02:00
cocoa.m ui/cocoa.m: Update documentation file and pathname 2020-03-06 11:06:55 +00:00
console-gl.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
console.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
curses.c ui/curses: Move arrays to .heap to save 74KiB of .bss 2020-03-16 23:02:25 +01:00
curses_keys.h curses: support wide input 2019-03-11 08:39:02 +01:00
cursor.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
cursor_hidden.xpm ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
cursor_left_ptr.xpm ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
egl-context.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
egl-headless.c ui/egl: fix framebuffer reads 2019-09-17 13:42:02 +02:00
egl-helpers.c ui/egl: fix framebuffer reads 2019-09-17 13:42:02 +02:00
gtk-egl.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
gtk-gl-area.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
gtk.c Compress lines for immediate return 2020-05-04 14:43:22 +02:00
input-barrier.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
input-barrier.h ui: add an embedded Barrier client 2019-09-17 13:43:22 +02:00
input-keymap.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
input-legacy.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
input-linux.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
input.c sysemu: Split sysemu/runstate.h off sysemu/sysemu.h 2019-08-16 13:37:36 +02:00
kbd-state.c Include qemu/queue.h slightly less 2019-08-16 13:31:52 +02:00
keymaps.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
keymaps.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
Makefile.objs ui: add an embedded Barrier client 2019-09-17 13:43:22 +02:00
qemu-pixman.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
qemu-x509.h ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
qemu.desktop ui: fix icon display for GTK frontend under GNOME Shell with Wayland 2019-01-21 09:43:13 +01:00
sdl2-2d.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
sdl2-gl.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
sdl2-input.c Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
sdl2.c ui/sdl: switch to new show-cursor option 2020-02-12 13:25:17 +01:00
shader.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
spice-app.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
spice-core.c sysemu: Split sysemu/runstate.h off sysemu/sysemu.h 2019-08-16 13:37:36 +02:00
spice-display.c lockable: replaced locks with lock guard macros where appropriate 2020-05-04 16:07:43 +01:00
spice-input.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
trace-events ppm-save: pass opened fd 2020-01-02 13:54:57 +04:00
vgafont.h ui: move files to ui/ and include/ui/ 2012-12-19 08:31:30 +01:00
vnc-auth-sasl.c authz: delete existing ACL implementation 2019-02-26 15:32:19 +00:00
vnc-auth-sasl.h Include qemu/main-loop.h less 2019-08-16 13:31:52 +02:00
vnc-auth-vencrypt.c authz: delete existing ACL implementation 2019-02-26 15:32:19 +00:00
vnc-auth-vencrypt.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
vnc-enc-hextile-template.h ui: vnc: finish removing TABs 2019-02-05 16:50:18 +01:00
vnc-enc-hextile.c ui: Clean up includes 2016-02-04 17:01:04 +00:00
vnc-enc-tight.c vnc: fix memory leak when vnc disconnect 2019-09-17 13:45:10 +02:00
vnc-enc-tight.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
vnc-enc-zlib.c vnc: fix memory leak when vnc disconnect 2019-09-17 13:45:10 +02:00
vnc-enc-zrle.c vnc: prioritize ZRLE compression over ZLIB 2020-01-21 07:29:03 +01:00
vnc-enc-zrle.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
vnc-enc-zrle.inc.c vnc: fix memory leak when vnc disconnect 2019-09-17 13:45:10 +02:00
vnc-enc-zywrle-template.c avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
vnc-enc-zywrle.h ui: vnc: finish removing TABs 2019-02-05 16:50:18 +01:00
vnc-jobs.c vnc: fix memleak of the "vnc-worker-output" name 2018-08-24 08:40:10 +02:00
vnc-jobs.h ui/vnc: Drop unused vnc_has_job() and vnc_jobs_clear() 2017-02-08 14:59:36 +01:00
vnc-palette.c all: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
vnc-palette.h Include qapi/qmp/qlist.h exactly where needed 2018-02-09 13:52:15 +01:00
vnc-stubs.c vnc: add qapi/error.h include to stubs 2018-02-16 12:23:21 +01:00
vnc-ws.c authz: delete existing ACL implementation 2019-02-26 15:32:19 +00:00
vnc-ws.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
vnc.c vnc: prioritize ZRLE compression over ZLIB 2020-01-21 07:29:03 +01:00
vnc.h vnc: drop Error pointer indirection in vnc_client_io_error 2019-12-18 08:36:16 +01:00
vnc_keysym.h ui: add next and prior keysyms 2017-07-27 14:23:09 +02:00
x_keymap.c ui: fix keymap detection under Xwayland 2018-04-10 11:21:54 +02:00
x_keymap.h ui: convert GTK and SDL1 frontends to keycodemapdb 2018-01-25 15:02:00 +01:00