emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r100078: Fix wrong-docstring problem


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100078: Fix wrong-docstring problem introduced with hash-consing.
Date: Thu, 29 Apr 2010 08:42:01 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100078
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Thu 2010-04-29 08:42:01 -0400
message:
  Fix wrong-docstring problem introduced with hash-consing.
  * eval.c (Fautoload): Set doc to a unique number rather than to 0.
  Remove unused var `args'.
  * lisp.h (XSETCARFASTINT, XSETCDRFASTINT): Remove.
  (LOADHIST_ATTACH): Wrap with do...while to avoid surprises for callers.
  * doc.c (store_function_docstring): Use XSETCAR.
modified:
  src/ChangeLog
  src/ChangeLog.4
  src/doc.c
  src/eval.c
  src/lisp.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-04-28 07:25:47 +0000
+++ b/src/ChangeLog     2010-04-29 12:42:01 +0000
@@ -1,3 +1,12 @@
+2010-04-29  Stefan Monnier  <address@hidden>
+
+       Fix wrong-docstring problem introduced with hash-consing.
+       * eval.c (Fautoload): Set doc to a unique number rather than to 0.
+       Remove unused var `args'.
+       * lisp.h (XSETCARFASTINT, XSETCDRFASTINT): Remove.
+       (LOADHIST_ATTACH): Wrap with do...while to avoid surprises for callers.
+       * doc.c (store_function_docstring): Use XSETCAR.
+
 2010-04-28  Glenn Morris  <address@hidden>
 
        * Makefile.in (BASE_WINDOW_SUPPORT, X_WINDOW_SUPPORT): New variables.

=== modified file 'src/ChangeLog.4'
--- a/src/ChangeLog.4   2010-01-13 08:35:10 +0000
+++ b/src/ChangeLog.4   2010-04-29 12:42:01 +0000
@@ -4329,7 +4329,7 @@
 
 1993-11-01  Richard Stallman  (address@hidden)
 
-       * s/sunos4-1-3.h (HAVE_TERMIOS): Defined.
+       * s/sunos4-1-3.h (HAVE_TERMIOS): Define.
 
 1993-10-25  Brian J. Fox  (address@hidden)
 
@@ -4426,9 +4426,9 @@
 
        * Makefile.in: File removed.  It is now generated by ../configure.
 
-       * Makefile.in.in (LIBES): Add $(GNULIB_VAR) again at end.  This
-       change to ymakefile was mysteriously lost.  Were any others lost
-       too?
+       * Makefile.in.in (LIBES): Add $(GNULIB_VAR) again at end.
+       This change to ymakefile was mysteriously lost.
+       Were any others lost too?
 
 1993-10-02  Brian J. Fox  (address@hidden)
 
@@ -4461,8 +4461,7 @@
 
 1993-09-24  Brian J. Fox  (address@hidden)
 
-       * textprop.c (validate_plist): Add declaration for `list'
-       argument.
+       * textprop.c (validate_plist): Add declaration for `list' argument.
 
        * frame.c (Fhandle_switch_frame): Doc fix.
 
@@ -4501,7 +4500,7 @@
        * doc.c (Fsubstitute_command_keys): Pass new arg.
        * abbrev.c (Funexpand_abbrev, Fexpand_abbrev): Pass new arg.
 
-       * s/aix3-2.h (AIX3_2): Defined.
+       * s/aix3-2.h (AIX3_2): Define.
        * m/ibmrs6000.h (LIBS_MACHINE): Include -lrts, -liconv only if AIX3_2.
 
        * xterm.h (HAVE_X11R4): If AIX, do not define HAVE_X11R4.
@@ -4703,13 +4702,13 @@
 
        * xfns.c (XScreenNumberOfScreen): New function.
 
-       * m/tek4300.h (C_DEBUG_SWITCH, SYSTEM_MALLOC): Defined.
+       * m/tek4300.h (C_DEBUG_SWITCH, SYSTEM_MALLOC): Define.
 
        * m/iris4d.h (START_FILES, LIB_STANDARD): Don't define if USG5_4.
        (DEFAULT_ENTRY_ADDRESS): Likewise.
        (UNEXEC): Use unexelfsgi.o if USG5_4.
 
-       * s/irix5-0.h (C_SWITCH_MACHINE): Deleted.
+       * s/irix5-0.h (C_SWITCH_MACHINE): Delete.
 
 1993-08-13  Frederic Pierresteguy  (address@hidden)
 
