* [PATCH 0/4] improve qconfig C++ code, take 2
@ 2024-12-19 7:19 Rolf Eike Beer
2024-12-19 7:20 ` [PATCH 1/4] kconfig: qconf: use preferred form of QString API Rolf Eike Beer
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Rolf Eike Beer @ 2024-12-19 7:19 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 888 bytes --]
This is a followup to my earlier series, which has been partially applied
already. Other patches that became obsolete by unrelated refactoring have been
dropped.
The review comments have been addressed. The nullptr patch should now be
complete and catch every "0" in qconf.cc and qconf.h. One additional patch has
been added that removes a constructor overload that would have needed this
treatment otherwise as well.
Regards,
Eike
--
Rolf Eike Beer
emlix GmbH
Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
Phone +49 (0)551 30664-0, e-mail info@emlix.com
District Court of Göttingen, Registry Number HR B 3160
Managing Directors: Heike Jordan, Dr. Uwe Kracke
VAT ID No. DE 205 198 055
Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
Office Bonn: Bachstr. 6, 53115 Bonn, Germany
http://www.emlix.com
emlix - your embedded Linux partner
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 313 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] kconfig: qconf: use preferred form of QString API
2024-12-19 7:19 [PATCH 0/4] improve qconfig C++ code, take 2 Rolf Eike Beer
@ 2024-12-19 7:20 ` Rolf Eike Beer
2025-01-10 16:33 ` Masahiro Yamada
2024-12-19 7:21 ` [PATCH 2/4] kconfig: qconf: use QCommandLineParser Rolf Eike Beer
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Rolf Eike Beer @ 2024-12-19 7:20 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel
A QString constructed from a character literal of length 0, i.e. "", is not
"null" for historical reasons. This does not matter here so use the preferred
method isEmpty() instead.
Also directly construct empty QString objects instead of passing in an empty
character literal that has to be parsed into an empty object first.
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
---
scripts/kconfig/qconf.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 6c92ef1e16ef..eaa465b0ccf9 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1464,8 +1464,8 @@ void ConfigMainWindow::loadConfig(void)
{
QString str;
- str = QFileDialog::getOpenFileName(this, "", configname);
- if (str.isNull())
+ str = QFileDialog::getOpenFileName(this, QString(), configname);
+ if (str.isEmpty())
return;
if (conf_read(str.toLocal8Bit().constData()))
@@ -1491,8 +1491,8 @@ void ConfigMainWindow::saveConfigAs(void)
{
QString str;
- str = QFileDialog::getSaveFileName(this, "", configname);
- if (str.isNull())
+ str = QFileDialog::getSaveFileName(this, QString(), configname);
+ if (str.isEmpty())
return;
if (conf_write(str.toLocal8Bit().constData())) {
--
2.47.1
--
Rolf Eike Beer
emlix GmbH
Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
Phone +49 (0)551 30664-0, e-mail info@emlix.com
District Court of Göttingen, Registry Number HR B 3160
Managing Directors: Heike Jordan, Dr. Uwe Kracke
VAT ID No. DE 205 198 055
Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
Office Bonn: Bachstr. 6, 53115 Bonn, Germany
http://www.emlix.com
emlix - your embedded Linux partner
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] kconfig: qconf: use QCommandLineParser
2024-12-19 7:19 [PATCH 0/4] improve qconfig C++ code, take 2 Rolf Eike Beer
2024-12-19 7:20 ` [PATCH 1/4] kconfig: qconf: use preferred form of QString API Rolf Eike Beer
@ 2024-12-19 7:21 ` Rolf Eike Beer
2025-01-10 17:27 ` Masahiro Yamada
2024-12-19 7:22 ` [PATCH 3/4] kconfig: qconf: remove overloaded constructor Rolf Eike Beer
2024-12-19 7:22 ` [PATCH 4/4] kconfig: qconf: use nullptr in C++11 code Rolf Eike Beer
3 siblings, 1 reply; 9+ messages in thread
From: Rolf Eike Beer @ 2024-12-19 7:21 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel
This has a much nicer output without manual processing. It also adds window
management options from Qt for free.
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
---
scripts/kconfig/qconf.cc | 44 ++++++++++++++++------------------------
1 file changed, 17 insertions(+), 27 deletions(-)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index eaa465b0ccf9..4d500cc9ba9d 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -8,6 +8,7 @@
#include <QActionGroup>
#include <QApplication>
#include <QCloseEvent>
+#include <QCommandLineParser>
#include <QDebug>
#include <QFileDialog>
#include <QLabel>
@@ -1785,41 +1786,30 @@ void fixup_rootmenu(struct menu *menu)
}
}
-static const char *progname;
-
-static void usage(void)
-{
- printf("%s [-s] <config>\n", progname);
- exit(0);
-}
-
int main(int ac, char** av)
{
ConfigMainWindow* v;
- const char *name;
+ configApp = new QApplication(ac, av);
+ QCommandLineParser cmdline;
+ QCommandLineOption silent("s", "silent");
- progname = av[0];
- if (ac > 1 && av[1][0] == '-') {
- switch (av[1][1]) {
- case 's':
- conf_set_message_callback(NULL);
- break;
- case 'h':
- case '?':
- usage();
- }
- name = av[2];
- } else
- name = av[1];
- if (!name)
- usage();
+ cmdline.addOption(silent);
+ cmdline.addHelpOption();
+ cmdline.addPositionalArgument("Kconfig", "Top-level Kconfig file", "Kconfig");
+
+ cmdline.process(*configApp);
+
+ if (cmdline.isSet(silent))
+ conf_set_message_callback(NULL);
- conf_parse(name);
+ QStringList args = cmdline.positionalArguments();
+ if (args.isEmpty())
+ cmdline.showHelp(1);
+
+ conf_parse(args.first().toLocal8Bit().constData());
fixup_rootmenu(&rootmenu);
//zconfdump(stdout);
- configApp = new QApplication(ac, av);
-
configSettings = new ConfigSettings();
configSettings->beginGroup("/kconfig/qconf");
v = new ConfigMainWindow();
--
2.47.1
--
Rolf Eike Beer
emlix GmbH
Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
Phone +49 (0)551 30664-0, e-mail info@emlix.com
District Court of Göttingen, Registry Number HR B 3160
Managing Directors: Heike Jordan, Dr. Uwe Kracke
VAT ID No. DE 205 198 055
Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
Office Bonn: Bachstr. 6, 53115 Bonn, Germany
http://www.emlix.com
emlix - your embedded Linux partner
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] kconfig: qconf: remove overloaded constructor
2024-12-19 7:19 [PATCH 0/4] improve qconfig C++ code, take 2 Rolf Eike Beer
2024-12-19 7:20 ` [PATCH 1/4] kconfig: qconf: use preferred form of QString API Rolf Eike Beer
2024-12-19 7:21 ` [PATCH 2/4] kconfig: qconf: use QCommandLineParser Rolf Eike Beer
@ 2024-12-19 7:22 ` Rolf Eike Beer
2025-01-10 17:29 ` Masahiro Yamada
2024-12-19 7:22 ` [PATCH 4/4] kconfig: qconf: use nullptr in C++11 code Rolf Eike Beer
3 siblings, 1 reply; 9+ messages in thread
From: Rolf Eike Beer @ 2024-12-19 7:22 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel
No extra implementation is needed for this variant, provide a default argument
to the matching sibling instead.
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
---
scripts/kconfig/qconf.h | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 62ab3286d04f..1c90fec4c2da 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -114,7 +114,7 @@ public slots:
class ConfigItem : public QTreeWidgetItem {
typedef class QTreeWidgetItem Parent;
public:
- ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m)
+ ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m = nullptr)
: Parent(parent, after), nextItem(0), menu(m), goParent(false)
{
init();
@@ -124,11 +124,6 @@ class ConfigItem : public QTreeWidgetItem {
{
init();
}
- ConfigItem(ConfigList *parent, ConfigItem *after)
- : Parent(parent, after), nextItem(0), menu(0), goParent(true)
- {
- init();
- }
~ConfigItem(void);
void init(void);
void updateMenu(void);
--
2.47.1
--
Rolf Eike Beer
emlix GmbH
Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
Phone +49 (0)551 30664-0, e-mail info@emlix.com
District Court of Göttingen, Registry Number HR B 3160
Managing Directors: Heike Jordan, Dr. Uwe Kracke
VAT ID No. DE 205 198 055
Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
Office Bonn: Bachstr. 6, 53115 Bonn, Germany
http://www.emlix.com
emlix - your embedded Linux partner
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] kconfig: qconf: use nullptr in C++11 code
2024-12-19 7:19 [PATCH 0/4] improve qconfig C++ code, take 2 Rolf Eike Beer
` (2 preceding siblings ...)
2024-12-19 7:22 ` [PATCH 3/4] kconfig: qconf: remove overloaded constructor Rolf Eike Beer
@ 2024-12-19 7:22 ` Rolf Eike Beer
3 siblings, 0 replies; 9+ messages in thread
From: Rolf Eike Beer @ 2024-12-19 7:22 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel
This C++11 keyword is typesafe, i.e. it can't be assigned to non-pointers, and
it makes it visually clear that this is about a pointer.
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
---
scripts/kconfig/qconf.cc | 42 ++++++++++++++++++++--------------------
scripts/kconfig/qconf.h | 8 ++++----
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 4d500cc9ba9d..7cfd19dadc51 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -303,7 +303,7 @@ ConfigList::ConfigList(QWidget *parent, const char *name)
: QTreeWidget(parent),
updateAll(false),
showName(false), mode(singleMode), optMode(normalOpt),
- rootEntry(0), headerPopup(0)
+ rootEntry(nullptr), headerPopup(nullptr)
{
setObjectName(name);
setSortingEnabled(false);
@@ -417,7 +417,7 @@ void ConfigList::updateSelection(void)
void ConfigList::updateList()
{
- ConfigItem* last = 0;
+ ConfigItem* last = nullptr;
ConfigItem *item;
if (!rootEntry) {
@@ -439,7 +439,7 @@ void ConfigList::updateList()
if (rootEntry != &rootmenu && mode == singleMode) {
item = (ConfigItem *)topLevelItem(0);
if (!item)
- item = new ConfigItem(this, 0);
+ item = new ConfigItem(this, nullptr);
last = item;
}
if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) &&
@@ -489,7 +489,7 @@ void ConfigList::setValue(ConfigItem* item, tristate val)
int type;
tristate oldval;
- sym = item->menu ? item->menu->sym : 0;
+ sym = item->menu ? item->menu->sym : nullptr;
if (!sym)
return;
@@ -553,7 +553,7 @@ void ConfigList::setRootMenu(struct menu *menu)
type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN;
if (type != P_MENU)
return;
- updateMenuList(0);
+ updateMenuList(nullptr);
rootEntry = menu;
updateListAll();
if (currentItem()) {
@@ -610,7 +610,7 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu)
last = parent->firstChild();
if (last && !last->goParent)
- last = 0;
+ last = nullptr;
for (child = menu->list; child; child = child->next) {
item = last ? last->nextSibling() : parent->firstChild();
type = child->prompt ? child->prompt->type : P_UNKNOWN;
@@ -639,7 +639,7 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu)
if (mode == fullMode || mode == menuMode || type != P_MENU)
updateMenuList(item, child);
else
- updateMenuList(item, 0);
+ updateMenuList(item, nullptr);
last = item;
continue;
}
@@ -647,7 +647,7 @@ hide:
if (item && item->menu == child) {
last = parent->firstChild();
if (last == item)
- last = 0;
+ last = nullptr;
else while (last->nextSibling() != item)
last = last->nextSibling();
delete item;
@@ -673,7 +673,7 @@ void ConfigList::updateMenuList(struct menu *menu)
last = (ConfigItem *)topLevelItem(0);
if (last && !last->goParent)
- last = 0;
+ last = nullptr;
for (child = menu->list; child; child = child->next) {
item = last ? last->nextSibling() : (ConfigItem *)topLevelItem(0);
type = child->prompt ? child->prompt->type : P_UNKNOWN;
@@ -702,7 +702,7 @@ void ConfigList::updateMenuList(struct menu *menu)
if (mode == fullMode || mode == menuMode || type != P_MENU)
updateMenuList(item, child);
else
- updateMenuList(item, 0);
+ updateMenuList(item, nullptr);
last = item;
continue;
}
@@ -710,7 +710,7 @@ hide:
if (item && item->menu == child) {
last = (ConfigItem *)topLevelItem(0);
if (last == item)
- last = 0;
+ last = nullptr;
else while (last->nextSibling() != item)
last = last->nextSibling();
delete item;
@@ -853,7 +853,7 @@ skip:
void ConfigList::focusInEvent(QFocusEvent *e)
{
- struct menu *menu = NULL;
+ struct menu *menu = nullptr;
Parent::focusInEvent(e);
@@ -912,7 +912,7 @@ void ConfigList::setAllOpen(bool open)
}
ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
- : Parent(parent), sym(0), _menu(0)
+ : Parent(parent), sym(nullptr), _menu(nullptr)
{
setObjectName(name);
setOpenLinks(false);
@@ -964,7 +964,7 @@ void ConfigInfoView::setInfo(struct menu *m)
if (_menu == m)
return;
_menu = m;
- sym = NULL;
+ sym = nullptr;
if (!_menu)
clear();
else
@@ -1156,7 +1156,7 @@ void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event)
}
ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)
- : Parent(parent), result(NULL)
+ : Parent(parent), result(nullptr)
{
setObjectName("search");
setWindowTitle("Search Config");
@@ -1228,7 +1228,7 @@ void ConfigSearchWindow::search(void)
{
struct symbol **p;
struct property *prop;
- ConfigItem *lastItem = NULL;
+ ConfigItem *lastItem = nullptr;
free(result);
list->clear();
@@ -1247,7 +1247,7 @@ void ConfigSearchWindow::search(void)
* Construct the complete config widget
*/
ConfigMainWindow::ConfigMainWindow(void)
- : searchWindow(0)
+ : searchWindow(nullptr)
{
bool ok = true;
QVariant x, y;
@@ -1524,7 +1524,7 @@ void ConfigMainWindow::changeMenu(struct menu *menu)
void ConfigMainWindow::setMenuLink(struct menu *menu)
{
struct menu *parent;
- ConfigList* list = NULL;
+ ConfigList* list = nullptr;
ConfigItem* item;
if (configList->menuSkip(menu))
@@ -1601,7 +1601,7 @@ void ConfigMainWindow::showSingleView(void)
backAction->setEnabled(true);
menuList->hide();
- menuList->setRootMenu(0);
+ menuList->setRootMenu(nullptr);
configList->mode = singleMode;
if (configList->rootEntry == &rootmenu)
configList->updateListAll();
@@ -1647,7 +1647,7 @@ void ConfigMainWindow::showFullView(void)
backAction->setEnabled(false);
menuList->hide();
- menuList->setRootMenu(0);
+ menuList->setRootMenu(nullptr);
configList->mode = fullMode;
if (configList->rootEntry == &rootmenu)
configList->updateListAll();
@@ -1800,7 +1800,7 @@ int main(int ac, char** av)
cmdline.process(*configApp);
if (cmdline.isSet(silent))
- conf_set_message_callback(NULL);
+ conf_set_message_callback(nullptr);
QStringList args = cmdline.positionalArguments();
if (args.isEmpty())
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 1c90fec4c2da..5f6c57383aba 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -42,7 +42,7 @@ class ConfigList : public QTreeWidget {
Q_OBJECT
typedef class QTreeWidget Parent;
public:
- ConfigList(QWidget *parent, const char *name = 0);
+ ConfigList(QWidget *parent, const char *name = nullptr);
~ConfigList();
void reinit(void);
ConfigItem* findConfigItem(struct menu *);
@@ -115,12 +115,12 @@ class ConfigItem : public QTreeWidgetItem {
typedef class QTreeWidgetItem Parent;
public:
ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m = nullptr)
- : Parent(parent, after), nextItem(0), menu(m), goParent(false)
+ : Parent(parent, after), nextItem(nullptr), menu(m), goParent(false)
{
init();
}
ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m)
- : Parent(parent, after), nextItem(0), menu(m), goParent(false)
+ : Parent(parent, after), nextItem(nullptr), menu(m), goParent(false)
{
init();
}
@@ -180,7 +180,7 @@ class ConfigInfoView : public QTextBrowser {
typedef class QTextBrowser Parent;
QMenu *contextMenu;
public:
- ConfigInfoView(QWidget* parent, const char *name = 0);
+ ConfigInfoView(QWidget* parent, const char *name = nullptr);
bool showDebug(void) const { return _showDebug; }
public slots:
--
2.47.1
--
Rolf Eike Beer
emlix GmbH
Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
Phone +49 (0)551 30664-0, e-mail info@emlix.com
District Court of Göttingen, Registry Number HR B 3160
Managing Directors: Heike Jordan, Dr. Uwe Kracke
VAT ID No. DE 205 198 055
Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
Office Bonn: Bachstr. 6, 53115 Bonn, Germany
http://www.emlix.com
emlix - your embedded Linux partner
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] kconfig: qconf: use preferred form of QString API
2024-12-19 7:20 ` [PATCH 1/4] kconfig: qconf: use preferred form of QString API Rolf Eike Beer
@ 2025-01-10 16:33 ` Masahiro Yamada
0 siblings, 0 replies; 9+ messages in thread
From: Masahiro Yamada @ 2025-01-10 16:33 UTC (permalink / raw)
To: Rolf Eike Beer; +Cc: linux-kbuild, linux-kernel
On Thu, Dec 19, 2024 at 4:23 PM Rolf Eike Beer <eb@emlix.com> wrote:
>
> A QString constructed from a character literal of length 0, i.e. "", is not
> "null" for historical reasons. This does not matter here so use the preferred
> method isEmpty() instead.
>
> Also directly construct empty QString objects instead of passing in an empty
> character literal that has to be parsed into an empty object first.
>
> Signed-off-by: Rolf Eike Beer <eb@emlix.com>
> ---
Applied to linux-kbuild. Thanks.
> scripts/kconfig/qconf.cc | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> index 6c92ef1e16ef..eaa465b0ccf9 100644
> --- a/scripts/kconfig/qconf.cc
> +++ b/scripts/kconfig/qconf.cc
> @@ -1464,8 +1464,8 @@ void ConfigMainWindow::loadConfig(void)
> {
> QString str;
>
> - str = QFileDialog::getOpenFileName(this, "", configname);
> - if (str.isNull())
> + str = QFileDialog::getOpenFileName(this, QString(), configname);
> + if (str.isEmpty())
> return;
>
> if (conf_read(str.toLocal8Bit().constData()))
> @@ -1491,8 +1491,8 @@ void ConfigMainWindow::saveConfigAs(void)
> {
> QString str;
>
> - str = QFileDialog::getSaveFileName(this, "", configname);
> - if (str.isNull())
> + str = QFileDialog::getSaveFileName(this, QString(), configname);
> + if (str.isEmpty())
> return;
>
> if (conf_write(str.toLocal8Bit().constData())) {
> --
> 2.47.1
>
>
> --
> Rolf Eike Beer
>
> emlix GmbH
> Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
> Phone +49 (0)551 30664-0, e-mail info@emlix.com
> District Court of Göttingen, Registry Number HR B 3160
> Managing Directors: Heike Jordan, Dr. Uwe Kracke
> VAT ID No. DE 205 198 055
> Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
> Office Bonn: Bachstr. 6, 53115 Bonn, Germany
> http://www.emlix.com
>
> emlix - your embedded Linux partner
>
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] kconfig: qconf: use QCommandLineParser
2024-12-19 7:21 ` [PATCH 2/4] kconfig: qconf: use QCommandLineParser Rolf Eike Beer
@ 2025-01-10 17:27 ` Masahiro Yamada
0 siblings, 0 replies; 9+ messages in thread
From: Masahiro Yamada @ 2025-01-10 17:27 UTC (permalink / raw)
To: Rolf Eike Beer; +Cc: linux-kbuild, linux-kernel
On Thu, Dec 19, 2024 at 4:23 PM Rolf Eike Beer <eb@emlix.com> wrote:
>
> This has a much nicer output without manual processing. It also adds window
> management options from Qt for free.
>
> Signed-off-by: Rolf Eike Beer <eb@emlix.com>
> ---
This did not reflect my previous comment.
https://lore.kernel.org/linux-kbuild/CAK7LNASdLT-KQA7+Vn+Y2ZJeropcR-sjmv8p2=DCgzCyQdJAEw@mail.gmail.com/
> scripts/kconfig/qconf.cc | 44 ++++++++++++++++------------------------
> 1 file changed, 17 insertions(+), 27 deletions(-)
>
> diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> index eaa465b0ccf9..4d500cc9ba9d 100644
> --- a/scripts/kconfig/qconf.cc
> +++ b/scripts/kconfig/qconf.cc
> @@ -8,6 +8,7 @@
> #include <QActionGroup>
> #include <QApplication>
> #include <QCloseEvent>
> +#include <QCommandLineParser>
> #include <QDebug>
> #include <QFileDialog>
> #include <QLabel>
> @@ -1785,41 +1786,30 @@ void fixup_rootmenu(struct menu *menu)
> }
> }
>
> -static const char *progname;
> -
> -static void usage(void)
> -{
> - printf("%s [-s] <config>\n", progname);
> - exit(0);
> -}
> -
> int main(int ac, char** av)
> {
> ConfigMainWindow* v;
> - const char *name;
> + configApp = new QApplication(ac, av);
> + QCommandLineParser cmdline;
> + QCommandLineOption silent("s", "silent");
>
> - progname = av[0];
> - if (ac > 1 && av[1][0] == '-') {
> - switch (av[1][1]) {
> - case 's':
> - conf_set_message_callback(NULL);
> - break;
> - case 'h':
> - case '?':
> - usage();
> - }
> - name = av[2];
> - } else
> - name = av[1];
> - if (!name)
> - usage();
> + cmdline.addOption(silent);
> + cmdline.addHelpOption();
> + cmdline.addPositionalArgument("Kconfig", "Top-level Kconfig file", "Kconfig");
> +
> + cmdline.process(*configApp);
> +
> + if (cmdline.isSet(silent))
> + conf_set_message_callback(NULL);
>
> - conf_parse(name);
> + QStringList args = cmdline.positionalArguments();
> + if (args.isEmpty())
> + cmdline.showHelp(1);
> +
> + conf_parse(args.first().toLocal8Bit().constData());
> fixup_rootmenu(&rootmenu);
> //zconfdump(stdout);
>
> - configApp = new QApplication(ac, av);
> -
> configSettings = new ConfigSettings();
> configSettings->beginGroup("/kconfig/qconf");
> v = new ConfigMainWindow();
> --
> 2.47.1
>
>
> --
> Rolf Eike Beer
>
> emlix GmbH
> Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
> Phone +49 (0)551 30664-0, e-mail info@emlix.com
> District Court of Göttingen, Registry Number HR B 3160
> Managing Directors: Heike Jordan, Dr. Uwe Kracke
> VAT ID No. DE 205 198 055
> Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
> Office Bonn: Bachstr. 6, 53115 Bonn, Germany
> http://www.emlix.com
>
> emlix - your embedded Linux partner
>
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] kconfig: qconf: remove overloaded constructor
2024-12-19 7:22 ` [PATCH 3/4] kconfig: qconf: remove overloaded constructor Rolf Eike Beer
@ 2025-01-10 17:29 ` Masahiro Yamada
2025-01-14 13:03 ` Rolf Eike Beer
0 siblings, 1 reply; 9+ messages in thread
From: Masahiro Yamada @ 2025-01-10 17:29 UTC (permalink / raw)
To: Rolf Eike Beer; +Cc: linux-kbuild, linux-kernel
On Thu, Dec 19, 2024 at 4:23 PM Rolf Eike Beer <eb@emlix.com> wrote:
>
> No extra implementation is needed for this variant, provide a default argument
> to the matching sibling instead.
I am not sure if this is equivalent conversion
because you are changing goParent(true)
into goParent(false).
> Signed-off-by: Rolf Eike Beer <eb@emlix.com>
> ---
> scripts/kconfig/qconf.h | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
> index 62ab3286d04f..1c90fec4c2da 100644
> --- a/scripts/kconfig/qconf.h
> +++ b/scripts/kconfig/qconf.h
> @@ -114,7 +114,7 @@ public slots:
> class ConfigItem : public QTreeWidgetItem {
> typedef class QTreeWidgetItem Parent;
> public:
> - ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m)
> + ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m = nullptr)
> : Parent(parent, after), nextItem(0), menu(m), goParent(false)
> {
> init();
> @@ -124,11 +124,6 @@ class ConfigItem : public QTreeWidgetItem {
> {
> init();
> }
> - ConfigItem(ConfigList *parent, ConfigItem *after)
> - : Parent(parent, after), nextItem(0), menu(0), goParent(true)
> - {
> - init();
> - }
> ~ConfigItem(void);
> void init(void);
> void updateMenu(void);
> --
> 2.47.1
>
>
> --
> Rolf Eike Beer
>
> emlix GmbH
> Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
> Phone +49 (0)551 30664-0, e-mail info@emlix.com
> District Court of Göttingen, Registry Number HR B 3160
> Managing Directors: Heike Jordan, Dr. Uwe Kracke
> VAT ID No. DE 205 198 055
> Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
> Office Bonn: Bachstr. 6, 53115 Bonn, Germany
> http://www.emlix.com
>
> emlix - your embedded Linux partner
>
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] kconfig: qconf: remove overloaded constructor
2025-01-10 17:29 ` Masahiro Yamada
@ 2025-01-14 13:03 ` Rolf Eike Beer
0 siblings, 0 replies; 9+ messages in thread
From: Rolf Eike Beer @ 2025-01-14 13:03 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]
On Freitag, 10. Januar 2025 18:29:06 Mitteleuropäische Normalzeit Masahiro
Yamada wrote:
> On Thu, Dec 19, 2024 at 4:23 PM Rolf Eike Beer <eb@emlix.com> wrote:
> > No extra implementation is needed for this variant, provide a default
> > argument to the matching sibling instead.
>
> I am not sure if this is equivalent conversion
> because you are changing goParent(true)
> into goParent(false).
It is not, for exactly that reason. Found that out the hard way, i.e. it
crashes in some situations which I didn't notice before. I'll send an updated
patch.
Regards,
Eike
--
Rolf Eike Beer
emlix GmbH
Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
Phone +49 (0)551 30664-0, e-mail info@emlix.com
District Court of Göttingen, Registry Number HR B 3160
Managing Directors: Heike Jordan, Dr. Uwe Kracke
VAT ID No. DE 205 198 055
Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
Office Bonn: Bachstr. 6, 53115 Bonn, Germany
http://www.emlix.com
emlix - your embedded Linux partner
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 313 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-01-14 13:11 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-19 7:19 [PATCH 0/4] improve qconfig C++ code, take 2 Rolf Eike Beer
2024-12-19 7:20 ` [PATCH 1/4] kconfig: qconf: use preferred form of QString API Rolf Eike Beer
2025-01-10 16:33 ` Masahiro Yamada
2024-12-19 7:21 ` [PATCH 2/4] kconfig: qconf: use QCommandLineParser Rolf Eike Beer
2025-01-10 17:27 ` Masahiro Yamada
2024-12-19 7:22 ` [PATCH 3/4] kconfig: qconf: remove overloaded constructor Rolf Eike Beer
2025-01-10 17:29 ` Masahiro Yamada
2025-01-14 13:03 ` Rolf Eike Beer
2024-12-19 7:22 ` [PATCH 4/4] kconfig: qconf: use nullptr in C++11 code Rolf Eike Beer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).