-
Notifications
You must be signed in to change notification settings - Fork 137
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
Add -Wformat=2 compiler flag #860
Conversation
Let's watch it burn :-) |
Maybe it is time to reconsider using my |
IMHO that sounds overkill, just to tame the compiler. We could silence it with a pragma... |
@@ -190,6 +190,8 @@ static void js_set_thread_state(JSRuntime *rt, JSThreadState *ts) | |||
js_std_cmd(/*SetOpaque*/1, rt, ts); | |||
} | |||
|
|||
#pragma GCC diagnostic push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are going to work around the compiler, might as well be straight about it.
} | ||
|
||
/* %s is replaced by 'atom'. The macro is used so that gcc can check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually didn't work, it errors in bellart/quickjs if you enable -Wformat=2
@@ -3197,7 +3197,6 @@ JSValue JS_NewSymbol(JSContext *ctx, const char *description, bool is_global) | |||
|
|||
#define ATOM_GET_STR_BUF_SIZE 64 | |||
|
|||
/* Should only be used for debug. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also used to print exception messages.
c |= str->u.str8[i]; | ||
} | ||
if (c < 0x80) | ||
return (const char *)str->u.str8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This return broke the "contract" that the function filled the buffer in. Since this is hardly a hot path, let's be consistent and copy the content to the provided buffer.
@bnoordhuis PTAL! You can see the thought process in the shitty conning log. Worry not I'll squash :-) |
No description provided.