Skip to content

CMakeLists.txt: remove -Werror=format-nonliteral#381

Open
hauke wants to merge 1 commit intojow-:masterfrom
hauke:format-nonliteral
Open

CMakeLists.txt: remove -Werror=format-nonliteral#381
hauke wants to merge 1 commit intojow-:masterfrom
hauke:format-nonliteral

Conversation

@hauke
Copy link
Copy Markdown

@hauke hauke commented Mar 12, 2026

The musl libc fortify source headers are using a nonliteral format string in the sprintf() and snprintf() function. Do not fail in ucode

Not everyone is using the workaround in fortify source headers.

The musl libc fortify source headers are using a nonliteral format
string in the sprintf() and snprintf() function. Do not fail in ucode

Not everyone is using the workaround in fortify source headers.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
@jow-
Copy link
Copy Markdown
Owner

jow- commented Mar 15, 2026

FIrst I would like to better understand the actual error this is fixing

@hauke
Copy link
Copy Markdown
Author

hauke commented Mar 15, 2026

We are seeing such errors when activatig fortify sources for cmake applications:

/include/fortify/stdio.h: In function 'snprintf':
/include/fortify/stdio.h:101:9: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
  101 |         return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
      |         ^~~~~~
/include/fortify/stdio.h: In function 'sprintf':
/include/fortify/stdio.h:110:17: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
  110 |                 __r = __orig_snprintf(__s, __b, __f, __builtin_va_arg_pack());
      |                 ^~~
/include/fortify/stdio.h:114:17: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
  114 |                 __r = __orig_sprintf(__s, __f, __builtin_va_arg_pack());
      |                 ^~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.

I would like to move away from the workaround in OpenWrt: openwrt/openwrt@b237266

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