Fix code generation for entries with min/max
ClosedPublic

Authored by hchain on Feb 19 2020, 11:30 AM.

Details

Summary
  • When GenerateProperties and Mutators are activated, the generated code did not handle min/max properly
  • In the case of a parameterized entry, generated code also did not handle min/max

BUG: 418146

Test Plan
  • auto tests included

Diff Detail

Repository
R237 KConfig
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
hchain created this revision.Feb 19 2020, 11:30 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 19 2020, 11:30 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
hchain requested review of this revision.Feb 19 2020, 11:30 AM
bport added inline comments.Feb 19 2020, 12:04 PM
autotests/kconfig_compiler/test_param_minmax.kcfg
18

Add a new line

autotests/kconfig_compiler/test_param_minmax.kcfgc
5

add a new line

autotests/kconfig_compiler/test_param_minmax_main.cpp
29

Missing new line at end of this file

src/kconfig_compiler/KConfigCommonStructs.h
192

Space before * not after

src/kconfig_compiler/kconfig_compiler.cpp
484

Space before * not after

hchain updated this revision to Diff 75982.Feb 19 2020, 12:16 PM

Fix Style/whitespace

hchain updated this revision to Diff 75983.Feb 19 2020, 12:20 PM

Yet more style fixes

hchain updated this revision to Diff 75985.Feb 19 2020, 12:29 PM

Reduce number of lines in generated test code

hchain updated this revision to Diff 75987.Feb 19 2020, 12:36 PM

Add reference files for other tests that were impacted

meven accepted this revision.Feb 20 2020, 10:10 AM

Seems good to me

autotests/kconfig_compiler/test_param_minmax.h.ref
26

We probably should not output anything or at least let the user give logging context to the debug output.
This is not about this review though.

This revision is now accepted and ready to land.Feb 20 2020, 10:10 AM
ervin added a comment.Feb 24 2020, 4:04 PM

A few smallish issues only, otherwise LGTM.

src/kconfig_compiler/KConfigSourceGenerator.cpp
316–322

I'd const it and also use the = style of initialization which I find more readable.

354

const those please

372

ditto

src/kconfig_compiler/kconfig_compiler.cpp
397–406

const

401

const

462

Should be named newInnerItem

ervin requested changes to this revision.Feb 24 2020, 4:04 PM
This revision now requires changes to proceed.Feb 24 2020, 4:04 PM
hchain updated this revision to Diff 76317.Feb 24 2020, 5:23 PM

const, change method name, reformat code

ervin accepted this revision.Feb 25 2020, 2:39 PM
ervin edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Feb 25 2020, 2:40 PM
hchain updated this revision to Diff 76368.Feb 25 2020, 2:46 PM

add bugzilla

This revision was automatically updated to reflect the committed changes.
meven added inline comments.Feb 26 2020, 9:39 AM
autotests/kconfig_compiler/test_properties_minmax.h.ref
43

This is incorrrect since D27496, too bad this was not rebased and tested before before landing
It causes test failures :

WARNING: KConfigCompiler_Test::testRunning(test_properties_minmax) testdata test_properties_minmax could not be located!
   Loc: [/repositories/src/kconfig/autotests/kconfig_compiler/kconfigcompiler_test.cpp(155)]
FAIL!  : KConfigCompiler_Test::testRunning(test_properties_minmax) '!program.isEmpty()' returned FALSE. (test_properties_minmax must exist!)
   Loc: [/repositories/src/kconfig/autotests/kconfig_compiler/kconfigcompiler_test.cpp(156)]
WARNING: KConfigCompiler_Test::testRunning(test_param_minmax) testdata test_param_minmax could not be located!
   Loc: [/repositories/src/kconfig/autotests/kconfig_compiler/kconfigcompiler_test.cpp(155)]
FAIL!  : KConfigCompiler_Test::testRunning(test_param_minmax) '!program.isEmpty()' returned FALSE. (test_param_minmax must exist!)
   Loc: [/repositories/src/kconfig/autotests/kconfig_compiler/kconfigcompiler_test.cpp(156)]
FAIL!  : KConfigCompiler_Test::testBaselineComparison(test_properties_minmax.h) 'false' returned FALSE. (This test failed, look at the following file for details: /repositories/src/kconfig/autotests/kconfig_compiler/test_properties_minmax.h.ref.diff)
   Loc: [/repositories/src/kconfig/autotests/kconfig_compiler/kconfigcompiler_test.cpp(190)]
FAIL!  : KConfigCompiler_Test::testBaselineComparison(test_properties_minmax.h) 'content == contentRef' returned FALSE. ()
   Loc: [/repositories/src/kconfig/autotests/kconfig_compiler/kconfigcompiler_test.cpp(135)]