D27497: Fix code generation for entries with min/max

2020-02-26 Thread Méven Car
meven added inline comments.

INLINE COMMENTS

> test_properties_minmax.h.ref:43
> +Q_PROPERTY(int bar READ bar WRITE setBar NOTIFY barChanged)
> +Q_PROPERTY(bool isBarImmutable CONSTANT)
> +/**

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)]

REPOSITORY
  R237 KConfig

REVISION DETAIL
  https://phabricator.kde.org/D27497

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-25 Thread Henri Chain
This revision was automatically updated to reflect the committed changes.
Closed by commit R237:d218b93a5350: Fix code generation for entries with 
min/max (authored by hchain).

REPOSITORY
  R237 KConfig

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D27497?vs=76368&id=76371

REVISION DETAIL
  https://phabricator.kde.org/D27497

AFFECTED FILES
  autotests/kconfig_compiler/CMakeLists.txt
  autotests/kconfig_compiler/kconfigcompiler_test.cpp
  autotests/kconfig_compiler/test13.cpp.ref
  autotests/kconfig_compiler/test_param_minmax.cpp.ref
  autotests/kconfig_compiler/test_param_minmax.h.ref
  autotests/kconfig_compiler/test_param_minmax.kcfg
  autotests/kconfig_compiler/test_param_minmax.kcfgc
  autotests/kconfig_compiler/test_param_minmax_main.cpp
  autotests/kconfig_compiler/test_properties_minmax.cpp.ref
  autotests/kconfig_compiler/test_properties_minmax.h.ref
  autotests/kconfig_compiler/test_properties_minmax.kcfg
  autotests/kconfig_compiler/test_properties_minmax.kcfgc
  autotests/kconfig_compiler/test_properties_minmax_main.cpp
  autotests/kconfig_compiler/test_signal.cpp.ref
  src/kconfig_compiler/KConfigCommonStructs.h
  src/kconfig_compiler/KConfigSourceGenerator.cpp
  src/kconfig_compiler/KConfigXmlParser.cpp
  src/kconfig_compiler/kconfig_compiler.cpp

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-25 Thread Henri Chain
hchain updated this revision to Diff 76368.
hchain added a comment.


  add bugzilla

REPOSITORY
  R237 KConfig

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D27497?vs=76317&id=76368

REVISION DETAIL
  https://phabricator.kde.org/D27497

AFFECTED FILES
  autotests/kconfig_compiler/CMakeLists.txt
  autotests/kconfig_compiler/kconfigcompiler_test.cpp
  autotests/kconfig_compiler/test13.cpp.ref
  autotests/kconfig_compiler/test_param_minmax.cpp.ref
  autotests/kconfig_compiler/test_param_minmax.h.ref
  autotests/kconfig_compiler/test_param_minmax.kcfg
  autotests/kconfig_compiler/test_param_minmax.kcfgc
  autotests/kconfig_compiler/test_param_minmax_main.cpp
  autotests/kconfig_compiler/test_properties_minmax.cpp.ref
  autotests/kconfig_compiler/test_properties_minmax.h.ref
  autotests/kconfig_compiler/test_properties_minmax.kcfg
  autotests/kconfig_compiler/test_properties_minmax.kcfgc
  autotests/kconfig_compiler/test_properties_minmax_main.cpp
  autotests/kconfig_compiler/test_signal.cpp.ref
  src/kconfig_compiler/KConfigCommonStructs.h
  src/kconfig_compiler/KConfigSourceGenerator.cpp
  src/kconfig_compiler/KConfigXmlParser.cpp
  src/kconfig_compiler/kconfig_compiler.cpp

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-25 Thread Kevin Ottens
ervin accepted this revision.
This revision is now accepted and ready to land.

REPOSITORY
  R237 KConfig

REVISION DETAIL
  https://phabricator.kde.org/D27497

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-25 Thread Kevin Ottens
ervin edited the summary of this revision.

REPOSITORY
  R237 KConfig

REVISION DETAIL
  https://phabricator.kde.org/D27497

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-24 Thread Henri Chain
hchain updated this revision to Diff 76317.
hchain added a comment.


  const, change method name, reformat code

REPOSITORY
  R237 KConfig

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D27497?vs=75987&id=76317

REVISION DETAIL
  https://phabricator.kde.org/D27497

AFFECTED FILES
  autotests/kconfig_compiler/CMakeLists.txt
  autotests/kconfig_compiler/kconfigcompiler_test.cpp
  autotests/kconfig_compiler/test13.cpp.ref
  autotests/kconfig_compiler/test_param_minmax.cpp.ref
  autotests/kconfig_compiler/test_param_minmax.h.ref
  autotests/kconfig_compiler/test_param_minmax.kcfg
  autotests/kconfig_compiler/test_param_minmax.kcfgc
  autotests/kconfig_compiler/test_param_minmax_main.cpp
  autotests/kconfig_compiler/test_properties_minmax.cpp.ref
  autotests/kconfig_compiler/test_properties_minmax.h.ref
  autotests/kconfig_compiler/test_properties_minmax.kcfg
  autotests/kconfig_compiler/test_properties_minmax.kcfgc
  autotests/kconfig_compiler/test_properties_minmax_main.cpp
  autotests/kconfig_compiler/test_signal.cpp.ref
  src/kconfig_compiler/KConfigCommonStructs.h
  src/kconfig_compiler/KConfigSourceGenerator.cpp
  src/kconfig_compiler/KConfigXmlParser.cpp
  src/kconfig_compiler/kconfig_compiler.cpp

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-24 Thread Kevin Ottens
ervin added a comment.


  A few smallish issues only, otherwise LGTM.

INLINE COMMENTS

> KConfigSourceGenerator.cpp:316
>  {
> -   stream() << "  " << itemPath(entry, cfg()) << " = "
> +QString innerItemVarStr(innerItemVar(entry, cfg()));
> +if (!entry->signalList.isEmpty()) {

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

> KConfigSourceGenerator.cpp:354
> +QString argBracket = QStringLiteral("[%1]").arg(i);
> +QString innerItemVarStr = innerItemVar(entry, cfg()) + argBracket;
>  

const those please

> KConfigSourceGenerator.cpp:365
> +
> +QString itemVarStr(itemPath(entry, cfg()) + argBracket);
> +

ditto

> kconfig_compiler.cpp:397
>  {
> -if (cfg.itemAccessors) {
> -return QString();
> +QString type = cfg.inherits + "::Item" + itemType(e->type);
> +

const

> kconfig_compiler.cpp:401
> +fCap[0] = fCap[0].toUpper();
> +QString argSuffix = (!e->param.isEmpty()) ? 
> (QStringLiteral("[%1]").arg(e->paramMax + 1)) : QString();
> +QString result;

const

> kconfig_compiler.cpp:462
>  
> -QString newItem(const CfgEntry* entry, const QString &key, const QString& 
> defaultValue,
> +QString newItemInner(const CfgEntry *entry, const QString &key, const 
> QString &defaultValue,
>  const KConfigParameters &cfg, const QString ¶m) {

Should be named newInnerItem

REPOSITORY
  R237 KConfig

REVISION DETAIL
  https://phabricator.kde.org/D27497

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-24 Thread Kevin Ottens
ervin requested changes to this revision.
This revision now requires changes to proceed.

REPOSITORY
  R237 KConfig

REVISION DETAIL
  https://phabricator.kde.org/D27497

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-20 Thread Méven Car
meven accepted this revision.
meven added a comment.
This revision is now accepted and ready to land.


  Seems good to me

INLINE COMMENTS

> test_param_minmax.h.ref:25
> +  {
> +qDebug() << "setFoo: value " << v << " is less than the minimum 
> value of 0.01";
> +v = 0.01;

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.

REPOSITORY
  R237 KConfig

REVISION DETAIL
  https://phabricator.kde.org/D27497

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-19 Thread Henri Chain
hchain updated this revision to Diff 75987.
hchain added a comment.


  Add reference files for other tests that were impacted

REPOSITORY
  R237 KConfig

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D27497?vs=75985&id=75987

REVISION DETAIL
  https://phabricator.kde.org/D27497

AFFECTED FILES
  autotests/kconfig_compiler/CMakeLists.txt
  autotests/kconfig_compiler/kconfigcompiler_test.cpp
  autotests/kconfig_compiler/test13.cpp.ref
  autotests/kconfig_compiler/test_param_minmax.cpp.ref
  autotests/kconfig_compiler/test_param_minmax.h.ref
  autotests/kconfig_compiler/test_param_minmax.kcfg
  autotests/kconfig_compiler/test_param_minmax.kcfgc
  autotests/kconfig_compiler/test_param_minmax_main.cpp
  autotests/kconfig_compiler/test_properties_minmax.cpp.ref
  autotests/kconfig_compiler/test_properties_minmax.h.ref
  autotests/kconfig_compiler/test_properties_minmax.kcfg
  autotests/kconfig_compiler/test_properties_minmax.kcfgc
  autotests/kconfig_compiler/test_properties_minmax_main.cpp
  autotests/kconfig_compiler/test_signal.cpp.ref
  src/kconfig_compiler/KConfigCommonStructs.h
  src/kconfig_compiler/KConfigSourceGenerator.cpp
  src/kconfig_compiler/KConfigXmlParser.cpp
  src/kconfig_compiler/kconfig_compiler.cpp

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-19 Thread Henri Chain
hchain updated this revision to Diff 75985.
hchain added a comment.


  Reduce number of lines in generated test code

REPOSITORY
  R237 KConfig

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D27497?vs=75983&id=75985

REVISION DETAIL
  https://phabricator.kde.org/D27497

AFFECTED FILES
  autotests/kconfig_compiler/CMakeLists.txt
  autotests/kconfig_compiler/kconfigcompiler_test.cpp
  autotests/kconfig_compiler/test_param_minmax.cpp.ref
  autotests/kconfig_compiler/test_param_minmax.h.ref
  autotests/kconfig_compiler/test_param_minmax.kcfg
  autotests/kconfig_compiler/test_param_minmax.kcfgc
  autotests/kconfig_compiler/test_param_minmax_main.cpp
  autotests/kconfig_compiler/test_properties_minmax.cpp.ref
  autotests/kconfig_compiler/test_properties_minmax.h.ref
  autotests/kconfig_compiler/test_properties_minmax.kcfg
  autotests/kconfig_compiler/test_properties_minmax.kcfgc
  autotests/kconfig_compiler/test_properties_minmax_main.cpp
  src/kconfig_compiler/KConfigCommonStructs.h
  src/kconfig_compiler/KConfigSourceGenerator.cpp
  src/kconfig_compiler/KConfigXmlParser.cpp
  src/kconfig_compiler/kconfig_compiler.cpp

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-19 Thread Henri Chain
hchain updated this revision to Diff 75983.
hchain added a comment.


  Yet more style fixes

REPOSITORY
  R237 KConfig

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D27497?vs=75982&id=75983

REVISION DETAIL
  https://phabricator.kde.org/D27497

AFFECTED FILES
  autotests/kconfig_compiler/CMakeLists.txt
  autotests/kconfig_compiler/kconfigcompiler_test.cpp
  autotests/kconfig_compiler/test_param_minmax.cpp.ref
  autotests/kconfig_compiler/test_param_minmax.h.ref
  autotests/kconfig_compiler/test_param_minmax.kcfg
  autotests/kconfig_compiler/test_param_minmax.kcfgc
  autotests/kconfig_compiler/test_param_minmax_main.cpp
  autotests/kconfig_compiler/test_properties_minmax.cpp.ref
  autotests/kconfig_compiler/test_properties_minmax.h.ref
  autotests/kconfig_compiler/test_properties_minmax.kcfg
  autotests/kconfig_compiler/test_properties_minmax.kcfgc
  autotests/kconfig_compiler/test_properties_minmax_main.cpp
  src/kconfig_compiler/KConfigCommonStructs.h
  src/kconfig_compiler/KConfigSourceGenerator.cpp
  src/kconfig_compiler/KConfigXmlParser.cpp
  src/kconfig_compiler/kconfig_compiler.cpp

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-19 Thread Henri Chain
hchain updated this revision to Diff 75982.
hchain added a comment.


  Fix Style/whitespace

REPOSITORY
  R237 KConfig

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D27497?vs=75978&id=75982

REVISION DETAIL
  https://phabricator.kde.org/D27497

AFFECTED FILES
  autotests/kconfig_compiler/CMakeLists.txt
  autotests/kconfig_compiler/kconfigcompiler_test.cpp
  autotests/kconfig_compiler/test_param_minmax.cpp.ref
  autotests/kconfig_compiler/test_param_minmax.h.ref
  autotests/kconfig_compiler/test_param_minmax.kcfg
  autotests/kconfig_compiler/test_param_minmax.kcfgc
  autotests/kconfig_compiler/test_param_minmax_main.cpp
  autotests/kconfig_compiler/test_properties_minmax.cpp.ref
  autotests/kconfig_compiler/test_properties_minmax.h.ref
  autotests/kconfig_compiler/test_properties_minmax.kcfg
  autotests/kconfig_compiler/test_properties_minmax.kcfgc
  autotests/kconfig_compiler/test_properties_minmax_main.cpp
  src/kconfig_compiler/KConfigCommonStructs.h
  src/kconfig_compiler/KConfigSourceGenerator.cpp
  src/kconfig_compiler/KConfigXmlParser.cpp
  src/kconfig_compiler/kconfig_compiler.cpp

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-19 Thread Benjamin Port
bport added inline comments.

INLINE COMMENTS

> test_param_minmax.kcfg:17
> +
> \ No newline at end of file


Add a new line

> test_param_minmax.kcfgc:4
> +Mutators=true
> \ No newline at end of file


add a new line

> test_param_minmax_main.cpp:28
> +return 0;
> +}

Missing new line at end of this file

> KConfigCommonStructs.h:185
> +QString newItemInner(
> +const CfgEntry* entry,
> +const QString &key,

Space before * not after

> kconfig_compiler.cpp:478
> +
> +QString newItem(const CfgEntry* entry, const QString &key, const QString& 
> defaultValue,
> +const KConfigParameters &cfg, const QString ¶m) {

Space before * not after

REPOSITORY
  R237 KConfig

REVISION DETAIL
  https://phabricator.kde.org/D27497

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns


D27497: Fix code generation for entries with min/max

2020-02-19 Thread Henri Chain
hchain created this revision.
hchain added reviewers: meven, crossi, ervin, bport, tcanabrava.
Herald added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
hchain requested review of this revision.

REVISION 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

TEST PLAN
  - auto tests included

REPOSITORY
  R237 KConfig

REVISION DETAIL
  https://phabricator.kde.org/D27497

AFFECTED FILES
  autotests/kconfig_compiler/CMakeLists.txt
  autotests/kconfig_compiler/kconfigcompiler_test.cpp
  autotests/kconfig_compiler/test_param_minmax.cpp.ref
  autotests/kconfig_compiler/test_param_minmax.h.ref
  autotests/kconfig_compiler/test_param_minmax.kcfg
  autotests/kconfig_compiler/test_param_minmax.kcfgc
  autotests/kconfig_compiler/test_param_minmax_main.cpp
  autotests/kconfig_compiler/test_properties_minmax.cpp.ref
  autotests/kconfig_compiler/test_properties_minmax.h.ref
  autotests/kconfig_compiler/test_properties_minmax.kcfg
  autotests/kconfig_compiler/test_properties_minmax.kcfgc
  autotests/kconfig_compiler/test_properties_minmax_main.cpp
  src/kconfig_compiler/KConfigCommonStructs.h
  src/kconfig_compiler/KConfigSourceGenerator.cpp
  src/kconfig_compiler/KConfigXmlParser.cpp
  src/kconfig_compiler/kconfig_compiler.cpp

To: hchain, meven, crossi, ervin, bport, tcanabrava
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns