History

Merge branch 'master' into for-next

Fast-forward merge with Linus to be able to merge patches based on more recent version of the tree.

Jiri Kosina committed 15 years ago

Commit e060c382 parents 10e4ac5 cc39c6a3980 files · +199073 −61456Browse files

Showing the changes to scripts (23 of 3980 files). Show all

Unified · Split

23 files
  1. scripts/checkpatch.pl +2 −1
  2. scripts/get_maintainer.pl +1 −1
  3. scripts/kconfig/Makefile +8 −15
  4. scripts/kconfig/conf.c +39 −9
  5. scripts/kconfig/confdata.c +194 −101
  6. scripts/kconfig/expr.c +4 −9
  7. scripts/kconfig/expr.h +0 −3
  8. scripts/kconfig/gconf.c +1 −37
  9. scripts/kconfig/kconfig_load.c +0 −35
  10. scripts/kconfig/kxgettext.c +0 −1
  11. scripts/kconfig/lkc.h +5 −11
  12. scripts/kconfig/lkc_proto.h +1 −0
  13. scripts/kconfig/mconf.c +1 −1
  14. scripts/kconfig/menu.c +3 −2
  15. scripts/kconfig/nconf.c +9 −21
  16. scripts/kconfig/qconf.cc +10 −7
  17. scripts/kconfig/qconf.h +1 −1
  18. scripts/kconfig/symbol.c +45 −2
  19. scripts/kconfig/util.c +2 −0
  20. scripts/kconfig/zconf.l +0 −1
  21. scripts/kconfig/zconf.lex.c_shipped +0 −1
  22. scripts/kconfig/zconf.tab.c_shipped +0 −1
  23. scripts/kconfig/zconf.y +0 −1
