[gnu.emacs.bug] bug in cmacro

wolfgang@MGM.MIT.EDU (06/01/89)

In GNU Emacs 18.54.3 of Fri May 19 1989 on Sun3 (berkeley-unix)

The c-macro-expand tries too hard to be efficient...

---example file---
#define foo(x)  (x \
		 x \
		 x)

foo(hello)
---end example file---

produces:
	(hello
instead of:
	(hello
	 hello
	 hello)

"The expansion would be entirely correct if it used the C preprocessor." ;-)

-wolfgang
---
Wolfgang Rupprecht	ARPA:  wolfgang@mgm.mit.edu (IP 18.82.0.114)
TEL: (703) 768-2640	UUCP:  mit-eddie!mgm.mit.edu!wolfgang

diff -c cmacexp.el.~1~ cmacexp.el
*** cmacexp.el.~1~	Wed May 31 15:29:32 1989
--- cmacexp.el	Wed May 31 15:49:56 1989
***************
*** 18,26 ****
  	(goto-char beg)
  	(beginning-of-line)
  	(setq last-needed (point))
! 	(if (re-search-backward "^[ \t]*#" nil t)
! 	    (progn (forward-line 1)
! 		   (setq last-needed (point)))))
        (write-region (point-min) last-needed tempfile nil 'nomsg)
        (process-send-string process (concat "#include \"" tempfile "\"\n"))
        (process-send-string process "\n")
--- 18,27 ----
  	(goto-char beg)
  	(beginning-of-line)
  	(setq last-needed (point))
! 	;;(if (re-search-backward "^[ \t]*#" nil t)
! 	;;    (progn (forward-line 1)
! 	;;	   (setq last-needed (point))))
! 	)
        (write-region (point-min) last-needed tempfile nil 'nomsg)
        (process-send-string process (concat "#include \"" tempfile "\"\n"))
        (process-send-string process "\n")

diff exited abnormally with code 1