Zitat Zitat von danst
Hallo,

ich bin gerade auf Linux umgestiegen und mir gefällt die Einschränkung des neuen Compilers, dass ich keine Binären Zahlen (alla "0b") mehr verwenden kann, nicht, daher ...
Nun denn, packen wir einfach das Übel an der Wurzel und lehren gcc, wie er mit 0b* umzugehen hat. Wenn wir schon Open Source verwenden, dann sind wir ja Master of Code
Und sooo viel zu patchen ist's wirklich nicht! Schau selbst:

Zitat Zitat von <GCC>/gcc/cpplib.h
Code:
#define CPP_N_RADIX	0x0F00
#define CPP_N_DECIMAL	0x0100
#define CPP_N_HEX	0x0200
#define CPP_N_OCTAL	0x0400
#define CPP_N_BINARY	0x0800
Zitat Zitat von <GCC>/gcc/cppexp.c
Code:
unsigned int
cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
{
...
  /* First, interpret the radix.  */
  if (*str == '0')
  {
      radix = 8;
      str++;
      
      /* Require at least one hex digit to classify it as hex.  */
      if ((*str == 'x' || *str == 'X')
          && (str[1] == '.' || ISXDIGIT (str[1])))
      {
          radix = 16;
          str++;
      }
      /* Require at least one binary digit to classify it as binary.  */
      else if ((*str == 'b' || *str == 'B')
          && (str[1] == '0' || str[1] == '1'))
      {
          radix = 2;
          str++;
      }
  }
...
  
  if (max_digit >= radix)
      if (radix == 2)
          SYNTAX_ERROR2 ("invalid digit \"%c\" in binary constant", '0' + max_digit);
      else
          SYNTAX_ERROR2 ("invalid digit \"%c\" in octal constant", '0' + max_digit);

...

  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;

  return result;

 syntax_error:
  return CPP_N_INVALID;
}

cpp_num
cpp_interpret_integer (cpp_reader *pfile, const cpp_token *token, unsigned int type)
{
...
      if ((type & CPP_N_RADIX) == CPP_N_OCTAL)
	{
	  base = 8;
	  p++;
	}
      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;
	}
...
}
Dabei sind das nicht alles Änderungen, sondern teilweise noch der Originalcode, damit die Stellen besser zu finden sind.