aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbusbind.c
diff options
context:
space:
mode:
authorPaul Eggert2022-05-12 17:01:10 -0700
committerPaul Eggert2022-05-12 17:03:55 -0700
commit0f731c49e6a8ccf3aa4c30c3f8ca82ed0a2cefb7 (patch)
treef675d5245b560aaaeae1c95f52df8ec882631d75 /src/dbusbind.c
parent454caf858d92a87dc781bc35b421d5014a312bb9 (diff)
downloademacs-0f731c49e6a8ccf3aa4c30c3f8ca82ed0a2cefb7.tar.gz
emacs-0f731c49e6a8ccf3aa4c30c3f8ca82ed0a2cefb7.zip
Pacify GCC 12 in default developer build
This lets ‘./configure; make’ work on Fedora 36 x86-64 from a Git checkout without generating false-alarm warnings. * lib-src/etags.c (main): There appeared to be false alarm with GCC 12. However, the code was wrong anyway, as it mishandled file names containing "'" so fix that bug. This pacifies GCC. (mercury_decl): Omit tests ‘s + pos != NULL’ that were apparently intended to be ‘s[pos] != '\0'’ but which were miscoded to always be true and which were mostly not needed anyway. In one place, though, a test was needed, so fix that by using strchr instead. * src/alloc.c (lisp_free) [!GC_MALLOC_CHECK]: * src/term.c (Fsuspend_tty): Don’t look at a pointer after freeing it, even just to test it for equality with some other pointer, as this has undefined behavior in C and GCC 12 diagnoses this. * src/dbusbind.c (xd_read_message_1): Rework the code a bit so that it has fewer tests. This pacifies GCC 12 which was complaining incorrectly about dereferencing a null pointer. * src/intervals.c (copy_properties): Remove an eassume that should no longer be needed even to pacify older GCCs, due to ... * src/intervals.h (split_interval_left): ... this addition of ATTRIBUTE_RETURNS_NONNULL to pacify a GCC 12 warning about dereferencing a null pointer. * src/regex-emacs.c (EXTEND_BUFFER): Use negative values rather than auxiliary booleans to indicate null pointers. This pacifies GCC 12 false alarms about using uninitialized variables. * src/xdisp.c (clear_position): New function. (append_space_for_newline, extend_face_to_end_of_line): Use it to work around false alarms from GCC 12. (display_and_set_cursor): Add an UNINIT to pacify GCC 12. * src/xterm.c (x_draw_glyphless_glyph_string_foreground): Defend against hypothetical bad code elsewhere; this also pacifies GCC 12. (x_term_init): Use fixed-size auto array rather than alloca, as the array is small; this also pacifies GCC 12.
Diffstat (limited to 'src/dbusbind.c')
-rw-r--r--src/dbusbind.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 7cfdbbe23cf..943a4aff8e7 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1690,29 +1690,30 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
1690 value = Fgethash (key, Vdbus_registered_objects_table, Qnil); 1690 value = Fgethash (key, Vdbus_registered_objects_table, Qnil);
1691 1691
1692 /* Loop over the registered functions. Construct an event. */ 1692 /* Loop over the registered functions. Construct an event. */
1693 while (!NILP (value)) 1693 for (; !NILP (value); value = CDR_SAFE (value))
1694 { 1694 {
1695 key = CAR_SAFE (value); 1695 key = CAR_SAFE (value);
1696 Lisp_Object key_uname = CAR_SAFE (key);
1696 /* key has the structure (UNAME SERVICE PATH HANDLER). */ 1697 /* key has the structure (UNAME SERVICE PATH HANDLER). */
1697 if (((uname == NULL) 1698 if (uname && !NILP (key_uname)
1698 || (NILP (CAR_SAFE (key))) 1699 && strcmp (uname, SSDATA (key_uname)) != 0)
1699 || (strcmp (uname, SSDATA (CAR_SAFE (key))) == 0)) 1700 continue;
1700 && ((path == NULL) 1701 Lisp_Object key_service_etc = CDR_SAFE (key);
1701 || (NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) 1702 Lisp_Object key_path_etc = CDR_SAFE (key_service_etc);
1702 || (strcmp (path, 1703 Lisp_Object key_path = CAR_SAFE (key_path_etc);
1703 SSDATA (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) 1704 if (path && !NILP (key_path)
1704 == 0)) 1705 && strcmp (path, SSDATA (key_path)) != 0)
1705 && (!NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (key))))))) 1706 continue;
1706 { 1707 Lisp_Object handler = CAR_SAFE (CDR_SAFE (key_path_etc));
1707 EVENT_INIT (event); 1708 if (NILP (handler))
1708 event.kind = DBUS_EVENT; 1709 continue;
1709 event.frame_or_window = Qnil; 1710
1710 /* Handler. */ 1711 /* Construct an event and exit the loop. */
1711 event.arg 1712 EVENT_INIT (event);
1712 = Fcons (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (key)))), args); 1713 event.kind = DBUS_EVENT;
1713 break; 1714 event.frame_or_window = Qnil;
1714 } 1715 event.arg = Fcons (handler, args);
1715 value = CDR_SAFE (value); 1716 break;
1716 } 1717 }
1717 1718
1718 if (NILP (value)) 1719 if (NILP (value))