@@ -4809,7 +4808,7 @@
 
        * m/dpx2.h (HAVE_TCATTR): Macro #defined.
        (HAVE_CLOSEDIR): #undef to allow use of closedir in sysdep.c.
-       (SIGTSTP): Commented #undef to allow use of ^Z in shell-mode.
+       (SIGTSTP): Comment #undef to allow use of ^Z in shell-mode.
        (SIGNALS_VIA_CHARACTERS): #defined.
 
 1993-08-09  Paul Eggert  (address@hidden)
@@ -4849,10 +4848,10 @@
        and calculate position properly.
 
        * s/bsd4-2.h, s/bsd4-3.h, s/umax.h, s/rtu.h, s/dgux.h (HAVE_VFORK):
-       Defined.
+       Define.
 
        * ymakefile (alloc.o): Don't use DEBUG_MOLE.
-       (DEBUG_MOLE): Deleted.
+       (DEBUG_MOLE): Delete.
        * gnu-hp300: File deleted.
 
        * .gdbinit: Don't put -q in args.
@@ -4878,7 +4877,7 @@
        (main): Call init_buffer, init_callproc and init_cmdargs
        before init_lread.
        (syms_of_emacs): Install the function, and protect the variable.
-       * lisp.h (Vinvocation_directory): Declared.
+       * lisp.h (Vinvocation_directory): Declare.
        * lread.c (init_lread): Normally put Vinvocation_directory
        at end of Vload_path, if not present already.
 

=== modified file 'src/doc.c'
--- a/src/doc.c 2010-01-13 08:35:10 +0000
+++ b/src/doc.c 2010-04-29 12:42:01 +0000
@@ -538,7 +538,7 @@
        {
          tem = Fcdr (Fcdr (fun));
          if (CONSP (tem) && INTEGERP (XCAR (tem)))
-           XSETCARFASTINT (tem, offset);
+           XSETCAR (tem, make_number (offset));
        }
       else if (EQ (tem, Qmacro))
        store_function_docstring (XCDR (fun), offset);

=== modified file 'src/eval.c'
--- a/src/eval.c        2010-04-25 22:16:58 +0000
+++ b/src/eval.c        2010-04-29 12:42:01 +0000
@@ -2134,8 +2134,6 @@
      (function, file, docstring, interactive, type)
      Lisp_Object function, file, docstring, interactive, type;
 {
-  Lisp_Object args[4];
-
   CHECK_SYMBOL (function);
   CHECK_STRING (file);
 
@@ -2151,8 +2149,11 @@
     LOADHIST_ATTACH (Fcons (Qautoload, function));
   else
     /* We don't want the docstring in purespace (instead,
-       Snarf-documentation should (hopefully) overwrite it).  */
-    docstring = make_number (0);
+       Snarf-documentation should (hopefully) overwrite it).
+       We used to use 0 here, but that leads to accidental sharing in
+       purecopy's hash-consing, so we use a (hopefully) unique integer
+       instead.  */
+    docstring = make_number (XHASH (function));
   return Ffset (function,
                Fpurecopy (list5 (Qautoload, file, docstring,
                                  interactive, type)));

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2010-04-20 18:52:07 +0000
+++ b/src/lisp.h        2010-04-29 12:42:01 +0000
@@ -721,11 +721,6 @@
 #define XSETCAR(c,n) (XCAR_AS_LVALUE(c) = (n))
 #define XSETCDR(c,n) (XCDR_AS_LVALUE(c) = (n))
 
-/* For performance: Fast storage of positive integers into the
-   fields of a cons cell.  See above caveats.  */
-#define XSETCARFASTINT(c,n)  XSETFASTINT(XCAR_AS_LVALUE(c),(n))
-#define XSETCDRFASTINT(c,n)  XSETFASTINT(XCDR_AS_LVALUE(c),(n))
-
 /* Take the car or cdr of something whose type is not known.  */
 #define CAR(c)                                 \
  (CONSP ((c)) ? XCAR ((c))                     \
@@ -2821,7 +2816,9 @@
 extern Lisp_Object make_symbol P_ ((char *));
 extern Lisp_Object oblookup P_ ((Lisp_Object, const char *, int, int));
 #define LOADHIST_ATTACH(x) \
- if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list)
+  do {                                                                 \
+    if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); \
+  } while (0)
 extern Lisp_Object Vcurrent_load_list;
 extern Lisp_Object Vload_history, Vload_suffixes, Vload_file_rep_suffixes;
 extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object,


reply via email to

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