clang -cc1 -cc1 -triple x86_64-redhat-linux-gnu -O3 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name wrap-util.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/__w/nvme-cli/nvme-cli/.build-ci -fcoverage-compilation-dir=/__w/nvme-cli/nvme-cli/.build-ci -resource-dir /usr/bin/../lib/clang/22 -include /__w/nvme-cli/nvme-cli/.build-ci/nvme-config.h -I shared/libshared.a.p -I shared -I ../shared -I ccan -I ../ccan -D _FILE_OFFSET_BITS=64 -D _GNU_SOURCE -U NDEBUG -internal-isystem /usr/bin/../lib/clang/22/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/16/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=gnu99 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -vectorize-loops -vectorize-slp -analyzer-opt-analyze-headers -analyzer-output=html -faddrsig -fdwarf2-cfi-asm -o /__w/nvme-cli/nvme-cli/.build-ci/scan-results/2026-08-08-045408-589-1 -x c ../shared/wrap-util.c
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | #include <stdbool.h> |
| 10 | #include <string.h> |
| 11 | |
| 12 | #include "wrap-util.h" |
| 13 | |
| 14 | void shr_print_word_wrapped(const char *s, int indent, int start, FILE *stream) |
| 15 | { |
| 16 | const int width = 76; |
| 17 | bool at_line_start = start <= indent; |
| 18 | int col = start; |
| 19 | |
| 20 | while (col < indent) { |
| 21 | putc(' ', stream); |
| 22 | col++; |
| 23 | } |
| 24 | |
| 25 | while (*s) { |
| 26 | if (*s == '\n') { |
| 27 | putc('\n', stream); |
| 28 | for (col = 0; col < indent; col++) |
| 29 | putc(' ', stream); |
| 30 | at_line_start = true; |
| 31 | s++; |
| 32 | continue; |
| 33 | } |
| 34 | |
| 35 | if (*s == ' ') { |
| 36 | if (!at_line_start) { |
| 37 | putc(' ', stream); |
| 38 | col++; |
| 39 | } |
| 40 | s++; |
| 41 | continue; |
| 42 | } |
| 43 | |
| 44 | size_t word_len = strcspn(s, " \n"); |
| 45 | |
| 46 | if (!at_line_start && col + (int)word_len > width) { |
| 47 | putc('\n', stream); |
| 48 | for (col = 0; col < indent; col++) |
| 49 | putc(' ', stream); |
| 50 | at_line_start = true; |
| Value stored to 'at_line_start' is never read |
| 51 | } |
| 52 | |
| 53 | fwrite(s, 1, word_len, stream); |
| 54 | col += (int)word_len; |
| 55 | at_line_start = false; |
| 56 | s += word_len; |
| 57 | } |
| 58 | } |