aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-11-03 22:09:03 -0800
committerPaul Eggert2013-11-03 22:09:03 -0800
commit91f2d272895257f23596075a0cc42e6e5f4e490f (patch)
tree5bcf0c44acc54bd56eef8394e50ff7d4cc24d5b3 /src
parent0a749fa0e64fc88bcd1772253774d7e44ecfe8ce (diff)
downloademacs-91f2d272895257f23596075a0cc42e6e5f4e490f.tar.gz
emacs-91f2d272895257f23596075a0cc42e6e5f4e490f.zip
Port to stricter C99 platforms.
Especially, C99 prohibits nesting a struct X inside struct Y if struct X has a flexible array member. Also, merge from gnulib, incorporating: 2013-11-03 intprops: port to Oracle Studio c99 * lib/intprops.h: Update from gnulib. * src/alloc.c (struct sdata): New type. (sdata): Implement in terms of struct sdata. Remove u member; all uses replaced by next_vector, set_next_vector. (SDATA_SELECTOR, SDATA_DATA, SDATA_DATA_OFFSET): Adjust to sdata change. (SDATA_DATA_OFFSET): Now a constant, not a macro. (struct sblock): Rename first_data member to data, which is now a flexible array member. All uses changed. (next_vector, set_next_vector, large_vector_vec): New functions. (vector_alignment): New constant. (roundup_size): Make it a multiple of ALIGNOF_STRUCT_LISP_VECTOR, too. (struct large-vector): Now merely a NEXT member, since the old approach ran afoul of stricter C99. All uses changed to use large_vector_vec or large_vector_offset. (large_vector_offset): New constant. * src/dispnew.c: Include tparam.h, for tgetent. Do not include term.h; no longer needed. * src/gnutls.c (Fgnutls_boot): Don't continue after calling a _Noreturn. * src/lisp.h (ENUM_BF) [__SUNPRO_C && __STDC__]: Use unsigned int. (struct Lisp_Vector): Use a flexible array member for contents, instead of a union with a member that is an array of size 1. All uses changed. (ALIGNOF_STRUCT_LISP_VECTOR): New constant, to make up for the fact that the struct no longer contains a union. (struct Lisp_Misc_Any, struct Lisp_Marker, struct Lisp_Overlay) (struct Lisp_Save_Value, struct Lisp_Free): Use unsigned, not int, for spacers, to avoid c99 warning. (union specbinding): Use unsigned, not bool, for bitfield, as bool is not portable to pre-C99 hosts.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog34
-rw-r--r--src/alloc.c168
-rw-r--r--src/buffer.c2
-rw-r--r--src/bytecode.c2
-rw-r--r--src/ccl.c8
-rw-r--r--src/character.h2
-rw-r--r--src/chartab.c4
-rw-r--r--src/composite.c2
-rw-r--r--src/composite.h8
-rw-r--r--src/dispnew.c5
-rw-r--r--src/disptab.h2
-rw-r--r--src/fns.c8
-rw-r--r--src/fontset.c2
-rw-r--r--src/gnutls.c10
-rw-r--r--src/indent.c6
-rw-r--r--src/keyboard.c16
-rw-r--r--src/lisp.h48
-rw-r--r--src/lread.c2
-rw-r--r--src/msdos.c2
-rw-r--r--src/process.c32
-rw-r--r--src/term.c2
-rw-r--r--src/w32.c2
-rw-r--r--src/w32menu.c2
-rw-r--r--src/window.c2
-rw-r--r--src/xdisp.c10
-rw-r--r--src/xfaces.c30
-rw-r--r--src/xfont.c2
-rw-r--r--src/xmenu.c4
28 files changed, 240 insertions, 177 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4815cf3f0f5..1c56a7c5996 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,37 @@
12013-11-04 Paul Eggert <eggert@cs.ucla.edu>
2
3 Port to stricter C99 platforms.
4 Especially, C99 prohibits nesting a struct X inside struct Y if
5 struct X has a flexible array member.
6 * alloc.c (struct sdata): New type.
7 (sdata): Implement in terms of struct sdata.
8 Remove u member; all uses replaced by next_vector, set_next_vector.
9 (SDATA_SELECTOR, SDATA_DATA, SDATA_DATA_OFFSET): Adjust to sdata change.
10 (SDATA_DATA_OFFSET): Now a constant, not a macro.
11 (struct sblock): Rename first_data member to data, which is now
12 a flexible array member. All uses changed.
13 (next_vector, set_next_vector, large_vector_vec): New functions.
14 (vector_alignment): New constant.
15 (roundup_size): Make it a multiple of ALIGNOF_STRUCT_LISP_VECTOR, too.
16 (struct large-vector): Now merely a NEXT member, since the old approach
17 ran afoul of stricter C99. All uses changed to use
18 large_vector_vec or large_vector_offset.
19 (large_vector_offset): New constant.
20 * dispnew.c: Include tparam.h, for tgetent.
21 Do not include term.h; no longer needed.
22 * gnutls.c (Fgnutls_boot): Don't continue after calling a _Noreturn.
23 * lisp.h (ENUM_BF) [__SUNPRO_C && __STDC__]: Use unsigned int.
24 (struct Lisp_Vector): Use a flexible array member for contents,
25 instead of a union with a member that is an array of size 1.
26 All uses changed.
27 (ALIGNOF_STRUCT_LISP_VECTOR): New constant, to make up for the
28 fact that the struct no longer contains a union.
29 (struct Lisp_Misc_Any, struct Lisp_Marker, struct Lisp_Overlay)
30 (struct Lisp_Save_Value, struct Lisp_Free):
31 Use unsigned, not int, for spacers, to avoid c99 warning.
32 (union specbinding): Use unsigned, not bool, for bitfield, as
33 bool is not portable to pre-C99 hosts.
34
12013-11-04 Glenn Morris <rgm@gnu.org> 352013-11-04 Glenn Morris <rgm@gnu.org>
2 36
3 * emacs.c (usage_message): Mention that `-L :...' appends. 37 * emacs.c (usage_message): Mention that `-L :...' appends.
diff --git a/src/alloc.c b/src/alloc.c
index f57e22d9cc0..b35f7c4333f 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1280,28 +1280,32 @@ mark_interval (register INTERVAL i, Lisp_Object dummy)
1280 1280
1281#define LARGE_STRING_BYTES 1024 1281#define LARGE_STRING_BYTES 1024
1282 1282
1283/* Struct or union describing string memory sub-allocated from an sblock. 1283/* The SDATA typedef is a struct or union describing string memory
1284 This is where the contents of Lisp strings are stored. */ 1284 sub-allocated from an sblock. This is where the contents of Lisp
1285 strings are stored. */
1285 1286
1286#ifdef GC_CHECK_STRING_BYTES 1287struct sdata
1287
1288typedef struct
1289{ 1288{
1290 /* Back-pointer to the string this sdata belongs to. If null, this 1289 /* Back-pointer to the string this sdata belongs to. If null, this
1291 structure is free, and the NBYTES member of the union below 1290 structure is free, and NBYTES (in this structure or in the union below)
1292 contains the string's byte size (the same value that STRING_BYTES 1291 contains the string's byte size (the same value that STRING_BYTES
1293 would return if STRING were non-null). If non-null, STRING_BYTES 1292 would return if STRING were non-null). If non-null, STRING_BYTES
1294 (STRING) is the size of the data, and DATA contains the string's 1293 (STRING) is the size of the data, and DATA contains the string's
1295 contents. */ 1294 contents. */
1296 struct Lisp_String *string; 1295 struct Lisp_String *string;
1297 1296
1297#ifdef GC_CHECK_STRING_BYTES
1298 ptrdiff_t nbytes; 1298 ptrdiff_t nbytes;
1299#endif
1300
1299 unsigned char data[FLEXIBLE_ARRAY_MEMBER]; 1301 unsigned char data[FLEXIBLE_ARRAY_MEMBER];
1300} sdata; 1302};
1303
1304#ifdef GC_CHECK_STRING_BYTES
1301 1305
1306typedef struct sdata sdata;
1302#define SDATA_NBYTES(S) (S)->nbytes 1307#define SDATA_NBYTES(S) (S)->nbytes
1303#define SDATA_DATA(S) (S)->data 1308#define SDATA_DATA(S) (S)->data
1304#define SDATA_SELECTOR(member) member
1305 1309
1306#else 1310#else
1307 1311
@@ -1309,12 +1313,16 @@ typedef union
1309{ 1313{
1310 struct Lisp_String *string; 1314 struct Lisp_String *string;
1311 1315
1312 /* When STRING is non-null. */ 1316 /* When STRING is nonnull, this union is actually of type 'struct sdata',
1313 struct 1317 which has a flexible array member. However, if implemented by
1314 { 1318 giving this union a member of type 'struct sdata', the union
1315 struct Lisp_String *string; 1319 could not be the last (flexible) member of 'struct sblock',
1316 unsigned char data[FLEXIBLE_ARRAY_MEMBER]; 1320 because C99 prohibits a flexible array member from having a type
1317 } u; 1321 that is itself a flexible array. So, comment this member out here,
1322 but remember that the option's there when using this union. */
1323#if 0
1324 struct sdata u;
1325#endif
1318 1326
1319 /* When STRING is null. */ 1327 /* When STRING is null. */
1320 struct 1328 struct
@@ -1325,13 +1333,11 @@ typedef union
1325} sdata; 1333} sdata;
1326 1334
1327#define SDATA_NBYTES(S) (S)->n.nbytes 1335#define SDATA_NBYTES(S) (S)->n.nbytes
1328#define SDATA_DATA(S) (S)->u.data 1336#define SDATA_DATA(S) ((struct sdata *) (S))->data
1329#define SDATA_SELECTOR(member) u.member
1330 1337
1331#endif /* not GC_CHECK_STRING_BYTES */ 1338#endif /* not GC_CHECK_STRING_BYTES */
1332 1339
1333#define SDATA_DATA_OFFSET offsetof (sdata, SDATA_SELECTOR (data)) 1340enum { SDATA_DATA_OFFSET = offsetof (struct sdata, data) };
1334
1335 1341
1336/* Structure describing a block of memory which is sub-allocated to 1342/* Structure describing a block of memory which is sub-allocated to
1337 obtain string data memory for strings. Blocks for small strings 1343 obtain string data memory for strings. Blocks for small strings
@@ -1347,8 +1353,8 @@ struct sblock
1347 of the sblock if there isn't any space left in this block. */ 1353 of the sblock if there isn't any space left in this block. */
1348 sdata *next_free; 1354 sdata *next_free;
1349 1355
1350 /* Start of data. */ 1356 /* String data. */
1351 sdata first_data; 1357 sdata data[FLEXIBLE_ARRAY_MEMBER];
1352}; 1358};
1353 1359
1354/* Number of Lisp strings in a string_block structure. The 1020 is 1360/* Number of Lisp strings in a string_block structure. The 1020 is
@@ -1464,7 +1470,7 @@ static ptrdiff_t const STRING_BYTES_MAX =
1464 min (STRING_BYTES_BOUND, 1470 min (STRING_BYTES_BOUND,
1465 ((SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD 1471 ((SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD
1466 - GC_STRING_EXTRA 1472 - GC_STRING_EXTRA
1467 - offsetof (struct sblock, first_data) 1473 - offsetof (struct sblock, data)
1468 - SDATA_DATA_OFFSET) 1474 - SDATA_DATA_OFFSET)
1469 & ~(sizeof (EMACS_INT) - 1))); 1475 & ~(sizeof (EMACS_INT) - 1)));
1470 1476
@@ -1507,7 +1513,7 @@ check_sblock (struct sblock *b)
1507 1513
1508 end = b->next_free; 1514 end = b->next_free;
1509 1515
1510 for (from = &b->first_data; from < end; from = from_end) 1516 for (from = b->data; from < end; from = from_end)
1511 { 1517 {
1512 /* Compute the next FROM here because copying below may 1518 /* Compute the next FROM here because copying below may
1513 overwrite data we need to compute it. */ 1519 overwrite data we need to compute it. */
@@ -1535,7 +1541,7 @@ check_string_bytes (bool all_p)
1535 1541
1536 for (b = large_sblocks; b; b = b->next) 1542 for (b = large_sblocks; b; b = b->next)
1537 { 1543 {
1538 struct Lisp_String *s = b->first_data.string; 1544 struct Lisp_String *s = b->data[0].string;
1539 if (s) 1545 if (s)
1540 string_bytes (s); 1546 string_bytes (s);
1541 } 1547 }
@@ -1669,7 +1675,7 @@ allocate_string_data (struct Lisp_String *s,
1669 1675
1670 if (nbytes > LARGE_STRING_BYTES) 1676 if (nbytes > LARGE_STRING_BYTES)
1671 { 1677 {
1672 size_t size = offsetof (struct sblock, first_data) + needed; 1678 size_t size = offsetof (struct sblock, data) + needed;
1673 1679
1674#ifdef DOUG_LEA_MALLOC 1680#ifdef DOUG_LEA_MALLOC
1675 /* Prevent mmap'ing the chunk. Lisp data may not be mmap'ed 1681 /* Prevent mmap'ing the chunk. Lisp data may not be mmap'ed
@@ -1691,8 +1697,8 @@ allocate_string_data (struct Lisp_String *s,
1691 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); 1697 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
1692#endif 1698#endif
1693 1699
1694 b->next_free = &b->first_data; 1700 b->next_free = b->data;
1695 b->first_data.string = NULL; 1701 b->data[0].string = NULL;
1696 b->next = large_sblocks; 1702 b->next = large_sblocks;
1697 large_sblocks = b; 1703 large_sblocks = b;
1698 } 1704 }
@@ -1703,8 +1709,8 @@ allocate_string_data (struct Lisp_String *s,
1703 { 1709 {
1704 /* Not enough room in the current sblock. */ 1710 /* Not enough room in the current sblock. */
1705 b = lisp_malloc (SBLOCK_SIZE, MEM_TYPE_NON_LISP); 1711 b = lisp_malloc (SBLOCK_SIZE, MEM_TYPE_NON_LISP);
1706 b->next_free = &b->first_data; 1712 b->next_free = b->data;
1707 b->first_data.string = NULL; 1713 b->data[0].string = NULL;
1708 b->next = NULL; 1714 b->next = NULL;
1709 1715
1710 if (current_sblock) 1716 if (current_sblock)
@@ -1858,7 +1864,7 @@ free_large_strings (void)
1858 { 1864 {
1859 next = b->next; 1865 next = b->next;
1860 1866
1861 if (b->first_data.string == NULL) 1867 if (b->data[0].string == NULL)
1862 lisp_free (b); 1868 lisp_free (b);
1863 else 1869 else
1864 { 1870 {
@@ -1885,7 +1891,7 @@ compact_small_strings (void)
1885 to, and TB_END is the end of TB. */ 1891 to, and TB_END is the end of TB. */
1886 tb = oldest_sblock; 1892 tb = oldest_sblock;
1887 tb_end = (sdata *) ((char *) tb + SBLOCK_SIZE); 1893 tb_end = (sdata *) ((char *) tb + SBLOCK_SIZE);
1888 to = &tb->first_data; 1894 to = tb->data;
1889 1895
1890 /* Step through the blocks from the oldest to the youngest. We 1896 /* Step through the blocks from the oldest to the youngest. We
1891 expect that old blocks will stabilize over time, so that less 1897 expect that old blocks will stabilize over time, so that less
@@ -1895,7 +1901,7 @@ compact_small_strings (void)
1895 end = b->next_free; 1901 end = b->next_free;
1896 eassert ((char *) end <= (char *) b + SBLOCK_SIZE); 1902 eassert ((char *) end <= (char *) b + SBLOCK_SIZE);
1897 1903
1898 for (from = &b->first_data; from < end; from = from_end) 1904 for (from = b->data; from < end; from = from_end)
1899 { 1905 {
1900 /* Compute the next FROM here because copying below may 1906 /* Compute the next FROM here because copying below may
1901 overwrite data we need to compute it. */ 1907 overwrite data we need to compute it. */
@@ -1932,7 +1938,7 @@ compact_small_strings (void)
1932 tb->next_free = to; 1938 tb->next_free = to;
1933 tb = tb->next; 1939 tb = tb->next;
1934 tb_end = (sdata *) ((char *) tb + SBLOCK_SIZE); 1940 tb_end = (sdata *) ((char *) tb + SBLOCK_SIZE);
1935 to = &tb->first_data; 1941 to = tb->data;
1936 to_end = (sdata *) ((char *) to + nbytes + GC_STRING_EXTRA); 1942 to_end = (sdata *) ((char *) to + nbytes + GC_STRING_EXTRA);
1937 } 1943 }
1938 1944
@@ -2606,16 +2612,35 @@ DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0,
2606 Vector Allocation 2612 Vector Allocation
2607 ***********************************************************************/ 2613 ***********************************************************************/
2608 2614
2615/* Sometimes a vector's contents are merely a pointer internally used
2616 in vector allocation code. Usually you don't want to touch this. */
2617
2618static struct Lisp_Vector *
2619next_vector (struct Lisp_Vector *v)
2620{
2621 return XUNTAG (v->contents[0], 0);
2622}
2623
2624static void
2625set_next_vector (struct Lisp_Vector *v, struct Lisp_Vector *p)
2626{
2627 v->contents[0] = make_lisp_ptr (p, 0);
2628}
2629
2609/* This value is balanced well enough to avoid too much internal overhead 2630/* This value is balanced well enough to avoid too much internal overhead
2610 for the most common cases; it's not required to be a power of two, but 2631 for the most common cases; it's not required to be a power of two, but
2611 it's expected to be a mult-of-ROUNDUP_SIZE (see below). */ 2632 it's expected to be a mult-of-ROUNDUP_SIZE (see below). */
2612 2633
2613#define VECTOR_BLOCK_SIZE 4096 2634#define VECTOR_BLOCK_SIZE 4096
2614 2635
2615/* Align allocation request sizes to be a multiple of ROUNDUP_SIZE. */
2616enum 2636enum
2617 { 2637 {
2618 roundup_size = COMMON_MULTIPLE (word_size, USE_LSB_TAG ? GCALIGNMENT : 1) 2638 /* Alignment of struct Lisp_Vector objects. */
2639 vector_alignment = COMMON_MULTIPLE (ALIGNOF_STRUCT_LISP_VECTOR,
2640 USE_LSB_TAG ? GCALIGNMENT : 1),
2641
2642 /* Vector size requests are a multiple of this. */
2643 roundup_size = COMMON_MULTIPLE (vector_alignment, word_size)
2619 }; 2644 };
2620 2645
2621/* Verify assumptions described above. */ 2646/* Verify assumptions described above. */
@@ -2663,26 +2688,37 @@ verify (VECTOR_BLOCK_SIZE <= (1 << PSEUDOVECTOR_SIZE_BITS));
2663 eassert ((nbytes) % roundup_size == 0); \ 2688 eassert ((nbytes) % roundup_size == 0); \
2664 (tmp) = VINDEX (nbytes); \ 2689 (tmp) = VINDEX (nbytes); \
2665 eassert ((tmp) < VECTOR_MAX_FREE_LIST_INDEX); \ 2690 eassert ((tmp) < VECTOR_MAX_FREE_LIST_INDEX); \
2666 v->u.next = vector_free_lists[tmp]; \ 2691 set_next_vector (v, vector_free_lists[tmp]); \
2667 vector_free_lists[tmp] = (v); \ 2692 vector_free_lists[tmp] = (v); \
2668 total_free_vector_slots += (nbytes) / word_size; \ 2693 total_free_vector_slots += (nbytes) / word_size; \
2669 } while (0) 2694 } while (0)
2670 2695
2671/* This internal type is used to maintain the list of large vectors 2696/* This internal type is used to maintain the list of large vectors
2672 which are allocated at their own, e.g. outside of vector blocks. */ 2697 which are allocated at their own, e.g. outside of vector blocks.
2698
2699 struct large_vector itself cannot contain a struct Lisp_Vector, as
2700 the latter contains a flexible array member and C99 does not allow
2701 such structs to be nested. Instead, each struct large_vector
2702 object LV is followed by a struct Lisp_Vector, which is at offset
2703 large_vector_offset from LV, and whose address is therefore
2704 large_vector_vec (&LV). */
2673 2705
2674struct large_vector 2706struct large_vector
2675{ 2707{
2676 union { 2708 struct large_vector *next;
2677 struct large_vector *vector;
2678#if USE_LSB_TAG
2679 /* We need to maintain ROUNDUP_SIZE alignment for the vector member. */
2680 unsigned char c[vroundup_ct (sizeof (struct large_vector *))];
2681#endif
2682 } next;
2683 struct Lisp_Vector v;
2684}; 2709};
2685 2710
2711enum
2712{
2713 large_vector_offset = ROUNDUP (sizeof (struct large_vector), vector_alignment)
2714};
2715
2716static struct Lisp_Vector *
2717large_vector_vec (struct large_vector *p)
2718{
2719 return (struct Lisp_Vector *) ((char *) p + large_vector_offset);
2720}
2721
2686/* This internal type is used to maintain an underlying storage 2722/* This internal type is used to maintain an underlying storage
2687 for small vectors. */ 2723 for small vectors. */
2688 2724
@@ -2760,7 +2796,7 @@ allocate_vector_from_block (size_t nbytes)
2760 if (vector_free_lists[index]) 2796 if (vector_free_lists[index])
2761 { 2797 {
2762 vector = vector_free_lists[index]; 2798 vector = vector_free_lists[index];
2763 vector_free_lists[index] = vector->u.next; 2799 vector_free_lists[index] = next_vector (vector);
2764 total_free_vector_slots -= nbytes / word_size; 2800 total_free_vector_slots -= nbytes / word_size;
2765 return vector; 2801 return vector;
2766 } 2802 }
@@ -2774,7 +2810,7 @@ allocate_vector_from_block (size_t nbytes)
2774 { 2810 {
2775 /* This vector is larger than requested. */ 2811 /* This vector is larger than requested. */
2776 vector = vector_free_lists[index]; 2812 vector = vector_free_lists[index];
2777 vector_free_lists[index] = vector->u.next; 2813 vector_free_lists[index] = next_vector (vector);
2778 total_free_vector_slots -= nbytes / word_size; 2814 total_free_vector_slots -= nbytes / word_size;
2779 2815
2780 /* Excess bytes are used for the smaller vector, 2816 /* Excess bytes are used for the smaller vector,
@@ -2933,7 +2969,7 @@ sweep_vectors (void)
2933 2969
2934 for (lv = large_vectors; lv; lv = *lvprev) 2970 for (lv = large_vectors; lv; lv = *lvprev)
2935 { 2971 {
2936 vector = &lv->v; 2972 vector = large_vector_vec (lv);
2937 if (VECTOR_MARKED_P (vector)) 2973 if (VECTOR_MARKED_P (vector))
2938 { 2974 {
2939 VECTOR_UNMARK (vector); 2975 VECTOR_UNMARK (vector);
@@ -2949,11 +2985,11 @@ sweep_vectors (void)
2949 else 2985 else
2950 total_vector_slots 2986 total_vector_slots
2951 += header_size / word_size + vector->header.size; 2987 += header_size / word_size + vector->header.size;
2952 lvprev = &lv->next.vector; 2988 lvprev = &lv->next;
2953 } 2989 }
2954 else 2990 else
2955 { 2991 {
2956 *lvprev = lv->next.vector; 2992 *lvprev = lv->next;
2957 lisp_free (lv); 2993 lisp_free (lv);
2958 } 2994 }
2959 } 2995 }
@@ -2987,12 +3023,12 @@ allocate_vectorlike (ptrdiff_t len)
2987 else 3023 else
2988 { 3024 {
2989 struct large_vector *lv 3025 struct large_vector *lv
2990 = lisp_malloc ((offsetof (struct large_vector, v.u.contents) 3026 = lisp_malloc ((large_vector_offset + header_size
2991 + len * word_size), 3027 + len * word_size),
2992 MEM_TYPE_VECTORLIKE); 3028 MEM_TYPE_VECTORLIKE);
2993 lv->next.vector = large_vectors; 3029 lv->next = large_vectors;
2994 large_vectors = lv; 3030 large_vectors = lv;
2995 p = &lv->v; 3031 p = large_vector_vec (lv);
2996 } 3032 }
2997 3033
2998#ifdef DOUG_LEA_MALLOC 3034#ifdef DOUG_LEA_MALLOC
@@ -3041,7 +3077,7 @@ allocate_pseudovector (int memlen, int lisplen, enum pvec_type tag)
3041 3077
3042 /* Only the first lisplen slots will be traced normally by the GC. */ 3078 /* Only the first lisplen slots will be traced normally by the GC. */
3043 for (i = 0; i < lisplen; ++i) 3079 for (i = 0; i < lisplen; ++i)
3044 v->u.contents[i] = Qnil; 3080 v->contents[i] = Qnil;
3045 3081
3046 XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen); 3082 XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen);
3047 return v; 3083 return v;
@@ -3129,7 +3165,7 @@ See also the function `vector'. */)
3129 p = allocate_vector (XFASTINT (length)); 3165 p = allocate_vector (XFASTINT (length));
3130 sizei = XFASTINT (length); 3166 sizei = XFASTINT (length);
3131 for (i = 0; i < sizei; i++) 3167 for (i = 0; i < sizei; i++)
3132 p->u.contents[i] = init; 3168 p->contents[i] = init;
3133 3169
3134 XSETVECTOR (vector, p); 3170 XSETVECTOR (vector, p);
3135 return vector; 3171 return vector;
@@ -3147,7 +3183,7 @@ usage: (vector &rest OBJECTS) */)
3147 register struct Lisp_Vector *p = XVECTOR (val); 3183 register struct Lisp_Vector *p = XVECTOR (val);
3148 3184
3149 for (i = 0; i < nargs; i++) 3185 for (i = 0; i < nargs; i++)
3150 p->u.contents[i] = args[i]; 3186 p->contents[i] = args[i];
3151 return val; 3187 return val;
3152} 3188}
3153 3189
@@ -3156,14 +3192,14 @@ make_byte_code (struct Lisp_Vector *v)
3156{ 3192{
3157 /* Don't allow the global zero_vector to become a byte code object. */ 3193 /* Don't allow the global zero_vector to become a byte code object. */
3158 eassert(0 < v->header.size); 3194 eassert(0 < v->header.size);
3159 if (v->header.size > 1 && STRINGP (v->u.contents[1]) 3195 if (v->header.size > 1 && STRINGP (v->contents[1])
3160 && STRING_MULTIBYTE (v->u.contents[1])) 3196 && STRING_MULTIBYTE (v->contents[1]))
3161 /* BYTECODE-STRING must have been produced by Emacs 20.2 or the 3197 /* BYTECODE-STRING must have been produced by Emacs 20.2 or the
3162 earlier because they produced a raw 8-bit string for byte-code 3198 earlier because they produced a raw 8-bit string for byte-code
3163 and now such a byte-code string is loaded as multibyte while 3199 and now such a byte-code string is loaded as multibyte while
3164 raw 8-bit characters converted to multibyte form. Thus, now we 3200 raw 8-bit characters converted to multibyte form. Thus, now we
3165 must convert them back to the original unibyte form. */ 3201 must convert them back to the original unibyte form. */
3166 v->u.contents[1] = Fstring_as_unibyte (v->u.contents[1]); 3202 v->contents[1] = Fstring_as_unibyte (v->contents[1]);
3167 XSETPVECTYPE (v, PVEC_COMPILED); 3203 XSETPVECTYPE (v, PVEC_COMPILED);
3168} 3204}
3169 3205
@@ -3198,7 +3234,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
3198 to be setcar'd). */ 3234 to be setcar'd). */
3199 3235
3200 for (i = 0; i < nargs; i++) 3236 for (i = 0; i < nargs; i++)
3201 p->u.contents[i] = args[i]; 3237 p->contents[i] = args[i];
3202 make_byte_code (p); 3238 make_byte_code (p);
3203 XSETCOMPILED (val, p); 3239 XSETCOMPILED (val, p);
3204 return val; 3240 return val;
@@ -4256,9 +4292,7 @@ live_vector_p (struct mem_node *m, void *p)
4256 vector = ADVANCE (vector, vector_nbytes (vector)); 4292 vector = ADVANCE (vector, vector_nbytes (vector));
4257 } 4293 }
4258 } 4294 }
4259 else if (m->type == MEM_TYPE_VECTORLIKE 4295 else if (m->type == MEM_TYPE_VECTORLIKE && p == large_vector_vec (m->start))
4260 && (char *) p == ((char *) m->start
4261 + offsetof (struct large_vector, v)))
4262 /* This memory node corresponds to a large vector. */ 4296 /* This memory node corresponds to a large vector. */
4263 return 1; 4297 return 1;
4264 return 0; 4298 return 0;
@@ -5189,7 +5223,7 @@ Does not copy symbols. Copies strings without text properties. */)
5189 size &= PSEUDOVECTOR_SIZE_MASK; 5223 size &= PSEUDOVECTOR_SIZE_MASK;
5190 vec = XVECTOR (make_pure_vector (size)); 5224 vec = XVECTOR (make_pure_vector (size));
5191 for (i = 0; i < size; i++) 5225 for (i = 0; i < size; i++)
5192 vec->u.contents[i] = Fpurecopy (AREF (obj, i)); 5226 vec->contents[i] = Fpurecopy (AREF (obj, i));
5193 if (COMPILEDP (obj)) 5227 if (COMPILEDP (obj))
5194 { 5228 {
5195 XSETPVECTYPE (vec, PVEC_COMPILED); 5229 XSETPVECTYPE (vec, PVEC_COMPILED);
@@ -5710,7 +5744,7 @@ mark_vectorlike (struct Lisp_Vector *ptr)
5710 The distinction is used e.g. by Lisp_Process which places extra 5744 The distinction is used e.g. by Lisp_Process which places extra
5711 non-Lisp_Object fields at the end of the structure... */ 5745 non-Lisp_Object fields at the end of the structure... */
5712 for (i = 0; i < size; i++) /* ...and then mark its elements. */ 5746 for (i = 0; i < size; i++) /* ...and then mark its elements. */
5713 mark_object (ptr->u.contents[i]); 5747 mark_object (ptr->contents[i]);
5714} 5748}
5715 5749
5716/* Like mark_vectorlike but optimized for char-tables (and 5750/* Like mark_vectorlike but optimized for char-tables (and
@@ -5727,7 +5761,7 @@ mark_char_table (struct Lisp_Vector *ptr)
5727 VECTOR_MARK (ptr); 5761 VECTOR_MARK (ptr);
5728 for (i = 0; i < size; i++) 5762 for (i = 0; i < size; i++)
5729 { 5763 {
5730 Lisp_Object val = ptr->u.contents[i]; 5764 Lisp_Object val = ptr->contents[i];
5731 5765
5732 if (INTEGERP (val) || (SYMBOLP (val) && XSYMBOL (val)->gcmarkbit)) 5766 if (INTEGERP (val) || (SYMBOLP (val) && XSYMBOL (val)->gcmarkbit))
5733 continue; 5767 continue;
@@ -5956,10 +5990,10 @@ mark_object (Lisp_Object arg)
5956 VECTOR_MARK (ptr); 5990 VECTOR_MARK (ptr);
5957 for (i = 0; i < size; i++) 5991 for (i = 0; i < size; i++)
5958 if (i != COMPILED_CONSTANTS) 5992 if (i != COMPILED_CONSTANTS)
5959 mark_object (ptr->u.contents[i]); 5993 mark_object (ptr->contents[i]);
5960 if (size > COMPILED_CONSTANTS) 5994 if (size > COMPILED_CONSTANTS)
5961 { 5995 {
5962 obj = ptr->u.contents[COMPILED_CONSTANTS]; 5996 obj = ptr->contents[COMPILED_CONSTANTS];
5963 goto loop; 5997 goto loop;
5964 } 5998 }
5965 } 5999 }
diff --git a/src/buffer.c b/src/buffer.c
index e44908a543c..e5a8af93cf0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4534,7 +4534,7 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after,
4534 Lisp_Object *copy = alloca (size * sizeof *copy); 4534 Lisp_Object *copy = alloca (size * sizeof *copy);
4535 ptrdiff_t i; 4535 ptrdiff_t i;
4536 4536
4537 memcpy (copy, XVECTOR (last_overlay_modification_hooks)->u.contents, 4537 memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents,
4538 size * word_size); 4538 size * word_size);
4539 gcpro1.var = copy; 4539 gcpro1.var = copy;
4540 gcpro1.nvars = size; 4540 gcpro1.nvars = size;
diff --git a/src/bytecode.c b/src/bytecode.c
index b9cb36c871f..f34e702c71d 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -550,7 +550,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
550#ifdef BYTE_CODE_SAFE 550#ifdef BYTE_CODE_SAFE
551 bytestr_length = SBYTES (bytestr); 551 bytestr_length = SBYTES (bytestr);
552#endif 552#endif
553 vectorp = XVECTOR (vector)->u.contents; 553 vectorp = XVECTOR (vector)->contents;
554 554
555 stack.byte_string = bytestr; 555 stack.byte_string = bytestr;
556 stack.pc = stack.byte_string_start = SDATA (bytestr); 556 stack.pc = stack.byte_string_start = SDATA (bytestr);
diff --git a/src/ccl.c b/src/ccl.c
index d1783c25718..8fec18296a6 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1094,7 +1094,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
1094 ccl_prog_stack_struct[stack_idx].ic = ic; 1094 ccl_prog_stack_struct[stack_idx].ic = ic;
1095 ccl_prog_stack_struct[stack_idx].eof_ic = eof_ic; 1095 ccl_prog_stack_struct[stack_idx].eof_ic = eof_ic;
1096 stack_idx++; 1096 stack_idx++;
1097 ccl_prog = XVECTOR (AREF (slot, 1))->u.contents; 1097 ccl_prog = XVECTOR (AREF (slot, 1))->contents;
1098 ic = CCL_HEADER_MAIN; 1098 ic = CCL_HEADER_MAIN;
1099 eof_ic = XFASTINT (ccl_prog[CCL_HEADER_EOF]); 1099 eof_ic = XFASTINT (ccl_prog[CCL_HEADER_EOF]);
1100 } 1100 }
@@ -1936,9 +1936,9 @@ setup_ccl_program (struct ccl_program *ccl, Lisp_Object ccl_prog)
1936 return -1; 1936 return -1;
1937 vp = XVECTOR (ccl_prog); 1937 vp = XVECTOR (ccl_prog);
1938 ccl->size = vp->header.size; 1938 ccl->size = vp->header.size;
1939 ccl->prog = vp->u.contents; 1939 ccl->prog = vp->contents;
1940 ccl->eof_ic = XINT (vp->u.contents[CCL_HEADER_EOF]); 1940 ccl->eof_ic = XINT (vp->contents[CCL_HEADER_EOF]);
1941 ccl->buf_magnification = XINT (vp->u.contents[CCL_HEADER_BUF_MAG]); 1941 ccl->buf_magnification = XINT (vp->contents[CCL_HEADER_BUF_MAG]);
1942 if (ccl->idx >= 0) 1942 if (ccl->idx >= 0)
1943 { 1943 {
1944 Lisp_Object slot; 1944 Lisp_Object slot;
diff --git a/src/character.h b/src/character.h
index d1b781caa53..e944b5775ed 100644
--- a/src/character.h
+++ b/src/character.h
@@ -677,7 +677,7 @@ extern Lisp_Object string_escape_byte8 (Lisp_Object);
677 677
678/* Return a translation table of id number ID. */ 678/* Return a translation table of id number ID. */
679#define GET_TRANSLATION_TABLE(id) \ 679#define GET_TRANSLATION_TABLE(id) \
680 (XCDR (XVECTOR (Vtranslation_table_vector)->u.contents[(id)])) 680 (XCDR (XVECTOR (Vtranslation_table_vector)->contents[(id)]))
681 681
682INLINE_HEADER_END 682INLINE_HEADER_END
683 683
diff --git a/src/chartab.c b/src/chartab.c
index 089c4254da6..b7b9590a538 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -1258,7 +1258,7 @@ uniprop_encode_value_character (Lisp_Object table, Lisp_Object value)
1258static Lisp_Object 1258static Lisp_Object
1259uniprop_encode_value_run_length (Lisp_Object table, Lisp_Object value) 1259uniprop_encode_value_run_length (Lisp_Object table, Lisp_Object value)
1260{ 1260{
1261 Lisp_Object *value_table = XVECTOR (XCHAR_TABLE (table)->extras[4])->u.contents; 1261 Lisp_Object *value_table = XVECTOR (XCHAR_TABLE (table)->extras[4])->contents;
1262 int i, size = ASIZE (XCHAR_TABLE (table)->extras[4]); 1262 int i, size = ASIZE (XCHAR_TABLE (table)->extras[4]);
1263 1263
1264 for (i = 0; i < size; i++) 1264 for (i = 0; i < size; i++)
@@ -1276,7 +1276,7 @@ uniprop_encode_value_run_length (Lisp_Object table, Lisp_Object value)
1276static Lisp_Object 1276static Lisp_Object
1277uniprop_encode_value_numeric (Lisp_Object table, Lisp_Object value) 1277uniprop_encode_value_numeric (Lisp_Object table, Lisp_Object value)
1278{ 1278{
1279 Lisp_Object *value_table = XVECTOR (XCHAR_TABLE (table)->extras[4])->u.contents; 1279 Lisp_Object *value_table = XVECTOR (XCHAR_TABLE (table)->extras[4])->contents;
1280 int i, size = ASIZE (XCHAR_TABLE (table)->extras[4]); 1280 int i, size = ASIZE (XCHAR_TABLE (table)->extras[4]);
1281 1281
1282 CHECK_NUMBER (value); 1282 CHECK_NUMBER (value);
diff --git a/src/composite.c b/src/composite.c
index 689ae95fa17..2ab5dbc9133 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -266,7 +266,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t nchars,
266 composition_table = xpalloc (composition_table, &composition_table_size, 266 composition_table = xpalloc (composition_table, &composition_table_size,
267 1, -1, sizeof *composition_table); 267 1, -1, sizeof *composition_table);
268 268
269 key_contents = XVECTOR (key)->u.contents; 269 key_contents = XVECTOR (key)->contents;
270 270
271 /* Check if the contents of COMPONENTS are valid if COMPONENTS is a 271 /* Check if the contents of COMPONENTS are valid if COMPONENTS is a
272 vector or a list. It should be a sequence of: 272 vector or a list. It should be a sequence of:
diff --git a/src/composite.h b/src/composite.h
index b3ea5cd1ed8..9026d03f7b6 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -88,8 +88,8 @@ composition_registered_p (Lisp_Object prop)
88#define COMPOSITION_GLYPH(cmp, n) \ 88#define COMPOSITION_GLYPH(cmp, n) \
89 XINT (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \ 89 XINT (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \
90 ->key_and_value) \ 90 ->key_and_value) \
91 ->u.contents[cmp->hash_index * 2]) \ 91 ->contents[cmp->hash_index * 2]) \
92 ->u.contents[cmp->method == COMPOSITION_WITH_RULE_ALTCHARS \ 92 ->contents[cmp->method == COMPOSITION_WITH_RULE_ALTCHARS \
93 ? (n) * 2 : (n)]) 93 ? (n) * 2 : (n)])
94 94
95/* Return the encoded composition rule to compose the Nth glyph of 95/* Return the encoded composition rule to compose the Nth glyph of
@@ -98,8 +98,8 @@ composition_registered_p (Lisp_Object prop)
98#define COMPOSITION_RULE(cmp, n) \ 98#define COMPOSITION_RULE(cmp, n) \
99 XINT (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \ 99 XINT (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \
100 ->key_and_value) \ 100 ->key_and_value) \
101 ->u.contents[cmp->hash_index * 2]) \ 101 ->contents[cmp->hash_index * 2]) \
102 ->u.contents[(n) * 2 - 1]) 102 ->contents[(n) * 2 - 1])
103 103
104/* Decode encoded composition rule RULE_CODE into GREF (global 104/* Decode encoded composition rule RULE_CODE into GREF (global
105 reference point code), NREF (new ref. point code). Don't check RULE_CODE; 105 reference point code), NREF (new ref. point code). Don't check RULE_CODE;
diff --git a/src/dispnew.c b/src/dispnew.c
index 25acdd725dd..0379573b50a 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -42,6 +42,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
42#include "process.h" 42#include "process.h"
43 43
44#include "syssignal.h" 44#include "syssignal.h"
45#include "tparam.h"
45 46
46#ifdef HAVE_WINDOW_SYSTEM 47#ifdef HAVE_WINDOW_SYSTEM
47#include TERM_HEADER 48#include TERM_HEADER
@@ -52,10 +53,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
52#include <fpending.h> 53#include <fpending.h>
53#include <timespec.h> 54#include <timespec.h>
54 55
55#if defined (HAVE_TERM_H) && defined (GNU_LINUX)
56#include <term.h> /* for tgetent */
57#endif
58
59#ifdef WINDOWSNT 56#ifdef WINDOWSNT
60#include "w32.h" 57#include "w32.h"
61#endif 58#endif
diff --git a/src/disptab.h b/src/disptab.h
index 87dc5a22a68..e02bab04bbc 100644
--- a/src/disptab.h
+++ b/src/disptab.h
@@ -59,7 +59,7 @@ extern Lisp_Object Qdisplay_table;
59/* Return the current base (for indexing) of the GLYPH table, 59/* Return the current base (for indexing) of the GLYPH table,
60 or 0 if the table isn't currently valid. */ 60 or 0 if the table isn't currently valid. */
61#define GLYPH_TABLE_BASE \ 61#define GLYPH_TABLE_BASE \
62 ((VECTORP (Vglyph_table)) ? XVECTOR (Vglyph_table)->u.contents : 0) 62 ((VECTORP (Vglyph_table)) ? XVECTOR (Vglyph_table)->contents : 0)
63 63
64/* Given BASE and LEN returned by the two previous macros, 64/* Given BASE and LEN returned by the two previous macros,
65 return nonzero if the GLYPH code G should be output as a single 65 return nonzero if the GLYPH code G should be output as a single
diff --git a/src/fns.c b/src/fns.c
index 7a7ddc8b89c..93f2eee0666 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1602,7 +1602,7 @@ changing the value of a sequence `foo'. */)
1602 1602
1603 for (i = n = 0; i < ASIZE (seq); ++i) 1603 for (i = n = 0; i < ASIZE (seq); ++i)
1604 if (NILP (Fequal (AREF (seq, i), elt))) 1604 if (NILP (Fequal (AREF (seq, i), elt)))
1605 p->u.contents[n++] = AREF (seq, i); 1605 p->contents[n++] = AREF (seq, i);
1606 1606
1607 XSETVECTOR (seq, p); 1607 XSETVECTOR (seq, p);
1608 } 1608 }
@@ -3446,7 +3446,7 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max)
3446{ 3446{
3447 struct Lisp_Vector *v; 3447 struct Lisp_Vector *v;
3448 ptrdiff_t i, incr, incr_max, old_size, new_size; 3448 ptrdiff_t i, incr, incr_max, old_size, new_size;
3449 ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->u.contents; 3449 ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->contents;
3450 ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max 3450 ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max
3451 ? nitems_max : C_language_max); 3451 ? nitems_max : C_language_max);
3452 eassert (VECTORP (vec)); 3452 eassert (VECTORP (vec));
@@ -3458,9 +3458,9 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max)
3458 memory_full (SIZE_MAX); 3458 memory_full (SIZE_MAX);
3459 new_size = old_size + incr; 3459 new_size = old_size + incr;
3460 v = allocate_vector (new_size); 3460 v = allocate_vector (new_size);
3461 memcpy (v->u.contents, XVECTOR (vec)->u.contents, old_size * sizeof *v->u.contents); 3461 memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents);
3462 for (i = old_size; i < new_size; ++i) 3462 for (i = old_size; i < new_size; ++i)
3463 v->u.contents[i] = Qnil; 3463 v->contents[i] = Qnil;
3464 XSETVECTOR (vec, v); 3464 XSETVECTOR (vec, v);
3465 return vec; 3465 return vec;
3466} 3466}
diff --git a/src/fontset.c b/src/fontset.c
index 090c097c929..a3634f0b08d 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -453,7 +453,7 @@ reorder_font_vector (Lisp_Object font_group, struct font *font)
453 } 453 }
454 454
455 if (score_changed) 455 if (score_changed)
456 qsort (XVECTOR (vec)->u.contents, size, word_size, 456 qsort (XVECTOR (vec)->contents, size, word_size,
457 fontset_compare_rfontdef); 457 fontset_compare_rfontdef);
458 XSETCAR (font_group, make_number (charset_ordered_list_tick)); 458 XSETCAR (font_group, make_number (charset_ordered_list_tick));
459} 459}
diff --git a/src/gnutls.c b/src/gnutls.c
index f9e86d1a697..0ee3fcae4a4 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -791,16 +791,10 @@ one trustfile (usually a CA bundle). */)
791 CHECK_LIST (proplist); 791 CHECK_LIST (proplist);
792 792
793 if (NILP (Fgnutls_available_p ())) 793 if (NILP (Fgnutls_available_p ()))
794 { 794 error ("GnuTLS not available");
795 error ("GnuTLS not available");
796 return gnutls_make_error (GNUTLS_EMACS_ERROR_NOT_LOADED);
797 }
798 795
799 if (!EQ (type, Qgnutls_x509pki) && !EQ (type, Qgnutls_anon)) 796 if (!EQ (type, Qgnutls_x509pki) && !EQ (type, Qgnutls_anon))
800 { 797 error ("Invalid GnuTLS credential type");
801 error ("Invalid GnuTLS credential type");
802 return gnutls_make_error (GNUTLS_EMACS_ERROR_INVALID_TYPE);
803 }
804 798
805 hostname = Fplist_get (proplist, QCgnutls_bootprop_hostname); 799 hostname = Fplist_get (proplist, QCgnutls_bootprop_hostname);
806 priority_string = Fplist_get (proplist, QCgnutls_bootprop_priority); 800 priority_string = Fplist_get (proplist, QCgnutls_bootprop_priority);
diff --git a/src/indent.c b/src/indent.c
index d956e627ba9..891b42788ed 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -118,7 +118,7 @@ disptab_matches_widthtab (struct Lisp_Char_Table *disptab, struct Lisp_Vector *w
118 118
119 for (i = 0; i < 256; i++) 119 for (i = 0; i < 256; i++)
120 if (character_width (i, disptab) 120 if (character_width (i, disptab)
121 != XFASTINT (widthtab->u.contents[i])) 121 != XFASTINT (widthtab->contents[i]))
122 return 0; 122 return 0;
123 123
124 return 1; 124 return 1;
@@ -138,7 +138,7 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
138 eassert (widthtab->header.size == 256); 138 eassert (widthtab->header.size == 256);
139 139
140 for (i = 0; i < 256; i++) 140 for (i = 0; i < 256; i++)
141 XSETFASTINT (widthtab->u.contents[i], character_width (i, disptab)); 141 XSETFASTINT (widthtab->contents[i], character_width (i, disptab));
142} 142}
143 143
144/* Allocate or free the width run cache, as requested by the 144/* Allocate or free the width run cache, as requested by the
@@ -1136,7 +1136,7 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, EMACS_INT fromvpos,
1136 width_run_cache_on_off (); 1136 width_run_cache_on_off ();
1137 if (dp == buffer_display_table ()) 1137 if (dp == buffer_display_table ())
1138 width_table = (VECTORP (BVAR (current_buffer, width_table)) 1138 width_table = (VECTORP (BVAR (current_buffer, width_table))
1139 ? XVECTOR (BVAR (current_buffer, width_table))->u.contents 1139 ? XVECTOR (BVAR (current_buffer, width_table))->contents
1140 : 0); 1140 : 0);
1141 else 1141 else
1142 /* If the window has its own display table, we can't use the width 1142 /* If the window has its own display table, we can't use the width
diff --git a/src/keyboard.c b/src/keyboard.c
index 6831f4d2cad..c157eb19a28 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -4357,7 +4357,7 @@ decode_timer (Lisp_Object timer, struct timespec *result)
4357 4357
4358 if (! (VECTORP (timer) && ASIZE (timer) == 9)) 4358 if (! (VECTORP (timer) && ASIZE (timer) == 9))
4359 return 0; 4359 return 0;
4360 vector = XVECTOR (timer)->u.contents; 4360 vector = XVECTOR (timer)->contents;
4361 if (! NILP (vector[0])) 4361 if (! NILP (vector[0]))
4362 return 0; 4362 return 0;
4363 4363
@@ -7987,7 +7987,7 @@ process_tool_bar_item (Lisp_Object key, Lisp_Object def, Lisp_Object data, void
7987 discard any previously made item. */ 7987 discard any previously made item. */
7988 for (i = 0; i < ntool_bar_items; i += TOOL_BAR_ITEM_NSLOTS) 7988 for (i = 0; i < ntool_bar_items; i += TOOL_BAR_ITEM_NSLOTS)
7989 { 7989 {
7990 Lisp_Object *v = XVECTOR (tool_bar_items_vector)->u.contents + i; 7990 Lisp_Object *v = XVECTOR (tool_bar_items_vector)->contents + i;
7991 7991
7992 if (EQ (key, v[TOOL_BAR_ITEM_KEY])) 7992 if (EQ (key, v[TOOL_BAR_ITEM_KEY]))
7993 { 7993 {
@@ -8311,7 +8311,7 @@ append_tool_bar_item (void)
8311 /* Append entries from tool_bar_item_properties to the end of 8311 /* Append entries from tool_bar_item_properties to the end of
8312 tool_bar_items_vector. */ 8312 tool_bar_items_vector. */
8313 vcopy (tool_bar_items_vector, ntool_bar_items, 8313 vcopy (tool_bar_items_vector, ntool_bar_items,
8314 XVECTOR (tool_bar_item_properties)->u.contents, TOOL_BAR_ITEM_NSLOTS); 8314 XVECTOR (tool_bar_item_properties)->contents, TOOL_BAR_ITEM_NSLOTS);
8315 ntool_bar_items += TOOL_BAR_ITEM_NSLOTS; 8315 ntool_bar_items += TOOL_BAR_ITEM_NSLOTS;
8316} 8316}
8317 8317
@@ -9915,7 +9915,7 @@ DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0,
9915 doc: /* Return vector of last 300 events, not counting those from keyboard macros. */) 9915 doc: /* Return vector of last 300 events, not counting those from keyboard macros. */)
9916 (void) 9916 (void)
9917{ 9917{
9918 Lisp_Object *keys = XVECTOR (recent_keys)->u.contents; 9918 Lisp_Object *keys = XVECTOR (recent_keys)->contents;
9919 Lisp_Object val; 9919 Lisp_Object val;
9920 9920
9921 if (total_keys < NUM_RECENT_KEYS) 9921 if (total_keys < NUM_RECENT_KEYS)
@@ -9941,7 +9941,7 @@ See also `this-command-keys-vector'. */)
9941 (void) 9941 (void)
9942{ 9942{
9943 return make_event_array (this_command_key_count, 9943 return make_event_array (this_command_key_count,
9944 XVECTOR (this_command_keys)->u.contents); 9944 XVECTOR (this_command_keys)->contents);
9945} 9945}
9946 9946
9947DEFUN ("this-command-keys-vector", Fthis_command_keys_vector, Sthis_command_keys_vector, 0, 0, 0, 9947DEFUN ("this-command-keys-vector", Fthis_command_keys_vector, Sthis_command_keys_vector, 0, 0, 0,
@@ -9953,7 +9953,7 @@ See also `this-command-keys'. */)
9953 (void) 9953 (void)
9954{ 9954{
9955 return Fvector (this_command_key_count, 9955 return Fvector (this_command_key_count,
9956 XVECTOR (this_command_keys)->u.contents); 9956 XVECTOR (this_command_keys)->contents);
9957} 9957}
9958 9958
9959DEFUN ("this-single-command-keys", Fthis_single_command_keys, 9959DEFUN ("this-single-command-keys", Fthis_single_command_keys,
@@ -9968,7 +9968,7 @@ The value is always a vector. */)
9968{ 9968{
9969 return Fvector (this_command_key_count 9969 return Fvector (this_command_key_count
9970 - this_single_command_key_start, 9970 - this_single_command_key_start,
9971 (XVECTOR (this_command_keys)->u.contents 9971 (XVECTOR (this_command_keys)->contents
9972 + this_single_command_key_start)); 9972 + this_single_command_key_start));
9973} 9973}
9974 9974
@@ -9982,7 +9982,7 @@ shows the events before all translations (except for input methods).
9982The value is always a vector. */) 9982The value is always a vector. */)
9983 (void) 9983 (void)
9984{ 9984{
9985 return Fvector (raw_keybuf_count, XVECTOR (raw_keybuf)->u.contents); 9985 return Fvector (raw_keybuf_count, XVECTOR (raw_keybuf)->contents);
9986} 9986}
9987 9987
9988DEFUN ("reset-this-command-lengths", Freset_this_command_lengths, 9988DEFUN ("reset-this-command-lengths", Freset_this_command_lengths,
diff --git a/src/lisp.h b/src/lisp.h
index c8b9497a314..f538cec5ed1 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -406,8 +406,10 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 };
406#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 406#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1
407 407
408/* Idea stolen from GDB. Pedantic GCC complains about enum bitfields, 408/* Idea stolen from GDB. Pedantic GCC complains about enum bitfields,
409 MSVC doesn't support them, and xlc complains vociferously about them. */ 409 MSVC doesn't support them, and xlc and Oracle Studio c99 complain
410#if defined __STRICT_ANSI__ || defined _MSC_VER || defined __IBMC__ 410 vociferously about them. */
411#if (defined __STRICT_ANSI__ || defined _MSC_VER || defined __IBMC__ \
412 || (defined __SUNPRO_C && __STDC__))
411#define ENUM_BF(TYPE) unsigned int 413#define ENUM_BF(TYPE) unsigned int
412#else 414#else
413#define ENUM_BF(TYPE) enum TYPE 415#define ENUM_BF(TYPE) enum TYPE
@@ -1175,22 +1177,22 @@ struct vectorlike_header
1175 ptrdiff_t size; 1177 ptrdiff_t size;
1176 }; 1178 };
1177 1179
1178/* Regular vector is just a header plus array of Lisp_Objects... */ 1180/* A regular vector is just a header plus an array of Lisp_Objects. */
1179 1181
1180struct Lisp_Vector 1182struct Lisp_Vector
1181 { 1183 {
1182 struct vectorlike_header header; 1184 struct vectorlike_header header;
1183 union { 1185 Lisp_Object contents[FLEXIBLE_ARRAY_MEMBER];
1184 /* ...but sometimes there is also a pointer internally used in 1186 };
1185 vector allocation code. Usually you don't want to touch this. */
1186 struct Lisp_Vector *next;
1187 1187
1188 /* We can't use FLEXIBLE_ARRAY_MEMBER here. */ 1188/* C11 prohibits alignof (struct Lisp_Vector), so compute it manually. */
1189 Lisp_Object contents[1]; 1189enum
1190 } u; 1190 {
1191 ALIGNOF_STRUCT_LISP_VECTOR
1192 = alignof (union { struct vectorlike_header a; Lisp_Object b; })
1191 }; 1193 };
1192 1194
1193/* A boolvector is a kind of vectorlike, with contents are like a string. */ 1195/* A boolvector is a kind of vectorlike, with contents like a string. */
1194 1196
1195struct Lisp_Bool_Vector 1197struct Lisp_Bool_Vector
1196 { 1198 {
@@ -1216,7 +1218,7 @@ bool_vector_size (Lisp_Object a)
1216 1218
1217enum 1219enum
1218 { 1220 {
1219 header_size = offsetof (struct Lisp_Vector, u.contents), 1221 header_size = offsetof (struct Lisp_Vector, contents),
1220 bool_header_size = offsetof (struct Lisp_Bool_Vector, data), 1222 bool_header_size = offsetof (struct Lisp_Bool_Vector, data),
1221 word_size = sizeof (Lisp_Object) 1223 word_size = sizeof (Lisp_Object)
1222 }; 1224 };
@@ -1226,13 +1228,13 @@ enum
1226INLINE Lisp_Object 1228INLINE Lisp_Object
1227AREF (Lisp_Object array, ptrdiff_t idx) 1229AREF (Lisp_Object array, ptrdiff_t idx)
1228{ 1230{
1229 return XVECTOR (array)->u.contents[idx]; 1231 return XVECTOR (array)->contents[idx];
1230} 1232}
1231 1233
1232INLINE Lisp_Object * 1234INLINE Lisp_Object *
1233aref_addr (Lisp_Object array, ptrdiff_t idx) 1235aref_addr (Lisp_Object array, ptrdiff_t idx)
1234{ 1236{
1235 return & XVECTOR (array)->u.contents[idx]; 1237 return & XVECTOR (array)->contents[idx];
1236} 1238}
1237 1239
1238INLINE ptrdiff_t 1240INLINE ptrdiff_t
@@ -1245,7 +1247,7 @@ INLINE void
1245ASET (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) 1247ASET (Lisp_Object array, ptrdiff_t idx, Lisp_Object val)
1246{ 1248{
1247 eassert (0 <= idx && idx < ASIZE (array)); 1249 eassert (0 <= idx && idx < ASIZE (array));
1248 XVECTOR (array)->u.contents[idx] = val; 1250 XVECTOR (array)->contents[idx] = val;
1249} 1251}
1250 1252
1251INLINE void 1253INLINE void
@@ -1254,7 +1256,7 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val)
1254 /* Like ASET, but also can be used in the garbage collector: 1256 /* Like ASET, but also can be used in the garbage collector:
1255 sweep_weak_table calls set_hash_key etc. while the table is marked. */ 1257 sweep_weak_table calls set_hash_key etc. while the table is marked. */
1256 eassert (0 <= idx && idx < (ASIZE (array) & ~ARRAY_MARK_FLAG)); 1258 eassert (0 <= idx && idx < (ASIZE (array) & ~ARRAY_MARK_FLAG));
1257 XVECTOR (array)->u.contents[idx] = val; 1259 XVECTOR (array)->contents[idx] = val;
1258} 1260}
1259 1261
1260/* If a struct is made to look like a vector, this macro returns the length 1262/* If a struct is made to look like a vector, this macro returns the length
@@ -1758,14 +1760,14 @@ struct Lisp_Misc_Any /* Supertype of all Misc types. */
1758{ 1760{
1759 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_??? */ 1761 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_??? */
1760 unsigned gcmarkbit : 1; 1762 unsigned gcmarkbit : 1;
1761 int spacer : 15; 1763 unsigned spacer : 15;
1762}; 1764};
1763 1765
1764struct Lisp_Marker 1766struct Lisp_Marker
1765{ 1767{
1766 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Marker */ 1768 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Marker */
1767 unsigned gcmarkbit : 1; 1769 unsigned gcmarkbit : 1;
1768 int spacer : 13; 1770 unsigned spacer : 13;
1769 /* This flag is temporarily used in the functions 1771 /* This flag is temporarily used in the functions
1770 decode/encode_coding_object to record that the marker position 1772 decode/encode_coding_object to record that the marker position
1771 must be adjusted after the conversion. */ 1773 must be adjusted after the conversion. */
@@ -1819,7 +1821,7 @@ struct Lisp_Overlay
1819 { 1821 {
1820 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */ 1822 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */
1821 unsigned gcmarkbit : 1; 1823 unsigned gcmarkbit : 1;
1822 int spacer : 15; 1824 unsigned spacer : 15;
1823 struct Lisp_Overlay *next; 1825 struct Lisp_Overlay *next;
1824 Lisp_Object start; 1826 Lisp_Object start;
1825 Lisp_Object end; 1827 Lisp_Object end;
@@ -1897,7 +1899,7 @@ struct Lisp_Save_Value
1897 { 1899 {
1898 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */ 1900 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */
1899 unsigned gcmarkbit : 1; 1901 unsigned gcmarkbit : 1;
1900 int spacer : 32 - (16 + 1 + SAVE_TYPE_BITS); 1902 unsigned spacer : 32 - (16 + 1 + SAVE_TYPE_BITS);
1901 1903
1902 /* V->data may hold up to SAVE_VALUE_SLOTS entries. The type of 1904 /* V->data may hold up to SAVE_VALUE_SLOTS entries. The type of
1903 V's data entries are determined by V->save_type. E.g., if 1905 V's data entries are determined by V->save_type. E.g., if
@@ -1973,7 +1975,7 @@ struct Lisp_Free
1973 { 1975 {
1974 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Free */ 1976 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Free */
1975 unsigned gcmarkbit : 1; 1977 unsigned gcmarkbit : 1;
1976 int spacer : 15; 1978 unsigned spacer : 15;
1977 union Lisp_Misc *chain; 1979 union Lisp_Misc *chain;
1978 }; 1980 };
1979 1981
@@ -2737,7 +2739,7 @@ union specbinding
2737 } let; 2739 } let;
2738 struct { 2740 struct {
2739 ENUM_BF (specbind_tag) kind : CHAR_BIT; 2741 ENUM_BF (specbind_tag) kind : CHAR_BIT;
2740 bool debug_on_exit : 1; 2742 unsigned debug_on_exit : 1;
2741 Lisp_Object function; 2743 Lisp_Object function;
2742 Lisp_Object *args; 2744 Lisp_Object *args;
2743 ptrdiff_t nargs; 2745 ptrdiff_t nargs;
@@ -3089,7 +3091,7 @@ INLINE void
3089vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count) 3091vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count)
3090{ 3092{
3091 eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v)); 3093 eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v));
3092 memcpy (XVECTOR (v)->u.contents + offset, args, count * sizeof *args); 3094 memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args);
3093} 3095}
3094 3096
3095/* Functions to modify hash tables. */ 3097/* Functions to modify hash tables. */
diff --git a/src/lread.c b/src/lread.c
index fe2b92a34b3..b42ac5908e9 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3462,7 +3462,7 @@ read_vector (Lisp_Object readcharfun, bool bytecodeflag)
3462 vector = Fmake_vector (len, Qnil); 3462 vector = Fmake_vector (len, Qnil);
3463 3463
3464 size = ASIZE (vector); 3464 size = ASIZE (vector);
3465 ptr = XVECTOR (vector)->u.contents; 3465 ptr = XVECTOR (vector)->contents;
3466 for (i = 0; i < size; i++) 3466 for (i = 0; i < size; i++)
3467 { 3467 {
3468 item = Fcar (tem); 3468 item = Fcar (tem);
diff --git a/src/msdos.c b/src/msdos.c
index 2ba7a16a443..7a029f8c380 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -2387,7 +2387,7 @@ Each input key receives two values in this vector: first the ASCII code,
2387and then the scan code. */) 2387and then the scan code. */)
2388 (void) 2388 (void)
2389{ 2389{
2390 Lisp_Object val, *keys = XVECTOR (recent_doskeys)->u.contents; 2390 Lisp_Object val, *keys = XVECTOR (recent_doskeys)->contents;
2391 2391
2392 if (total_doskeys < NUM_RECENT_DOSKEYS) 2392 if (total_doskeys < NUM_RECENT_DOSKEYS)
2393 return Fvector (total_doskeys, keys); 2393 return Fvector (total_doskeys, keys);
diff --git a/src/process.c b/src/process.c
index 91bc090e76e..f6aa576e8b7 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1333,15 +1333,15 @@ Returns nil if format of ADDRESS is invalid. */)
1333 1333
1334 for (i = 0; i < nargs; i++) 1334 for (i = 0; i < nargs; i++)
1335 { 1335 {
1336 if (! RANGED_INTEGERP (0, p->u.contents[i], 65535)) 1336 if (! RANGED_INTEGERP (0, p->contents[i], 65535))
1337 return Qnil; 1337 return Qnil;
1338 1338
1339 if (nargs <= 5 /* IPv4 */ 1339 if (nargs <= 5 /* IPv4 */
1340 && i < 4 /* host, not port */ 1340 && i < 4 /* host, not port */
1341 && XINT (p->u.contents[i]) > 255) 1341 && XINT (p->contents[i]) > 255)
1342 return Qnil; 1342 return Qnil;
1343 1343
1344 args[i+1] = p->u.contents[i]; 1344 args[i+1] = p->contents[i];
1345 } 1345 }
1346 1346
1347 return Fformat (nargs+1, args); 1347 return Fformat (nargs+1, args);
@@ -1983,7 +1983,7 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, int len)
1983 len = sizeof (sin->sin_addr) + 1; 1983 len = sizeof (sin->sin_addr) + 1;
1984 address = Fmake_vector (make_number (len), Qnil); 1984 address = Fmake_vector (make_number (len), Qnil);
1985 p = XVECTOR (address); 1985 p = XVECTOR (address);
1986 p->u.contents[--len] = make_number (ntohs (sin->sin_port)); 1986 p->contents[--len] = make_number (ntohs (sin->sin_port));
1987 cp = (unsigned char *) &sin->sin_addr; 1987 cp = (unsigned char *) &sin->sin_addr;
1988 break; 1988 break;
1989 } 1989 }
@@ -1995,9 +1995,9 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, int len)
1995 len = sizeof (sin6->sin6_addr)/2 + 1; 1995 len = sizeof (sin6->sin6_addr)/2 + 1;
1996 address = Fmake_vector (make_number (len), Qnil); 1996 address = Fmake_vector (make_number (len), Qnil);
1997 p = XVECTOR (address); 1997 p = XVECTOR (address);
1998 p->u.contents[--len] = make_number (ntohs (sin6->sin6_port)); 1998 p->contents[--len] = make_number (ntohs (sin6->sin6_port));
1999 for (i = 0; i < len; i++) 1999 for (i = 0; i < len; i++)
2000 p->u.contents[i] = make_number (ntohs (ip6[i])); 2000 p->contents[i] = make_number (ntohs (ip6[i]));
2001 return address; 2001 return address;
2002 } 2002 }
2003#endif 2003#endif
@@ -2022,7 +2022,7 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, int len)
2022 2022
2023 i = 0; 2023 i = 0;
2024 while (i < len) 2024 while (i < len)
2025 p->u.contents[i++] = make_number (*cp++); 2025 p->contents[i++] = make_number (*cp++);
2026 2026
2027 return address; 2027 return address;
2028} 2028}
@@ -2093,7 +2093,7 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int
2093 { 2093 {
2094 struct sockaddr_in *sin = (struct sockaddr_in *) sa; 2094 struct sockaddr_in *sin = (struct sockaddr_in *) sa;
2095 len = sizeof (sin->sin_addr) + 1; 2095 len = sizeof (sin->sin_addr) + 1;
2096 hostport = XINT (p->u.contents[--len]); 2096 hostport = XINT (p->contents[--len]);
2097 sin->sin_port = htons (hostport); 2097 sin->sin_port = htons (hostport);
2098 cp = (unsigned char *)&sin->sin_addr; 2098 cp = (unsigned char *)&sin->sin_addr;
2099 sa->sa_family = family; 2099 sa->sa_family = family;
@@ -2104,12 +2104,12 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int
2104 struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa; 2104 struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa;
2105 uint16_t *ip6 = (uint16_t *)&sin6->sin6_addr; 2105 uint16_t *ip6 = (uint16_t *)&sin6->sin6_addr;
2106 len = sizeof (sin6->sin6_addr) + 1; 2106 len = sizeof (sin6->sin6_addr) + 1;
2107 hostport = XINT (p->u.contents[--len]); 2107 hostport = XINT (p->contents[--len]);
2108 sin6->sin6_port = htons (hostport); 2108 sin6->sin6_port = htons (hostport);
2109 for (i = 0; i < len; i++) 2109 for (i = 0; i < len; i++)
2110 if (INTEGERP (p->u.contents[i])) 2110 if (INTEGERP (p->contents[i]))
2111 { 2111 {
2112 int j = XFASTINT (p->u.contents[i]) & 0xffff; 2112 int j = XFASTINT (p->contents[i]) & 0xffff;
2113 ip6[i] = ntohs (j); 2113 ip6[i] = ntohs (j);
2114 } 2114 }
2115 sa->sa_family = family; 2115 sa->sa_family = family;
@@ -2140,8 +2140,8 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int
2140 } 2140 }
2141 2141
2142 for (i = 0; i < len; i++) 2142 for (i = 0; i < len; i++)
2143 if (INTEGERP (p->u.contents[i])) 2143 if (INTEGERP (p->contents[i]))
2144 *cp++ = XFASTINT (p->u.contents[i]) & 0xff; 2144 *cp++ = XFASTINT (p->contents[i]) & 0xff;
2145} 2145}
2146 2146
2147#ifdef DATAGRAM_SOCKETS 2147#ifdef DATAGRAM_SOCKETS
@@ -3723,7 +3723,9 @@ network_interface_info (Lisp_Object ifname)
3723 3723
3724 any = 1; 3724 any = 1;
3725 for (n = 0; n < 6; n++) 3725 for (n = 0; n < 6; n++)
3726 p->u.contents[n] = make_number (((unsigned char *)&rq.ifr_hwaddr.sa_data[0])[n]); 3726 p->contents[n] = make_number (((unsigned char *)
3727 &rq.ifr_hwaddr.sa_data[0])
3728 [n]);
3727 elt = Fcons (make_number (rq.ifr_hwaddr.sa_family), hwaddr); 3729 elt = Fcons (make_number (rq.ifr_hwaddr.sa_family), hwaddr);
3728 } 3730 }
3729#elif defined (HAVE_GETIFADDRS) && defined (LLADDR) 3731#elif defined (HAVE_GETIFADDRS) && defined (LLADDR)
@@ -3746,7 +3748,7 @@ network_interface_info (Lisp_Object ifname)
3746 3748
3747 memcpy (linkaddr, LLADDR (sdl), sdl->sdl_alen); 3749 memcpy (linkaddr, LLADDR (sdl), sdl->sdl_alen);
3748 for (n = 0; n < 6; n++) 3750 for (n = 0; n < 6; n++)
3749 p->u.contents[n] = make_number (linkaddr[n]); 3751 p->contents[n] = make_number (linkaddr[n]);
3750 3752
3751 elt = Fcons (make_number (it->ifa_addr->sa_family), hwaddr); 3753 elt = Fcons (make_number (it->ifa_addr->sa_family), hwaddr);
3752 break; 3754 break;
diff --git a/src/term.c b/src/term.c
index b4c2e2560cc..929280865a5 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3478,7 +3478,7 @@ tty_menu_help_callback (char const *help_string, int pane, int item)
3478 Lisp_Object pane_name; 3478 Lisp_Object pane_name;
3479 Lisp_Object menu_object; 3479 Lisp_Object menu_object;
3480 3480
3481 first_item = XVECTOR (menu_items)->u.contents; 3481 first_item = XVECTOR (menu_items)->contents;
3482 if (EQ (first_item[0], Qt)) 3482 if (EQ (first_item[0], Qt))
3483 pane_name = first_item[MENU_ITEMS_PANE_NAME]; 3483 pane_name = first_item[MENU_ITEMS_PANE_NAME];
3484 else if (EQ (first_item[0], Qquote)) 3484 else if (EQ (first_item[0], Qquote))
diff --git a/src/w32.c b/src/w32.c
index 2c157d11769..e48078aec99 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -7621,7 +7621,7 @@ network_interface_get_info (Lisp_Object ifname)
7621 7621
7622 /* Hardware address and its family. */ 7622 /* Hardware address and its family. */
7623 for (n = 0; n < adapter->AddressLength; n++) 7623 for (n = 0; n < adapter->AddressLength; n++)
7624 p->u.contents[n] = make_number ((int) adapter->Address[n]); 7624 p->contents[n] = make_number ((int) adapter->Address[n]);
7625 /* Windows does not support AF_LINK or AF_PACKET family 7625 /* Windows does not support AF_LINK or AF_PACKET family
7626 of addresses. Use an arbitrary family number that is 7626 of addresses. Use an arbitrary family number that is
7627 identical to what GNU/Linux returns. */ 7627 identical to what GNU/Linux returns. */
diff --git a/src/w32menu.c b/src/w32menu.c
index 6ac02d95a63..b25652017cd 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -326,7 +326,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
326 326
327 /* Save the frame's previous menu bar contents data. */ 327 /* Save the frame's previous menu bar contents data. */
328 if (previous_menu_items_used) 328 if (previous_menu_items_used)
329 memcpy (previous_items, XVECTOR (f->menu_bar_vector)->u.contents, 329 memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
330 previous_menu_items_used * word_size); 330 previous_menu_items_used * word_size);
331 331
332 /* Fill in menu_items with the current menu bar contents. 332 /* Fill in menu_items with the current menu bar contents.
diff --git a/src/window.c b/src/window.c
index ecbe5fa5365..cb505eda819 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5405,7 +5405,7 @@ struct saved_window
5405}; 5405};
5406 5406
5407#define SAVED_WINDOW_N(swv,n) \ 5407#define SAVED_WINDOW_N(swv,n) \
5408 ((struct saved_window *) (XVECTOR ((swv)->u.contents[(n)]))) 5408 ((struct saved_window *) (XVECTOR ((swv)->contents[(n)])))
5409 5409
5410DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_p, 1, 1, 0, 5410DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_p, 1, 1, 0,
5411 doc: /* Return t if OBJECT is a window-configuration object. */) 5411 doc: /* Return t if OBJECT is a window-configuration object. */)
diff --git a/src/xdisp.c b/src/xdisp.c
index 5cd2c2badcc..9992fa4776a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4412,8 +4412,8 @@ setup_for_ellipsis (struct it *it, int len)
4412 if (it->dp && VECTORP (DISP_INVIS_VECTOR (it->dp))) 4412 if (it->dp && VECTORP (DISP_INVIS_VECTOR (it->dp)))
4413 { 4413 {
4414 struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp)); 4414 struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp));
4415 it->dpvec = v->u.contents; 4415 it->dpvec = v->contents;
4416 it->dpend = v->u.contents + v->header.size; 4416 it->dpend = v->contents + v->header.size;
4417 } 4417 }
4418 else 4418 else
4419 { 4419 {
@@ -6714,8 +6714,8 @@ get_next_display_element (struct it *it)
6714 if (v->header.size) 6714 if (v->header.size)
6715 { 6715 {
6716 it->dpvec_char_len = it->len; 6716 it->dpvec_char_len = it->len;
6717 it->dpvec = v->u.contents; 6717 it->dpvec = v->contents;
6718 it->dpend = v->u.contents + v->header.size; 6718 it->dpend = v->contents + v->header.size;
6719 it->current.dpvec_index = 0; 6719 it->current.dpvec_index = 0;
6720 it->dpvec_face_id = -1; 6720 it->dpvec_face_id = -1;
6721 it->saved_face_id = it->face_id; 6721 it->saved_face_id = it->face_id;
@@ -27585,7 +27585,7 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
27585 if (VECTORP (XCDR (hot_spot))) 27585 if (VECTORP (XCDR (hot_spot)))
27586 { 27586 {
27587 struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot)); 27587 struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot));
27588 Lisp_Object *poly = v->u.contents; 27588 Lisp_Object *poly = v->contents;
27589 ptrdiff_t n = v->header.size; 27589 ptrdiff_t n = v->header.size;
27590 ptrdiff_t i; 27590 ptrdiff_t i;
27591 int inside = 0; 27591 int inside = 0;
diff --git a/src/xfaces.c b/src/xfaces.c
index 7b88659e11d..6845e5c3c65 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1569,7 +1569,7 @@ the face font sort order. */)
1569 vec = Fvconcat (ndrivers, drivers); 1569 vec = Fvconcat (ndrivers, drivers);
1570 nfonts = ASIZE (vec); 1570 nfonts = ASIZE (vec);
1571 1571
1572 qsort (XVECTOR (vec)->u.contents, nfonts, word_size, 1572 qsort (XVECTOR (vec)->contents, nfonts, word_size,
1573 compare_fonts_by_sort_order); 1573 compare_fonts_by_sort_order);
1574 1574
1575 result = Qnil; 1575 result = Qnil;
@@ -1839,7 +1839,7 @@ check_lface (Lisp_Object lface)
1839 if (!NILP (lface)) 1839 if (!NILP (lface))
1840 { 1840 {
1841 eassert (LFACEP (lface)); 1841 eassert (LFACEP (lface));
1842 check_lface_attrs (XVECTOR (lface)->u.contents); 1842 check_lface_attrs (XVECTOR (lface)->contents);
1843 } 1843 }
1844} 1844}
1845 1845
@@ -2016,7 +2016,7 @@ get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name,
2016 lface = lface_from_face_name_no_resolve (f, face_name, signal_p); 2016 lface = lface_from_face_name_no_resolve (f, face_name, signal_p);
2017 2017
2018 if (! NILP (lface)) 2018 if (! NILP (lface))
2019 memcpy (attrs, XVECTOR (lface)->u.contents, 2019 memcpy (attrs, XVECTOR (lface)->contents,
2020 LFACE_VECTOR_SIZE * sizeof *attrs); 2020 LFACE_VECTOR_SIZE * sizeof *attrs);
2021 2021
2022 return !NILP (lface); 2022 return !NILP (lface);
@@ -2706,7 +2706,7 @@ The value is TO. */)
2706 copy = Finternal_make_lisp_face (to, new_frame); 2706 copy = Finternal_make_lisp_face (to, new_frame);
2707 } 2707 }
2708 2708
2709 vcopy (copy, 0, XVECTOR (lface)->u.contents, LFACE_VECTOR_SIZE); 2709 vcopy (copy, 0, XVECTOR (lface)->contents, LFACE_VECTOR_SIZE);
2710 2710
2711 /* Changing a named face means that all realized faces depending on 2711 /* Changing a named face means that all realized faces depending on
2712 that face are invalid. Since we cannot tell which realized faces 2712 that face are invalid. Since we cannot tell which realized faces
@@ -3126,7 +3126,7 @@ FRAME 0 means change the face on all frames, and change the default
3126 f = XFRAME (frame); 3126 f = XFRAME (frame);
3127 if (! FONT_OBJECT_P (value)) 3127 if (! FONT_OBJECT_P (value))
3128 { 3128 {
3129 Lisp_Object *attrs = XVECTOR (lface)->u.contents; 3129 Lisp_Object *attrs = XVECTOR (lface)->contents;
3130 Lisp_Object font_object; 3130 Lisp_Object font_object;
3131 3131
3132 font_object = font_load_for_lface (f, attrs, value); 3132 font_object = font_load_for_lface (f, attrs, value);
@@ -3194,7 +3194,7 @@ FRAME 0 means change the face on all frames, and change the default
3194 the font to nil so that the font selector doesn't think that 3194 the font to nil so that the font selector doesn't think that
3195 the attribute is mandatory. Also, clear the average 3195 the attribute is mandatory. Also, clear the average
3196 width. */ 3196 width. */
3197 font_clear_prop (XVECTOR (lface)->u.contents, prop_index); 3197 font_clear_prop (XVECTOR (lface)->contents, prop_index);
3198 } 3198 }
3199 3199
3200 /* Changing a named face means that all realized faces depending on 3200 /* Changing a named face means that all realized faces depending on
@@ -3224,7 +3224,7 @@ FRAME 0 means change the face on all frames, and change the default
3224 reflected in changed `font' frame parameters. */ 3224 reflected in changed `font' frame parameters. */
3225 if (FRAMEP (frame) 3225 if (FRAMEP (frame)
3226 && (prop_index || EQ (attr, QCfont)) 3226 && (prop_index || EQ (attr, QCfont))
3227 && lface_fully_specified_p (XVECTOR (lface)->u.contents)) 3227 && lface_fully_specified_p (XVECTOR (lface)->contents))
3228 set_font_frame_param (frame, lface); 3228 set_font_frame_param (frame, lface);
3229 else 3229 else
3230#endif /* HAVE_WINDOW_SYSTEM */ 3230#endif /* HAVE_WINDOW_SYSTEM */
@@ -3404,7 +3404,7 @@ set_font_frame_param (Lisp_Object frame, Lisp_Object lface)
3404 { 3404 {
3405 if (FONT_SPEC_P (font)) 3405 if (FONT_SPEC_P (font))
3406 { 3406 {
3407 font = font_load_for_lface (f, XVECTOR (lface)->u.contents, font); 3407 font = font_load_for_lface (f, XVECTOR (lface)->contents, font);
3408 if (NILP (font)) 3408 if (NILP (font))
3409 return; 3409 return;
3410 ASET (lface, LFACE_FONT_INDEX, font); 3410 ASET (lface, LFACE_FONT_INDEX, font);
@@ -3763,8 +3763,8 @@ Default face attributes override any local face attributes. */)
3763 the local frame is defined from default specs in `face-defface-spec' 3763 the local frame is defined from default specs in `face-defface-spec'
3764 and those should be overridden by global settings. Hence the strange 3764 and those should be overridden by global settings. Hence the strange
3765 "global before local" priority. */ 3765 "global before local" priority. */
3766 lvec = XVECTOR (local_lface)->u.contents; 3766 lvec = XVECTOR (local_lface)->contents;
3767 gvec = XVECTOR (global_lface)->u.contents; 3767 gvec = XVECTOR (global_lface)->contents;
3768 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) 3768 for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
3769 if (IGNORE_DEFFACE_P (gvec[i])) 3769 if (IGNORE_DEFFACE_P (gvec[i]))
3770 ASET (local_lface, i, Qunspecified); 3770 ASET (local_lface, i, Qunspecified);
@@ -3948,8 +3948,8 @@ If FRAME is omitted or nil, use the selected frame. */)
3948 3948
3949 lface1 = lface_from_face_name (f, face1, 1); 3949 lface1 = lface_from_face_name (f, face1, 1);
3950 lface2 = lface_from_face_name (f, face2, 1); 3950 lface2 = lface_from_face_name (f, face2, 1);
3951 equal_p = lface_equal_p (XVECTOR (lface1)->u.contents, 3951 equal_p = lface_equal_p (XVECTOR (lface1)->contents,
3952 XVECTOR (lface2)->u.contents); 3952 XVECTOR (lface2)->contents);
3953 return equal_p ? Qt : Qnil; 3953 return equal_p ? Qt : Qnil;
3954} 3954}
3955 3955
@@ -4691,7 +4691,7 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector,
4691 Lisp_Object lface; 4691 Lisp_Object lface;
4692 lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), 4692 lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
4693 Qunspecified); 4693 Qunspecified);
4694 merge_face_ref (XFRAME (selected_frame), plist, XVECTOR (lface)->u.contents, 4694 merge_face_ref (XFRAME (selected_frame), plist, XVECTOR (lface)->contents,
4695 1, 0); 4695 1, 0);
4696 return lface; 4696 return lface;
4697} 4697}
@@ -5377,9 +5377,9 @@ realize_default_face (struct frame *f)
5377 ASET (lface, LFACE_STIPPLE_INDEX, Qnil); 5377 ASET (lface, LFACE_STIPPLE_INDEX, Qnil);
5378 5378
5379 /* Realize the face; it must be fully-specified now. */ 5379 /* Realize the face; it must be fully-specified now. */
5380 eassert (lface_fully_specified_p (XVECTOR (lface)->u.contents)); 5380 eassert (lface_fully_specified_p (XVECTOR (lface)->contents));
5381 check_lface (lface); 5381 check_lface (lface);
5382 memcpy (attrs, XVECTOR (lface)->u.contents, sizeof attrs); 5382 memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs);
5383 face = realize_face (c, attrs, DEFAULT_FACE_ID); 5383 face = realize_face (c, attrs, DEFAULT_FACE_ID);
5384 5384
5385#ifdef HAVE_WINDOW_SYSTEM 5385#ifdef HAVE_WINDOW_SYSTEM
diff --git a/src/xfont.c b/src/xfont.c
index 1f87fb8783e..d4d6ee7c10f 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -384,7 +384,7 @@ xfont_list_pattern (Display *display, const char *pattern,
384 if (num_fonts > 0) 384 if (num_fonts > 0)
385 { 385 {
386 char **indices = alloca (sizeof (char *) * num_fonts); 386 char **indices = alloca (sizeof (char *) * num_fonts);
387 Lisp_Object *props = XVECTOR (xfont_scratch_props)->u.contents; 387 Lisp_Object *props = XVECTOR (xfont_scratch_props)->contents;
388 Lisp_Object scripts = Qnil; 388 Lisp_Object scripts = Qnil;
389 389
390 for (i = 0; i < ASIZE (xfont_scratch_props); i++) 390 for (i = 0; i < ASIZE (xfont_scratch_props); i++)
diff --git a/src/xmenu.c b/src/xmenu.c
index d910100f77f..b2c7fb5f073 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -847,7 +847,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
847 847
848 /* Save the frame's previous menu bar contents data. */ 848 /* Save the frame's previous menu bar contents data. */
849 if (previous_menu_items_used) 849 if (previous_menu_items_used)
850 memcpy (previous_items, XVECTOR (f->menu_bar_vector)->u.contents, 850 memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
851 previous_menu_items_used * word_size); 851 previous_menu_items_used * word_size);
852 852
853 /* Fill in menu_items with the current menu bar contents. 853 /* Fill in menu_items with the current menu bar contents.
@@ -2086,7 +2086,7 @@ menu_help_callback (char const *help_string, int pane, int item)
2086 Lisp_Object pane_name; 2086 Lisp_Object pane_name;
2087 Lisp_Object menu_object; 2087 Lisp_Object menu_object;
2088 2088
2089 first_item = XVECTOR (menu_items)->u.contents; 2089 first_item = XVECTOR (menu_items)->contents;
2090 if (EQ (first_item[0], Qt)) 2090 if (EQ (first_item[0], Qt))
2091 pane_name = first_item[MENU_ITEMS_PANE_NAME]; 2091 pane_name = first_item[MENU_ITEMS_PANE_NAME];
2092 else if (EQ (first_item[0], Qquote)) 2092 else if (EQ (first_item[0], Qquote))