Sanyam Khurana <[email protected]> added the comment:
Even a simple use of ternary operator instead of using if-else inside do-while
to handle the macro like:
#define SET_DECODE_ERROR(NAME, LEN) \
pymain->err = ((LEN) == (size_t)-2) \
? _Py_INIT_USER_ERR("cannot decode " #NAME) \
: _Py_INIT_NO_MEMORY()
, throws the error `undeclared identifier pymain`:
gcc -c -Wno-unused-result -Wsign-compare -g -O0 -Wall -Wstrict-prototypes
-std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter
-Wno-missing-field-initializers -Werror=implicit-function-declaration -I.
-I./Include -DPy_BUILD_CORE -o Modules/main.o Modules/main.c
Modules/main.c:899:20: error: use of undeclared identifier 'pymain'
return SET_DECODE_ERROR("PYTHONEXECUTABLE environment "
^
Modules/main.c:46:5: note: expanded from macro 'SET_DECODE_ERROR'
pymain->err = ((LEN) == (size_t)-2) \
^
1 error generated.
make: *** [Modules/main.o] Error 1
I'm still trying to figure out a solution for this.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32197>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com