Commit 9a61df9e authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'kbuild-v4.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull more Kbuild updates from Masahiro Yamada:
 "Makefile changes:
   - enable unused-variable warning that was wrongly disabled for clang

  Kconfig changes:
   - warn about blank 'help' and fix existing instances
   - fix 'choice' behavior to not write out invisible symbols
   - fix misc weirdness

  Coccinell changes:
   - fix false positive of free after managed memory alloc detection
   - improve performance of NULL dereference detection"

* tag 'kbuild-v4.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (21 commits)
  kconfig: remove const qualifier from sym_expand_string_value()
  kconfig: add xrealloc() helper
  kconfig: send error messages to stderr
  kconfig: echo stdin to stdout if either is redirected
  kconfig: remove check_stdin()
  kconfig: remove 'config*' pattern from .gitignnore
  kconfig: show '?' prompt even if no help text is available
  kconfig: do not write choice values when their dependency becomes n
  coccinelle: deref_null: avoid useless computation
  coccinelle: devm_free: reduce false positives
  kbuild: clang: disable unused variable warnings only when constant
  kconfig: Warn if help text is blank
  nios2: kconfig: Remove blank help text
  arm: vt8500: kconfig: Remove blank help text
  MIPS: kconfig: Remove blank help text
  MIPS: BCM63XX: kconfig: Remove blank help text
  lib/Kconfig.debug: Remove blank help text
  Staging: rtl8192e: kconfig: Remove blank help text
  Staging: rtl8192u: kconfig: Remove blank help text
  mmc: kconfig: Remove blank help text
  ...
