unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Bug in hide-ifdef-mode
@ 2008-01-19 16:51 martin rudalics
  0 siblings, 0 replies; only message in thread
From: martin rudalics @ 2008-01-19 16:51 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1204 bytes --]

To reproduce with Emacs -Q: Open src/data.c and do M-x hide-ifdef-mode.

Should get you something like:

Debugger entered--Lisp error: (error "Bad token in parenthesized expression: 125")
   signal(error ("Bad token in parenthesized expression: 125"))
   error("Bad token in parenthesized expression: %s" 125)
   hif-factor()
   hif-math()
   hif-eq-expr()
   hif-and-expr()
   hif-or-expr()
   hif-expr()
   hif-parse-if-exp((lparen FLT_RADIX equal 2 and FLT_MANT_DIG equal 24 and FLT_MIN_EXP equal hif-minus 125 and FLT_MAX_EXP equal 128 rparen))
   hif-canonicalize()
   hif-possibly-hide()
   hide-ifdef-guts()
   hif-recurse-on(1351 1547)
   hif-possibly-hide()
   hide-ifdef-guts()
   hide-ifdefs()
   hide-ifdef-mode(toggle)
   call-interactively(hide-ifdef-mode)
   execute-extended-command(nil)
   call-interactively(execute-extended-command)

The bug occurs when `hif-factor' tries to parse the unary minus in:

#if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
      && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128)

The attached, somewhat naive, patch fixes the bug for me.  Could someone
who uses `hide-ifdef-mode' on a regular basis check whether that fix
breaks something else.  Thanks in advance.

[-- Attachment #2: hideif.patch --]
[-- Type: text/plain, Size: 556 bytes --]

*** progmodes/hideif.el	Sat Jan 19 14:53:52 2008
--- progmodes/hideif.el	Sat Jan 19 17:16:20 2008
***************
*** 473,478 ****
--- 473,486 ----
     ((numberp hif-token)
      (prog1 hif-token (hif-nexttoken)))
  
+    ((memq hif-token '(hif-minus hif-plus))
+     (let (result math-op)
+       (while (memq hif-token '(hif-plus hif-minus))
+ 	(setq math-op hif-token)
+ 	(hif-nexttoken)
+ 	(setq result (list math-op result (hif-factor))))
+       result))
+ 
     (t					; identifier
      (let ((ident hif-token))
        (if (memq ident '(or and))

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-19 16:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-19 16:51 Bug in hide-ifdef-mode martin rudalics

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).