emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

More issues with r117851 [Was: Re: Subtle error defining VALMASK?]


From: Dmitry Antipov
Subject: More issues with r117851 [Was: Re: Subtle error defining VALMASK?]
Date: Wed, 10 Sep 2014 21:25:46 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0

On 09/10/2014 08:54 PM, Paul Eggert wrote:

That's not a problem with the #define; it's a problem with the enum.
It's simpler to omit the enum, so I did that in trunk bzr 117854.

Thanks.

But there is one more issue with r117851.  Even after an obvious fix:

=== modified file 'src/lisp.h'
--- src/lisp.h  2014-09-10 16:52:50 +0000
+++ src/lisp.h  2014-09-10 17:20:29 +0000
@@ -4590,7 +4590,7 @@
 /* Return a function-scoped string with contents DATA and length NBYTES.  */

 # define make_local_string(data, nbytes) \
-    make_local_string (data, nbytes, __COUNTER__)
+    make_local_string_n (data, nbytes, __COUNTER__)
 # define make_local_string_n(data_arg, nbytes_arg, n)                  \
     ({                                                                 \
        char const *data##n = data_arg;                                 \
@@ -4599,7 +4599,7 @@
        if (nbytes##n <= MAX_ALLOCA - sizeof (struct Lisp_String) - 1)       \
         {                                                              \
           struct Lisp_String *ptr##n                                   \
-            = alloca (sizeof (struct Lisp_String) + 1 + nbytes);       \
+            = alloca (sizeof (struct Lisp_String) + 1 + nbytes##n);    \
           string##n = local_string_init (ptr##n, data##n, nbytes##n);  \
         }                                                              \
        else                                                            \


__COUNTER__ is not expanded, e.g. this:

=== modified file 'src/editfns.c'
--- src/editfns.c       2014-09-07 07:04:01 +0000
+++ src/editfns.c       2014-09-10 17:15:08 +0000
@@ -1318,7 +1318,7 @@
   p = USER_FULL_NAME;
   /* Chop off everything after the first comma. */
   q = strchr (p, ',');
-  full = make_string (p, q ? q - p : strlen (p));
+  full = make_local_string (p, q ? q - p : strlen (p));

 #ifdef AMPERSAND_FULL_NAME
   p = SSDATA (full);

expands to:

  p = pw->pw_gecos;
  /* Chop off everything after the first comma. */
  q = strchr (p, ',');
full = ({ char const *data__COUNTER__ = p; ptrdiff_t nbytes__COUNTER__ = q ? q - p : strlen (p); Lisp_Object string__COUNTER__; if (nbytes__COUNTER__ <= MAX_ALLOCA - sizeof (struct Lisp_String) - 1) { struct Lisp_String *ptr__COUNTER__ = __builtin_alloca (sizeof (struct Lisp_String) + 1 + nbytes__COUNTER__); string__COUNTER__ = local_string_init (ptr__COUNTER__, data__COUNTER__, nbytes__COUNTER__); } else string__COUNTER__ = make_string (data__COUNTER__, nbytes__COUNTER__); string__COUNTER__; });

Dmitry




reply via email to

[Prev in Thread] Current Thread [Next in Thread]