Skip to content

Conversation

saghul
Copy link
Contributor

@saghul saghul commented May 1, 2025

quickjs.c:11727:32: error: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (37 chars into 36 available) [-Werror=unterminated-string-initialization]
11727 | static char const digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz";
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@saghul saghul force-pushed the fix-gcc15-error branch from cd254eb to 629e39d Compare May 1, 2025 22:36
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.

LGTM although I have a mild preference for writing it out as a char array so no compiler-specific annotations are necessary.

(It's what I did in 6e43400 but apparently I overlooked this one.)

cutils.c Outdated

/* 2 <= base <= 36 */
char const digits36[36] = {
char const digits36[36] JS_NONSTRING_ATTR = {
Copy link
Contributor

Choose a reason for hiding this comment

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

The attribute isn't necessary here, right?

@saghul
Copy link
Contributor Author

saghul commented May 2, 2025

Oh I see. That does look better. I'll align it to match your change.

```
quickjs.c:11727:32: error: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (37 chars into 36 available) [-Werror=unterminated-string-initialization]
11727 | static char const digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz";
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
@saghul saghul force-pushed the fix-gcc15-error branch from 629e39d to 296e245 Compare May 2, 2025 10:53
@saghul saghul merged commit b1500a2 into master May 2, 2025
127 checks passed
@saghul saghul deleted the fix-gcc15-error branch May 2, 2025 11:52
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.

2 participants