ulfalizer / Kconfiglib

A flexible Python 2/3 Kconfig implementation and library
ISC License
456 stars 161 forks source link

Trailing comments in fragments break kconfiglib #45

Closed SebastianBoe closed 6 years ago

SebastianBoe commented 6 years ago

Trailing comments in Kconfig fragments is legal (supported by conf), but breaks kconfiglib.

E.g.

CONFIG_FOO=3 # bla bla

ulfalizer commented 6 years ago

Hello,

How did you test it?

With FOO defined as an int symbol, I get this with the C tools:

.config:1:warning: symbol value '3 # bla bla' invalid for FOO

Kconfiglib gives this:

warning: the value '3 # bla bla' is invalid for FOO (defined at Kconfig:6), which has type int -- assignment ignored

The reason trailing comments aren't supported is that .config files use Makefile syntax (they can be included directly). You can get unexpected behavior there: https://stackoverflow.com/questions/9953825/trailing-comments-after-variable-assignment-subvert-comparison

SebastianBoe commented 6 years ago

My mistake.