diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2026-05-26 17:51:44 -0700 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2026-05-26 21:57:19 -0700 |
| commit | 5d8bb14d3b90513ed1a849ebbafb82a7734d9c8c (patch) | |
| tree | e18857682723d21a44846a44aa8288d35b216eff /test | |
| parent | ca5e9976b1498dd6244c8c9d138375d3bcf4569a (diff) | |
Omit useless casts found by GCC 16
GCC 16’s -Wuseless-cast warning can be useful.
Fix the useless casts it identifies, and also fix false positives
by using compound literals, which are safer anyway than casts.
* src/composite.c (composition_adjust_point)
(Ffind_composition_internal):
* lwlib/xlwmenu.c (xlwMenuResources, xlwMenuClassRec)
(resource_widget_value, XlwMenuDestroy, Select):
* src/alloc.c (process_mark_stack):
* src/data.c (Faref):
* src/emacs-module.c (module_extract_big_integer):
* src/fileio.c (Finsert_file_contents):
* src/frame.h (FRAME_MESSAGE_BUF_SIZE):
* src/gtkutil.c (xg_tool_item_stale_p, update_frame_tool_bar):
* src/image.c (pbm_load, png_load_body, jpeg_load_body)
(tiff_load, gif_load):
* src/pdumper.c (ptrdiff_t_to_dump_off, dump_queue_dequeue)
(field_relpos, dump_field_emacs_ptr)
(dump_object_start_pseudovector, pdumper_remember_scalar_impl)
(pdumper_load, syms_of_pdumper):
* src/regex-emacs.c (BUF_PUSH, BUF_PUSH_2, POINTER_TO_OFFSET):
* src/xdisp.c (remember_mouse_glyph, pint2str):
* src/xterm.c (cvt_string_to_pixel, handle_one_xevent):
Omit useless casts. Perhaps they were formerly needed,
but they should not be needed now.
* src/alloc.c (Fmemory_info):
* src/category.c (Fdefine_category, Fmodify_category_entry):
* src/data.c (Fash):
* src/dispextern.h (GLYPH_CODE_P):
* src/emacs.c (load_seccomp):
* src/fns.c (Flocale_info, maybe_resize_hash_table):
* src/indent.c (check_display_width):
* src/json.c (symset_size):
* src/lisp.h (XUNTAG, BOOL_VECTOR_LENGTH_MAX, obarray_size)
(hash_table_index_size):
* src/lread.c (make_obarray, grow_obarray, Fobarray_clear):
* src/menu.c (digest_single_submenu, x_popup_menu_1):
* src/term.c (init_tty):
* src/widget.c (update_wm_hints):
* src/xdisp.c (truncate_echo_area):
* src/xfns.c (x_set_border_pixel):
* src/xfont.c (xfont_match, xfont_open):
* src/xmenu.c (set_frame_menubar):
* test/src/emacs-module-resources/mod-test.c (emacs_module_init):
Use compound literal instead of a cast that is useless in
some platforms but not others.
* src/dispextern.h, src/haikugui.h, src/w32gui.h:
(WINDOW_HANDLE_UINTPTR): New macro.
* src/frame.c (gui_report_frame_params):
* src/xterm.c (x_try_cr_xlib_drawable):
Use it.
* src/lisp.h (XUNTAG): And tag with UINTPTR_MAX to pacify
gcc warning about a constant out of range.
(hash_idx_t): Make it int_least32_t, as it need not be exactly 32 bits.
(PRIdHASH_IDX): New macro.
* src/pdumper.c (dump_queue_dequeue): Use it.
* src/profiler.c (setup_cpu_timer): Make a local EMACS_INT
rather than int, to avoid need for casting later.
* src/syntax.c (uninitialized_interval):
Use 1u rather than 1 so the cast is always useful.
A compound literal wouldn’t do here, as this macro
needs to be an integer constant expression.
* src/xfns.c (XICCallback, XICProc): Remove macros.
(Xxic_preedit_start_callback): Use a cleaner way to specify it,
avoiding the need for type macros, and for a cast
if HAVE_XICCALLBACK_CALLBACK.
* src/xterm.c (handle_one_xevent): 2nd arg is now XEvent *
on all platforms, as there is no need to diverge, and
diverging meant we needed lots of unnecessary casts.
Diffstat (limited to 'test')
| -rw-r--r-- | test/src/emacs-module-resources/mod-test.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/src/emacs-module-resources/mod-test.c b/test/src/emacs-module-resources/mod-test.c index a5aeda0a666..3dabca1aa43 100644 --- a/test/src/emacs-module-resources/mod-test.c +++ b/test/src/emacs-module-resources/mod-test.c @@ -794,7 +794,7 @@ emacs_module_init (struct emacs_runtime *ert) { fprintf (stderr, "Runtime size of runtime structure (%"pT" bytes) " "smaller than compile-time size (%"pZ" bytes)", - (T_TYPE) ert->size, (Z_TYPE) sizeof (*ert)); + (T_TYPE) {ert->size}, (Z_TYPE) {sizeof (*ert)}); return 1; } @@ -804,7 +804,7 @@ emacs_module_init (struct emacs_runtime *ert) { fprintf (stderr, "Runtime size of environment structure (%"pT" bytes) " "smaller than compile-time size (%"pZ" bytes)", - (T_TYPE) env->size, (Z_TYPE) sizeof (*env)); + (T_TYPE) {env->size}, (Z_TYPE) {sizeof (*env)}); return 2; } |
