Commit 769e4709 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull Kconfig updates from Masahiro Yamada:

 - support -y option for merge_config.sh to avoid downgrading =y to =m

 - remove S_OTHER symbol type, and touch include/config/*.h files correctly

 - fix file name and line number in lexer warnings

 - fix memory leak when EOF is encountered in quotation

 - resolve all shift/reduce conflicts of the parser

 - warn no new line at end of file

 - make 'source' statement more strict to take only string literal

 - rewrite the lexer and remove the keyword lookup table

 - convert to SPDX License Identifier

 - compile C files independently instead of including them from zconf.y

 - fix various warnings of gconfig

 - misc cleanups

* tag 'kconfig-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (39 commits)
  kconfig: surround dbg_sym_flags with #ifdef DEBUG to fix gconf warning
  kconfig: split images.c out of qconf.cc/gconf.c to fix gconf warnings
  kconfig: add static qualifiers to fix gconf warnings
  kconfig: split the lexer out of zconf.y
  kconfig: split some C files out of zconf.y
  kconfig: convert to SPDX License Identifier
  kconfig: remove keyword lookup table entirely
  kconfig: update current_pos in the second lexer
  kconfig: switch to ASSIGN_VAL state in the second lexer
  kconfig: stop associating kconf_id with yylval
  kconfig: refactor end token rules
  kconfig: stop supporting '.' and '/' in unquoted words
  treewide: surround Kconfig file paths with double quotes
  microblaze: surround string default in Kconfig with double quotes
  kconfig: use T_WORD instead of T_VARIABLE for variables
  kconfig: use specific tokens instead of T_ASSIGN for assignments
  kconfig: refactor scanning and parsing "option" properties
  kconfig: use distinct tokens for type and default properties
  kconfig: remove redundant token defines
  kconfig: rename depends_list to comment_option_list
  ...
parents 668c35f6 f222b7f4
...@@ -910,7 +910,7 @@ config PLAT_VERSATILE ...@@ -910,7 +910,7 @@ config PLAT_VERSATILE
source "arch/arm/firmware/Kconfig" source "arch/arm/firmware/Kconfig"
source arch/arm/mm/Kconfig source "arch/arm/mm/Kconfig"
config IWMMXT config IWMMXT
bool "Enable iWMMXt support" bool "Enable iWMMXt support"
......
...@@ -55,6 +55,6 @@ config KVM_ARM_HOST ...@@ -55,6 +55,6 @@ config KVM_ARM_HOST
---help--- ---help---
Provides host support for ARM processors. Provides host support for ARM processors.
source drivers/vhost/Kconfig source "drivers/vhost/Kconfig"
endif # VIRTUALIZATION endif # VIRTUALIZATION
...@@ -857,7 +857,7 @@ config NEED_PER_CPU_EMBED_FIRST_CHUNK ...@@ -857,7 +857,7 @@ config NEED_PER_CPU_EMBED_FIRST_CHUNK
config HOLES_IN_ZONE config HOLES_IN_ZONE
def_bool y def_bool y
source kernel/Kconfig.hz source "kernel/Kconfig.hz"
config ARCH_SUPPORTS_DEBUG_PAGEALLOC config ARCH_SUPPORTS_DEBUG_PAGEALLOC
def_bool y def_bool y
......
...@@ -61,6 +61,6 @@ config KVM_ARM_PMU ...@@ -61,6 +61,6 @@ config KVM_ARM_PMU
config KVM_INDIRECT_VECTORS config KVM_INDIRECT_VECTORS
def_bool KVM && (HARDEN_BRANCH_PREDICTOR || HARDEN_EL2_VECTORS) def_bool KVM && (HARDEN_BRANCH_PREDICTOR || HARDEN_EL2_VECTORS)
source drivers/vhost/Kconfig source "drivers/vhost/Kconfig"
endif # VIRTUALIZATION endif # VIRTUALIZATION
...@@ -261,7 +261,7 @@ config HZ ...@@ -261,7 +261,7 @@ config HZ
endif endif
if !IA64_HP_SIM if !IA64_HP_SIM
source kernel/Kconfig.hz source "kernel/Kconfig.hz"
endif endif
config IA64_BRL_EMU config IA64_BRL_EMU
......
...@@ -122,11 +122,11 @@ config BOOTINFO_PROC ...@@ -122,11 +122,11 @@ config BOOTINFO_PROC
menu "Platform setup" menu "Platform setup"
source arch/m68k/Kconfig.cpu source "arch/m68k/Kconfig.cpu"
source arch/m68k/Kconfig.machine source "arch/m68k/Kconfig.machine"
source arch/m68k/Kconfig.bus source "arch/m68k/Kconfig.bus"
endmenu endmenu
......
...@@ -65,6 +65,6 @@ config XILINX_MICROBLAZE0_USE_FPU ...@@ -65,6 +65,6 @@ config XILINX_MICROBLAZE0_USE_FPU
config XILINX_MICROBLAZE0_HW_VER config XILINX_MICROBLAZE0_HW_VER
string "Core version number" string "Core version number"
default 7.10.d default "7.10.d"
endmenu endmenu
...@@ -73,6 +73,6 @@ config KVM_MIPS_DEBUG_COP0_COUNTERS ...@@ -73,6 +73,6 @@ config KVM_MIPS_DEBUG_COP0_COUNTERS
If unsure, say N. If unsure, say N.
source drivers/vhost/Kconfig source "drivers/vhost/Kconfig"
endif # VIRTUALIZATION endif # VIRTUALIZATION
...@@ -138,7 +138,7 @@ config SMP ...@@ -138,7 +138,7 @@ config SMP
If you don't know what to do here, say N. If you don't know what to do here, say N.
source kernel/Kconfig.hz source "kernel/Kconfig.hz"
config OPENRISC_NO_SPR_SR_DSX config OPENRISC_NO_SPR_SR_DSX
bool "use SPR_SR_DSX software emulation" if OR1K_1200 bool "use SPR_SR_DSX software emulation" if OR1K_1200
......
...@@ -393,7 +393,7 @@ config HIGHMEM ...@@ -393,7 +393,7 @@ config HIGHMEM
bool "High memory support" bool "High memory support"
depends on PPC32 depends on PPC32
source kernel/Kconfig.hz source "kernel/Kconfig.hz"
config HUGETLB_PAGE_SIZE_VARIABLE config HUGETLB_PAGE_SIZE_VARIABLE
bool bool
...@@ -816,7 +816,7 @@ config ARCH_WANTS_FREEZER_CONTROL ...@@ -816,7 +816,7 @@ config ARCH_WANTS_FREEZER_CONTROL
def_bool y def_bool y
depends on ADB_PMU depends on ADB_PMU
source kernel/power/Kconfig source "kernel/power/Kconfig"
config SECCOMP config SECCOMP
bool "Enable seccomp to safely compute untrusted bytecode" bool "Enable seccomp to safely compute untrusted bytecode"
......
...@@ -204,6 +204,6 @@ config KVM_XIVE ...@@ -204,6 +204,6 @@ config KVM_XIVE
default y default y
depends on KVM_XICS && PPC_XIVE_NATIVE && KVM_BOOK3S_HV_POSSIBLE depends on KVM_XICS && PPC_XIVE_NATIVE && KVM_BOOK3S_HV_POSSIBLE
source drivers/vhost/Kconfig source "drivers/vhost/Kconfig"
endif # VIRTUALIZATION endif # VIRTUALIZATION
...@@ -296,6 +296,6 @@ endmenu ...@@ -296,6 +296,6 @@ endmenu
menu "Power management options" menu "Power management options"
source kernel/power/Kconfig source "kernel/power/Kconfig"
endmenu endmenu
...@@ -518,7 +518,7 @@ config SCHED_TOPOLOGY ...@@ -518,7 +518,7 @@ config SCHED_TOPOLOGY
making when dealing with machines that have multi-threading, making when dealing with machines that have multi-threading,
multiple cores or multiple books. multiple cores or multiple books.
source kernel/Kconfig.hz source "kernel/Kconfig.hz"
config KEXEC config KEXEC
def_bool y def_bool y
......
...@@ -57,6 +57,6 @@ config KVM_S390_UCONTROL ...@@ -57,6 +57,6 @@ config KVM_S390_UCONTROL
# OK, it's a little counter-intuitive to do this, but it puts it neatly under # OK, it's a little counter-intuitive to do this, but it puts it neatly under
# the virtualization menu. # the virtualization menu.
source drivers/vhost/Kconfig source "drivers/vhost/Kconfig"
endif # VIRTUALIZATION endif # VIRTUALIZATION
...@@ -596,7 +596,7 @@ endmenu ...@@ -596,7 +596,7 @@ endmenu
menu "Kernel features" menu "Kernel features"
source kernel/Kconfig.hz source "kernel/Kconfig.hz"
config KEXEC config KEXEC
bool "kexec system call (EXPERIMENTAL)" bool "kexec system call (EXPERIMENTAL)"
......
...@@ -185,7 +185,7 @@ config NR_CPUS ...@@ -185,7 +185,7 @@ config NR_CPUS
default 32 if SPARC32 default 32 if SPARC32
default 4096 if SPARC64 default 4096 if SPARC64
source kernel/Kconfig.hz source "kernel/Kconfig.hz"
config RWSEM_GENERIC_SPINLOCK config RWSEM_GENERIC_SPINLOCK
bool bool
......
...@@ -1977,7 +1977,7 @@ config SECCOMP ...@@ -1977,7 +1977,7 @@ config SECCOMP
If unsure, say Y. Only embedded should say N here. If unsure, say Y. Only embedded should say N here.
source kernel/Kconfig.hz source "kernel/Kconfig.hz"
config KEXEC config KEXEC
bool "kexec system call" bool "kexec system call"
......
...@@ -98,6 +98,6 @@ config KVM_MMU_AUDIT ...@@ -98,6 +98,6 @@ config KVM_MMU_AUDIT
# OK, it's a little counter-intuitive to do this, but it puts it neatly under # OK, it's a little counter-intuitive to do this, but it puts it neatly under
# the virtualization menu. # the virtualization menu.
source drivers/vhost/Kconfig source "drivers/vhost/Kconfig"
endif # VIRTUALIZATION endif # VIRTUALIZATION
...@@ -218,4 +218,4 @@ config BLK_MQ_RDMA ...@@ -218,4 +218,4 @@ config BLK_MQ_RDMA
config BLK_PM config BLK_PM
def_bool BLOCK && PM def_bool BLOCK && PM
source block/Kconfig.iosched source "block/Kconfig.iosched"
...@@ -1889,7 +1889,7 @@ config CRYPTO_HASH_INFO ...@@ -1889,7 +1889,7 @@ config CRYPTO_HASH_INFO
bool bool
source "drivers/crypto/Kconfig" source "drivers/crypto/Kconfig"
source crypto/asymmetric_keys/Kconfig source "crypto/asymmetric_keys/Kconfig"
source certs/Kconfig source "certs/Kconfig"
endif # if CRYPTO endif # if CRYPTO
...@@ -258,7 +258,7 @@ config CRYPTO_DEV_HIFN_795X_RNG ...@@ -258,7 +258,7 @@ config CRYPTO_DEV_HIFN_795X_RNG
Select this option if you want to enable the random number generator Select this option if you want to enable the random number generator
on the HIFN 795x crypto adapters. on the HIFN 795x crypto adapters.
source drivers/crypto/caam/Kconfig source "drivers/crypto/caam/Kconfig"
config CRYPTO_DEV_TALITOS config CRYPTO_DEV_TALITOS
tristate "Talitos Freescale Security Engine (SEC)" tristate "Talitos Freescale Security Engine (SEC)"
......
...@@ -131,5 +131,5 @@ config DRM_I915_GVT_KVMGT ...@@ -131,5 +131,5 @@ config DRM_I915_GVT_KVMGT
menu "drm/i915 Debugging" menu "drm/i915 Debugging"
depends on DRM_I915 depends on DRM_I915
depends on EXPERT depends on EXPERT
source drivers/gpu/drm/i915/Kconfig.debug source "drivers/gpu/drm/i915/Kconfig.debug"
endmenu endmenu
...@@ -1310,7 +1310,7 @@ config SENSORS_PCF8591 ...@@ -1310,7 +1310,7 @@ config SENSORS_PCF8591
These devices are hard to detect and rarely found on mainstream These devices are hard to detect and rarely found on mainstream
hardware. If unsure, say N. hardware. If unsure, say N.
source drivers/hwmon/pmbus/Kconfig source "drivers/hwmon/pmbus/Kconfig"
config SENSORS_PWM_FAN config SENSORS_PWM_FAN
tristate "PWM fan" tristate "PWM fan"
......
...@@ -68,7 +68,7 @@ config I2C_MUX ...@@ -68,7 +68,7 @@ config I2C_MUX
This support is also available as a module. If so, the module This support is also available as a module. If so, the module
will be called i2c-mux. will be called i2c-mux.
source drivers/i2c/muxes/Kconfig source "drivers/i2c/muxes/Kconfig"
config I2C_HELPER_AUTO config I2C_HELPER_AUTO
bool "Autoselect pertinent helper modules" bool "Autoselect pertinent helper modules"
...@@ -94,8 +94,8 @@ config I2C_SMBUS ...@@ -94,8 +94,8 @@ config I2C_SMBUS
This support is also available as a module. If so, the module This support is also available as a module. If so, the module
will be called i2c-smbus. will be called i2c-smbus.
source drivers/i2c/algos/Kconfig source "drivers/i2c/algos/Kconfig"
source drivers/i2c/busses/Kconfig source "drivers/i2c/busses/Kconfig"
config I2C_STUB config I2C_STUB
tristate "I2C/SMBus Test Stub" tristate "I2C/SMBus Test Stub"
......
...@@ -37,8 +37,8 @@ config NTP_PPS ...@@ -37,8 +37,8 @@ config NTP_PPS
It doesn't work on tickless systems at the moment. It doesn't work on tickless systems at the moment.
source drivers/pps/clients/Kconfig source "drivers/pps/clients/Kconfig"
source drivers/pps/generators/Kconfig source "drivers/pps/generators/Kconfig"
endif # PPS endif # PPS
...@@ -30,6 +30,6 @@ menuconfig RAS ...@@ -30,6 +30,6 @@ menuconfig RAS
if RAS if RAS
source arch/x86/ras/Kconfig source "arch/x86/ras/Kconfig"
endif endif
...@@ -383,7 +383,7 @@ config INTEL_QUARK_DTS_THERMAL ...@@ -383,7 +383,7 @@ config INTEL_QUARK_DTS_THERMAL
underlying BIOS/Firmware. underlying BIOS/Firmware.
menu "ACPI INT340X thermal drivers" menu "ACPI INT340X thermal drivers"
source drivers/thermal/int340x_thermal/Kconfig source "drivers/thermal/int340x_thermal/Kconfig"
endmenu endmenu
config INTEL_BXT_PMIC_THERMAL config INTEL_BXT_PMIC_THERMAL
......
...@@ -25,7 +25,7 @@ config W1_CON ...@@ -25,7 +25,7 @@ config W1_CON
2. Userspace commands. Includes read/write and search/alarm search commands. 2. Userspace commands. Includes read/write and search/alarm search commands.
3. Replies to userspace commands. 3. Replies to userspace commands.
source drivers/w1/masters/Kconfig source "drivers/w1/masters/Kconfig"
source drivers/w1/slaves/Kconfig source "drivers/w1/slaves/Kconfig"
endif # W1 endif # W1
...@@ -57,4 +57,4 @@ config PREEMPT ...@@ -57,4 +57,4 @@ config PREEMPT
endchoice endchoice
config PREEMPT_COUNT config PREEMPT_COUNT
bool bool
\ No newline at end of file
...@@ -439,7 +439,7 @@ config DEBUG_KERNEL ...@@ -439,7 +439,7 @@ config DEBUG_KERNEL
menu "Memory Debugging" menu "Memory Debugging"
source mm/Kconfig.debug source "mm/Kconfig.debug"
config DEBUG_OBJECTS config DEBUG_OBJECTS
bool "Debug object operations" bool "Debug object operations"
...@@ -1624,7 +1624,7 @@ config LATENCYTOP ...@@ -1624,7 +1624,7 @@ config LATENCYTOP
Enable this option if you want to use the LatencyTOP tool Enable this option if you want to use the LatencyTOP tool
to find out which userspace is blocking on what kernel operations. to find out which userspace is blocking on what kernel operations.
source kernel/trace/Kconfig source "kernel/trace/Kconfig"
config PROVIDE_OHCI1394_DMA_INIT config PROVIDE_OHCI1394_DMA_INIT
bool "Remote debugging over FireWire early on boot" bool "Remote debugging over FireWire early on boot"
......
...@@ -142,23 +142,20 @@ help: ...@@ -142,23 +142,20 @@ help:
@echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)' @echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)'
# =========================================================================== # ===========================================================================
# Shared Makefile for the various kconfig executables:
# conf: Used for defconfig, oldconfig and related targets
# object files used by all kconfig flavours # object files used by all kconfig flavours
common-objs := confdata.o expr.o symbol.o preprocess.o zconf.lex.o zconf.tab.o
conf-objs := conf.o zconf.tab.o $(obj)/zconf.lex.o: $(obj)/zconf.tab.h
hostprogs-y := conf
targets += zconf.lex.c
# generated files seem to need this to find local include files
HOSTCFLAGS_zconf.lex.o := -I$(src) HOSTCFLAGS_zconf.lex.o := -I$(src)
HOSTCFLAGS_zconf.tab.o := -I$(src) HOSTCFLAGS_zconf.tab.o := -I$(src)
# conf: Used for defconfig, oldconfig and related targets
hostprogs-y += conf
conf-objs := conf.o $(common-objs)
# nconf: Used for the nconfig target based on ncurses # nconf: Used for the nconfig target based on ncurses
hostprogs-y += nconf hostprogs-y += nconf
nconf-objs := nconf.o zconf.tab.o nconf.gui.o nconf-objs := nconf.o nconf.gui.o $(common-objs)
HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs)
HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
...@@ -169,7 +166,7 @@ $(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/.nconf-cfg ...@@ -169,7 +166,7 @@ $(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/.nconf-cfg
# mconf: Used for the menuconfig target based on lxdialog # mconf: Used for the menuconfig target based on lxdialog
hostprogs-y += mconf hostprogs-y += mconf
lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o
mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog)) mconf-objs := mconf.o $(addprefix lxdialog/, $(lxdialog)) $(common-objs)
HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs) HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs)
$(foreach f, mconf.o $(lxdialog), \ $(foreach f, mconf.o $(lxdialog), \
...@@ -181,7 +178,7 @@ $(addprefix $(obj)/lxdialog/, $(lxdialog)): $(obj)/.mconf-cfg ...@@ -181,7 +178,7 @@ $(addprefix $(obj)/lxdialog/, $(lxdialog)): $(obj)/.mconf-cfg
# qconf: Used for the xconfig target based on Qt # qconf: Used for the xconfig target based on Qt
hostprogs-y += qconf hostprogs-y += qconf
qconf-cxxobjs := qconf.o qconf-cxxobjs := qconf.o
qconf-objs := zconf.tab.o qconf-objs := images.o $(common-objs)
HOSTLDLIBS_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) HOSTLDLIBS_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs)
HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags) HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags)
...@@ -196,15 +193,13 @@ $(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg ...@@ -196,15 +193,13 @@ $(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg
# gconf: Used for the gconfig target based on GTK+ # gconf: Used for the gconfig target based on GTK+
hostprogs-y += gconf hostprogs-y += gconf
gconf-objs := gconf.o zconf.tab.o gconf-objs := gconf.o images.o $(common-objs)
HOSTLDLIBS_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs) HOSTLDLIBS_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs)
HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags) HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags)
$(obj)/gconf.o: $(obj)/.gconf-cfg $(obj)/gconf.o: $(obj)/.gconf-cfg
$(obj)/zconf.tab.o: $(obj)/zconf.lex.c
# check if necessary packages are available, and configure build flags # check if necessary packages are available, and configure build flags
define filechk_conf_cfg define filechk_conf_cfg
$(CONFIG_SHELL) $< $(CONFIG_SHELL) $<
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/ */
#include <ctype.h> #include <ctype.h>
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/ */
#include <sys/stat.h> #include <sys/stat.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -74,6 +75,47 @@ static int make_parent_dir(const char *path) ...@@ -74,6 +75,47 @@ static int make_parent_dir(const char *path)
return 0; return 0;
} }
static char depfile_path[PATH_MAX];
static size_t depfile_prefix_len;
/* touch depfile for symbol 'name' */
static int conf_touch_dep(const char *name)
{
int fd, ret;
const char *s;
char *d, c;
/* check overflow: prefix + name + ".h" + '\0' must fit in buffer. */
if (depfile_prefix_len + strlen(name) + 3 > sizeof(depfile_path))
return -1;
d = depfile_path + depfile_prefix_len;
s = name;
while ((c = *s++))
*d++ = (c == '_') ? '/' : tolower(c);
strcpy(d, ".h");
/* Assume directory path already exists. */
fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1) {
if (errno != ENOENT)
return -1;
ret = make_parent_dir(depfile_path);
if (ret)
return ret;
/* Try it again. */
fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1)
return -1;
}
close(fd);
return 0;
}
struct conf_printer { struct conf_printer {
void (*print_symbol)(FILE *, struct symbol *, const char *, void *); void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
void (*print_comment)(FILE *, const char *, void *); void (*print_comment)(FILE *, const char *, void *);
...@@ -186,14 +228,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) ...@@ -186,14 +228,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
conf_warning("symbol value '%s' invalid for %s", conf_warning("symbol value '%s' invalid for %s",
p, sym->name); p, sym->name);
return 1; return 1;
case S_OTHER:
if (*p != '"') {
for (p2 = p; *p2 && !isspace(*p2); p2++)
;
sym->type = S_STRING;
goto done;
}
/* fall through */
case S_STRING: case S_STRING:
if (*p++ != '"') if (*p++ != '"')
break; break;
...@@ -212,7 +246,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) ...@@ -212,7 +246,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
/* fall through */ /* fall through */
case S_INT: case S_INT:
case S_HEX: case S_HEX:
done:
if (sym_string_valid(sym, p)) { if (sym_string_valid(sym, p)) {
sym->def[def].val = xstrdup(p); sym->def[def].val = xstrdup(p);
sym->flags |= def_flags; sym->flags |= def_flags;
...@@ -363,7 +396,7 @@ int conf_read_simple(const char *name, int def) ...@@ -363,7 +396,7 @@ int conf_read_simple(const char *name, int def)
sym = sym_find(line + 2 + strlen(CONFIG_)); sym = sym_find(line + 2 + strlen(CONFIG_));
if (!sym) { if (!sym) {
sym_add_change_count(1); sym_add_change_count(1);
goto setsym; continue;
} }
} else { } else {
sym = sym_lookup(line + 2 + strlen(CONFIG_), 0); sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
...@@ -393,17 +426,22 @@ int conf_read_simple(const char *name, int def) ...@@ -393,17 +426,22 @@ int conf_read_simple(const char *name, int def)
if (*p2 == '\r') if (*p2 == '\r')
*p2 = 0; *p2 = 0;
} }
if (def == S_DEF_USER) {
sym = sym_find(line + strlen(CONFIG_)); sym = sym_find(line + strlen(CONFIG_));
if (!sym) { if (!sym) {
if (def == S_DEF_AUTO)
/*
* Reading from include/config/auto.conf
* If CONFIG_FOO previously existed in
* auto.conf but it is missing now,
* include/config/foo.h must be touched.
*/
conf_touch_dep(line + strlen(CONFIG_));
else
sym_add_change_count(1); sym_add_change_count(1);
goto setsym; continue;
}
} else {
sym = sym_lookup(line + strlen(CONFIG_), 0);
if (sym->type == S_UNKNOWN)
sym->type = S_OTHER;
} }
if (sym->flags & def_flags) { if (sym->flags & def_flags) {
conf_warning("override: reassigning to symbol %s", sym->name); conf_warning("override: reassigning to symbol %s", sym->name);
} }
...@@ -416,7 +454,7 @@ int conf_read_simple(const char *name, int def) ...@@ -416,7 +454,7 @@ int conf_read_simple(const char *name, int def)
continue; continue;
} }
setsym:
if (sym && sym_is_choice_value(sym)) { if (sym && sym_is_choice_value(sym)) {
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
switch (sym->def[def].tri) { switch (sym->def[def].tri) {
...@@ -669,7 +707,6 @@ static void conf_write_symbol(FILE *fp, struct symbol *sym, ...@@ -669,7 +707,6 @@ static void conf_write_symbol(FILE *fp, struct symbol *sym,
const char *str; const char *str;
switch (sym->type) { switch (sym->type) {
case S_OTHER:
case S_UNKNOWN: case S_UNKNOWN:
break; break;
case S_STRING: case S_STRING:
...@@ -906,24 +943,19 @@ static int conf_write_dep(const char *name) ...@@ -906,24 +943,19 @@ static int conf_write_dep(const char *name)
return 0; return 0;
} }
static int conf_split_config(void) static int conf_touch_deps(void)
{ {
const char *name; const char *name;
char path[PATH_MAX+1];
char *s, *d, c;
struct symbol *sym; struct symbol *sym;
int res, i, fd; int res, i;
strcpy(depfile_path, "include/config/");
depfile_prefix_len = strlen(depfile_path);
name = conf_get_autoconfig_name(); name = conf_get_autoconfig_name();
conf_read_simple(name, S_DEF_AUTO); conf_read_simple(name, S_DEF_AUTO);
sym_calc_value(modules_sym); sym_calc_value(modules_sym);
if (make_parent_dir("include/config/foo.h"))
return 1;
if (chdir("include/config"))
return 1;
res = 0;
for_all_symbols(i, sym) { for_all_symbols(i, sym) {
sym_calc_value(sym); sym_calc_value(sym);
if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name) if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name)
...@@ -975,42 +1007,12 @@ static int conf_split_config(void) ...@@ -975,42 +1007,12 @@ static int conf_split_config(void)
* different from 'no'). * different from 'no').
*/ */
/* Replace all '_' and append ".h" */ res = conf_touch_dep(sym->name);
s = sym->name; if (res)
d = path; return res;
while ((c = *s++)) {
c = tolower(c);
*d++ = (c == '_') ? '/' : c;
}
strcpy(d, ".h");
/* Assume directory path already exists. */
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1) {
if (errno != ENOENT) {
res = 1;
break;
}
if (make_parent_dir(path)) {
res = 1;
goto out;
}
/* Try it again. */
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1) {
res = 1;
break;
}
}
close(fd);
} }
out:
if (chdir("../.."))
return 1;
return res; return 0;
} }
int conf_write_autoconf(int overwrite) int conf_write_autoconf(int overwrite)
...@@ -1028,7 +1030,7 @@ int conf_write_autoconf(int overwrite) ...@@ -1028,7 +1030,7 @@ int conf_write_autoconf(int overwrite)
conf_write_dep("include/config/auto.conf.cmd"); conf_write_dep("include/config/auto.conf.cmd");
if (conf_split_config()) if (conf_touch_deps())
return 1; return 1;
out = fopen(".tmpconfig", "w"); out = fopen(".tmpconfig", "w");
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/ */
#include <ctype.h>
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -980,7 +982,6 @@ enum string_value_kind { ...@@ -980,7 +982,6 @@ enum string_value_kind {
k_string, k_string,
k_signed, k_signed,
k_unsigned, k_unsigned,
k_invalid
}; };
union string_value { union string_value {
...@@ -1011,13 +1012,10 @@ static enum string_value_kind expr_parse_string(const char *str, ...@@ -1011,13 +1012,10 @@ static enum string_value_kind expr_parse_string(const char *str,
val->u = strtoull(str, &tail, 16); val->u = strtoull(str, &tail, 16);
kind = k_unsigned; kind = k_unsigned;
break; break;
case S_STRING: default:
case S_UNKNOWN:
val->s = strtoll(str, &tail, 0); val->s = strtoll(str, &tail, 0);
kind = k_signed; kind = k_signed;
break; break;
default:
return k_invalid;
} }
return !errno && !*tail && tail > str && isxdigit(tail[-1]) return !errno && !*tail && tail > str && isxdigit(tail[-1])
? kind : k_string; ? kind : k_string;
...@@ -1073,13 +1071,7 @@ tristate expr_calc_value(struct expr *e) ...@@ -1073,13 +1071,7 @@ tristate expr_calc_value(struct expr *e)
if (k1 == k_string || k2 == k_string) if (k1 == k_string || k2 == k_string)
res = strcmp(str1, str2); res = strcmp(str1, str2);
else if (k1 == k_invalid || k2 == k_invalid) { else if (k1 == k_unsigned || k2 == k_unsigned)
if (e->type != E_EQUAL && e->type != E_UNEQUAL) {
printf("Cannot compare \"%s\" and \"%s\"\n", str1, str2);
return no;
}
res = strcmp(str1, str2);
} else if (k1 == k_unsigned || k2 == k_unsigned)
res = (lval.u > rval.u) - (lval.u < rval.u); res = (lval.u > rval.u) - (lval.u < rval.u);
else /* if (k1 == k_signed && k2 == k_signed) */ else /* if (k1 == k_signed && k2 == k_signed) */
res = (lval.s > rval.s) - (lval.s < rval.s); res = (lval.s > rval.s) - (lval.s < rval.s);
......
/* SPDX-License-Identifier: GPL-2.0 */
/* /*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/ */
#ifndef EXPR_H #ifndef EXPR_H
...@@ -62,7 +62,7 @@ struct symbol_value { ...@@ -62,7 +62,7 @@ struct symbol_value {
}; };
enum symbol_type { enum symbol_type {
S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING
}; };
/* enum values are used as index to symbol.def[] */ /* enum values are used as index to symbol.def[] */
...@@ -131,7 +131,7 @@ struct symbol { ...@@ -131,7 +131,7 @@ struct symbol {
struct expr_value implied; struct expr_value implied;
}; };
#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) #define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next)
#define SYMBOL_CONST 0x0001 /* symbol is const */ #define SYMBOL_CONST 0x0001 /* symbol is const */
#define SYMBOL_CHECK 0x0008 /* used during dependency checking */ #define SYMBOL_CHECK 0x0008 /* used during dependency checking */
......
/* Hey EMACS -*- linux-c -*- */ // SPDX-License-Identifier: GPL-2.0
/* /*
*
* Copyright (C) 2002-2003 Romain Lievin <roms@tilp.info> * Copyright (C) 2002-2003 Romain Lievin <roms@tilp.info>
* Released under the terms of the GNU GPL v2.0.
*
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
...@@ -12,7 +9,7 @@ ...@@ -12,7 +9,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "lkc.h" #include "lkc.h"
#include "images.c" #include "images.h"
#include <glade/glade.h> #include <glade/glade.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
...@@ -78,8 +75,8 @@ static gchar **fill_row(struct menu *menu); ...@@ -78,8 +75,8 @@ static gchar **fill_row(struct menu *menu);
static void conf_changed(void); static void conf_changed(void);
/* Helping/Debugging Functions */ /* Helping/Debugging Functions */
#ifdef DEBUG
const char *dbg_sym_flags(int val) static const char *dbg_sym_flags(int val)
{ {
static char buf[256]; static char buf[256];
...@@ -108,9 +105,10 @@ const char *dbg_sym_flags(int val) ...@@ -108,9 +105,10 @@ const char *dbg_sym_flags(int val)
return buf; return buf;
} }
#endif
void replace_button_icon(GladeXML * xml, GdkDrawable * window, static void replace_button_icon(GladeXML *xml, GdkDrawable *window,
GtkStyle * style, gchar * btn_name, gchar ** xpm) GtkStyle *style, gchar *btn_name, gchar **xpm)
{ {
GdkPixmap *pixmap; GdkPixmap *pixmap;
GdkBitmap *mask; GdkBitmap *mask;
...@@ -128,7 +126,7 @@ void replace_button_icon(GladeXML * xml, GdkDrawable * window, ...@@ -128,7 +126,7 @@ void replace_button_icon(GladeXML * xml, GdkDrawable * window,
} }
/* Main Window Initialization */ /* Main Window Initialization */
void init_main_window(const gchar * glade_file) static void init_main_window(const gchar *glade_file)
{ {
GladeXML *xml; GladeXML *xml;
GtkWidget *widget; GtkWidget *widget;
...@@ -190,7 +188,7 @@ void init_main_window(const gchar * glade_file) ...@@ -190,7 +188,7 @@ void init_main_window(const gchar * glade_file)
gtk_widget_show(main_wnd); gtk_widget_show(main_wnd);
} }
void init_tree_model(void) static void init_tree_model(void)
{ {
gint i; gint i;
...@@ -220,7 +218,7 @@ void init_tree_model(void) ...@@ -220,7 +218,7 @@ void init_tree_model(void)
model1 = GTK_TREE_MODEL(tree1); model1 = GTK_TREE_MODEL(tree1);
} }
void init_left_tree(void) static void init_left_tree(void)
{ {
GtkTreeView *view = GTK_TREE_VIEW(tree1_w); GtkTreeView *view = GTK_TREE_VIEW(tree1_w);
GtkCellRenderer *renderer; GtkCellRenderer *renderer;
...@@ -262,7 +260,7 @@ static void renderer_edited(GtkCellRendererText * cell, ...@@ -262,7 +260,7 @@ static void renderer_edited(GtkCellRendererText * cell,
const gchar * path_string, const gchar * path_string,
const gchar * new_text, gpointer user_data); const gchar * new_text, gpointer user_data);
void init_right_tree(void) static void init_right_tree(void)
{ {
GtkTreeView *view = GTK_TREE_VIEW(tree2_w); GtkTreeView *view = GTK_TREE_VIEW(tree2_w);
GtkCellRenderer *renderer; GtkCellRenderer *renderer;
...@@ -1212,8 +1210,8 @@ static GtkTreeIter found; ...@@ -1212,8 +1210,8 @@ static GtkTreeIter found;
/* /*
* Find a menu in the GtkTree starting at parent. * Find a menu in the GtkTree starting at parent.
*/ */
GtkTreeIter *gtktree_iter_find_node(GtkTreeIter * parent, static GtkTreeIter *gtktree_iter_find_node(GtkTreeIter *parent,
struct menu *tofind) struct menu *tofind)
{ {
GtkTreeIter iter; GtkTreeIter iter;
GtkTreeIter *child = &iter; GtkTreeIter *child = &iter;
...@@ -1424,7 +1422,7 @@ static void display_list(void) ...@@ -1424,7 +1422,7 @@ static void display_list(void)
tree = tree2; tree = tree2;
} }
void fixup_rootmenu(struct menu *menu) static void fixup_rootmenu(struct menu *menu)
{ {
struct menu *child; struct menu *child;
static int menu_cnt = 0; static int menu_cnt = 0;
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/ */
static const char *xpm_load[] = { #include "images.h"
const char *xpm_load[] = {
"22 22 5 1", "22 22 5 1",
". c None", ". c None",
"# c #000000", "# c #000000",
...@@ -33,7 +35,7 @@ static const char *xpm_load[] = { ...@@ -33,7 +35,7 @@ static const char *xpm_load[] = {
"###############.......", "###############.......",
"......................"}; "......................"};
static const char *xpm_save[] = { const char *xpm_save[] = {
"22 22 5 1", "22 22 5 1",
". c None", ". c None",
"# c #000000", "# c #000000",
...@@ -63,7 +65,7 @@ static const char *xpm_save[] = { ...@@ -63,7 +65,7 @@ static const char *xpm_save[] = {
"..##################..", "..##################..",
"......................"}; "......................"};
static const char *xpm_back[] = { const char *xpm_back[] = {
"22 22 3 1", "22 22 3 1",
". c None", ". c None",
"# c #000083", "# c #000083",
...@@ -91,7 +93,7 @@ static const char *xpm_back[] = { ...@@ -91,7 +93,7 @@ static const char *xpm_back[] = {
"......................", "......................",
"......................"}; "......................"};
static const char *xpm_tree_view[] = { const char *xpm_tree_view[] = {
"22 22 2 1", "22 22 2 1",
". c None", ". c None",
"# c #000000", "# c #000000",
...@@ -118,7 +120,7 @@ static const char *xpm_tree_view[] = { ...@@ -118,7 +120,7 @@ static const char *xpm_tree_view[] = {
"......................", "......................",
"......................"}; "......................"};
static const char *xpm_single_view[] = { const char *xpm_single_view[] = {
"22 22 2 1", "22 22 2 1",
". c None", ". c None",
"# c #000000", "# c #000000",
...@@ -145,7 +147,7 @@ static const char *xpm_single_view[] = { ...@@ -145,7 +147,7 @@ static const char *xpm_single_view[] = {
"......................", "......................",
"......................"}; "......................"};
static const char *xpm_split_view[] = { const char *xpm_split_view[] = {
"22 22 2 1", "22 22 2 1",
". c None", ". c None",
"# c #000000", "# c #000000",
...@@ -172,7 +174,7 @@ static const char *xpm_split_view[] = { ...@@ -172,7 +174,7 @@ static const char *xpm_split_view[] = {
"......................", "......................",
"......................"}; "......................"};
static const char *xpm_symbol_no[] = { const char *xpm_symbol_no[] = {
"12 12 2 1", "12 12 2 1",
" c white", " c white",
". c black", ". c black",
...@@ -189,7 +191,7 @@ static const char *xpm_symbol_no[] = { ...@@ -189,7 +191,7 @@ static const char *xpm_symbol_no[] = {
" .......... ", " .......... ",
" "}; " "};
static const char *xpm_symbol_mod[] = { const char *xpm_symbol_mod[] = {
"12 12 2 1", "12 12 2 1",
" c white", " c white",
". c black", ". c black",
...@@ -206,7 +208,7 @@ static const char *xpm_symbol_mod[] = { ...@@ -206,7 +208,7 @@ static const char *xpm_symbol_mod[] = {
" .......... ", " .......... ",
" "}; " "};
static const char *xpm_symbol_yes[] = { const char *xpm_symbol_yes[] = {
"12 12 2 1", "12 12 2 1",
" c white", " c white",
". c black", ". c black",
...@@ -223,7 +225,7 @@ static const char *xpm_symbol_yes[] = { ...@@ -223,7 +225,7 @@ static const char *xpm_symbol_yes[] = {
" .......... ", " .......... ",
" "}; " "};
static const char *xpm_choice_no[] = { const char *xpm_choice_no[] = {
"12 12 2 1", "12 12 2 1",
" c white", " c white",
". c black", ". c black",
...@@ -240,7 +242,7 @@ static const char *xpm_choice_no[] = { ...@@ -240,7 +242,7 @@ static const char *xpm_choice_no[] = {
" .... ", " .... ",
" "}; " "};
static const char *xpm_choice_yes[] = { const char *xpm_choice_yes[] = {
"12 12 2 1", "12 12 2 1",
" c white", " c white",
". c black", ". c black",
...@@ -257,7 +259,7 @@ static const char *xpm_choice_yes[] = { ...@@ -257,7 +259,7 @@ static const char *xpm_choice_yes[] = {
" .... ", " .... ",
" "}; " "};
static const char *xpm_menu[] = { const char *xpm_menu[] = {
"12 12 2 1", "12 12 2 1",
" c white", " c white",
". c black", ". c black",
...@@ -274,7 +276,7 @@ static const char *xpm_menu[] = { ...@@ -274,7 +276,7 @@ static const char *xpm_menu[] = {
" .......... ", " .......... ",
" "}; " "};
static const char *xpm_menu_inv[] = { const char *xpm_menu_inv[] = {
"12 12 2 1", "12 12 2 1",
" c white", " c white",
". c black", ". c black",
...@@ -291,7 +293,7 @@ static const char *xpm_menu_inv[] = { ...@@ -291,7 +293,7 @@ static const char *xpm_menu_inv[] = {
" .......... ", " .......... ",
" "}; " "};
static const char *xpm_menuback[] = { const char *xpm_menuback[] = {
"12 12 2 1", "12 12 2 1",
" c white", " c white",
". c black", ". c black",
...@@ -308,7 +310,7 @@ static const char *xpm_menuback[] = { ...@@ -308,7 +310,7 @@ static const char *xpm_menuback[] = {
" .......... ", " .......... ",
" "}; " "};
static const char *xpm_void[] = { const char *xpm_void[] = {
"12 12 2 1", "12 12 2 1",
" c white", " c white",
". c black", ". c black",
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
*/
#ifndef IMAGES_H
#define IMAGES_H
#ifdef __cplusplus
extern "C" {
#endif
extern const char *xpm_load[];
extern const char *xpm_save[];
extern const char *xpm_back[];
extern const char *xpm_tree_view[];
extern const char *xpm_single_view[];
extern const char *xpm_split_view[];
extern const char *xpm_symbol_no[];
extern const char *xpm_symbol_mod[];
extern const char *xpm_symbol_yes[];
extern const char *xpm_choice_no[];
extern const char *xpm_choice_yes[];
extern const char *xpm_menu[];
extern const char *xpm_menu_inv[];
extern const char *xpm_menuback[];
extern const char *xpm_void[];
#ifdef __cplusplus
}
#endif
#endif /* IMAGES_H */
static struct kconf_id kconf_id_array[] = {
{ "mainmenu", T_MAINMENU, TF_COMMAND },
{ "menu", T_MENU, TF_COMMAND },
{ "endmenu", T_ENDMENU, TF_COMMAND },
{ "source", T_SOURCE, TF_COMMAND },
{ "choice", T_CHOICE, TF_COMMAND },
{ "endchoice", T_ENDCHOICE, TF_COMMAND },
{ "comment", T_COMMENT, TF_COMMAND },
{ "config", T_CONFIG, TF_COMMAND },
{ "menuconfig", T_MENUCONFIG, TF_COMMAND },
{ "help", T_HELP, TF_COMMAND },
{ "---help---", T_HELP, TF_COMMAND },
{ "if", T_IF, TF_COMMAND|TF_PARAM },
{ "endif", T_ENDIF, TF_COMMAND },
{ "depends", T_DEPENDS, TF_COMMAND },
{ "optional", T_OPTIONAL, TF_COMMAND },
{ "default", T_DEFAULT, TF_COMMAND, S_UNKNOWN },
{ "prompt", T_PROMPT, TF_COMMAND },
{ "tristate", T_TYPE, TF_COMMAND, S_TRISTATE },
{ "def_tristate", T_DEFAULT, TF_COMMAND, S_TRISTATE },
{ "bool", T_TYPE, TF_COMMAND, S_BOOLEAN },
{ "def_bool", T_DEFAULT, TF_COMMAND, S_BOOLEAN },
{ "int", T_TYPE, TF_COMMAND, S_INT },
{ "hex", T_TYPE, TF_COMMAND, S_HEX },
{ "string", T_TYPE, TF_COMMAND, S_STRING },
{ "select", T_SELECT, TF_COMMAND },
{ "imply", T_IMPLY, TF_COMMAND },
{ "range", T_RANGE, TF_COMMAND },
{ "visible", T_VISIBLE, TF_COMMAND },
{ "option", T_OPTION, TF_COMMAND },
{ "on", T_ON, TF_PARAM },
{ "modules", T_OPT_MODULES, TF_OPTION },
{ "defconfig_list", T_OPT_DEFCONFIG_LIST, TF_OPTION },
{ "allnoconfig_y", T_OPT_ALLNOCONFIG_Y, TF_OPTION },
};
#define KCONF_ID_ARRAY_SIZE (sizeof(kconf_id_array)/sizeof(struct kconf_id))
static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len)
{
int i;
for (i = 0; i < KCONF_ID_ARRAY_SIZE; i++) {
struct kconf_id *id = kconf_id_array+i;
int l = strlen(id->name);
if (len == l && !memcmp(str, id->name, len))
return id;
}
return NULL;
}
/* SPDX-License-Identifier: GPL-2.0 */
/* /*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/ */
#ifndef LKC_H #ifndef LKC_H
...@@ -30,10 +30,6 @@ static inline const char *CONFIG_prefix(void) ...@@ -30,10 +30,6 @@ static inline const char *CONFIG_prefix(void)
#undef CONFIG_ #undef CONFIG_
#define CONFIG_ CONFIG_prefix() #define CONFIG_ CONFIG_prefix()
#define TF_COMMAND 0x0001
#define TF_PARAM 0x0002
#define TF_OPTION 0x0004
enum conf_def_mode { enum conf_def_mode {
def_default, def_default,
def_yes, def_yes,
...@@ -42,17 +38,6 @@ enum conf_def_mode { ...@@ -42,17 +38,6 @@ enum conf_def_mode {
def_random def_random
}; };
#define T_OPT_MODULES 1
#define T_OPT_DEFCONFIG_LIST 2
#define T_OPT_ALLNOCONFIG_Y 4
struct kconf_id {
const char *name;
int token;
unsigned int flags;
enum symbol_type stype;
};
extern int yylineno; extern int yylineno;
void zconfdump(FILE *out); void zconfdump(FILE *out);
void zconf_starthelp(void); void zconf_starthelp(void);
...@@ -91,7 +76,9 @@ void menu_add_visibility(struct expr *dep); ...@@ -91,7 +76,9 @@ void menu_add_visibility(struct expr *dep);
struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
void menu_add_option(int token, char *arg); void menu_add_option_modules(void);
void menu_add_option_defconfig_list(void);
void menu_add_option_allnoconfig_y(void);
void menu_finalize(struct menu *parent); void menu_finalize(struct menu *parent);
void menu_set_type(int type); void menu_set_type(int type);
...@@ -103,6 +90,9 @@ void *xrealloc(void *p, size_t size); ...@@ -103,6 +90,9 @@ void *xrealloc(void *p, size_t size);
char *xstrdup(const char *s); char *xstrdup(const char *s);
char *xstrndup(const char *s, size_t n); char *xstrndup(const char *s, size_t n);
/* zconf.l */
int yylex(void);
struct gstr { struct gstr {
size_t len; size_t len;
char *s; char *s;
...@@ -121,6 +111,7 @@ const char *str_get(struct gstr *gs); ...@@ -121,6 +111,7 @@ const char *str_get(struct gstr *gs);
/* symbol.c */ /* symbol.c */
void sym_clear_all_valid(void); void sym_clear_all_valid(void);
struct symbol *sym_choice_default(struct symbol *sym); struct symbol *sym_choice_default(struct symbol *sym);
struct property *sym_get_range_prop(struct symbol *sym);
const char *sym_get_string_default(struct symbol *sym); const char *sym_get_string_default(struct symbol *sym);
struct symbol *sym_check_deps(struct symbol *sym); struct symbol *sym_check_deps(struct symbol *sym);
struct property *prop_alloc(enum prop_type type, struct symbol *sym); struct property *prop_alloc(enum prop_type type, struct symbol *sym);
......
// SPDX-License-Identifier: GPL-2.0+
/* /*
* checklist.c -- implements the checklist box * checklist.c -- implements the checklist box
* *
...@@ -5,20 +6,6 @@ ...@@ -5,20 +6,6 @@
* Stuart Herbert - S.Herbert@sheffield.ac.uk: radiolist extension * Stuart Herbert - S.Herbert@sheffield.ac.uk: radiolist extension
* Alessandro Rubini - rubini@ipvvis.unipv.it: merged the two * Alessandro Rubini - rubini@ipvvis.unipv.it: merged the two
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include "dialog.h" #include "dialog.h"
......
/* SPDX-License-Identifier: GPL-2.0+ */
/* /*
* dialog.h -- common declarations for all dialog modules * dialog.h -- common declarations for all dialog modules
* *
* AUTHOR: Savio Lam (lam836@cs.cuhk.hk) * AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <sys/types.h> #include <sys/types.h>
......
// SPDX-License-Identifier: GPL-2.0+
/* /*
* inputbox.c -- implements the input box * inputbox.c -- implements the input box
* *
* ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include "dialog.h" #include "dialog.h"
......
// SPDX-License-Identifier: GPL-2.0+
/* /*
* menubox.c -- implements the menu box * menubox.c -- implements the menu box
* *
* ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcapw@cfw.com) * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcapw@cfw.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* /*
......
// SPDX-License-Identifier: GPL-2.0+
/* /*
* textbox.c -- implements the text box * textbox.c -- implements the text box
* *
* ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include "dialog.h" #include "dialog.h"
......
// SPDX-License-Identifier: GPL-2.0+
/* /*
* util.c * util.c
* *
* ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <stdarg.h> #include <stdarg.h>
......
// SPDX-License-Identifier: GPL-2.0+
/* /*
* yesno.c -- implements the yes/no box * yesno.c -- implements the yes/no box
* *
* ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
* MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include "dialog.h" #include "dialog.h"
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
* *
* Introduced single menu mode (show all sub-menus in one large tree). * Introduced single menu mode (show all sub-menus in one large tree).
* 2002-11-06 Petr Baudis <pasky@ucw.cz> * 2002-11-06 Petr Baudis <pasky@ucw.cz>
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/ */
#include <ctype.h> #include <ctype.h>
...@@ -195,29 +195,26 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep) ...@@ -195,29 +195,26 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep); menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep);
} }
void menu_add_option(int token, char *arg) void menu_add_option_modules(void)
{ {
switch (token) { if (modules_sym)
case T_OPT_MODULES: zconf_error("symbol '%s' redefines option 'modules' already defined by symbol '%s'",
if (modules_sym) current_entry->sym->name, modules_sym->name);
zconf_error("symbol '%s' redefines option 'modules'" modules_sym = current_entry->sym;
" already defined by symbol '%s'", }
current_entry->sym->name,
modules_sym->name void menu_add_option_defconfig_list(void)
); {
modules_sym = current_entry->sym; if (!sym_defconfig_list)
break; sym_defconfig_list = current_entry->sym;
case T_OPT_DEFCONFIG_LIST: else if (sym_defconfig_list != current_entry->sym)
if (!sym_defconfig_list) zconf_error("trying to redefine defconfig symbol");
sym_defconfig_list = current_entry->sym; sym_defconfig_list->flags |= SYMBOL_NO_WRITE;
else if (sym_defconfig_list != current_entry->sym) }
zconf_error("trying to redefine defconfig symbol");
sym_defconfig_list->flags |= SYMBOL_NO_WRITE; void menu_add_option_allnoconfig_y(void)
break; {
case T_OPT_ALLNOCONFIG_Y: current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y;
current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y;
break;
}
} }
static int menu_validate_number(struct symbol *sym, struct symbol *sym2) static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# merge_config.sh - Takes a list of config fragment values, and merges # merge_config.sh - Takes a list of config fragment values, and merges
# them one by one. Provides warnings on overridden values, and specified # them one by one. Provides warnings on overridden values, and specified
# values that did not make it to the resulting .config file (due to missed # values that did not make it to the resulting .config file (due to missed
...@@ -10,18 +12,10 @@ ...@@ -10,18 +12,10 @@
# #
# Copyright (c) 2009-2010 Wind River Systems, Inc. # Copyright (c) 2009-2010 Wind River Systems, Inc.
# Copyright 2011 Linaro # Copyright 2011 Linaro
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
clean_up() { clean_up() {
rm -f $TMP_FILE rm -f $TMP_FILE
rm -f $MERGE_FILE
exit exit
} }
trap clean_up HUP INT TERM trap clean_up HUP INT TERM
...@@ -32,6 +26,7 @@ usage() { ...@@ -32,6 +26,7 @@ usage() {
echo " -m only merge the fragments, do not execute the make command" echo " -m only merge the fragments, do not execute the make command"
echo " -n use allnoconfig instead of alldefconfig" echo " -n use allnoconfig instead of alldefconfig"
echo " -r list redundant entries when merging fragments" echo " -r list redundant entries when merging fragments"
echo " -y make builtin have precedence over modules"
echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead." echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead."
echo echo
echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable." echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable."
...@@ -40,6 +35,7 @@ usage() { ...@@ -40,6 +35,7 @@ usage() {
RUNMAKE=true RUNMAKE=true
ALLTARGET=alldefconfig ALLTARGET=alldefconfig
WARNREDUN=false WARNREDUN=false
BUILTIN=false
OUTPUT=. OUTPUT=.
CONFIG_PREFIX=${CONFIG_-CONFIG_} CONFIG_PREFIX=${CONFIG_-CONFIG_}
...@@ -64,6 +60,11 @@ while true; do ...@@ -64,6 +60,11 @@ while true; do
shift shift
continue continue
;; ;;
"-y")
BUILTIN=true
shift
continue
;;
"-O") "-O")
if [ -d $2 ];then if [ -d $2 ];then
OUTPUT=$(echo $2 | sed 's/\/*$//') OUTPUT=$(echo $2 | sed 's/\/*$//')
...@@ -106,32 +107,45 @@ SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p" ...@@ -106,32 +107,45 @@ SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p"
SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p" SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p"
TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
MERGE_FILE=$(mktemp ./.merge_tmp.config.XXXXXXXXXX)
echo "Using $INITFILE as base" echo "Using $INITFILE as base"
cat $INITFILE > $TMP_FILE cat $INITFILE > $TMP_FILE
# Merge files, printing warnings on overridden values # Merge files, printing warnings on overridden values
for MERGE_FILE in $MERGE_LIST ; do for ORIG_MERGE_FILE in $MERGE_LIST ; do
echo "Merging $MERGE_FILE" echo "Merging $ORIG_MERGE_FILE"
if [ ! -r "$MERGE_FILE" ]; then if [ ! -r "$ORIG_MERGE_FILE" ]; then
echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2 echo "The merge file '$ORIG_MERGE_FILE' does not exist. Exit." >&2
exit 1 exit 1
fi fi
cat $ORIG_MERGE_FILE > $MERGE_FILE
CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE) CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE)
for CFG in $CFG_LIST ; do for CFG in $CFG_LIST ; do
grep -q -w $CFG $TMP_FILE || continue grep -q -w $CFG $TMP_FILE || continue
PREV_VAL=$(grep -w $CFG $TMP_FILE) PREV_VAL=$(grep -w $CFG $TMP_FILE)
NEW_VAL=$(grep -w $CFG $MERGE_FILE) NEW_VAL=$(grep -w $CFG $MERGE_FILE)
if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then BUILTIN_FLAG=false
echo Value of $CFG is redefined by fragment $MERGE_FILE: if [ "$BUILTIN" = "true" ] && [ "${NEW_VAL#CONFIG_*=}" = "m" ] && [ "${PREV_VAL#CONFIG_*=}" = "y" ]; then
echo Previous value: $PREV_VAL
echo New value: $NEW_VAL
echo -y passed, will not demote y to m
echo
BUILTIN_FLAG=true
elif [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
echo Value of $CFG is redefined by fragment $ORIG_MERGE_FILE:
echo Previous value: $PREV_VAL echo Previous value: $PREV_VAL
echo New value: $NEW_VAL echo New value: $NEW_VAL
echo echo
elif [ "$WARNREDUN" = "true" ]; then elif [ "$WARNREDUN" = "true" ]; then
echo Value of $CFG is redundant by fragment $MERGE_FILE: echo Value of $CFG is redundant by fragment $ORIG_MERGE_FILE:
fi
if [ "$BUILTIN_FLAG" = "false" ]; then
sed -i "/$CFG[ =]/d" $TMP_FILE
else
sed -i "/$CFG[ =]/d" $MERGE_FILE
fi fi
sed -i "/$CFG[ =]/d" $TMP_FILE
done done
cat $MERGE_FILE >> $TMP_FILE cat $MERGE_FILE >> $TMP_FILE
done done
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com? * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
* Released under the terms of the GNU GPL v2.0.
* *
* Derived from menuconfig. * Derived from menuconfig.
*
*/ */
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
#define _GNU_SOURCE #define _GNU_SOURCE
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com? * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
* Released under the terms of the GNU GPL v2.0.
* *
* Derived from menuconfig. * Derived from menuconfig.
*
*/ */
#include "nconf.h" #include "nconf.h"
#include "lkc.h" #include "lkc.h"
......
/* SPDX-License-Identifier: GPL-2.0 */
/* /*
* Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com? * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
* Released under the terms of the GNU GPL v2.0.
* *
* Derived from menuconfig. * Derived from menuconfig.
*
*/ */
#include <ctype.h> #include <ctype.h>
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// //
// Copyright (C) 2018 Masahiro Yamada <yamada.masahiro@socionext.com> // Copyright (C) 2018 Masahiro Yamada <yamada.masahiro@socionext.com>
#include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
...@@ -9,6 +10,7 @@ ...@@ -9,6 +10,7 @@
#include <string.h> #include <string.h>
#include "list.h" #include "list.h"
#include "lkc.h"
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
...@@ -555,8 +557,7 @@ char *expand_string(const char *in) ...@@ -555,8 +557,7 @@ char *expand_string(const char *in)
static bool is_end_of_token(char c) static bool is_end_of_token(char c)
{ {
/* Why are '.' and '/' valid characters for symbols? */ return !(isalnum(c) || c == '_' || c == '-');
return !(isalnum(c) || c == '_' || c == '-' || c == '.' || c == '/');
} }
/* /*
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com> * Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com>
* Released under the terms of the GNU GPL v2.0.
*/ */
#include <qglobal.h> #include <qglobal.h>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "qconf.h" #include "qconf.h"
#include "qconf.moc" #include "qconf.moc"
#include "images.c" #include "images.h"
static QApplication *configApp; static QApplication *configApp;
......
/* SPDX-License-Identifier: GPL-2.0 */
/* /*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/ */
#include <QTextBrowser> #include <QTextBrowser>
......
#!/usr/bin/env perl #!/usr/bin/env perl
# SPDX-License-Identifier: GPL-2.0
# #
# Copyright 2005-2009 - Steven Rostedt # Copyright 2005-2009 - Steven Rostedt
# Licensed under the terms of the GNU GPL License version 2
# #
# It's simple enough to figure out how this works. # It's simple enough to figure out how this works.
# If not, then you can ask me at stripconfig@goodmis.org # If not, then you can ask me at stripconfig@goodmis.org
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/ */
#include <ctype.h> #include <ctype.h>
...@@ -61,8 +61,6 @@ const char *sym_type_name(enum symbol_type type) ...@@ -61,8 +61,6 @@ const char *sym_type_name(enum symbol_type type)
return "string"; return "string";
case S_UNKNOWN: case S_UNKNOWN:
return "unknown"; return "unknown";
case S_OTHER:
break;
} }
return "???"; return "???";
} }
...@@ -88,7 +86,7 @@ static struct property *sym_get_default_prop(struct symbol *sym) ...@@ -88,7 +86,7 @@ static struct property *sym_get_default_prop(struct symbol *sym)
return NULL; return NULL;
} }
static struct property *sym_get_range_prop(struct symbol *sym) struct property *sym_get_range_prop(struct symbol *sym)
{ {
struct property *prop; struct property *prop;
...@@ -757,7 +755,6 @@ const char *sym_get_string_default(struct symbol *sym) ...@@ -757,7 +755,6 @@ const char *sym_get_string_default(struct symbol *sym)
return str; return str;
case S_STRING: case S_STRING:
return str; return str;
case S_OTHER:
case S_UNKNOWN: case S_UNKNOWN:
break; break;
} }
......
# SPDX-License-Identifier: GPL-2.0
config A config A
bool "A" bool "A"
default y default y
......
# SPDX-License-Identifier: GPL-2.0
""" """
Create submenu for symbols that depend on the preceding one. Create submenu for symbols that depend on the preceding one.
......
# SPDX-License-Identifier: GPL-2.0
config MODULES config MODULES
bool "Enable loadable module support" bool "Enable loadable module support"
option modules option modules
......
# SPDX-License-Identifier: GPL-2.0
""" """
Basic choice tests. Basic choice tests.
......
# SPDX-License-Identifier: GPL-2.0
config MODULES config MODULES
def_bool y def_bool y
option modules option modules
......
# SPDX-License-Identifier: GPL-2.0
""" """
Hide tristate choice values with mod dependency in y choice. Hide tristate choice values with mod dependency in y choice.
......
# SPDX-License-Identifier: GPL-2.0
""" """
Detect recursive inclusion error. Detect recursive inclusion error.
......
# SPDX-License-Identifier: GPL-2.0
config MODULES config MODULES
def_bool y def_bool y
option modules option modules
......
# SPDX-License-Identifier: GPL-2.0
""" """
Do not affect user-assigned choice value by another choice. Do not affect user-assigned choice value by another choice.
......
# SPDX-License-Identifier: GPL-2.0
config A config A
bool "A" bool "A"
help help
......
# SPDX-License-Identifier: GPL-2.0
""" """
Ask new choice values when they become visible. Ask new choice values when they become visible.
......
# SPDX-License-Identifier: GPL-2.0
config A config A
bool "A" bool "A"
......
# SPDX-License-Identifier: GPL-2.0
""" """
Do not write choice values to .config if the dependency is unmet. Do not write choice values to .config if the dependency is unmet.
......
# SPDX-License-Identifier: GPL-2.0
choice choice
prompt "choice" prompt "choice"
......
# SPDX-License-Identifier: GPL-2.0
""" """
Set random values recursively in nested choices. Set random values recursively in nested choices.
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (C) 2002-2005 Roman Zippel <zippel@linux-m68k.org> * Copyright (C) 2002-2005 Roman Zippel <zippel@linux-m68k.org>
* Copyright (C) 2002-2005 Sam Ravnborg <sam@ravnborg.org> * Copyright (C) 2002-2005 Sam Ravnborg <sam@ravnborg.org>
*
* Released under the terms of the GNU GPL v2.0.
*/ */
#include <stdarg.h> #include <stdarg.h>
......
%option nostdinit noyywrap never-interactive full ecs /* SPDX-License-Identifier: GPL-2.0 */
%option 8bit nodefault yylineno
%x COMMAND HELP STRING PARAM ASSIGN_VAL
%{
/* /*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/ */
%option nostdinit noyywrap never-interactive full ecs
%option 8bit nodefault yylineno
%x ASSIGN_VAL HELP STRING
%{
#include <assert.h> #include <assert.h>
#include <limits.h> #include <limits.h>
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
#include <unistd.h> #include <unistd.h>
#include "lkc.h" #include "lkc.h"
#include "zconf.tab.h"
#define YY_DECL static int yylex1(void)
#define START_STRSIZE 16 #define START_STRSIZE 16
...@@ -23,6 +26,8 @@ static struct { ...@@ -23,6 +26,8 @@ static struct {
int lineno; int lineno;
} current_pos; } current_pos;
static int prev_prev_token = T_EOL;
static int prev_token = T_EOL;
static char *text; static char *text;
static int text_size, text_asize; static int text_size, text_asize;
...@@ -73,7 +78,7 @@ static void warn_ignored_character(char chr) ...@@ -73,7 +78,7 @@ static void warn_ignored_character(char chr)
{ {
fprintf(stderr, fprintf(stderr,
"%s:%d:warning: ignoring unsupported character '%c'\n", "%s:%d:warning: ignoring unsupported character '%c'\n",
zconf_curname(), zconf_lineno(), chr); current_file->name, yylineno, chr);
} }
%} %}
...@@ -83,54 +88,73 @@ n [A-Za-z0-9_-] ...@@ -83,54 +88,73 @@ n [A-Za-z0-9_-]
int str = 0; int str = 0;
int ts, i; int ts, i;
[ \t]*#.*\n | #.* /* ignore comment */
[ \t]*\n { [ \t]* /* whitespaces */
return T_EOL; \\\n /* escaped new line */
} \n return T_EOL;
[ \t]*#.* "allnoconfig_y" return T_ALLNOCONFIG_Y;
"bool" return T_BOOL;
"choice" return T_CHOICE;
[ \t]+ { "comment" return T_COMMENT;
BEGIN(COMMAND); "config" return T_CONFIG;
} "def_bool" return T_DEF_BOOL;
"def_tristate" return T_DEF_TRISTATE;
. { "default" return T_DEFAULT;
unput(yytext[0]); "defconfig_list" return T_DEFCONFIG_LIST;
BEGIN(COMMAND); "depends" return T_DEPENDS;
} "endchoice" return T_ENDCHOICE;
"endif" return T_ENDIF;
"endmenu" return T_ENDMENU;
<COMMAND>{ "help"|"---help---" return T_HELP;
{n}+ { "hex" return T_HEX;
const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); "if" return T_IF;
current_pos.file = current_file; "imply" return T_IMPLY;
current_pos.lineno = yylineno; "int" return T_INT;
if (id && id->flags & TF_COMMAND) { "mainmenu" return T_MAINMENU;
BEGIN(PARAM); "menu" return T_MENU;
yylval.id = id; "menuconfig" return T_MENUCONFIG;
return id->token; "modules" return T_MODULES;
} "on" return T_ON;
alloc_string(yytext, yyleng); "option" return T_OPTION;
yylval.string = text; "optional" return T_OPTIONAL;
return T_VARIABLE; "prompt" return T_PROMPT;
} "range" return T_RANGE;
({n}|$)+ { "select" return T_SELECT;
/* this token includes at least one '$' */ "source" return T_SOURCE;
yylval.string = expand_token(yytext, yyleng); "string" return T_STRING;
if (strlen(yylval.string)) "tristate" return T_TRISTATE;
return T_VARIABLE; "visible" return T_VISIBLE;
free(yylval.string); "||" return T_OR;
} "&&" return T_AND;
"=" { BEGIN(ASSIGN_VAL); yylval.flavor = VAR_RECURSIVE; return T_ASSIGN; } "=" return T_EQUAL;
":=" { BEGIN(ASSIGN_VAL); yylval.flavor = VAR_SIMPLE; return T_ASSIGN; } "!=" return T_UNEQUAL;
"+=" { BEGIN(ASSIGN_VAL); yylval.flavor = VAR_APPEND; return T_ASSIGN; } "<" return T_LESS;
[[:blank:]]+ "<=" return T_LESS_EQUAL;
. warn_ignored_character(*yytext); ">" return T_GREATER;
\n { ">=" return T_GREATER_EQUAL;
BEGIN(INITIAL); "!" return T_NOT;
return T_EOL; "(" return T_OPEN_PAREN;
} ")" return T_CLOSE_PAREN;
} ":=" return T_COLON_EQUAL;
"+=" return T_PLUS_EQUAL;
\"|\' {
str = yytext[0];
new_string();
BEGIN(STRING);
}
{n}+ {
alloc_string(yytext, yyleng);
yylval.string = text;
return T_WORD;
}
({n}|$)+ {
/* this token includes at least one '$' */
yylval.string = expand_token(yytext, yyleng);
if (strlen(yylval.string))
return T_WORD;
free(yylval.string);
}
. warn_ignored_character(*yytext);
<ASSIGN_VAL>{ <ASSIGN_VAL>{
[^[:blank:]\n]+.* { [^[:blank:]\n]+.* {
...@@ -142,71 +166,17 @@ n [A-Za-z0-9_-] ...@@ -142,71 +166,17 @@ n [A-Za-z0-9_-]
. .
} }
<PARAM>{
"&&" return T_AND;
"||" return T_OR;
"(" return T_OPEN_PAREN;
")" return T_CLOSE_PAREN;
"!" return T_NOT;
"=" return T_EQUAL;
"!=" return T_UNEQUAL;
"<=" return T_LESS_EQUAL;
">=" return T_GREATER_EQUAL;
"<" return T_LESS;
">" return T_GREATER;
\"|\' {
str = yytext[0];
new_string();
BEGIN(STRING);
}
\n BEGIN(INITIAL); return T_EOL;
({n}|[/.])+ {
const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
if (id && id->flags & TF_PARAM) {
yylval.id = id;
return id->token;
}
alloc_string(yytext, yyleng);
yylval.string = text;
return T_WORD;
}
({n}|[/.$])+ {
/* this token includes at least one '$' */
yylval.string = expand_token(yytext, yyleng);
if (strlen(yylval.string))
return T_WORD;
free(yylval.string);
}
#.* /* comment */
\\\n ;
[[:blank:]]+
. warn_ignored_character(*yytext);
<<EOF>> {
BEGIN(INITIAL);
}
}
<STRING>{ <STRING>{
"$".* append_expanded_string(yytext); "$".* append_expanded_string(yytext);
[^$'"\\\n]+/\n {
append_string(yytext, yyleng);
yylval.string = text;
return T_WORD_QUOTE;
}
[^$'"\\\n]+ { [^$'"\\\n]+ {
append_string(yytext, yyleng); append_string(yytext, yyleng);
} }
\\.?/\n {
append_string(yytext + 1, yyleng - 1);
yylval.string = text;
return T_WORD_QUOTE;
}
\\.? { \\.? {
append_string(yytext + 1, yyleng - 1); append_string(yytext + 1, yyleng - 1);
} }
\'|\" { \'|\" {
if (str == yytext[0]) { if (str == yytext[0]) {
BEGIN(PARAM); BEGIN(INITIAL);
yylval.string = text; yylval.string = text;
return T_WORD_QUOTE; return T_WORD_QUOTE;
} else } else
...@@ -216,11 +186,15 @@ n [A-Za-z0-9_-] ...@@ -216,11 +186,15 @@ n [A-Za-z0-9_-]
fprintf(stderr, fprintf(stderr,
"%s:%d:warning: multi-line strings not supported\n", "%s:%d:warning: multi-line strings not supported\n",
zconf_curname(), zconf_lineno()); zconf_curname(), zconf_lineno());
unput('\n');
BEGIN(INITIAL); BEGIN(INITIAL);
return T_EOL; yylval.string = text;
return T_WORD_QUOTE;
} }
<<EOF>> { <<EOF>> {
BEGIN(INITIAL); BEGIN(INITIAL);
yylval.string = text;
return T_WORD_QUOTE;
} }
} }
...@@ -271,6 +245,12 @@ n [A-Za-z0-9_-] ...@@ -271,6 +245,12 @@ n [A-Za-z0-9_-]
} }
<<EOF>> { <<EOF>> {
BEGIN(INITIAL);
if (prev_token != T_EOL && prev_token != T_HELPTEXT)
fprintf(stderr, "%s:%d:warning: no new line at end of file\n",
current_file->name, yylineno);
if (current_file) { if (current_file) {
zconf_endfile(); zconf_endfile();
return T_EOL; return T_EOL;
...@@ -280,6 +260,41 @@ n [A-Za-z0-9_-] ...@@ -280,6 +260,41 @@ n [A-Za-z0-9_-]
} }
%% %%
/* second stage lexer */
int yylex(void)
{
int token;
repeat:
token = yylex1();
if (prev_token == T_EOL || prev_token == T_HELPTEXT) {
if (token == T_EOL) {
/* Do not pass unneeded T_EOL to the parser. */
goto repeat;
} else {
/*
* For the parser, update file/lineno at the first token
* of each statement. Generally, \n is a statement
* terminator in Kconfig, but it is not always true
* because \n could be escaped by a backslash.
*/
current_pos.file = current_file;
current_pos.lineno = yylineno;
}
}
if (prev_prev_token == T_EOL && prev_token == T_WORD &&
(token == T_EQUAL || token == T_COLON_EQUAL || token == T_PLUS_EQUAL))
BEGIN(ASSIGN_VAL);
prev_prev_token = prev_token;
prev_token = token;
return token;
}
static char *expand_token(const char *in, size_t n) static char *expand_token(const char *in, size_t n)
{ {
char *out; char *out;
......
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
menu "Security options" menu "Security options"
source security/keys/Kconfig source "security/keys/Kconfig"
config SECURITY_DMESG_RESTRICT config SECURITY_DMESG_RESTRICT
bool "Restrict unprivileged access to the kernel syslog" bool "Restrict unprivileged access to the kernel syslog"
...@@ -230,14 +230,14 @@ config STATIC_USERMODEHELPER_PATH ...@@ -230,14 +230,14 @@ config STATIC_USERMODEHELPER_PATH
If you wish for all usermode helper programs to be disabled, If you wish for all usermode helper programs to be disabled,
specify an empty string here (i.e. ""). specify an empty string here (i.e. "").
source security/selinux/Kconfig source "security/selinux/Kconfig"
source security/smack/Kconfig source "security/smack/Kconfig"
source security/tomoyo/Kconfig source "security/tomoyo/Kconfig"
source security/apparmor/Kconfig source "security/apparmor/Kconfig"
source security/loadpin/Kconfig source "security/loadpin/Kconfig"
source security/yama/Kconfig source "security/yama/Kconfig"
source security/integrity/Kconfig source "security/integrity/Kconfig"
choice choice
prompt "Default security module" prompt "Default security module"
......
...@@ -66,7 +66,7 @@ config INTEGRITY_AUDIT ...@@ -66,7 +66,7 @@ config INTEGRITY_AUDIT
be enabled by specifying 'integrity_audit=1' on the kernel be enabled by specifying 'integrity_audit=1' on the kernel
command line. command line.
source security/integrity/ima/Kconfig source "security/integrity/ima/Kconfig"
source security/integrity/evm/Kconfig source "security/integrity/evm/Kconfig"
endif # if INTEGRITY endif # if INTEGRITY
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