------------------------------------------------------------ revno: 117898 committer: Paul Eggert branch nick: trunk timestamp: Wed 2014-09-17 22:40:17 -0700 message: Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64. Revert previous lisp.h change, and install the following instead. * lisp.h (USE_LOCAL_ALLOCATORS): Define only if __GNUC__ && !__clang__. This works with GCC and with clang and is safer for compilers we don't know about. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-09-18 01:03:40 +0000 +++ src/ChangeLog 2014-09-18 05:40:17 +0000 @@ -1,9 +1,9 @@ 2014-09-18 Paul Eggert Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64. - * lisp.h (ALLOCA_FIXUP): New constant. - (LOCAL_ALLOCA): New macro. - (local_cons, make_local_vector, make_local_string): Use them. + * lisp.h (USE_LOCAL_ALLOCATORS): Define only if __GNUC__ && + !__clang__. This works with GCC and with clang and is safer for + compilers we don't know about. (local_cons): Rename parameter to make capture less likely. 2014-09-17 Samuel Bronson === modified file 'src/lisp.h' --- src/lisp.h 2014-09-18 01:03:40 +0000 +++ src/lisp.h 2014-09-18 05:40:17 +0000 @@ -4599,30 +4599,22 @@ # define scoped_list3(x, y, z) list3 (x, y, z) #endif -#if USE_STACK_LISP_OBJECTS && HAVE_STATEMENT_EXPRESSIONS - +/* Local allocators require both statement expressions and a + GCALIGNMENT-aligned alloca. clang's alloca isn't properly aligned + in some cases. In the absence of solid information, play it safe + for other non-GCC compilers. */ +#if (USE_STACK_LISP_OBJECTS && HAVE_STATEMENT_EXPRESSIONS \ + && __GNUC__ && !__clang__) # define USE_LOCAL_ALLOCATORS - -/* Alignment fixup needed for alloca. GCC aligns alloca properly already, - Clang sometimes doesn't, and play it safe for other random compilers. */ -# if __GNUC__ && !__clang__ -enum { ALLOCA_FIXUP = 0 }; -# else -enum { ALLOCA_FIXUP = GCALIGNMENT - 1 }; -# endif - -/* Declare a void * variable PTR and set it to a properly-aligned array of - N newly allocated bytes with function lifetime. */ -# define LOCAL_ALLOCA(ptr, n) \ - void *ptr = alloca ((n) + ALLOCA_FIXUP); \ - ptr = (void *) ((intptr_t) ptr_ & ~(ALLOCA_FIXUP)) +#endif + +#ifdef USE_LOCAL_ALLOCATORS /* Return a function-scoped cons whose car is X and cdr is Y. */ # define local_cons(x, y) \ ({ \ - LOCAL_ALLOCA (ptr_, sizeof (struct Lisp_Cons)); \ - struct Lisp_Cons *c_ = ptr_; \ + struct Lisp_Cons *c_ = alloca (sizeof (struct Lisp_Cons)); \ c_->car = (x); \ c_->u.cdr = (y); \ make_lisp_ptr (c_, Lisp_Cons); \ @@ -4640,9 +4632,9 @@ ptrdiff_t size_ = size; \ Lisp_Object init_ = init; \ Lisp_Object vec_; \ - if (size_ <= (MAX_ALLOCA - ALLOCA_FIXUP - header_size) / word_size) \ + if (size_ <= (MAX_ALLOCA - header_size) / word_size) \ { \ - LOCAL_ALLOCA (ptr_, size_ * word_size + header_size); \ + void *ptr_ = alloca (size_ * word_size + header_size); \ vec_ = local_vector_init (ptr_, size_, init_); \ } \ else \ @@ -4657,10 +4649,10 @@ char const *data_ = data; \ ptrdiff_t nbytes_ = nbytes; \ Lisp_Object string_; \ - if (nbytes_ \ - <= MAX_ALLOCA - ALLOCA_FIXUP - sizeof (struct Lisp_String) - 1) \ + if (nbytes_ <= MAX_ALLOCA - sizeof (struct Lisp_String) - 1) \ { \ - LOCAL_ALLOCA (ptr_, sizeof (struct Lisp_String) + 1 + bytes_); \ + struct Lisp_String *ptr_ \ + = alloca (sizeof (struct Lisp_String) + 1 + nbytes_); \ string_ = local_string_init (ptr_, data_, nbytes_); \ } \ else \ ------------------------------------------------------------ revno: 117897 committer: Paul Eggert branch nick: trunk timestamp: Wed 2014-09-17 18:03:40 -0700 message: Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64. * lisp.h (ALLOCA_FIXUP): New constant. (LOCAL_ALLOCA): New macro. (local_cons, make_local_vector, make_local_string): Use them. (local_cons): Rename parameter to make capture less likely. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-09-17 19:58:31 +0000 +++ src/ChangeLog 2014-09-18 01:03:40 +0000 @@ -1,3 +1,11 @@ +2014-09-18 Paul Eggert + + Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64. + * lisp.h (ALLOCA_FIXUP): New constant. + (LOCAL_ALLOCA): New macro. + (local_cons, make_local_vector, make_local_string): Use them. + (local_cons): Rename parameter to make capture less likely. + 2014-09-17 Samuel Bronson * unexmacosx.c (copy_data_segment): Port to GCC 4.6+ (Bug#9927). === modified file 'src/lisp.h' --- src/lisp.h 2014-09-17 18:27:36 +0000 +++ src/lisp.h 2014-09-18 01:03:40 +0000 @@ -4603,14 +4603,29 @@ # define USE_LOCAL_ALLOCATORS +/* Alignment fixup needed for alloca. GCC aligns alloca properly already, + Clang sometimes doesn't, and play it safe for other random compilers. */ +# if __GNUC__ && !__clang__ +enum { ALLOCA_FIXUP = 0 }; +# else +enum { ALLOCA_FIXUP = GCALIGNMENT - 1 }; +# endif + +/* Declare a void * variable PTR and set it to a properly-aligned array of + N newly allocated bytes with function lifetime. */ +# define LOCAL_ALLOCA(ptr, n) \ + void *ptr = alloca ((n) + ALLOCA_FIXUP); \ + ptr = (void *) ((intptr_t) ptr_ & ~(ALLOCA_FIXUP)) + /* Return a function-scoped cons whose car is X and cdr is Y. */ # define local_cons(x, y) \ ({ \ - struct Lisp_Cons *c = alloca (sizeof (struct Lisp_Cons)); \ - c->car = (x); \ - c->u.cdr = (y); \ - make_lisp_ptr (c, Lisp_Cons); \ + LOCAL_ALLOCA (ptr_, sizeof (struct Lisp_Cons)); \ + struct Lisp_Cons *c_ = ptr_; \ + c_->car = (x); \ + c_->u.cdr = (y); \ + make_lisp_ptr (c_, Lisp_Cons); \ }) # define local_list1(x) local_cons (x, Qnil) @@ -4625,9 +4640,9 @@ ptrdiff_t size_ = size; \ Lisp_Object init_ = init; \ Lisp_Object vec_; \ - if (size_ <= (MAX_ALLOCA - header_size) / word_size) \ + if (size_ <= (MAX_ALLOCA - ALLOCA_FIXUP - header_size) / word_size) \ { \ - void *ptr_ = alloca (size_ * word_size + header_size); \ + LOCAL_ALLOCA (ptr_, size_ * word_size + header_size); \ vec_ = local_vector_init (ptr_, size_, init_); \ } \ else \ @@ -4642,10 +4657,10 @@ char const *data_ = data; \ ptrdiff_t nbytes_ = nbytes; \ Lisp_Object string_; \ - if (nbytes_ <= MAX_ALLOCA - sizeof (struct Lisp_String) - 1) \ + if (nbytes_ \ + <= MAX_ALLOCA - ALLOCA_FIXUP - sizeof (struct Lisp_String) - 1) \ { \ - struct Lisp_String *ptr_ \ - = alloca (sizeof (struct Lisp_String) + 1 + nbytes_); \ + LOCAL_ALLOCA (ptr_, sizeof (struct Lisp_String) + 1 + bytes_); \ string_ = local_string_init (ptr_, data_, nbytes_); \ } \ else \ ------------------------------------------------------------ revno: 117896 fixes bug: http://debbugs.gnu.org/9927 author: Samuel Bronson committer: Paul Eggert branch nick: trunk timestamp: Wed 2014-09-17 12:58:31 -0700 message: * unexmacosx.c (copy_data_segment): Port to GCC 4.6+. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-09-17 18:27:36 +0000 +++ src/ChangeLog 2014-09-17 19:58:31 +0000 @@ -1,3 +1,7 @@ +2014-09-17 Samuel Bronson + + * unexmacosx.c (copy_data_segment): Port to GCC 4.6+ (Bug#9927). + 2014-09-17 Paul Eggert Fix minor problems found by static checking. === modified file 'src/unexmacosx.c' --- src/unexmacosx.c 2014-09-01 02:37:22 +0000 +++ src/unexmacosx.c 2014-09-17 19:58:31 +0000 @@ -879,6 +879,27 @@ if (!unexec_write (header_offset, sectp, sizeof (struct section))) unexec_error ("cannot write section %.16s's header", sectp->sectname); } + else if (strncmp (sectp->sectname, "__bss", 5) == 0 + || strncmp (sectp->sectname, "__pu_bss", 8) == 0) + { + sectp->flags = S_REGULAR; + + /* These sections are produced by GCC 4.6+. + + FIXME: We possibly ought to clear uninitialized local + variables in statically linked libraries like for + SECT_BSS (__bss) above, but setting up the markers we + need in lastfile.c would be rather messy. See + darwin_output_aligned_bss () in gcc/config/darwin.c for + the root of the problem, keeping in mind that the + sections are numbered by their alignment in GCC 4.6, but + by log2(alignment) in GCC 4.7. */ + + if (!unexec_write (sectp->offset, (void *) sectp->addr, sectp->size)) + unexec_error ("cannot copy section %.16s", sectp->sectname); + if (!unexec_write (header_offset, sectp, sizeof (struct section))) + unexec_error ("cannot write section %.16s's header", sectp->sectname); + } else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0 || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0 || strncmp (sectp->sectname, "__got", 16) == 0 @@ -890,6 +911,7 @@ || strncmp (sectp->sectname, "__program_vars", 16) == 0 || strncmp (sectp->sectname, "__mod_init_func", 16) == 0 || strncmp (sectp->sectname, "__mod_term_func", 16) == 0 + || strncmp (sectp->sectname, "__static_data", 16) == 0 || strncmp (sectp->sectname, "__objc_", 7) == 0) { if (!unexec_copy (sectp->offset, old_file_offset, sectp->size)) ------------------------------------------------------------ revno: 117895 committer: Paul Eggert branch nick: trunk timestamp: Wed 2014-09-17 11:27:36 -0700 message: Fix minor problems found by static checking. * alloc.c, lisp.h (SAVE_TYPE_INT_OBJ, make_save_int_obj): Remove; now unused. * buffer.h (decode_buffer): Doc and indentation fixes. * fns.c (Qstring_collate_lessp, Qstring_collate_equalp): Now static. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-09-17 15:34:37 +0000 +++ src/ChangeLog 2014-09-17 18:27:36 +0000 @@ -1,3 +1,11 @@ +2014-09-17 Paul Eggert + + Fix minor problems found by static checking. + * alloc.c, lisp.h (SAVE_TYPE_INT_OBJ, make_save_int_obj): + Remove; now unused. + * buffer.h (decode_buffer): Doc and indentation fixes. + * fns.c (Qstring_collate_lessp, Qstring_collate_equalp): Now static. + 2014-09-17 Dmitry Antipov Avoid clang-specific warnings. === modified file 'src/alloc.c' --- src/alloc.c 2014-09-17 11:22:45 +0000 +++ src/alloc.c 2014-09-17 18:27:36 +0000 @@ -3657,17 +3657,6 @@ return val; } -Lisp_Object -make_save_int_obj (ptrdiff_t a, Lisp_Object b) -{ - Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value); - struct Lisp_Save_Value *p = XSAVE_VALUE (val); - p->save_type = SAVE_TYPE_INT_OBJ; - p->data[0].integer = a; - p->data[1].object = b; - return val; -} - #if ! (defined USE_X_TOOLKIT || defined USE_GTK) Lisp_Object make_save_ptr_ptr (void *a, void *b) === modified file 'src/buffer.h' --- src/buffer.h 2014-09-07 07:04:01 +0000 +++ src/buffer.h 2014-09-17 18:27:36 +0000 @@ -1088,8 +1088,9 @@ extern void restore_buffer (Lisp_Object); extern void set_buffer_if_live (Lisp_Object); -INLINE -struct buffer * +/* Return B as a struct buffer pointer, defaulting to the current buffer. */ + +INLINE struct buffer * decode_buffer (Lisp_Object b) { return NILP (b) ? current_buffer : (CHECK_BUFFER (b), XBUFFER (b)); === modified file 'src/fns.c' --- src/fns.c 2014-09-16 13:07:57 +0000 +++ src/fns.c 2014-09-17 18:27:36 +0000 @@ -41,7 +41,8 @@ #include "xterm.h" #endif -Lisp_Object Qstring_lessp, Qstring_collate_lessp, Qstring_collate_equalp; +Lisp_Object Qstring_lessp; +static Lisp_Object Qstring_collate_lessp, Qstring_collate_equalp; static Lisp_Object Qprovide, Qrequire; static Lisp_Object Qyes_or_no_p_history; Lisp_Object Qcursor_in_echo_area; === modified file 'src/lisp.h' --- src/lisp.h 2014-09-15 14:53:23 +0000 +++ src/lisp.h 2014-09-17 18:27:36 +0000 @@ -1967,7 +1967,6 @@ SAVE_TYPE_OBJ_OBJ_OBJ_OBJ = SAVE_OBJECT + (SAVE_TYPE_OBJ_OBJ_OBJ << SAVE_SLOT_BITS), SAVE_TYPE_PTR_INT = SAVE_POINTER + (SAVE_INTEGER << SAVE_SLOT_BITS), - SAVE_TYPE_INT_OBJ = SAVE_INTEGER + (SAVE_OBJECT << SAVE_SLOT_BITS), SAVE_TYPE_PTR_OBJ = SAVE_POINTER + (SAVE_OBJECT << SAVE_SLOT_BITS), SAVE_TYPE_PTR_PTR = SAVE_POINTER + (SAVE_POINTER << SAVE_SLOT_BITS), SAVE_TYPE_FUNCPTR_PTR_OBJ @@ -3798,7 +3797,6 @@ extern Lisp_Object make_save_ptr (void *); extern Lisp_Object make_save_ptr_int (void *, ptrdiff_t); extern Lisp_Object make_save_ptr_ptr (void *, void *); -extern Lisp_Object make_save_int_obj (ptrdiff_t, Lisp_Object); extern Lisp_Object make_save_funcptr_ptr_obj (void (*) (void), void *, Lisp_Object); extern Lisp_Object make_save_memory (Lisp_Object *, ptrdiff_t); ------------------------------------------------------------ revno: 117894 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2014-09-17 19:34:37 +0400 message: Avoid clang-specific warnings. * buffer.c (init_buffer): Shut up -Wself-assign. * process.c (server_accept_connection): Shut up -Wunsequenced. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-09-16 13:07:57 +0000 +++ src/ChangeLog 2014-09-17 15:34:37 +0000 @@ -1,3 +1,9 @@ +2014-09-17 Dmitry Antipov + + Avoid clang-specific warnings. + * buffer.c (init_buffer): Shut up -Wself-assign. + * process.c (server_accept_connection): Shut up -Wunsequenced. + 2014-09-16 Daniel Colascione * fns.c (sxhash): For symbols, use address as hash code. === modified file 'src/buffer.c' --- src/buffer.c 2014-09-16 08:20:08 +0000 +++ src/buffer.c 2014-09-17 15:34:37 +0000 @@ -5286,7 +5286,7 @@ } #else /* not USE_MMAP_FOR_BUFFERS */ /* Avoid compiler warnings. */ - initialized = initialized; + (void) initialized; #endif /* USE_MMAP_FOR_BUFFERS */ Fset_buffer (Fget_buffer_create (build_local_string ("*scratch*"))); === modified file 'src/process.c' --- src/process.c 2014-09-15 14:53:23 +0000 +++ src/process.c 2014-09-17 15:34:37 +0000 @@ -4060,8 +4060,8 @@ unsigned char *ip = (unsigned char *)&saddr.in.sin_addr.s_addr; host = Fformat (5, ((Lisp_Object []) - { build_local_string ("%d.%d.%d.%d"), make_number (*ip++), - make_number (*ip++), make_number (*ip++), make_number (*ip++) })); + { build_local_string ("%d.%d.%d.%d"), make_number (ip[0]), + make_number (ip[1]), make_number (ip[2]), make_number (ip[3]) })); service = make_number (ntohs (saddr.in.sin_port)); caller = Fformat (3, ((Lisp_Object []) { build_local_string (" <%s:%d>"), host, service })); ------------------------------------------------------------ revno: 117893 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2014-09-17 15:22:45 +0400 message: * alloc.c (local_vector_init): Remove useless INLINE. diff: === modified file 'src/alloc.c' --- src/alloc.c 2014-09-15 14:53:23 +0000 +++ src/alloc.c 2014-09-17 11:22:45 +0000 @@ -3325,7 +3325,7 @@ /* Initialize V with LENGTH objects each with value INIT, and return it tagged as a Lisp Object. */ -INLINE Lisp_Object +Lisp_Object local_vector_init (struct Lisp_Vector *v, ptrdiff_t length, Lisp_Object init) { v->header.size = length; ------------------------------------------------------------ revno: 117892 committer: Reuben Thomas branch nick: trunk timestamp: Wed 2014-09-17 10:17:27 +0100 message: Add interpreter-mode-alist support for various JavaScript interpreters. * progmodes/js.el: here. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-09-17 00:07:12 +0000 +++ lisp/ChangeLog 2014-09-17 09:17:27 +0000 @@ -1,3 +1,8 @@ +2014-09-17 Reuben Thomas + + * progmodes/js.el: Add interpreter-mode-alist support for various + JavaScript interpreters. + 2014-09-17 Paul Eggert Don't assume 'grep' supports GREP_OPTIONS. === modified file 'lisp/progmodes/js.el' --- lisp/progmodes/js.el 2014-06-01 01:53:04 +0000 +++ lisp/progmodes/js.el 2014-09-17 09:17:27 +0000 @@ -3479,6 +3479,10 @@ '(when (fboundp 'folding-add-to-marks-list) (folding-add-to-marks-list 'js-mode "// {{{" "// }}}" ))) +;;;###autoload +(dolist (name (list "node" "nodejs" "gjs" "rhino")) + (add-to-list 'interpreter-mode-alist (cons (purecopy name) 'js-mode))) + (provide 'js) ;; js.el ends here ------------------------------------------------------------ revno: 117891 committer: Paul Eggert branch nick: trunk timestamp: Tue 2014-09-16 17:07:12 -0700 message: Don't assume 'grep' supports GREP_OPTIONS. The GREP_OPTIONS environment variable is planned to be marked obsolescent in GNU grep, due to problems in its use, so stop relying on it. * progmodes/grep.el (grep-highlight-matches): Document this. (grep-process-setup): Do not set GREP_OPTIONS. (grep-compute-defaults): Use an explicit --color option if supported. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-09-16 00:28:28 +0000 +++ lisp/ChangeLog 2014-09-17 00:07:12 +0000 @@ -1,3 +1,13 @@ +2014-09-17 Paul Eggert + + Don't assume 'grep' supports GREP_OPTIONS. + The GREP_OPTIONS environment variable is planned to be marked + obsolescent in GNU grep, due to problems in its use, so stop + relying on it. + * progmodes/grep.el (grep-highlight-matches): Document this. + (grep-process-setup): Do not set GREP_OPTIONS. + (grep-compute-defaults): Use an explicit --color option if supported. + 2014-09-16 Stefan Monnier * msb.el (msb--make-keymap-menu, msb-menu-bar-update-buffers): === modified file 'lisp/progmodes/grep.el' --- lisp/progmodes/grep.el 2014-05-09 09:10:56 +0000 +++ lisp/progmodes/grep.el 2014-09-17 00:07:12 +0000 @@ -76,11 +76,10 @@ you will not get highlighting. This option sets the environment variable GREP_COLORS to specify -markers for highlighting and GREP_OPTIONS to add the --color -option in front of any explicit grep options before starting -the grep. +markers for highlighting and adds the --color option in front of +any explicit grep options before starting the grep. -When this option is `auto', grep uses `--color=auto' to highlight +When this option is `auto', grep uses `--color' to highlight matches only when it outputs to a terminal (when `grep' is the last command in the pipe), thus avoiding the use of any potentially-harmful escape sequences when standard output goes to a file or pipe. @@ -96,7 +95,7 @@ :type '(choice (const :tag "Do not highlight matches with grep markers" nil) (const :tag "Highlight matches with grep markers" t) (const :tag "Use --color=always" always) - (const :tag "Use --color=auto" auto) + (const :tag "Use --color" auto) (other :tag "Not Set" auto-detect)) :set 'grep-apply-setting :version "22.1" @@ -466,10 +465,6 @@ ;; `setenv' modifies `process-environment' let-bound in `compilation-start' ;; Any TERM except "dumb" allows GNU grep to use `--color=auto' (setenv "TERM" "emacs-grep") - (setenv "GREP_OPTIONS" - (concat (getenv "GREP_OPTIONS") - " --color=" (if (eq grep-highlight-matches 'always) - "always" "auto"))) ;; GREP_COLOR is used in GNU grep 2.5.1, but deprecated in later versions (setenv "GREP_COLOR" "01;31") ;; GREP_COLORS is used in GNU grep 2.5.2 and later versions @@ -569,7 +564,13 @@ (unless (and grep-command grep-find-command grep-template grep-find-template) (let ((grep-options - (concat (if grep-use-null-device "-n" "-nH") + (concat (and grep-highlight-matches + (grep-probe grep-program + `(nil nil nil "--color" "x" ,null-device) + nil 1) + (if (eq grep-highlight-matches 'always) + "--color=always " "--color ")) + (if grep-use-null-device "-n" "-nH") (if (grep-probe grep-program `(nil nil nil "-e" "foo" ,null-device) nil 1)