Commit 287b901dcadd7eb3c5aa93b679bbad4058814921
Exists in
master
and in
6 other branches
Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
* 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: menuconfig: fix a regression when canceling the prompt dialog at exit kbuild: Fix compiler warning with assertion when calling 'fwrite' Improve update-po-config output menuconfig: let make not report error when not save configuration merge_config.sh: fix bug in final check merge_config.sh: whitespace cleanup merge_config.sh: use signal names compatible with dash and bash kconfig: add merge_config.sh script kconfig: use xfwrite wrapper function to silence warnings kconfig: fix set but not used warnings kconfig: fix warnings by specifing format arguments
Showing 7 changed files Side-by-side Diff
scripts/kconfig/Makefile
... | ... | @@ -50,9 +50,8 @@ |
50 | 50 | |
51 | 51 | # Create new linux.pot file |
52 | 52 | # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files |
53 | -# The symlink is used to repair a deficiency in arch/um | |
54 | 53 | update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h |
55 | - $(Q)echo " GEN config" | |
54 | + $(Q)echo " GEN config.pot" | |
56 | 55 | $(Q)xgettext --default-domain=linux \ |
57 | 56 | --add-comments --keyword=_ --keyword=N_ \ |
58 | 57 | --from-code=UTF-8 \ |
59 | 58 | |
... | ... | @@ -63,10 +62,11 @@ |
63 | 62 | $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \ |
64 | 63 | $(srctree)/arch/*/um/Kconfig`; \ |
65 | 64 | do \ |
66 | - echo " GEN $$i"; \ | |
65 | + echo " GEN $$i"; \ | |
67 | 66 | $(obj)/kxgettext $$i \ |
68 | 67 | >> $(obj)/config.pot; \ |
69 | 68 | done ) |
69 | + $(Q)echo " GEN linux.pot" | |
70 | 70 | $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ |
71 | 71 | --output $(obj)/linux.pot |
72 | 72 | $(Q)rm -f $(obj)/config.pot |
scripts/kconfig/confdata.c
... | ... | @@ -464,7 +464,7 @@ |
464 | 464 | fprintf(fp, "#"); |
465 | 465 | if (l) { |
466 | 466 | fprintf(fp, " "); |
467 | - fwrite(p, l, 1, fp); | |
467 | + xfwrite(p, l, 1, fp); | |
468 | 468 | p += l; |
469 | 469 | } |
470 | 470 | fprintf(fp, "\n"); |
... | ... | @@ -537,7 +537,7 @@ |
537 | 537 | fprintf(fp, " *"); |
538 | 538 | if (l) { |
539 | 539 | fprintf(fp, " "); |
540 | - fwrite(p, l, 1, fp); | |
540 | + xfwrite(p, l, 1, fp); | |
541 | 541 | p += l; |
542 | 542 | } |
543 | 543 | fprintf(fp, "\n"); |
scripts/kconfig/expr.h
scripts/kconfig/gconf.c
... | ... | @@ -683,7 +683,7 @@ |
683 | 683 | dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), |
684 | 684 | GTK_DIALOG_DESTROY_WITH_PARENT, |
685 | 685 | GTK_MESSAGE_INFO, |
686 | - GTK_BUTTONS_CLOSE, intro_text); | |
686 | + GTK_BUTTONS_CLOSE, "%s", intro_text); | |
687 | 687 | g_signal_connect_swapped(GTK_OBJECT(dialog), "response", |
688 | 688 | G_CALLBACK(gtk_widget_destroy), |
689 | 689 | GTK_OBJECT(dialog)); |
... | ... | @@ -701,7 +701,7 @@ |
701 | 701 | dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), |
702 | 702 | GTK_DIALOG_DESTROY_WITH_PARENT, |
703 | 703 | GTK_MESSAGE_INFO, |
704 | - GTK_BUTTONS_CLOSE, about_text); | |
704 | + GTK_BUTTONS_CLOSE, "%s", about_text); | |
705 | 705 | g_signal_connect_swapped(GTK_OBJECT(dialog), "response", |
706 | 706 | G_CALLBACK(gtk_widget_destroy), |
707 | 707 | GTK_OBJECT(dialog)); |
... | ... | @@ -720,7 +720,7 @@ |
720 | 720 | dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), |
721 | 721 | GTK_DIALOG_DESTROY_WITH_PARENT, |
722 | 722 | GTK_MESSAGE_INFO, |
723 | - GTK_BUTTONS_CLOSE, license_text); | |
723 | + GTK_BUTTONS_CLOSE, "%s", license_text); | |
724 | 724 | g_signal_connect_swapped(GTK_OBJECT(dialog), "response", |
725 | 725 | G_CALLBACK(gtk_widget_destroy), |
726 | 726 | GTK_OBJECT(dialog)); |
... | ... | @@ -830,7 +830,7 @@ |
830 | 830 | static void change_sym_value(struct menu *menu, gint col) |
831 | 831 | { |
832 | 832 | struct symbol *sym = menu->sym; |
833 | - tristate oldval, newval; | |
833 | + tristate newval; | |
834 | 834 | |
835 | 835 | if (!sym) |
836 | 836 | return; |
... | ... | @@ -847,7 +847,6 @@ |
847 | 847 | switch (sym_get_type(sym)) { |
848 | 848 | case S_BOOLEAN: |
849 | 849 | case S_TRISTATE: |
850 | - oldval = sym_get_tristate_value(sym); | |
851 | 850 | if (!sym_tristate_within_range(sym, newval)) |
852 | 851 | newval = yes; |
853 | 852 | sym_set_tristate_value(sym, newval); |
... | ... | @@ -1278,7 +1277,6 @@ |
1278 | 1277 | gboolean valid; |
1279 | 1278 | GtkTreeIter *sibling; |
1280 | 1279 | struct symbol *sym; |
1281 | - struct property *prop; | |
1282 | 1280 | struct menu *menu1, *menu2; |
1283 | 1281 | |
1284 | 1282 | if (src == &rootmenu) |
... | ... | @@ -1287,7 +1285,6 @@ |
1287 | 1285 | valid = gtk_tree_model_iter_children(model2, child2, dst); |
1288 | 1286 | for (child1 = src->list; child1; child1 = child1->next) { |
1289 | 1287 | |
1290 | - prop = child1->prompt; | |
1291 | 1288 | sym = child1->sym; |
1292 | 1289 | |
1293 | 1290 | reparse: |
scripts/kconfig/lkc.h
... | ... | @@ -90,8 +90,10 @@ |
90 | 90 | /* confdata.c and expr.c */ |
91 | 91 | static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) |
92 | 92 | { |
93 | - if (fwrite(str, len, count, out) < count) | |
94 | - fprintf(stderr, "\nError in writing or end of file.\n"); | |
93 | + assert(len != 0); | |
94 | + | |
95 | + if (fwrite(str, len, count, out) != count) | |
96 | + fprintf(stderr, "Error in writing or end of file.\n"); | |
95 | 97 | } |
96 | 98 | |
97 | 99 | /* menu.c */ |
scripts/kconfig/mconf.c
scripts/kconfig/merge_config.sh
1 | +#!/bin/sh | |
2 | +# merge_config.sh - Takes a list of config fragment values, and merges | |
3 | +# them one by one. Provides warnings on overridden values, and specified | |
4 | +# values that did not make it to the resulting .config file (due to missed | |
5 | +# dependencies or config symbol removal). | |
6 | +# | |
7 | +# Portions reused from kconf_check and generate_cfg: | |
8 | +# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/kconf_check | |
9 | +# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/generate_cfg | |
10 | +# | |
11 | +# Copyright (c) 2009-2010 Wind River Systems, Inc. | |
12 | +# Copyright 2011 Linaro | |
13 | +# | |
14 | +# This program is free software; you can redistribute it and/or modify | |
15 | +# it under the terms of the GNU General Public License version 2 as | |
16 | +# published by the Free Software Foundation. | |
17 | +# | |
18 | +# This program is distributed in the hope that it will be useful, | |
19 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
21 | +# See the GNU General Public License for more details. | |
22 | + | |
23 | +clean_up() { | |
24 | + rm -f $TMP_FILE | |
25 | + exit | |
26 | +} | |
27 | +trap clean_up HUP INT TERM | |
28 | + | |
29 | +usage() { | |
30 | + echo "Usage: $0 [OPTIONS] [CONFIG [...]]" | |
31 | + echo " -h display this help text" | |
32 | + echo " -m only merge the fragments, do not execute the make command" | |
33 | + echo " -n use allnoconfig instead of alldefconfig" | |
34 | +} | |
35 | + | |
36 | +MAKE=true | |
37 | +ALLTARGET=alldefconfig | |
38 | + | |
39 | +while true; do | |
40 | + case $1 in | |
41 | + "-n") | |
42 | + ALLTARGET=allnoconfig | |
43 | + shift | |
44 | + continue | |
45 | + ;; | |
46 | + "-m") | |
47 | + MAKE=false | |
48 | + shift | |
49 | + continue | |
50 | + ;; | |
51 | + "-h") | |
52 | + usage | |
53 | + exit | |
54 | + ;; | |
55 | + *) | |
56 | + break | |
57 | + ;; | |
58 | + esac | |
59 | +done | |
60 | + | |
61 | + | |
62 | + | |
63 | +MERGE_LIST=$* | |
64 | +SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" | |
65 | +TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) | |
66 | + | |
67 | +# Merge files, printing warnings on overrided values | |
68 | +for MERGE_FILE in $MERGE_LIST ; do | |
69 | + echo "Merging $MERGE_FILE" | |
70 | + CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE) | |
71 | + | |
72 | + for CFG in $CFG_LIST ; do | |
73 | + grep -q -w $CFG $TMP_FILE | |
74 | + if [ $? -eq 0 ] ; then | |
75 | + PREV_VAL=$(grep -w $CFG $TMP_FILE) | |
76 | + NEW_VAL=$(grep -w $CFG $MERGE_FILE) | |
77 | + if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then | |
78 | + echo Value of $CFG is redefined by fragment $MERGE_FILE: | |
79 | + echo Previous value: $PREV_VAL | |
80 | + echo New value: $NEW_VAL | |
81 | + echo | |
82 | + fi | |
83 | + sed -i "/$CFG[ =]/d" $TMP_FILE | |
84 | + fi | |
85 | + done | |
86 | + cat $MERGE_FILE >> $TMP_FILE | |
87 | +done | |
88 | + | |
89 | +if [ "$MAKE" = "false" ]; then | |
90 | + cp $TMP_FILE .config | |
91 | + echo "#" | |
92 | + echo "# merged configuration written to .config (needs make)" | |
93 | + echo "#" | |
94 | + clean_up | |
95 | + exit | |
96 | +fi | |
97 | + | |
98 | +# Use the merged file as the starting point for: | |
99 | +# alldefconfig: Fills in any missing symbols with Kconfig default | |
100 | +# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set | |
101 | +make KCONFIG_ALLCONFIG=$TMP_FILE $ALLTARGET | |
102 | + | |
103 | + | |
104 | +# Check all specified config values took (might have missed-dependency issues) | |
105 | +for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do | |
106 | + | |
107 | + REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) | |
108 | + ACTUAL_VAL=$(grep -w -e "$CFG" .config) | |
109 | + if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then | |
110 | + echo "Value requested for $CFG not in final .config" | |
111 | + echo "Requested value: $REQUESTED_VAL" | |
112 | + echo "Actual value: $ACTUAL_VAL" | |
113 | + echo "" | |
114 | + fi | |
115 | +done | |
116 | + | |
117 | +clean_up |