Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-32390: Modify syntax to satisify xlC/gcc compiler requirements on AIX: assignment between types "unsigned long" and "struct fsid_t" is not allowed #4972

Merged
merged 8 commits into from
Jan 5, 2018

Conversation

aixtools
Copy link
Contributor

@aixtools aixtools commented Dec 22, 2017

Error message was: "./Modules/posixmodule.c", line 9328.64: 1506-280 (S) Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed.

https://bugs.python.org/issue32390

Error message was: "./Modules/posixmodule.c", line 9328.64: 1506-280 (S) Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed.
@aixtools aixtools changed the title Modify syntax to satisify xlC/gcc compiler requirements on AIX: assignment between types "unsigned long" and "struct fsid_t" is not allowed bpo-32390: Modify syntax to satisify xlC/gcc compiler requirements on AIX: assignment between types "unsigned long" and "struct fsid_t" is not allowed Dec 22, 2017
@aixtools
Copy link
Contributor Author

Seems 'clang' and AIX xlc and gcc are not agreeing:

  • The clang test (of ontinuous-integration/travis-ci/pr) fails with:
./Modules/posixmodule.c:9328:71: error: member reference base type 'unsigned long' is not a structure or union
    PyStructSequence_SET_ITEM(v, 10, PyLong_FromUnsignedLong(st.f_fsid.val[0]));
                                                             ~~~~~~~~~^~~~
./Include/structseq.h:38:69: note: expanded from macro 'PyStructSequence_SET_ITEM'
#define PyStructSequence_SET_ITEM(op, i, v) PyTuple_SET_ITEM(op, i, v)
                                                                    ^
./Include/tupleobject.h:62:75: note: expanded from macro 'PyTuple_SET_ITEM'
#define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
                                                                          ^
gcc -pthread -Wno-unused-result -Wsign-compare -g -Og -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  -c ./Modules/posixmodule.c -o Modules/posixmodule.o
In file included from ./Include/Python.h:85:0,
                 from ./Modules/posixmodule.c:27:
./Modules/posixmodule.c: In function '_pystatvfs_fromstructstatvfs':
./Modules/posixmodule.c:9328:62: error: incompatible type for argument 1 of 'PyLong_FromUnsignedLong'
     PyStructSequence_SET_ITEM(v, 10, PyLong_FromUnsignedLong(st.f_fsid));
                                                              ^
./Include/tupleobject.h:62:75: note: in definition of macro 'PyTuple_SET_ITEM'
 #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
                                                                           ^
./Modules/posixmodule.c:9328:5: note: in expansion of macro 'PyStructSequence_SET_ITEM'
     PyStructSequence_SET_ITEM(v, 10, PyLong_FromUnsignedLong(st.f_fsid));
     ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./Include/Python.h:78:0,
                 from ./Modules/posixmodule.c:27:
./Include/longobject.h:19:24: note: expected 'long unsigned int' but argument is of type 'fsid_t {aka struct fsid_t}'
 PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long);
                        ^~~~~~~~~~~~~~~~~~~~~~~
Makefile:1765: recipe for target 'Modules/posixmodule.o' failed

  • I'll modify the change (to put it behind _AIX) - as AIX seems to be having an issue regardless of gcc or xlc (which is how I spotted the issue originally).
  • See if that passes tests - and then I welcome your input for a potentially prettier solution!

@@ -0,0 +1,2 @@
Correct compiler syntax error on AIX for st.f_fsid addition
Error message: 1506-280 (S) Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer:

Fix os.statvfs(path) on AIX where the f_fsid member of the statvfs structure is a structure instead of unsigned long. Patch by Michael Felt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did more research and found a way for typedefs to be the same. Added comments in code and summary in News.

If this is not the way you want it documented, please reply.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment in a source file with part of a AIX header being copy-pasted in it is not correct, this should be done in the issue instead.

Please start a discussion in the issue.

@aixtools
Copy link
Contributor Author

aixtools commented Dec 31, 2017

would like to emphasize, since 96a5e50 AIX cannot compile. This allows compile to continue.

p.s. title should be changed, as the syntax is now the same. The "default" action of defining _ALL_SOURCE is undone is closer to the truth.

@xdegaye xdegaye merged commit 502d551 into python:master Jan 5, 2018
@aixtools aixtools deleted the bpo-32390 branch January 8, 2018 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants