-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fixed null ptr errors in print statements #635
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Jay Jay Billings <[email protected]>
Signed-off-by: Jay Jay Billings <[email protected]>
Thanks for the patch Personally I hate I'm also not quite clear what the logic is with the gcc change.
which is less readable, and you'll end up with loads of copies of a string "(null)" kicking around. I wonder what others think. |
I agree printing "(null)" is more useful for debugging that printing nothing so there is some cost to fixing the issues. Do you have some examples of gcc error messages? I wonder if it's better (and possible) to handle them from caller code - I suspect if we have got to a point where we have a null pointer and are printing it out we may be potentially dereferencing it through means other than printf. |
Surely you should either make Note that |
I'm expecting this should fix #631 which lists the error messages. AFAIK vcos_vlog_default_impl will never be called with cat = NULL, but you can't tell the compiler that, and it complains. You could assert, but that only does anything on debug builds.
Line 301 is under a |
Right, so I don't think this patch actually helps the printf problem. It looks to me as though the proper check would be
I saw that, but thought that since the code remains in the function, it should be kept up to date with its surroundings. Just curious, but is there any reason these parts of the code are kept in the repository if they are for sure never compiled? |
Signed-off-by: Jay Jay Billings <[email protected]>
I just pushed changes to fix the if statements. Now they check path and cat->name directly. |
@tombsar I was just reading your comment more closely. FWIW I agree. I don't thinks this fixes the broader set of printf problems for GCC 10, but it at least gets it compiling on Fedora 32. |
I was compiling from source on Fedora 32 using GCC 10.1.1-1 and encountered numerous compilation errors. GCC 9 and 10 are rather picky about calling printf with arguments that can have NULL values.
To fix these errors I adjusted the vcos_logging header file and fixed two separate places in the file system and threading utilities.
Please let me know if I need to adjust anything. Happy to help get this in shape to push to master.