Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] preprocessor and carriage returns

Hi, this is a bit of a low level technical issue, but I'm hoping someone
can shed some light on the situation.

I'm reusing several of the existing parser test suites against the C99
parser. In particular, DOMLocationInclusionTests.testMacrosInIncludeFile()
keeps failing. This test involves parsing code that contains '\r'. The
problem I'm having is with this line of code in the test:


 assertSoleFileLocation(
                    macroDefinitions[1],
                    "blarg.h", h_file_code.indexOf("#define _BLARG_H_"),
"#define _BLARG_H_\r".length());


Why is the '\r' counted towards the length of the object macro definition?
Shouldn't it be considered whitespace? The C99 lexer ignores the '\r' as
whitespace and the test fails because the length is off by one.

I've been spending some time trying to get this test case to pass but now
its starting to feel like I'm trying to emulate a bug.

How are carriage returns supposed to be handled? Am I wrong in assuming
that they are treated just like regular whitespace?


Mike Kucera
IBM CDT Team
IBM Toronto Lab
905-413-3657
mkucera@xxxxxxxxxx



Back to the top