Skip to content

Fix zero-length gnu_printf format string warning #508

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

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

saghul
Copy link
Contributor

@saghul saghul commented Sep 9, 2024

src/quickjs/quickjs.c: In function ‘JS_ReadString’:
src/quickjs/quickjs.c:34274:26: warning: zero-length gnu_printf format string [-Wformat-zero-length]
34274 |         bc_read_trace(s, "");  // hex dump and indentation
      |                          ^~
src/quickjs/quickjs.c: In function ‘JS_ReadFunctionBytecode’:
src/quickjs/quickjs.c:34334:30: warning: zero-length gnu_printf format string [-Wformat-zero-length]
34334 |             bc_read_trace(s, "");   // hex dump + indent

Ref: #502

```
src/quickjs/quickjs.c: In function ‘JS_ReadString’:
src/quickjs/quickjs.c:34274:26: warning: zero-length gnu_printf format string [-Wformat-zero-length]
34274 |         bc_read_trace(s, "");  // hex dump and indentation
      |                          ^~
src/quickjs/quickjs.c: In function ‘JS_ReadFunctionBytecode’:
src/quickjs/quickjs.c:34334:30: warning: zero-length gnu_printf format string [-Wformat-zero-length]
34334 |             bc_read_trace(s, "");   // hex dump + indent
```

Ref: #502
Copy link
Contributor

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That one has been annoying me for some days now :-)

@chqrlie
Copy link
Collaborator

chqrlie commented Sep 9, 2024

That one has been annoying me for some days now :-)

Agreed. How does this patch fix the problem?

@saghul
Copy link
Contributor Author

saghul commented Sep 9, 2024

That one has been annoying me for some days now :-)

Agreed. How does this patch fix the problem?

Rather than passing an empty string we pass NULL which is OK. When the filename is NULL we seemingly create an atom for the empty string. One could algue that is not right, but I worry of the breakage if we make that change.

@saghul saghul merged commit c740aa0 into master Sep 9, 2024
50 checks passed
@saghul saghul deleted the zero-length-printf branch September 9, 2024 09:18
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.

3 participants