From: Stefan Monnier Date: Thu, 29 Apr 2010 12:42:01 +0000 (-0400) Subject: Fix wrong-docstring problem introduced with hash-consing. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~346 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d6d2385247fd2a9cacd338ec5ff1b47787ef44fb;p=emacs.git 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index e80ee7c2073..3eca5c4fda1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2010-04-29 Stefan Monnier + + 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 * Makefile.in (BASE_WINDOW_SUPPORT, X_WINDOW_SUPPORT): New variables. diff --git a/src/ChangeLog.4 b/src/ChangeLog.4 index 7e5728fbbcd..4f5d0b29e4c 100644 --- a/src/ChangeLog.4 +++ b/src/ChangeLog.4 @@ -4329,7 +4329,7 @@ 1993-11-01 Richard Stallman (rms@mole.gnu.ai.mit.edu) - * s/sunos4-1-3.h (HAVE_TERMIOS): Defined. + * s/sunos4-1-3.h (HAVE_TERMIOS): Define. 1993-10-25 Brian J. Fox (bfox@albert.gnu.ai.mit.edu) @@ -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 (bfox@ai.mit.edu) @@ -4461,8 +4461,7 @@ 1993-09-24 Brian J. Fox (bfox@ai.mit.edu) - * 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 (F.Pierresteguy@frcl.bull.fr) @@ -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 (eggert@twinsun.com) @@ -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. diff --git a/src/doc.c b/src/doc.c index 303aed0486d..536d22c57a6 100644 --- a/src/doc.c +++ b/src/doc.c @@ -538,7 +538,7 @@ store_function_docstring (fun, offset) { 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); diff --git a/src/eval.c b/src/eval.c index 184455f7e7d..120365f5f57 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2134,8 +2134,6 @@ this does nothing and returns nil. */) (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 @@ this does nothing and returns nil. */) 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))); diff --git a/src/lisp.h b/src/lisp.h index 84e2fad4483..16953e20a04 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -721,11 +721,6 @@ struct Lisp_Cons #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 intern_c_string (const char *); 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,