------------------------------------------------------------ revno: 114934 committer: Paul Eggert branch nick: trunk timestamp: Sun 2013-11-03 22:09:03 -0800 message: 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. diff: === modified file 'ChangeLog' --- ChangeLog 2013-11-02 20:54:08 +0000 +++ ChangeLog 2013-11-04 06:09:03 +0000 @@ -1,3 +1,10 @@ +2013-11-04 Paul Eggert + + Port to stricter C99 platforms. + Merge from gnulib, incorporating: + 2013-11-03 intprops: port to Oracle Studio c99 + * lib/intprops.h: Update from gnulib. + 2013-11-02 Glenn Morris * Makefile.in (check): Depend on all. === modified file 'lib/intprops.h' --- lib/intprops.h 2013-04-27 19:30:33 +0000 +++ lib/intprops.h 2013-11-04 06:09:03 +0000 @@ -89,7 +89,8 @@ /* Return 1 if the __typeof__ keyword works. This could be done by 'configure', but for now it's easier to do it by hand. */ -#if 2 <= __GNUC__ || defined __IBM__TYPEOF__ || 0x5110 <= __SUNPRO_C +#if (2 <= __GNUC__ || defined __IBM__TYPEOF__ \ + || (0x5110 <= __SUNPRO_C && !__STDC__)) # define _GL_HAVE___TYPEOF__ 1 #else # define _GL_HAVE___TYPEOF__ 0 === modified file 'src/ChangeLog' --- src/ChangeLog 2013-11-04 01:38:16 +0000 +++ src/ChangeLog 2013-11-04 06:09:03 +0000 @@ -1,3 +1,37 @@ +2013-11-04 Paul Eggert + + Port to stricter C99 platforms. + Especially, C99 prohibits nesting a struct X inside struct Y if + struct X has a flexible array member. + * 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. + * dispnew.c: Include tparam.h, for tgetent. + Do not include term.h; no longer needed. + * gnutls.c (Fgnutls_boot): Don't continue after calling a _Noreturn. + * 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. + 2013-11-04 Glenn Morris * emacs.c (usage_message): Mention that `-L :...' appends. === modified file 'src/alloc.c' --- src/alloc.c 2013-10-25 07:28:16 +0000 +++ src/alloc.c 2013-11-04 06:09:03 +0000 @@ -1280,28 +1280,32 @@ #define LARGE_STRING_BYTES 1024 -/* Struct or union describing string memory sub-allocated from an sblock. - This is where the contents of Lisp strings are stored. */ - -#ifdef GC_CHECK_STRING_BYTES - -typedef struct +/* The SDATA typedef is a struct or union describing string memory + sub-allocated from an sblock. This is where the contents of Lisp + strings are stored. */ + +struct sdata { /* Back-pointer to the string this sdata belongs to. If null, this - structure is free, and the NBYTES member of the union below + structure is free, and NBYTES (in this structure or in the union below) contains the string's byte size (the same value that STRING_BYTES would return if STRING were non-null). If non-null, STRING_BYTES (STRING) is the size of the data, and DATA contains the string's contents. */ struct Lisp_String *string; +#ifdef GC_CHECK_STRING_BYTES ptrdiff_t nbytes; +#endif + unsigned char data[FLEXIBLE_ARRAY_MEMBER]; -} sdata; - +}; + +#ifdef GC_CHECK_STRING_BYTES + +typedef struct sdata sdata; #define SDATA_NBYTES(S) (S)->nbytes #define SDATA_DATA(S) (S)->data -#define SDATA_SELECTOR(member) member #else @@ -1309,12 +1313,16 @@ { struct Lisp_String *string; - /* When STRING is non-null. */ - struct - { - struct Lisp_String *string; - unsigned char data[FLEXIBLE_ARRAY_MEMBER]; - } u; + /* When STRING is nonnull, this union is actually of type 'struct sdata', + which has a flexible array member. However, if implemented by + giving this union a member of type 'struct sdata', the union + could not be the last (flexible) member of 'struct sblock', + because C99 prohibits a flexible array member from having a type + that is itself a flexible array. So, comment this member out here, + but remember that the option's there when using this union. */ +#if 0 + struct sdata u; +#endif /* When STRING is null. */ struct @@ -1325,13 +1333,11 @@ } sdata; #define SDATA_NBYTES(S) (S)->n.nbytes -#define SDATA_DATA(S) (S)->u.data -#define SDATA_SELECTOR(member) u.member +#define SDATA_DATA(S) ((struct sdata *) (S))->data #endif /* not GC_CHECK_STRING_BYTES */ -#define SDATA_DATA_OFFSET offsetof (sdata, SDATA_SELECTOR (data)) - +enum { SDATA_DATA_OFFSET = offsetof (struct sdata, data) }; /* Structure describing a block of memory which is sub-allocated to obtain string data memory for strings. Blocks for small strings @@ -1347,8 +1353,8 @@ of the sblock if there isn't any space left in this block. */ sdata *next_free; - /* Start of data. */ - sdata first_data; + /* String data. */ + sdata data[FLEXIBLE_ARRAY_MEMBER]; }; /* Number of Lisp strings in a string_block structure. The 1020 is @@ -1464,7 +1470,7 @@ min (STRING_BYTES_BOUND, ((SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD - GC_STRING_EXTRA - - offsetof (struct sblock, first_data) + - offsetof (struct sblock, data) - SDATA_DATA_OFFSET) & ~(sizeof (EMACS_INT) - 1))); @@ -1507,7 +1513,7 @@ end = b->next_free; - for (from = &b->first_data; from < end; from = from_end) + for (from = b->data; from < end; from = from_end) { /* Compute the next FROM here because copying below may overwrite data we need to compute it. */ @@ -1535,7 +1541,7 @@ for (b = large_sblocks; b; b = b->next) { - struct Lisp_String *s = b->first_data.string; + struct Lisp_String *s = b->data[0].string; if (s) string_bytes (s); } @@ -1669,7 +1675,7 @@ if (nbytes > LARGE_STRING_BYTES) { - size_t size = offsetof (struct sblock, first_data) + needed; + size_t size = offsetof (struct sblock, data) + needed; #ifdef DOUG_LEA_MALLOC /* Prevent mmap'ing the chunk. Lisp data may not be mmap'ed @@ -1691,8 +1697,8 @@ mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); #endif - b->next_free = &b->first_data; - b->first_data.string = NULL; + b->next_free = b->data; + b->data[0].string = NULL; b->next = large_sblocks; large_sblocks = b; } @@ -1703,8 +1709,8 @@ { /* Not enough room in the current sblock. */ b = lisp_malloc (SBLOCK_SIZE, MEM_TYPE_NON_LISP); - b->next_free = &b->first_data; - b->first_data.string = NULL; + b->next_free = b->data; + b->data[0].string = NULL; b->next = NULL; if (current_sblock) @@ -1858,7 +1864,7 @@ { next = b->next; - if (b->first_data.string == NULL) + if (b->data[0].string == NULL) lisp_free (b); else { @@ -1885,7 +1891,7 @@ to, and TB_END is the end of TB. */ tb = oldest_sblock; tb_end = (sdata *) ((char *) tb + SBLOCK_SIZE); - to = &tb->first_data; + to = tb->data; /* Step through the blocks from the oldest to the youngest. We expect that old blocks will stabilize over time, so that less @@ -1895,7 +1901,7 @@ end = b->next_free; eassert ((char *) end <= (char *) b + SBLOCK_SIZE); - for (from = &b->first_data; from < end; from = from_end) + for (from = b->data; from < end; from = from_end) { /* Compute the next FROM here because copying below may overwrite data we need to compute it. */ @@ -1932,7 +1938,7 @@ tb->next_free = to; tb = tb->next; tb_end = (sdata *) ((char *) tb + SBLOCK_SIZE); - to = &tb->first_data; + to = tb->data; to_end = (sdata *) ((char *) to + nbytes + GC_STRING_EXTRA); } @@ -2606,16 +2612,35 @@ Vector Allocation ***********************************************************************/ +/* Sometimes a vector's contents are merely a pointer internally used + in vector allocation code. Usually you don't want to touch this. */ + +static struct Lisp_Vector * +next_vector (struct Lisp_Vector *v) +{ + return XUNTAG (v->contents[0], 0); +} + +static void +set_next_vector (struct Lisp_Vector *v, struct Lisp_Vector *p) +{ + v->contents[0] = make_lisp_ptr (p, 0); +} + /* This value is balanced well enough to avoid too much internal overhead for the most common cases; it's not required to be a power of two, but it's expected to be a mult-of-ROUNDUP_SIZE (see below). */ #define VECTOR_BLOCK_SIZE 4096 -/* Align allocation request sizes to be a multiple of ROUNDUP_SIZE. */ enum { - roundup_size = COMMON_MULTIPLE (word_size, USE_LSB_TAG ? GCALIGNMENT : 1) + /* Alignment of struct Lisp_Vector objects. */ + vector_alignment = COMMON_MULTIPLE (ALIGNOF_STRUCT_LISP_VECTOR, + USE_LSB_TAG ? GCALIGNMENT : 1), + + /* Vector size requests are a multiple of this. */ + roundup_size = COMMON_MULTIPLE (vector_alignment, word_size) }; /* Verify assumptions described above. */ @@ -2663,25 +2688,36 @@ eassert ((nbytes) % roundup_size == 0); \ (tmp) = VINDEX (nbytes); \ eassert ((tmp) < VECTOR_MAX_FREE_LIST_INDEX); \ - v->u.next = vector_free_lists[tmp]; \ + set_next_vector (v, vector_free_lists[tmp]); \ vector_free_lists[tmp] = (v); \ total_free_vector_slots += (nbytes) / word_size; \ } while (0) /* This internal type is used to maintain the list of large vectors - which are allocated at their own, e.g. outside of vector blocks. */ + which are allocated at their own, e.g. outside of vector blocks. + + struct large_vector itself cannot contain a struct Lisp_Vector, as + the latter contains a flexible array member and C99 does not allow + such structs to be nested. Instead, each struct large_vector + object LV is followed by a struct Lisp_Vector, which is at offset + large_vector_offset from LV, and whose address is therefore + large_vector_vec (&LV). */ struct large_vector { - union { - struct large_vector *vector; -#if USE_LSB_TAG - /* We need to maintain ROUNDUP_SIZE alignment for the vector member. */ - unsigned char c[vroundup_ct (sizeof (struct large_vector *))]; -#endif - } next; - struct Lisp_Vector v; -}; + struct large_vector *next; +}; + +enum +{ + large_vector_offset = ROUNDUP (sizeof (struct large_vector), vector_alignment) +}; + +static struct Lisp_Vector * +large_vector_vec (struct large_vector *p) +{ + return (struct Lisp_Vector *) ((char *) p + large_vector_offset); +} /* This internal type is used to maintain an underlying storage for small vectors. */ @@ -2760,7 +2796,7 @@ if (vector_free_lists[index]) { vector = vector_free_lists[index]; - vector_free_lists[index] = vector->u.next; + vector_free_lists[index] = next_vector (vector); total_free_vector_slots -= nbytes / word_size; return vector; } @@ -2774,7 +2810,7 @@ { /* This vector is larger than requested. */ vector = vector_free_lists[index]; - vector_free_lists[index] = vector->u.next; + vector_free_lists[index] = next_vector (vector); total_free_vector_slots -= nbytes / word_size; /* Excess bytes are used for the smaller vector, @@ -2933,7 +2969,7 @@ for (lv = large_vectors; lv; lv = *lvprev) { - vector = &lv->v; + vector = large_vector_vec (lv); if (VECTOR_MARKED_P (vector)) { VECTOR_UNMARK (vector); @@ -2949,11 +2985,11 @@ else total_vector_slots += header_size / word_size + vector->header.size; - lvprev = &lv->next.vector; + lvprev = &lv->next; } else { - *lvprev = lv->next.vector; + *lvprev = lv->next; lisp_free (lv); } } @@ -2987,12 +3023,12 @@ else { struct large_vector *lv - = lisp_malloc ((offsetof (struct large_vector, v.u.contents) + = lisp_malloc ((large_vector_offset + header_size + len * word_size), MEM_TYPE_VECTORLIKE); - lv->next.vector = large_vectors; + lv->next = large_vectors; large_vectors = lv; - p = &lv->v; + p = large_vector_vec (lv); } #ifdef DOUG_LEA_MALLOC @@ -3041,7 +3077,7 @@ /* Only the first lisplen slots will be traced normally by the GC. */ for (i = 0; i < lisplen; ++i) - v->u.contents[i] = Qnil; + v->contents[i] = Qnil; XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen); return v; @@ -3129,7 +3165,7 @@ p = allocate_vector (XFASTINT (length)); sizei = XFASTINT (length); for (i = 0; i < sizei; i++) - p->u.contents[i] = init; + p->contents[i] = init; XSETVECTOR (vector, p); return vector; @@ -3147,7 +3183,7 @@ register struct Lisp_Vector *p = XVECTOR (val); for (i = 0; i < nargs; i++) - p->u.contents[i] = args[i]; + p->contents[i] = args[i]; return val; } @@ -3156,14 +3192,14 @@ { /* Don't allow the global zero_vector to become a byte code object. */ eassert(0 < v->header.size); - if (v->header.size > 1 && STRINGP (v->u.contents[1]) - && STRING_MULTIBYTE (v->u.contents[1])) + if (v->header.size > 1 && STRINGP (v->contents[1]) + && STRING_MULTIBYTE (v->contents[1])) /* BYTECODE-STRING must have been produced by Emacs 20.2 or the earlier because they produced a raw 8-bit string for byte-code and now such a byte-code string is loaded as multibyte while raw 8-bit characters converted to multibyte form. Thus, now we must convert them back to the original unibyte form. */ - v->u.contents[1] = Fstring_as_unibyte (v->u.contents[1]); + v->contents[1] = Fstring_as_unibyte (v->contents[1]); XSETPVECTYPE (v, PVEC_COMPILED); } @@ -3198,7 +3234,7 @@ to be setcar'd). */ for (i = 0; i < nargs; i++) - p->u.contents[i] = args[i]; + p->contents[i] = args[i]; make_byte_code (p); XSETCOMPILED (val, p); return val; @@ -4256,9 +4292,7 @@ vector = ADVANCE (vector, vector_nbytes (vector)); } } - else if (m->type == MEM_TYPE_VECTORLIKE - && (char *) p == ((char *) m->start - + offsetof (struct large_vector, v))) + else if (m->type == MEM_TYPE_VECTORLIKE && p == large_vector_vec (m->start)) /* This memory node corresponds to a large vector. */ return 1; return 0; @@ -5189,7 +5223,7 @@ size &= PSEUDOVECTOR_SIZE_MASK; vec = XVECTOR (make_pure_vector (size)); for (i = 0; i < size; i++) - vec->u.contents[i] = Fpurecopy (AREF (obj, i)); + vec->contents[i] = Fpurecopy (AREF (obj, i)); if (COMPILEDP (obj)) { XSETPVECTYPE (vec, PVEC_COMPILED); @@ -5710,7 +5744,7 @@ The distinction is used e.g. by Lisp_Process which places extra non-Lisp_Object fields at the end of the structure... */ for (i = 0; i < size; i++) /* ...and then mark its elements. */ - mark_object (ptr->u.contents[i]); + mark_object (ptr->contents[i]); } /* Like mark_vectorlike but optimized for char-tables (and @@ -5727,7 +5761,7 @@ VECTOR_MARK (ptr); for (i = 0; i < size; i++) { - Lisp_Object val = ptr->u.contents[i]; + Lisp_Object val = ptr->contents[i]; if (INTEGERP (val) || (SYMBOLP (val) && XSYMBOL (val)->gcmarkbit)) continue; @@ -5956,10 +5990,10 @@ VECTOR_MARK (ptr); for (i = 0; i < size; i++) if (i != COMPILED_CONSTANTS) - mark_object (ptr->u.contents[i]); + mark_object (ptr->contents[i]); if (size > COMPILED_CONSTANTS) { - obj = ptr->u.contents[COMPILED_CONSTANTS]; + obj = ptr->contents[COMPILED_CONSTANTS]; goto loop; } } === modified file 'src/buffer.c' --- src/buffer.c 2013-10-29 14:46:23 +0000 +++ src/buffer.c 2013-11-04 06:09:03 +0000 @@ -4534,7 +4534,7 @@ Lisp_Object *copy = alloca (size * sizeof *copy); ptrdiff_t i; - memcpy (copy, XVECTOR (last_overlay_modification_hooks)->u.contents, + memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, size * word_size); gcpro1.var = copy; gcpro1.nvars = size; === modified file 'src/bytecode.c' --- src/bytecode.c 2013-10-04 06:51:50 +0000 +++ src/bytecode.c 2013-11-04 06:09:03 +0000 @@ -550,7 +550,7 @@ #ifdef BYTE_CODE_SAFE bytestr_length = SBYTES (bytestr); #endif - vectorp = XVECTOR (vector)->u.contents; + vectorp = XVECTOR (vector)->contents; stack.byte_string = bytestr; stack.pc = stack.byte_string_start = SDATA (bytestr); === modified file 'src/ccl.c' --- src/ccl.c 2013-09-24 06:43:20 +0000 +++ src/ccl.c 2013-11-04 06:09:03 +0000 @@ -1094,7 +1094,7 @@ ccl_prog_stack_struct[stack_idx].ic = ic; ccl_prog_stack_struct[stack_idx].eof_ic = eof_ic; stack_idx++; - ccl_prog = XVECTOR (AREF (slot, 1))->u.contents; + ccl_prog = XVECTOR (AREF (slot, 1))->contents; ic = CCL_HEADER_MAIN; eof_ic = XFASTINT (ccl_prog[CCL_HEADER_EOF]); } @@ -1936,9 +1936,9 @@ return -1; vp = XVECTOR (ccl_prog); ccl->size = vp->header.size; - ccl->prog = vp->u.contents; - ccl->eof_ic = XINT (vp->u.contents[CCL_HEADER_EOF]); - ccl->buf_magnification = XINT (vp->u.contents[CCL_HEADER_BUF_MAG]); + ccl->prog = vp->contents; + ccl->eof_ic = XINT (vp->contents[CCL_HEADER_EOF]); + ccl->buf_magnification = XINT (vp->contents[CCL_HEADER_BUF_MAG]); if (ccl->idx >= 0) { Lisp_Object slot; === modified file 'src/character.h' --- src/character.h 2013-09-24 06:43:20 +0000 +++ src/character.h 2013-11-04 06:09:03 +0000 @@ -677,7 +677,7 @@ /* Return a translation table of id number ID. */ #define GET_TRANSLATION_TABLE(id) \ - (XCDR (XVECTOR (Vtranslation_table_vector)->u.contents[(id)])) + (XCDR (XVECTOR (Vtranslation_table_vector)->contents[(id)])) INLINE_HEADER_END === modified file 'src/chartab.c' --- src/chartab.c 2013-09-24 06:43:20 +0000 +++ src/chartab.c 2013-11-04 06:09:03 +0000 @@ -1258,7 +1258,7 @@ static Lisp_Object uniprop_encode_value_run_length (Lisp_Object table, Lisp_Object value) { - Lisp_Object *value_table = XVECTOR (XCHAR_TABLE (table)->extras[4])->u.contents; + Lisp_Object *value_table = XVECTOR (XCHAR_TABLE (table)->extras[4])->contents; int i, size = ASIZE (XCHAR_TABLE (table)->extras[4]); for (i = 0; i < size; i++) @@ -1276,7 +1276,7 @@ static Lisp_Object uniprop_encode_value_numeric (Lisp_Object table, Lisp_Object value) { - Lisp_Object *value_table = XVECTOR (XCHAR_TABLE (table)->extras[4])->u.contents; + Lisp_Object *value_table = XVECTOR (XCHAR_TABLE (table)->extras[4])->contents; int i, size = ASIZE (XCHAR_TABLE (table)->extras[4]); CHECK_NUMBER (value); === modified file 'src/composite.c' --- src/composite.c 2013-10-11 06:32:29 +0000 +++ src/composite.c 2013-11-04 06:09:03 +0000 @@ -266,7 +266,7 @@ composition_table = xpalloc (composition_table, &composition_table_size, 1, -1, sizeof *composition_table); - key_contents = XVECTOR (key)->u.contents; + key_contents = XVECTOR (key)->contents; /* Check if the contents of COMPONENTS are valid if COMPONENTS is a vector or a list. It should be a sequence of: === modified file 'src/composite.h' --- src/composite.h 2013-09-24 06:43:20 +0000 +++ src/composite.h 2013-11-04 06:09:03 +0000 @@ -88,8 +88,8 @@ #define COMPOSITION_GLYPH(cmp, n) \ XINT (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \ ->key_and_value) \ - ->u.contents[cmp->hash_index * 2]) \ - ->u.contents[cmp->method == COMPOSITION_WITH_RULE_ALTCHARS \ + ->contents[cmp->hash_index * 2]) \ + ->contents[cmp->method == COMPOSITION_WITH_RULE_ALTCHARS \ ? (n) * 2 : (n)]) /* Return the encoded composition rule to compose the Nth glyph of @@ -98,8 +98,8 @@ #define COMPOSITION_RULE(cmp, n) \ XINT (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \ ->key_and_value) \ - ->u.contents[cmp->hash_index * 2]) \ - ->u.contents[(n) * 2 - 1]) + ->contents[cmp->hash_index * 2]) \ + ->contents[(n) * 2 - 1]) /* Decode encoded composition rule RULE_CODE into GREF (global reference point code), NREF (new ref. point code). Don't check RULE_CODE; === modified file 'src/dispnew.c' --- src/dispnew.c 2013-10-14 12:19:21 +0000 +++ src/dispnew.c 2013-11-04 06:09:03 +0000 @@ -42,6 +42,7 @@ #include "process.h" #include "syssignal.h" +#include "tparam.h" #ifdef HAVE_WINDOW_SYSTEM #include TERM_HEADER @@ -52,10 +53,6 @@ #include #include -#if defined (HAVE_TERM_H) && defined (GNU_LINUX) -#include /* for tgetent */ -#endif - #ifdef WINDOWSNT #include "w32.h" #endif === modified file 'src/disptab.h' --- src/disptab.h 2013-09-24 06:43:20 +0000 +++ src/disptab.h 2013-11-04 06:09:03 +0000 @@ -59,7 +59,7 @@ /* Return the current base (for indexing) of the GLYPH table, or 0 if the table isn't currently valid. */ #define GLYPH_TABLE_BASE \ - ((VECTORP (Vglyph_table)) ? XVECTOR (Vglyph_table)->u.contents : 0) + ((VECTORP (Vglyph_table)) ? XVECTOR (Vglyph_table)->contents : 0) /* Given BASE and LEN returned by the two previous macros, return nonzero if the GLYPH code G should be output as a single === modified file 'src/fns.c' --- src/fns.c 2013-10-16 09:56:36 +0000 +++ src/fns.c 2013-11-04 06:09:03 +0000 @@ -1602,7 +1602,7 @@ for (i = n = 0; i < ASIZE (seq); ++i) if (NILP (Fequal (AREF (seq, i), elt))) - p->u.contents[n++] = AREF (seq, i); + p->contents[n++] = AREF (seq, i); XSETVECTOR (seq, p); } @@ -3446,7 +3446,7 @@ { struct Lisp_Vector *v; ptrdiff_t i, incr, incr_max, old_size, new_size; - ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->u.contents; + ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->contents; ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max ? nitems_max : C_language_max); eassert (VECTORP (vec)); @@ -3458,9 +3458,9 @@ memory_full (SIZE_MAX); new_size = old_size + incr; v = allocate_vector (new_size); - memcpy (v->u.contents, XVECTOR (vec)->u.contents, old_size * sizeof *v->u.contents); + memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents); for (i = old_size; i < new_size; ++i) - v->u.contents[i] = Qnil; + v->contents[i] = Qnil; XSETVECTOR (vec, v); return vec; } === modified file 'src/fontset.c' --- src/fontset.c 2013-10-29 16:11:50 +0000 +++ src/fontset.c 2013-11-04 06:09:03 +0000 @@ -453,7 +453,7 @@ } if (score_changed) - qsort (XVECTOR (vec)->u.contents, size, word_size, + qsort (XVECTOR (vec)->contents, size, word_size, fontset_compare_rfontdef); XSETCAR (font_group, make_number (charset_ordered_list_tick)); } === modified file 'src/gnutls.c' --- src/gnutls.c 2013-10-17 06:42:21 +0000 +++ src/gnutls.c 2013-11-04 06:09:03 +0000 @@ -791,16 +791,10 @@ CHECK_LIST (proplist); if (NILP (Fgnutls_available_p ())) - { - error ("GnuTLS not available"); - return gnutls_make_error (GNUTLS_EMACS_ERROR_NOT_LOADED); - } + error ("GnuTLS not available"); if (!EQ (type, Qgnutls_x509pki) && !EQ (type, Qgnutls_anon)) - { - error ("Invalid GnuTLS credential type"); - return gnutls_make_error (GNUTLS_EMACS_ERROR_INVALID_TYPE); - } + error ("Invalid GnuTLS credential type"); hostname = Fplist_get (proplist, QCgnutls_bootprop_hostname); priority_string = Fplist_get (proplist, QCgnutls_bootprop_priority); === modified file 'src/indent.c' --- src/indent.c 2013-09-24 06:43:20 +0000 +++ src/indent.c 2013-11-04 06:09:03 +0000 @@ -118,7 +118,7 @@ for (i = 0; i < 256; i++) if (character_width (i, disptab) - != XFASTINT (widthtab->u.contents[i])) + != XFASTINT (widthtab->contents[i])) return 0; return 1; @@ -138,7 +138,7 @@ eassert (widthtab->header.size == 256); for (i = 0; i < 256; i++) - XSETFASTINT (widthtab->u.contents[i], character_width (i, disptab)); + XSETFASTINT (widthtab->contents[i], character_width (i, disptab)); } /* Allocate or free the width run cache, as requested by the @@ -1136,7 +1136,7 @@ width_run_cache_on_off (); if (dp == buffer_display_table ()) width_table = (VECTORP (BVAR (current_buffer, width_table)) - ? XVECTOR (BVAR (current_buffer, width_table))->u.contents + ? XVECTOR (BVAR (current_buffer, width_table))->contents : 0); else /* If the window has its own display table, we can't use the width === modified file 'src/keyboard.c' --- src/keyboard.c 2013-10-29 21:05:35 +0000 +++ src/keyboard.c 2013-11-04 06:09:03 +0000 @@ -4357,7 +4357,7 @@ if (! (VECTORP (timer) && ASIZE (timer) == 9)) return 0; - vector = XVECTOR (timer)->u.contents; + vector = XVECTOR (timer)->contents; if (! NILP (vector[0])) return 0; @@ -7987,7 +7987,7 @@ discard any previously made item. */ for (i = 0; i < ntool_bar_items; i += TOOL_BAR_ITEM_NSLOTS) { - Lisp_Object *v = XVECTOR (tool_bar_items_vector)->u.contents + i; + Lisp_Object *v = XVECTOR (tool_bar_items_vector)->contents + i; if (EQ (key, v[TOOL_BAR_ITEM_KEY])) { @@ -8311,7 +8311,7 @@ /* Append entries from tool_bar_item_properties to the end of tool_bar_items_vector. */ vcopy (tool_bar_items_vector, ntool_bar_items, - XVECTOR (tool_bar_item_properties)->u.contents, TOOL_BAR_ITEM_NSLOTS); + XVECTOR (tool_bar_item_properties)->contents, TOOL_BAR_ITEM_NSLOTS); ntool_bar_items += TOOL_BAR_ITEM_NSLOTS; } @@ -9915,7 +9915,7 @@ doc: /* Return vector of last 300 events, not counting those from keyboard macros. */) (void) { - Lisp_Object *keys = XVECTOR (recent_keys)->u.contents; + Lisp_Object *keys = XVECTOR (recent_keys)->contents; Lisp_Object val; if (total_keys < NUM_RECENT_KEYS) @@ -9941,7 +9941,7 @@ (void) { return make_event_array (this_command_key_count, - XVECTOR (this_command_keys)->u.contents); + XVECTOR (this_command_keys)->contents); } DEFUN ("this-command-keys-vector", Fthis_command_keys_vector, Sthis_command_keys_vector, 0, 0, 0, @@ -9953,7 +9953,7 @@ (void) { return Fvector (this_command_key_count, - XVECTOR (this_command_keys)->u.contents); + XVECTOR (this_command_keys)->contents); } DEFUN ("this-single-command-keys", Fthis_single_command_keys, @@ -9968,7 +9968,7 @@ { return Fvector (this_command_key_count - this_single_command_key_start, - (XVECTOR (this_command_keys)->u.contents + (XVECTOR (this_command_keys)->contents + this_single_command_key_start)); } @@ -9982,7 +9982,7 @@ The value is always a vector. */) (void) { - return Fvector (raw_keybuf_count, XVECTOR (raw_keybuf)->u.contents); + return Fvector (raw_keybuf_count, XVECTOR (raw_keybuf)->contents); } DEFUN ("reset-this-command-lengths", Freset_this_command_lengths, === modified file 'src/lisp.h' --- src/lisp.h 2013-10-29 16:08:08 +0000 +++ src/lisp.h 2013-11-04 06:09:03 +0000 @@ -406,8 +406,10 @@ #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 /* Idea stolen from GDB. Pedantic GCC complains about enum bitfields, - MSVC doesn't support them, and xlc complains vociferously about them. */ -#if defined __STRICT_ANSI__ || defined _MSC_VER || defined __IBMC__ + MSVC doesn't support them, and xlc and Oracle Studio c99 complain + vociferously about them. */ +#if (defined __STRICT_ANSI__ || defined _MSC_VER || defined __IBMC__ \ + || (defined __SUNPRO_C && __STDC__)) #define ENUM_BF(TYPE) unsigned int #else #define ENUM_BF(TYPE) enum TYPE @@ -1175,22 +1177,22 @@ ptrdiff_t size; }; -/* Regular vector is just a header plus array of Lisp_Objects... */ +/* A regular vector is just a header plus an array of Lisp_Objects. */ struct Lisp_Vector { struct vectorlike_header header; - union { - /* ...but sometimes there is also a pointer internally used in - vector allocation code. Usually you don't want to touch this. */ - struct Lisp_Vector *next; - - /* We can't use FLEXIBLE_ARRAY_MEMBER here. */ - Lisp_Object contents[1]; - } u; - }; - -/* A boolvector is a kind of vectorlike, with contents are like a string. */ + Lisp_Object contents[FLEXIBLE_ARRAY_MEMBER]; + }; + +/* C11 prohibits alignof (struct Lisp_Vector), so compute it manually. */ +enum + { + ALIGNOF_STRUCT_LISP_VECTOR + = alignof (union { struct vectorlike_header a; Lisp_Object b; }) + }; + +/* A boolvector is a kind of vectorlike, with contents like a string. */ struct Lisp_Bool_Vector { @@ -1216,7 +1218,7 @@ enum { - header_size = offsetof (struct Lisp_Vector, u.contents), + header_size = offsetof (struct Lisp_Vector, contents), bool_header_size = offsetof (struct Lisp_Bool_Vector, data), word_size = sizeof (Lisp_Object) }; @@ -1226,13 +1228,13 @@ INLINE Lisp_Object AREF (Lisp_Object array, ptrdiff_t idx) { - return XVECTOR (array)->u.contents[idx]; + return XVECTOR (array)->contents[idx]; } INLINE Lisp_Object * aref_addr (Lisp_Object array, ptrdiff_t idx) { - return & XVECTOR (array)->u.contents[idx]; + return & XVECTOR (array)->contents[idx]; } INLINE ptrdiff_t @@ -1245,7 +1247,7 @@ ASET (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) { eassert (0 <= idx && idx < ASIZE (array)); - XVECTOR (array)->u.contents[idx] = val; + XVECTOR (array)->contents[idx] = val; } INLINE void @@ -1254,7 +1256,7 @@ /* Like ASET, but also can be used in the garbage collector: sweep_weak_table calls set_hash_key etc. while the table is marked. */ eassert (0 <= idx && idx < (ASIZE (array) & ~ARRAY_MARK_FLAG)); - XVECTOR (array)->u.contents[idx] = val; + XVECTOR (array)->contents[idx] = val; } /* If a struct is made to look like a vector, this macro returns the length @@ -1758,14 +1760,14 @@ { ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_??? */ unsigned gcmarkbit : 1; - int spacer : 15; + unsigned spacer : 15; }; struct Lisp_Marker { ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Marker */ unsigned gcmarkbit : 1; - int spacer : 13; + unsigned spacer : 13; /* This flag is temporarily used in the functions decode/encode_coding_object to record that the marker position must be adjusted after the conversion. */ @@ -1819,7 +1821,7 @@ { ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */ unsigned gcmarkbit : 1; - int spacer : 15; + unsigned spacer : 15; struct Lisp_Overlay *next; Lisp_Object start; Lisp_Object end; @@ -1897,7 +1899,7 @@ { ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */ unsigned gcmarkbit : 1; - int spacer : 32 - (16 + 1 + SAVE_TYPE_BITS); + unsigned spacer : 32 - (16 + 1 + SAVE_TYPE_BITS); /* V->data may hold up to SAVE_VALUE_SLOTS entries. The type of V's data entries are determined by V->save_type. E.g., if @@ -1973,7 +1975,7 @@ { ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Free */ unsigned gcmarkbit : 1; - int spacer : 15; + unsigned spacer : 15; union Lisp_Misc *chain; }; @@ -2737,7 +2739,7 @@ } let; struct { ENUM_BF (specbind_tag) kind : CHAR_BIT; - bool debug_on_exit : 1; + unsigned debug_on_exit : 1; Lisp_Object function; Lisp_Object *args; ptrdiff_t nargs; @@ -3089,7 +3091,7 @@ vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count) { eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v)); - memcpy (XVECTOR (v)->u.contents + offset, args, count * sizeof *args); + memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args); } /* Functions to modify hash tables. */ === modified file 'src/lread.c' --- src/lread.c 2013-09-26 03:46:47 +0000 +++ src/lread.c 2013-11-04 06:09:03 +0000 @@ -3462,7 +3462,7 @@ vector = Fmake_vector (len, Qnil); size = ASIZE (vector); - ptr = XVECTOR (vector)->u.contents; + ptr = XVECTOR (vector)->contents; for (i = 0; i < size; i++) { item = Fcar (tem); === modified file 'src/msdos.c' --- src/msdos.c 2013-09-26 07:37:16 +0000 +++ src/msdos.c 2013-11-04 06:09:03 +0000 @@ -2387,7 +2387,7 @@ and then the scan code. */) (void) { - Lisp_Object val, *keys = XVECTOR (recent_doskeys)->u.contents; + Lisp_Object val, *keys = XVECTOR (recent_doskeys)->contents; if (total_doskeys < NUM_RECENT_DOSKEYS) return Fvector (total_doskeys, keys); === modified file 'src/process.c' --- src/process.c 2013-10-17 06:42:21 +0000 +++ src/process.c 2013-11-04 06:09:03 +0000 @@ -1333,15 +1333,15 @@ for (i = 0; i < nargs; i++) { - if (! RANGED_INTEGERP (0, p->u.contents[i], 65535)) + if (! RANGED_INTEGERP (0, p->contents[i], 65535)) return Qnil; if (nargs <= 5 /* IPv4 */ && i < 4 /* host, not port */ - && XINT (p->u.contents[i]) > 255) + && XINT (p->contents[i]) > 255) return Qnil; - args[i+1] = p->u.contents[i]; + args[i+1] = p->contents[i]; } return Fformat (nargs+1, args); @@ -1983,7 +1983,7 @@ len = sizeof (sin->sin_addr) + 1; address = Fmake_vector (make_number (len), Qnil); p = XVECTOR (address); - p->u.contents[--len] = make_number (ntohs (sin->sin_port)); + p->contents[--len] = make_number (ntohs (sin->sin_port)); cp = (unsigned char *) &sin->sin_addr; break; } @@ -1995,9 +1995,9 @@ len = sizeof (sin6->sin6_addr)/2 + 1; address = Fmake_vector (make_number (len), Qnil); p = XVECTOR (address); - p->u.contents[--len] = make_number (ntohs (sin6->sin6_port)); + p->contents[--len] = make_number (ntohs (sin6->sin6_port)); for (i = 0; i < len; i++) - p->u.contents[i] = make_number (ntohs (ip6[i])); + p->contents[i] = make_number (ntohs (ip6[i])); return address; } #endif @@ -2022,7 +2022,7 @@ i = 0; while (i < len) - p->u.contents[i++] = make_number (*cp++); + p->contents[i++] = make_number (*cp++); return address; } @@ -2093,7 +2093,7 @@ { struct sockaddr_in *sin = (struct sockaddr_in *) sa; len = sizeof (sin->sin_addr) + 1; - hostport = XINT (p->u.contents[--len]); + hostport = XINT (p->contents[--len]); sin->sin_port = htons (hostport); cp = (unsigned char *)&sin->sin_addr; sa->sa_family = family; @@ -2104,12 +2104,12 @@ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa; uint16_t *ip6 = (uint16_t *)&sin6->sin6_addr; len = sizeof (sin6->sin6_addr) + 1; - hostport = XINT (p->u.contents[--len]); + hostport = XINT (p->contents[--len]); sin6->sin6_port = htons (hostport); for (i = 0; i < len; i++) - if (INTEGERP (p->u.contents[i])) + if (INTEGERP (p->contents[i])) { - int j = XFASTINT (p->u.contents[i]) & 0xffff; + int j = XFASTINT (p->contents[i]) & 0xffff; ip6[i] = ntohs (j); } sa->sa_family = family; @@ -2140,8 +2140,8 @@ } for (i = 0; i < len; i++) - if (INTEGERP (p->u.contents[i])) - *cp++ = XFASTINT (p->u.contents[i]) & 0xff; + if (INTEGERP (p->contents[i])) + *cp++ = XFASTINT (p->contents[i]) & 0xff; } #ifdef DATAGRAM_SOCKETS @@ -3723,7 +3723,9 @@ any = 1; for (n = 0; n < 6; n++) - p->u.contents[n] = make_number (((unsigned char *)&rq.ifr_hwaddr.sa_data[0])[n]); + p->contents[n] = make_number (((unsigned char *) + &rq.ifr_hwaddr.sa_data[0]) + [n]); elt = Fcons (make_number (rq.ifr_hwaddr.sa_family), hwaddr); } #elif defined (HAVE_GETIFADDRS) && defined (LLADDR) @@ -3746,7 +3748,7 @@ memcpy (linkaddr, LLADDR (sdl), sdl->sdl_alen); for (n = 0; n < 6; n++) - p->u.contents[n] = make_number (linkaddr[n]); + p->contents[n] = make_number (linkaddr[n]); elt = Fcons (make_number (it->ifa_addr->sa_family), hwaddr); break; === modified file 'src/term.c' --- src/term.c 2013-10-17 06:42:21 +0000 +++ src/term.c 2013-11-04 06:09:03 +0000 @@ -3478,7 +3478,7 @@ Lisp_Object pane_name; Lisp_Object menu_object; - first_item = XVECTOR (menu_items)->u.contents; + first_item = XVECTOR (menu_items)->contents; if (EQ (first_item[0], Qt)) pane_name = first_item[MENU_ITEMS_PANE_NAME]; else if (EQ (first_item[0], Qquote)) === modified file 'src/w32.c' --- src/w32.c 2013-10-17 06:42:21 +0000 +++ src/w32.c 2013-11-04 06:09:03 +0000 @@ -7621,7 +7621,7 @@ /* Hardware address and its family. */ for (n = 0; n < adapter->AddressLength; n++) - p->u.contents[n] = make_number ((int) adapter->Address[n]); + p->contents[n] = make_number ((int) adapter->Address[n]); /* Windows does not support AF_LINK or AF_PACKET family of addresses. Use an arbitrary family number that is identical to what GNU/Linux returns. */ === modified file 'src/w32menu.c' --- src/w32menu.c 2013-09-29 18:38:56 +0000 +++ src/w32menu.c 2013-11-04 06:09:03 +0000 @@ -326,7 +326,7 @@ /* Save the frame's previous menu bar contents data. */ if (previous_menu_items_used) - memcpy (previous_items, XVECTOR (f->menu_bar_vector)->u.contents, + memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents, previous_menu_items_used * word_size); /* Fill in menu_items with the current menu bar contents. === modified file 'src/window.c' --- src/window.c 2013-10-08 17:49:20 +0000 +++ src/window.c 2013-11-04 06:09:03 +0000 @@ -5405,7 +5405,7 @@ }; #define SAVED_WINDOW_N(swv,n) \ - ((struct saved_window *) (XVECTOR ((swv)->u.contents[(n)]))) + ((struct saved_window *) (XVECTOR ((swv)->contents[(n)]))) DEFUN ("window-configuration-p", Fwindow_configuration_p, Swindow_configuration_p, 1, 1, 0, doc: /* Return t if OBJECT is a window-configuration object. */) === modified file 'src/xdisp.c' --- src/xdisp.c 2013-10-29 16:11:50 +0000 +++ src/xdisp.c 2013-11-04 06:09:03 +0000 @@ -4412,8 +4412,8 @@ if (it->dp && VECTORP (DISP_INVIS_VECTOR (it->dp))) { struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp)); - it->dpvec = v->u.contents; - it->dpend = v->u.contents + v->header.size; + it->dpvec = v->contents; + it->dpend = v->contents + v->header.size; } else { @@ -6714,8 +6714,8 @@ if (v->header.size) { it->dpvec_char_len = it->len; - it->dpvec = v->u.contents; - it->dpend = v->u.contents + v->header.size; + it->dpvec = v->contents; + it->dpend = v->contents + v->header.size; it->current.dpvec_index = 0; it->dpvec_face_id = -1; it->saved_face_id = it->face_id; @@ -27585,7 +27585,7 @@ if (VECTORP (XCDR (hot_spot))) { struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot)); - Lisp_Object *poly = v->u.contents; + Lisp_Object *poly = v->contents; ptrdiff_t n = v->header.size; ptrdiff_t i; int inside = 0; === modified file 'src/xfaces.c' --- src/xfaces.c 2013-11-02 13:14:55 +0000 +++ src/xfaces.c 2013-11-04 06:09:03 +0000 @@ -1569,7 +1569,7 @@ vec = Fvconcat (ndrivers, drivers); nfonts = ASIZE (vec); - qsort (XVECTOR (vec)->u.contents, nfonts, word_size, + qsort (XVECTOR (vec)->contents, nfonts, word_size, compare_fonts_by_sort_order); result = Qnil; @@ -1839,7 +1839,7 @@ if (!NILP (lface)) { eassert (LFACEP (lface)); - check_lface_attrs (XVECTOR (lface)->u.contents); + check_lface_attrs (XVECTOR (lface)->contents); } } @@ -2016,7 +2016,7 @@ lface = lface_from_face_name_no_resolve (f, face_name, signal_p); if (! NILP (lface)) - memcpy (attrs, XVECTOR (lface)->u.contents, + memcpy (attrs, XVECTOR (lface)->contents, LFACE_VECTOR_SIZE * sizeof *attrs); return !NILP (lface); @@ -2706,7 +2706,7 @@ copy = Finternal_make_lisp_face (to, new_frame); } - vcopy (copy, 0, XVECTOR (lface)->u.contents, LFACE_VECTOR_SIZE); + vcopy (copy, 0, XVECTOR (lface)->contents, LFACE_VECTOR_SIZE); /* Changing a named face means that all realized faces depending on that face are invalid. Since we cannot tell which realized faces @@ -3126,7 +3126,7 @@ f = XFRAME (frame); if (! FONT_OBJECT_P (value)) { - Lisp_Object *attrs = XVECTOR (lface)->u.contents; + Lisp_Object *attrs = XVECTOR (lface)->contents; Lisp_Object font_object; font_object = font_load_for_lface (f, attrs, value); @@ -3194,7 +3194,7 @@ the font to nil so that the font selector doesn't think that the attribute is mandatory. Also, clear the average width. */ - font_clear_prop (XVECTOR (lface)->u.contents, prop_index); + font_clear_prop (XVECTOR (lface)->contents, prop_index); } /* Changing a named face means that all realized faces depending on @@ -3224,7 +3224,7 @@ reflected in changed `font' frame parameters. */ if (FRAMEP (frame) && (prop_index || EQ (attr, QCfont)) - && lface_fully_specified_p (XVECTOR (lface)->u.contents)) + && lface_fully_specified_p (XVECTOR (lface)->contents)) set_font_frame_param (frame, lface); else #endif /* HAVE_WINDOW_SYSTEM */ @@ -3404,7 +3404,7 @@ { if (FONT_SPEC_P (font)) { - font = font_load_for_lface (f, XVECTOR (lface)->u.contents, font); + font = font_load_for_lface (f, XVECTOR (lface)->contents, font); if (NILP (font)) return; ASET (lface, LFACE_FONT_INDEX, font); @@ -3763,8 +3763,8 @@ the local frame is defined from default specs in `face-defface-spec' and those should be overridden by global settings. Hence the strange "global before local" priority. */ - lvec = XVECTOR (local_lface)->u.contents; - gvec = XVECTOR (global_lface)->u.contents; + lvec = XVECTOR (local_lface)->contents; + gvec = XVECTOR (global_lface)->contents; for (i = 1; i < LFACE_VECTOR_SIZE; ++i) if (IGNORE_DEFFACE_P (gvec[i])) ASET (local_lface, i, Qunspecified); @@ -3948,8 +3948,8 @@ lface1 = lface_from_face_name (f, face1, 1); lface2 = lface_from_face_name (f, face2, 1); - equal_p = lface_equal_p (XVECTOR (lface1)->u.contents, - XVECTOR (lface2)->u.contents); + equal_p = lface_equal_p (XVECTOR (lface1)->contents, + XVECTOR (lface2)->contents); return equal_p ? Qt : Qnil; } @@ -4691,7 +4691,7 @@ Lisp_Object lface; lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), Qunspecified); - merge_face_ref (XFRAME (selected_frame), plist, XVECTOR (lface)->u.contents, + merge_face_ref (XFRAME (selected_frame), plist, XVECTOR (lface)->contents, 1, 0); return lface; } @@ -5377,9 +5377,9 @@ ASET (lface, LFACE_STIPPLE_INDEX, Qnil); /* Realize the face; it must be fully-specified now. */ - eassert (lface_fully_specified_p (XVECTOR (lface)->u.contents)); + eassert (lface_fully_specified_p (XVECTOR (lface)->contents)); check_lface (lface); - memcpy (attrs, XVECTOR (lface)->u.contents, sizeof attrs); + memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs); face = realize_face (c, attrs, DEFAULT_FACE_ID); #ifdef HAVE_WINDOW_SYSTEM === modified file 'src/xfont.c' --- src/xfont.c 2013-10-25 06:55:36 +0000 +++ src/xfont.c 2013-11-04 06:09:03 +0000 @@ -384,7 +384,7 @@ if (num_fonts > 0) { char **indices = alloca (sizeof (char *) * num_fonts); - Lisp_Object *props = XVECTOR (xfont_scratch_props)->u.contents; + Lisp_Object *props = XVECTOR (xfont_scratch_props)->contents; Lisp_Object scripts = Qnil; for (i = 0; i < ASIZE (xfont_scratch_props); i++) === modified file 'src/xmenu.c' --- src/xmenu.c 2013-10-10 10:06:17 +0000 +++ src/xmenu.c 2013-11-04 06:09:03 +0000 @@ -847,7 +847,7 @@ /* Save the frame's previous menu bar contents data. */ if (previous_menu_items_used) - memcpy (previous_items, XVECTOR (f->menu_bar_vector)->u.contents, + memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents, previous_menu_items_used * word_size); /* Fill in menu_items with the current menu bar contents. @@ -2086,7 +2086,7 @@ Lisp_Object pane_name; Lisp_Object menu_object; - first_item = XVECTOR (menu_items)->u.contents; + first_item = XVECTOR (menu_items)->contents; if (EQ (first_item[0], Qt)) pane_name = first_item[MENU_ITEMS_PANE_NAME]; else if (EQ (first_item[0], Qquote)) ------------------------------------------------------------ revno: 114933 author: Michal Nazarewicz committer: Stefan Monnier branch nick: trunk timestamp: Sun 2013-11-03 23:29:59 -0500 message: * lisp/textmodes/fill.el (fill-single-char-nobreak-p): New function checking whether point is after a 1-letter word. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-11-04 01:36:14 +0000 +++ etc/NEWS 2013-11-04 04:29:59 +0000 @@ -180,6 +180,12 @@ ** The default value of `comment-use-global-state' is changed to t, and this variable has been marked obsolete. +** `fill-single-char-nobreak-p' prevents fill from breaking a line after +a 1-letter word, which is an error according to Polish and +Czech typography rules. To globally enable this feature, evaluate: + + (add-hook 'fill-nobreak-predicate 'fill-single-char-nobreak-p) + * Editing Changes in Emacs 24.4 === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-04 03:44:23 +0000 +++ lisp/ChangeLog 2013-11-04 04:29:59 +0000 @@ -1,4 +1,9 @@ -2013-11-03 Nathan Trapuzzano (tiny change) +2013-11-04 Michal Nazarewicz + + * textmodes/fill.el (fill-single-char-nobreak-p): New function + checking whether point is after a 1-letter word. + +2013-11-04 Nathan Trapuzzano (tiny change) * progmodes/cperl-mode.el (cperl-font-lock-fontify-region-function): Don't infloop when expanding region over `multiline' syntax-type that === modified file 'lisp/textmodes/fill.el' --- lisp/textmodes/fill.el 2013-08-23 15:31:45 +0000 +++ lisp/textmodes/fill.el 2013-11-04 04:29:59 +0000 @@ -329,13 +329,24 @@ (and (memq (preceding-char) '(?\t ?\s)) (eq (char-syntax (following-char)) ?w))))))) +(defun fill-single-char-nobreak-p () + "Return t if point is placed just after a 1-letter word. +This is used in `fill-nobreak-predicate' to prevent breaking line just +after a 1-letter word (usually conjunction or preposition) which is +considered composition error in Polish and Czech typography." + (save-excursion + (skip-chars-backward " \t") + (backward-char 2) + (looking-at "[[:space:]][[:alpha:]]"))) + (defcustom fill-nobreak-predicate nil "List of predicates for recognizing places not to break a line. The predicates are called with no arguments, with point at the place to be tested. If it returns t, fill commands do not break the line there." :group 'fill :type 'hook - :options '(fill-french-nobreak-p fill-single-word-nobreak-p)) + :options '(fill-french-nobreak-p fill-single-word-nobreak-p + fill-single-char-nobreak-p)) (defcustom fill-nobreak-invisible nil "Non-nil means that fill commands do not break lines in invisible text." ------------------------------------------------------------ revno: 114932 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15778 author: Nathan Trapuzzano committer: Stefan Monnier branch nick: trunk timestamp: Sun 2013-11-03 22:44:23 -0500 message: * lisp/progmodes/cperl-mode.el (cperl-font-lock-fontify-region-function): Don't infloop when expanding region over `multiline' syntax-type that begins a line. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-04 03:06:54 +0000 +++ lisp/ChangeLog 2013-11-04 03:44:23 +0000 @@ -1,3 +1,9 @@ +2013-11-03 Nathan Trapuzzano (tiny change) + + * progmodes/cperl-mode.el (cperl-font-lock-fontify-region-function): + Don't infloop when expanding region over `multiline' syntax-type that + begins a line (bug#15778). + 2013-11-04 Stefan Monnier * rect.el (rectangle-mark-mode): Rename from rectangle-mark. === modified file 'lisp/progmodes/cperl-mode.el' --- lisp/progmodes/cperl-mode.el 2013-09-12 05:48:22 +0000 +++ lisp/progmodes/cperl-mode.el 2013-11-04 03:44:23 +0000 @@ -8900,8 +8900,9 @@ (beginning-of-line) (eq (get-text-property (setq beg (point)) 'syntax-type) 'multiline))) - (if (setq beg (cperl-beginning-of-property beg 'syntax-type)) - (goto-char beg))) + (let ((new-beg (cperl-beginning-of-property beg 'syntax-type))) + (setq beg (if (= new-beg beg) nil new-beg)) + (goto-char new-beg))) (setq beg (point)) (goto-char end) (while (and end ------------------------------------------------------------ revno: 114931 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15796 committer: Stefan Monnier branch nick: trunk timestamp: Sun 2013-11-03 22:06:54 -0500 message: * lisp/rect.el (rectangle-mark-mode): Rename from rectangle-mark. Make it into a proper minor mode. (rectangle--region): (implicitly) rename to rectangle-mark-mode. (rectangle-mark-mode-map): New keymap. (rectangle--highlight-for-redisplay): Fix some corner cases. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-04 01:36:14 +0000 +++ lisp/ChangeLog 2013-11-04 03:06:54 +0000 @@ -1,3 +1,11 @@ +2013-11-04 Stefan Monnier + + * rect.el (rectangle-mark-mode): Rename from rectangle-mark. + Make it into a proper minor mode. + (rectangle--region): (implicitly) rename to rectangle-mark-mode. + (rectangle-mark-mode-map): New keymap. + (rectangle--highlight-for-redisplay): Fix some corner cases (bug#15796). + 2013-11-04 Glenn Morris * startup.el (command-line-1): Allow `-L :...' to append to load-path. === modified file 'lisp/rect.el' --- lisp/rect.el 2013-10-29 16:11:50 +0000 +++ lisp/rect.el 2013-11-04 03:06:54 +0000 @@ -420,11 +420,8 @@ ;; - lots of commands handle the region without paying attention to its ;; rectangular shape. -(defvar-local rectangle--region nil - "If non-nil, the region is meant to delimit a rectangle.") - (add-hook 'deactivate-mark-hook - (lambda () (kill-local-variable 'rectangle--region))) + (lambda () (rectangle-mark-mode -1))) (add-function :around redisplay-highlight-region-function #'rectangle--highlight-for-redisplay) @@ -433,17 +430,25 @@ (add-function :around region-extract-function #'rectangle--extract-region) +(defvar rectangle-mark-mode-map + (let ((map (make-sparse-keymap))) + (define-key map [?\C-o] 'open-rectangle) + (define-key map [?\C-t] 'string-rectangle) + ;; (define-key map [remap open-line] 'open-rectangle) + ;; (define-key map [remap transpose-chars] 'string-rectangle) + map) + "Keymap used while marking a rectangular region.") + ;;;###autoload -(defun rectangle-mark () - "Toggle the region as rectangular." - (interactive) - (if rectangle--region - (kill-local-variable 'rectangle--region) - (unless (region-active-p) (push-mark-command t)) - (setq rectangle--region t))) +(define-minor-mode rectangle-mark-mode + "Toggle the region as rectangular. +Activates the region if needed. Only lasts until the region is deactivated." + nil nil nil + (when rectangle-mark-mode + (unless (region-active-p) (push-mark-command t)))) (defun rectangle--extract-region (orig &optional delete) - (if (not rectangle--region) + (if (not rectangle-mark-mode) (funcall orig delete) (let* ((strs (funcall (if delete #'delete-extract-rectangle @@ -473,7 +478,7 @@ (defun rectangle--highlight-for-redisplay (orig start end window rol) (cond - ((not rectangle--region) + ((not rectangle-mark-mode) (funcall orig start end window rol)) ((and (eq 'rectangle (car-safe rol)) (eq (nth 1 rol) (buffer-modified-tick)) @@ -535,10 +540,17 @@ (eq (char-before right) ?\t)) (setq right (1- right)) (move-overlay ol left right) - (goto-char right) - (let ((str (make-string (- rightcol (current-column)) ?\s))) - (put-text-property 0 (length str) 'face 'region str) - (overlay-put ol 'after-string str))) + (if (= rightcol leftcol) + (overlay-put ol 'after-string nil) + (goto-char right) + (let ((str (make-string + (- rightcol (max leftcol (current-column))) ?\s))) + (put-text-property 0 (length str) 'face 'region str) + (when (= left right) + ;; If cursor happens to be here, draw it *before* rather + ;; than after this highlighted pseudo-text. + (put-text-property 0 1 'cursor 1 str)) + (overlay-put ol 'after-string str)))) ((overlay-get ol 'after-string) (overlay-put ol 'after-string nil))) (when (= leftcol rightcol) ------------------------------------------------------------ revno: 114930 committer: Glenn Morris branch nick: trunk timestamp: Sun 2013-11-03 17:48:08 -0800 message: * test/automated/Makefile.in (abs_srcdir): Remove. (emacs): Unset EMACSLOADPATH. (.el.elc, check): Use -L to append srcdir to load-path. diff: === modified file 'test/ChangeLog' --- test/ChangeLog 2013-11-02 20:54:08 +0000 +++ test/ChangeLog 2013-11-04 01:48:08 +0000 @@ -1,3 +1,9 @@ +2013-11-04 Glenn Morris + + * automated/Makefile.in (abs_srcdir): Remove. + (emacs): Unset EMACSLOADPATH. + (.el.elc, check): Use -L to append srcdir to load-path. + 2013-11-02 Glenn Morris * automated/Makefile.in (top_builddir, abs_test, abs_lispsrc, lisp) === modified file 'test/automated/Makefile.in' --- test/automated/Makefile.in 2013-11-02 20:54:08 +0000 +++ test/automated/Makefile.in 2013-11-04 01:48:08 +0000 @@ -20,7 +20,6 @@ SHELL = @SHELL@ srcdir = @srcdir@ -abs_srcdir = @abs_srcdir@ VPATH = $(srcdir) # We never change directory before running Emacs, so a relative file @@ -35,7 +34,8 @@ BYTE_COMPILE_EXTRA_FLAGS = # The actual Emacs command run in the targets below. -emacs = EMACSLOADPATH="$(abs_srcdir)/../../lisp:$(abs_srcdir)" LC_ALL=C "$(EMACS)" $(EMACSOPT) +# Prevent any setting of EMACSLOADPATH in user environment causing problems. +emacs = unset EMACSLOADPATH; LC_ALL=C "$(EMACS)" $(EMACSOPT) # Common command to find subdirectories setwins=subdirs=`find . -type d -print`; \ @@ -55,7 +55,7 @@ .el.elc: @echo Compiling $< - @$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $< + @$(emacs) -L :$(srcdir) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $< .PHONY: compile-targets compile-main compile-clean @@ -110,6 +110,6 @@ done; \ echo Testing $$els; \ cd "$$thisdir"; \ - $(emacs) --chdir $(srcdir) $$args -f ert-run-tests-batch-and-exit + $(emacs) --chdir $(srcdir) -L :. $$args -f ert-run-tests-batch-and-exit # Makefile ends here. ------------------------------------------------------------ revno: 114929 committer: Glenn Morris branch nick: trunk timestamp: Sun 2013-11-03 17:38:16 -0800 message: * src/emacs.c (usage_message): Mention that `-L :...' appends. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-11-02 23:49:54 +0000 +++ src/ChangeLog 2013-11-04 01:38:16 +0000 @@ -1,3 +1,7 @@ +2013-11-04 Glenn Morris + + * emacs.c (usage_message): Mention that `-L :...' appends. + 2013-11-02 Glenn Morris * Makefile.in (abs_builddir): Remove. === modified file 'src/emacs.c' --- src/emacs.c 2013-11-02 02:11:37 +0000 +++ src/emacs.c 2013-11-04 01:38:16 +0000 @@ -254,7 +254,7 @@ FILE visit FILE using find-file\n\ +LINE go to line LINE in next FILE\n\ +LINE:COLUMN go to line LINE, column COLUMN, in next FILE\n\ ---directory, -L DIR add DIR to variable load-path\n\ +--directory, -L DIR prepend DIR to load-path (with :DIR, append DIR)\n\ --eval EXPR evaluate Emacs Lisp expression EXPR\n\ --execute EXPR evaluate Emacs Lisp expression EXPR\n\ ", ------------------------------------------------------------ revno: 114928 committer: Glenn Morris branch nick: trunk timestamp: Sun 2013-11-03 17:36:14 -0800 message: * lisp/startup.el (command-line-1): Allow `-L :...' to append to load-path. * doc/emacs/cmdargs.texi (Action Arguments): Mention that `-L :...' appends. * etc/NEWS: Mention this. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2013-11-02 23:36:32 +0000 +++ doc/emacs/ChangeLog 2013-11-04 01:36:14 +0000 @@ -1,3 +1,7 @@ +2013-11-04 Glenn Morris + + * cmdargs.texi (Action Arguments): Mention that `-L :...' appends. + 2013-11-02 Glenn Morris * cmdargs.texi (Action Arguments): Clarify `-L' a bit. === modified file 'doc/emacs/cmdargs.texi' --- doc/emacs/cmdargs.texi 2013-11-02 23:36:32 +0000 +++ doc/emacs/cmdargs.texi 2013-11-04 01:36:14 +0000 @@ -139,6 +139,8 @@ If you specify multiple @samp{-L} options, Emacs preserves the relative order; i.e., using @samp{-L /foo -L /bar} results in a @code{load-path} of the form @code{("/foo" "/bar" @dots{})}. +If @var{dir} begins with @samp{:}, Emacs removes the @samp{:} and +appends (rather than prepends) the remainder to @code{load-path}. @item -f @var{function} @opindex -f === modified file 'etc/NEWS' --- etc/NEWS 2013-11-02 11:37:14 +0000 +++ etc/NEWS 2013-11-04 01:36:14 +0000 @@ -62,6 +62,10 @@ * Startup Changes in Emacs 24.4 ++++ +** The -L option, which normally prepends its argument to load-path, +will instead append, if the argument begins with `:'. + * Changes in Emacs 24.4 === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-03 22:56:03 +0000 +++ lisp/ChangeLog 2013-11-04 01:36:14 +0000 @@ -1,3 +1,7 @@ +2013-11-04 Glenn Morris + + * startup.el (command-line-1): Allow `-L :...' to append to load-path. + 2013-11-03 Stefan Monnier * progmodes/ruby-mode.el (ruby-smie--rule-parent-skip-assign): Remove. === modified file 'lisp/startup.el' --- lisp/startup.el 2013-11-02 23:37:59 +0000 +++ lisp/startup.el 2013-11-04 01:36:14 +0000 @@ -2171,13 +2171,22 @@ (eval (read (or argval (pop command-line-args-left))))) ((member argi '("-L" "-directory")) - (setq tem (expand-file-name - (command-line-normalize-file-name - (or argval (pop command-line-args-left))))) - (cond (splice (setcdr splice (cons tem (cdr splice))) - (setq splice (cdr splice))) - (t (setq load-path (cons tem load-path) - splice load-path)))) + ;; -L :/foo adds /foo to the _end_ of load-path. + (let (append) + (if (string-match-p + "\\`:" + (setq tem (or argval (pop command-line-args-left)))) + (setq tem (substring tem 1) + append t)) + (setq tem (expand-file-name + (command-line-normalize-file-name tem))) + (cond (append (setq load-path + (append load-path (list tem))) + (if splice (setq splice load-path))) + (splice (setcdr splice (cons tem (cdr splice))) + (setq splice (cdr splice))) + (t (setq load-path (cons tem load-path) + splice load-path))))) ((member argi '("-l" "-load")) (let* ((file (command-line-normalize-file-name ------------------------------------------------------------ revno: 114927 committer: Stefan Monnier branch nick: trunk timestamp: Sun 2013-11-03 17:56:03 -0500 message: * lisp/emacs-lisp/smie.el (smie-rule-parent): Always call smie-indent-virtual rather than only for hanging tokens. (smie--next-indent-change): New helper command. * lisp/progmodes/ruby-mode.el (ruby-smie--rule-parent-skip-assign): Remove. (ruby-smie-rules): Use smie-rule-parent instead. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-03 19:25:29 +0000 +++ lisp/ChangeLog 2013-11-03 22:56:03 +0000 @@ -1,3 +1,12 @@ +2013-11-03 Stefan Monnier + + * progmodes/ruby-mode.el (ruby-smie--rule-parent-skip-assign): Remove. + (ruby-smie-rules): Use smie-rule-parent instead. + + * emacs-lisp/smie.el (smie-rule-parent): Always call + smie-indent-virtual rather than only for hanging tokens. + (smie--next-indent-change): New helper command. + 2013-11-03 Glenn Morris * Makefile.in (abs_srcdir): Remove. @@ -25,8 +34,8 @@ 2013-11-02 Bozhidar Batsov - * emacs-lisp/package.el (package-version-join): Recognize - snapshot versions. + * emacs-lisp/package.el (package-version-join): + Recognize snapshot versions. 2013-11-02 Bozhidar Batsov @@ -34,8 +43,8 @@ 2013-11-02 Dmitry Gutov - * progmodes/ruby-mode.el (ruby-smie--rule-parent-skip-assign): New - function, replacement for `smie-rule-parent' for when we want to + * progmodes/ruby-mode.el (ruby-smie--rule-parent-skip-assign): + New function, replacement for `smie-rule-parent' for when we want to skip over our direct parent if it's an assignment token.. (ruby-smie-rules): Use it. === modified file 'lisp/emacs-lisp/smie.el' --- lisp/emacs-lisp/smie.el 2013-10-24 21:16:20 +0000 +++ lisp/emacs-lisp/smie.el 2013-11-03 22:56:03 +0000 @@ -1236,15 +1236,7 @@ (goto-char (cadr (smie-indent--parent))) (cons 'column (+ (or offset 0) - ;; Use smie-indent-virtual when indenting relative to an opener: - ;; this will also by default use current-column unless - ;; that opener is hanging, but will additionally consult - ;; rules-function, so it gives it a chance to tweak - ;; indentation (e.g. by forcing indentation relative to - ;; its own parent, as in fn a => fn b => fn c =>). - (if (or (not (numberp (car smie--parent))) - (smie-indent--hanging-p)) - (smie-indent-virtual) (current-column)))))) + (smie-indent-virtual))))) (defvar smie-rule-separator-outdent 2) @@ -1837,6 +1829,15 @@ (edebug-instrument-function smie-rules-function) (error "Sorry, don't know how to instrument a lambda expression"))) +(defun smie--next-indent-change () + "Go to the next line that needs to be reindented (and reindent it)." + (interactive) + (while + (let ((tick (buffer-modified-tick))) + (indent-according-to-mode) + (eq tick (buffer-modified-tick))) + (forward-line 1))) + ;;; User configuration ;; This is designed to be a completely independent "module", so we can play === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2013-11-02 05:18:11 +0000 +++ lisp/progmodes/ruby-mode.el 2013-11-03 22:56:03 +0000 @@ -467,16 +467,6 @@ (t ";"))) (t tok))))))) -(defun ruby-smie--rule-parent-skip-assign () - (let* ((parent (smie-indent--parent)) - (tok (caddr parent))) - (if (and (stringp tok) (string-match-p "[+-*&|^]?=\\'" tok)) - (progn - (goto-char (cadr parent)) - (let (smie--parent) - (smie-rule-parent))) - (smie-rule-parent)))) - (defun ruby-smie-rules (kind token) (pcase (cons kind token) (`(:elem . basic) ruby-indent-level) @@ -499,7 +489,7 @@ ((and (equal token "{") (not (smie-rule-prev-p "(" "{" "[" "," "=>" "=" "return" ";"))) ;; Curly block opener. - (ruby-smie--rule-parent-skip-assign)) + (smie-rule-parent)) ((smie-rule-hanging-p) ;; Treat purely syntactic block-constructs as being part of their parent, ;; when the opening statement is hanging. @@ -508,7 +498,7 @@ (cons 'column (smie-indent-virtual))))) (`(:after . ,(or "=" "iuwu-mod")) 2) (`(:after . " @ ") (smie-rule-parent)) - (`(:before . "do") (ruby-smie--rule-parent-skip-assign)) + (`(:before . "do") (smie-rule-parent)) (`(,(or :before :after) . ".") (unless (smie-rule-parent-p ".") (smie-rule-parent ruby-indent-level))) ------------------------------------------------------------ revno: 114926 committer: Johan Bockgård branch nick: trunk timestamp: Sun 2013-11-03 22:51:25 +0100 message: * cedet/semantic/lex.el (semantic-lex-start-block) (semantic-lex-end-block): Move after definition of semantic-lex-token macro. diff: === modified file 'lisp/cedet/ChangeLog' --- lisp/cedet/ChangeLog 2013-10-31 01:50:24 +0000 +++ lisp/cedet/ChangeLog 2013-11-03 21:51:25 +0000 @@ -1,3 +1,9 @@ +2013-11-03 Johan Bockgård + + * semantic/lex.el (semantic-lex-start-block) + (semantic-lex-end-block): Move after definition of + semantic-lex-token macro. + 2013-10-28 Barry O'Reilly * semantic/idle.el (semantic-idle-symbol-highlight) === modified file 'lisp/cedet/semantic/lex.el' --- lisp/cedet/semantic/lex.el 2013-06-01 18:01:45 +0000 +++ lisp/cedet/semantic/lex.el 2013-11-03 21:51:25 +0000 @@ -831,63 +831,6 @@ ;; Return the token stream (nreverse semantic-lex-token-stream)))) -;;; Collapsed block tokens delimited by any tokens. -;; -(defun semantic-lex-start-block (syntax) - "Mark the last read token as the beginning of a SYNTAX block." - (if (or (not semantic-lex-maximum-depth) - (< semantic-lex-current-depth semantic-lex-maximum-depth)) - (setq semantic-lex-current-depth (1+ semantic-lex-current-depth)) - (push (list syntax (car semantic-lex-token-stream)) - semantic-lex-block-stack))) - -(defun semantic-lex-end-block (syntax) - "Process the end of a previously marked SYNTAX block. -That is, collapse the tokens inside that block, including the -beginning and end of block tokens, into a high level block token of -class SYNTAX. -The token at beginning of block is the one marked by a previous call -to `semantic-lex-start-block'. The current token is the end of block. -The collapsed tokens are saved in `semantic-lex-block-streams'." - (if (null semantic-lex-block-stack) - (setq semantic-lex-current-depth (1- semantic-lex-current-depth)) - (let* ((stream semantic-lex-token-stream) - (blk (pop semantic-lex-block-stack)) - (bstream (cdr blk)) - (first (car bstream)) - (last (pop stream)) ;; The current token mark the EOBLK - tok) - (if (not (eq (car blk) syntax)) - ;; SYNTAX doesn't match the syntax of the current block in - ;; the stack. So we encountered the end of the SYNTAX block - ;; before the end of the current one in the stack which is - ;; signaled unterminated. - (semantic-lex-unterminated-syntax-detected (car blk)) - ;; Move tokens found inside the block from the main stream - ;; into a separate block stream. - (while (and stream (not (eq (setq tok (pop stream)) first))) - (push tok bstream)) - ;; The token marked as beginning of block was not encountered. - ;; This should not happen! - (or (eq tok first) - (error "Token %S not found at beginning of block `%s'" - first syntax)) - ;; Save the block stream for future reuse, to avoid to redo - ;; the lexical analysis of the block content! - ;; Anchor the block stream with its start position, so we can - ;; use: (cdr (assq start semantic-lex-block-streams)) to - ;; quickly retrieve the lexical stream associated to a block. - (setcar blk (semantic-lex-token-start first)) - (setcdr blk (nreverse bstream)) - (push blk semantic-lex-block-streams) - ;; In the main stream, replace the tokens inside the block by - ;; a high level block token of class SYNTAX. - (setq semantic-lex-token-stream stream) - (semantic-lex-push-token - (semantic-lex-token - syntax (car blk) (semantic-lex-token-end last))) - )))) - ;;; Lexical token API ;; ;; Functions for accessing parts of a token. Use these functions @@ -1049,6 +992,63 @@ (semantic-lex-token-end semlist) depth)) +;;; Collapsed block tokens delimited by any tokens. +;; +(defun semantic-lex-start-block (syntax) + "Mark the last read token as the beginning of a SYNTAX block." + (if (or (not semantic-lex-maximum-depth) + (< semantic-lex-current-depth semantic-lex-maximum-depth)) + (setq semantic-lex-current-depth (1+ semantic-lex-current-depth)) + (push (list syntax (car semantic-lex-token-stream)) + semantic-lex-block-stack))) + +(defun semantic-lex-end-block (syntax) + "Process the end of a previously marked SYNTAX block. +That is, collapse the tokens inside that block, including the +beginning and end of block tokens, into a high level block token of +class SYNTAX. +The token at beginning of block is the one marked by a previous call +to `semantic-lex-start-block'. The current token is the end of block. +The collapsed tokens are saved in `semantic-lex-block-streams'." + (if (null semantic-lex-block-stack) + (setq semantic-lex-current-depth (1- semantic-lex-current-depth)) + (let* ((stream semantic-lex-token-stream) + (blk (pop semantic-lex-block-stack)) + (bstream (cdr blk)) + (first (car bstream)) + (last (pop stream)) ;; The current token mark the EOBLK + tok) + (if (not (eq (car blk) syntax)) + ;; SYNTAX doesn't match the syntax of the current block in + ;; the stack. So we encountered the end of the SYNTAX block + ;; before the end of the current one in the stack which is + ;; signaled unterminated. + (semantic-lex-unterminated-syntax-detected (car blk)) + ;; Move tokens found inside the block from the main stream + ;; into a separate block stream. + (while (and stream (not (eq (setq tok (pop stream)) first))) + (push tok bstream)) + ;; The token marked as beginning of block was not encountered. + ;; This should not happen! + (or (eq tok first) + (error "Token %S not found at beginning of block `%s'" + first syntax)) + ;; Save the block stream for future reuse, to avoid to redo + ;; the lexical analysis of the block content! + ;; Anchor the block stream with its start position, so we can + ;; use: (cdr (assq start semantic-lex-block-streams)) to + ;; quickly retrieve the lexical stream associated to a block. + (setcar blk (semantic-lex-token-start first)) + (setcdr blk (nreverse bstream)) + (push blk semantic-lex-block-streams) + ;; In the main stream, replace the tokens inside the block by + ;; a high level block token of class SYNTAX. + (setq semantic-lex-token-stream stream) + (semantic-lex-push-token + (semantic-lex-token + syntax (car blk) (semantic-lex-token-end last))) + )))) + ;;; Analyzer creation macros ;; ;; An individual analyzer is a condition and code that goes with it. ------------------------------------------------------------ revno: 114925 committer: Glenn Morris branch nick: trunk timestamp: Sun 2013-11-03 11:25:29 -0800 message: Unset EMACSLOADPATH in some Makefiles rather than setting it to the default * leim/Makefile.in (abs_srcdir): Remove. (RUN_EMACS): Unset EMACSLOADPATH. * lisp/Makefile.in (abs_srcdir): Remove. (emacs): Unset EMACSLOADPATH. diff: === modified file 'leim/ChangeLog' --- leim/ChangeLog 2013-11-02 20:30:13 +0000 +++ leim/ChangeLog 2013-11-03 19:25:29 +0000 @@ -1,3 +1,8 @@ +2013-11-03 Glenn Morris + + * Makefile.in (abs_srcdir): Remove. + (RUN_EMACS): Unset EMACSLOADPATH. + 2013-11-02 Glenn Morris * Makefile.in (buildlisppath): Remove. === modified file 'leim/Makefile.in' --- leim/Makefile.in 2013-11-02 20:30:13 +0000 +++ leim/Makefile.in 2013-11-03 19:25:29 +0000 @@ -25,15 +25,15 @@ # Here are the things that we expect ../configure to edit. srcdir=@srcdir@ -abs_srcdir=@abs_srcdir@ # Which Emacs to use to convert TIT files to Emacs Lisp files, # byte-compile Emacs Lisp files, and generate the file leim-list.el. EMACS = ../src/emacs # How to run Emacs. -RUN_EMACS = EMACSLOADPATH="${abs_srcdir}/../lisp" LC_ALL=C \ - "${EMACS}" -batch --no-site-file --no-site-lisp +# Prevent any setting of EMACSLOADPATH in user environment causing problems. +RUN_EMACS = unset EMACSLOADPATH; LC_ALL=C "${EMACS}" -batch \ + --no-site-file --no-site-lisp MKDIR_P = @MKDIR_P@ === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-11-02 23:39:49 +0000 +++ lisp/ChangeLog 2013-11-03 19:25:29 +0000 @@ -1,3 +1,8 @@ +2013-11-03 Glenn Morris + + * Makefile.in (abs_srcdir): Remove. + (emacs): Unset EMACSLOADPATH. + 2013-11-02 Glenn Morris * Makefile.in (EMACS): Use a relative filename. === modified file 'lisp/Makefile.in' --- lisp/Makefile.in 2013-11-02 23:39:49 +0000 +++ lisp/Makefile.in 2013-11-03 19:25:29 +0000 @@ -20,7 +20,6 @@ SHELL = @SHELL@ srcdir = @srcdir@ -abs_srcdir = @abs_srcdir@ top_srcdir = @top_srcdir@ lisp = $(srcdir) VPATH = $(srcdir) @@ -106,8 +105,8 @@ $(lisp)/emacs-lisp/autoload.elc # The actual Emacs command run in the targets below. - -emacs = EMACSLOADPATH="$(abs_srcdir)" LC_ALL=C "$(EMACS)" $(EMACSOPT) +# Prevent any setting of EMACSLOADPATH in user environment causing problems. +emacs = unset EMACSLOADPATH; LC_ALL=C "$(EMACS)" $(EMACSOPT) # Common command to find subdirectories setwins=subdirs=`find . -type d -print`; \ ------------------------------------------------------------ revno: 114924 committer: Glenn Morris branch nick: trunk timestamp: Sat 2013-11-02 16:49:54 -0700 message: * src/Makefile.in (bootstrap_exe): Use relative filename. (abs_builddir): Remove. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-11-02 19:41:33 +0000 +++ src/ChangeLog 2013-11-02 23:49:54 +0000 @@ -1,5 +1,8 @@ 2013-11-02 Glenn Morris + * Makefile.in (abs_builddir): Remove. + (bootstrap_exe): Use relative filename. + Use relative filenames in TAGS files. * Makefile.in (abs_srcdir): Remove it again. (.PHONY): Remove frc. === modified file 'src/Makefile.in' --- src/Makefile.in 2013-11-02 19:41:33 +0000 +++ src/Makefile.in 2013-11-02 23:49:54 +0000 @@ -31,7 +31,6 @@ # MinGW CPPFLAGS may use this. abs_top_srcdir=@abs_top_srcdir@ ntsource = $(srcdir)/../nt -abs_builddir = @abs_builddir@ VPATH = $(srcdir) CC = @CC@ WINDRES = @WINDRES@ @@ -60,7 +59,7 @@ # Configuration files for .o files to depend on. config_h = config.h $(srcdir)/conf_post.h -bootstrap_exe = $(abs_builddir)/bootstrap-emacs$(EXEEXT) +bootstrap_exe = ../src/bootstrap-emacs$(EXEEXT) ## ns-app if HAVE_NS, else empty. OTHER_FILES = @OTHER_FILES@