g-ir-scanner doesn't "export" constants (macros) defined using other constants (macros) in some cases
Submitted by Vratislav Podzimek
Link to original bug (#758691)
Description
Created attachment 316289 sources demonstrating the issue
Description of problem: Best described with an example code:
#define TEST_DATA_CONST1 10
#define TEST_DATA_CONST2 *10
#define TEST_DATA_CONST3 (TEST_DATA_CONST1 TEST_DATA_CONST2)
If the above code is a part of the header file (attached) that is GI-introspected, only the TEST_DATA_CONST1 is "exported" (defined in the namespace).
Version-Release number of selected component (if applicable): gobject-introspection-devel-1.42.0-1.fc21.x86_64
How reproducible: 100 %
Steps to Reproduce:
- use the test_data.c and test_data.h files to create a GI-introspected library
- try to get the TEST_DATA_CONST3 e.g. from python
$ gcc -fPIC -c -o test_data.o `pkg-config --cflags glib-2.0 gobject-2.0` test_data.c
$ gcc -shared -o test_data.so `pkg-config --libs glib-2.0 gobject-2.0` test_data.o
$ LD_LIBRARY_PATH=. g-ir-scanner `pkg-config --libs --cflags glib-2.0 gobject-2.0` --identifier-prefix=Test --symbol-prefix=test --namespace Test --nsversion=1.0 --library test_data --warn-all -o Test-1.0.gir test_data.c test_data.h
$ g-ir-compiler Test-1.0.gir > Test-1.0.typelib
$ GI_TYPELIB_PATH=. LD_LIBRARY_PATH=. ipython
Actual results:
no TestData.CONST3 in the TestData module/namespace
Expected results:
TestData.CONST3 in the TestData module/namespace as it is a valid constant and preprocessor expands it to the right value just fine
Attachment 316289, "sources demonstrating the issue":
reproducer.tar.gz
Edited by Christoph Reiter