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

Fix warnings from gcc 8.2 in Debian 10 (Buster) #321

Merged
merged 7 commits into from
Dec 17, 2019
Merged

Fix warnings from gcc 8.2 in Debian 10 (Buster) #321

merged 7 commits into from
Dec 17, 2019

Conversation

pdp7
Copy link
Collaborator

@pdp7 pdp7 commented Dec 11, 2019

Fix warning about casting incompatible function types, format truncation, and sizeof in strncpy. Refer to issue #308

Debian 10 (Buster) has gcc 8.2 which warns about:

cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’

The solution is to cast to '(PyCFunction)(void *)'
Debian 10 (Buster) has gcc 8.2 which warns about:

error: ‘%s’ directive output may be truncated writing up to 19 bytes into a region of size between 10 and 59 [-Werror=format-truncation=]
  snprintf(path, sizeof(path), "%s/%s/state", ocp_dir, pinmux_dir);
Debian 10 (Buster) has gcc 8.2 which warns about:

cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’

The solution is to cast to '(PyCFunction)(void *)'
Debian 10 (Buster) has gcc 8.2 which warns about:

source/c_pwm.c:459:65: error: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
source/c_pwm.c:396:43: error: ‘%s’ directive output may be truncated writing up to 199 bytes into a region of size 100 [-Werror=format-truncation=]
Debian 10 (Buster) has gcc 8.2 which warns about:

cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’

The solution is to cast to '(PyCFunction)(void *)'
@pdp7
Copy link
Collaborator Author

pdp7 commented Dec 17, 2019

@kattni @makermelissa @tannewt @westphahl I'd appreciate any advice. Travis is failing on Adafruit_BBIO.

https://github.com/adafruit/adafruit-beaglebone-io-python/pull/321/checks?check_run_id=344188905

From the log:

https://travis-ci.com/adafruit/adafruit-beaglebone-io-python/jobs/266112026

0.01s$ source ~/virtualenv/python3.6/bin/activate
$ python --version
Python 3.6.7
$ pip --version
pip 19.0.3 from /home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/pip (python 3.6)
install
1.55s$ pip install tox
6.19s$ tox
GLOB sdist-make: /home/travis/build/adafruit/adafruit-beaglebone-io-python/setup.py
py27 create: /home/travis/build/adafruit/adafruit-beaglebone-io-python/.tox/py27
py27 inst: /home/travis/build/adafruit/adafruit-beaglebone-io-python/.tox/.tmp/package/1/Adafruit_BBIO-1.1.1.zip
py27 installed: Adafruit-BBIO==1.1.1
py27 run-test-pre: PYTHONHASHSEED='2852702290'
py27 run-test: commands[0] | echo 'run pytest on beaglebone'
run pytest on beaglebone
py34 create: /home/travis/build/adafruit/adafruit-beaglebone-io-python/.tox/py34
ERROR: InterpreterNotFound: python3.4
___________________________________ summary ____________________________________
  py27: commands succeeded
ERROR:  py34: InterpreterNotFound: python3.4
The command "tox" exited with 1.

This is the travis config:
https://github.com/adafruit/adafruit-beaglebone-io-python/blob/issue308/.travis.yml

It seems like it is looking for Python 3.4 which no longer exists. Has this been an issue for any other repos that you know of?

Attempt to fix Travis error:
https://travis-ci.com/adafruit/adafruit-beaglebone-io-python/builds/140636005

```
1.74s$ git clone --depth=50 --branch=issue308 https://github.com/adafruit/adafruit-beaglebone-io-python.git adafruit/adafruit-beaglebone-io-python
0.01s0.01s$ source ~/virtualenv/python3.6/bin/activate
$ python --version
Python 3.6.7
$ pip --version
pip 19.0.3 from /home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/pip (python 3.6)
install
1.54s$ pip install tox
5.96s$ tox
GLOB sdist-make: /home/travis/build/adafruit/adafruit-beaglebone-io-python/setup.py
py27 create: /home/travis/build/adafruit/adafruit-beaglebone-io-python/.tox/py27
py27 inst: /home/travis/build/adafruit/adafruit-beaglebone-io-python/.tox/.tmp/package/1/Adafruit_BBIO-1.1.1.zip
py27 installed: Adafruit-BBIO==1.1.1
py27 run-test-pre: PYTHONHASHSEED='645938357'
py27 run-test: commands[0] | echo 'run pytest on beaglebone'
run pytest on beaglebone
py34 create: /home/travis/build/adafruit/adafruit-beaglebone-io-python/.tox/py34
ERROR: InterpreterNotFound: python3.4
___________________________________ summary ____________________________________
  py27: commands succeeded
ERROR:  py34: InterpreterNotFound: python3.4
The command "tox" exited with 1.
Done. Your build exited with 1.
```
Try to fix TravisCI error that Python 3.4 does not exist
@pdp7
Copy link
Collaborator Author

pdp7 commented Dec 17, 2019

UPDATE: changing tox.ini to py36 fixed it 59dcd95

@makermelissa
Copy link

Awesome. Glad to hear.

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.

2 participants