--- gcc/cpplib.h.orig	Mon Feb  9 13:23:51 2004
+++ gcc/cpplib.h	Thu Apr 29 12:24:10 2004
@@ -630,6 +630,7 @@
 #define CPP_N_DECIMAL	0x0100
 #define CPP_N_HEX	0x0200
 #define CPP_N_OCTAL	0x0400
+#define CPP_N_BINARY	0x0800
 
 #define CPP_N_UNSIGNED	0x1000	/* Properties.  */
 #define CPP_N_IMAGINARY	0x2000
--- gcc/cppexp.c.orig	Thu Feb 12 00:52:56 2004
+++ gcc/cppexp.c	Thu Apr 29 12:29:40 2004
@@ -22,6 +22,9 @@
 #include "system.h"
 #include "cpplib.h"
 #include "cpphash.h"
+#include "flags.h"
+#include "coretypes.h"
+#include "toplev.h"
 
 #define PART_PRECISION (sizeof (cpp_num_part) * CHAR_BIT)
 #define HALF_MASK (~(cpp_num_part) 0 >> (PART_PRECISION / 2))
@@ -75,6 +78,9 @@
 #define SYNTAX_ERROR2(msgid, arg) \
   do { cpp_error (pfile, CPP_DL_ERROR, msgid, arg); goto syntax_error; } \
   while(0)
+#define SYNTAX_ERROR3(msgid, arg1, arg2) \
+  do { cpp_error (pfile, CPP_DL_ERROR, msgid, arg1, arg2); goto syntax_error; } \
+  while(0)
 
 /* Subroutine of cpp_classify_number.  S points to a float suffix of
    length LEN, possibly zero.  Returns 0 for an invalid suffix, or a
@@ -171,6 +177,11 @@
 	  radix = 16;
 	  str++;
 	}
+      else if ((*str == 'b' || *str == 'B') && (str[1] == '0' || str[1] == '1'))
+	{
+	  radix = 2;
+	  str++;
+	}
     }
 
   /* Now scan for a well-formed integer or float.  */
@@ -209,7 +220,8 @@
     radix = 10;
 
   if (max_digit >= radix)
-    SYNTAX_ERROR2 ("invalid digit \"%c\" in octal constant", '0' + max_digit);
+    SYNTAX_ERROR3 ("invalid digit \"%c\" in %s constant", '0' + max_digit,
+		   radix == 2? "binary": "octal");
 
   if (float_flag != NOT_FLOAT)
     {
@@ -288,11 +300,16 @@
   if ((result & CPP_N_IMAGINARY) && CPP_PEDANTIC (pfile))
     cpp_error (pfile, CPP_DL_PEDWARN,
 	       "imaginary constants are a GCC extension");
+  if (radix == 2 && CPP_PEDANTIC (pfile))
+    cpp_error (pfile, CPP_DL_PEDWARN,
+	       "binary constants are a GCC extension");
 
   if (radix == 10)
     result |= CPP_N_DECIMAL;
   else if (radix == 16)
     result |= CPP_N_HEX;
+  else if (radix == 2)
+    result |= CPP_N_BINARY;
   else
     result |= CPP_N_OCTAL;
 
@@ -341,6 +358,11 @@
       else if ((type & CPP_N_RADIX) == CPP_N_HEX)
 	{
 	  base = 16;
+	  p += 2;
+	}
+      else if ((type & CPP_N_RADIX) == CPP_N_BINARY)
+	{
+	  base = 2;
 	  p += 2;
 	}
