putchar() from kernel.h clobbered by stdio.h
Posted: Sat Jul 31, 2004 9:52 am
I ran into a problem where the pre-compiler clobbered the proto for putchar() from kernel.c
What came form the include was in ps2sdk/ee/kernel.h line 272:
int putchar(int c);
After the pre-compiler used the defines from ps2dev/ee/ee/include/stdio.h the result was:
int (--((_impure_ptr->_stdout))->_w < 0 ? ((_impure_ptr->_stdout))->_w >= ((_imp
ure_ptr->_stdout))->_lbfsize ? (*((_impure_ptr->_stdout))->_p = (int c)), *((_im
pure_ptr->_stdout))->_p != '\n' ? (int)*((_impure_ptr->_stdout))->_p++ : __swbuf
('\n', (_impure_ptr->_stdout)) : __swbuf((int)(int c), (_impure_ptr->_stdout)) :
(*((_impure_ptr->_stdout))->_p = (int c), (int)*((_impure_ptr->_stdout))->_p++)
);
This finally results in a fatal compiler error that a parse error occured before '--' token.
If I comment out the proto from the kernel header file then the compiler complettes.
What came form the include was in ps2sdk/ee/kernel.h line 272:
int putchar(int c);
After the pre-compiler used the defines from ps2dev/ee/ee/include/stdio.h the result was:
int (--((_impure_ptr->_stdout))->_w < 0 ? ((_impure_ptr->_stdout))->_w >= ((_imp
ure_ptr->_stdout))->_lbfsize ? (*((_impure_ptr->_stdout))->_p = (int c)), *((_im
pure_ptr->_stdout))->_p != '\n' ? (int)*((_impure_ptr->_stdout))->_p++ : __swbuf
('\n', (_impure_ptr->_stdout)) : __swbuf((int)(int c), (_impure_ptr->_stdout)) :
(*((_impure_ptr->_stdout))->_p = (int c), (int)*((_impure_ptr->_stdout))->_p++)
);
This finally results in a fatal compiler error that a parse error occured before '--' token.
If I comment out the proto from the kernel header file then the compiler complettes.