diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c index 12aeac8b16f..9dc27929517 100644 --- a/lwlib/xlwmenu.c +++ b/lwlib/xlwmenu.c @@ -118,7 +118,7 @@ xlwMenuResources[] = {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), offset(menu.foreground), XtRString, "XtDefaultForeground"}, {XtNdisabledForeground, XtCDisabledForeground, XtRPixel, sizeof(Pixel), - offset(menu.disabled_foreground), XtRString, (XtPointer)NULL}, + offset(menu.disabled_foreground), XtRString, NULL}, {XtNbuttonForeground, XtCButtonForeground, XtRPixel, sizeof(Pixel), offset(menu.button_foreground), XtRString, "XtDefaultForeground"}, {XtNhighlightForeground, XtCHighlightForeground, XtRPixel, sizeof(Pixel), @@ -147,17 +147,17 @@ xlwMenuResources[] = offset (menu.bottom_shadow_pixmap), XtRImmediate, (XtPointer)None}, {XtNopen, XtCCallback, XtRCallback, sizeof(XtPointer), - offset(menu.open), XtRCallback, (XtPointer)NULL}, + offset(menu.open), XtRCallback, NULL}, {XtNselect, XtCCallback, XtRCallback, sizeof(XtPointer), - offset(menu.select), XtRCallback, (XtPointer)NULL}, + offset(menu.select), XtRCallback, NULL}, {XtNhighlightCallback, XtCCallback, XtRCallback, sizeof(XtPointer), - offset(menu.highlight), XtRCallback, (XtPointer)NULL}, + offset(menu.highlight), XtRCallback, NULL}, {XtNenterCallback, XtCCallback, XtRCallback, sizeof(XtPointer), - offset(menu.enter), XtRCallback, (XtPointer)NULL}, + offset(menu.enter), XtRCallback, NULL}, {XtNleaveCallback, XtCCallback, XtRCallback, sizeof(XtPointer), - offset(menu.leave), XtRCallback, (XtPointer)NULL}, + offset(menu.leave), XtRCallback, NULL}, {XtNmenu, XtCMenu, XtRPointer, sizeof(XtPointer), - offset(menu.contents), XtRImmediate, (XtPointer)NULL}, + offset(menu.contents), XtRImmediate, NULL}, {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), offset(menu.cursor_shape), XtRString, (XtPointer)"right_ptr"}, {XtNhorizontal, XtCHorizontal, XtRInt, sizeof(int), @@ -208,7 +208,7 @@ xlwMenuActionsList [] = XlwMenuClassRec xlwMenuClassRec = { { /* CoreClass fields initialization */ - (WidgetClass) SuperClass, /* superclass */ + SuperClass, /* superclass */ "XlwMenu", /* class_name */ sizeof(XlwMenuRec), /* size */ XlwMenuClassInitialize, /* class_initialize */ @@ -430,7 +430,7 @@ resource_widget_value (XlwMenuWidget mw, widget_value *val) resourced_name = val->name; if (!val->value) { - complete_name = (char *) XtMalloc (strlen (resourced_name) + 1); + complete_name = XtMalloc (strlen (resourced_name) + 1); strcpy (complete_name, resourced_name); } else @@ -2259,7 +2259,7 @@ XlwMenuDestroy (Widget w) XlwMenuWidget mw = (XlwMenuWidget) w; if (pointer_grabbed) - ungrab_all ((Widget)w, CurrentTime); + ungrab_all (w, CurrentTime); pointer_grabbed = 0; keyboard_grabbed = 0; @@ -2773,7 +2773,7 @@ Select (Widget w, XEvent *ev, String *params, Cardinal *num_params) after the initial down-click that brought the menu up, do nothing. */ if ((selected_item == 0 - || ((widget_value *) selected_item)->call_data == 0) + || selected_item->call_data == 0) && !next_release_must_exit && (ev->xbutton.time - menu_post_event.xbutton.time < XtGetMultiClickTime (XtDisplay (w)))) diff --git a/src/alloc.c b/src/alloc.c index ed0d6f4976d..395cca304c6 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6609,7 +6609,7 @@ process_mark_stack (ptrdiff_t base_sp) case PVEC_CHAR_TABLE: case PVEC_SUB_CHAR_TABLE: - mark_char_table (ptr, (enum pvec_type) pvectype); + mark_char_table (ptr, pvectype); break; case PVEC_BOOL_VECTOR: @@ -7177,28 +7177,28 @@ respective remote host. */) #else units = 1; #endif - return list4i ((uintmax_t) si.totalram * units / 1024, - (uintmax_t) si.freeram * units / 1024, - (uintmax_t) si.totalswap * units / 1024, - (uintmax_t) si.freeswap * units / 1024); + return list4i ((uintmax_t) {si.totalram} * units / 1024, + (uintmax_t) {si.freeram} * units / 1024, + (uintmax_t) {si.totalswap} * units / 1024, + (uintmax_t) {si.freeswap} * units / 1024); #elif defined WINDOWSNT unsigned long long totalram, freeram, totalswap, freeswap; if (w32_memory_info (&totalram, &freeram, &totalswap, &freeswap) == 0) - return list4i ((uintmax_t) totalram / 1024, - (uintmax_t) freeram / 1024, - (uintmax_t) totalswap / 1024, - (uintmax_t) freeswap / 1024); + return list4i ((uintmax_t) {totalram} / 1024, + (uintmax_t) {freeram} / 1024, + (uintmax_t) {totalswap} / 1024, + (uintmax_t) {freeswap} / 1024); else return Qnil; #elif defined MSDOS unsigned long totalram, freeram, totalswap, freeswap; if (dos_memory_info (&totalram, &freeram, &totalswap, &freeswap) == 0) - return list4i ((uintmax_t) totalram / 1024, - (uintmax_t) freeram / 1024, - (uintmax_t) totalswap / 1024, - (uintmax_t) freeswap / 1024); + return list4i ((uintmax_t) {totalram} / 1024, + (uintmax_t) {freeram} / 1024, + (uintmax_t) {totalswap} / 1024, + (uintmax_t) {freeswap} / 1024); else return Qnil; #else /* not HAVE_LINUX_SYSINFO, not WINDOWSNT, not MSDOS */ diff --git a/src/category.c b/src/category.c index c5956a46cdf..6261b5a1e25 100644 --- a/src/category.c +++ b/src/category.c @@ -117,7 +117,7 @@ the current buffer's category table. */) table = check_category_table (table); if (!NILP (CATEGORY_DOCSTRING (table, XFIXNAT (category)))) - error ("Category `%c' is already defined", (int) XFIXNAT (category)); + error ("Category `%c' is already defined", (int) {XFIXNAT (category)}); SET_CATEGORY_DOCSTRING (table, XFIXNAT (category), docstring); return Qnil; @@ -347,7 +347,7 @@ then delete CATEGORY from the category set instead of adding it. */) table = check_category_table (table); if (NILP (CATEGORY_DOCSTRING (table, XFIXNAT (category)))) - error ("Undefined category: %c", (int) XFIXNAT (category)); + error ("Undefined category: %c", (int) {XFIXNAT (category)}); set_value = NILP (reset); diff --git a/src/composite.c b/src/composite.c index 2898ea9651e..55841d08cb5 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1873,8 +1873,7 @@ composition_adjust_point (ptrdiff_t last_pt, ptrdiff_t new_pt) return new_pt; /* Next check the automatic composition. */ - if (! find_automatic_composition (new_pt, (ptrdiff_t) -1, (ptrdiff_t) -1, - &beg, &end, &val, Qnil) + if (! find_automatic_composition (new_pt, -1, -1, &beg, &end, &val, Qnil) || beg == new_pt) return new_pt; for (i = 0; i < LGSTRING_GLYPH_LEN (val); i++) @@ -2074,7 +2073,7 @@ See `find-composition' for more details. */) && !NILP (BVAR (current_buffer, enable_multibyte_characters))) || (!NILP (string) && STRING_MULTIBYTE (string))) && ! inhibit_auto_composition () - && find_automatic_composition (from, to, (ptrdiff_t) -1, + && find_automatic_composition (from, to, -1, &start, &end, &gstring, string)) return list3 (make_fixnum (start), make_fixnum (end), gstring); return Qnil; @@ -2083,7 +2082,7 @@ See `find-composition' for more details. */) { ptrdiff_t s, e; - if (find_automatic_composition (from, to, (ptrdiff_t) -1, + if (find_automatic_composition (from, to, -1, &s, &e, &gstring, string) && (e <= fixed_pos ? e > end : s < start)) return list3 (make_fixnum (s), make_fixnum (e), gstring); diff --git a/src/data.c b/src/data.c index 2f245ce8061..92926eca89a 100644 --- a/src/data.c +++ b/src/data.c @@ -2583,7 +2583,7 @@ or a byte-code object. IDX starts at 0. */) if (idxval < 0 || idxval >= SCHARS (array)) args_out_of_range (array, idx); if (! STRING_MULTIBYTE (array)) - return make_fixnum ((unsigned char) SREF (array, idxval)); + return make_fixnum (SREF (array, idxval)); idxval_byte = string_char_to_byte (array, idxval); c = STRING_CHAR (SDATA (array) + idxval_byte); @@ -3587,7 +3587,7 @@ discarding bits. */) if (c == 0) return value; - if ((EMACS_INT) -1 >> 1 == -1 && FIXNUMP (value)) + if ((EMACS_INT) {-1} >> 1 == -1 && FIXNUMP (value)) { EMACS_INT shift = -c; EMACS_INT result diff --git a/src/dispextern.h b/src/dispextern.h index d08bd7ee7a9..4071ca57f72 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -185,6 +185,14 @@ typedef void *Emacs_Cursor; #ifdef HAVE_WINDOW_SYSTEM +/* Convert a window handle to uintptr_t. This default uses a compound literal, + which is good for platforms where handles are integers, as it checks + types better than a cast would. Platforms where handles are pointers + should override the default with a more-powerful cast. */ +# ifndef WINDOW_HANDLE_UINTPTR +# define WINDOW_HANDLE_UINTPTR(h) ((uintptr_t) {(h)}) +# endif + /* ``box'' structure similar to that found in the X sample server, meaning that X2 and Y2 are not actually the end of the box, but one pixel past the end of the box, which makes checking for overlaps @@ -2045,7 +2053,7 @@ GLYPH_CODE_P (Lisp_Object gc) : (RANGED_FIXNUMP (0, gc, (MAX_FACE_ID < EMACS_INT_MAX >> CHARACTERBITS - ? ((EMACS_INT) MAX_FACE_ID << CHARACTERBITS) | MAX_CHAR + ? ((EMACS_INT) {MAX_FACE_ID} << CHARACTERBITS) | MAX_CHAR : EMACS_INT_MAX)))); } diff --git a/src/emacs-module.c b/src/emacs-module.c index 3c49490e5c4..ce6c292dbb5 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -1120,7 +1120,7 @@ module_extract_big_integer (emacs_env *env, emacs_value arg, int *sign, u = -(EMACS_UINT) x; static_assert (required * bits < PTRDIFF_MAX); for (ptrdiff_t i = 0; i < required; ++i) - magnitude[i] = (emacs_limb_t) (u >> (i * bits)); + magnitude[i] = u >> (i * bits); MODULE_INTERNAL_CLEANUP (); return true; } diff --git a/src/emacs.c b/src/emacs.c index d50f817cefc..0827101da2f 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1232,7 +1232,7 @@ load_seccomp (const char *file) || stat.st_size % sizeof *program.filter != 0) { fprintf (stderr, "seccomp filter %s has invalid size %ld\n", - file, (long) stat.st_size); + file, (long) {stat.st_size}); goto out; } if (ckd_add (&program.len, stat.st_size / sizeof *program.filter, 0)) diff --git a/src/fileio.c b/src/fileio.c index e6a6670ff9d..28adb6dd5f9 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4396,7 +4396,7 @@ by calling `format-decode', which see. */) Ferase_buffer (); bset_enable_multibyte_characters (buf, Qnil); - insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0); + insert_1_both (read_buf, nread, nread, 0, 0, 0); TEMP_SET_PT_BOTH (BEG, BEG_BYTE); coding_system = calln (Vset_auto_coding_function, filename, make_fixnum (nread)); diff --git a/src/fns.c b/src/fns.c index e3d297102ca..687f0303aae 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3959,14 +3959,14 @@ The data read from the system are decoded using `locale-coding-system'. */) # endif # ifdef HAVE_LANGINFO__NL_PAPER_WIDTH if (EQ (item, Qpaper)) - /* We have to cast twice here: first to a correctly-sized integer, + /* We have to convert twice here: first to a correctly-sized integer, then to int, because that's what nl_langinfo is documented to - return for _NO_PAPER_{WIDTH,HEIGHT}. The first cast doesn't + return for _NO_PAPER_{WIDTH,HEIGHT}. The cast doesn't suffice because it could overflow an Emacs fixnum. This can happen when running under ASan, which fills allocated but uninitialized memory with 0xBE bytes. */ - return list2i ((int) (intptr_t) nl_langinfo (_NL_PAPER_WIDTH), - (int) (intptr_t) nl_langinfo (_NL_PAPER_HEIGHT)); + return list2i ((int) {(intptr_t) nl_langinfo (_NL_PAPER_WIDTH)}, + (int) {(intptr_t) nl_langinfo (_NL_PAPER_HEIGHT)}); # endif #endif /* HAVE_LANGINFO_CODESET*/ return Qnil; @@ -4987,7 +4987,7 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h) ptrdiff_t old_index_size = hash_table_index_size (h); ptrdiff_t index_bits = compute_hash_index_bits (new_size); - ptrdiff_t index_size = (ptrdiff_t)1 << index_bits; + ptrdiff_t index_size = (ptrdiff_t) {1} << index_bits; hash_idx_t *index = hash_table_alloc_bytes (index_size * sizeof *index); for (ptrdiff_t i = 0; i < index_size; i++) index[i] = -1; diff --git a/src/frame.c b/src/frame.c index 2c0a27cf47c..489ecbc7187 100644 --- a/src/frame.c +++ b/src/frame.c @@ -5458,7 +5458,7 @@ gui_report_frame_params (struct frame *f, Lisp_Object *alistptr) E.g., on MS-Windows it returns a value whose type is HANDLE, which is actually a pointer. Explicit casting avoids compiler warnings. */ - w = (uintptr_t) FRAME_NATIVE_WINDOW (f); + w = WINDOW_HANDLE_UINTPTR (FRAME_NATIVE_WINDOW (f)); store_in_alist (alistptr, Qwindow_id, make_formatted_string ("%"PRIuMAX, w)); #ifdef HAVE_X_WINDOWS @@ -5466,7 +5466,7 @@ gui_report_frame_params (struct frame *f, Lisp_Object *alistptr) /* Tooltip frame may not have this widget. */ if (FRAME_X_OUTPUT (f)->widget) #endif - w = (uintptr_t) FRAME_OUTER_WINDOW (f); + w = WINDOW_HANDLE_UINTPTR (FRAME_OUTER_WINDOW (f)); store_in_alist (alistptr, Qouter_window_id, make_formatted_string ("%"PRIuMAX, w)); #endif @@ -5480,7 +5480,8 @@ gui_report_frame_params (struct frame *f, Lisp_Object *alistptr) if (FRAME_OUTPUT_DATA (f)->parent_desc == FRAME_DISPLAY_INFO (f)->root_window) tem = Qnil; else - tem = make_fixed_natnum ((uintptr_t) FRAME_OUTPUT_DATA (f)->parent_desc); + tem = make_fixed_natnum (WINDOW_HANDLE_UINTPTR + (FRAME_OUTPUT_DATA (f)->parent_desc)); store_in_alist (alistptr, Qexplicit_name, (f->explicit_name ? Qt : Qnil)); store_in_alist (alistptr, Qparent_id, tem); store_in_alist (alistptr, Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f)); diff --git a/src/frame.h b/src/frame.h index 091b112e8b9..64d8a74f36e 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1382,7 +1382,7 @@ FRAME_PARENT_FRAME (struct frame *f) width of the frame by 4 because multi-byte form may require at most 4-byte for a character. */ -#define FRAME_MESSAGE_BUF_SIZE(f) (((int) FRAME_COLS (f)) * 4) +#define FRAME_MESSAGE_BUF_SIZE(f) (4 * FRAME_COLS (f)) #define CHECK_FRAME(x) \ CHECK_TYPE (FRAMEP (x), Qframep, x) diff --git a/src/gtkutil.c b/src/gtkutil.c index df41fb91110..6b67a978cfe 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -5738,8 +5738,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name, gpointer gold_img = g_object_get_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA); #ifdef USE_CAIRO - void *old_img = (void *) gold_img; - if (old_img != img->cr_data) + if (gold_img != img->cr_data) return 1; #else Pixmap old_img = (Pixmap) gold_img; @@ -6106,7 +6105,7 @@ update_frame_tool_bar (struct frame *f) w = xg_get_image_for_pixmap (f, img, x->widget, NULL); g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, #ifdef USE_CAIRO - (gpointer)img->cr_data + img->cr_data #else (gpointer)img->pixmap #endif diff --git a/src/haikugui.h b/src/haikugui.h index 50dba6e8061..afe677c487a 100644 --- a/src/haikugui.h +++ b/src/haikugui.h @@ -36,6 +36,8 @@ struct haiku_rect typedef void *haiku; +#define WINDOW_HANDLE_UINTPTR(h) ((uintptr_t) (h)) + typedef haiku Emacs_Pixmap; typedef haiku Emacs_Window; typedef haiku Emacs_Cursor; diff --git a/src/image.c b/src/image.c index f41a08eb1a8..723443193c0 100644 --- a/src/image.c +++ b/src/image.c @@ -7840,8 +7840,7 @@ pbm_load (struct frame *f, struct image *img) /* Maybe fill in the background field while we have ximg handy. */ if (NILP (image_spec_value (img->spec, QCbackground, NULL))) - /* Casting avoids a GCC warning. */ - IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg); + IMAGE_BACKGROUND (img, f, ximg); /* Put ximg into the image. */ image_put_x_image (f, img, ximg, 0); @@ -8586,9 +8585,8 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) img->width = width; img->height = height; - /* Maybe fill in the background field while we have ximg handy. - Casting avoids a GCC warning. */ - IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg); + /* Maybe fill in the background field while we have ximg handy. */ + IMAGE_BACKGROUND (img, f, ximg); /* Put ximg into the image. */ image_put_x_image (f, img, ximg, 0); @@ -8597,8 +8595,8 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) if (mask_img) { /* Fill in the background_transparent field while we have the - mask handy. Casting avoids a GCC warning. */ - image_background_transparent (img, f, (Emacs_Pix_Context)mask_img); + mask handy. */ + image_background_transparent (img, f, mask_img); image_put_x_image (f, img, mask_img, 1); } @@ -9165,8 +9163,7 @@ jpeg_load_body (struct frame *f, struct image *img, /* Maybe fill in the background field while we have ximg handy. */ if (NILP (image_spec_value (img->spec, QCbackground, NULL))) - /* Casting avoids a GCC warning. */ - IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg); + IMAGE_BACKGROUND (img, f, ximg); /* Put ximg into the image. */ image_put_x_image (f, img, ximg, 0); @@ -9606,8 +9603,7 @@ tiff_load (struct frame *f, struct image *img) /* Maybe fill in the background field while we have ximg handy. */ if (NILP (image_spec_value (img->spec, QCbackground, NULL))) - /* Casting avoids a GCC warning on W32. */ - IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg); + IMAGE_BACKGROUND (img, f, ximg); /* Put ximg into the image. */ image_put_x_image (f, img, ximg, 0); @@ -10329,8 +10325,7 @@ gif_load (struct frame *f, struct image *img) /* Maybe fill in the background field while we have ximg handy. */ if (NILP (image_spec_value (img->spec, QCbackground, NULL))) - /* Casting avoids a GCC warning. */ - IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg); + IMAGE_BACKGROUND (img, f, ximg); /* Put ximg into the image. */ image_put_x_image (f, img, ximg, 0); diff --git a/src/indent.c b/src/indent.c index e8513fbf6f2..8f0648743bd 100644 --- a/src/indent.c +++ b/src/indent.c @@ -500,7 +500,7 @@ check_display_width (Lisp_Object window, Lisp_Object prop; EMACS_INT align_to_max = (col < MOST_POSITIVE_FIXNUM - INT_MAX - ? (EMACS_INT) INT_MAX + col + ? (EMACS_INT) {INT_MAX} + col : MOST_POSITIVE_FIXNUM); plist = XCDR (val); diff --git a/src/json.c b/src/json.c index 5186667a9d2..7174367873b 100644 --- a/src/json.c +++ b/src/json.c @@ -134,7 +134,7 @@ struct symset_tbl static inline ptrdiff_t symset_size (int bits) { - return (ptrdiff_t) 1 << bits; + return (ptrdiff_t) {1} << bits; } static struct symset_tbl * diff --git a/src/lisp.h b/src/lisp.h index d4978460f68..dd780e90c1d 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -747,10 +747,11 @@ INLINE void /* Extract A's pointer value, assuming A's Lisp type is TYPE and the extracted pointer's type is CTYPE *. When !USE_LSB_TAG this simply - extracts A's low-order bits, as (uintptr_t) LISP_WORD_TAG (type) is + extracts A's low-order bits, as LISP_WORD_TAG (type) & UINTPTR_MAX is always zero then. */ #define XUNTAG(a, type, ctype) \ - ((ctype *) ((uintptr_t) XLP (a) - (uintptr_t) LISP_WORD_TAG (type))) + ((ctype *) ((uintptr_t) XLP (a) \ + - (uintptr_t) {LISP_WORD_TAG (type) & UINTPTR_MAX})) /* A forwarding pointer to a value. It uses a generic pointer to avoid alignment bugs that could occur if it used a pointer to a @@ -1841,10 +1842,10 @@ enum #define BOOL_VECTOR_LENGTH_MAX \ min (MOST_POSITIVE_FIXNUM, \ ((INT_MULTIPLY_OVERFLOW (min (PTRDIFF_MAX, SIZE_MAX) - bool_header_size,\ - (EMACS_INT) BOOL_VECTOR_BITS_PER_CHAR) \ + (EMACS_INT) {BOOL_VECTOR_BITS_PER_CHAR}) \ ? EMACS_INT_MAX \ : ((min (PTRDIFF_MAX, SIZE_MAX) - bool_header_size) \ - * (EMACS_INT) BOOL_VECTOR_BITS_PER_CHAR)) \ + * (EMACS_INT) {BOOL_VECTOR_BITS_PER_CHAR})) \ - (BITS_PER_BITS_WORD - 1))) /* The number of data words and bytes in a bool vector with SIZE bits. */ @@ -2437,7 +2438,7 @@ make_lisp_obarray (struct Lisp_Obarray *o) INLINE ptrdiff_t obarray_size (const struct Lisp_Obarray *o) { - return (ptrdiff_t)1 << o->size_bits; + return (ptrdiff_t) {1} << o->size_bits; } Lisp_Object check_obarray_slow (Lisp_Object); @@ -2557,7 +2558,8 @@ typedef enum hash_table_weakness_t { /* The type of a hash table index, both for table indices and index (hash) indices. It's signed and a subtype of ptrdiff_t. */ -typedef int32_t hash_idx_t; +typedef int_least32_t hash_idx_t; +#define PRIdHASH_IDX PRIdLEAST32 struct Lisp_Hash_Table { @@ -2715,7 +2717,7 @@ HASH_TABLE_SIZE (const struct Lisp_Hash_Table *h) INLINE ptrdiff_t hash_table_index_size (const struct Lisp_Hash_Table *h) { - return (ptrdiff_t)1 << h->index_bits; + return (ptrdiff_t) {1} << h->index_bits; } /* Hash value for KEY in hash table H. */ diff --git a/src/lread.c b/src/lread.c index 219d64d0282..00f85114ac7 100644 --- a/src/lread.c +++ b/src/lread.c @@ -5029,7 +5029,7 @@ make_obarray (unsigned bits) struct Lisp_Obarray *o = allocate_obarray (); o->count = 0; o->size_bits = bits; - ptrdiff_t size = (ptrdiff_t)1 << bits; + ptrdiff_t size = (ptrdiff_t) {1} << bits; o->buckets = hash_table_alloc_bytes (size * sizeof *o->buckets); for (ptrdiff_t i = 0; i < size; i++) o->buckets[i] = make_fixnum (0); @@ -5053,7 +5053,7 @@ grow_obarray (struct Lisp_Obarray *o) int new_bits = o->size_bits + 1; if (new_bits > obarray_max_bits) error ("Obarray too big"); - ptrdiff_t new_size = (ptrdiff_t)1 << new_bits; + ptrdiff_t new_size = (ptrdiff_t) {1} << new_bits; o->buckets = hash_table_alloc_bytes (new_size * sizeof *o->buckets); for (ptrdiff_t i = 0; i < new_size; i++) o->buckets[i] = make_fixnum (0); @@ -5123,7 +5123,7 @@ DEFUN ("obarray-clear", Fobarray_clear, Sobarray_clear, 1, 1, 0, /* This function does not bother setting the status of its contained symbols to uninterned. It doesn't matter very much. */ int new_bits = obarray_default_bits; - int new_size = (ptrdiff_t)1 << new_bits; + int new_size = (ptrdiff_t) {1} << new_bits; Lisp_Object *new_buckets = hash_table_alloc_bytes (new_size * sizeof *new_buckets); for (ptrdiff_t i = 0; i < new_size; i++) diff --git a/src/menu.c b/src/menu.c index ff4721d35f7..6f014581939 100644 --- a/src/menu.c +++ b/src/menu.c @@ -803,9 +803,9 @@ digest_single_submenu (int start, int end, bool top_level_items) wv->lname = item_name; if (!NILP (descrip)) wv->lkey = descrip; - /* The intptr_t cast avoids a warning. There's no problem + /* The intptr_t avoids a warning. There's no problem as long as pointers have enough bits to hold small integers. */ - wv->call_data = (!NILP (def) ? (void *) (intptr_t) i : 0); + wv->call_data = (!NILP (def) ? (void *) (intptr_t) {i} : 0); if (NILP (type)) wv->button_type = BUTTON_TYPE_NONE; @@ -1272,12 +1272,12 @@ x_popup_menu_1 (Lisp_Object position, Lisp_Object menu) xpos += check_integer_range (x, (xpos < INT_MIN - MOST_NEGATIVE_FIXNUM - ? (EMACS_INT) INT_MIN - xpos + ? (EMACS_INT) {INT_MIN} - xpos : MOST_NEGATIVE_FIXNUM), INT_MAX - xpos); ypos += check_integer_range (y, (ypos < INT_MIN - MOST_NEGATIVE_FIXNUM - ? (EMACS_INT) INT_MIN - ypos + ? (EMACS_INT) {INT_MIN} - ypos : MOST_NEGATIVE_FIXNUM), INT_MAX - ypos); diff --git a/src/pdumper.c b/src/pdumper.c index 259ecf7301d..066058d2078 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -159,7 +159,7 @@ ptrdiff_t_to_dump_off (ptrdiff_t value) { eassert (DUMP_OFF_MIN <= value); eassert (value <= DUMP_OFF_MAX); - return (dump_off) value; + return value; } /* Worst-case allocation granularity on any system that might load @@ -1234,13 +1234,14 @@ dump_queue_dequeue (struct dump_queue *dump_queue, dump_off basis) dump_trace (("dump_queue_dequeue basis=%"PRIdDUMP_OFF" fancy=%"PRIdPTR - " zero=%"PRIdPTR" normal=%"PRIdPTR" strong=%"PRIdPTR" hash=%td\n"), + " zero=%"PRIdPTR" normal=%"PRIdPTR" strong=%"PRIdPTR + " hash=%"PRIdHASH_IDX"\n"), basis, dump_tailq_length (&dump_queue->fancy_weight_objects), dump_tailq_length (&dump_queue->zero_weight_objects), dump_tailq_length (&dump_queue->one_weight_normal_objects), dump_tailq_length (&dump_queue->one_weight_strong_objects), - (ptrdiff_t) XHASH_TABLE (dump_queue->link_weights)->count); + XHASH_TABLE (dump_queue->link_weights)->count); #define nr_candidates 3 struct candidate @@ -1773,7 +1774,7 @@ field_relpos (const void *in_start, const void *in_field) ever violated, make sure the two pointers indeed point into the same object, and if so, enlarge the value of PDUMPER_MAX_OBJECT_SIZE. */ eassert (relpos < PDUMPER_MAX_OBJECT_SIZE); - return (dump_off) relpos; + return relpos; } static void @@ -1967,7 +1968,7 @@ dump_field_emacs_ptr (struct dump_context *ctx, intptr_t rel_emacs_ptr = 0; if (abs_emacs_ptr) { - rel_emacs_ptr = emacs_offset ((void *)abs_emacs_ptr); + rel_emacs_ptr = emacs_offset (abs_emacs_ptr); dump_reloc_dump_to_emacs_ptr_raw (ctx, ctx->obj_offset + relpos); } cpyptr ((char *) out + relpos, &rel_emacs_ptr); @@ -1980,7 +1981,7 @@ dump_object_start_pseudovector (struct dump_context *ctx, { eassert (in_hdr->size & PSEUDOVECTOR_FLAG); ptrdiff_t vec_size = vectorlike_nbytes (in_hdr); - dump_object_start (ctx, out_hdr, (dump_off) vec_size); + dump_object_start (ctx, out_hdr, vec_size); *out_hdr = *in_hdr; } @@ -4416,7 +4417,7 @@ pdumper_remember_scalar_impl (void *mem, ptrdiff_t nbytes) { eassert (0 <= nbytes && nbytes <= INT_MAX); if (nbytes > 0) - pdumper_remember_user_data_1 (mem, (int) nbytes); + pdumper_remember_user_data_1 (mem, nbytes); } void @@ -5655,7 +5656,7 @@ pdumper_load (const char *dump_filename, char *argv0) err = PDUMPER_LOAD_BAD_FILE_TYPE; if (stat.st_size > INTPTR_MAX) goto out; - dump_size = (intptr_t) stat.st_size; + dump_size = stat.st_size; err = PDUMPER_LOAD_BAD_FILE_TYPE; if (dump_size < sizeof (*header)) @@ -5910,7 +5911,6 @@ syms_of_pdumper (void) doc: /* The fingerprint of this Emacs binary. It is a string that is supposed to be unique to each build of Emacs. */); - Vpdumper_fingerprint = make_unibyte_string ((char *) hexbuf, - sizeof hexbuf); + Vpdumper_fingerprint = make_unibyte_string (hexbuf, sizeof hexbuf); #endif /* HAVE_PDUMPER */ } diff --git a/src/profiler.c b/src/profiler.c index b8339a3c544..c9cc3f118ad 100644 --- a/src/profiler.c +++ b/src/profiler.c @@ -392,12 +392,11 @@ deliver_profiler_signal (int signal) static int setup_cpu_timer (Lisp_Object sampling_interval) { - int billion = 1000000000; + EMACS_INT billion = 1000000000; if (! RANGED_FIXNUMP (1, sampling_interval, (TYPE_MAXIMUM (time_t) < EMACS_INT_MAX / billion - ? ((EMACS_INT) TYPE_MAXIMUM (time_t) * billion - + (billion - 1)) + ? TYPE_MAXIMUM (time_t) * billion + (billion - 1) : EMACS_INT_MAX))) return -1; diff --git a/src/regex-emacs.c b/src/regex-emacs.c index 03c4ba3e4e9..d8ed8a462a1 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c @@ -175,7 +175,7 @@ ptrdiff_t emacs_re_safe_alloca = MAX_ALLOCA; (destination = SAFE_ALLOCA (nsize), \ memcpy (destination, source, osize)) -/* True if 'size1' is non-NULL and PTR is pointing anywhere inside +/* True if 'size1' is nonzero and PTR is pointing anywhere inside 'string1' or just past its end. This works if PTR is NULL, which is a good thing. */ #define FIRST_STRING_P(ptr) \ @@ -1210,7 +1210,7 @@ static bool analyze_first (struct re_pattern_buffer *bufp, #define BUF_PUSH(c) \ do { \ GET_BUFFER_SPACE (1); \ - *b++ = (unsigned char) (c); \ + *b++ = (c); \ } while (false) @@ -1218,8 +1218,8 @@ static bool analyze_first (struct re_pattern_buffer *bufp, #define BUF_PUSH_2(c1, c2) \ do { \ GET_BUFFER_SPACE (2); \ - *b++ = (unsigned char) (c1); \ - *b++ = (unsigned char) (c2); \ + *b++ = (c1); \ + *b++ = (c2); \ } while (false) @@ -3637,7 +3637,7 @@ static bool bcmp_translate (re_char *, re_char *, ptrdiff_t, #define POINTER_TO_OFFSET(ptr) \ (FIRST_STRING_P (ptr) \ ? (ptr) - string1 \ - : (ptr) - string2 + (ptrdiff_t) size1) + : (ptr) - string2 + size1) /* Call before fetching a character with *d. This switches over to string2 if necessary. diff --git a/src/syntax.c b/src/syntax.c index 7649abb1aa0..38ae2f90572 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -236,7 +236,7 @@ SYNTAX_MATCH (int c) } /* A "dummy" value we never dereference, distinct from NULL. */ -#define uninitialized_interval ((INTERVAL) (intptr_t) 1) +#define uninitialized_interval ((INTERVAL) (intptr_t) 1u) /* This should be called with FROM at the start of forward search, or after the last position of the backward search. It diff --git a/src/term.c b/src/term.c index 8047e4102a1..cd8c9717640 100644 --- a/src/term.c +++ b/src/term.c @@ -4585,7 +4585,7 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\ tty->TS_exit_attribute_mode = tgetstr ("me", address); #ifdef TERMINFO tty->TS_enter_strike_through_mode = tigetstr ("smxx"); - if (tty->TS_enter_strike_through_mode == (char *) (intptr_t) -1) + if (tty->TS_enter_strike_through_mode == (char *) (intptr_t) {-1}) tty->TS_enter_strike_through_mode = NULL; #else /* FIXME: Is calling tgetstr here for non-terminfo case correct, @@ -4621,8 +4621,8 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\ const char *bg; /* Our own non-standard support for 24-bit colors. */ if ((fg = tigetstr ("setf24")) && (bg = tigetstr ("setb24")) - && fg != (char *) (intptr_t) -1 - && bg != (char *) (intptr_t) -1) + && fg != (char *) (intptr_t) {-1} + && bg != (char *) (intptr_t) {-1}) { tty->TS_set_foreground = fg; tty->TS_set_background = bg; @@ -4630,8 +4630,8 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\ } /* Other non-standard support for 24-bit colors. */ else if ((fg = tigetstr ("setrgbf")) && (bg = tigetstr ("setrgbb")) - && fg != (char *) (intptr_t) -1 - && bg != (char *) (intptr_t) -1) + && fg != (char *) (intptr_t) {-1} + && bg != (char *) (intptr_t) {-1}) { tty->TS_set_foreground = fg; tty->TS_set_background = bg; @@ -4692,7 +4692,7 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\ common default escape sequence and is not recommended. */ #ifdef TERMINFO tty->TF_set_underline_style = tigetstr ("Smulx"); - if (tty->TF_set_underline_style == (char *) (intptr_t) -1) + if (tty->TF_set_underline_style == (char *) (intptr_t) {-1}) tty->TF_set_underline_style = NULL; #else tty->TF_set_underline_style = tgetstr ("Smulx", address); diff --git a/src/w32gui.h b/src/w32gui.h index a0e2763462b..40bc786bf06 100644 --- a/src/w32gui.h +++ b/src/w32gui.h @@ -33,6 +33,8 @@ typedef HWND Window; typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */ typedef HCURSOR Emacs_Cursor; +#define WINDOW_HANDLE_UINTPTR(h) ((uintptr_t) (h)) + /* Windows equivalent of XImage. */ typedef struct _XImage { diff --git a/src/widget.c b/src/widget.c index f05818fcc76..8aa67885047 100644 --- a/src/widget.c +++ b/src/widget.c @@ -299,12 +299,12 @@ update_wm_hints (WMShellWidget wmshell, EmacsFrame ew) + (rounded_height - (char_height * ch))); XtVaSetValues ((Widget) wmshell, - XtNbaseWidth, (XtArgVal) base_width, - XtNbaseHeight, (XtArgVal) base_height, - XtNwidthInc, (XtArgVal) (frame_resize_pixelwise ? 1 : cw), - XtNheightInc, (XtArgVal) (frame_resize_pixelwise ? 1 : ch), - XtNminWidth, (XtArgVal) base_width, - XtNminHeight, (XtArgVal) base_height, + XtNbaseWidth, (XtArgVal) {base_width}, + XtNbaseHeight, (XtArgVal) {base_height}, + XtNwidthInc, (XtArgVal) {frame_resize_pixelwise ? 1 : cw}, + XtNheightInc, (XtArgVal) {frame_resize_pixelwise ? 1 : ch}, + XtNminWidth, (XtArgVal) {base_width}, + XtNminHeight, (XtArgVal) {base_height}, NULL); /* Return if size hints really changed. If they did not, then Xt diff --git a/src/xdisp.c b/src/xdisp.c index b00a4b2e1e7..2b4af7d877e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2848,7 +2848,7 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) text_glyph: gr = 0; gy = 0; for (; r <= end_row && r->enabled_p; ++r) - if (r->y + (int) r->height > y) + if (r->y + r->height > y) { gr = r; gy = r->y; break; @@ -2948,7 +2948,7 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) row_glyph: gr = 0, gy = 0; for (; r <= end_row && r->enabled_p; ++r) - if (r->y + (int) r->height > y) + if (r->y + r->height > y) { gr = r; gy = r->y; break; @@ -13509,7 +13509,7 @@ truncate_echo_area (ptrdiff_t nchars) initialized yet, just toss it. */ if (sf->glyphs_initialized_p) with_echo_area_buffer (0, 0, truncate_message_1, - (void *) (intptr_t) nchars, Qnil); + (void *) (intptr_t) {nchars}, Qnil); } } @@ -29092,7 +29092,7 @@ pint2str (register char *buf, register int width, register ptrdiff_t d) } } - for (width -= (int) (p - buf); width > 0; --width) + for (width -= p - buf; width > 0; --width) *p++ = ' '; *p-- = '\0'; while (p > buf) diff --git a/src/xfns.c b/src/xfns.c index 976218819dd..2a1d3f5860e 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1559,7 +1559,7 @@ x_set_border_pixel (struct frame *f, unsigned long pix) { block_input (); XtVaSetValues (f->output_data.x->widget, XtNborderColor, - (Pixel) pix, NULL); + (Pixel) {pix}, NULL); unblock_input (); if (FRAME_VISIBLE_P (f)) @@ -2736,11 +2736,6 @@ static int xic_preedit_start_callback (XIC, XPointer, XPointer); static void xic_string_conversion_callback (XIC, XPointer, XIMStringConversionCallbackStruct *); -#ifndef HAVE_XICCALLBACK_CALLBACK -#define XICCallback XIMCallback -#define XICProc XIMProc -#endif - static XIMCallback Xxic_preedit_draw_callback = { NULL, @@ -2759,11 +2754,19 @@ static XIMCallback Xxic_preedit_done_callback = (XIMProc) xic_preedit_done_callback, }; +#ifdef HAVE_XICCALLBACK_CALLBACK static XICCallback Xxic_preedit_start_callback = { NULL, - (XICProc) xic_preedit_start_callback, + xic_preedit_start_callback, }; +#else +static XIMCallback Xxic_preedit_start_callback = + { + NULL, + (XIMProc) xic_preedit_start_callback, + }; +#endif static XIMCallback Xxic_string_conversion_callback = { diff --git a/src/xfont.c b/src/xfont.c index f237badcf27..441ec15fe4d 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -565,7 +565,7 @@ xfont_match (struct frame *f, Lisp_Object spec) { if (XGetFontProperty (xfont, XA_FONT, &value)) { - char *s = XGetAtomName (display, (Atom) value); + char *s = XGetAtomName (display, (Atom) {value}); /* If DXPC (a Differential X Protocol Compressor) Ver.3.7 is running, XGetAtomName will return null @@ -733,7 +733,7 @@ xfont_open (struct frame *f, Lisp_Object entity, int pixel_size) char *p0, *p; int dashes = 0; - p0 = p = XGetAtomName (FRAME_X_DISPLAY (f), (Atom) value); + p0 = p = XGetAtomName (FRAME_X_DISPLAY (f), (Atom) {value}); /* Count the number of dashes in the "full name". If it is too few, this isn't really the font's full name, so don't use it. diff --git a/src/xmenu.c b/src/xmenu.c index 924db3f0a45..35473f2db0e 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1131,7 +1131,7 @@ set_frame_menubar (struct frame *f, bool deep_p) menu item is really supposed to be empty. */ /* The intptr_t cast avoids a warning. This value just has to be different from small integers. */ - wv->call_data = (void *) (intptr_t) (-1); + wv->call_data = (void *) (intptr_t) {-1}; if (prev_wv) prev_wv->next = wv; diff --git a/src/xterm.c b/src/xterm.c index 06fe480646e..358e01c776a 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1182,15 +1182,9 @@ static bool x_handle_net_wm_state (struct frame *, const XPropertyEvent *); static void x_check_fullscreen (struct frame *); static void x_check_expected_move (struct frame *, int, int); static void x_sync_with_move (struct frame *, int, int, bool); -#ifndef HAVE_XINPUT2 -static int handle_one_xevent (struct x_display_info *, - const XEvent *, int *, - struct input_event *); -#else static int handle_one_xevent (struct x_display_info *, XEvent *, int *, struct input_event *); -#endif #if ! (defined USE_X_TOOLKIT || defined USE_MOTIF) && defined USE_GTK static int x_dispatch_event (XEvent *, Display *); #endif @@ -6187,7 +6181,9 @@ x_try_cr_xlib_drawable (struct frame *f, GC gc) cairo_destroy (buf); cairo_set_user_data (cr, &saved_drawable_key, - (void *) (uintptr_t) FRAME_X_RAW_DRAWABLE (f), NULL); + ((void *) + WINDOW_HANDLE_UINTPTR (FRAME_X_RAW_DRAWABLE (f))), + NULL); FRAME_X_RAW_DRAWABLE (f) = pixmap; cairo_surface_flush (xlib_surface); @@ -9010,7 +9006,7 @@ cvt_string_to_pixel (Display *dpy, XrmValue *args, Cardinal *nargs, screen = *(Screen **) args[0].addr; cmap = *(Colormap *) args[1].addr; - color_name = (String) from->addr; + color_name = from->addr; if (strcmp (color_name, XtDefaultBackground) == 0) { @@ -18868,11 +18864,7 @@ x_find_selection_owner (struct x_display_info *dpyinfo, Atom selection) static int handle_one_xevent (struct x_display_info *dpyinfo, -#ifndef HAVE_XINPUT2 - const XEvent *event, -#else XEvent *event, -#endif int *finish, struct input_event *hold_quit) { union buffered_input_event inev; @@ -19363,7 +19355,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (f) { _XEditResCheckMessages (f->output_data.x->widget, - NULL, (XEvent *) event, NULL); + NULL, event, NULL); goto done; } @@ -19437,7 +19429,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, == dpyinfo->Xatom_net_wm_frame_drawn) { if (any) - x_sync_handle_frame_drawn (dpyinfo, (XEvent *) event, any); + x_sync_handle_frame_drawn (dpyinfo, event, any); goto done; } @@ -19460,8 +19452,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, dx = 0; dy = 0; - rc = x_coords_from_dnd_message (dpyinfo, (XEvent *) event, - &dx, &dy); + rc = x_coords_from_dnd_message (dpyinfo, event, &dx, &dy); if (x_handle_dnd_message (f, &event->xclient, dpyinfo, &inev.ie, rc, dx, dy)) @@ -19938,12 +19929,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, expose_frame (f, event->xexpose.x, event->xexpose.y, event->xexpose.width, event->xexpose.height); #ifndef USE_TOOLKIT_SCROLL_BARS - x_scroll_bar_handle_exposure (f, (XEvent *) event); + x_scroll_bar_handle_exposure (f, event); #endif } #ifndef USE_TOOLKIT_SCROLL_BARS else - x_scroll_bar_handle_exposure (f, (XEvent *) event); + x_scroll_bar_handle_exposure (f, event); #endif #ifdef HAVE_XDBE @@ -19980,7 +19971,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, event->xgraphicsexpose.width, event->xgraphicsexpose.height); #ifndef USE_TOOLKIT_SCROLL_BARS - x_scroll_bar_handle_exposure (f, (XEvent *) event); + x_scroll_bar_handle_exposure (f, event); #endif #ifdef USE_GTK x_clear_under_internal_border (f); @@ -22215,7 +22206,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, x_find_modifier_meanings (dpyinfo); FALLTHROUGH; case MappingKeyboard: - XRefreshKeyboardMapping ((XMappingEvent *) &event->xmapping); + XRefreshKeyboardMapping (&event->xmapping); } goto OTHER; @@ -24251,7 +24242,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, { Status status_return; nbytes = XmbLookupString (FRAME_XIC (f), - &xkey, (char *) copy_bufptr, + &xkey, copy_bufptr, copy_bufsiz, &keysym, &status_return); coding = FRAME_X_XIM_CODING (f); @@ -24261,7 +24252,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, copy_bufsiz = nbytes + 1; copy_bufptr = SAFE_ALLOCA (copy_bufsiz); nbytes = XmbLookupString (FRAME_XIC (f), - &xkey, (char *) copy_bufptr, + &xkey, copy_bufptr, copy_bufsiz, &keysym, &status_return); } @@ -25494,7 +25485,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (event->type == (dpyinfo->xrandr_event_base + RRScreenChangeNotify)) - XRRUpdateConfiguration ((XEvent *) event); + XRRUpdateConfiguration (event); if (event->type == (dpyinfo->xrandr_event_base + RRScreenChangeNotify)) @@ -25566,9 +25557,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, && event->xconfigure.height != 0)) { #if defined USE_X_TOOLKIT && defined HAVE_XINPUT2 - XtDispatchEvent (use_copy ? © : (XEvent *) event); + XtDispatchEvent (use_copy ? © : event); #else - XtDispatchEvent ((XEvent *) event); + XtDispatchEvent (event); #endif } } 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; }