Preprocessor: Compiler dependent parsing of '<backspace><space><newline>'. Maybe it should be possible to control it from the commandline instead. Ticket: #640
This commit is contained in:
parent
32d98969fb
commit
567f1da4b4
|
@ -144,9 +144,16 @@ std::string Preprocessor::read(std::istream &istr, const std::string &filename,
|
||||||
needSpace = true;
|
needSpace = true;
|
||||||
|
|
||||||
// <backspace><newline>..
|
// <backspace><newline>..
|
||||||
|
// for gcc-compatibility the trailing spaces should be ignored
|
||||||
|
// for vs-compatibility the trailing spaces should be kept
|
||||||
|
// See tickets #640 and #1869
|
||||||
|
// The solution for now is to have a compiler-dependent behaviour.
|
||||||
if (ch == '\\')
|
if (ch == '\\')
|
||||||
{
|
{
|
||||||
unsigned char chNext = 0;
|
unsigned char chNext;
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
// gcc-compatibility: ignore spaces
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
chNext = (unsigned char)istr.peek();
|
chNext = (unsigned char)istr.peek();
|
||||||
|
@ -160,7 +167,10 @@ std::string Preprocessor::read(std::istream &istr, const std::string &filename,
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// keep spaces
|
||||||
|
chNext = (unsigned char)istr.peek();
|
||||||
|
#endif
|
||||||
if (chNext == '\n' || chNext == '\r')
|
if (chNext == '\n' || chNext == '\r')
|
||||||
{
|
{
|
||||||
++newlines;
|
++newlines;
|
||||||
|
|
Loading…
Reference in New Issue