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

Any suggestions for how to solve compiler warnings in uLisp 4.4? #63

Open
technoblogy opened this issue Mar 31, 2023 · 5 comments
Open

Comments

@technoblogy
Copy link
Owner

The new error-handling functions in uLisp 4.4, unwind-protect, ignore-errors, and error work correctly, but cause compiler warnings on all platforms:

/Users/david/Documents/Arduino/LispESP198/LispESP198.ino: In function 'object* sp_unwindprotect(object*, object*)':
/Users/david/Documents/Arduino/LispESP198/LispESP198.ino:4031:11: warning: variable 'result' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered]
   object *result;
           ^~~~~~
/Users/david/Documents/Arduino/LispESP198/LispESP198.ino: In function 'object* sp_ignoreerrors(object*, object*)':
/Users/david/Documents/Arduino/LispESP198/LispESP198.ino:4063:8: warning: variable 'signaled' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered]
   bool signaled = false;
        ^~~~~~~~
/Users/david/Documents/Arduino/LispESP198/LispESP198.ino:4054:34: warning: argument 'args' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered]
 object *sp_ignoreerrors (object *args, object *env) {
                          ~~~~~~~~^~~~

Can anyone explain what is causing these, and suggest how to eliminate them?

@dragoncoder047
Copy link

I think https://stackoverflow.com/a/25327028 provides a pretty good answer for this. It uses vfork() but they both do the same sort of thing. Also keep in mind it says might be clobbered, not will be clobbered, so if you code it right you won't have to worry about it.

@technoblogy
Copy link
Owner Author

Thanks for the help. That agrees with some advice I found previously:

using volatile is a simple solution, too.

However, I've tried defining the variables involved as volatile, and it didn't get rid of the warnings.

@dragoncoder047
Copy link

I compiled uLisp again today on a fresh install of arduino & esp core and also got this warning as well as the longjmp warnings:

/home/dc047/Desktop/arduino stuff/ulisp-esp32/ulisp.hpp: In function 'char fromradix40(char)':
/home/dc047/Desktop/arduino stuff/ulisp-esp32/ulisp.hpp:774:11: warning: comparison is always false due to limited range of data type [-Wtype-limits]
     if (n < 0 || n >= 40) return 0;
         ~~^~~

Weird... n is a char, which is signed AFAIK...

@technoblogy
Copy link
Owner Author

Actually char can be signed or unsigned:

https://stackoverflow.com/questions/2054939/is-char-signed-or-unsigned-by-default

I should probably fix that so the warning cannot appear whatever the definition of char - thanks!

@dragoncoder047
Copy link

Actually char can be signed or unsigned.

OK, good to know that char $\equiv$ byte on ESP32 at least.

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

No branches or pull requests

2 participants