jperkin / node-rpio

Raspberry Pi GPIO library for node.js
859 stars 124 forks source link

Compilation Warnings #162

Closed alba-ado closed 2 years ago

alba-ado commented 2 years ago

The npm gives the following warnings while compiling for x64 Linux (Ubuntu 20.04):

Some of these seem trivial (like the indentation of the if statement). I posted this just to notify you and maybe you can solve it and republish it in the npm.

CXX(target) Release/obj.target/rpio/src/rpio.o In file included from ../../nan/nan.h:56, from ../src/rpio.cc:17: /home/ado/.cache/node-gyp/14.19.0/include/node/node.h:793:43: warning: cast between incompatible function types from ‘void ()(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void ()(v8::Local)’} to ‘node::addon_register_func’ {aka ‘void ()(v8::Local, v8::Local, void)’} [-Wcast-function-type] 793 | (node::addon_register_func) (regfunc), \ | ^ /home/ado/.cache/node-gyp/14.19.0/include/node/node.h:827:3: note: in expansion of macro ‘NODE_MODULE_X’ 827 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage) | ^~~~~ ../src/rpio.cc:499:1: note: in expansion of macro ‘NODE_MODULE’ 499 | NODE_MODULE(rpio, setup) | ^~~ CC(target) Release/obj.target/rpio/src/bcm2835.o ../src/bcm2835.c: In function ‘bcm2835_gpio_pad’: ../src/bcm2835.c:487:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 487 | if (bcm2835_pads == MAP_FAILED) | ^~ ../src/bcm2835.c:490:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 490 | volatile uint32_t paddr = bcm2835_pads + BCM2835_PADS_GPIO_0_27/4 + group; | ^~~~ ../src/bcm2835.c: In function ‘bcm2835_gpio_set_pad’: ../src/bcm2835.c:500:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 500 | if (bcm2835_pads == MAP_FAILED) | ^~ ../src/bcm2835.c:503:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 503 | volatile uint32_t paddr = bcm2835_pads + BCM2835_PADS_GPIO_0_27/4 + group; | ^~~~ SOLINK_MODULE(target) Release/obj.target/rpio.node COPY Release/rpio.node

jperkin commented 2 years ago

Hi! Thanks for the pull request. Could I ask that you send this upstream? I'm trying to keep diffs to the bcm2835 code to a minimum, otherwise it makes merging future releases a lot harder.

The main page is at http://www.airspayce.com/mikem/bcm2835/ and you can report issues via the Google Group at https://groups.google.com/g/bcm2835, I've sent stuff there before and Mike (the maintainer) is responsive and helpful.

Many thanks!