diff --git a/CHANGELOG b/CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+Version 1.9
+-----------
+  * Bugfix for #undef.
+
 Version 1.8
 -----------
   * Bugfix for off-by-one error in line numbers with --include=file.
diff --git a/Language/Preprocessor/Cpphs/CppIfdef.hs b/Language/Preprocessor/Cpphs/CppIfdef.hs
--- a/Language/Preprocessor/Cpphs/CppIfdef.hs
+++ b/Language/Preprocessor/Cpphs/CppIfdef.hs
@@ -20,7 +20,6 @@
 
 import Language.Preprocessor.Cpphs.SymTab
 import Text.ParserCombinators.HuttonMeijer
--- import HashDefine
 import Language.Preprocessor.Cpphs.Position  (Posn,newfile,newline,newlines
                                              ,cppline,newpos)
 import Language.Preprocessor.Cpphs.ReadFirst (readFirst)
@@ -245,6 +244,7 @@
         Nothing  -> sym
         Just (a@SymbolReplacement{}) -> recursivelyExpand st (replacement a)
         Just (a@MacroExpansion{})    -> expandMacro a args False
+        Just (a@AntiDefined{})       -> name a
 
 recursivelyExpand :: SymTab HashDefine -> String -> String
 recursivelyExpand st inp =
diff --git a/Language/Preprocessor/Cpphs/HashDefine.hs b/Language/Preprocessor/Cpphs/HashDefine.hs
--- a/Language/Preprocessor/Cpphs/HashDefine.hs
+++ b/Language/Preprocessor/Cpphs/HashDefine.hs
@@ -26,6 +26,10 @@
 		{ name :: String }
 	| Pragma
 		{ name :: String }
+        | AntiDefined
+		{ name          :: String
+		, linebreaks    :: Int
+		}
 	| SymbolReplacement
 		{ name		:: String
 		, replacement	:: String
@@ -72,9 +76,9 @@
     command ("line":xs)   = Just (LineDrop ("#line"++concat xs))
     command ("pragma":xs) = Just (Pragma ("#pragma"++concat xs))
     command ("define":xs) = Just (((define . skip) xs) { linebreaks=count def })
-    command ("undef":xs)  = Just (((undef  . skip) xs) { linebreaks=count def })
+    command ("undef":xs)  = Just (((undef  . skip) xs))
     command _             = Nothing
-    undef  (sym:_)   = symbolReplacement { name=sym, replacement=sym }
+    undef  (sym:_)   = AntiDefined { name=sym, linebreaks=0 }
     define (sym:xs)  = case {-skip-} xs of
                            ("(":ys) -> (macroHead sym [] . skip) ys
                            ys   -> symbolReplacement
diff --git a/Language/Preprocessor/Cpphs/MacroPass.hs b/Language/Preprocessor/Cpphs/MacroPass.hs
--- a/Language/Preprocessor/Cpphs/MacroPass.hs
+++ b/Language/Preprocessor/Cpphs/MacroPass.hs
@@ -100,6 +100,7 @@
             Nothing -> x: macroProcess pr layout lang st ws
             Just hd ->
                 case hd of
+                    AntiDefined {name=n} -> n: macroProcess pr layout lang st ws
                     SymbolReplacement {replacement=r} ->
                         let r' = if layout then r else filter (/='\n') r in
                         -- one-level expansion only:
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 LIBRARY = cpphs
-VERSION = 1.8
+VERSION = 1.9
 
 DIRS	= Language/Preprocessor/Cpphs \
 	  Text/ParserCombinators
diff --git a/cpphs.cabal b/cpphs.cabal
--- a/cpphs.cabal
+++ b/cpphs.cabal
@@ -1,5 +1,5 @@
 Name: cpphs
-Version: 1.8
+Version: 1.9
 Copyright: 2004-2009, Malcolm Wallace
 Build-Depends: base < 6, haskell98
 License: LGPL
diff --git a/cpphs.hs b/cpphs.hs
--- a/cpphs.hs
+++ b/cpphs.hs
@@ -19,7 +19,7 @@
 import List   ( isPrefixOf )
 
 version :: String
-version = "1.8"
+version = "1.9"
 
 main :: IO ()
 main = do
diff --git a/docs/index.html b/docs/index.html
--- a/docs/index.html
+++ b/docs/index.html
@@ -194,16 +194,16 @@
 <b>Current stable version:</b>
 
 <p>
-cpphs-1.8, release date 2009.08.06<br>
+cpphs-1.9, release date 2009.09.07<br>
 By HTTP:
-<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.8.tar.gz">.tar.gz</a>,
-<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.8.zip">.zip</a>.
+<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.9.tar.gz">.tar.gz</a>,
+<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.9.zip">.zip</a>.
 <a href="http://www.haskell.org/fedora/">Fedora package</a>,
 <a href="http://packages.gentoo.org/packages/?category=dev-haskell;name=cpphs">Gentoo package</a>,
 <a href="http://www.freshports.org/devel/hs-cpphs/">FreeBSD port</a>,
 <a href="http://www.openbsd.org/cgi-bin/cvsweb/ports/devel/cpphs/">OpenBSD port</a>.
 <ul>
-<li> Bugfix for off-by-one error in line numbers with --include=file.
+<li> Bugfix for #undef.
 </ul>
 
 <p>
@@ -225,6 +225,15 @@
 
 <p>
 <b>Older versions:</b>
+
+<p>
+cpphs-1.8, release date 2009.08.06<br>
+By HTTP:
+<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.8.tar.gz">.tar.gz</a>,
+<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.8.zip">.zip</a>.
+<ul>
+<li> Bugfix for off-by-one error in line numbers with --include=file.
+</ul>
 
 <p>
 cpphs-1.7, release date 2009.06.22<br>
diff --git a/tests/runtests b/tests/runtests
--- a/tests/runtests
+++ b/tests/runtests
@@ -66,4 +66,5 @@
 runtest "$CPPHS --include=inclusion preinclude" expect46
 runtest "$CPPHS --unlit endcode-a" expect47
 runtest "$CPPHS --unlit endcode-b" expect48
+runtest "$CPPHS undef.hs" expect49
 exit $FAIL
diff --git a/tests/undef.hs b/tests/undef.hs
new file mode 100644
--- /dev/null
+++ b/tests/undef.hs
@@ -0,0 +1,4 @@
+#define FOO 3
+wibble FOO
+#undef FOO
+this is FOO