scripts/checkpatch.pl+2−1
@@ -2574,7 +2574,8 @@ sub process { · 2573 unmodified lines
25742574 } else {
25752575 $cast = $cast2;
25762576 }
2577− WARN("$call() should probably be ${call}_t($cast, $arg1, $arg2)\n" . $herecurr);
2577+ WARN("MINMAX",
2578+ "$call() should probably be ${call}_t($cast, $arg1, $arg2)\n" . $herecurr);
25782579 }
25792580 }
25802581
scripts/get_maintainer.pl+1−1
@@ -1389,7 +1389,7 @@ sub vcs_exists { · 1388 unmodified lines
13891389 warn("$P: No supported VCS found. Add --nogit to options?\n");
13901390 warn("Using a git repository produces better results.\n");
13911391 warn("Try Linus Torvalds' latest git repository using:\n");
1392− warn("git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n");
1392+ warn("git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git\n");
13931393 $printed_novcs = 1;
13941394 }
13951395 return 0;
scripts/kconfig/Makefile+8−15
@@ -170,8 +170,8 @@ mconf-objs := mconf.o zconf.tab.o $(lxdialog) · 169 unmodified lines
170170 nconf-objs := nconf.o zconf.tab.o nconf.gui.o
171171 kxgettext-objs := kxgettext.o zconf.tab.o
172172 qconf-cxxobjs := qconf.o
173−qconf-objs := kconfig_load.o zconf.tab.o
174−gconf-objs := gconf.o kconfig_load.o zconf.tab.o
173+qconf-objs := zconf.tab.o
174+gconf-objs := gconf.o zconf.tab.o
175175
176176 hostprogs-y := conf
177177
@@ -203,7 +203,7 @@ ifeq ($(gconf-target),1) · 25 unmodified lines
203203 hostprogs-y += gconf
204204 endif
205205
206−clean-files := lkc_defs.h qconf.moc .tmp_qtcheck .tmp_gtkcheck
206+clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck
207207 clean-files += zconf.tab.c zconf.lex.c zconf.hash.c gconf.glade.h
208208 clean-files += mconf qconf gconf nconf
209209 clean-files += config.pot linux.pot
@@ -226,12 +226,12 @@ HOSTCFLAGS_zconf.tab.o := -I$(src) · 16 unmodified lines
226226 LEX_PREFIX_zconf := zconf
227227 YACC_PREFIX_zconf := zconf
228228
229−HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl
230−HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
229+HOSTLOADLIBES_qconf = $(KC_QT_LIBS)
230+HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS)
231231
232−HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl
232+HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
233233 HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
234− -D LKC_DIRECT_LINK
234+ -Wno-missing-prototypes
235235
236236 HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
237237
@@ -321,18 +321,11 @@ endif · 83 unmodified lines
321321
322322 $(obj)/zconf.tab.o: $(obj)/zconf.lex.c $(obj)/zconf.hash.c
323323
324−$(obj)/kconfig_load.o: $(obj)/lkc_defs.h
325−
326−$(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h
327−
328−$(obj)/gconf.o: $(obj)/lkc_defs.h
324+$(obj)/qconf.o: $(obj)/qconf.moc
329325
330326 $(obj)/%.moc: $(src)/%.h
331327 $(KC_QT_MOC) -i $< -o $@
332328
333−$(obj)/lkc_defs.h: $(src)/lkc_proto.h
334− $(Q)sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
335−
336329 # Extract gconf menu items for I18N support
337330 $(obj)/gconf.glade.h: $(obj)/gconf.glade
338331 $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \
scripts/kconfig/conf.c+39−9
@@ -14,11 +14,11 @@ · 13 unmodified lines
1414 #include <sys/stat.h>
1515 #include <sys/time.h>
1616
17−#define LKC_DIRECT_LINK
1817 #include "lkc.h"
1918
2019 static void conf(struct menu *menu);
2120 static void check_conf(struct menu *menu);
21+static void xfgets(char *str, int size, FILE *in);
2222
2323 enum input_mode {
2424 oldaskconfig,
@@ -35,8 +35,6 @@ enum input_mode { · 10 unmodified lines
3535 oldnoconfig,
3636 } input_mode = oldaskconfig;
3737
38−char *defconfig_file;
39−
4038 static int indent = 1;
4139 static int valid_stdin = 1;
4240 static int sync_kconfig;
@@ -106,6 +104,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) · 63 unmodified lines
106104 return 0;
107105 }
108106 check_stdin();
107+ /* fall through */
109108 case oldaskconfig:
110109 fflush(stdout);
111110 xfgets(line, 128, stdin);
@@ -150,6 +149,7 @@ static int conf_string(struct menu *menu) · 38 unmodified lines
150149 def = NULL;
151150 break;
152151 }
152+ /* fall through */
153153 default:
154154 line[strlen(line)-1] = 0;
155155 def = line;
@@ -304,6 +304,7 @@ static int conf_choice(struct menu *menu) · 148 unmodified lines
304304 break;
305305 }
306306 check_stdin();
307+ /* fall through */
307308 case oldaskconfig:
308309 fflush(stdout);
309310 xfgets(line, 128, stdin);
@@ -369,6 +370,7 @@ static void conf(struct menu *menu) · 59 unmodified lines
369370 check_conf(menu);
370371 return;
371372 }
373+ /* fall through */
372374 case P_COMMENT:
373375 prompt = menu_get_prompt(menu);
374376 if (prompt)
@@ -456,10 +458,30 @@ static struct option long_opts[] = { · 81 unmodified lines
456458 {NULL, 0, NULL, 0}
457459 };
458460
461+static void conf_usage(const char *progname)
462+{
463+
464+ printf("Usage: %s [option] <kconfig-file>\n", progname);
465+ printf("[option] is _one_ of the following:\n");
466+ printf(" --listnewconfig List new options\n");
467+ printf(" --oldaskconfig Start a new configuration using a line-oriented program\n");
468+ printf(" --oldconfig Update a configuration using a provided .config as base\n");
469+ printf(" --silentoldconfig Same as oldconfig, but quietly, additionally update deps\n");
470+ printf(" --oldnoconfig Same as silentoldconfig but set new symbols to no\n");
471+ printf(" --defconfig <file> New config with default defined in <file>\n");
472+ printf(" --savedefconfig <file> Save the minimal current configuration to <file>\n");
473+ printf(" --allnoconfig New config where all options are answered with no\n");
474+ printf(" --allyesconfig New config where all options are answered with yes\n");
475+ printf(" --allmodconfig New config where all options are answered with mod\n");
476+ printf(" --alldefconfig New config with all symbols set to default\n");
477+ printf(" --randconfig New config with random answer to all options\n");
478+}
479+
459480 int main(int ac, char **av)
460481 {
482+ const char *progname = av[0];
461483 int opt;
462− const char *name;
484+ const char *name, *defconfig_file = NULL /* gcc uninit */;
463485 struct stat tmpstat;
464486
465487 setlocale(LC_ALL, "");
@@ -491,14 +513,24 @@ int main(int ac, char **av) · 25 unmodified lines
491513 srand(seed);
492514 break;
493515 }
516+ case oldaskconfig:
517+ case oldconfig:
518+ case allnoconfig:
519+ case allyesconfig:
520+ case allmodconfig:
521+ case alldefconfig:
522+ case listnewconfig:
523+ case oldnoconfig:
524+ break;
494525 case '?':
495− fprintf(stderr, _("See README for usage info\n"));
526+ conf_usage(progname);
496527 exit(1);
497528 break;
498529 }
499530 }
500531 if (ac == optind) {
501532 printf(_("%s: Kconfig file missing\n"), av[0]);
533+ conf_usage(progname);
502534 exit(1);
503535 }
504536 name = av[optind];
@@ -641,13 +673,11 @@ int main(int ac, char **av) · 136 unmodified lines
641673 }
642674 return 0;
643675 }
676+
644677 /*
645678 * Helper function to facilitate fgets() by Jean Sacren.
646679 */
647−void xfgets(str, size, in)
648− char *str;
649− int size;
650− FILE *in;
680+void xfgets(char *str, int size, FILE *in)
651681 {
652682 if (fgets(str, size, in) == NULL)
653683 fprintf(stderr, "\nError in reading or end of file.\n");
scripts/kconfig/confdata.c+194−101
@@ -7,13 +7,13 @@ · 6 unmodified lines
77 #include <ctype.h>
88 #include <errno.h>
99 #include <fcntl.h>
10+#include <stdarg.h>
1011 #include <stdio.h>
1112 #include <stdlib.h>
1213 #include <string.h>
1314 #include <time.h>
1415 #include <unistd.h>
1516
16−#define LKC_DIRECT_LINK
1717 #include "lkc.h"
1818
1919 static void conf_warning(const char *fmt, ...)
@@ -128,6 +128,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) · 108 unmodified lines
128128 sym->flags |= def_flags;
129129 break;
130130 }
131+ /* fall through */
131132 case S_BOOLEAN:
132133 if (p[0] == 'y') {
133134 sym->def[def].tri = yes;
@@ -140,7 +141,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) · 6 unmodified lines
140141 break;
141142 }
142143 conf_warning("symbol value '%s' invalid for %s", p, sym->name);
143− break;
144+ return 1;
144145 case S_OTHER:
145146 if (*p != '"') {
146147 for (p2 = p; *p2 && !isspace(*p2); p2++)
@@ -148,6 +149,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) · 1 unmodified line
148149 sym->type = S_STRING;
149150 goto done;
150151 }
152+ /* fall through */
151153 case S_STRING:
152154 if (*p++ != '"')
153155 break;
@@ -162,6 +164,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) · 8 unmodified lines
162164 conf_warning("invalid string found");
163165 return 1;
164166 }
167+ /* fall through */
165168 case S_INT:
166169 case S_HEX:
167170 done:
@@ -237,6 +240,7 @@ load: · 69 unmodified lines
237240 case S_STRING:
238241 if (sym->def[def].val)
239242 free(sym->def[def].val);
243+ /* fall through */
240244 default:
241245 sym->def[def].val = NULL;
242246 sym->def[def].tri = no;
@@ -363,6 +367,7 @@ int conf_read(const char *name) · 120 unmodified lines
363367 break;
364368 if (!sym_is_choice(sym))
365369 goto sym_ok;
370+ /* fall through */
366371 default:
367372 if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val))
368373 goto sym_ok;
@@ -417,64 +422,202 @@ int conf_read(const char *name) · 48 unmodified lines
417422 return 0;
418423 }
419424
420−/* Write a S_STRING */
421−static void conf_write_string(bool headerfile, const char *name,
422− const char *str, FILE *out)
425+/*
426+ * Kconfig configuration printer
427+ *
428+ * This printer is used when generating the resulting configuration after
429+ * kconfig invocation and `defconfig' files. Unset symbol might be omitted by
430+ * passing a non-NULL argument to the printer.
431+ *
432+ */
433+static void
434+kconfig_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
423435 {
424− int l;
425− if (headerfile)
426− fprintf(out, "#define %s%s \"", CONFIG_, name);
427− else
428− fprintf(out, "%s%s=\"", CONFIG_, name);
429−
430− while (1) {
431− l = strcspn(str, "\"\\");
436+
437+ switch (sym->type) {
438+ case S_BOOLEAN:
439+ case S_TRISTATE:
440+ if (*value == 'n') {
441+ bool skip_unset = (arg != NULL);
442+
443+ if (!skip_unset)
444+ fprintf(fp, "# %s%s is not set\n",
445+ CONFIG_, sym->name);
446+ return;
447+ }
448+ break;
449+ default:
450+ break;
451+ }
452+
453+ fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, value);
454+}
455+
456+static void
457+kconfig_print_comment(FILE *fp, const char *value, void *arg)
458+{
459+ const char *p = value;
460+ size_t l;
461+
462+ for (;;) {
463+ l = strcspn(p, "\n");
464+ fprintf(fp, "#");
432465 if (l) {
433− xfwrite(str, l, 1, out);
434− str += l;
466+ fprintf(fp, " ");
467+ fwrite(p, l, 1, fp);
468+ p += l;
435469 }
436− if (!*str)
470+ fprintf(fp, "\n");
471+ if (*p++ == '\0')
437472 break;
438− fprintf(out, "\\%c", *str++);
439473 }
440− fputs("\"\n", out);
441474 }
442475
443−static void conf_write_symbol(struct symbol *sym, FILE *out, bool write_no)
476+static struct conf_printer kconfig_printer_cb =
477+{
478+ .print_symbol = kconfig_print_symbol,
479+ .print_comment = kconfig_print_comment,
480+};
481+
482+/*
483+ * Header printer
484+ *
485+ * This printer is used when generating the `include/generated/autoconf.h' file.
486+ */
487+static void
488+header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
444489 {
445− const char *str;
446490
447491 switch (sym->type) {
448492 case S_BOOLEAN:
449− case S_TRISTATE:
450− switch (sym_get_tristate_value(sym)) {
451− case no:
452− if (write_no)
453− fprintf(out, "# %s%s is not set\n",
454− CONFIG_, sym->name);
455− break;
456− case mod:
457− fprintf(out, "%s%s=m\n", CONFIG_, sym->name);
458− break;
459− case yes:
460− fprintf(out, "%s%s=y\n", CONFIG_, sym->name);
493+ case S_TRISTATE: {
494+ const char *suffix = "";
495+
496+ switch (*value) {
497+ case 'n':
461498 break;
499+ case 'm':
500+ suffix = "_MODULE";
501+ /* fall through */
502+ default:
503+ fprintf(fp, "#define %s%s%s 1\n",
504+ CONFIG_, sym->name, suffix);
462505 }
506+ /*
507+ * Generate the __enabled_CONFIG_* and
508+ * __enabled_CONFIG_*_MODULE macros for use by the
509+ * IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is
510+ * generated even for booleans so that the IS_ENABLED() macro
511+ * works.
512+ */
513+ fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n",
514+ sym->name, (*value == 'y'));
515+ fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n",
516+ sym->name, (*value == 'm'));
463517 break;
464− case S_STRING:
465− conf_write_string(false, sym->name, sym_get_string_value(sym), out);
518+ }
519+ case S_HEX: {
520+ const char *prefix = "";
521+
522+ if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X'))
523+ prefix = "0x";
524+ fprintf(fp, "#define %s%s %s%s\n",
525+ CONFIG_, sym->name, prefix, value);
466526 break;
467− case S_HEX:
527+ }
528+ case S_STRING:
468529 case S_INT:
469− str = sym_get_string_value(sym);
470− fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str);
530+ fprintf(fp, "#define %s%s %s\n",
531+ CONFIG_, sym->name, value);
532+ break;
533+ default:
471534 break;
535+ }
536+
537+}
538+
539+static void
540+header_print_comment(FILE *fp, const char *value, void *arg)
541+{
542+ const char *p = value;
543+ size_t l;
544+
545+ fprintf(fp, "/*\n");
546+ for (;;) {
547+ l = strcspn(p, "\n");
548+ fprintf(fp, " *");
549+ if (l) {
550+ fprintf(fp, " ");
551+ fwrite(p, l, 1, fp);
552+ p += l;
553+ }
554+ fprintf(fp, "\n");
555+ if (*p++ == '\0')
556+ break;
557+ }
558+ fprintf(fp, " */\n");
559+}
560+
561+static struct conf_printer header_printer_cb =
562+{
563+ .print_symbol = header_print_symbol,
564+ .print_comment = header_print_comment,
565+};
566+
567+/*
568+ * Tristate printer
569+ *
570+ * This printer is used when generating the `include/config/tristate.conf' file.
571+ */
572+static void
573+tristate_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
574+{
575+
576+ if (sym->type == S_TRISTATE && *value != 'n')
577+ fprintf(fp, "%s%s=%c\n", CONFIG_, sym->name, (char)toupper(*value));
578+}
579+
580+static struct conf_printer tristate_printer_cb =
581+{
582+ .print_symbol = tristate_print_symbol,
583+ .print_comment = kconfig_print_comment,
584+};
585+
586+static void conf_write_symbol(FILE *fp, struct symbol *sym,
587+ struct conf_printer *printer, void *printer_arg)
588+{
589+ const char *str;
590+
591+ switch (sym->type) {
472592 case S_OTHER:
473593 case S_UNKNOWN:
474594 break;
595+ case S_STRING:
596+ str = sym_get_string_value(sym);
597+ str = sym_escape_string_value(str);
598+ printer->print_symbol(fp, sym, str, printer_arg);
599+ free((void *)str);
600+ break;
601+ default:
602+ str = sym_get_string_value(sym);
603+ printer->print_symbol(fp, sym, str, printer_arg);
475604 }
476605 }
477606
607+static void
608+conf_write_heading(FILE *fp, struct conf_printer *printer, void *printer_arg)
609+{
610+ char buf[256];
611+
612+ snprintf(buf, sizeof(buf),
613+ "\n"
614+ "Automatically generated file; DO NOT EDIT.\n"
615+ "%s\n",
616+ rootmenu.prompt->text);
617+
618+ printer->print_comment(fp, buf, printer_arg);
619+}
620+
478621 /*
479622 * Write out a minimal config.
480623 * All values that has default values are skipped as this is redundant.
@@ -531,7 +674,7 @@ int conf_write_defconfig(const char *filename) · 50 unmodified lines
531674 goto next_menu;
532675 }
533676 }
534− conf_write_symbol(sym, out, true);
677+ conf_write_symbol(out, sym, &kconfig_printer_cb, NULL);
535678 }
536679 next_menu:
537680 if (menu->list != NULL) {
@@ -596,11 +739,7 @@ int conf_write(const char *name) · 58 unmodified lines
596739 if (!out)
597740 return 1;
598741
599− fprintf(out, _("#\n"
600− "# Automatically generated make config: don't edit\n"
601− "# %s\n"
602− "#\n"),
603− rootmenu.prompt->text);
742+ conf_write_heading(out, &kconfig_printer_cb, NULL);
604743
605744 if (!conf_get_changed())
606745 sym_clear_all_valid();
@@ -621,8 +760,8 @@ int conf_write(const char *name) · 14 unmodified lines
621760 if (!(sym->flags & SYMBOL_WRITE))
622761 goto next;
623762 sym->flags &= ~SYMBOL_WRITE;
624− /* Write config symbol to file */
625− conf_write_symbol(sym, out, true);
763+
764+ conf_write_symbol(out, sym, &kconfig_printer_cb, NULL);
626765 }
627766
628767 next:
@@ -771,7 +910,6 @@ out: · 142 unmodified lines
771910 int conf_write_autoconf(void)
772911 {
773912 struct symbol *sym;
774− const char *str;
775913 const char *name;
776914 FILE *out, *tristate, *out_h;
777915 int i;
@@ -800,68 +938,23 @@ int conf_write_autoconf(void) · 22 unmodified lines
800938 return 1;
801939 }
802940
803− fprintf(out, "#\n"
804− "# Automatically generated make config: don't edit\n"
805− "# %s\n"
806− "#\n",
807− rootmenu.prompt->text);
808− fprintf(tristate, "#\n"
809− "# Automatically generated - do not edit\n"
810− "\n");
811− fprintf(out_h, "/*\n"
812− " * Automatically generated C config: don't edit\n"
813− " * %s\n"
814− " */\n",
815− rootmenu.prompt->text);
941+ conf_write_heading(out, &kconfig_printer_cb, NULL);
942+
943+ conf_write_heading(tristate, &tristate_printer_cb, NULL);
944+
945+ conf_write_heading(out_h, &header_printer_cb, NULL);
816946
817947 for_all_symbols(i, sym) {
818948 sym_calc_value(sym);
819949 if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
820950 continue;
821951
822− /* write symbol to config file */
823− conf_write_symbol(sym, out, false);
952+ /* write symbol to auto.conf, tristate and header files */
953+ conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);
824954
825− /* update autoconf and tristate files */
826− switch (sym->type) {
827− case S_BOOLEAN:
828− case S_TRISTATE:
829− switch (sym_get_tristate_value(sym)) {
830− case no:
831− break;
832− case mod:
833− fprintf(tristate, "%s%s=M\n",
834− CONFIG_, sym->name);
835− fprintf(out_h, "#define %s%s_MODULE 1\n",
836− CONFIG_, sym->name);
837− break;
838− case yes:
839− if (sym->type == S_TRISTATE)
840− fprintf(tristate,"%s%s=Y\n",
841− CONFIG_, sym->name);
842− fprintf(out_h, "#define %s%s 1\n",
843− CONFIG_, sym->name);
844− break;
845− }
846− break;
847− case S_STRING:
848− conf_write_string(true, sym->name, sym_get_string_value(sym), out_h);
849− break;
850− case S_HEX:
851− str = sym_get_string_value(sym);
852− if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
853− fprintf(out_h, "#define %s%s 0x%s\n",
854− CONFIG_, sym->name, str);
855− break;
856− }
857− case S_INT:
858− str = sym_get_string_value(sym);
859− fprintf(out_h, "#define %s%s %s\n",
860− CONFIG_, sym->name, str);
861− break;
862− default:
863− break;
864− }
955+ conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1);
956+
957+ conf_write_symbol(out_h, sym, &header_printer_cb, NULL);
865958 }
866959 fclose(out);
867960 fclose(tristate);
scripts/kconfig/expr.c+4−9
@@ -7,15 +7,13 @@ · 6 unmodified lines
77 #include <stdlib.h>
88 #include <string.h>
99
10−#define LKC_DIRECT_LINK
1110 #include "lkc.h"
1211
1312 #define DEBUG_EXPR 0
1413
1514 struct expr *expr_alloc_symbol(struct symbol *sym)
1615 {
17− struct expr *e = malloc(sizeof(*e));
18− memset(e, 0, sizeof(*e));
16+ struct expr *e = calloc(1, sizeof(*e));
1917 e->type = E_SYMBOL;
2018 e->left.sym = sym;
2119 return e;
@@ -23,8 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym) · 1 unmodified line
2321
2422 struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
2523 {
26− struct expr *e = malloc(sizeof(*e));
27− memset(e, 0, sizeof(*e));
24+ struct expr *e = calloc(1, sizeof(*e));
2825 e->type = type;
2926 e->left.expr = ce;
3027 return e;
@@ -32,8 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) · 1 unmodified line
3229
3330 struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)
3431 {
35− struct expr *e = malloc(sizeof(*e));
36− memset(e, 0, sizeof(*e));
32+ struct expr *e = calloc(1, sizeof(*e));
3733 e->type = type;
3834 e->left.expr = e1;
3935 e->right.expr = e2;
@@ -42,8 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e · 2 unmodified lines
4238
4339 struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2)
4440 {
45− struct expr *e = malloc(sizeof(*e));
46− memset(e, 0, sizeof(*e));
41+ struct expr *e = calloc(1, sizeof(*e));
4742 e->type = type;
4843 e->left.sym = s1;
4944 e->right.sym = s2;
scripts/kconfig/expr.h+0−3
@@ -172,8 +172,6 @@ struct menu { · 171 unmodified lines
172172 #define MENU_CHANGED 0x0001
173173 #define MENU_ROOT 0x0002
174174
175−#ifndef SWIG
176−
177175 extern struct file *file_list;
178176 extern struct file *current_file;
179177 struct file *lookup_file(const char *name);
@@ -218,7 +216,6 @@ static inline int expr_is_no(struct expr *e) · 38 unmodified lines
218216 {
219217 return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no);
220218 }
221−#endif
222219
223220 #ifdef __cplusplus
224221 }
scripts/kconfig/gconf.c+1−37
@@ -285,8 +285,6 @@ void init_left_tree(void) · 284 unmodified lines
285285 static void renderer_edited(GtkCellRendererText * cell,
286286 const gchar * path_string,
287287 const gchar * new_text, gpointer user_data);
288−static void renderer_toggled(GtkCellRendererToggle * cellrenderertoggle,
289− gchar * arg1, gpointer user_data);
290288
291289 void init_right_tree(void)
292290 {
@@ -320,8 +318,6 @@ void init_right_tree(void) · 27 unmodified lines
320318 "inconsistent", COL_BTNINC,
321319 "visible", COL_BTNVIS,
322320 "radio", COL_BTNRAD, NULL);
323− /*g_signal_connect(G_OBJECT(renderer), "toggled",
324− G_CALLBACK(renderer_toggled), NULL); */
325321 renderer = gtk_cell_renderer_text_new();
326322 gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
327323 renderer, FALSE);
@@ -888,35 +884,6 @@ static void toggle_sym_value(struct menu *menu) · 560 unmodified lines
888884 display_tree_part(); //fixme: keep exp/coll
889885 }
890886
891−static void renderer_toggled(GtkCellRendererToggle * cell,
892− gchar * path_string, gpointer user_data)
893−{
894− GtkTreePath *path, *sel_path = NULL;
895− GtkTreeIter iter, sel_iter;
896− GtkTreeSelection *sel;
897− struct menu *menu;
898−
899− path = gtk_tree_path_new_from_string(path_string);
900− if (!gtk_tree_model_get_iter(model2, &iter, path))
901− return;
902−
903− sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree2_w));
904− if (gtk_tree_selection_get_selected(sel, NULL, &sel_iter))
905− sel_path = gtk_tree_model_get_path(model2, &sel_iter);
906− if (!sel_path)
907− goto out1;
908− if (gtk_tree_path_compare(path, sel_path))
909− goto out2;
910−
911− gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1);
912− toggle_sym_value(menu);
913−
914− out2:
915− gtk_tree_path_free(sel_path);
916− out1:
917− gtk_tree_path_free(path);
918−}
919−
920887 static gint column2index(GtkTreeViewColumn * column)
921888 {
922889 gint i;
@@ -1172,6 +1139,7 @@ static gchar **fill_row(struct menu *menu) · 249 unmodified lines
11721139 row[COL_BTNVIS] = GINT_TO_POINTER(TRUE);
11731140 if (sym_is_choice(sym))
11741141 break;
1142+ /* fall through */
11751143 case S_TRISTATE:
11761144 val = sym_get_tristate_value(sym);
11771145 switch (val) {
@@ -1506,10 +1474,6 @@ int main(int ac, char *av[]) · 328 unmodified lines
15061474 char *env;
15071475 gchar *glade_file;
15081476
1509−#ifndef LKC_DIRECT_LINK
1510− kconfig_load();
1511−#endif
1512−
15131477 bindtextdomain(PACKAGE, LOCALEDIR);
15141478 bind_textdomain_codeset(PACKAGE, "UTF-8");
15151479 textdomain(PACKAGE);
scripts/kconfig/kconfig_load.c+0−35
@@ -1,35 +0,0 @@
1−#include <dlfcn.h>
2−#include <stdio.h>
3−#include <stdlib.h>
4−
5−#include "lkc.h"
6−
7−#define P(name,type,arg) type (*name ## _p) arg
8−#include "lkc_proto.h"
9−#undef P
10−
11−void kconfig_load(void)
12−{
13− void *handle;
14− char *error;
15−
16− handle = dlopen("./libkconfig.so", RTLD_LAZY);
17− if (!handle) {
18− handle = dlopen("./scripts/kconfig/libkconfig.so", RTLD_LAZY);
19− if (!handle) {
20− fprintf(stderr, "%s\n", dlerror());
21− exit(1);
22− }
23− }
24−
25−#define P(name,type,arg) \
26−{ \
27− name ## _p = dlsym(handle, #name); \
28− if ((error = dlerror())) { \
29− fprintf(stderr, "%s\n", error); \
30− exit(1); \
31− } \
32−}
33−#include "lkc_proto.h"
34−#undef P
35−}
scripts/kconfig/kxgettext.c+0−1
@@ -7,7 +7,6 @@ · 6 unmodified lines
77 #include <stdlib.h>
88 #include <string.h>
99
10−#define LKC_DIRECT_LINK
1110 #include "lkc.h"
1211
1312 static char *escape(const char* text, char *bf, int len)
scripts/kconfig/lkc.h+5−11
@@ -21,12 +21,7 @@ static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; · 20 unmodified lines
2121 extern "C" {
2222 #endif
2323
24−#ifdef LKC_DIRECT_LINK
2524 #define P(name,type,arg) extern type name arg
26−#else
27−#include "lkc_defs.h"
28−#define P(name,type,arg) extern type (*name ## _p) arg
29−#endif
3025 #include "lkc_proto.h"
3126 #undef P
3227
@@ -79,9 +74,6 @@ void zconf_nextfile(const char *name); · 46 unmodified lines
7974 int zconf_lineno(void);
8075 const char *zconf_curname(void);
8176
82−/* conf.c */
83−void xfgets(char *str, int size, FILE *in);
84−
8577 /* confdata.c */
8678 const char *conf_get_configname(void);
8779 const char *conf_get_autoconfig_name(void);
@@ -90,6 +82,11 @@ void sym_set_change_count(int count); · 2 unmodified lines
9082 void sym_add_change_count(int count);
9183 void conf_set_all_new_symbols(enum conf_def_mode mode);
9284
85+struct conf_printer {
86+ void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
87+ void (*print_comment)(FILE *, const char *, void *);
88+};
89+
9390 /* confdata.c and expr.c */
9491 static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
9592 {
@@ -97,9 +94,6 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) · 1 unmodified line
9794 fprintf(stderr, "\nError in writing or end of file.\n");
9895 }
9996
100−/* kconfig_load.c */
101−void kconfig_load(void);
102−
10397 /* menu.c */
10498 void _menu_init(void);
10599 void menu_warn(struct menu *menu, const char *fmt, ...);
scripts/kconfig/lkc_proto.h+1−0
@@ -31,6 +31,7 @@ P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); · 30 unmodified lines
3131 P(sym_lookup,struct symbol *,(const char *name, int flags));
3232 P(sym_find,struct symbol *,(const char *name));
3333 P(sym_expand_string_value,const char *,(const char *in));
34+P(sym_escape_string_value, const char *,(const char *in));
3435 P(sym_re_search,struct symbol **,(const char *pattern));
3536 P(sym_type_name,const char *,(enum symbol_type type));
3637 P(sym_calc_value,void,(struct symbol *sym));
scripts/kconfig/mconf.c+1−1
@@ -18,7 +18,6 @@ · 17 unmodified lines
1818 #include <unistd.h>
1919 #include <locale.h>
2020
21−#define LKC_DIRECT_LINK
2221 #include "lkc.h"
2322 #include "lxdialog/dialog.h"
2423
@@ -845,6 +844,7 @@ int main(int ac, char **av) · 820 unmodified lines
845844 "\n\n"));
846845 return 1;
847846 }
847+ /* fall through */
848848 case -1:
849849 printf(_("\n\n"
850850 "*** End of the configuration.\n"
scripts/kconfig/menu.c+3−2
@@ -3,10 +3,11 @@ · 2 unmodified lines
33 * Released under the terms of the GNU GPL v2.0.
44 */
55
6+#include <ctype.h>
7+#include <stdarg.h>
68 #include <stdlib.h>
79 #include <string.h>
810
9−#define LKC_DIRECT_LINK
1011 #include "lkc.h"
1112
1213 static const char nohelp_text[] = N_(
@@ -350,7 +351,7 @@ void menu_finalize(struct menu *parent) · 337 unmodified lines
350351 last_menu->next = NULL;
351352 }
352353
353− sym->dir_dep.expr = parent->dep;
354+ sym->dir_dep.expr = expr_alloc_or(sym->dir_dep.expr, parent->dep);
354355 }
355356 for (menu = parent->list; menu; menu = menu->next) {
356357 if (sym && sym_is_choice(sym) &&
scripts/kconfig/nconf.c+9−21
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 */
88 #define _GNU_SOURCE
99 #include <string.h>
10−#define LKC_DIRECT_LINK
10+
1111 #include "lkc.h"
1212 #include "nconf.h"
1313 #include <ctype.h>
@@ -1067,7 +1067,6 @@ static void conf(struct menu *menu) · 1053 unmodified lines
10671067 struct menu *submenu = 0;
10681068 const char *prompt = menu_get_prompt(menu);
10691069 struct symbol *sym;
1070− struct menu *active_menu = NULL;
10711070 int res;
10721071 int current_index = 0;
10731072 int last_top_row = 0;
@@ -1152,13 +1151,9 @@ static void conf(struct menu *menu) · 78 unmodified lines
11521151 continue;
11531152
11541153 submenu = (struct menu *) item_data();
1155− active_menu = (struct menu *)item_data();
11561154 if (!submenu || !menu_is_visible(submenu))
11571155 continue;
1158− if (submenu)
1159− sym = submenu->sym;
1160− else
1161− sym = NULL;
1156+ sym = submenu->sym;
11621157
11631158 switch (res) {
11641159 case ' ':
@@ -1222,20 +1217,13 @@ static void conf_message_callback(const char *fmt, va_list ap) · 57 unmodified lines
12221217
12231218 static void show_help(struct menu *menu)
12241219 {
1225− struct gstr help = str_new();
1226−
1227− if (menu && menu->sym && menu_has_help(menu)) {
1228− if (menu->sym->name) {
1229− str_printf(&help, "%s%s:\n\n", CONFIG_, menu->sym->name);
1230− str_append(&help, _(menu_get_help(menu)));
1231− str_append(&help, "\n");
1232− get_symbol_str(&help, menu->sym);
1233− } else {
1234− str_append(&help, _(menu_get_help(menu)));
1235− }
1236− } else {
1237− str_append(&help, nohelp_text);
1238− }
1220+ struct gstr help;
1221+
1222+ if (!menu)
1223+ return;
1224+
1225+ help = str_new();
1226+ menu_get_ext_help(menu, &help);
12391227 show_scroll_win(main_window, _(menu_get_prompt(menu)), str_get(&help));
12401228 str_free(&help);
12411229 }
scripts/kconfig/qconf.cc+10−7
@@ -1478,10 +1478,13 @@ void ConfigMainWindow::loadConfig(void) · 1477 unmodified lines
14781478 ConfigView::updateListAll();
14791479 }
14801480
1481−void ConfigMainWindow::saveConfig(void)
1481+bool ConfigMainWindow::saveConfig(void)
14821482 {
1483− if (conf_write(NULL))
1483+ if (conf_write(NULL)) {
14841484 QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
1485+ return false;
1486+ }
1487+ return true;
14851488 }
14861489
14871490 void ConfigMainWindow::saveConfigAs(void)
@@ -1642,7 +1645,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) · 154 unmodified lines
16421645 mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit"));
16431646 switch (mb.exec()) {
16441647 case QMessageBox::Yes:
1645− saveConfig();
1648+ if (saveConfig())
1649+ e->accept();
1650+ else
1651+ e->ignore();
1652+ break;
16461653 case QMessageBox::No:
16471654 e->accept();
16481655 break;
@@ -1745,10 +1752,6 @@ int main(int ac, char** av) · 96 unmodified lines
17451752 bindtextdomain(PACKAGE, LOCALEDIR);
17461753 textdomain(PACKAGE);
17471754
1748−#ifndef LKC_DIRECT_LINK
1749− kconfig_load();
1750−#endif
1751−
17521755 progname = av[0];
17531756 configApp = new QApplication(ac, av);
17541757 if (ac > 1 && av[1][0] == '-') {
scripts/kconfig/qconf.h+1−1
@@ -311,7 +311,7 @@ public slots: · 310 unmodified lines
311311 void listFocusChanged(void);
312312 void goBack(void);
313313 void loadConfig(void);
314− void saveConfig(void);
314+ bool saveConfig(void);
315315 void saveConfigAs(void);
316316 void searchConfig(void);
317317 void showSingleView(void);
scripts/kconfig/symbol.c+45−2
@@ -9,7 +9,6 @@ · 8 unmodified lines
99 #include <regex.h>
1010 #include <sys/utsname.h>
1111
12−#define LKC_DIRECT_LINK
1312 #include "lkc.h"
1413
1514 struct symbol symbol_yes = {
@@ -751,7 +750,8 @@ const char *sym_get_string_value(struct symbol *sym) · 735 unmodified lines
751750 case no:
752751 return "n";
753752 case mod:
754− return "m";
753+ sym_calc_value(modules_sym);
754+ return (modules_sym->curr.tri == no) ? "n" : "m";
755755 case yes:
756756 return "y";
757757 }
@@ -893,6 +893,49 @@ const char *sym_expand_string_value(const char *in) · 135 unmodified lines
893893 return res;
894894 }
895895
896+const char *sym_escape_string_value(const char *in)
897+{
898+ const char *p;
899+ size_t reslen;
900+ char *res;
901+ size_t l;
902+
903+ reslen = strlen(in) + strlen("\"\"") + 1;
904+
905+ p = in;
906+ for (;;) {
907+ l = strcspn(p, "\"\\");
908+ p += l;
909+
910+ if (p[0] == '\0')
911+ break;
912+
913+ reslen++;
914+ p++;
915+ }
916+
917+ res = malloc(reslen);
918+ res[0] = '\0';
919+
920+ strcat(res, "\"");
921+
922+ p = in;
923+ for (;;) {
924+ l = strcspn(p, "\"\\");
925+ strncat(res, p, l);
926+ p += l;
927+
928+ if (p[0] == '\0')
929+ break;
930+
931+ strcat(res, "\\");
932+ strncat(res, p++, 1);
933+ }
934+
935+ strcat(res, "\"");
936+ return res;
937+}
938+
896939 struct symbol **sym_re_search(const char *pattern)
897940 {
898941 struct symbol *sym, **sym_arr = NULL;
scripts/kconfig/util.c+2−0
@@ -5,6 +5,8 @@ · 4 unmodified lines
55 * Released under the terms of the GNU GPL v2.0.
66 */
77
8+#include <stdarg.h>
9+#include <stdlib.h>
810 #include <string.h>
911 #include "lkc.h"
1012
scripts/kconfig/zconf.l+0−1
@@ -14,7 +14,6 @@ · 13 unmodified lines
1414 #include <string.h>
1515 #include <unistd.h>
1616
17−#define LKC_DIRECT_LINK
1817 #include "lkc.h"
1918
2019 #define START_STRSIZE 16
scripts/kconfig/zconf.lex.c_shipped+0−1
@@ -776,7 +776,6 @@ char *zconftext; · 775 unmodified lines
776776 #include <string.h>
777777 #include <unistd.h>
778778
779−#define LKC_DIRECT_LINK
780779 #include "lkc.h"
781780
782781 #define START_STRSIZE 16
scripts/kconfig/zconf.tab.c_shipped+0−1
@@ -87,7 +87,6 @@ · 86 unmodified lines
8787 #include <string.h>
8888 #include <stdbool.h>
8989
90−#define LKC_DIRECT_LINK
9190 #include "lkc.h"
9291
9392 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
scripts/kconfig/zconf.y+0−1
@@ -11,7 +11,6 @@ · 10 unmodified lines
1111 #include <string.h>
1212 #include <stdbool.h>
1313
14−#define LKC_DIRECT_LINK
1514 #include "lkc.h"
1615
1716 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t