parents 7a501609 523ca58b
...@@ -729,7 +729,6 @@ endif ...@@ -729,7 +729,6 @@ endif
ifeq ($(cc-name),clang) ifeq ($(cc-name),clang)
KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)
KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
KBUILD_CFLAGS += $(call cc-disable-warning, gnu) KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
...@@ -747,9 +746,9 @@ else ...@@ -747,9 +746,9 @@ else
# These warnings generated too much noise in a regular build. # These warnings generated too much noise in a regular build.
# Use make W=1 to enable them (see scripts/Makefile.extrawarn) # Use make W=1 to enable them (see scripts/Makefile.extrawarn)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
endif endif
KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
ifdef CONFIG_FRAME_POINTER ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else else
......
...@@ -13,7 +13,6 @@ config ARCH_WM8505 ...@@ -13,7 +13,6 @@ config ARCH_WM8505
depends on ARCH_MULTI_V5 depends on ARCH_MULTI_V5
select ARCH_VT8500 select ARCH_VT8500
select CPU_ARM926T select CPU_ARM926T
help
config ARCH_WM8750 config ARCH_WM8750
bool "WonderMedia WM8750" bool "WonderMedia WM8750"
......
...@@ -2333,7 +2333,6 @@ config MIPS_VPE_LOADER_TOM ...@@ -2333,7 +2333,6 @@ config MIPS_VPE_LOADER_TOM
config MIPS_VPE_APSP_API config MIPS_VPE_APSP_API
bool "Enable support for AP/SP API (RTLX)" bool "Enable support for AP/SP API (RTLX)"
depends on MIPS_VPE_LOADER depends on MIPS_VPE_LOADER
help
config MIPS_VPE_APSP_API_CMP config MIPS_VPE_APSP_API_CMP
bool bool
......
...@@ -7,6 +7,5 @@ choice ...@@ -7,6 +7,5 @@ choice
config BOARD_BCM963XX config BOARD_BCM963XX
bool "Generic Broadcom 963xx boards" bool "Generic Broadcom 963xx boards"
select SSB select SSB
help
endchoice endchoice
...@@ -152,7 +152,6 @@ menu "Advanced setup" ...@@ -152,7 +152,6 @@ menu "Advanced setup"
config ADVANCED_OPTIONS config ADVANCED_OPTIONS
bool "Prompt for advanced kernel configuration options" bool "Prompt for advanced kernel configuration options"
help
comment "Default settings for advanced configuration options are used" comment "Default settings for advanced configuration options are used"
depends on !ADVANCED_OPTIONS depends on !ADVANCED_OPTIONS
......
...@@ -874,7 +874,6 @@ config MMC_CQHCI ...@@ -874,7 +874,6 @@ config MMC_CQHCI
config MMC_TOSHIBA_PCI config MMC_TOSHIBA_PCI
tristate "Toshiba Type A SD/MMC Card Interface Driver" tristate "Toshiba Type A SD/MMC Card Interface Driver"
depends on PCI depends on PCI
help
config MMC_BCM2835 config MMC_BCM2835
tristate "Broadcom BCM2835 SDHOST MMC Controller support" tristate "Broadcom BCM2835 SDHOST MMC Controller support"
......
...@@ -6,4 +6,3 @@ config RTL8192E ...@@ -6,4 +6,3 @@ config RTL8192E
select WEXT_PRIV select WEXT_PRIV
select CRYPTO select CRYPTO
select FW_LOADER select FW_LOADER
---help---
...@@ -5,4 +5,3 @@ config RTL8192U ...@@ -5,4 +5,3 @@ config RTL8192U
select WIRELESS_EXT select WIRELESS_EXT
select WEXT_PRIV select WEXT_PRIV
select CRYPTO select CRYPTO
---help---
...@@ -1156,7 +1156,6 @@ config FB_I810_I2C ...@@ -1156,7 +1156,6 @@ config FB_I810_I2C
bool "Enable DDC Support" bool "Enable DDC Support"
depends on FB_I810 && FB_I810_GTF depends on FB_I810 && FB_I810_GTF
select FB_DDC select FB_DDC
help
config FB_LE80578 config FB_LE80578
tristate "Intel LE80578 (Vermilion) support" tristate "Intel LE80578 (Vermilion) support"
......
...@@ -351,7 +351,6 @@ config SECTION_MISMATCH_WARN_ONLY ...@@ -351,7 +351,6 @@ config SECTION_MISMATCH_WARN_ONLY
# #
config ARCH_WANT_FRAME_POINTERS config ARCH_WANT_FRAME_POINTERS
bool bool
help
config FRAME_POINTER config FRAME_POINTER
bool "Compile the kernel with frame pointers" bool "Compile the kernel with frame pointers"
......
...@@ -56,9 +56,62 @@ expression x; ...@@ -56,9 +56,62 @@ expression x;
x = devm_ioport_map(...) x = devm_ioport_map(...)
) )
@safe depends on context || org || report exists@
expression x;
position p;
@@
(
x = kmalloc(...)
|
x = kvasprintf(...)
|
x = kasprintf(...)
|
x = kzalloc(...)
|
x = kmalloc_array(...)
|
x = kcalloc(...)
|
x = kstrdup(...)
|
x = kmemdup(...)
|
x = get_free_pages(...)
|
x = request_irq(...)
|
x = ioremap(...)
|
x = ioremap_nocache(...)
|
x = ioport_map(...)
)
...
(
kfree@p(x)
|
kzfree@p(x)
|
__krealloc@p(x, ...)
|
krealloc@p(x, ...)
|
free_pages@p(x, ...)
|
free_page@p(x)
|
free_irq@p(x)
|
iounmap@p(x)
|
ioport_unmap@p(x)
)
@pb@ @pb@
expression r.x; expression r.x;
position p; position p != safe.p;
@@ @@
( (
......
...@@ -212,7 +212,7 @@ else S3 ...@@ -212,7 +212,7 @@ else S3
// The following three rules are duplicates of ifm, pr1 and pr2 respectively. // The following three rules are duplicates of ifm, pr1 and pr2 respectively.
// It is need because the previous rule as already made a "change". // It is need because the previous rule as already made a "change".
@ifm1@ @ifm1 depends on context && !org && !report@
expression *E; expression *E;
statement S1,S2; statement S1,S2;
position p1; position p1;
...@@ -220,7 +220,7 @@ position p1; ...@@ -220,7 +220,7 @@ position p1;
if@p1 ((E == NULL && ...) || ...) S1 else S2 if@p1 ((E == NULL && ...) || ...) S1 else S2
@pr11 expression@ @pr11 depends on context && !org && !report expression@
expression *ifm1.E; expression *ifm1.E;
identifier f; identifier f;
position p1; position p1;
...@@ -228,7 +228,7 @@ position p1; ...@@ -228,7 +228,7 @@ position p1;
(E != NULL && ...) ? <+...E->f@p1...+> : ... (E != NULL && ...) ? <+...E->f@p1...+> : ...
@pr12 expression@ @pr12 depends on context && !org && !report expression@
expression *ifm1.E; expression *ifm1.E;
identifier f; identifier f;
position p2; position p2;
......
# #
# Generated files # Generated files
# #
config*
*.lex.c *.lex.c
*.tab.c *.tab.c
*.tab.h *.tab.h
......
...@@ -39,7 +39,6 @@ static enum input_mode input_mode = oldaskconfig; ...@@ -39,7 +39,6 @@ static enum input_mode input_mode = oldaskconfig;
static int indent = 1; static int indent = 1;
static int tty_stdio; static int tty_stdio;
static int valid_stdin = 1;
static int sync_kconfig; static int sync_kconfig;
static int conf_cnt; static int conf_cnt;
static char line[PATH_MAX]; static char line[PATH_MAX];
...@@ -72,21 +71,14 @@ static void strip(char *str) ...@@ -72,21 +71,14 @@ static void strip(char *str)
*p-- = 0; *p-- = 0;
} }
static void check_stdin(void)
{
if (!valid_stdin) {
printf(_("aborted!\n\n"));
printf(_("Console input/output is redirected. "));
printf(_("Run 'make oldconfig' to update configuration.\n\n"));
exit(1);
}
}
/* Helper function to facilitate fgets() by Jean Sacren. */ /* Helper function to facilitate fgets() by Jean Sacren. */
static void xfgets(char *str, int size, FILE *in) static void xfgets(char *str, int size, FILE *in)
{ {
if (!fgets(str, size, in)) if (!fgets(str, size, in))
fprintf(stderr, "\nError in reading or end of file.\n"); fprintf(stderr, "\nError in reading or end of file.\n");
if (!tty_stdio)
printf("%s", str);
} }
static int conf_askvalue(struct symbol *sym, const char *def) static int conf_askvalue(struct symbol *sym, const char *def)
...@@ -113,13 +105,10 @@ static int conf_askvalue(struct symbol *sym, const char *def) ...@@ -113,13 +105,10 @@ static int conf_askvalue(struct symbol *sym, const char *def)
printf("%s\n", def); printf("%s\n", def);
return 0; return 0;
} }
check_stdin();
/* fall through */ /* fall through */
case oldaskconfig: case oldaskconfig:
fflush(stdout); fflush(stdout);
xfgets(line, sizeof(line), stdin); xfgets(line, sizeof(line), stdin);
if (!tty_stdio)
printf("\n");
return 1; return 1;
default: default:
break; break;
...@@ -199,9 +188,7 @@ static int conf_sym(struct menu *menu) ...@@ -199,9 +188,7 @@ static int conf_sym(struct menu *menu)
printf("/m"); printf("/m");
if (oldval != yes && sym_tristate_within_range(sym, yes)) if (oldval != yes && sym_tristate_within_range(sym, yes))
printf("/y"); printf("/y");
if (menu_has_help(menu)) printf("/?] ");
printf("/?");
printf("] ");
if (!conf_askvalue(sym, sym_get_string_value(sym))) if (!conf_askvalue(sym, sym_get_string_value(sym)))
return 0; return 0;
strip(line); strip(line);
...@@ -303,10 +290,7 @@ static int conf_choice(struct menu *menu) ...@@ -303,10 +290,7 @@ static int conf_choice(struct menu *menu)
printf("[1]: 1\n"); printf("[1]: 1\n");
goto conf_childs; goto conf_childs;
} }
printf("[1-%d", cnt); printf("[1-%d?]: ", cnt);
if (menu_has_help(menu))
printf("?");
printf("]: ");
switch (input_mode) { switch (input_mode) {
case oldconfig: case oldconfig:
case silentoldconfig: case silentoldconfig:
...@@ -315,7 +299,6 @@ static int conf_choice(struct menu *menu) ...@@ -315,7 +299,6 @@ static int conf_choice(struct menu *menu)
printf("%d\n", cnt); printf("%d\n", cnt);
break; break;
} }
check_stdin();
/* fall through */ /* fall through */
case oldaskconfig: case oldaskconfig:
fflush(stdout); fflush(stdout);
...@@ -508,7 +491,7 @@ int main(int ac, char **av) ...@@ -508,7 +491,7 @@ int main(int ac, char **av)
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);
tty_stdio = isatty(0) && isatty(1) && isatty(2); tty_stdio = isatty(0) && isatty(1);
while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) { while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) {
if (opt == 's') { if (opt == 's') {
...@@ -565,7 +548,7 @@ int main(int ac, char **av) ...@@ -565,7 +548,7 @@ int main(int ac, char **av)
} }
} }
if (ac == optind) { if (ac == optind) {
printf(_("%s: Kconfig file missing\n"), av[0]); fprintf(stderr, _("%s: Kconfig file missing\n"), av[0]);
conf_usage(progname); conf_usage(progname);
exit(1); exit(1);
} }
...@@ -590,9 +573,11 @@ int main(int ac, char **av) ...@@ -590,9 +573,11 @@ int main(int ac, char **av)
if (!defconfig_file) if (!defconfig_file)
defconfig_file = conf_get_default_confname(); defconfig_file = conf_get_default_confname();
if (conf_read(defconfig_file)) { if (conf_read(defconfig_file)) {
printf(_("***\n" fprintf(stderr,
_("***\n"
"*** Can't find default configuration \"%s\"!\n" "*** Can't find default configuration \"%s\"!\n"
"***\n"), defconfig_file); "***\n"),
defconfig_file);
exit(1); exit(1);
} }
break; break;
...@@ -650,7 +635,6 @@ int main(int ac, char **av) ...@@ -650,7 +635,6 @@ int main(int ac, char **av)
return 1; return 1;
} }
} }
valid_stdin = tty_stdio;
} }
switch (input_mode) { switch (input_mode) {
......
...@@ -201,7 +201,7 @@ static int add_byte(int c, char **lineptr, size_t slen, size_t *n) ...@@ -201,7 +201,7 @@ static int add_byte(int c, char **lineptr, size_t slen, size_t *n)
if (new_size > *n) { if (new_size > *n) {
new_size += LINE_GROWTH - 1; new_size += LINE_GROWTH - 1;
new_size *= 2; new_size *= 2;
nline = realloc(*lineptr, new_size); nline = xrealloc(*lineptr, new_size);
if (!nline) if (!nline)
return -1; return -1;
......
...@@ -94,7 +94,7 @@ struct expr *expr_copy(const struct expr *org) ...@@ -94,7 +94,7 @@ struct expr *expr_copy(const struct expr *org)
e->right.expr = expr_copy(org->right.expr); e->right.expr = expr_copy(org->right.expr);
break; break;
default: default:
printf("can't copy type %d\n", e->type); fprintf(stderr, "can't copy type %d\n", e->type);
free(e); free(e);
e = NULL; e = NULL;
break; break;
...@@ -127,7 +127,7 @@ void expr_free(struct expr *e) ...@@ -127,7 +127,7 @@ void expr_free(struct expr *e)
expr_free(e->right.expr); expr_free(e->right.expr);
break; break;
default: default:
printf("how to free type %d?\n", e->type); fprintf(stderr, "how to free type %d?\n", e->type);
break; break;
} }
free(e); free(e);
......
...@@ -114,6 +114,7 @@ struct file *file_lookup(const char *name); ...@@ -114,6 +114,7 @@ struct file *file_lookup(const char *name);
int file_write_dep(const char *name); int file_write_dep(const char *name);
void *xmalloc(size_t size); void *xmalloc(size_t size);
void *xcalloc(size_t nmemb, size_t size); void *xcalloc(size_t nmemb, size_t size);
void *xrealloc(void *p, size_t size);
struct gstr { struct gstr {
size_t len; size_t len;
......
...@@ -31,7 +31,7 @@ extern struct symbol * symbol_hash[SYMBOL_HASHSIZE]; ...@@ -31,7 +31,7 @@ extern struct symbol * symbol_hash[SYMBOL_HASHSIZE];
struct symbol * sym_lookup(const char *name, int flags); struct symbol * sym_lookup(const char *name, int flags);
struct symbol * sym_find(const char *name); struct symbol * sym_find(const char *name);
const char * sym_expand_string_value(const char *in); char *sym_expand_string_value(const char *in);
const char * sym_escape_string_value(const char *in); const char * sym_escape_string_value(const char *in);
struct symbol ** sym_re_search(const char *pattern); struct symbol ** sym_re_search(const char *pattern);
const char * sym_type_name(enum symbol_type type); const char * sym_type_name(enum symbol_type type);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* *
*/ */
#include "nconf.h" #include "nconf.h"
#include "lkc.h"
/* a list of all the different widgets we use */ /* a list of all the different widgets we use */
attributes_t attributes[ATTR_MAX+1] = {0}; attributes_t attributes[ATTR_MAX+1] = {0};
...@@ -374,7 +375,7 @@ int dialog_inputbox(WINDOW *main_window, ...@@ -374,7 +375,7 @@ int dialog_inputbox(WINDOW *main_window,
if (strlen(init)+1 > *result_len) { if (strlen(init)+1 > *result_len) {
*result_len = strlen(init)+1; *result_len = strlen(init)+1;
*resultp = result = realloc(result, *result_len); *resultp = result = xrealloc(result, *result_len);
} }
/* find the widest line of msg: */ /* find the widest line of msg: */
......
...@@ -371,11 +371,13 @@ void sym_calc_value(struct symbol *sym) ...@@ -371,11 +371,13 @@ void sym_calc_value(struct symbol *sym)
sym->curr.tri = no; sym->curr.tri = no;
return; return;
} }
if (!sym_is_choice_value(sym))
sym->flags &= ~SYMBOL_WRITE; sym->flags &= ~SYMBOL_WRITE;
sym_calc_visibility(sym); sym_calc_visibility(sym);
if (sym->visible != no)
sym->flags |= SYMBOL_WRITE;
/* set default if recursively called */ /* set default if recursively called */
sym->curr = newval; sym->curr = newval;
...@@ -390,7 +392,6 @@ void sym_calc_value(struct symbol *sym) ...@@ -390,7 +392,6 @@ void sym_calc_value(struct symbol *sym)
/* if the symbol is visible use the user value /* if the symbol is visible use the user value
* if available, otherwise try the default value * if available, otherwise try the default value
*/ */
sym->flags |= SYMBOL_WRITE;
if (sym_has_value(sym)) { if (sym_has_value(sym)) {
newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri, newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri,
sym->visible); sym->visible);
...@@ -433,13 +434,10 @@ void sym_calc_value(struct symbol *sym) ...@@ -433,13 +434,10 @@ void sym_calc_value(struct symbol *sym)
case S_STRING: case S_STRING:
case S_HEX: case S_HEX:
case S_INT: case S_INT:
if (sym->visible != no) { if (sym->visible != no && sym_has_value(sym)) {
sym->flags |= SYMBOL_WRITE;
if (sym_has_value(sym)) {
newval.val = sym->def[S_DEF_USER].val; newval.val = sym->def[S_DEF_USER].val;
break; break;
} }
}
prop = sym_get_default_prop(sym); prop = sym_get_default_prop(sym);
if (prop) { if (prop) {
struct symbol *ds = prop_get_symbol(prop); struct symbol *ds = prop_get_symbol(prop);
...@@ -901,7 +899,7 @@ struct symbol *sym_find(const char *name) ...@@ -901,7 +899,7 @@ struct symbol *sym_find(const char *name)
* name to be expanded shall be prefixed by a '$'. Unknown symbol expands to * name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
* the empty string. * the empty string.
*/ */
const char *sym_expand_string_value(const char *in) char *sym_expand_string_value(const char *in)
{ {
const char *src; const char *src;
char *res; char *res;
...@@ -938,7 +936,7 @@ const char *sym_expand_string_value(const char *in) ...@@ -938,7 +936,7 @@ const char *sym_expand_string_value(const char *in)
newlen = strlen(res) + strlen(symval) + strlen(src) + 1; newlen = strlen(res) + strlen(symval) + strlen(src) + 1;
if (newlen > reslen) { if (newlen > reslen) {
reslen = newlen; reslen = newlen;
res = realloc(res, reslen); res = xrealloc(res, reslen);
} }
strcat(res, symval); strcat(res, symval);
...@@ -1223,7 +1221,7 @@ static struct symbol *sym_check_expr_deps(struct expr *e) ...@@ -1223,7 +1221,7 @@ static struct symbol *sym_check_expr_deps(struct expr *e)
default: default:
break; break;
} }
printf("Oops! How to check %d?\n", e->type); fprintf(stderr, "Oops! How to check %d?\n", e->type);
return NULL; return NULL;
} }
......
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
struct file *file_lookup(const char *name) struct file *file_lookup(const char *name)
{ {
struct file *file; struct file *file;
const char *file_name = sym_expand_string_value(name); char *file_name = sym_expand_string_value(name);
for (file = file_list; file; file = file->next) { for (file = file_list; file; file = file->next) {
if (!strcmp(name, file->name)) { if (!strcmp(name, file->name)) {
free((void *)file_name); free(file_name);
return file; return file;
} }
} }
...@@ -104,7 +104,7 @@ void str_append(struct gstr *gs, const char *s) ...@@ -104,7 +104,7 @@ void str_append(struct gstr *gs, const char *s)
if (s) { if (s) {
l = strlen(gs->s) + strlen(s) + 1; l = strlen(gs->s) + strlen(s) + 1;
if (l > gs->len) { if (l > gs->len) {
gs->s = realloc(gs->s, l); gs->s = xrealloc(gs->s, l);
gs->len = l; gs->len = l;
} }
strcat(gs->s, s); strcat(gs->s, s);
...@@ -145,3 +145,12 @@ void *xcalloc(size_t nmemb, size_t size) ...@@ -145,3 +145,12 @@ void *xcalloc(size_t nmemb, size_t size)
fprintf(stderr, "Out of memory.\n"); fprintf(stderr, "Out of memory.\n");
exit(1); exit(1);
} }
void *xrealloc(void *p, size_t size)
{
p = realloc(p, size);
if (p)
return p;
fprintf(stderr, "Out of memory.\n");
exit(1);
}
...@@ -52,7 +52,7 @@ static void append_string(const char *str, int size) ...@@ -52,7 +52,7 @@ static void append_string(const char *str, int size)
if (new_size > text_asize) { if (new_size > text_asize) {
new_size += START_STRSIZE - 1; new_size += START_STRSIZE - 1;
new_size &= -START_STRSIZE; new_size &= -START_STRSIZE;
text = realloc(text, new_size); text = xrealloc(text, new_size);
text_asize = new_size; text_asize = new_size;
} }
memcpy(text + text_size, str, size); memcpy(text + text_size, str, size);
...@@ -184,7 +184,9 @@ n [A-Za-z0-9_-] ...@@ -184,7 +184,9 @@ n [A-Za-z0-9_-]
append_string(yytext, 1); append_string(yytext, 1);
} }
\n { \n {
printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); fprintf(stderr,
"%s:%d:warning: multi-line strings not supported\n",
zconf_curname(), zconf_lineno());
current_file->lineno++; current_file->lineno++;
BEGIN(INITIAL); BEGIN(INITIAL);
return T_EOL; return T_EOL;
...@@ -294,7 +296,7 @@ void zconf_initscan(const char *name) ...@@ -294,7 +296,7 @@ void zconf_initscan(const char *name)
{ {
yyin = zconf_fopen(name); yyin = zconf_fopen(name);
if (!yyin) { if (!yyin) {
printf("can't find file %s\n", name); fprintf(stderr, "can't find file %s\n", name);
exit(1); exit(1);
} }
...@@ -315,7 +317,7 @@ void zconf_nextfile(const char *name) ...@@ -315,7 +317,7 @@ void zconf_nextfile(const char *name)
current_buf->state = YY_CURRENT_BUFFER; current_buf->state = YY_CURRENT_BUFFER;
yyin = zconf_fopen(file->name); yyin = zconf_fopen(file->name);
if (!yyin) { if (!yyin) {
printf("%s:%d: can't open file \"%s\"\n", fprintf(stderr, "%s:%d: can't open file \"%s\"\n",
zconf_curname(), zconf_lineno(), file->name); zconf_curname(), zconf_lineno(), file->name);
exit(1); exit(1);
} }
...@@ -325,19 +327,20 @@ void zconf_nextfile(const char *name) ...@@ -325,19 +327,20 @@ void zconf_nextfile(const char *name)
for (iter = current_file->parent; iter; iter = iter->parent ) { for (iter = current_file->parent; iter; iter = iter->parent ) {
if (!strcmp(current_file->name,iter->name) ) { if (!strcmp(current_file->name,iter->name) ) {
printf("%s:%d: recursive inclusion detected. " fprintf(stderr,
"%s:%d: recursive inclusion detected. "
"Inclusion path:\n current file : '%s'\n", "Inclusion path:\n current file : '%s'\n",
zconf_curname(), zconf_lineno(), zconf_curname(), zconf_lineno(),
zconf_curname()); zconf_curname());
iter = current_file->parent; iter = current_file->parent;
while (iter && \ while (iter && \
strcmp(iter->name,current_file->name)) { strcmp(iter->name,current_file->name)) {
printf(" included from: '%s:%d'\n", fprintf(stderr, " included from: '%s:%d'\n",
iter->name, iter->lineno-1); iter->name, iter->lineno-1);
iter = iter->parent; iter = iter->parent;
} }
if (iter) if (iter)
printf(" included from: '%s:%d'\n", fprintf(stderr, " included from: '%s:%d'\n",
iter->name, iter->lineno+1); iter->name, iter->lineno+1);
exit(1); exit(1);
} }
......
...@@ -436,6 +436,12 @@ help: help_start T_HELPTEXT ...@@ -436,6 +436,12 @@ help: help_start T_HELPTEXT
zconfprint("warning: '%s' defined with more than one help text -- only the last one will be used", zconfprint("warning: '%s' defined with more than one help text -- only the last one will be used",
current_entry->sym->name ?: "<choice>"); current_entry->sym->name ?: "<choice>");
} }
/* Is the help text empty or all whitespace? */
if ($2[strspn($2, " \f\n\r\t\v")] == '\0')
zconfprint("warning: '%s' defined with blank help text",
current_entry->sym->name ?: "<choice>");
current_entry->help = $2; current_entry->help = $2;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment