Skip to content

tools: kconfig2html: Handle blank input lines#19322

Open
Old-Ding wants to merge 2 commits into
apache:masterfrom
Old-Ding:codex/kconfig2html-blank-line
Open

tools: kconfig2html: Handle blank input lines#19322
Old-Ding wants to merge 2 commits into
apache:masterfrom
Old-Ding:codex/kconfig2html-blank-line

Conversation

@Old-Ding

@Old-Ding Old-Ding commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Note: Please adhere to Contributing Guidelines.

Summary

read_line() removes a trailing newline and then checks g_line[len - 1] for a line-continuation backslash. A blank input line leaves len at zero, so the continuation check would read before g_line.

Return the empty line to the caller before checking for a continuation. kconfig_line() already skips empty lines, so parser behavior for non-empty Kconfig entries stays unchanged.

Impact

No configuration syntax, generated output, or hardware behavior changes. Blank Kconfig lines are now handled safely instead of reaching the continuation-marker access with an empty buffer.

Testing

  • Host: Windows 11; compiled tools/kconfig2html.c with GCC 16.1.0 (winlibs).
  • Created a minimal Kconfig fixture containing blank lines, then ran the compiled kconfig2html; it exited successfully and generated a 4,177-byte HTML file.
  • git diff --check passed.
  • A full-tree run was also attempted. It stops at the existing Unrecognized garbage after default value parser limitation, outside the changed read_line() blank-line path; no hardware testing applies to this host tool change.

@github-actions github-actions Bot added Area: Tooling Size: XS The size of the change in this PR is very small labels Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

arduino-mega2560

  • flash: .text +48 B (+0.1%, 67,248 B / 262,144 B, total: 26% used)

esp32-devkitc

  • ROM: .flash.text +56 B (+0.0%, 122,708 B / 4,194,272 B, total: 3% used)
  • irom0_0_seg: .flash.text +56 B (+0.1%, 87,076 B / 3,342,304 B, total: 3% used)

hifive1-revb

  • flash: .text -8 B (-0.0%, 83,244 B / 4,194,304 B, total: 2% used)

mirtoo

  • kseg0_progmem: .text +64 B (+0.1%, 67,152 B / 131,072 B, total: 51% used)

qemu-armv8a

  • Code: .text.arm64_fpu_procfs_stat -4 B, .text.file_vioctl -4 B, .text.host_open -4 B, .text.inode_stat -4 B, .text.posix_spawnattr_init -16 B, .text.task_spawn +36 B, .text.uart_readv +48 B (+0.0%, 315,362 B)

qemu-intel64

  • Code: .text +85 B (+0.0%, 8,655,434 B)

rx65n-rsk2mb

  • ROM: .text +48 B (+0.1%, 85,656 B / 2,097,152 B, total: 4% used)

s698pm-dkit

  • Code: .text +816 B (+0.2%, 358,096 B)

stm32-nucleo-f103rb

  • flash: .text +52 B (+0.2%, 33,788 B / 131,072 B, total: 26% used)

@linguini1

Copy link
Copy Markdown
Contributor

I think you should try running the tool to make sure that your change does what you want

@Old-Ding
Old-Ding force-pushed the codex/kconfig2html-blank-line branch from bdb2d9d to 68a72dc Compare July 8, 2026 03:38
read_line() removes a trailing newline and then checks g_line[len - 1]
for a line-continuation backslash. A blank line leaves len at zero, so
the continuation check reads before g_line.

Return the empty line to the caller before checking for a continuation.
kconfig_line() already skips empty lines, so parser behavior is
unchanged.

Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
@Old-Ding
Old-Ding force-pushed the codex/kconfig2html-blank-line branch from 68a72dc to c4d0fb4 Compare July 8, 2026 13:57
xiaoxiang781216
xiaoxiang781216 previously approved these changes Jul 9, 2026
Comment thread tools/kconfig2html.c
@linguini1

Copy link
Copy Markdown
Contributor

Can you also edit the description to follow the PR template?

Explain why the guard runs before checking for a continuation marker.

Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Tooling Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants