Skip to contentSkip to conversation

Random kconfig patches

PATCH In review Arnaud Lacombe 3 participants 22 messages Jun 6, 2011 – Jul 12, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Random kconfig patches

Hi Michal,

You'll find hereafter a serie of relatively trivial (I hope) patches concerning kconfig. Mostly annotation, deadcode removal, and correctness. This serie is based on top of v3.0-rc1.

As always, it is also available on my git repo on github:

git://github.com/lacombar/linux-2.6.git kconfig-trivial

Regards,
- Arnaud

Arnaud Lacombe (9):
kconfig: annotate non-trivial fall-trough
kconfig: fix return code for invalid boolean symbol in

    conf_set_sym_val()

kconfig: add missing <stdarg.h> inclusion
kconfig: add missing <ctype.h> inclusion
kconfig: add missing <stdlib.h> inclusion
kconfig: nuke reference to SWIG
kconfig: nuke LKC_DIRECT_LINK cruft kconfig/gconf: kill deadcode kconfig/gconf: silent missing prototype warnings

 scripts/kconfig/Makefile            |   23 +++++++-------------
 scripts/kconfig/conf.c              |    5 +++-
 scripts/kconfig/confdata.c          |    9 ++++++-
 scripts/kconfig/expr.c              |    1 -
 scripts/kconfig/expr.h              |    3 --
 scripts/kconfig/gconf.c             |   38 +----------------------------------
 scripts/kconfig/kconfig_load.c      |   35 --------------------------------
 scripts/kconfig/kxgettext.c         |    1 -
 scripts/kconfig/lex.zconf.c_shipped |    1 -
 scripts/kconfig/lkc.h               |    5 ----
 scripts/kconfig/mconf.c             |    2 +-
 scripts/kconfig/menu.c              |    3 +-
 scripts/kconfig/nconf.c             |    2 +-
 scripts/kconfig/qconf.cc            |    4 ---
 scripts/kconfig/symbol.c            |    1 -
 scripts/kconfig/util.c              |    2 +
 scripts/kconfig/zconf.l             |    1 -
 scripts/kconfig/zconf.tab.c_shipped |    1 -
 scripts/kconfig/zconf.y             |    1 -
 19 files changed, 26 insertions(+), 112 deletions(-)
 delete mode 100644 scripts/kconfig/kconfig_load.c
Signature · 1 line
1.7.3.4.574.g608b.dirty
#1 lore raw

PATCH 1/9 kconfig: annotate non-trivial fall-trough

---
 scripts/kconfig/conf.c     |    4 ++++
 scripts/kconfig/confdata.c |    5 +++++
 scripts/kconfig/gconf.c    |    1 +
 scripts/kconfig/mconf.c    |    1 +
 4 files changed, 11 insertions(+), 0 deletions(-)
scripts/kconfig/conf.c +4 -0
index 006ad81..8be7374 100644
@@ -106,6 +106,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
 			return 0;
 		}
 		check_stdin();
+		/* FALLTHOUGH */
 	case oldaskconfig:
 		fflush(stdout);
 		xfgets(line, 128, stdin);
@@ -150,6 +151,7 @@ static int conf_string(struct menu *menu)
 				def = NULL;
 				break;
 			}
+			/* FALLTHOUGH */
 		default:
 			line[strlen(line)-1] = 0;
 			def = line;
@@ -304,6 +306,7 @@ static int conf_choice(struct menu *menu)
 				break;
 			}
 			check_stdin();
+			/* FALLTHOUGH */
 		case oldaskconfig:
 			fflush(stdout);
 			xfgets(line, 128, stdin);
@@ -369,6 +372,7 @@ static void conf(struct menu *menu)
 				check_conf(menu);
 				return;
 			}
+			/* FALLTHOUGH */
 		case P_COMMENT:
 			prompt = menu_get_prompt(menu);
 			if (prompt)
scripts/kconfig/confdata.c +5 -0
index 2bafd9a..3693ac7 100644
@@ -128,6 +128,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
 			sym->flags |= def_flags;
 			break;
 		}
+		/* FALLTHOUGH */
 	case S_BOOLEAN:
 		if (p[0] == 'y') {
 			sym->def[def].tri = yes;
@@ -148,6 +149,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
 			sym->type = S_STRING;
 			goto done;
 		}
+		/* FALLTHOUGH */
 	case S_STRING:
 		if (*p++ != '"')
 			break;
@@ -162,6 +164,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
 			conf_warning("invalid string found");
 			return 1;
 		}
+		/* FALLTHOUGH */
 	case S_INT:
 	case S_HEX:
 	done:
@@ -237,6 +240,7 @@ load:
 		case S_STRING:
 			if (sym->def[def].val)
 				free(sym->def[def].val);
+			/* FALLTHOUGH */
 		default:
 			sym->def[def].val = NULL;
 			sym->def[def].tri = no;
@@ -363,6 +367,7 @@ int conf_read(const char *name)
 					break;
 				if (!sym_is_choice(sym))
 					goto sym_ok;
+				/* FALLTHOUGH */
 			default:
 				if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val))
 					goto sym_ok;
scripts/kconfig/gconf.c +1 -0
index a11d5f7..79e9806 100644
@@ -1172,6 +1172,7 @@ static gchar **fill_row(struct menu *menu)
 			row[COL_BTNVIS] = GINT_TO_POINTER(TRUE);
 		if (sym_is_choice(sym))
 			break;
+		/* FALLTHOUGH */
 	case S_TRISTATE:
 		val = sym_get_tristate_value(sym);
 		switch (val) {
scripts/kconfig/mconf.c +1 -0
index d433c7a..fa0ae0e 100644
@@ -845,6 +845,7 @@ int main(int ac, char **av)
 				"\n\n"));
 			return 1;
 		}
+		/* FALLTHOUGH */
 	case -1:
 		printf(_("\n\n"
 			"*** End of the configuration.\n"
Signature · 1 line
1.7.3.4.574.g608b.dirty
#4 lore raw

PATCH 2/9 kconfig: fix return code for invalid boolean symbol in conf_set_sym_val()

In reply to Arnaud Lacombe
---
 scripts/kconfig/confdata.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
scripts/kconfig/confdata.c +1 -1
index 3693ac7..a9f0ebd 100644
@@ -141,7 +141,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
 			break;
 		}
 		conf_warning("symbol value '%s' invalid for %s", p, sym->name);
-		break;
+		return 1;
 	case S_OTHER:
 		if (*p != '"') {
 			for (p2 = p; *p2 && !isspace(*p2); p2++)
Signature · 1 line
1.7.3.4.574.g608b.dirty
#5 lore raw

PATCH 3/9 kconfig: add missing <stdarg.h> inclusion

In reply to Arnaud Lacombe

This header is needed when using va_{start,end,copy}(3) functions family.

---
 scripts/kconfig/confdata.c |    1 +
 scripts/kconfig/menu.c     |    1 +
 scripts/kconfig/util.c     |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)
scripts/kconfig/confdata.c +1 -0
index a9f0ebd..2118f4b 100644
@@ -7,6 +7,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
scripts/kconfig/menu.c +1 -0
index 5fdf10d..d64108b 100644
@@ -3,6 +3,7 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
+#include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 
scripts/kconfig/util.c +1 -0
index 6330cc8..e07d557 100644
@@ -5,6 +5,7 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
+#include <stdarg.h>
 #include <string.h>
 #include "lkc.h"
 
Signature · 1 line
1.7.3.4.574.g608b.dirty
#6 lore raw

PATCH 4/9 kconfig: add missing <ctype.h> inclusion

In reply to Arnaud Lacombe

This header is needed when using isspace(3) function family.

---
 scripts/kconfig/menu.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
scripts/kconfig/menu.c +1 -0
index d64108b..24547fe 100644
@@ -3,6 +3,7 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
+#include <ctype.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
Signature · 1 line
1.7.3.4.574.g608b.dirty
#7 lore raw

PATCH 5/9 kconfig: add missing <stdlib.h> inclusion

In reply to Arnaud Lacombe

This header is needed when using {m,re}alloc(3) and free(3) function family.

---
 scripts/kconfig/util.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
scripts/kconfig/util.c +1 -0
index e07d557..d0b8b23 100644
@@ -6,6 +6,7 @@
  */
 
 #include <stdarg.h>
+#include <stdlib.h>
 #include <string.h>
 #include "lkc.h"
 
Signature · 1 line
1.7.3.4.574.g608b.dirty
#8 lore raw

PATCH 6/9 kconfig: nuke reference to SWIG

In reply to Arnaud Lacombe

SWIG is not used (yet?) to create kconfig binding, so there is no point referencing it.

---
 scripts/kconfig/expr.h |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
scripts/kconfig/expr.h +0 -3
index 16bfae2..80fce57 100644
@@ -172,8 +172,6 @@ struct menu {
 #define MENU_CHANGED		0x0001
 #define MENU_ROOT		0x0002
 
-#ifndef SWIG
-
 extern struct file *file_list;
 extern struct file *current_file;
 struct file *lookup_file(const char *name);
@@ -218,7 +216,6 @@ static inline int expr_is_no(struct expr *e)
 {
 	return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no);
 }
-#endif
 
 #ifdef __cplusplus
 }
Signature · 1 line
1.7.3.4.574.g608b.dirty
#9 lore raw

PATCH 7/9 kconfig: nuke LKC_DIRECT_LINK cruft

In reply to Arnaud Lacombe

This interface is not (and has never been ?) used by any frontend, just get rid of it.

---
 scripts/kconfig/Makefile            |   24 ++++++++----------------
 scripts/kconfig/conf.c              |    1 -
 scripts/kconfig/confdata.c          |    1 -
 scripts/kconfig/expr.c              |    1 -
 scripts/kconfig/gconf.c             |    4 ----
 scripts/kconfig/kconfig_load.c      |   35 -----------------------------------
 scripts/kconfig/kxgettext.c         |    1 -
 scripts/kconfig/lex.zconf.c_shipped |    1 -
 scripts/kconfig/lkc.h               |    5 -----
 scripts/kconfig/mconf.c             |    1 -
 scripts/kconfig/menu.c              |    1 -
 scripts/kconfig/nconf.c             |    2 +-
 scripts/kconfig/qconf.cc            |    4 ----
 scripts/kconfig/symbol.c            |    1 -
 scripts/kconfig/zconf.l             |    1 -
 scripts/kconfig/zconf.tab.c_shipped |    1 -
 scripts/kconfig/zconf.y             |    1 -
 17 files changed, 9 insertions(+), 76 deletions(-)
 delete mode 100644 scripts/kconfig/kconfig_load.c
scripts/kconfig/Makefile +8 -16
index faa9a47..0460ac3 100644
@@ -170,8 +170,8 @@ mconf-objs     := mconf.o zconf.tab.o $(lxdialog)
 nconf-objs     := nconf.o zconf.tab.o nconf.gui.o
 kxgettext-objs	:= kxgettext.o zconf.tab.o
 qconf-cxxobjs	:= qconf.o
-qconf-objs	:= kconfig_load.o zconf.tab.o
-gconf-objs	:= gconf.o kconfig_load.o zconf.tab.o
+qconf-objs	:= zconf.tab.o
+gconf-objs	:= gconf.o zconf.tab.o
 
 hostprogs-y := conf
 
@@ -203,7 +203,7 @@ ifeq ($(gconf-target),1)
 	hostprogs-y += gconf
 endif
 
-clean-files	:= lkc_defs.h qconf.moc .tmp_qtcheck .tmp_gtkcheck
+clean-files	:= qconf.moc .tmp_qtcheck .tmp_gtkcheck
 clean-files	+= zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
 clean-files     += mconf qconf gconf nconf
 clean-files     += config.pot linux.pot
@@ -223,12 +223,11 @@ HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC)
 HOSTCFLAGS_lex.zconf.o	:= -I$(src)
 HOSTCFLAGS_zconf.tab.o	:= -I$(src)
 
-HOSTLOADLIBES_qconf	= $(KC_QT_LIBS) -ldl
-HOSTCXXFLAGS_qconf.o	= $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
+HOSTLOADLIBES_qconf	= $(KC_QT_LIBS)
+HOSTCXXFLAGS_qconf.o	= $(KC_QT_CFLAGS)
 
-HOSTLOADLIBES_gconf	= `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl
-HOSTCFLAGS_gconf.o	= `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
-                          -D LKC_DIRECT_LINK
+HOSTLOADLIBES_gconf	= `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
+HOSTCFLAGS_gconf.o	= `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0`
 
 HOSTLOADLIBES_mconf   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
 
@@ -318,18 +317,11 @@ endif
 
 $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c
 
-$(obj)/kconfig_load.o: $(obj)/lkc_defs.h
-
-$(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
-
-$(obj)/gconf.o: $(obj)/lkc_defs.h
+$(obj)/qconf.o: $(obj)/qconf.moc
 
 $(obj)/%.moc: $(src)/%.h
 	$(KC_QT_MOC) -i $< -o $@
 
-$(obj)/lkc_defs.h: $(src)/lkc_proto.h
-	$(Q)sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
-
 # Extract gconf menu items for I18N support
 $(obj)/gconf.glade.h: $(obj)/gconf.glade
 	$(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \
scripts/kconfig/conf.c +0 -1
index 8be7374..4e32098 100644
@@ -14,7 +14,6 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 
-#define LKC_DIRECT_LINK
 #include "lkc.h"
 
 static void conf(struct menu *menu);
scripts/kconfig/confdata.c +0 -1
index 2118f4b..3eeaaeb 100644
@@ -14,7 +14,6 @@
 #include <time.h>
 #include <unistd.h>
 
-#define LKC_DIRECT_LINK
 #include "lkc.h"
 
 static void conf_warning(const char *fmt, ...)
scripts/kconfig/expr.c +0 -1
index 0010034..792c62e 100644
@@ -7,7 +7,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define LKC_DIRECT_LINK
 #include "lkc.h"
 
 #define DEBUG_EXPR	0
scripts/kconfig/gconf.c +0 -4
index 79e9806..0426fda 100644
@@ -1507,10 +1507,6 @@ int main(int ac, char *av[])
 	char *env;
 	gchar *glade_file;
 
-#ifndef LKC_DIRECT_LINK
-	kconfig_load();
-#endif
-
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	bind_textdomain_codeset(PACKAGE, "UTF-8");
 	textdomain(PACKAGE);
scripts/kconfig/kconfig_load.c deleted +0 -35
deleted file mode 100644
index dbdcaad..0000000
@@ -1,35 +0,0 @@
-#include <dlfcn.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "lkc.h"
-
-#define P(name,type,arg)	type (*name ## _p) arg
-#include "lkc_proto.h"
-#undef P
-
-void kconfig_load(void)
-{
-	void *handle;
-	char *error;
-
-	handle = dlopen("./libkconfig.so", RTLD_LAZY);
-	if (!handle) {
-		handle = dlopen("./scripts/kconfig/libkconfig.so", RTLD_LAZY);
-		if (!handle) {
-			fprintf(stderr, "%s\n", dlerror());
-			exit(1);
-		}
-	}
-
-#define P(name,type,arg)			\
-{						\
-	name ## _p = dlsym(handle, #name);	\
-        if ((error = dlerror()))  {		\
-                fprintf(stderr, "%s\n", error);	\
-		exit(1);			\
-	}					\
-}
-#include "lkc_proto.h"
-#undef P
-}
scripts/kconfig/kxgettext.c +0 -1
index e9d8e79..2858738 100644
@@ -7,7 +7,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define LKC_DIRECT_LINK
 #include "lkc.h"
 
 static char *escape(const char* text, char *bf, int len)
scripts/kconfig/lex.zconf.c_shipped +0 -1
index d918291..dcea7a7 100644
@@ -785,7 +785,6 @@ char *zconftext;
 #include <string.h>
 #include <unistd.h>
 
-#define LKC_DIRECT_LINK
 #include "lkc.h"
 
 #define START_STRSIZE	16
scripts/kconfig/lkc.h +0 -5
index febf0c9..625ec69 100644
@@ -21,12 +21,7 @@ static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c;
 extern "C" {
 #endif
 
-#ifdef LKC_DIRECT_LINK
 #define P(name,type,arg)	extern type name arg
-#else
-#include "lkc_defs.h"
-#define P(name,type,arg)	extern type (*name ## _p) arg
-#endif
 #include "lkc_proto.h"
 #undef P
 
scripts/kconfig/mconf.c +0 -1
index fa0ae0e..77344ac 100644
@@ -18,7 +18,6 @@
 #include <unistd.h>
 #include <locale.h>
 
-#define LKC_DIRECT_LINK
 #include "lkc.h"
 #include "lxdialog/dialog.h"
 
scripts/kconfig/menu.c +0 -1
index 24547fe..aab5a1f 100644
@@ -8,7 +8,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define LKC_DIRECT_LINK
 #include "lkc.h"
 
 static const char nohelp_text[] = N_(
scripts/kconfig/nconf.c +1 -1
index 488dd74..da9f5c4 100644
@@ -7,7 +7,7 @@
  */
 #define _GNU_SOURCE
 #include <string.h>
-#define LKC_DIRECT_LINK
+
 #include "lkc.h"
 #include "nconf.h"
 #include <ctype.h>
scripts/kconfig/qconf.cc +0 -4
index c2796b8..31e01cd 100644
@@ -1745,10 +1745,6 @@ int main(int ac, char** av)
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
 
-#ifndef LKC_DIRECT_LINK
-	kconfig_load();
-#endif
-
 	progname = av[0];
 	configApp = new QApplication(ac, av);
 	if (ac > 1 && av[1][0] == '-') {
scripts/kconfig/symbol.c +0 -1
index a796c95..cf8edf4 100644
@@ -9,7 +9,6 @@
 #include <regex.h>
 #include <sys/utsname.h>
 
-#define LKC_DIRECT_LINK
 #include "lkc.h"
 
 struct symbol symbol_yes = {
scripts/kconfig/zconf.l +0 -1
index b22f884..29b79f4 100644
@@ -14,7 +14,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#define LKC_DIRECT_LINK
 #include "lkc.h"
 
 #define START_STRSIZE	16
scripts/kconfig/zconf.tab.c_shipped +0 -1
index 4c5495e..c1579e6 100644
@@ -88,7 +88,6 @@
 #include <string.h>
 #include <stdbool.h>
 
-#define LKC_DIRECT_LINK
 #include "lkc.h"
 
 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
scripts/kconfig/zconf.y +0 -1
index 49fb4ab..29c391f 100644
@@ -11,7 +11,6 @@
 #include <string.h>
 #include <stdbool.h>
 
-#define LKC_DIRECT_LINK
 #include "lkc.h"
 
 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
Signature · 1 line
1.7.3.4.574.g608b.dirty
#10 lore raw

PATCH 8/9 kconfig/gconf: kill deadcode

In reply to Arnaud Lacombe

The only call site of renderer_toggled() has been commented out since Apr. 2003, as per Linus' Linux history repository:

commit e7f67eb3c0570aa50c1cc0707b478a6d93bdc255
Author: Roman Zippel <[email protected]>
Date: Fri Apr 4 04:18:05 2003 -0800

[PATCH] gconf update

A gconf update by Romain Li<C3><A9>vin <[email protected]>
- fixed bug when double-clicking for changing value.
- expand row when enabling a row with a submenu.
- various bug fixes

As this result in a warning:

scripts/kconfig/gconf.c:891:13: warning: 'renderer_toggled' defined but not used

just nuke that code.

---
 scripts/kconfig/gconf.c |   33 ---------------------------------
 1 files changed, 0 insertions(+), 33 deletions(-)
scripts/kconfig/gconf.c +0 -33
index 0426fda..e2db621 100644
@@ -285,8 +285,6 @@ void init_left_tree(void)
 static void renderer_edited(GtkCellRendererText * cell,
 			    const gchar * path_string,
 			    const gchar * new_text, gpointer user_data);
-static void renderer_toggled(GtkCellRendererToggle * cellrenderertoggle,
-			     gchar * arg1, gpointer user_data);
 
 void init_right_tree(void)
 {
@@ -320,8 +318,6 @@ void init_right_tree(void)
 					    "inconsistent", COL_BTNINC,
 					    "visible", COL_BTNVIS,
 					    "radio", COL_BTNRAD, NULL);
-	/*g_signal_connect(G_OBJECT(renderer), "toggled",
-	   G_CALLBACK(renderer_toggled), NULL); */
 	renderer = gtk_cell_renderer_text_new();
 	gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
 					renderer, FALSE);
@@ -888,35 +884,6 @@ static void toggle_sym_value(struct menu *menu)
 		display_tree_part();	//fixme: keep exp/coll
 }
 
-static void renderer_toggled(GtkCellRendererToggle * cell,
-			     gchar * path_string, gpointer user_data)
-{
-	GtkTreePath *path, *sel_path = NULL;
-	GtkTreeIter iter, sel_iter;
-	GtkTreeSelection *sel;
-	struct menu *menu;
-
-	path = gtk_tree_path_new_from_string(path_string);
-	if (!gtk_tree_model_get_iter(model2, &iter, path))
-		return;
-
-	sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree2_w));
-	if (gtk_tree_selection_get_selected(sel, NULL, &sel_iter))
-		sel_path = gtk_tree_model_get_path(model2, &sel_iter);
-	if (!sel_path)
-		goto out1;
-	if (gtk_tree_path_compare(path, sel_path))
-		goto out2;
-
-	gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1);
-	toggle_sym_value(menu);
-
-      out2:
-	gtk_tree_path_free(sel_path);
-      out1:
-	gtk_tree_path_free(path);
-}
-
 static gint column2index(GtkTreeViewColumn * column)
 {
 	gint i;
Signature · 1 line
1.7.3.4.574.g608b.dirty
#11 lore raw

PATCH 9/9 kconfig/gconf: silent missing prototype warnings

In reply to Arnaud Lacombe

As the `gconf' frontend is un-maintained, go the easy way by silencing the "warning: no previous prototype for '<fn>'" warnings.

---
 scripts/kconfig/Makefile |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
scripts/kconfig/Makefile +2 -1
index 0460ac3..84abb2f 100644
@@ -227,7 +227,8 @@ HOSTLOADLIBES_qconf	= $(KC_QT_LIBS)
 HOSTCXXFLAGS_qconf.o	= $(KC_QT_CFLAGS)
 
 HOSTLOADLIBES_gconf	= `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
-HOSTCFLAGS_gconf.o	= `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0`
+HOSTCFLAGS_gconf.o	= `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
+                          -Wno-missing-prototypes
 
 HOSTLOADLIBES_mconf   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
 
Signature · 1 line
1.7.3.4.574.g608b.dirty
#2 lore raw

Re: [PATCH 1/9] kconfig: annotate non-trivial fall-trough

In reply to Arnaud Lacombe
Quoted 13 lines · Arnaud Lacombe
---
 scripts/kconfig/conf.c     |    4 ++++
 scripts/kconfig/confdata.c |    5 +++++
 scripts/kconfig/gconf.c    |    1 +
 scripts/kconfig/mconf.c    |    1 +
 4 files changed, 11 insertions(+), 0 deletions(-)
scripts/kconfig/conf.c +0 -0
index 006ad81..8be7374 100644

scripts/kconfig/conf.c static int conf_askvalue(struct symbol *sym, const char *def) · line 112

Quoted 7 lines
scripts/kconfig/conf.c +1 -0
@@ -106,6 +106,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
 			return 0;
 		}
 		check_stdin();
+		/* FALLTHOUGH */
 	case oldaskconfig:
 		fflush(stdout);
 		xfgets(line, 128, stdin);

Could it be done using the inside voice?

s/FALLTHOUGH/fall through/

Daniel K.

#3 lore raw

Re: [PATCH 1/9] kconfig: annotate non-trivial fall-trough

Hi,

Quoted 26 lines · Daniel K.
Quoted 19 lines · Arnaud Lacombe

---
 scripts/kconfig/conf.c     |    4 ++++
 scripts/kconfig/confdata.c |    5 +++++
 scripts/kconfig/gconf.c    |    1 +
 scripts/kconfig/mconf.c    |    1 +

 4 files changed, 11 insertions(+), 0 deletions(-)
scripts/kconfig/conf.c +1 -0
index 006ad81..8be7374 100644
@@ -106,6 +106,7 @@ static int conf_askvalue(struct symbol *sym, const
 char *def)
                        return 0;
                }
                check_stdin();
+               /* FALLTHOUGH */
Quoted 3 lines

       case oldaskconfig:
               fflush(stdout);
               xfgets(line, 128, stdin);

Could it be done using the inside voice?

Quoted 2 lines

s/FALLTHOUGH/fall through/

Sure, I followed the LINT syntax and missed `Documentation/CodingStyle' defined its own. [And I actually managed to make a typo in a so trivial patch :(]. Anyway, thanks for pointing that out. The tree at github contains the fixed version.

- Arnaud

#12 lore raw
In reply to Arnaud Lacombe
Quoted 16 lines · Arnaud Lacombe

Hi Michal,

You'll find hereafter a serie of relatively trivial (I hope) patches concerning kconfig. Mostly annotation, deadcode removal, and correctness. This serie is based on top of v3.0-rc1.

As always, it is also available on my git repo on github:

git://github.com/lacombar/linux-2.6.git kconfig-trivial

Regards,
- Arnaud

Arnaud Lacombe (9):
kconfig: annotate non-trivial fall-trough
kconfig: fix return code for invalid boolean symbol in

Quoted 8 lines
     conf_set_sym_val()

kconfig: add missing<stdarg.h> inclusion
kconfig: add missing<ctype.h> inclusion
kconfig: add missing<stdlib.h> inclusion
kconfig: nuke reference to SWIG
kconfig: nuke LKC_DIRECT_LINK cruft kconfig/gconf: kill deadcode kconfig/gconf: silent missing prototype warnings

Thanks, pulled. I like especially the LKC_DIRECT_LINK removal :).

Michal

#13 lore raw

cover Random kconfig patches (second iteration)

In reply to Arnaud Lacombe

Hi Michal,

You'll find hereafter a another serie of relatively trivial (I hope) patches concerning kconfig. Some missing bits of the previous serie, scope reductions, proper description of `conf' usage...

You may want to diretly merge it from my git repo on github if you find those acceptable:

git://github.com/lacombar/linux-2.6.git kconfig-trivial

Regards,
- Arnaud

Arnaud Lacombe (5):
kconfig: use calloc() for expr allocation kconfig/conf: reduce the scope of `defconfig_file' kconfig/conf: add command line options' description
kconfig: remove pending prototypes for kconfig_load() kconfig/conf: mark xfgets() private

 scripts/kconfig/conf.c |   43 +++++++++++++++++++++++++++++++++++--------
 scripts/kconfig/expr.c |   12 ++++--------
 scripts/kconfig/lkc.h  |    6 ------
 3 files changed, 39 insertions(+), 22 deletions(-)
Signature · 1 line
1.7.3.4.574.g608b.dirty
#14 lore raw

PATCH 1/5 kconfig: use calloc() for expr allocation

---
 scripts/kconfig/expr.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
scripts/kconfig/expr.c +4 -8
index 792c62e..290ce41 100644
@@ -13,8 +13,7 @@
 
 struct expr *expr_alloc_symbol(struct symbol *sym)
 {
-	struct expr *e = malloc(sizeof(*e));
-	memset(e, 0, sizeof(*e));
+	struct expr *e = calloc(1, sizeof(*e));
 	e->type = E_SYMBOL;
 	e->left.sym = sym;
 	return e;
@@ -22,8 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym)
 
 struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
 {
-	struct expr *e = malloc(sizeof(*e));
-	memset(e, 0, sizeof(*e));
+	struct expr *e = calloc(1, sizeof(*e));
 	e->type = type;
 	e->left.expr = ce;
 	return e;
@@ -31,8 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
 
 struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)
 {
-	struct expr *e = malloc(sizeof(*e));
-	memset(e, 0, sizeof(*e));
+	struct expr *e = calloc(1, sizeof(*e));
 	e->type = type;
 	e->left.expr = e1;
 	e->right.expr = e2;
@@ -41,8 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
 
 struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2)
 {
-	struct expr *e = malloc(sizeof(*e));
-	memset(e, 0, sizeof(*e));
+	struct expr *e = calloc(1, sizeof(*e));
 	e->type = type;
 	e->left.sym = s1;
 	e->right.sym = s2;
Signature · 1 line
1.7.3.4.574.g608b.dirty
#15 lore raw

PATCH 2/5 kconfig/conf: reduce the scope of `defconfig_file'

In reply to Arnaud Lacombe

This variable is not used outside of main() so there is not much reason keeping it global. Ensure it is initialized as gcc has no way to know that normal execution path expect only one option switch to be given on the command line (except when we request help). As a result, we always initialize `defconfig_file' before using it.

---
 scripts/kconfig/conf.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
scripts/kconfig/conf.c +1 -3
index 08c05bc..6431f5c 100644
@@ -34,8 +34,6 @@ enum input_mode {
 	oldnoconfig,
 } input_mode = oldaskconfig;
 
-char *defconfig_file;
-
 static int indent = 1;
 static int valid_stdin = 1;
 static int sync_kconfig;
@@ -462,7 +460,7 @@ static struct option long_opts[] = {
 int main(int ac, char **av)
 {
 	int opt;
-	const char *name;
+	const char *name, *defconfig_file = NULL /* gcc uninit */;
 	struct stat tmpstat;
 
 	setlocale(LC_ALL, "");
Signature · 1 line
1.7.3.4.574.g608b.dirty
#16 lore raw

PATCH 3/5 kconfig/conf: add command line options' description

In reply to Arnaud Lacombe
---
 scripts/kconfig/conf.c |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)
scripts/kconfig/conf.c +31 -1
index 6431f5c..819ab18 100644
@@ -457,8 +457,28 @@ static struct option long_opts[] = {
 	{NULL, 0, NULL, 0}
 };
 
+static void conf_usage(const char *progname)
+{
+
+	printf("Usage: %s [option] <kconfig-file>\n", progname);
+	printf("[option] is _one_ of the following:\n");
+	printf("  --listnewconfig         List new options\n");
+	printf("  --oldaskconfig          Start a new configuration using a line-oriented program\n");
+	printf("  --oldconfig             Update a configuration using a provided .config as base\n");
+	printf("  --silentoldconfig       Same as oldconfig, but quietly, additionally update deps\n");
+	printf("  --oldnoconfig           Same as silentoldconfig but set new symbols to no\n");
+	printf("  --defconfig <file>      New config with default defined in <file>\n");
+	printf("  --savedefconfig <file>  Save the minimal current configuration to <file>\n");
+	printf("  --allnoconfig           New config where all options are answered with no\n");
+	printf("  --allyesconfig          New config where all options are answered with yes\n");
+	printf("  --allmodconfig          New config where all options are answered with mod\n");
+	printf("  --alldefconfig          New config with all symbols set to default\n");
+	printf("  --randconfig            New config with random answer to all options\n");
+}
+
 int main(int ac, char **av)
 {
+	const char *progname = av[0];
 	int opt;
 	const char *name, *defconfig_file = NULL /* gcc uninit */;
 	struct stat tmpstat;
@@ -492,14 +512,24 @@ int main(int ac, char **av)
 			srand(seed);
 			break;
 		}
+		case oldaskconfig:
+		case oldconfig:
+		case allnoconfig:
+		case allyesconfig:
+		case allmodconfig:
+		case alldefconfig:
+		case listnewconfig:
+		case oldnoconfig:
+			break;
 		case '?':
-			fprintf(stderr, _("See README for usage info\n"));
+			conf_usage(progname);
 			exit(1);
 			break;
 		}
 	}
 	if (ac == optind) {
 		printf(_("%s: Kconfig file missing\n"), av[0]);
+		conf_usage(progname);
 		exit(1);
 	}
 	name = av[optind];
Signature · 1 line
1.7.3.4.574.g608b.dirty
#17 lore raw

PATCH 4/5 kconfig: remove pending prototypes for kconfig_load()

In reply to Arnaud Lacombe

Commit 5a6f8d2bd9e3392569ed6f29ea4d7210652f929b removed kconfig_load()', however, it missed an hidden prototypes in lkc.h'. Fix this.

---
 scripts/kconfig/lkc.h |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
scripts/kconfig/lkc.h +0 -3
index 625ec69..60ffe8c 100644
@@ -94,9 +94,6 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
 		fprintf(stderr, "\nError in writing or end of file.\n");
 }
 
-/* kconfig_load.c */
-void kconfig_load(void);
-
 /* menu.c */
 void _menu_init(void);
 void menu_warn(struct menu *menu, const char *fmt, ...);
Signature · 1 line
1.7.3.4.574.g608b.dirty
#18 lore raw

PATCH 5/5 kconfig/conf: mark xfgets() private

In reply to Arnaud Lacombe

This function has not much reason to be public. In the mean time, convert declaration from K&R C to ISO C.

---
 scripts/kconfig/conf.c |    7 +++----
 scripts/kconfig/lkc.h  |    3 ---
 2 files changed, 3 insertions(+), 7 deletions(-)
scripts/kconfig/conf.c +3 -4
index 819ab18..f208f90 100644
@@ -18,6 +18,7 @@
 
 static void conf(struct menu *menu);
 static void check_conf(struct menu *menu);
+static void xfgets(char *str, int size, FILE *in);
 
 enum input_mode {
 	oldaskconfig,
@@ -672,13 +673,11 @@ int main(int ac, char **av)
 	}
 	return 0;
 }
+
 /*
  * Helper function to facilitate fgets() by Jean Sacren.
  */
-void xfgets(str, size, in)
-	char *str;
-	int size;
-	FILE *in;
+void xfgets(char *str, int size, FILE *in)
 {
 	if (fgets(str, size, in) == NULL)
 		fprintf(stderr, "\nError in reading or end of file.\n");
scripts/kconfig/lkc.h +0 -3
index 60ffe8c..eed2249 100644
@@ -76,9 +76,6 @@ void zconf_nextfile(const char *name);
 int zconf_lineno(void);
 const char *zconf_curname(void);
 
-/* conf.c */
-void xfgets(char *str, int size, FILE *in);
-
 /* confdata.c */
 const char *conf_get_configname(void);
 const char *conf_get_autoconfig_name(void);
Signature · 1 line
1.7.3.4.574.g608b.dirty
#19 lore raw

Re: [PATCH 0/5] Random kconfig patches (second iteration)

In reply to Arnaud Lacombe
Quoted 10 lines · Arnaud Lacombe

Hi Michal,

You'll find hereafter a another serie of relatively trivial (I hope) patches concerning kconfig. Some missing bits of the previous serie, scope reductions, proper description of `conf' usage...

You may want to diretly merge it from my git repo on github if you find those acceptable:

git://github.com/lacombar/linux-2.6.git kconfig-trivial

Pulled, thanks!

Michal

#20 lore raw

Re: [PATCH 0/5] Random kconfig patches (second iteration)

Hi,

2011/7/4 Michal Marek <[email protected]>:

Quoted 10 lines · Arnaud Lacombe
Quoted 9 lines

Hi Michal,

You'll find hereafter a another serie of relatively trivial (I hope) patches
concerning kconfig. Some missing bits of the previous serie, scope reductions,
proper description of `conf' usage...

Quoted 8 lines
Quoted 5 lines

You may want to diretly merge it from my git repo on github if you find those
acceptable:

 git://github.com/lacombar/linux-2.6.git kconfig-trivial

Pulled, thanks!

did you ?

It does not seems to have reached the kbuild-2.6.git tree on git.kernel.org.

Thanks,
- Arnaud

Quoted 2 lines

Michal

#21 lore raw

Re: [PATCH 0/5] Random kconfig patches (second iteration)

Quoted 6 lines · Arnaud Lacombe

2011/7/4 Michal Marek<[email protected]>:

Quoted 5 lines · Arnaud Lacombe
Quoted 4 lines

You may want to diretly merge it from my git repo on github if you find those
acceptable:

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

git://github.com/lacombar/linux-2.6.git kconfig-trivial

Pulled, thanks!

did you ?

It does not seems to have reached the kbuild-2.6.git tree on git.kernel.org.

I forgot to push it, sorry. It should be there now.

Michal