| Age | Commit message (Collapse) | Author |
|
Instead of failing in more cryptic ways later.
Also use 'orig_type' instead of 'type' for the UNKNOWN check. Oversight.
|
|
These are easiest to check after parsing, since a symbol/choice can be
defined in multiple locations:
- Warn if a symbol or choice defined without a type. Also warn for
choice value symbols defined without a type, even if they
automatically get their type from the choice. This feature isn't
well-known and probably not used deliberately.
- Warn if a choice is defined without a prompt
- Warn of a choice default symbol is not contained in the choice
Also move _name_and_loc_str() from the symbol class to the global scope
and generalize it to be able to handle choices.
|
|
Helpful
|
|
Might break U-Boot if they ever upgrade Kconfiglib, because they have a
'select y' in there (which the C tools don't flag since they only look
for quotes), but it's a one-line fix.
|
|
Implicit submenus are only ever created with a symbol as the base.
_has_auto_menu_dep() would indirectly reject anything that wasn't a
symbol anyway, but it led to redundant work.
Also get rid of _check_auto_menu() and inline it into _finalize_tree().
It's easier to read without the recursive call being hidden inside
_check_auto_menu().
Tweak the comments a bit too.
|
|
Extra unconsumed tokens at the end of lines were previously ignored.
Better to flag it.
Also inline _next_token() and _peek_token() into the syntax checking
variants of _next_token(). This code is pretty hot, and it saves a few %
of parsing time.
|
|
|
|
- _saved_line already handles EOF automagically, so no need to
special-case it at the end of help text parsing.
- Check for EOF earlier in _next_line(). Bit silly to do it after line
joining.
|
|
Now points out the error for stuff like 'config' with no symbol name
following it instead of randomly failing later.
1-2% parsing performance hit tops it seems.
|
|
No need to repeat what's already in the README. Just refer to the GitHub
page.
Include some other minor tweaks to the introductory sections.
|
|
No longer needed after 955ea4 ("Support <, > relational operators with
tristates").
|
|
It's also used for the warning added in 0087b40 ("Warn if a symbol with
unsatisfied deps is selected") now.
|
|
|
|
- Match the simpler strchr()y .config parsing done by the C
implementation
- Spell out \w as [a-zA-Z0-9_]. Easier to verify.
- Use ASCII mode for Python 3 to be consistent with Python 2,
where it's already the default. \s no longer matches obscure Unicode
stuff.
This also speeds up regex matching during parsing by about 15% on Python
3, increasing parsing performance by a few %. Looks like there's a tiny
improvement for Python 2 as well.
|
|
Mirrors 9059a3493ef ("kconfig: fix relational operators for bool and
tristate symbols") in the C implementation.
|
|
Use the "U" flag to open() rather than io.open() to avoid a ~14% parsing
performance hit. See comment.
|
|
Mirrors a warning in the C implementation. Make it a bit more
informative and simpler to decode for people who aren't super familiar
with Kconfig.
The warning is printed when/if the symbol is evaluated, e.g. when
writing a .config or C header or accessing Symbol.str/tri_value. It is
not printed if the symbol value has already been calculated and is
cached and up-to-date, which avoids warning spam.
Example:
config Y_SYMBOL_1
def_bool y
config Y_SYMBOL_2
def_bool y
config SELECTED
bool
depends on !Y_SYMBOL_1
config SELECTING_1
def_bool y
select SELECTED
# Skipped in warning, because n
config SELECTING_2
def_bool n
select SELECTED
config SELECTING_3
def_bool y
select SELECTED if Y_SYMBOL_1
depends on Y_SYMBOL_2
# Defined in multiple locations
config SELECTING_3
Generated warning:
warning: SELECTED (defined at Kconfig:7) has unsatisfied direct dependencies (!Y_SYMBOL_1), but is currently being selected by the following symbols:
SELECTING_3 (value: y, defined at Kconfig:20, Kconfig:26), with direct dependencies "y" (value: y) and select condition Y_SYMBOL_1 && Y_SYMBOL_2 (value: y)
SELECTING_1 (value: y, defined at Kconfig:11), with direct dependencies "y" (value: y)
Real-world example from test suite:
warning: NOT_COHERENT_CACHE (defined at arch/powerpc/platforms/Kconfig.cputype:381) has unsatisfied direct dependencies (4xx || PPC_8xx || E200 || PPC_MPC512x || GAMECUBE_COMMON), but is currently being selected by the following symbols:
AMIGAONE (value: y, defined at arch/powerpc/platforms/amigaone/Kconfig:2), with direct dependencies 6xx && BROKEN_ON_SMP (value: y) and select condition 6xx && BROKEN_ON_SMP (value: y)
|
|
Clarify how to fetch help texts and prompts, mention the no-prompt
warning.
|
|
The fancy regex isn't really justified. Much faster with replace() too,
though this is an unlikely hotspot.
Could have used a \g<0> backreference to refer to the entire match
instead of using a capturing group too. Hadn't discovered that.
Add some selftests for escape() and unescape() too.
|
|
Can be handy to check which symbols got set, like merge_config.py does.
|
|
Ended up with just user_value in the end before releasing Kconfiglib 2.
|
|
Same order as for .config files.
|
|
Can be handy to know that the order of the assignments matches the
Kconfig files.
|
|
Shaves a few % more from _parse_properties().
|
|
Speeds things up a bit further.
Rework the unget handling to save the ungotten line directly instead of
using a flag.
Add some help texts to tests/Klocation to make sure the line number is
updated properly for those.
|
|
Bit easier to read.
|
|
Factors out some code and makes the logic a bit more transparent. It's
only used for help text lines.
|
|
Bit clearer.
|
|
Old code. Can't remember why it kept lines shorter than the indent as-is
instead of clearing them, but it's pointless for help texts, which is
the only place where _deindent() is used. s[n:] is safe even if
n >= len(s).
Help text parsing is pretty hot code too, so every bit helps.
|
|
|
|
IOError() generates an OSError in Python 3.6. OSError does not have a
'message' attribute, which caused the following error when trying to add
the hint re. environment variables (the rest of the message was still
displayed):
AttributeError: 'OSError' object has no attribute 'message'
Use str(exception) instead, which seems to work for both Python 2 and
Python 3.
|
|
"Active user value" might have been a bit unclear. The symbol needs to
be visible.
|
|
Bit neater.
|
|
|
|
Easier to debug than a RecursionError.
Point out in the exception message that a common cause is environment
variables not being set correctly.
|
|
|
|
And rename it to _rec_invalidate_if_has_prompt(). Always used in this
way in practice.
|
|
Saves a tiny bit of bytecode too.
|
|
Implicit submenus are created after parsing, in _finalize_tree(), so the
parent can never be a symbol in _parse_block().
|
|
It's set to -1 in every return path, so we can just do it at the
beginning instead.
|
|
Choice symbols without prompts are pointless and probably nonexistent in
practice, so it's a bit silly to run the no-prompt optimization for
them.
Piggyback copyright year update.
|
|
Saves a tiny bit of bytecode too.
|
|
Already know the value.
|
|
|
|
Also switch to a faster local lookup for the second _T_HELP.
Micro-optimization -- shaves a % or two of the _tokenize() runtime. We
expect a token for valid Kconfig files, so the naming is still fine.
|
|
The Linux Kernel's merge_config.sh defaults to disabling warnings for
redundant assignments and has support for enabling them
specifically. This patch reproduces this behaviour in kconfiglib
except that we retaing kconfiglib's default behaviour of enabling the
warnings.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
|
|
Piggyback some cleanup and redundant comment removal.
|
|
Simpler.
I realized there's actually no need to follow the node pointers, since
menus and comments never generate output.
|
|
|
|
Oversight. SYMBOL_AUTO (env_var) being set indirectly clears
SYMBOL_WRITE (_write_to_conf) in sym_calc_value(). The .config case was
already fine due to an explicit env_var check.
Even non-visible env. symbols ended up in the header, due to
'option env' internally adding a default.
Disallow user values altogether on 'option env' symbols, even if
specified manually. This matches the C implementation. Add a warning
too.
|