KalebDark / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

__LINE__ macro expansion sporadically wrong due to line counter reset #184

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. run $ echo "void main() { int line = __LINE__;
line = __LINE__;
line = __LINE__; }" > line.cpp
2. run $ essl_to_glsl -o line.cpp

What is the expected output? What do you see instead?
$ g++ -E -x c++ line.cpp
void main() { int line = 1;
line = 2;
line = 3; }

$ essl_to_glsl -o line.cpp
void main(){
mediump int line = 1;
(line = 1);
(line = 2);
}

What version of the product are you using? On what operating system?
r705

Please provide any additional information below.
Add more line = __LINE__; lines to explore the exciting context-dependent 
nature of this bug.

Original issue reported on code.google.com by kosmo...@gmail.com on 18 Jul 2011 at 8:57

GoogleCodeExporter commented 9 years ago
This appears be to related to an incorrect __FILE__ increment:
$ echo "void main() { int line = __LINE__; int file = __FILE__;
> line = __LINE__; file = __FILE__;
> line = __LINE__; file = __FILE__; }" > line.cpp

$ essl_to_glsl -o line.cpp
void main(){
mediump int line = 1;
mediump int file = 0;
(line = 1);
(file = 1);
(line = 2);
(file = 1);
}

Original comment by kosmo...@gmail.com on 18 Jul 2011 at 9:08

GoogleCodeExporter commented 9 years ago
Alok: do you know if this is a problem in the new preprocessor?

Original comment by dan...@transgaming.com on 26 Oct 2012 at 7:39

GoogleCodeExporter commented 9 years ago
Should be fixed in the new preprocessor.

Original comment by alokp@chromium.org on 26 Oct 2012 at 7:42

GoogleCodeExporter commented 9 years ago
Closing as fixed then.

Original comment by dan...@transgaming.com on 26 Oct 2012 at 7:47