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

Ignore maybe-uninitialised on MacOS with GCC >= 11 #454

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

andrjohns
Copy link
Contributor

Closes #453

@saghul
Copy link
Contributor

saghul commented Jul 1, 2024

Does this silence the warning?

diff --git a/cutils.h b/cutils.h
index 26436d4..6d0c994 100644
--- a/cutils.h
+++ b/cutils.h
@@ -484,6 +484,8 @@ uint64_t js__hrtime_ns(void);
 
 static inline size_t js__malloc_usable_size(const void *ptr)
 {
+    if (!ptr)
+        return 0;
 #if defined(__APPLE__)
     return malloc_size(ptr);
 #elif defined(_WIN32)

@andrjohns
Copy link
Contributor Author

Unfortunately not. If you want to experiment with other approaches you can also see the warning in action here: https://godbolt.org/z/jq15nWz5d

@saghul saghul merged commit b9de2b0 into quickjs-ng:master Jul 1, 2024
50 checks passed
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.

MacOS-specific -Werror=maybe-unitialised due to malloc_size signature
2 participants