-
Notifications
You must be signed in to change notification settings - Fork 37
clang20 cleanups #1035
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
clang20 cleanups #1035
Conversation
|
I had a quick look at line 231 of file My reading to it is if |
|
ok so we need to take a look at
in the 2nd and 3rd cases the routine also takes out extra '/' and '/./` in the string
so we are dealing with cases where Clang is fine with most of this except when the path in question is a string literal: so... We can't leave newpath null: e.g. stdio_track_new_file_record won't know that NULL means '' We could forbid passing string literals to RECORD_OPEN.... makes for more work for the callers but string literals are only passed in during initalize We could
|
9d0fda1 to
3e740a5
Compare
|
ok well new approach: just keep doing what we are doing but I just pushed a new version that puts a big comment explaining away the warning |
|
I took a look at subroutine Maybe try the following to see if Clang still complains. |
|
Yeah I like the idea of big comment (what you have now is great) + type cast to convince clang that we know what we are up to here :) |
|
casting to void didn't fool clang. some rando on reddit suggests "try to write to the string and catch the segv" -- uh no thank you i'll keep the warning! |
3e740a5 to
94f192a
Compare
|
I don't know if this solution is better than the problem... just don't pass string literals to that macro... |
|
That's not so bad. @wkliao what do you think? |
|
How about using |
94f192a to
886ea28
Compare
There are places where we were trying to compare pointers vs literals like "<STDIN>". that is undefined behavior since the compiler could well put string literals in special regions of memory, so we'll make a copy of the path if it is one of these special cases, simplifying cleanup (always deallocate __newpath)
886ea28 to
9beb100
Compare
|
Thanks wei-keng I like that approach a lot. Pushed a new revision that does just that. no compiler warnings and cleaner code. win win. |
|
One of github action jobs failed with an error related to the installation of h5py-3.14.0. |
|
Yeah, the h5py problem is unrelated to this PR, I'll open up a separate issue about that. |
When I build with clang-20 I get a few warnings. The "uninitialized variable" and 'don't use K&R syntax' changes are straightforward enough.
I'm really puzzled by the
newpath != pathpart -- that's one of those "how did it ever work in the first place?" things, I'd like a second set of eyes because there's got to be a reason we were doing it that way since January 2019 (db25337)