aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2014-09-10 13:56:05 -0700
committerPaul Eggert2014-09-10 13:56:05 -0700
commitd1bed1f79107c8377ffaea160acd815008fab4f7 (patch)
treef9244ba7ada14e100ec76503ed9c2e29e12aa8d9 /src
parent1014b530f59b332e9ae53c1d0d90f6074b1fca6c (diff)
downloademacs-d1bed1f79107c8377ffaea160acd815008fab4f7.tar.gz
emacs-d1bed1f79107c8377ffaea160acd815008fab4f7.zip
Simplify lisp.h by removing the __COUNTER__ business.
Problem reported by Dmitry Antipov in: http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00220.html * lisp.h (make_local_vector, make_local_string) (build_local_string): Simplify by not bothering with __COUNTER__. The __COUNTER__ business wasn't working properly, and was needed only for hypothetical future expansion anyway.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/lisp.h52
2 files changed, 32 insertions, 30 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5498a07a0da..50f5fb8ca1e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12014-09-10 Paul Eggert <eggert@cs.ucla.edu>
2
3 Simplify lisp.h by removing the __COUNTER__ business.
4 Problem reported by Dmitry Antipov in:
5 http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00220.html
6 * lisp.h (make_local_vector, make_local_string)
7 (build_local_string): Simplify by not bothering with __COUNTER__.
8 The __COUNTER__ business wasn't working properly, and was needed
9 only for hypothetical future expansion anyway.
10
12014-09-10 Alp Aker <alp.tekin.aker@gmail.com> 112014-09-10 Alp Aker <alp.tekin.aker@gmail.com>
2 12
3 * nsterm.m (ns_draw_fringe_bitmap): Use the same logic as other 13 * nsterm.m (ns_draw_fringe_bitmap): Use the same logic as other
diff --git a/src/lisp.h b/src/lisp.h
index 1415ab270bc..468e8f9fa1c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4563,58 +4563,50 @@ verify (sizeof (struct Lisp_Cons) == sizeof (union Aligned_Cons));
4563# define scoped_list3(x, y, z) list3 (x, y, z) 4563# define scoped_list3(x, y, z) list3 (x, y, z)
4564#endif 4564#endif
4565 4565
4566#if USE_STACK_LISP_OBJECTS && HAVE_STATEMENT_EXPRESSIONS && defined __COUNTER__ 4566#if USE_STACK_LISP_OBJECTS && HAVE_STATEMENT_EXPRESSIONS
4567 4567
4568# define USE_LOCAL_ALLOCATORS 4568# define USE_LOCAL_ALLOCATORS
4569 4569
4570/* Return a function-scoped vector of length SIZE, with each element 4570/* Return a function-scoped vector of length SIZE, with each element
4571 being INIT. */ 4571 being INIT. */
4572 4572
4573# define make_local_vector(size, init) \ 4573# define make_local_vector(size, init) \
4574 make_local_vector_n (size, init, __COUNTER__)
4575# define make_local_vector_n(size_arg, init_arg, n) \
4576 ({ \ 4574 ({ \
4577 ptrdiff_t size##n = size_arg; \ 4575 ptrdiff_t size_ = size; \
4578 Lisp_Object init##n = init_arg; \ 4576 Lisp_Object init_ = init; \
4579 Lisp_Object vec##n; \ 4577 Lisp_Object vec_; \
4580 if (size##n <= (MAX_ALLOCA - header_size) / word_size) \ 4578 if (size_ <= (MAX_ALLOCA - header_size) / word_size) \
4581 { \ 4579 { \
4582 void *ptr##n = alloca (size##n * word_size + header_size); \ 4580 void *ptr_ = alloca (size_ * word_size + header_size); \
4583 vec##n = local_vector_init (ptr##n, size##n, init##n); \ 4581 vec_ = local_vector_init (ptr_, size_, init_); \
4584 } \ 4582 } \
4585 else \ 4583 else \
4586 vec##n = Fmake_vector (make_number (size##n), init##n); \ 4584 vec_ = Fmake_vector (make_number (size_), init_); \
4587 vec##n; \ 4585 vec_; \
4588 }) 4586 })
4589 4587
4590/* Return a function-scoped string with contents DATA and length NBYTES. */ 4588/* Return a function-scoped string with contents DATA and length NBYTES. */
4591 4589
4592# define make_local_string(data, nbytes) \ 4590# define make_local_string(data, nbytes) \
4593 make_local_string (data, nbytes, __COUNTER__)
4594# define make_local_string_n(data_arg, nbytes_arg, n) \
4595 ({ \ 4591 ({ \
4596 char const *data##n = data_arg; \ 4592 char const *data_ = data; \
4597 ptrdiff_t nbytes##n = nbytes_arg; \ 4593 ptrdiff_t nbytes_ = nbytes; \
4598 Lisp_Object string##n; \ 4594 Lisp_Object string_; \
4599 if (nbytes##n <= MAX_ALLOCA - sizeof (struct Lisp_String) - 1) \ 4595 if (nbytes_ <= MAX_ALLOCA - sizeof (struct Lisp_String) - 1) \
4600 { \ 4596 { \
4601 struct Lisp_String *ptr##n \ 4597 struct Lisp_String *ptr_ = alloca (sizeof (struct Lisp_String) + 1 \
4602 = alloca (sizeof (struct Lisp_String) + 1 + nbytes); \ 4598 + nbytes_); \
4603 string##n = local_string_init (ptr##n, data##n, nbytes##n); \ 4599 string_ = local_string_init (ptr_, data_, nbytes_); \
4604 } \ 4600 } \
4605 else \ 4601 else \
4606 string##n = make_string (data##n, nbytes##n); \ 4602 string_ = make_string (data_, nbytes_); \
4607 string##n; \ 4603 string_; \
4608 }) 4604 })
4609 4605
4610/* Return a function-scoped string with contents DATA. */ 4606/* Return a function-scoped string with contents DATA. */
4611 4607
4612# define build_local_string(data) build_local_string_n (data, __COUNTER__) 4608# define build_local_string(data) \
4613# define build_local_string_n(data_arg, n) \ 4609 ({ char const *data_ = data; make_local_string (data_, strlen (data_)); })
4614 ({ \
4615 char const *data##n = data_arg; \
4616 make_local_string (data##n, strlen (data##n)); \
4617 })
4618 4610
4619#else 4611#else
4620 4612