aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-12 22:56:15 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-12 22:56:15 -0500
commit9465d9cc31fa732089cd8bec9f1bdfcdc174a5ce (patch)
treefb31a0a6271b255ffe6e29b4f9eb4192253f8c7f
parente71c3978d6f97659f6c3ee942c3e581299e4adf2 (diff)
parentc029a2bec66e42e57538cb65e28618baf6a4b311 (diff)
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer updates from Thomas Gleixner: "The time/timekeeping/timer folks deliver with this update: - Fix a reintroduced signed/unsigned issue and cleanup the whole signed/unsigned mess in the timekeeping core so this wont happen accidentaly again. - Add a new trace clock based on boot time - Prevent injection of random sleep times when PM tracing abuses the RTC for storage - Make posix timers configurable for real tiny systems - Add tracepoints for the alarm timer subsystem so timer based suspend wakeups can be instrumented - The usual pile of fixes and updates to core and drivers" * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits) timekeeping: Use mul_u64_u32_shr() instead of open coding it timekeeping: Get rid of pointless typecasts timekeeping: Make the conversion call chain consistently unsigned timekeeping_Force_unsigned_clocksource_to_nanoseconds_conversion alarmtimer: Add tracepoints for alarm timers trace: Update documentation for mono, mono_raw and boot clock trace: Add an option for boot clock as trace clock timekeeping: Add a fast and NMI safe boot clock timekeeping/clocksource_cyc2ns: Document intended range limitation timekeeping: Ignore the bogus sleep time if pm_trace is enabled selftests/timers: Fix spelling mistake "Asyncrhonous" -> "Asynchronous" clocksource/drivers/bcm2835_timer: Unmap region obtained by of_iomap clocksource/drivers/arm_arch_timer: Map frame with of_io_request_and_map() arm64: dts: rockchip: Arch counter doesn't tick in system suspend clocksource/drivers/arm_arch_timer: Don't assume clock runs in suspend posix-timers: Make them configurable posix_cpu_timers: Move the add_device_randomness() call to a proper place timer: Move sys_alarm from timer.c to itimer.c ptp_clock: Allow for it to be optional Kconfig: Regenerate *.c_shipped files after previous changes ...
-rw-r--r--Documentation/devicetree/bindings/arm/arch_timer.txt5
-rw-r--r--Documentation/kbuild/kconfig-language.txt29
-rw-r--r--Documentation/trace/ftrace.txt20
-rw-r--r--arch/alpha/kernel/osf_sys.c8
-rw-r--r--arch/arm64/boot/dts/rockchip/rk3399.dtsi1
-rw-r--r--arch/x86/kernel/rtc.c9
-rw-r--r--drivers/Makefile2
-rw-r--r--drivers/base/power/trace.c27
-rw-r--r--drivers/char/Kconfig1
-rw-r--r--drivers/clocksource/arm_arch_timer.c14
-rw-r--r--drivers/clocksource/bcm2835_timer.c14
-rw-r--r--drivers/net/ethernet/adi/Kconfig2
-rw-r--r--drivers/net/ethernet/amd/Kconfig2
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-main.c6
-rw-r--r--drivers/net/ethernet/broadcom/Kconfig4
-rw-r--r--drivers/net/ethernet/cavium/Kconfig2
-rw-r--r--drivers/net/ethernet/freescale/Kconfig2
-rw-r--r--drivers/net/ethernet/intel/Kconfig10
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/Kconfig2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/Kconfig2
-rw-r--r--drivers/net/ethernet/renesas/Kconfig2
-rw-r--r--drivers/net/ethernet/samsung/Kconfig2
-rw-r--r--drivers/net/ethernet/sfc/Kconfig2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/Kconfig2
-rw-r--r--drivers/net/ethernet/ti/Kconfig2
-rw-r--r--drivers/net/ethernet/tile/Kconfig2
-rw-r--r--drivers/ptp/Kconfig10
-rw-r--r--drivers/rtc/rtc-cmos.c7
-rw-r--r--fs/exec.c2
-rw-r--r--include/linux/alarmtimer.h5
-rw-r--r--include/linux/clocksource.h5
-rw-r--r--include/linux/mc146818rtc.h1
-rw-r--r--include/linux/pm-trace.h9
-rw-r--r--include/linux/ptp_clock_kernel.h65
-rw-r--r--include/linux/time.h2
-rw-r--r--include/linux/timekeeping.h1
-rw-r--r--include/trace/events/alarmtimer.h96
-rw-r--r--init/Kconfig17
-rw-r--r--kernel/compat.c8
-rw-r--r--kernel/exit.c15
-rw-r--r--kernel/fork.c2
-rw-r--r--kernel/signal.c6
-rw-r--r--kernel/sys.c3
-rw-r--r--kernel/time/Makefile10
-rw-r--r--kernel/time/alarmtimer.c59
-rw-r--r--kernel/time/hrtimer.c20
-rw-r--r--kernel/time/itimer.c15
-rw-r--r--kernel/time/posix-cpu-timers.c4
-rw-r--r--kernel/time/posix-stubs.c123
-rw-r--r--kernel/time/timekeeping.c90
-rw-r--r--kernel/time/timer.c48
-rw-r--r--kernel/trace/trace.c1
-rw-r--r--scripts/kconfig/expr.h2
-rw-r--r--scripts/kconfig/menu.c55
-rw-r--r--scripts/kconfig/symbol.c24
-rw-r--r--scripts/kconfig/zconf.gperf1
-rw-r--r--scripts/kconfig/zconf.hash.c_shipped30
-rw-r--r--scripts/kconfig/zconf.tab.c_shipped1581
-rw-r--r--scripts/kconfig/zconf.y16
-rw-r--r--security/selinux/hooks.c11
-rw-r--r--tools/testing/selftests/timers/skew_consistency.c2
61 files changed, 1479 insertions, 1041 deletions
diff --git a/Documentation/devicetree/bindings/arm/arch_timer.txt b/Documentation/devicetree/bindings/arm/arch_timer.txt
index ef5fbe9a77c7..ad440a2b8051 100644
--- a/Documentation/devicetree/bindings/arm/arch_timer.txt
+++ b/Documentation/devicetree/bindings/arm/arch_timer.txt
@@ -38,6 +38,11 @@ to deliver its interrupts via SPIs.
38 architecturally-defined reset values. Only supported for 32-bit 38 architecturally-defined reset values. Only supported for 32-bit
39 systems which follow the ARMv7 architected reset values. 39 systems which follow the ARMv7 architected reset values.
40 40
41- arm,no-tick-in-suspend : The main counter does not tick when the system is in
42 low-power system suspend on some SoCs. This behavior does not match the
43 Architecture Reference Manual's specification that the system counter "must
44 be implemented in an always-on power domain."
45
41 46
42Example: 47Example:
43 48
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index 069fcb3eef6e..262722d8867b 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -113,6 +113,34 @@ applicable everywhere (see syntax).
113 That will limit the usefulness but on the other hand avoid 113 That will limit the usefulness but on the other hand avoid
114 the illegal configurations all over. 114 the illegal configurations all over.
115 115
116- weak reverse dependencies: "imply" <symbol> ["if" <expr>]
117 This is similar to "select" as it enforces a lower limit on another
118 symbol except that the "implied" symbol's value may still be set to n
119 from a direct dependency or with a visible prompt.
120
121 Given the following example:
122
123 config FOO
124 tristate
125 imply BAZ
126
127 config BAZ
128 tristate
129 depends on BAR
130
131 The following values are possible:
132
133 FOO BAR BAZ's default choice for BAZ
134 --- --- ------------- --------------
135 n y n N/m/y
136 m y m M/y/n
137 y y y Y/n
138 y n * N
139
140 This is useful e.g. with multiple drivers that want to indicate their
141 ability to hook into a secondary subsystem while allowing the user to
142 configure that subsystem out without also having to unset these drivers.
143
116- limiting menu display: "visible if" <expr> 144- limiting menu display: "visible if" <expr>
117 This attribute is only applicable to menu blocks, if the condition is 145 This attribute is only applicable to menu blocks, if the condition is
118 false, the menu block is not displayed to the user (the symbols 146 false, the menu block is not displayed to the user (the symbols
@@ -481,6 +509,7 @@ historical issues resolved through these different solutions.
481 b) Match dependency semantics: 509 b) Match dependency semantics:
482 b1) Swap all "select FOO" to "depends on FOO" or, 510 b1) Swap all "select FOO" to "depends on FOO" or,
483 b2) Swap all "depends on FOO" to "select FOO" 511 b2) Swap all "depends on FOO" to "select FOO"
512 c) Consider the use of "imply" instead of "select"
484 513
485The resolution to a) can be tested with the sample Kconfig file 514The resolution to a) can be tested with the sample Kconfig file
486Documentation/kbuild/Kconfig.recursion-issue-01 through the removal 515Documentation/kbuild/Kconfig.recursion-issue-01 through the removal
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt
index 185c39fea2a0..5596e2d71d6d 100644
--- a/Documentation/trace/ftrace.txt
+++ b/Documentation/trace/ftrace.txt
@@ -362,6 +362,26 @@ of ftrace. Here is a list of some of the key files:
362 to correlate events across hypervisor/guest if 362 to correlate events across hypervisor/guest if
363 tb_offset is known. 363 tb_offset is known.
364 364
365 mono: This uses the fast monotonic clock (CLOCK_MONOTONIC)
366 which is monotonic and is subject to NTP rate adjustments.
367
368 mono_raw:
369 This is the raw monotonic clock (CLOCK_MONOTONIC_RAW)
370 which is montonic but is not subject to any rate adjustments
371 and ticks at the same rate as the hardware clocksource.
372
373 boot: This is the boot clock (CLOCK_BOOTTIME) and is based on the
374 fast monotonic clock, but also accounts for time spent in
375 suspend. Since the clock access is designed for use in
376 tracing in the suspend path, some side effects are possible
377 if clock is accessed after the suspend time is accounted before
378 the fast mono clock is updated. In this case, the clock update
379 appears to happen slightly sooner than it normally would have.
380 Also on 32-bit systems, it's possible that the 64-bit boot offset
381 sees a partial update. These effects are rare and post
382 processing should be able to handle them. See comments in the
383 ktime_get_boot_fast_ns() function for more information.
384
365 To set a clock, simply echo the clock name into this file. 385 To set a clock, simply echo the clock name into this file.
366 386
367 echo global > trace_clock 387 echo global > trace_clock
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index ffb93f499c83..56e427c7aa3c 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -1029,11 +1029,16 @@ SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv,
1029 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); 1029 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
1030} 1030}
1031 1031
1032asmlinkage long sys_ni_posix_timers(void);
1033
1032SYSCALL_DEFINE2(osf_getitimer, int, which, struct itimerval32 __user *, it) 1034SYSCALL_DEFINE2(osf_getitimer, int, which, struct itimerval32 __user *, it)
1033{ 1035{
1034 struct itimerval kit; 1036 struct itimerval kit;
1035 int error; 1037 int error;
1036 1038
1039 if (!IS_ENABLED(CONFIG_POSIX_TIMERS))
1040 return sys_ni_posix_timers();
1041
1037 error = do_getitimer(which, &kit); 1042 error = do_getitimer(which, &kit);
1038 if (!error && put_it32(it, &kit)) 1043 if (!error && put_it32(it, &kit))
1039 error = -EFAULT; 1044 error = -EFAULT;
@@ -1047,6 +1052,9 @@ SYSCALL_DEFINE3(osf_setitimer, int, which, struct itimerval32 __user *, in,
1047 struct itimerval kin, kout; 1052 struct itimerval kin, kout;
1048 int error; 1053 int error;
1049 1054
1055 if (!IS_ENABLED(CONFIG_POSIX_TIMERS))
1056 return sys_ni_posix_timers();
1057
1050 if (in) { 1058 if (in) {
1051 if (get_it32(&kin, in)) 1059 if (get_it32(&kin, in))
1052 return -EFAULT; 1060 return -EFAULT;
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index 7afbfb0f96a3..1e24e455700b 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -174,6 +174,7 @@
174 <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW 0>, 174 <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW 0>,
175 <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW 0>, 175 <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW 0>,
176 <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>; 176 <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>;
177 arm,no-tick-in-suspend;
177 }; 178 };
178 179
179 xin24m: xin24m { 180 xin24m: xin24m {
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 79c6311cd912..5b21cb7d84d6 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -64,6 +64,15 @@ void mach_get_cmos_time(struct timespec *now)
64 unsigned int status, year, mon, day, hour, min, sec, century = 0; 64 unsigned int status, year, mon, day, hour, min, sec, century = 0;
65 unsigned long flags; 65 unsigned long flags;
66 66
67 /*
68 * If pm_trace abused the RTC as storage, set the timespec to 0,
69 * which tells the caller that this RTC value is unusable.
70 */
71 if (!pm_trace_rtc_valid()) {
72 now->tv_sec = now->tv_nsec = 0;
73 return;
74 }
75
67 spin_lock_irqsave(&rtc_lock, flags); 76 spin_lock_irqsave(&rtc_lock, flags);
68 77
69 /* 78 /*
diff --git a/drivers/Makefile b/drivers/Makefile
index 194d20bee7dc..060026a02f59 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -107,7 +107,7 @@ obj-$(CONFIG_INPUT) += input/
107obj-$(CONFIG_RTC_LIB) += rtc/ 107obj-$(CONFIG_RTC_LIB) += rtc/
108obj-y += i2c/ media/ 108obj-y += i2c/ media/
109obj-$(CONFIG_PPS) += pps/ 109obj-$(CONFIG_PPS) += pps/
110obj-$(CONFIG_PTP_1588_CLOCK) += ptp/ 110obj-y += ptp/
111obj-$(CONFIG_W1) += w1/ 111obj-$(CONFIG_W1) += w1/
112obj-y += power/ 112obj-y += power/
113obj-$(CONFIG_HWMON) += hwmon/ 113obj-$(CONFIG_HWMON) += hwmon/
diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
index efec10b49d59..1cda505d6a85 100644
--- a/drivers/base/power/trace.c
+++ b/drivers/base/power/trace.c
@@ -10,6 +10,7 @@
10#include <linux/pm-trace.h> 10#include <linux/pm-trace.h>
11#include <linux/export.h> 11#include <linux/export.h>
12#include <linux/rtc.h> 12#include <linux/rtc.h>
13#include <linux/suspend.h>
13 14
14#include <linux/mc146818rtc.h> 15#include <linux/mc146818rtc.h>
15 16
@@ -74,6 +75,9 @@
74 75
75#define DEVSEED (7919) 76#define DEVSEED (7919)
76 77
78bool pm_trace_rtc_abused __read_mostly;
79EXPORT_SYMBOL_GPL(pm_trace_rtc_abused);
80
77static unsigned int dev_hash_value; 81static unsigned int dev_hash_value;
78 82
79static int set_magic_time(unsigned int user, unsigned int file, unsigned int device) 83static int set_magic_time(unsigned int user, unsigned int file, unsigned int device)
@@ -104,6 +108,7 @@ static int set_magic_time(unsigned int user, unsigned int file, unsigned int dev
104 time.tm_min = (n % 20) * 3; 108 time.tm_min = (n % 20) * 3;
105 n /= 20; 109 n /= 20;
106 mc146818_set_time(&time); 110 mc146818_set_time(&time);
111 pm_trace_rtc_abused = true;
107 return n ? -1 : 0; 112 return n ? -1 : 0;
108} 113}
109 114
@@ -239,9 +244,31 @@ int show_trace_dev_match(char *buf, size_t size)
239 return ret; 244 return ret;
240} 245}
241 246
247static int
248pm_trace_notify(struct notifier_block *nb, unsigned long mode, void *_unused)
249{
250 switch (mode) {
251 case PM_POST_HIBERNATION:
252 case PM_POST_SUSPEND:
253 if (pm_trace_rtc_abused) {
254 pm_trace_rtc_abused = false;
255 pr_warn("Possible incorrect RTC due to pm_trace, please use 'ntpdate' or 'rdate' to reset it.\n");
256 }
257 break;
258 default:
259 break;
260 }
261 return 0;
262}
263
264static struct notifier_block pm_trace_nb = {
265 .notifier_call = pm_trace_notify,
266};
267
242static int early_resume_init(void) 268static int early_resume_init(void)
243{ 269{
244 hash_value_early_read = read_magic_time(); 270 hash_value_early_read = read_magic_time();
271 register_pm_notifier(&pm_trace_nb);
245 return 0; 272 return 0;
246} 273}
247 274
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index dcc09739a54e..45ba878ae025 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -542,6 +542,7 @@ config HANGCHECK_TIMER
542config MMTIMER 542config MMTIMER
543 tristate "MMTIMER Memory mapped RTC for SGI Altix" 543 tristate "MMTIMER Memory mapped RTC for SGI Altix"
544 depends on IA64_GENERIC || IA64_SGI_SN2 544 depends on IA64_GENERIC || IA64_SGI_SN2
545 depends on POSIX_TIMERS
545 default y 546 default y
546 help 547 help
547 The mmtimer device allows direct userspace access to the 548 The mmtimer device allows direct userspace access to the
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 73c487da6d2a..02fef6830e72 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -81,6 +81,7 @@ static struct clock_event_device __percpu *arch_timer_evt;
81static enum ppi_nr arch_timer_uses_ppi = VIRT_PPI; 81static enum ppi_nr arch_timer_uses_ppi = VIRT_PPI;
82static bool arch_timer_c3stop; 82static bool arch_timer_c3stop;
83static bool arch_timer_mem_use_virtual; 83static bool arch_timer_mem_use_virtual;
84static bool arch_counter_suspend_stop;
84 85
85static bool evtstrm_enable = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM); 86static bool evtstrm_enable = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
86 87
@@ -576,7 +577,7 @@ static struct clocksource clocksource_counter = {
576 .rating = 400, 577 .rating = 400,
577 .read = arch_counter_read, 578 .read = arch_counter_read,
578 .mask = CLOCKSOURCE_MASK(56), 579 .mask = CLOCKSOURCE_MASK(56),
579 .flags = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_SUSPEND_NONSTOP, 580 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
580}; 581};
581 582
582static struct cyclecounter cyclecounter = { 583static struct cyclecounter cyclecounter = {
@@ -616,6 +617,8 @@ static void __init arch_counter_register(unsigned type)
616 arch_timer_read_counter = arch_counter_get_cntvct_mem; 617 arch_timer_read_counter = arch_counter_get_cntvct_mem;
617 } 618 }
618 619
620 if (!arch_counter_suspend_stop)
621 clocksource_counter.flags |= CLOCK_SOURCE_SUSPEND_NONSTOP;
619 start_count = arch_timer_read_counter(); 622 start_count = arch_timer_read_counter();
620 clocksource_register_hz(&clocksource_counter, arch_timer_rate); 623 clocksource_register_hz(&clocksource_counter, arch_timer_rate);
621 cyclecounter.mult = clocksource_counter.mult; 624 cyclecounter.mult = clocksource_counter.mult;
@@ -907,6 +910,10 @@ static int __init arch_timer_of_init(struct device_node *np)
907 of_property_read_bool(np, "arm,cpu-registers-not-fw-configured")) 910 of_property_read_bool(np, "arm,cpu-registers-not-fw-configured"))
908 arch_timer_uses_ppi = PHYS_SECURE_PPI; 911 arch_timer_uses_ppi = PHYS_SECURE_PPI;
909 912
913 /* On some systems, the counter stops ticking when in suspend. */
914 arch_counter_suspend_stop = of_property_read_bool(np,
915 "arm,no-tick-in-suspend");
916
910 return arch_timer_init(); 917 return arch_timer_init();
911} 918}
912CLOCKSOURCE_OF_DECLARE(armv7_arch_timer, "arm,armv7-timer", arch_timer_of_init); 919CLOCKSOURCE_OF_DECLARE(armv7_arch_timer, "arm,armv7-timer", arch_timer_of_init);
@@ -964,8 +971,9 @@ static int __init arch_timer_mem_init(struct device_node *np)
964 } 971 }
965 972
966 ret= -ENXIO; 973 ret= -ENXIO;
967 base = arch_counter_base = of_iomap(best_frame, 0); 974 base = arch_counter_base = of_io_request_and_map(best_frame, 0,
968 if (!base) { 975 "arch_mem_timer");
976 if (IS_ERR(base)) {
969 pr_err("arch_timer: Can't map frame's registers\n"); 977 pr_err("arch_timer: Can't map frame's registers\n");
970 goto out; 978 goto out;
971 } 979 }
diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c
index e71acf231c89..f2f29d2be1cf 100644
--- a/drivers/clocksource/bcm2835_timer.c
+++ b/drivers/clocksource/bcm2835_timer.c
@@ -96,7 +96,7 @@ static int __init bcm2835_timer_init(struct device_node *node)
96 ret = of_property_read_u32(node, "clock-frequency", &freq); 96 ret = of_property_read_u32(node, "clock-frequency", &freq);
97 if (ret) { 97 if (ret) {
98 pr_err("Can't read clock-frequency"); 98 pr_err("Can't read clock-frequency");
99 return ret; 99 goto err_iounmap;
100 } 100 }
101 101
102 system_clock = base + REG_COUNTER_LO; 102 system_clock = base + REG_COUNTER_LO;
@@ -108,13 +108,15 @@ static int __init bcm2835_timer_init(struct device_node *node)
108 irq = irq_of_parse_and_map(node, DEFAULT_TIMER); 108 irq = irq_of_parse_and_map(node, DEFAULT_TIMER);
109 if (irq <= 0) { 109 if (irq <= 0) {
110 pr_err("Can't parse IRQ"); 110 pr_err("Can't parse IRQ");
111 return -EINVAL; 111 ret = -EINVAL;
112 goto err_iounmap;
112 } 113 }
113 114
114 timer = kzalloc(sizeof(*timer), GFP_KERNEL); 115 timer = kzalloc(sizeof(*timer), GFP_KERNEL);
115 if (!timer) { 116 if (!timer) {
116 pr_err("Can't allocate timer struct\n"); 117 pr_err("Can't allocate timer struct\n");
117 return -ENOMEM; 118 ret = -ENOMEM;
119 goto err_iounmap;
118 } 120 }
119 121
120 timer->control = base + REG_CONTROL; 122 timer->control = base + REG_CONTROL;
@@ -133,7 +135,7 @@ static int __init bcm2835_timer_init(struct device_node *node)
133 ret = setup_irq(irq, &timer->act); 135 ret = setup_irq(irq, &timer->act);
134 if (ret) { 136 if (ret) {
135 pr_err("Can't set up timer IRQ\n"); 137 pr_err("Can't set up timer IRQ\n");
136 return ret; 138 goto err_iounmap;
137 } 139 }
138 140
139 clockevents_config_and_register(&timer->evt, freq, 0xf, 0xffffffff); 141 clockevents_config_and_register(&timer->evt, freq, 0xf, 0xffffffff);
@@ -141,6 +143,10 @@ static int __init bcm2835_timer_init(struct device_node *node)
141 pr_info("bcm2835: system timer (irq = %d)\n", irq); 143 pr_info("bcm2835: system timer (irq = %d)\n", irq);
142 144
143 return 0; 145 return 0;
146
147err_iounmap:
148 iounmap(base);
149 return ret;
144} 150}
145CLOCKSOURCE_OF_DECLARE(bcm2835, "brcm,bcm2835-system-timer", 151CLOCKSOURCE_OF_DECLARE(bcm2835, "brcm,bcm2835-system-timer",
146 bcm2835_timer_init); 152 bcm2835_timer_init);
diff --git a/drivers/net/ethernet/adi/Kconfig b/drivers/net/ethernet/adi/Kconfig
index 6b94ba610399..98cc8f535021 100644
--- a/drivers/net/ethernet/adi/Kconfig
+++ b/drivers/net/ethernet/adi/Kconfig
@@ -58,7 +58,7 @@ config BFIN_RX_DESC_NUM
58config BFIN_MAC_USE_HWSTAMP 58config BFIN_MAC_USE_HWSTAMP
59 bool "Use IEEE 1588 hwstamp" 59 bool "Use IEEE 1588 hwstamp"
60 depends on BFIN_MAC && BF518 60 depends on BFIN_MAC && BF518
61 select PTP_1588_CLOCK 61 imply PTP_1588_CLOCK
62 default y 62 default y
63 ---help--- 63 ---help---
64 To support the IEEE 1588 Precision Time Protocol (PTP), select y here 64 To support the IEEE 1588 Precision Time Protocol (PTP), select y here
diff --git a/drivers/net/ethernet/amd/Kconfig b/drivers/net/ethernet/amd/Kconfig
index 7ab6efbe4189..d5c15e8bb3de 100644
--- a/drivers/net/ethernet/amd/Kconfig
+++ b/drivers/net/ethernet/amd/Kconfig
@@ -177,9 +177,9 @@ config AMD_XGBE
177 depends on X86 || ARM64 || COMPILE_TEST 177 depends on X86 || ARM64 || COMPILE_TEST
178 select BITREVERSE 178 select BITREVERSE
179 select CRC32 179 select CRC32
180 select PTP_1588_CLOCK
181 select PHYLIB 180 select PHYLIB
182 select AMD_XGBE_HAVE_ECC if X86 181 select AMD_XGBE_HAVE_ECC if X86
182 imply PTP_1588_CLOCK
183 ---help--- 183 ---help---
184 This driver supports the AMD 10GbE Ethernet device found on an 184 This driver supports the AMD 10GbE Ethernet device found on an
185 AMD SoC. 185 AMD SoC.
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c
index b87a89988ffd..17ac8f9a51a0 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c
@@ -422,7 +422,8 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata)
422 goto err_wq; 422 goto err_wq;
423 } 423 }
424 424
425 xgbe_ptp_register(pdata); 425 if (IS_REACHABLE(CONFIG_PTP_1588_CLOCK))
426 xgbe_ptp_register(pdata);
426 427
427 xgbe_debugfs_init(pdata); 428 xgbe_debugfs_init(pdata);
428 429
@@ -448,7 +449,8 @@ void xgbe_deconfig_netdev(struct xgbe_prv_data *pdata)
448 449
449 xgbe_debugfs_exit(pdata); 450 xgbe_debugfs_exit(pdata);
450 451
451 xgbe_ptp_unregister(pdata); 452 if (IS_REACHABLE(CONFIG_PTP_1588_CLOCK))
453 xgbe_ptp_unregister(pdata);
452 454
453 pdata->phy_if.phy_exit(pdata); 455 pdata->phy_if.phy_exit(pdata);
454 456
diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig
index 404c020cb82e..940fb24bba21 100644
--- a/drivers/net/ethernet/broadcom/Kconfig
+++ b/drivers/net/ethernet/broadcom/Kconfig
@@ -110,7 +110,7 @@ config TIGON3
110 depends on PCI 110 depends on PCI
111 select PHYLIB 111 select PHYLIB
112 select HWMON 112 select HWMON
113 select PTP_1588_CLOCK 113 imply PTP_1588_CLOCK
114 ---help--- 114 ---help---
115 This driver supports Broadcom Tigon3 based gigabit Ethernet cards. 115 This driver supports Broadcom Tigon3 based gigabit Ethernet cards.
116 116
@@ -120,7 +120,7 @@ config TIGON3
120config BNX2X 120config BNX2X
121 tristate "Broadcom NetXtremeII 10Gb support" 121 tristate "Broadcom NetXtremeII 10Gb support"
122 depends on PCI 122 depends on PCI
123 select PTP_1588_CLOCK 123 imply PTP_1588_CLOCK
124 select FW_LOADER 124 select FW_LOADER
125 select ZLIB_INFLATE 125 select ZLIB_INFLATE
126 select LIBCRC32C 126 select LIBCRC32C
diff --git a/drivers/net/ethernet/cavium/Kconfig b/drivers/net/ethernet/cavium/Kconfig
index c0679c21638a..bbc8bd16cb97 100644
--- a/drivers/net/ethernet/cavium/Kconfig
+++ b/drivers/net/ethernet/cavium/Kconfig
@@ -53,7 +53,7 @@ config THUNDER_NIC_RGX
53config LIQUIDIO 53config LIQUIDIO
54 tristate "Cavium LiquidIO support" 54 tristate "Cavium LiquidIO support"
55 depends on 64BIT 55 depends on 64BIT
56 select PTP_1588_CLOCK 56 imply PTP_1588_CLOCK
57 select FW_LOADER 57 select FW_LOADER
58 select LIBCRC32C 58 select LIBCRC32C
59 ---help--- 59 ---help---
diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
index 0d415516b577..6e490fd2345d 100644
--- a/drivers/net/ethernet/freescale/Kconfig
+++ b/drivers/net/ethernet/freescale/Kconfig
@@ -25,7 +25,7 @@ config FEC
25 ARCH_MXC || SOC_IMX28) 25 ARCH_MXC || SOC_IMX28)
26 default ARCH_MXC || SOC_IMX28 if ARM 26 default ARCH_MXC || SOC_IMX28 if ARM
27 select PHYLIB 27 select PHYLIB
28 select PTP_1588_CLOCK 28 imply PTP_1588_CLOCK
29 ---help--- 29 ---help---
30 Say Y here if you want to use the built-in 10/100 Fast ethernet 30 Say Y here if you want to use the built-in 10/100 Fast ethernet
31 controller on some Motorola ColdFire and Freescale i.MX processors. 31 controller on some Motorola ColdFire and Freescale i.MX processors.
diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig
index c0e17433f623..1349b45f014d 100644
--- a/drivers/net/ethernet/intel/Kconfig
+++ b/drivers/net/ethernet/intel/Kconfig
@@ -58,7 +58,7 @@ config E1000E
58 tristate "Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support" 58 tristate "Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support"
59 depends on PCI && (!SPARC32 || BROKEN) 59 depends on PCI && (!SPARC32 || BROKEN)
60 select CRC32 60 select CRC32
61 select PTP_1588_CLOCK 61 imply PTP_1588_CLOCK
62 ---help--- 62 ---help---
63 This driver supports the PCI-Express Intel(R) PRO/1000 gigabit 63 This driver supports the PCI-Express Intel(R) PRO/1000 gigabit
64 ethernet family of adapters. For PCI or PCI-X e1000 adapters, 64 ethernet family of adapters. For PCI or PCI-X e1000 adapters,
@@ -83,7 +83,7 @@ config E1000E_HWTS
83config IGB 83config IGB
84 tristate "Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support" 84 tristate "Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support"
85 depends on PCI 85 depends on PCI
86 select PTP_1588_CLOCK 86 imply PTP_1588_CLOCK
87 select I2C 87 select I2C
88 select I2C_ALGOBIT 88 select I2C_ALGOBIT
89 ---help--- 89 ---help---
@@ -156,7 +156,7 @@ config IXGBE
156 tristate "Intel(R) 10GbE PCI Express adapters support" 156 tristate "Intel(R) 10GbE PCI Express adapters support"
157 depends on PCI 157 depends on PCI
158 select MDIO 158 select MDIO
159 select PTP_1588_CLOCK 159 imply PTP_1588_CLOCK
160 ---help--- 160 ---help---
161 This driver supports Intel(R) 10GbE PCI Express family of 161 This driver supports Intel(R) 10GbE PCI Express family of
162 adapters. For more information on how to identify your adapter, go 162 adapters. For more information on how to identify your adapter, go
@@ -213,7 +213,7 @@ config IXGBEVF
213 213
214config I40E 214config I40E
215 tristate "Intel(R) Ethernet Controller XL710 Family support" 215 tristate "Intel(R) Ethernet Controller XL710 Family support"
216 select PTP_1588_CLOCK 216 imply PTP_1588_CLOCK
217 depends on PCI 217 depends on PCI
218 ---help--- 218 ---help---
219 This driver supports Intel(R) Ethernet Controller XL710 Family of 219 This driver supports Intel(R) Ethernet Controller XL710 Family of
@@ -264,7 +264,7 @@ config FM10K
264 tristate "Intel(R) FM10000 Ethernet Switch Host Interface Support" 264 tristate "Intel(R) FM10000 Ethernet Switch Host Interface Support"
265 default n 265 default n
266 depends on PCI_MSI 266 depends on PCI_MSI
267 select PTP_1588_CLOCK 267 imply PTP_1588_CLOCK
268 ---help--- 268 ---help---
269 This driver supports Intel(R) FM10000 Ethernet Switch Host 269 This driver supports Intel(R) FM10000 Ethernet Switch Host
270 Interface. For more information on how to identify your adapter, 270 Interface. For more information on how to identify your adapter,
diff --git a/drivers/net/ethernet/mellanox/mlx4/Kconfig b/drivers/net/ethernet/mellanox/mlx4/Kconfig
index 5098e7f21987..22b1cc012bc9 100644
--- a/drivers/net/ethernet/mellanox/mlx4/Kconfig
+++ b/drivers/net/ethernet/mellanox/mlx4/Kconfig
@@ -7,7 +7,7 @@ config MLX4_EN
7 depends on MAY_USE_DEVLINK 7 depends on MAY_USE_DEVLINK
8 depends on PCI 8 depends on PCI
9 select MLX4_CORE 9 select MLX4_CORE
10 select PTP_1588_CLOCK 10 imply PTP_1588_CLOCK
11 ---help--- 11 ---help---
12 This driver supports Mellanox Technologies ConnectX Ethernet 12 This driver supports Mellanox Technologies ConnectX Ethernet
13 devices. 13 devices.
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
index 521cfdb7d11e..ddb4ca4ff930 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
+++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
@@ -14,7 +14,7 @@ config MLX5_CORE
14config MLX5_CORE_EN 14config MLX5_CORE_EN
15 bool "Mellanox Technologies ConnectX-4 Ethernet support" 15 bool "Mellanox Technologies ConnectX-4 Ethernet support"
16 depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE 16 depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE
17 select PTP_1588_CLOCK 17 imply PTP_1588_CLOCK
18 default n 18 default n
19 ---help--- 19 ---help---
20 Ethernet support in Mellanox Technologies ConnectX-4 NIC. 20 Ethernet support in Mellanox Technologies ConnectX-4 NIC.
diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig
index 85ec447c2d18..27be51f0a421 100644
--- a/drivers/net/ethernet/renesas/Kconfig
+++ b/drivers/net/ethernet/renesas/Kconfig
@@ -37,7 +37,7 @@ config RAVB
37 select MII 37 select MII
38 select MDIO_BITBANG 38 select MDIO_BITBANG
39 select PHYLIB 39 select PHYLIB
40 select PTP_1588_CLOCK 40 imply PTP_1588_CLOCK
41 help 41 help
42 Renesas Ethernet AVB device driver. 42 Renesas Ethernet AVB device driver.
43 This driver supports the following SoCs: 43 This driver supports the following SoCs:
diff --git a/drivers/net/ethernet/samsung/Kconfig b/drivers/net/ethernet/samsung/Kconfig
index 2360d8150777..fbd5e06654c6 100644
--- a/drivers/net/ethernet/samsung/Kconfig
+++ b/drivers/net/ethernet/samsung/Kconfig
@@ -21,7 +21,7 @@ config SXGBE_ETH
21 depends on HAS_IOMEM && HAS_DMA 21 depends on HAS_IOMEM && HAS_DMA
22 select PHYLIB 22 select PHYLIB
23 select CRC32 23 select CRC32
24 select PTP_1588_CLOCK 24 imply PTP_1588_CLOCK
25 ---help--- 25 ---help---
26 This is the driver for the SXGBE 10G Ethernet IP block found on 26 This is the driver for the SXGBE 10G Ethernet IP block found on
27 Samsung platforms. 27 Samsung platforms.
diff --git a/drivers/net/ethernet/sfc/Kconfig b/drivers/net/ethernet/sfc/Kconfig
index 605ebc73b2b2..46f7be85f5a3 100644
--- a/drivers/net/ethernet/sfc/Kconfig
+++ b/drivers/net/ethernet/sfc/Kconfig
@@ -5,7 +5,7 @@ config SFC
5 select CRC32 5 select CRC32
6 select I2C 6 select I2C
7 select I2C_ALGOBIT 7 select I2C_ALGOBIT
8 select PTP_1588_CLOCK 8 imply PTP_1588_CLOCK
9 ---help--- 9 ---help---
10 This driver supports 10/40-gigabit Ethernet cards based on 10 This driver supports 10/40-gigabit Ethernet cards based on
11 the Solarflare SFC9000-family and SFC9100-family controllers. 11 the Solarflare SFC9000-family and SFC9100-family controllers.
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index d37e32d55ca9..ab66248a4b78 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -4,7 +4,7 @@ config STMMAC_ETH
4 select MII 4 select MII
5 select PHYLIB 5 select PHYLIB
6 select CRC32 6 select CRC32
7 select PTP_1588_CLOCK 7 imply PTP_1588_CLOCK
8 select RESET_CONTROLLER 8 select RESET_CONTROLLER
9 ---help--- 9 ---help---
10 This is the driver for the Ethernet IPs are built around a 10 This is the driver for the Ethernet IPs are built around a
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index dc217fd7a734..296c8efd0038 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -76,7 +76,7 @@ config TI_CPSW
76config TI_CPTS 76config TI_CPTS
77 tristate "TI Common Platform Time Sync (CPTS) Support" 77 tristate "TI Common Platform Time Sync (CPTS) Support"
78 depends on TI_CPSW || TI_KEYSTONE_NETCP 78 depends on TI_CPSW || TI_KEYSTONE_NETCP
79 select PTP_1588_CLOCK 79 imply PTP_1588_CLOCK
80 ---help--- 80 ---help---
81 This driver supports the Common Platform Time Sync unit of 81 This driver supports the Common Platform Time Sync unit of
82 the CPSW Ethernet Switch and Keystone 2 1g/10g Switch Subsystem. 82 the CPSW Ethernet Switch and Keystone 2 1g/10g Switch Subsystem.
diff --git a/drivers/net/ethernet/tile/Kconfig b/drivers/net/ethernet/tile/Kconfig
index f59a6c265331..bdfeaf3d4fce 100644
--- a/drivers/net/ethernet/tile/Kconfig
+++ b/drivers/net/ethernet/tile/Kconfig
@@ -9,7 +9,7 @@ config TILE_NET
9 select CRC32 9 select CRC32
10 select TILE_GXIO_MPIPE if TILEGX 10 select TILE_GXIO_MPIPE if TILEGX
11 select HIGH_RES_TIMERS if TILEGX 11 select HIGH_RES_TIMERS if TILEGX
12 select PTP_1588_CLOCK if TILEGX 12 imply PTP_1588_CLOCK if TILEGX
13 ---help--- 13 ---help---
14 This is a standard Linux network device driver for the 14 This is a standard Linux network device driver for the
15 on-chip Tilera Gigabit Ethernet and XAUI interfaces. 15 on-chip Tilera Gigabit Ethernet and XAUI interfaces.
diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig
index ee3de3421f2d..bdce33291161 100644
--- a/drivers/ptp/Kconfig
+++ b/drivers/ptp/Kconfig
@@ -6,7 +6,7 @@ menu "PTP clock support"
6 6
7config PTP_1588_CLOCK 7config PTP_1588_CLOCK
8 tristate "PTP clock support" 8 tristate "PTP clock support"
9 depends on NET 9 depends on NET && POSIX_TIMERS
10 select PPS 10 select PPS
11 select NET_PTP_CLASSIFY 11 select NET_PTP_CLASSIFY
12 help 12 help
@@ -28,7 +28,7 @@ config PTP_1588_CLOCK
28config PTP_1588_CLOCK_GIANFAR 28config PTP_1588_CLOCK_GIANFAR
29 tristate "Freescale eTSEC as PTP clock" 29 tristate "Freescale eTSEC as PTP clock"
30 depends on GIANFAR 30 depends on GIANFAR
31 select PTP_1588_CLOCK 31 depends on PTP_1588_CLOCK
32 default y 32 default y
33 help 33 help
34 This driver adds support for using the eTSEC as a PTP 34 This driver adds support for using the eTSEC as a PTP
@@ -42,7 +42,7 @@ config PTP_1588_CLOCK_GIANFAR
42config PTP_1588_CLOCK_IXP46X 42config PTP_1588_CLOCK_IXP46X
43 tristate "Intel IXP46x as PTP clock" 43 tristate "Intel IXP46x as PTP clock"
44 depends on IXP4XX_ETH 44 depends on IXP4XX_ETH
45 select PTP_1588_CLOCK 45 depends on PTP_1588_CLOCK
46 default y 46 default y
47 help 47 help
48 This driver adds support for using the IXP46X as a PTP 48 This driver adds support for using the IXP46X as a PTP
@@ -60,7 +60,7 @@ config DP83640_PHY
60 tristate "Driver for the National Semiconductor DP83640 PHYTER" 60 tristate "Driver for the National Semiconductor DP83640 PHYTER"
61 depends on NETWORK_PHY_TIMESTAMPING 61 depends on NETWORK_PHY_TIMESTAMPING
62 depends on PHYLIB 62 depends on PHYLIB
63 select PTP_1588_CLOCK 63 depends on PTP_1588_CLOCK
64 ---help--- 64 ---help---
65 Supports the DP83640 PHYTER with IEEE 1588 features. 65 Supports the DP83640 PHYTER with IEEE 1588 features.
66 66
@@ -76,7 +76,7 @@ config PTP_1588_CLOCK_PCH
76 tristate "Intel PCH EG20T as PTP clock" 76 tristate "Intel PCH EG20T as PTP clock"
77 depends on X86_32 || COMPILE_TEST 77 depends on X86_32 || COMPILE_TEST
78 depends on HAS_IOMEM && NET 78 depends on HAS_IOMEM && NET
79 select PTP_1588_CLOCK 79 imply PTP_1588_CLOCK
80 help 80 help
81 This driver adds support for using the PCH EG20T as a PTP 81 This driver adds support for using the PCH EG20T as a PTP
82 clock. The hardware supports time stamping of PTP packets 82 clock. The hardware supports time stamping of PTP packets
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 7030d7cd3861..38aa8e1906c2 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -191,6 +191,13 @@ static inline void cmos_write_bank2(unsigned char val, unsigned char addr)
191 191
192static int cmos_read_time(struct device *dev, struct rtc_time *t) 192static int cmos_read_time(struct device *dev, struct rtc_time *t)
193{ 193{
194 /*
195 * If pm_trace abused the RTC for storage, set the timespec to 0,
196 * which tells the caller that this RTC value is unusable.
197 */
198 if (!pm_trace_rtc_valid())
199 return -EIO;
200
194 /* REVISIT: if the clock has a "century" register, use 201 /* REVISIT: if the clock has a "century" register, use
195 * that instead of the heuristic in mc146818_get_time(). 202 * that instead of the heuristic in mc146818_get_time().
196 * That'll make Y3K compatility (year > 2070) easy! 203 * That'll make Y3K compatility (year > 2070) easy!
diff --git a/fs/exec.c b/fs/exec.c
index 4e497b9ee71e..923c57d96899 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1169,8 +1169,10 @@ no_thread_group:
1169 /* we have changed execution domain */ 1169 /* we have changed execution domain */
1170 tsk->exit_signal = SIGCHLD; 1170 tsk->exit_signal = SIGCHLD;
1171 1171
1172#ifdef CONFIG_POSIX_TIMERS
1172 exit_itimers(sig); 1173 exit_itimers(sig);
1173 flush_itimer_signals(); 1174 flush_itimer_signals();
1175#endif
1174 1176
1175 if (atomic_read(&oldsighand->count) != 1) { 1177 if (atomic_read(&oldsighand->count) != 1) {
1176 struct sighand_struct *newsighand; 1178 struct sighand_struct *newsighand;
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
index 9d8031257a90..c70aac13244a 100644
--- a/include/linux/alarmtimer.h
+++ b/include/linux/alarmtimer.h
@@ -10,7 +10,12 @@ enum alarmtimer_type {
10 ALARM_REALTIME, 10 ALARM_REALTIME,
11 ALARM_BOOTTIME, 11 ALARM_BOOTTIME,
12 12
13 /* Supported types end here */
13 ALARM_NUMTYPE, 14 ALARM_NUMTYPE,
15
16 /* Used for tracing information. No usable types. */
17 ALARM_REALTIME_FREEZER,
18 ALARM_BOOTTIME_FREEZER,
14}; 19};
15 20
16enum alarmtimer_restart { 21enum alarmtimer_restart {
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 08398182f56e..65602d395a52 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -169,7 +169,10 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
169 * @mult: cycle to nanosecond multiplier 169 * @mult: cycle to nanosecond multiplier
170 * @shift: cycle to nanosecond divisor (power of two) 170 * @shift: cycle to nanosecond divisor (power of two)
171 * 171 *
172 * Converts cycles to nanoseconds, using the given mult and shift. 172 * Converts clocksource cycles to nanoseconds, using the given @mult and @shift.
173 * The code is optimized for performance and is not intended to work
174 * with absolute clocksource cycles (as those will easily overflow),
175 * but is only intended to be used with relative (delta) clocksource cycles.
173 * 176 *
174 * XXX - This could use some mult_lxl_ll() asm optimization 177 * XXX - This could use some mult_lxl_ll() asm optimization
175 */ 178 */
diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h
index a585b4b5fa0e..0661af17a758 100644
--- a/include/linux/mc146818rtc.h
+++ b/include/linux/mc146818rtc.h
@@ -16,6 +16,7 @@
16#include <asm/mc146818rtc.h> /* register access macros */ 16#include <asm/mc146818rtc.h> /* register access macros */
17#include <linux/bcd.h> 17#include <linux/bcd.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/pm-trace.h>
19 20
20#ifdef __KERNEL__ 21#ifdef __KERNEL__
21#include <linux/spinlock.h> /* spinlock_t */ 22#include <linux/spinlock.h> /* spinlock_t */
diff --git a/include/linux/pm-trace.h b/include/linux/pm-trace.h
index ecbde7a5548e..7b78793f07d7 100644
--- a/include/linux/pm-trace.h
+++ b/include/linux/pm-trace.h
@@ -1,11 +1,17 @@
1#ifndef PM_TRACE_H 1#ifndef PM_TRACE_H
2#define PM_TRACE_H 2#define PM_TRACE_H
3 3
4#include <linux/types.h>
4#ifdef CONFIG_PM_TRACE 5#ifdef CONFIG_PM_TRACE
5#include <asm/pm-trace.h> 6#include <asm/pm-trace.h>
6#include <linux/types.h>
7 7
8extern int pm_trace_enabled; 8extern int pm_trace_enabled;
9extern bool pm_trace_rtc_abused;
10
11static inline bool pm_trace_rtc_valid(void)
12{
13 return !pm_trace_rtc_abused;
14}
9 15
10static inline int pm_trace_is_enabled(void) 16static inline int pm_trace_is_enabled(void)
11{ 17{
@@ -24,6 +30,7 @@ extern int show_trace_dev_match(char *buf, size_t size);
24 30
25#else 31#else
26 32
33static inline bool pm_trace_rtc_valid(void) { return true; }
27static inline int pm_trace_is_enabled(void) { return 0; } 34static inline int pm_trace_is_enabled(void) { return 0; }
28 35
29#define TRACE_DEVICE(dev) do { } while (0) 36#define TRACE_DEVICE(dev) do { } while (0)
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index b76d47aba564..a026bfd089db 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -130,30 +130,6 @@ struct ptp_clock_info {
130 130
131struct ptp_clock; 131struct ptp_clock;
132 132
133/**
134 * ptp_clock_register() - register a PTP hardware clock driver
135 *
136 * @info: Structure describing the new clock.
137 * @parent: Pointer to the parent device of the new clock.
138 *
139 * Returns a valid pointer on success or PTR_ERR on failure. If PHC
140 * support is missing at the configuration level, this function
141 * returns NULL, and drivers are expected to gracefully handle that
142 * case separately.
143 */
144
145extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
146 struct device *parent);
147
148/**
149 * ptp_clock_unregister() - unregister a PTP hardware clock driver
150 *
151 * @ptp: The clock to remove from service.
152 */
153
154extern int ptp_clock_unregister(struct ptp_clock *ptp);
155
156
157enum ptp_clock_events { 133enum ptp_clock_events {
158 PTP_CLOCK_ALARM, 134 PTP_CLOCK_ALARM,
159 PTP_CLOCK_EXTTS, 135 PTP_CLOCK_EXTTS,
@@ -179,6 +155,31 @@ struct ptp_clock_event {
179 }; 155 };
180}; 156};
181 157
158#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
159
160/**
161 * ptp_clock_register() - register a PTP hardware clock driver
162 *
163 * @info: Structure describing the new clock.
164 * @parent: Pointer to the parent device of the new clock.
165 *
166 * Returns a valid pointer on success or PTR_ERR on failure. If PHC
167 * support is missing at the configuration level, this function
168 * returns NULL, and drivers are expected to gracefully handle that
169 * case separately.
170 */
171
172extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
173 struct device *parent);
174
175/**
176 * ptp_clock_unregister() - unregister a PTP hardware clock driver
177 *
178 * @ptp: The clock to remove from service.
179 */
180
181extern int ptp_clock_unregister(struct ptp_clock *ptp);
182
182/** 183/**
183 * ptp_clock_event() - notify the PTP layer about an event 184 * ptp_clock_event() - notify the PTP layer about an event
184 * 185 *
@@ -210,4 +211,20 @@ extern int ptp_clock_index(struct ptp_clock *ptp);
210int ptp_find_pin(struct ptp_clock *ptp, 211int ptp_find_pin(struct ptp_clock *ptp,
211 enum ptp_pin_function func, unsigned int chan); 212 enum ptp_pin_function func, unsigned int chan);
212 213
214#else
215static inline struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
216 struct device *parent)
217{ return NULL; }
218static inline int ptp_clock_unregister(struct ptp_clock *ptp)
219{ return 0; }
220static inline void ptp_clock_event(struct ptp_clock *ptp,
221 struct ptp_clock_event *event)
222{ }
223static inline int ptp_clock_index(struct ptp_clock *ptp)
224{ return -1; }
225static inline int ptp_find_pin(struct ptp_clock *ptp,
226 enum ptp_pin_function func, unsigned int chan)
227{ return -1; }
228#endif
229
213#endif 230#endif
diff --git a/include/linux/time.h b/include/linux/time.h
index 4cea09d94208..23f0f5ce3090 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -172,8 +172,6 @@ extern int do_setitimer(int which, struct itimerval *value,
172 struct itimerval *ovalue); 172 struct itimerval *ovalue);
173extern int do_getitimer(int which, struct itimerval *value); 173extern int do_getitimer(int which, struct itimerval *value);
174 174
175extern unsigned int alarm_setitimer(unsigned int seconds);
176
177extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags); 175extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags);
178 176
179struct tms; 177struct tms;
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 09168c52ab64..361f8bf1429d 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -249,6 +249,7 @@ static inline u64 ktime_get_raw_ns(void)
249 249
250extern u64 ktime_get_mono_fast_ns(void); 250extern u64 ktime_get_mono_fast_ns(void);
251extern u64 ktime_get_raw_fast_ns(void); 251extern u64 ktime_get_raw_fast_ns(void);
252extern u64 ktime_get_boot_fast_ns(void);
252 253
253/* 254/*
254 * Timespec interfaces utilizing the ktime based ones 255 * Timespec interfaces utilizing the ktime based ones
diff --git a/include/trace/events/alarmtimer.h b/include/trace/events/alarmtimer.h
new file mode 100644
index 000000000000..a1c108c16c9c
--- /dev/null
+++ b/include/trace/events/alarmtimer.h
@@ -0,0 +1,96 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM alarmtimer
3
4#if !defined(_TRACE_ALARMTIMER_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_ALARMTIMER_H
6
7#include <linux/alarmtimer.h>
8#include <linux/rtc.h>
9#include <linux/tracepoint.h>
10
11TRACE_DEFINE_ENUM(ALARM_REALTIME);
12TRACE_DEFINE_ENUM(ALARM_BOOTTIME);
13TRACE_DEFINE_ENUM(ALARM_REALTIME_FREEZER);
14TRACE_DEFINE_ENUM(ALARM_BOOTTIME_FREEZER);
15
16#define show_alarm_type(type) __print_flags(type, " | ", \
17 { 1 << ALARM_REALTIME, "REALTIME" }, \
18 { 1 << ALARM_BOOTTIME, "BOOTTIME" }, \
19 { 1 << ALARM_REALTIME_FREEZER, "REALTIME Freezer" }, \
20 { 1 << ALARM_BOOTTIME_FREEZER, "BOOTTIME Freezer" })
21
22TRACE_EVENT(alarmtimer_suspend,
23
24 TP_PROTO(ktime_t expires, int flag),
25
26 TP_ARGS(expires, flag),
27
28 TP_STRUCT__entry(
29 __field(s64, expires)
30 __field(unsigned char, alarm_type)
31 ),
32
33 TP_fast_assign(
34 __entry->expires = expires.tv64;
35 __entry->alarm_type = flag;
36 ),
37
38 TP_printk("alarmtimer type:%s expires:%llu",
39 show_alarm_type((1 << __entry->alarm_type)),
40 __entry->expires
41 )
42);
43
44DECLARE_EVENT_CLASS(alarm_class,
45
46 TP_PROTO(struct alarm *alarm, ktime_t now),
47
48 TP_ARGS(alarm, now),
49
50 TP_STRUCT__entry(
51 __field(void *, alarm)
52 __field(unsigned char, alarm_type)
53 __field(s64, expires)
54 __field(s64, now)
55 ),
56
57 TP_fast_assign(
58 __entry->alarm = alarm;
59 __entry->alarm_type = alarm->type;
60 __entry->expires = alarm->node.expires.tv64;
61 __entry->now = now.tv64;
62 ),
63
64 TP_printk("alarmtimer:%p type:%s expires:%llu now:%llu",
65 __entry->alarm,
66 show_alarm_type((1 << __entry->alarm_type)),
67 __entry->expires,
68 __entry->now
69 )
70);
71
72DEFINE_EVENT(alarm_class, alarmtimer_fired,
73
74 TP_PROTO(struct alarm *alarm, ktime_t now),
75
76 TP_ARGS(alarm, now)
77);
78
79DEFINE_EVENT(alarm_class, alarmtimer_start,
80
81 TP_PROTO(struct alarm *alarm, ktime_t now),
82
83 TP_ARGS(alarm, now)
84);
85
86DEFINE_EVENT(alarm_class, alarmtimer_cancel,
87
88 TP_PROTO(struct alarm *alarm, ktime_t now),
89
90 TP_ARGS(alarm, now)
91);
92
93#endif /* _TRACE_ALARMTIMER_H */
94
95/* This part must be outside protection */
96#include <trace/define_trace.h>
diff --git a/init/Kconfig b/init/Kconfig
index 405120b5f13e..230abf1f2c0b 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1457,6 +1457,23 @@ config SYSCTL_SYSCALL
1457 1457
1458 If unsure say N here. 1458 If unsure say N here.
1459 1459
1460config POSIX_TIMERS
1461 bool "Posix Clocks & timers" if EXPERT
1462 default y
1463 help
1464 This includes native support for POSIX timers to the kernel.
1465 Some embedded systems have no use for them and therefore they
1466 can be configured out to reduce the size of the kernel image.
1467
1468 When this option is disabled, the following syscalls won't be
1469 available: timer_create, timer_gettime: timer_getoverrun,
1470 timer_settime, timer_delete, clock_adjtime, getitimer,
1471 setitimer, alarm. Furthermore, the clock_settime, clock_gettime,
1472 clock_getres and clock_nanosleep syscalls will be limited to
1473 CLOCK_REALTIME, CLOCK_MONOTONIC and CLOCK_BOOTTIME only.
1474
1475 If unsure say y.
1476
1460config KALLSYMS 1477config KALLSYMS
1461 bool "Load all symbols for debugging/ksymoops" if EXPERT 1478 bool "Load all symbols for debugging/ksymoops" if EXPERT
1462 default y 1479 default y
diff --git a/kernel/compat.c b/kernel/compat.c
index 333d364be29d..b3a047f208a7 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -307,12 +307,17 @@ static inline long put_compat_itimerval(struct compat_itimerval __user *o,
307 __put_user(i->it_value.tv_usec, &o->it_value.tv_usec))); 307 __put_user(i->it_value.tv_usec, &o->it_value.tv_usec)));
308} 308}
309 309
310asmlinkage long sys_ni_posix_timers(void);
311
310COMPAT_SYSCALL_DEFINE2(getitimer, int, which, 312COMPAT_SYSCALL_DEFINE2(getitimer, int, which,
311 struct compat_itimerval __user *, it) 313 struct compat_itimerval __user *, it)
312{ 314{
313 struct itimerval kit; 315 struct itimerval kit;
314 int error; 316 int error;
315 317
318 if (!IS_ENABLED(CONFIG_POSIX_TIMERS))
319 return sys_ni_posix_timers();
320
316 error = do_getitimer(which, &kit); 321 error = do_getitimer(which, &kit);
317 if (!error && put_compat_itimerval(it, &kit)) 322 if (!error && put_compat_itimerval(it, &kit))
318 error = -EFAULT; 323 error = -EFAULT;
@@ -326,6 +331,9 @@ COMPAT_SYSCALL_DEFINE3(setitimer, int, which,
326 struct itimerval kin, kout; 331 struct itimerval kin, kout;
327 int error; 332 int error;
328 333
334 if (!IS_ENABLED(CONFIG_POSIX_TIMERS))
335 return sys_ni_posix_timers();
336
329 if (in) { 337 if (in) {
330 if (get_compat_itimerval(&kin, in)) 338 if (get_compat_itimerval(&kin, in))
331 return -EFAULT; 339 return -EFAULT;
diff --git a/kernel/exit.c b/kernel/exit.c
index 3076f3089919..aacff8e2aec0 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -54,6 +54,7 @@
54#include <linux/writeback.h> 54#include <linux/writeback.h>
55#include <linux/shm.h> 55#include <linux/shm.h>
56#include <linux/kcov.h> 56#include <linux/kcov.h>
57#include <linux/random.h>
57 58
58#include <asm/uaccess.h> 59#include <asm/uaccess.h>
59#include <asm/unistd.h> 60#include <asm/unistd.h>
@@ -91,11 +92,10 @@ static void __exit_signal(struct task_struct *tsk)
91 lockdep_tasklist_lock_is_held()); 92 lockdep_tasklist_lock_is_held());
92 spin_lock(&sighand->siglock); 93 spin_lock(&sighand->siglock);
93 94
95#ifdef CONFIG_POSIX_TIMERS
94 posix_cpu_timers_exit(tsk); 96 posix_cpu_timers_exit(tsk);
95 if (group_dead) { 97 if (group_dead) {
96 posix_cpu_timers_exit_group(tsk); 98 posix_cpu_timers_exit_group(tsk);
97 tty = sig->tty;
98 sig->tty = NULL;
99 } else { 99 } else {
100 /* 100 /*
101 * This can only happen if the caller is de_thread(). 101 * This can only happen if the caller is de_thread().
@@ -104,7 +104,13 @@ static void __exit_signal(struct task_struct *tsk)
104 */ 104 */
105 if (unlikely(has_group_leader_pid(tsk))) 105 if (unlikely(has_group_leader_pid(tsk)))
106 posix_cpu_timers_exit_group(tsk); 106 posix_cpu_timers_exit_group(tsk);
107 }
108#endif
107 109
110 if (group_dead) {
111 tty = sig->tty;
112 sig->tty = NULL;
113 } else {
108 /* 114 /*
109 * If there is any task waiting for the group exit 115 * If there is any task waiting for the group exit
110 * then notify it: 116 * then notify it:
@@ -116,6 +122,9 @@ static void __exit_signal(struct task_struct *tsk)
116 sig->curr_target = next_thread(tsk); 122 sig->curr_target = next_thread(tsk);
117 } 123 }
118 124
125 add_device_randomness((const void*) &tsk->se.sum_exec_runtime,
126 sizeof(unsigned long long));
127
119 /* 128 /*
120 * Accumulate here the counters for all threads as they die. We could 129 * Accumulate here the counters for all threads as they die. We could
121 * skip the group leader because it is the last user of signal_struct, 130 * skip the group leader because it is the last user of signal_struct,
@@ -799,8 +808,10 @@ void __noreturn do_exit(long code)
799 acct_update_integrals(tsk); 808 acct_update_integrals(tsk);
800 group_dead = atomic_dec_and_test(&tsk->signal->live); 809 group_dead = atomic_dec_and_test(&tsk->signal->live);
801 if (group_dead) { 810 if (group_dead) {
811#ifdef CONFIG_POSIX_TIMERS
802 hrtimer_cancel(&tsk->signal->real_timer); 812 hrtimer_cancel(&tsk->signal->real_timer);
803 exit_itimers(tsk->signal); 813 exit_itimers(tsk->signal);
814#endif
804 if (tsk->mm) 815 if (tsk->mm)
805 setmax_mm_hiwater_rss(&tsk->signal->maxrss, tsk->mm); 816 setmax_mm_hiwater_rss(&tsk->signal->maxrss, tsk->mm);
806 } 817 }
diff --git a/kernel/fork.c b/kernel/fork.c
index 7ffa16033ded..5957cf8b4c4b 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1347,8 +1347,10 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
1347 seqlock_init(&sig->stats_lock); 1347 seqlock_init(&sig->stats_lock);
1348 prev_cputime_init(&sig->prev_cputime); 1348 prev_cputime_init(&sig->prev_cputime);
1349 1349
1350#ifdef CONFIG_POSIX_TIMERS
1350 hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 1351 hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
1351 sig->real_timer.function = it_real_fn; 1352 sig->real_timer.function = it_real_fn;
1353#endif
1352 1354
1353 task_lock(current->group_leader); 1355 task_lock(current->group_leader);
1354 memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim); 1356 memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim);
diff --git a/kernel/signal.c b/kernel/signal.c
index 75761acc77cf..29a410780aa9 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -427,6 +427,7 @@ void flush_signals(struct task_struct *t)
427 spin_unlock_irqrestore(&t->sighand->siglock, flags); 427 spin_unlock_irqrestore(&t->sighand->siglock, flags);
428} 428}
429 429
430#ifdef CONFIG_POSIX_TIMERS
430static void __flush_itimer_signals(struct sigpending *pending) 431static void __flush_itimer_signals(struct sigpending *pending)
431{ 432{
432 sigset_t signal, retain; 433 sigset_t signal, retain;
@@ -460,6 +461,7 @@ void flush_itimer_signals(void)
460 __flush_itimer_signals(&tsk->signal->shared_pending); 461 __flush_itimer_signals(&tsk->signal->shared_pending);
461 spin_unlock_irqrestore(&tsk->sighand->siglock, flags); 462 spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
462} 463}
464#endif
463 465
464void ignore_signals(struct task_struct *t) 466void ignore_signals(struct task_struct *t)
465{ 467{
@@ -567,6 +569,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
567 if (!signr) { 569 if (!signr) {
568 signr = __dequeue_signal(&tsk->signal->shared_pending, 570 signr = __dequeue_signal(&tsk->signal->shared_pending,
569 mask, info); 571 mask, info);
572#ifdef CONFIG_POSIX_TIMERS
570 /* 573 /*
571 * itimer signal ? 574 * itimer signal ?
572 * 575 *
@@ -590,6 +593,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
590 hrtimer_restart(tmr); 593 hrtimer_restart(tmr);
591 } 594 }
592 } 595 }
596#endif
593 } 597 }
594 598
595 recalc_sigpending(); 599 recalc_sigpending();
@@ -611,6 +615,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
611 */ 615 */
612 current->jobctl |= JOBCTL_STOP_DEQUEUED; 616 current->jobctl |= JOBCTL_STOP_DEQUEUED;
613 } 617 }
618#ifdef CONFIG_POSIX_TIMERS
614 if ((info->si_code & __SI_MASK) == __SI_TIMER && info->si_sys_private) { 619 if ((info->si_code & __SI_MASK) == __SI_TIMER && info->si_sys_private) {
615 /* 620 /*
616 * Release the siglock to ensure proper locking order 621 * Release the siglock to ensure proper locking order
@@ -622,6 +627,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
622 do_schedule_next_timer(info); 627 do_schedule_next_timer(info);
623 spin_lock(&tsk->sighand->siglock); 628 spin_lock(&tsk->sighand->siglock);
624 } 629 }
630#endif
625 return signr; 631 return signr;
626} 632}
627 633
diff --git a/kernel/sys.c b/kernel/sys.c
index 89d5be418157..78c9fb7dd680 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1416,7 +1416,8 @@ int do_prlimit(struct task_struct *tsk, unsigned int resource,
1416 * applications, so we live with it 1416 * applications, so we live with it
1417 */ 1417 */
1418 if (!retval && new_rlim && resource == RLIMIT_CPU && 1418 if (!retval && new_rlim && resource == RLIMIT_CPU &&
1419 new_rlim->rlim_cur != RLIM_INFINITY) 1419 new_rlim->rlim_cur != RLIM_INFINITY &&
1420 IS_ENABLED(CONFIG_POSIX_TIMERS))
1420 update_rlimit_cpu(tsk, new_rlim->rlim_cur); 1421 update_rlimit_cpu(tsk, new_rlim->rlim_cur);
1421out: 1422out:
1422 read_unlock(&tasklist_lock); 1423 read_unlock(&tasklist_lock);
diff --git a/kernel/time/Makefile b/kernel/time/Makefile
index 49eca0beed32..976840d29a71 100644
--- a/kernel/time/Makefile
+++ b/kernel/time/Makefile
@@ -1,6 +1,12 @@
1obj-y += time.o timer.o hrtimer.o itimer.o posix-timers.o posix-cpu-timers.o 1obj-y += time.o timer.o hrtimer.o
2obj-y += timekeeping.o ntp.o clocksource.o jiffies.o timer_list.o 2obj-y += timekeeping.o ntp.o clocksource.o jiffies.o timer_list.o
3obj-y += timeconv.o timecounter.o posix-clock.o alarmtimer.o 3obj-y += timeconv.o timecounter.o alarmtimer.o
4
5ifeq ($(CONFIG_POSIX_TIMERS),y)
6 obj-y += posix-timers.o posix-cpu-timers.o posix-clock.o itimer.o
7else
8 obj-y += posix-stubs.o
9endif
4 10
5obj-$(CONFIG_GENERIC_CLOCKEVENTS) += clockevents.o tick-common.o 11obj-$(CONFIG_GENERIC_CLOCKEVENTS) += clockevents.o tick-common.o
6ifeq ($(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST),y) 12ifeq ($(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST),y)
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 12dd190634ab..9b08ca391aed 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -26,6 +26,9 @@
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
27#include <linux/freezer.h> 27#include <linux/freezer.h>
28 28
29#define CREATE_TRACE_POINTS
30#include <trace/events/alarmtimer.h>
31
29/** 32/**
30 * struct alarm_base - Alarm timer bases 33 * struct alarm_base - Alarm timer bases
31 * @lock: Lock for syncrhonized access to the base 34 * @lock: Lock for syncrhonized access to the base
@@ -40,7 +43,9 @@ static struct alarm_base {
40 clockid_t base_clockid; 43 clockid_t base_clockid;
41} alarm_bases[ALARM_NUMTYPE]; 44} alarm_bases[ALARM_NUMTYPE];
42 45
43/* freezer delta & lock used to handle clock_nanosleep triggered wakeups */ 46/* freezer information to handle clock_nanosleep triggered wakeups */
47static enum alarmtimer_type freezer_alarmtype;
48static ktime_t freezer_expires;
44static ktime_t freezer_delta; 49static ktime_t freezer_delta;
45static DEFINE_SPINLOCK(freezer_delta_lock); 50static DEFINE_SPINLOCK(freezer_delta_lock);
46 51
@@ -194,6 +199,7 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer)
194 } 199 }
195 spin_unlock_irqrestore(&base->lock, flags); 200 spin_unlock_irqrestore(&base->lock, flags);
196 201
202 trace_alarmtimer_fired(alarm, base->gettime());
197 return ret; 203 return ret;
198 204
199} 205}
@@ -218,15 +224,16 @@ EXPORT_SYMBOL_GPL(alarm_expires_remaining);
218 */ 224 */
219static int alarmtimer_suspend(struct device *dev) 225static int alarmtimer_suspend(struct device *dev)
220{ 226{
221 struct rtc_time tm; 227 ktime_t min, now, expires;
222 ktime_t min, now; 228 int i, ret, type;
223 unsigned long flags;
224 struct rtc_device *rtc; 229 struct rtc_device *rtc;
225 int i; 230 unsigned long flags;
226 int ret; 231 struct rtc_time tm;
227 232
228 spin_lock_irqsave(&freezer_delta_lock, flags); 233 spin_lock_irqsave(&freezer_delta_lock, flags);
229 min = freezer_delta; 234 min = freezer_delta;
235 expires = freezer_expires;
236 type = freezer_alarmtype;
230 freezer_delta = ktime_set(0, 0); 237 freezer_delta = ktime_set(0, 0);
231 spin_unlock_irqrestore(&freezer_delta_lock, flags); 238 spin_unlock_irqrestore(&freezer_delta_lock, flags);
232 239
@@ -247,8 +254,11 @@ static int alarmtimer_suspend(struct device *dev)
247 if (!next) 254 if (!next)
248 continue; 255 continue;
249 delta = ktime_sub(next->expires, base->gettime()); 256 delta = ktime_sub(next->expires, base->gettime());
250 if (!min.tv64 || (delta.tv64 < min.tv64)) 257 if (!min.tv64 || (delta.tv64 < min.tv64)) {
258 expires = next->expires;
251 min = delta; 259 min = delta;
260 type = i;
261 }
252 } 262 }
253 if (min.tv64 == 0) 263 if (min.tv64 == 0)
254 return 0; 264 return 0;
@@ -258,6 +268,8 @@ static int alarmtimer_suspend(struct device *dev)
258 return -EBUSY; 268 return -EBUSY;
259 } 269 }
260 270
271 trace_alarmtimer_suspend(expires, type);
272
261 /* Setup an rtc timer to fire that far in the future */ 273 /* Setup an rtc timer to fire that far in the future */
262 rtc_timer_cancel(rtc, &rtctimer); 274 rtc_timer_cancel(rtc, &rtctimer);
263 rtc_read_time(rtc, &tm); 275 rtc_read_time(rtc, &tm);
@@ -295,15 +307,32 @@ static int alarmtimer_resume(struct device *dev)
295 307
296static void alarmtimer_freezerset(ktime_t absexp, enum alarmtimer_type type) 308static void alarmtimer_freezerset(ktime_t absexp, enum alarmtimer_type type)
297{ 309{
298 ktime_t delta; 310 struct alarm_base *base;
299 unsigned long flags; 311 unsigned long flags;
300 struct alarm_base *base = &alarm_bases[type]; 312 ktime_t delta;
313
314 switch(type) {
315 case ALARM_REALTIME:
316 base = &alarm_bases[ALARM_REALTIME];
317 type = ALARM_REALTIME_FREEZER;
318 break;
319 case ALARM_BOOTTIME:
320 base = &alarm_bases[ALARM_BOOTTIME];
321 type = ALARM_BOOTTIME_FREEZER;
322 break;
323 default:
324 WARN_ONCE(1, "Invalid alarm type: %d\n", type);
325 return;
326 }
301 327
302 delta = ktime_sub(absexp, base->gettime()); 328 delta = ktime_sub(absexp, base->gettime());
303 329
304 spin_lock_irqsave(&freezer_delta_lock, flags); 330 spin_lock_irqsave(&freezer_delta_lock, flags);
305 if (!freezer_delta.tv64 || (delta.tv64 < freezer_delta.tv64)) 331 if (!freezer_delta.tv64 || (delta.tv64 < freezer_delta.tv64)) {
306 freezer_delta = delta; 332 freezer_delta = delta;
333 freezer_expires = absexp;
334 freezer_alarmtype = type;
335 }
307 spin_unlock_irqrestore(&freezer_delta_lock, flags); 336 spin_unlock_irqrestore(&freezer_delta_lock, flags);
308} 337}
309 338
@@ -342,6 +371,8 @@ void alarm_start(struct alarm *alarm, ktime_t start)
342 alarmtimer_enqueue(base, alarm); 371 alarmtimer_enqueue(base, alarm);
343 hrtimer_start(&alarm->timer, alarm->node.expires, HRTIMER_MODE_ABS); 372 hrtimer_start(&alarm->timer, alarm->node.expires, HRTIMER_MODE_ABS);
344 spin_unlock_irqrestore(&base->lock, flags); 373 spin_unlock_irqrestore(&base->lock, flags);
374
375 trace_alarmtimer_start(alarm, base->gettime());
345} 376}
346EXPORT_SYMBOL_GPL(alarm_start); 377EXPORT_SYMBOL_GPL(alarm_start);
347 378
@@ -390,6 +421,8 @@ int alarm_try_to_cancel(struct alarm *alarm)
390 if (ret >= 0) 421 if (ret >= 0)
391 alarmtimer_dequeue(base, alarm); 422 alarmtimer_dequeue(base, alarm);
392 spin_unlock_irqrestore(&base->lock, flags); 423 spin_unlock_irqrestore(&base->lock, flags);
424
425 trace_alarmtimer_cancel(alarm, base->gettime());
393 return ret; 426 return ret;
394} 427}
395EXPORT_SYMBOL_GPL(alarm_try_to_cancel); 428EXPORT_SYMBOL_GPL(alarm_try_to_cancel);
@@ -846,8 +879,10 @@ static int __init alarmtimer_init(void)
846 879
847 alarmtimer_rtc_timer_init(); 880 alarmtimer_rtc_timer_init();
848 881
849 posix_timers_register_clock(CLOCK_REALTIME_ALARM, &alarm_clock); 882 if (IS_ENABLED(CONFIG_POSIX_TIMERS)) {
850 posix_timers_register_clock(CLOCK_BOOTTIME_ALARM, &alarm_clock); 883 posix_timers_register_clock(CLOCK_REALTIME_ALARM, &alarm_clock);
884 posix_timers_register_clock(CLOCK_BOOTTIME_ALARM, &alarm_clock);
885 }
851 886
852 /* Initialize alarm bases */ 887 /* Initialize alarm bases */
853 alarm_bases[ALARM_REALTIME].base_clockid = CLOCK_REALTIME; 888 alarm_bases[ALARM_REALTIME].base_clockid = CLOCK_REALTIME;
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index bb5ec425dfe0..08be5c99d26b 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1742,15 +1742,19 @@ schedule_hrtimeout_range_clock(ktime_t *expires, u64 delta,
1742 * You can set the task state as follows - 1742 * You can set the task state as follows -
1743 * 1743 *
1744 * %TASK_UNINTERRUPTIBLE - at least @timeout time is guaranteed to 1744 * %TASK_UNINTERRUPTIBLE - at least @timeout time is guaranteed to
1745 * pass before the routine returns. 1745 * pass before the routine returns unless the current task is explicitly
1746 * woken up, (e.g. by wake_up_process()).
1746 * 1747 *
1747 * %TASK_INTERRUPTIBLE - the routine may return early if a signal is 1748 * %TASK_INTERRUPTIBLE - the routine may return early if a signal is
1748 * delivered to the current task. 1749 * delivered to the current task or the current task is explicitly woken
1750 * up.
1749 * 1751 *
1750 * The current task state is guaranteed to be TASK_RUNNING when this 1752 * The current task state is guaranteed to be TASK_RUNNING when this
1751 * routine returns. 1753 * routine returns.
1752 * 1754 *
1753 * Returns 0 when the timer has expired otherwise -EINTR 1755 * Returns 0 when the timer has expired. If the task was woken before the
1756 * timer expired by a signal (only possible in state TASK_INTERRUPTIBLE) or
1757 * by an explicit wakeup, it returns -EINTR.
1754 */ 1758 */
1755int __sched schedule_hrtimeout_range(ktime_t *expires, u64 delta, 1759int __sched schedule_hrtimeout_range(ktime_t *expires, u64 delta,
1756 const enum hrtimer_mode mode) 1760 const enum hrtimer_mode mode)
@@ -1772,15 +1776,19 @@ EXPORT_SYMBOL_GPL(schedule_hrtimeout_range);
1772 * You can set the task state as follows - 1776 * You can set the task state as follows -
1773 * 1777 *
1774 * %TASK_UNINTERRUPTIBLE - at least @timeout time is guaranteed to 1778 * %TASK_UNINTERRUPTIBLE - at least @timeout time is guaranteed to
1775 * pass before the routine returns. 1779 * pass before the routine returns unless the current task is explicitly
1780 * woken up, (e.g. by wake_up_process()).
1776 * 1781 *
1777 * %TASK_INTERRUPTIBLE - the routine may return early if a signal is 1782 * %TASK_INTERRUPTIBLE - the routine may return early if a signal is
1778 * delivered to the current task. 1783 * delivered to the current task or the current task is explicitly woken
1784 * up.
1779 * 1785 *
1780 * The current task state is guaranteed to be TASK_RUNNING when this 1786 * The current task state is guaranteed to be TASK_RUNNING when this
1781 * routine returns. 1787 * routine returns.
1782 * 1788 *
1783 * Returns 0 when the timer has expired otherwise -EINTR 1789 * Returns 0 when the timer has expired. If the task was woken before the
1790 * timer expired by a signal (only possible in state TASK_INTERRUPTIBLE) or
1791 * by an explicit wakeup, it returns -EINTR.
1784 */ 1792 */
1785int __sched schedule_hrtimeout(ktime_t *expires, 1793int __sched schedule_hrtimeout(ktime_t *expires,
1786 const enum hrtimer_mode mode) 1794 const enum hrtimer_mode mode)
diff --git a/kernel/time/itimer.c b/kernel/time/itimer.c
index 1d5c7204ddc9..2b9f45bc955d 100644
--- a/kernel/time/itimer.c
+++ b/kernel/time/itimer.c
@@ -238,6 +238,8 @@ again:
238 return 0; 238 return 0;
239} 239}
240 240
241#ifdef __ARCH_WANT_SYS_ALARM
242
241/** 243/**
242 * alarm_setitimer - set alarm in seconds 244 * alarm_setitimer - set alarm in seconds
243 * 245 *
@@ -250,7 +252,7 @@ again:
250 * On 32 bit machines the seconds value is limited to (INT_MAX/2) to avoid 252 * On 32 bit machines the seconds value is limited to (INT_MAX/2) to avoid
251 * negative timeval settings which would cause immediate expiry. 253 * negative timeval settings which would cause immediate expiry.
252 */ 254 */
253unsigned int alarm_setitimer(unsigned int seconds) 255static unsigned int alarm_setitimer(unsigned int seconds)
254{ 256{
255 struct itimerval it_new, it_old; 257 struct itimerval it_new, it_old;
256 258
@@ -275,6 +277,17 @@ unsigned int alarm_setitimer(unsigned int seconds)
275 return it_old.it_value.tv_sec; 277 return it_old.it_value.tv_sec;
276} 278}
277 279
280/*
281 * For backwards compatibility? This can be done in libc so Alpha
282 * and all newer ports shouldn't need it.
283 */
284SYSCALL_DEFINE1(alarm, unsigned int, seconds)
285{
286 return alarm_setitimer(seconds);
287}
288
289#endif
290
278SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value, 291SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value,
279 struct itimerval __user *, ovalue) 292 struct itimerval __user *, ovalue)
280{ 293{
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index e887ffc8eef3..f246763c9947 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -9,7 +9,6 @@
9#include <asm/uaccess.h> 9#include <asm/uaccess.h>
10#include <linux/kernel_stat.h> 10#include <linux/kernel_stat.h>
11#include <trace/events/timer.h> 11#include <trace/events/timer.h>
12#include <linux/random.h>
13#include <linux/tick.h> 12#include <linux/tick.h>
14#include <linux/workqueue.h> 13#include <linux/workqueue.h>
15 14
@@ -447,10 +446,7 @@ static void cleanup_timers(struct list_head *head)
447 */ 446 */
448void posix_cpu_timers_exit(struct task_struct *tsk) 447void posix_cpu_timers_exit(struct task_struct *tsk)
449{ 448{
450 add_device_randomness((const void*) &tsk->se.sum_exec_runtime,
451 sizeof(unsigned long long));
452 cleanup_timers(tsk->cpu_timers); 449 cleanup_timers(tsk->cpu_timers);
453
454} 450}
455void posix_cpu_timers_exit_group(struct task_struct *tsk) 451void posix_cpu_timers_exit_group(struct task_struct *tsk)
456{ 452{
diff --git a/kernel/time/posix-stubs.c b/kernel/time/posix-stubs.c
new file mode 100644
index 000000000000..cd6716e115e8
--- /dev/null
+++ b/kernel/time/posix-stubs.c
@@ -0,0 +1,123 @@
1/*
2 * Dummy stubs used when CONFIG_POSIX_TIMERS=n
3 *
4 * Created by: Nicolas Pitre, July 2016
5 * Copyright: (C) 2016 Linaro Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/linkage.h>
13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/errno.h>
16#include <linux/syscalls.h>
17#include <linux/ktime.h>
18#include <linux/timekeeping.h>
19#include <linux/posix-timers.h>
20
21asmlinkage long sys_ni_posix_timers(void)
22{
23 pr_err_once("process %d (%s) attempted a POSIX timer syscall "
24 "while CONFIG_POSIX_TIMERS is not set\n",
25 current->pid, current->comm);
26 return -ENOSYS;
27}
28
29#define SYS_NI(name) SYSCALL_ALIAS(sys_##name, sys_ni_posix_timers)
30
31SYS_NI(timer_create);
32SYS_NI(timer_gettime);
33SYS_NI(timer_getoverrun);
34SYS_NI(timer_settime);
35SYS_NI(timer_delete);
36SYS_NI(clock_adjtime);
37SYS_NI(getitimer);
38SYS_NI(setitimer);
39#ifdef __ARCH_WANT_SYS_ALARM
40SYS_NI(alarm);
41#endif
42
43/*
44 * We preserve minimal support for CLOCK_REALTIME and CLOCK_MONOTONIC
45 * as it is easy to remain compatible with little code. CLOCK_BOOTTIME
46 * is also included for convenience as at least systemd uses it.
47 */
48
49SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
50 const struct timespec __user *, tp)
51{
52 struct timespec new_tp;
53
54 if (which_clock != CLOCK_REALTIME)
55 return -EINVAL;
56 if (copy_from_user(&new_tp, tp, sizeof (*tp)))
57 return -EFAULT;
58 return do_sys_settimeofday(&new_tp, NULL);
59}
60
61SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
62 struct timespec __user *,tp)
63{
64 struct timespec kernel_tp;
65
66 switch (which_clock) {
67 case CLOCK_REALTIME: ktime_get_real_ts(&kernel_tp); break;
68 case CLOCK_MONOTONIC: ktime_get_ts(&kernel_tp); break;
69 case CLOCK_BOOTTIME: get_monotonic_boottime(&kernel_tp); break;
70 default: return -EINVAL;
71 }
72 if (copy_to_user(tp, &kernel_tp, sizeof (kernel_tp)))
73 return -EFAULT;
74 return 0;
75}
76
77SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, struct timespec __user *, tp)
78{
79 struct timespec rtn_tp = {
80 .tv_sec = 0,
81 .tv_nsec = hrtimer_resolution,
82 };
83
84 switch (which_clock) {
85 case CLOCK_REALTIME:
86 case CLOCK_MONOTONIC:
87 case CLOCK_BOOTTIME:
88 if (copy_to_user(tp, &rtn_tp, sizeof(rtn_tp)))
89 return -EFAULT;
90 return 0;
91 default:
92 return -EINVAL;
93 }
94}
95
96SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags,
97 const struct timespec __user *, rqtp,
98 struct timespec __user *, rmtp)
99{
100 struct timespec t;
101
102 switch (which_clock) {
103 case CLOCK_REALTIME:
104 case CLOCK_MONOTONIC:
105 case CLOCK_BOOTTIME:
106 if (copy_from_user(&t, rqtp, sizeof (struct timespec)))
107 return -EFAULT;
108 if (!timespec_valid(&t))
109 return -EINVAL;
110 return hrtimer_nanosleep(&t, rmtp, flags & TIMER_ABSTIME ?
111 HRTIMER_MODE_ABS : HRTIMER_MODE_REL,
112 which_clock);
113 default:
114 return -EINVAL;
115 }
116}
117
118#ifdef CONFIG_COMPAT
119long clock_nanosleep_restart(struct restart_block *restart_block)
120{
121 return hrtimer_nanosleep_restart(restart_block);
122}
123#endif
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 37dec7e3db43..da233cdf89b0 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -258,10 +258,9 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock)
258 tk->cycle_interval = interval; 258 tk->cycle_interval = interval;
259 259
260 /* Go back from cycles -> shifted ns */ 260 /* Go back from cycles -> shifted ns */
261 tk->xtime_interval = (u64) interval * clock->mult; 261 tk->xtime_interval = interval * clock->mult;
262 tk->xtime_remainder = ntpinterval - tk->xtime_interval; 262 tk->xtime_remainder = ntpinterval - tk->xtime_interval;
263 tk->raw_interval = 263 tk->raw_interval = (interval * clock->mult) >> clock->shift;
264 ((u64) interval * clock->mult) >> clock->shift;
265 264
266 /* if changing clocks, convert xtime_nsec shift units */ 265 /* if changing clocks, convert xtime_nsec shift units */
267 if (old_clock) { 266 if (old_clock) {
@@ -299,10 +298,10 @@ u32 (*arch_gettimeoffset)(void) = default_arch_gettimeoffset;
299static inline u32 arch_gettimeoffset(void) { return 0; } 298static inline u32 arch_gettimeoffset(void) { return 0; }
300#endif 299#endif
301 300
302static inline s64 timekeeping_delta_to_ns(struct tk_read_base *tkr, 301static inline u64 timekeeping_delta_to_ns(struct tk_read_base *tkr,
303 cycle_t delta) 302 cycle_t delta)
304{ 303{
305 s64 nsec; 304 u64 nsec;
306 305
307 nsec = delta * tkr->mult + tkr->xtime_nsec; 306 nsec = delta * tkr->mult + tkr->xtime_nsec;
308 nsec >>= tkr->shift; 307 nsec >>= tkr->shift;
@@ -311,7 +310,7 @@ static inline s64 timekeeping_delta_to_ns(struct tk_read_base *tkr,
311 return nsec + arch_gettimeoffset(); 310 return nsec + arch_gettimeoffset();
312} 311}
313 312
314static inline s64 timekeeping_get_ns(struct tk_read_base *tkr) 313static inline u64 timekeeping_get_ns(struct tk_read_base *tkr)
315{ 314{
316 cycle_t delta; 315 cycle_t delta;
317 316
@@ -319,8 +318,8 @@ static inline s64 timekeeping_get_ns(struct tk_read_base *tkr)
319 return timekeeping_delta_to_ns(tkr, delta); 318 return timekeeping_delta_to_ns(tkr, delta);
320} 319}
321 320
322static inline s64 timekeeping_cycles_to_ns(struct tk_read_base *tkr, 321static inline u64 timekeeping_cycles_to_ns(struct tk_read_base *tkr,
323 cycle_t cycles) 322 cycle_t cycles)
324{ 323{
325 cycle_t delta; 324 cycle_t delta;
326 325
@@ -425,6 +424,35 @@ u64 ktime_get_raw_fast_ns(void)
425} 424}
426EXPORT_SYMBOL_GPL(ktime_get_raw_fast_ns); 425EXPORT_SYMBOL_GPL(ktime_get_raw_fast_ns);
427 426
427/**
428 * ktime_get_boot_fast_ns - NMI safe and fast access to boot clock.
429 *
430 * To keep it NMI safe since we're accessing from tracing, we're not using a
431 * separate timekeeper with updates to monotonic clock and boot offset
432 * protected with seqlocks. This has the following minor side effects:
433 *
434 * (1) Its possible that a timestamp be taken after the boot offset is updated
435 * but before the timekeeper is updated. If this happens, the new boot offset
436 * is added to the old timekeeping making the clock appear to update slightly
437 * earlier:
438 * CPU 0 CPU 1
439 * timekeeping_inject_sleeptime64()
440 * __timekeeping_inject_sleeptime(tk, delta);
441 * timestamp();
442 * timekeeping_update(tk, TK_CLEAR_NTP...);
443 *
444 * (2) On 32-bit systems, the 64-bit boot offset (tk->offs_boot) may be
445 * partially updated. Since the tk->offs_boot update is a rare event, this
446 * should be a rare occurrence which postprocessing should be able to handle.
447 */
448u64 notrace ktime_get_boot_fast_ns(void)
449{
450 struct timekeeper *tk = &tk_core.timekeeper;
451
452 return (ktime_get_mono_fast_ns() + ktime_to_ns(tk->offs_boot));
453}
454EXPORT_SYMBOL_GPL(ktime_get_boot_fast_ns);
455
428/* Suspend-time cycles value for halted fast timekeeper. */ 456/* Suspend-time cycles value for halted fast timekeeper. */
429static cycle_t cycles_at_suspend; 457static cycle_t cycles_at_suspend;
430 458
@@ -623,7 +651,7 @@ static void timekeeping_forward_now(struct timekeeper *tk)
623{ 651{
624 struct clocksource *clock = tk->tkr_mono.clock; 652 struct clocksource *clock = tk->tkr_mono.clock;
625 cycle_t cycle_now, delta; 653 cycle_t cycle_now, delta;
626 s64 nsec; 654 u64 nsec;
627 655
628 cycle_now = tk->tkr_mono.read(clock); 656 cycle_now = tk->tkr_mono.read(clock);
629 delta = clocksource_delta(cycle_now, tk->tkr_mono.cycle_last, tk->tkr_mono.mask); 657 delta = clocksource_delta(cycle_now, tk->tkr_mono.cycle_last, tk->tkr_mono.mask);
@@ -652,7 +680,7 @@ int __getnstimeofday64(struct timespec64 *ts)
652{ 680{
653 struct timekeeper *tk = &tk_core.timekeeper; 681 struct timekeeper *tk = &tk_core.timekeeper;
654 unsigned long seq; 682 unsigned long seq;
655 s64 nsecs = 0; 683 u64 nsecs;
656 684
657 do { 685 do {
658 seq = read_seqcount_begin(&tk_core.seq); 686 seq = read_seqcount_begin(&tk_core.seq);
@@ -692,7 +720,7 @@ ktime_t ktime_get(void)
692 struct timekeeper *tk = &tk_core.timekeeper; 720 struct timekeeper *tk = &tk_core.timekeeper;
693 unsigned int seq; 721 unsigned int seq;
694 ktime_t base; 722 ktime_t base;
695 s64 nsecs; 723 u64 nsecs;
696 724
697 WARN_ON(timekeeping_suspended); 725 WARN_ON(timekeeping_suspended);
698 726
@@ -735,7 +763,7 @@ ktime_t ktime_get_with_offset(enum tk_offsets offs)
735 struct timekeeper *tk = &tk_core.timekeeper; 763 struct timekeeper *tk = &tk_core.timekeeper;
736 unsigned int seq; 764 unsigned int seq;
737 ktime_t base, *offset = offsets[offs]; 765 ktime_t base, *offset = offsets[offs];
738 s64 nsecs; 766 u64 nsecs;
739 767
740 WARN_ON(timekeeping_suspended); 768 WARN_ON(timekeeping_suspended);
741 769
@@ -779,7 +807,7 @@ ktime_t ktime_get_raw(void)
779 struct timekeeper *tk = &tk_core.timekeeper; 807 struct timekeeper *tk = &tk_core.timekeeper;
780 unsigned int seq; 808 unsigned int seq;
781 ktime_t base; 809 ktime_t base;
782 s64 nsecs; 810 u64 nsecs;
783 811
784 do { 812 do {
785 seq = read_seqcount_begin(&tk_core.seq); 813 seq = read_seqcount_begin(&tk_core.seq);
@@ -804,8 +832,8 @@ void ktime_get_ts64(struct timespec64 *ts)
804{ 832{
805 struct timekeeper *tk = &tk_core.timekeeper; 833 struct timekeeper *tk = &tk_core.timekeeper;
806 struct timespec64 tomono; 834 struct timespec64 tomono;
807 s64 nsec;
808 unsigned int seq; 835 unsigned int seq;
836 u64 nsec;
809 837
810 WARN_ON(timekeeping_suspended); 838 WARN_ON(timekeeping_suspended);
811 839
@@ -893,8 +921,8 @@ void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot)
893 unsigned long seq; 921 unsigned long seq;
894 ktime_t base_raw; 922 ktime_t base_raw;
895 ktime_t base_real; 923 ktime_t base_real;
896 s64 nsec_raw; 924 u64 nsec_raw;
897 s64 nsec_real; 925 u64 nsec_real;
898 cycle_t now; 926 cycle_t now;
899 927
900 WARN_ON_ONCE(timekeeping_suspended); 928 WARN_ON_ONCE(timekeeping_suspended);
@@ -1052,7 +1080,7 @@ int get_device_system_crosststamp(int (*get_time_fn)
1052 cycle_t cycles, now, interval_start; 1080 cycle_t cycles, now, interval_start;
1053 unsigned int clock_was_set_seq = 0; 1081 unsigned int clock_was_set_seq = 0;
1054 ktime_t base_real, base_raw; 1082 ktime_t base_real, base_raw;
1055 s64 nsec_real, nsec_raw; 1083 u64 nsec_real, nsec_raw;
1056 u8 cs_was_changed_seq; 1084 u8 cs_was_changed_seq;
1057 unsigned long seq; 1085 unsigned long seq;
1058 bool do_interp; 1086 bool do_interp;
@@ -1365,7 +1393,7 @@ void getrawmonotonic64(struct timespec64 *ts)
1365 struct timekeeper *tk = &tk_core.timekeeper; 1393 struct timekeeper *tk = &tk_core.timekeeper;
1366 struct timespec64 ts64; 1394 struct timespec64 ts64;
1367 unsigned long seq; 1395 unsigned long seq;
1368 s64 nsecs; 1396 u64 nsecs;
1369 1397
1370 do { 1398 do {
1371 seq = read_seqcount_begin(&tk_core.seq); 1399 seq = read_seqcount_begin(&tk_core.seq);
@@ -1616,7 +1644,7 @@ void timekeeping_resume(void)
1616 struct clocksource *clock = tk->tkr_mono.clock; 1644 struct clocksource *clock = tk->tkr_mono.clock;
1617 unsigned long flags; 1645 unsigned long flags;
1618 struct timespec64 ts_new, ts_delta; 1646 struct timespec64 ts_new, ts_delta;
1619 cycle_t cycle_now, cycle_delta; 1647 cycle_t cycle_now;
1620 1648
1621 sleeptime_injected = false; 1649 sleeptime_injected = false;
1622 read_persistent_clock64(&ts_new); 1650 read_persistent_clock64(&ts_new);
@@ -1642,27 +1670,11 @@ void timekeeping_resume(void)
1642 cycle_now = tk->tkr_mono.read(clock); 1670 cycle_now = tk->tkr_mono.read(clock);
1643 if ((clock->flags & CLOCK_SOURCE_SUSPEND_NONSTOP) && 1671 if ((clock->flags & CLOCK_SOURCE_SUSPEND_NONSTOP) &&
1644 cycle_now > tk->tkr_mono.cycle_last) { 1672 cycle_now > tk->tkr_mono.cycle_last) {
1645 u64 num, max = ULLONG_MAX; 1673 u64 nsec, cyc_delta;
1646 u32 mult = clock->mult;
1647 u32 shift = clock->shift;
1648 s64 nsec = 0;
1649
1650 cycle_delta = clocksource_delta(cycle_now, tk->tkr_mono.cycle_last,
1651 tk->tkr_mono.mask);
1652
1653 /*
1654 * "cycle_delta * mutl" may cause 64 bits overflow, if the
1655 * suspended time is too long. In that case we need do the
1656 * 64 bits math carefully
1657 */
1658 do_div(max, mult);
1659 if (cycle_delta > max) {
1660 num = div64_u64(cycle_delta, max);
1661 nsec = (((u64) max * mult) >> shift) * num;
1662 cycle_delta -= num * max;
1663 }
1664 nsec += ((u64) cycle_delta * mult) >> shift;
1665 1674
1675 cyc_delta = clocksource_delta(cycle_now, tk->tkr_mono.cycle_last,
1676 tk->tkr_mono.mask);
1677 nsec = mul_u64_u32_shr(cyc_delta, clock->mult, clock->shift);
1666 ts_delta = ns_to_timespec64(nsec); 1678 ts_delta = ns_to_timespec64(nsec);
1667 sleeptime_injected = true; 1679 sleeptime_injected = true;
1668 } else if (timespec64_compare(&ts_new, &timekeeping_suspend_time) > 0) { 1680 } else if (timespec64_compare(&ts_new, &timekeeping_suspend_time) > 0) {
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index c611c47de884..ea4fbf8477a9 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1615,7 +1615,8 @@ void update_process_times(int user_tick)
1615 irq_work_tick(); 1615 irq_work_tick();
1616#endif 1616#endif
1617 scheduler_tick(); 1617 scheduler_tick();
1618 run_posix_cpu_timers(p); 1618 if (IS_ENABLED(CONFIG_POSIX_TIMERS))
1619 run_posix_cpu_timers(p);
1619} 1620}
1620 1621
1621/** 1622/**
@@ -1676,19 +1677,6 @@ void run_local_timers(void)
1676 raise_softirq(TIMER_SOFTIRQ); 1677 raise_softirq(TIMER_SOFTIRQ);
1677} 1678}
1678 1679
1679#ifdef __ARCH_WANT_SYS_ALARM
1680
1681/*
1682 * For backwards compatibility? This can be done in libc so Alpha
1683 * and all newer ports shouldn't need it.
1684 */
1685SYSCALL_DEFINE1(alarm, unsigned int, seconds)
1686{
1687 return alarm_setitimer(seconds);
1688}
1689
1690#endif
1691
1692static void process_timeout(unsigned long __data) 1680static void process_timeout(unsigned long __data)
1693{ 1681{
1694 wake_up_process((struct task_struct *)__data); 1682 wake_up_process((struct task_struct *)__data);
@@ -1705,11 +1693,12 @@ static void process_timeout(unsigned long __data)
1705 * You can set the task state as follows - 1693 * You can set the task state as follows -
1706 * 1694 *
1707 * %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to 1695 * %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to
1708 * pass before the routine returns. The routine will return 0 1696 * pass before the routine returns unless the current task is explicitly
1697 * woken up, (e.g. by wake_up_process())".
1709 * 1698 *
1710 * %TASK_INTERRUPTIBLE - the routine may return early if a signal is 1699 * %TASK_INTERRUPTIBLE - the routine may return early if a signal is
1711 * delivered to the current task. In this case the remaining time 1700 * delivered to the current task or the current task is explicitly woken
1712 * in jiffies will be returned, or 0 if the timer expired in time 1701 * up.
1713 * 1702 *
1714 * The current task state is guaranteed to be TASK_RUNNING when this 1703 * The current task state is guaranteed to be TASK_RUNNING when this
1715 * routine returns. 1704 * routine returns.
@@ -1718,7 +1707,9 @@ static void process_timeout(unsigned long __data)
1718 * the CPU away without a bound on the timeout. In this case the return 1707 * the CPU away without a bound on the timeout. In this case the return
1719 * value will be %MAX_SCHEDULE_TIMEOUT. 1708 * value will be %MAX_SCHEDULE_TIMEOUT.
1720 * 1709 *
1721 * In all cases the return value is guaranteed to be non-negative. 1710 * Returns 0 when the timer has expired otherwise the remaining time in
1711 * jiffies will be returned. In all cases the return value is guaranteed
1712 * to be non-negative.
1722 */ 1713 */
1723signed long __sched schedule_timeout(signed long timeout) 1714signed long __sched schedule_timeout(signed long timeout)
1724{ 1715{
@@ -1910,16 +1901,6 @@ unsigned long msleep_interruptible(unsigned int msecs)
1910 1901
1911EXPORT_SYMBOL(msleep_interruptible); 1902EXPORT_SYMBOL(msleep_interruptible);
1912 1903
1913static void __sched do_usleep_range(unsigned long min, unsigned long max)
1914{
1915 ktime_t kmin;
1916 u64 delta;
1917
1918 kmin = ktime_set(0, min * NSEC_PER_USEC);
1919 delta = (u64)(max - min) * NSEC_PER_USEC;
1920 schedule_hrtimeout_range(&kmin, delta, HRTIMER_MODE_REL);
1921}
1922
1923/** 1904/**
1924 * usleep_range - Sleep for an approximate time 1905 * usleep_range - Sleep for an approximate time
1925 * @min: Minimum time in usecs to sleep 1906 * @min: Minimum time in usecs to sleep
@@ -1933,7 +1914,14 @@ static void __sched do_usleep_range(unsigned long min, unsigned long max)
1933 */ 1914 */
1934void __sched usleep_range(unsigned long min, unsigned long max) 1915void __sched usleep_range(unsigned long min, unsigned long max)
1935{ 1916{
1936 __set_current_state(TASK_UNINTERRUPTIBLE); 1917 ktime_t exp = ktime_add_us(ktime_get(), min);
1937 do_usleep_range(min, max); 1918 u64 delta = (u64)(max - min) * NSEC_PER_USEC;
1919
1920 for (;;) {
1921 __set_current_state(TASK_UNINTERRUPTIBLE);
1922 /* Do not return before the requested sleep time has elapsed */
1923 if (!schedule_hrtimeout_range(&exp, delta, HRTIMER_MODE_ABS))
1924 break;
1925 }
1938} 1926}
1939EXPORT_SYMBOL(usleep_range); 1927EXPORT_SYMBOL(usleep_range);
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 465d56febc5b..54d5270a5042 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1125,6 +1125,7 @@ static struct {
1125 { trace_clock, "perf", 1 }, 1125 { trace_clock, "perf", 1 },
1126 { ktime_get_mono_fast_ns, "mono", 1 }, 1126 { ktime_get_mono_fast_ns, "mono", 1 },
1127 { ktime_get_raw_fast_ns, "mono_raw", 1 }, 1127 { ktime_get_raw_fast_ns, "mono_raw", 1 },
1128 { ktime_get_boot_fast_ns, "boot", 1 },
1128 ARCH_TRACE_CLOCKS 1129 ARCH_TRACE_CLOCKS
1129}; 1130};
1130 1131
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 973b6f733368..a73f762c48d6 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -85,6 +85,7 @@ struct symbol {
85 struct property *prop; 85 struct property *prop;
86 struct expr_value dir_dep; 86 struct expr_value dir_dep;
87 struct expr_value rev_dep; 87 struct expr_value rev_dep;
88 struct expr_value implied;
88}; 89};
89 90
90#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) 91#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)
@@ -136,6 +137,7 @@ enum prop_type {
136 P_DEFAULT, /* default y */ 137 P_DEFAULT, /* default y */
137 P_CHOICE, /* choice value */ 138 P_CHOICE, /* choice value */
138 P_SELECT, /* select BAR */ 139 P_SELECT, /* select BAR */
140 P_IMPLY, /* imply BAR */
139 P_RANGE, /* range 7..100 (for a symbol) */ 141 P_RANGE, /* range 7..100 (for a symbol) */
140 P_ENV, /* value from environment variable */ 142 P_ENV, /* value from environment variable */
141 P_SYMBOL, /* where a symbol is defined */ 143 P_SYMBOL, /* where a symbol is defined */
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index aed678e8a777..e9357931b47d 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -233,6 +233,8 @@ static void sym_check_prop(struct symbol *sym)
233{ 233{
234 struct property *prop; 234 struct property *prop;
235 struct symbol *sym2; 235 struct symbol *sym2;
236 char *use;
237
236 for (prop = sym->prop; prop; prop = prop->next) { 238 for (prop = sym->prop; prop; prop = prop->next) {
237 switch (prop->type) { 239 switch (prop->type) {
238 case P_DEFAULT: 240 case P_DEFAULT:
@@ -252,18 +254,20 @@ static void sym_check_prop(struct symbol *sym)
252 } 254 }
253 break; 255 break;
254 case P_SELECT: 256 case P_SELECT:
257 case P_IMPLY:
258 use = prop->type == P_SELECT ? "select" : "imply";
255 sym2 = prop_get_symbol(prop); 259 sym2 = prop_get_symbol(prop);
256 if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE) 260 if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE)
257 prop_warn(prop, 261 prop_warn(prop,
258 "config symbol '%s' uses select, but is " 262 "config symbol '%s' uses %s, but is "
259 "not boolean or tristate", sym->name); 263 "not boolean or tristate", sym->name, use);
260 else if (sym2->type != S_UNKNOWN && 264 else if (sym2->type != S_UNKNOWN &&
261 sym2->type != S_BOOLEAN && 265 sym2->type != S_BOOLEAN &&
262 sym2->type != S_TRISTATE) 266 sym2->type != S_TRISTATE)
263 prop_warn(prop, 267 prop_warn(prop,
264 "'%s' has wrong type. 'select' only " 268 "'%s' has wrong type. '%s' only "
265 "accept arguments of boolean and " 269 "accept arguments of boolean and "
266 "tristate type", sym2->name); 270 "tristate type", sym2->name, use);
267 break; 271 break;
268 case P_RANGE: 272 case P_RANGE:
269 if (sym->type != S_INT && sym->type != S_HEX) 273 if (sym->type != S_INT && sym->type != S_HEX)
@@ -333,6 +337,10 @@ void menu_finalize(struct menu *parent)
333 struct symbol *es = prop_get_symbol(prop); 337 struct symbol *es = prop_get_symbol(prop);
334 es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr, 338 es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr,
335 expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep))); 339 expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
340 } else if (prop->type == P_IMPLY) {
341 struct symbol *es = prop_get_symbol(prop);
342 es->implied.expr = expr_alloc_or(es->implied.expr,
343 expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
336 } 344 }
337 } 345 }
338 } 346 }
@@ -612,13 +620,30 @@ static struct property *get_symbol_prop(struct symbol *sym)
612 return prop; 620 return prop;
613} 621}
614 622
623static void get_symbol_props_str(struct gstr *r, struct symbol *sym,
624 enum prop_type tok, const char *prefix)
625{
626 bool hit = false;
627 struct property *prop;
628
629 for_all_properties(sym, prop, tok) {
630 if (!hit) {
631 str_append(r, prefix);
632 hit = true;
633 } else
634 str_printf(r, " && ");
635 expr_gstr_print(prop->expr, r);
636 }
637 if (hit)
638 str_append(r, "\n");
639}
640
615/* 641/*
616 * head is optional and may be NULL 642 * head is optional and may be NULL
617 */ 643 */
618static void get_symbol_str(struct gstr *r, struct symbol *sym, 644static void get_symbol_str(struct gstr *r, struct symbol *sym,
619 struct list_head *head) 645 struct list_head *head)
620{ 646{
621 bool hit;
622 struct property *prop; 647 struct property *prop;
623 648
624 if (sym && sym->name) { 649 if (sym && sym->name) {
@@ -648,22 +673,20 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym,
648 } 673 }
649 } 674 }
650 675
651 hit = false; 676 get_symbol_props_str(r, sym, P_SELECT, _(" Selects: "));
652 for_all_properties(sym, prop, P_SELECT) {
653 if (!hit) {
654 str_append(r, " Selects: ");
655 hit = true;
656 } else
657 str_printf(r, " && ");
658 expr_gstr_print(prop->expr, r);
659 }
660 if (hit)
661 str_append(r, "\n");
662 if (sym->rev_dep.expr) { 677 if (sym->rev_dep.expr) {
663 str_append(r, _(" Selected by: ")); 678 str_append(r, _(" Selected by: "));
664 expr_gstr_print(sym->rev_dep.expr, r); 679 expr_gstr_print(sym->rev_dep.expr, r);
665 str_append(r, "\n"); 680 str_append(r, "\n");
666 } 681 }
682
683 get_symbol_props_str(r, sym, P_IMPLY, _(" Implies: "));
684 if (sym->implied.expr) {
685 str_append(r, _(" Implied by: "));
686 expr_gstr_print(sym->implied.expr, r);
687 str_append(r, "\n");
688 }
689
667 str_append(r, "\n\n"); 690 str_append(r, "\n\n");
668} 691}
669 692
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 2432298487fb..20136ffefb23 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -258,6 +258,15 @@ static void sym_calc_visibility(struct symbol *sym)
258 sym->rev_dep.tri = tri; 258 sym->rev_dep.tri = tri;
259 sym_set_changed(sym); 259 sym_set_changed(sym);
260 } 260 }
261 tri = no;
262 if (sym->implied.expr && sym->dir_dep.tri != no)
263 tri = expr_calc_value(sym->implied.expr);
264 if (tri == mod && sym_get_type(sym) == S_BOOLEAN)
265 tri = yes;
266 if (sym->implied.tri != tri) {
267 sym->implied.tri = tri;
268 sym_set_changed(sym);
269 }
261} 270}
262 271
263/* 272/*
@@ -397,6 +406,10 @@ void sym_calc_value(struct symbol *sym)
397 newval.tri = EXPR_AND(expr_calc_value(prop->expr), 406 newval.tri = EXPR_AND(expr_calc_value(prop->expr),
398 prop->visible.tri); 407 prop->visible.tri);
399 } 408 }
409 if (sym->implied.tri != no) {
410 sym->flags |= SYMBOL_WRITE;
411 newval.tri = EXPR_OR(newval.tri, sym->implied.tri);
412 }
400 } 413 }
401 calc_newval: 414 calc_newval:
402 if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) { 415 if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) {
@@ -413,7 +426,8 @@ void sym_calc_value(struct symbol *sym)
413 } 426 }
414 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri); 427 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
415 } 428 }
416 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) 429 if (newval.tri == mod &&
430 (sym_get_type(sym) == S_BOOLEAN || sym->implied.tri == yes))
417 newval.tri = yes; 431 newval.tri = yes;
418 break; 432 break;
419 case S_STRING: 433 case S_STRING:
@@ -498,6 +512,8 @@ bool sym_tristate_within_range(struct symbol *sym, tristate val)
498 return false; 512 return false;
499 if (sym->visible <= sym->rev_dep.tri) 513 if (sym->visible <= sym->rev_dep.tri)
500 return false; 514 return false;
515 if (sym->implied.tri == yes && val == mod)
516 return false;
501 if (sym_is_choice_value(sym) && sym->visible == yes) 517 if (sym_is_choice_value(sym) && sym->visible == yes)
502 return val == yes; 518 return val == yes;
503 return val >= sym->rev_dep.tri && val <= sym->visible; 519 return val >= sym->rev_dep.tri && val <= sym->visible;
@@ -750,6 +766,10 @@ const char *sym_get_string_default(struct symbol *sym)
750 if (sym->type == S_BOOLEAN && val == mod) 766 if (sym->type == S_BOOLEAN && val == mod)
751 val = yes; 767 val = yes;
752 768
769 /* adjust the default value if this symbol is implied by another */
770 if (val < sym->implied.tri)
771 val = sym->implied.tri;
772
753 switch (sym->type) { 773 switch (sym->type) {
754 case S_BOOLEAN: 774 case S_BOOLEAN:
755 case S_TRISTATE: 775 case S_TRISTATE:
@@ -1352,6 +1372,8 @@ const char *prop_get_type_name(enum prop_type type)
1352 return "choice"; 1372 return "choice";
1353 case P_SELECT: 1373 case P_SELECT:
1354 return "select"; 1374 return "select";
1375 case P_IMPLY:
1376 return "imply";
1355 case P_RANGE: 1377 case P_RANGE:
1356 return "range"; 1378 return "range";
1357 case P_SYMBOL: 1379 case P_SYMBOL:
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf
index ac498f01b449..ead02edec936 100644
--- a/scripts/kconfig/zconf.gperf
+++ b/scripts/kconfig/zconf.gperf
@@ -38,6 +38,7 @@ int, T_TYPE, TF_COMMAND, S_INT
38hex, T_TYPE, TF_COMMAND, S_HEX 38hex, T_TYPE, TF_COMMAND, S_HEX
39string, T_TYPE, TF_COMMAND, S_STRING 39string, T_TYPE, TF_COMMAND, S_STRING
40select, T_SELECT, TF_COMMAND 40select, T_SELECT, TF_COMMAND
41imply, T_IMPLY, TF_COMMAND
41range, T_RANGE, TF_COMMAND 42range, T_RANGE, TF_COMMAND
42visible, T_VISIBLE, TF_COMMAND 43visible, T_VISIBLE, TF_COMMAND
43option, T_OPTION, TF_COMMAND 44option, T_OPTION, TF_COMMAND
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped
index 360a62df2b5e..d51b15de074a 100644
--- a/scripts/kconfig/zconf.hash.c_shipped
+++ b/scripts/kconfig/zconf.hash.c_shipped
@@ -55,10 +55,10 @@ kconf_id_hash (register const char *str, register unsigned int len)
55 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 55 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
56 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 56 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
57 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 57 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
58 73, 73, 73, 73, 73, 73, 73, 5, 25, 25, 58 73, 73, 73, 73, 73, 73, 73, 10, 25, 25,
59 0, 0, 0, 5, 0, 0, 73, 73, 5, 0, 59 0, 0, 0, 5, 0, 0, 73, 73, 5, 0,
60 10, 5, 45, 73, 20, 20, 0, 15, 15, 73, 60 10, 5, 45, 73, 20, 20, 0, 15, 15, 73,
61 20, 5, 73, 73, 73, 73, 73, 73, 73, 73, 61 20, 0, 73, 73, 73, 73, 73, 73, 73, 73,
62 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 62 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
63 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 63 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
64 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 64 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
@@ -120,6 +120,7 @@ struct kconf_id_strings_t
120 char kconf_id_strings_str43[sizeof("hex")]; 120 char kconf_id_strings_str43[sizeof("hex")];
121 char kconf_id_strings_str46[sizeof("config")]; 121 char kconf_id_strings_str46[sizeof("config")];
122 char kconf_id_strings_str47[sizeof("boolean")]; 122 char kconf_id_strings_str47[sizeof("boolean")];
123 char kconf_id_strings_str50[sizeof("imply")];
123 char kconf_id_strings_str51[sizeof("string")]; 124 char kconf_id_strings_str51[sizeof("string")];
124 char kconf_id_strings_str54[sizeof("help")]; 125 char kconf_id_strings_str54[sizeof("help")];
125 char kconf_id_strings_str56[sizeof("prompt")]; 126 char kconf_id_strings_str56[sizeof("prompt")];
@@ -157,6 +158,7 @@ static const struct kconf_id_strings_t kconf_id_strings_contents =
157 "hex", 158 "hex",
158 "config", 159 "config",
159 "boolean", 160 "boolean",
161 "imply",
160 "string", 162 "string",
161 "help", 163 "help",
162 "prompt", 164 "prompt",
@@ -174,7 +176,7 @@ kconf_id_lookup (register const char *str, register unsigned int len)
174{ 176{
175 enum 177 enum
176 { 178 {
177 TOTAL_KEYWORDS = 34, 179 TOTAL_KEYWORDS = 35,
178 MIN_WORD_LENGTH = 2, 180 MIN_WORD_LENGTH = 2,
179 MAX_WORD_LENGTH = 14, 181 MAX_WORD_LENGTH = 14,
180 MIN_HASH_VALUE = 2, 182 MIN_HASH_VALUE = 2,
@@ -205,15 +207,15 @@ kconf_id_lookup (register const char *str, register unsigned int len)
205 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_TRISTATE}, 207 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_TRISTATE},
206#line 36 "scripts/kconfig/zconf.gperf" 208#line 36 "scripts/kconfig/zconf.gperf"
207 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, 209 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN},
208#line 46 "scripts/kconfig/zconf.gperf" 210#line 47 "scripts/kconfig/zconf.gperf"
209 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_OPT_DEFCONFIG_LIST,TF_OPTION}, 211 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_OPT_DEFCONFIG_LIST,TF_OPTION},
210 {-1}, {-1}, 212 {-1}, {-1},
211#line 44 "scripts/kconfig/zconf.gperf" 213#line 45 "scripts/kconfig/zconf.gperf"
212 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_ON, TF_PARAM}, 214 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_ON, TF_PARAM},
213#line 29 "scripts/kconfig/zconf.gperf" 215#line 29 "scripts/kconfig/zconf.gperf"
214 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_OPTIONAL, TF_COMMAND}, 216 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_OPTIONAL, TF_COMMAND},
215 {-1}, {-1}, 217 {-1}, {-1},
216#line 43 "scripts/kconfig/zconf.gperf" 218#line 44 "scripts/kconfig/zconf.gperf"
217 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_OPTION, TF_COMMAND}, 219 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_OPTION, TF_COMMAND},
218#line 17 "scripts/kconfig/zconf.gperf" 220#line 17 "scripts/kconfig/zconf.gperf"
219 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_ENDMENU, TF_COMMAND}, 221 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_ENDMENU, TF_COMMAND},
@@ -223,9 +225,9 @@ kconf_id_lookup (register const char *str, register unsigned int len)
223#line 23 "scripts/kconfig/zconf.gperf" 225#line 23 "scripts/kconfig/zconf.gperf"
224 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str25, T_MENUCONFIG, TF_COMMAND}, 226 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str25, T_MENUCONFIG, TF_COMMAND},
225 {-1}, 227 {-1},
226#line 45 "scripts/kconfig/zconf.gperf" 228#line 46 "scripts/kconfig/zconf.gperf"
227 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION}, 229 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION},
228#line 48 "scripts/kconfig/zconf.gperf" 230#line 49 "scripts/kconfig/zconf.gperf"
229 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_OPT_ALLNOCONFIG_Y,TF_OPTION}, 231 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_OPT_ALLNOCONFIG_Y,TF_OPTION},
230#line 16 "scripts/kconfig/zconf.gperf" 232#line 16 "scripts/kconfig/zconf.gperf"
231 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND}, 233 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND},
@@ -234,10 +236,10 @@ kconf_id_lookup (register const char *str, register unsigned int len)
234 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SELECT, TF_COMMAND}, 236 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SELECT, TF_COMMAND},
235#line 21 "scripts/kconfig/zconf.gperf" 237#line 21 "scripts/kconfig/zconf.gperf"
236 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND}, 238 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND},
237#line 47 "scripts/kconfig/zconf.gperf" 239#line 48 "scripts/kconfig/zconf.gperf"
238 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_OPT_ENV, TF_OPTION}, 240 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_OPT_ENV, TF_OPTION},
239 {-1}, 241 {-1},
240#line 41 "scripts/kconfig/zconf.gperf" 242#line 42 "scripts/kconfig/zconf.gperf"
241 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_RANGE, TF_COMMAND}, 243 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_RANGE, TF_COMMAND},
242#line 19 "scripts/kconfig/zconf.gperf" 244#line 19 "scripts/kconfig/zconf.gperf"
243 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_CHOICE, TF_COMMAND}, 245 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_CHOICE, TF_COMMAND},
@@ -247,7 +249,7 @@ kconf_id_lookup (register const char *str, register unsigned int len)
247 {-1}, 249 {-1},
248#line 18 "scripts/kconfig/zconf.gperf" 250#line 18 "scripts/kconfig/zconf.gperf"
249 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_SOURCE, TF_COMMAND}, 251 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_SOURCE, TF_COMMAND},
250#line 42 "scripts/kconfig/zconf.gperf" 252#line 43 "scripts/kconfig/zconf.gperf"
251 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_VISIBLE, TF_COMMAND}, 253 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_VISIBLE, TF_COMMAND},
252#line 38 "scripts/kconfig/zconf.gperf" 254#line 38 "scripts/kconfig/zconf.gperf"
253 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str43, T_TYPE, TF_COMMAND, S_HEX}, 255 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str43, T_TYPE, TF_COMMAND, S_HEX},
@@ -256,7 +258,9 @@ kconf_id_lookup (register const char *str, register unsigned int len)
256 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_CONFIG, TF_COMMAND}, 258 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_CONFIG, TF_COMMAND},
257#line 35 "scripts/kconfig/zconf.gperf" 259#line 35 "scripts/kconfig/zconf.gperf"
258 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN}, 260 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN},
259 {-1}, {-1}, {-1}, 261 {-1}, {-1},
262#line 41 "scripts/kconfig/zconf.gperf"
263 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str50, T_IMPLY, TF_COMMAND},
260#line 39 "scripts/kconfig/zconf.gperf" 264#line 39 "scripts/kconfig/zconf.gperf"
261 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51, T_TYPE, TF_COMMAND, S_STRING}, 265 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51, T_TYPE, TF_COMMAND, S_STRING},
262 {-1}, {-1}, 266 {-1}, {-1},
@@ -289,5 +293,5 @@ kconf_id_lookup (register const char *str, register unsigned int len)
289 } 293 }
290 return 0; 294 return 0;
291} 295}
292#line 49 "scripts/kconfig/zconf.gperf" 296#line 50 "scripts/kconfig/zconf.gperf"
293 297
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
index 7a4d658c2066..65b7515a577c 100644
--- a/scripts/kconfig/zconf.tab.c_shipped
+++ b/scripts/kconfig/zconf.tab.c_shipped
@@ -1,19 +1,19 @@
1/* A Bison parser, made by GNU Bison 2.5.1. */ 1/* A Bison parser, made by GNU Bison 3.0.4. */
2 2
3/* Bison implementation for Yacc-like parsers in C 3/* Bison implementation for Yacc-like parsers in C
4 4
5 Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. 5 Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
6 6
7 This program is free software: you can redistribute it and/or modify 7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or 9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19
@@ -26,7 +26,7 @@
26 special exception, which will cause the skeleton and the resulting 26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public 27 Bison output files to be licensed under the GNU General Public
28 License without this special exception. 28 License without this special exception.
29 29
30 This special exception was added by the Free Software Foundation in 30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */ 31 version 2.2 of Bison. */
32 32
@@ -44,7 +44,7 @@
44#define YYBISON 1 44#define YYBISON 1
45 45
46/* Bison version. */ 46/* Bison version. */
47#define YYBISON_VERSION "2.5.1" 47#define YYBISON_VERSION "3.0.4"
48 48
49/* Skeleton name. */ 49/* Skeleton name. */
50#define YYSKELETON_NAME "yacc.c" 50#define YYSKELETON_NAME "yacc.c"
@@ -58,18 +58,16 @@
58/* Pull parsers. */ 58/* Pull parsers. */
59#define YYPULL 1 59#define YYPULL 1
60 60
61/* Using locations. */
62#define YYLSP_NEEDED 0
63 61
64/* Substitute the variable and function names. */ 62/* Substitute the variable and function names. */
65#define yyparse zconfparse 63#define yyparse zconfparse
66#define yylex zconflex 64#define yylex zconflex
67#define yyerror zconferror 65#define yyerror zconferror
68#define yylval zconflval
69#define yychar zconfchar
70#define yydebug zconfdebug 66#define yydebug zconfdebug
71#define yynerrs zconfnerrs 67#define yynerrs zconfnerrs
72 68
69#define yylval zconflval
70#define yychar zconfchar
73 71
74/* Copy the first part of user declarations. */ 72/* Copy the first part of user declarations. */
75 73
@@ -108,19 +106,14 @@ static struct menu *current_menu, *current_entry;
108 106
109 107
110 108
111# ifndef YY_NULL 109# ifndef YY_NULLPTR
112# if defined __cplusplus && 201103L <= __cplusplus 110# if defined __cplusplus && 201103L <= __cplusplus
113# define YY_NULL nullptr 111# define YY_NULLPTR nullptr
114# else 112# else
115# define YY_NULL 0 113# define YY_NULLPTR 0
116# endif 114# endif
117# endif 115# endif
118 116
119/* Enabling traces. */
120#ifndef YYDEBUG
121# define YYDEBUG 1
122#endif
123
124/* Enabling verbose error messages. */ 117/* Enabling verbose error messages. */
125#ifdef YYERROR_VERBOSE 118#ifdef YYERROR_VERBOSE
126# undef YYERROR_VERBOSE 119# undef YYERROR_VERBOSE
@@ -129,62 +122,65 @@ static struct menu *current_menu, *current_entry;
129# define YYERROR_VERBOSE 0 122# define YYERROR_VERBOSE 0
130#endif 123#endif
131 124
132/* Enabling the token table. */
133#ifndef YYTOKEN_TABLE
134# define YYTOKEN_TABLE 0
135#endif
136 125
126/* Debug traces. */
127#ifndef YYDEBUG
128# define YYDEBUG 1
129#endif
130#if YYDEBUG
131extern int zconfdebug;
132#endif
137 133
138/* Tokens. */ 134/* Token type. */
139#ifndef YYTOKENTYPE 135#ifndef YYTOKENTYPE
140# define YYTOKENTYPE 136# define YYTOKENTYPE
141 /* Put the tokens into the symbol table, so that GDB and other debuggers 137 enum yytokentype
142 know about them. */ 138 {
143 enum yytokentype { 139 T_MAINMENU = 258,
144 T_MAINMENU = 258, 140 T_MENU = 259,
145 T_MENU = 259, 141 T_ENDMENU = 260,
146 T_ENDMENU = 260, 142 T_SOURCE = 261,
147 T_SOURCE = 261, 143 T_CHOICE = 262,
148 T_CHOICE = 262, 144 T_ENDCHOICE = 263,
149 T_ENDCHOICE = 263, 145 T_COMMENT = 264,
150 T_COMMENT = 264, 146 T_CONFIG = 265,
151 T_CONFIG = 265, 147 T_MENUCONFIG = 266,
152 T_MENUCONFIG = 266, 148 T_HELP = 267,
153 T_HELP = 267, 149 T_HELPTEXT = 268,
154 T_HELPTEXT = 268, 150 T_IF = 269,
155 T_IF = 269, 151 T_ENDIF = 270,
156 T_ENDIF = 270, 152 T_DEPENDS = 271,
157 T_DEPENDS = 271, 153 T_OPTIONAL = 272,
158 T_OPTIONAL = 272, 154 T_PROMPT = 273,
159 T_PROMPT = 273, 155 T_TYPE = 274,
160 T_TYPE = 274, 156 T_DEFAULT = 275,
161 T_DEFAULT = 275, 157 T_SELECT = 276,
162 T_SELECT = 276, 158 T_IMPLY = 277,
163 T_RANGE = 277, 159 T_RANGE = 278,
164 T_VISIBLE = 278, 160 T_VISIBLE = 279,
165 T_OPTION = 279, 161 T_OPTION = 280,
166 T_ON = 280, 162 T_ON = 281,
167 T_WORD = 281, 163 T_WORD = 282,
168 T_WORD_QUOTE = 282, 164 T_WORD_QUOTE = 283,
169 T_UNEQUAL = 283, 165 T_UNEQUAL = 284,
170 T_LESS = 284, 166 T_LESS = 285,
171 T_LESS_EQUAL = 285, 167 T_LESS_EQUAL = 286,
172 T_GREATER = 286, 168 T_GREATER = 287,
173 T_GREATER_EQUAL = 287, 169 T_GREATER_EQUAL = 288,
174 T_CLOSE_PAREN = 288, 170 T_CLOSE_PAREN = 289,
175 T_OPEN_PAREN = 289, 171 T_OPEN_PAREN = 290,
176 T_EOL = 290, 172 T_EOL = 291,
177 T_OR = 291, 173 T_OR = 292,
178 T_AND = 292, 174 T_AND = 293,
179 T_EQUAL = 293, 175 T_EQUAL = 294,
180 T_NOT = 294 176 T_NOT = 295
181 }; 177 };
182#endif 178#endif
183 179
184 180/* Value type. */
185
186#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 181#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
187typedef union YYSTYPE 182
183union YYSTYPE
188{ 184{
189 185
190 186
@@ -196,14 +192,20 @@ typedef union YYSTYPE
196 const struct kconf_id *id; 192 const struct kconf_id *id;
197 193
198 194
195};
199 196
200} YYSTYPE; 197typedef union YYSTYPE YYSTYPE;
201# define YYSTYPE_IS_TRIVIAL 1 198# define YYSTYPE_IS_TRIVIAL 1
202# define yystype YYSTYPE /* obsolescent; will be withdrawn */
203# define YYSTYPE_IS_DECLARED 1 199# define YYSTYPE_IS_DECLARED 1
204#endif 200#endif
205 201
206 202
203extern YYSTYPE zconflval;
204
205int zconfparse (void);
206
207
208
207/* Copy the second part of user declarations. */ 209/* Copy the second part of user declarations. */
208 210
209 211
@@ -224,11 +226,8 @@ typedef unsigned char yytype_uint8;
224 226
225#ifdef YYTYPE_INT8 227#ifdef YYTYPE_INT8
226typedef YYTYPE_INT8 yytype_int8; 228typedef YYTYPE_INT8 yytype_int8;
227#elif (defined __STDC__ || defined __C99__FUNC__ \
228 || defined __cplusplus || defined _MSC_VER)
229typedef signed char yytype_int8;
230#else 229#else
231typedef short int yytype_int8; 230typedef signed char yytype_int8;
232#endif 231#endif
233 232
234#ifdef YYTYPE_UINT16 233#ifdef YYTYPE_UINT16
@@ -248,8 +247,7 @@ typedef short int yytype_int16;
248# define YYSIZE_T __SIZE_TYPE__ 247# define YYSIZE_T __SIZE_TYPE__
249# elif defined size_t 248# elif defined size_t
250# define YYSIZE_T size_t 249# define YYSIZE_T size_t
251# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 250# elif ! defined YYSIZE_T
252 || defined __cplusplus || defined _MSC_VER)
253# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 251# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
254# define YYSIZE_T size_t 252# define YYSIZE_T size_t
255# else 253# else
@@ -263,38 +261,67 @@ typedef short int yytype_int16;
263# if defined YYENABLE_NLS && YYENABLE_NLS 261# if defined YYENABLE_NLS && YYENABLE_NLS
264# if ENABLE_NLS 262# if ENABLE_NLS
265# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 263# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
266# define YY_(msgid) dgettext ("bison-runtime", msgid) 264# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
267# endif 265# endif
268# endif 266# endif
269# ifndef YY_ 267# ifndef YY_
270# define YY_(msgid) msgid 268# define YY_(Msgid) Msgid
269# endif
270#endif
271
272#ifndef YY_ATTRIBUTE
273# if (defined __GNUC__ \
274 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
275 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
276# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
277# else
278# define YY_ATTRIBUTE(Spec) /* empty */
279# endif
280#endif
281
282#ifndef YY_ATTRIBUTE_PURE
283# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
284#endif
285
286#ifndef YY_ATTRIBUTE_UNUSED
287# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
288#endif
289
290#if !defined _Noreturn \
291 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
292# if defined _MSC_VER && 1200 <= _MSC_VER
293# define _Noreturn __declspec (noreturn)
294# else
295# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
271# endif 296# endif
272#endif 297#endif
273 298
274/* Suppress unused-variable warnings by "using" E. */ 299/* Suppress unused-variable warnings by "using" E. */
275#if ! defined lint || defined __GNUC__ 300#if ! defined lint || defined __GNUC__
276# define YYUSE(e) ((void) (e)) 301# define YYUSE(E) ((void) (E))
277#else 302#else
278# define YYUSE(e) /* empty */ 303# define YYUSE(E) /* empty */
279#endif 304#endif
280 305
281/* Identity function, used to suppress warnings about constant conditions. */ 306#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
282#ifndef lint 307/* Suppress an incorrect diagnostic about yylval being uninitialized. */
283# define YYID(n) (n) 308# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
284#else 309 _Pragma ("GCC diagnostic push") \
285#if (defined __STDC__ || defined __C99__FUNC__ \ 310 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
286 || defined __cplusplus || defined _MSC_VER) 311 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
287static int 312# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
288YYID (int yyi) 313 _Pragma ("GCC diagnostic pop")
289#else 314#else
290static int 315# define YY_INITIAL_VALUE(Value) Value
291YYID (yyi)
292 int yyi;
293#endif 316#endif
294{ 317#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
295 return yyi; 318# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
296} 319# define YY_IGNORE_MAYBE_UNINITIALIZED_END
297#endif 320#endif
321#ifndef YY_INITIAL_VALUE
322# define YY_INITIAL_VALUE(Value) /* Nothing. */
323#endif
324
298 325
299#if ! defined yyoverflow || YYERROR_VERBOSE 326#if ! defined yyoverflow || YYERROR_VERBOSE
300 327
@@ -313,8 +340,7 @@ YYID (yyi)
313# define alloca _alloca 340# define alloca _alloca
314# else 341# else
315# define YYSTACK_ALLOC alloca 342# define YYSTACK_ALLOC alloca
316# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 343# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
317 || defined __cplusplus || defined _MSC_VER)
318# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 344# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
319 /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 345 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
320# ifndef EXIT_SUCCESS 346# ifndef EXIT_SUCCESS
@@ -326,8 +352,8 @@ YYID (yyi)
326# endif 352# endif
327 353
328# ifdef YYSTACK_ALLOC 354# ifdef YYSTACK_ALLOC
329 /* Pacify GCC's `empty if-body' warning. */ 355 /* Pacify GCC's 'empty if-body' warning. */
330# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 356# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
331# ifndef YYSTACK_ALLOC_MAXIMUM 357# ifndef YYSTACK_ALLOC_MAXIMUM
332 /* The OS might guarantee only one guard page at the bottom of the stack, 358 /* The OS might guarantee only one guard page at the bottom of the stack,
333 and a page size can be as small as 4096 bytes. So we cannot safely 359 and a page size can be as small as 4096 bytes. So we cannot safely
@@ -343,7 +369,7 @@ YYID (yyi)
343# endif 369# endif
344# if (defined __cplusplus && ! defined EXIT_SUCCESS \ 370# if (defined __cplusplus && ! defined EXIT_SUCCESS \
345 && ! ((defined YYMALLOC || defined malloc) \ 371 && ! ((defined YYMALLOC || defined malloc) \
346 && (defined YYFREE || defined free))) 372 && (defined YYFREE || defined free)))
347# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 373# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
348# ifndef EXIT_SUCCESS 374# ifndef EXIT_SUCCESS
349# define EXIT_SUCCESS 0 375# define EXIT_SUCCESS 0
@@ -351,15 +377,13 @@ YYID (yyi)
351# endif 377# endif
352# ifndef YYMALLOC 378# ifndef YYMALLOC
353# define YYMALLOC malloc 379# define YYMALLOC malloc
354# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 380# if ! defined malloc && ! defined EXIT_SUCCESS
355 || defined __cplusplus || defined _MSC_VER)
356void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 381void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
357# endif 382# endif
358# endif 383# endif
359# ifndef YYFREE 384# ifndef YYFREE
360# define YYFREE free 385# define YYFREE free
361# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 386# if ! defined free && ! defined EXIT_SUCCESS
362 || defined __cplusplus || defined _MSC_VER)
363void free (void *); /* INFRINGES ON USER NAME SPACE */ 387void free (void *); /* INFRINGES ON USER NAME SPACE */
364# endif 388# endif
365# endif 389# endif
@@ -369,7 +393,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
369 393
370#if (! defined yyoverflow \ 394#if (! defined yyoverflow \
371 && (! defined __cplusplus \ 395 && (! defined __cplusplus \
372 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 396 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
373 397
374/* A type that is properly aligned for any stack member. */ 398/* A type that is properly aligned for any stack member. */
375union yyalloc 399union yyalloc
@@ -394,16 +418,16 @@ union yyalloc
394 elements in the stack, and YYPTR gives the new location of the 418 elements in the stack, and YYPTR gives the new location of the
395 stack. Advance YYPTR to a properly aligned location for the next 419 stack. Advance YYPTR to a properly aligned location for the next
396 stack. */ 420 stack. */
397# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 421# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
398 do \ 422 do \
399 { \ 423 { \
400 YYSIZE_T yynewbytes; \ 424 YYSIZE_T yynewbytes; \
401 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 425 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
402 Stack = &yyptr->Stack_alloc; \ 426 Stack = &yyptr->Stack_alloc; \
403 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 427 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
404 yyptr += yynewbytes / sizeof (*yyptr); \ 428 yyptr += yynewbytes / sizeof (*yyptr); \
405 } \ 429 } \
406 while (YYID (0)) 430 while (0)
407 431
408#endif 432#endif
409 433
@@ -422,7 +446,7 @@ union yyalloc
422 for (yyi = 0; yyi < (Count); yyi++) \ 446 for (yyi = 0; yyi < (Count); yyi++) \
423 (Dst)[yyi] = (Src)[yyi]; \ 447 (Dst)[yyi] = (Src)[yyi]; \
424 } \ 448 } \
425 while (YYID (0)) 449 while (0)
426# endif 450# endif
427# endif 451# endif
428#endif /* !YYCOPY_NEEDED */ 452#endif /* !YYCOPY_NEEDED */
@@ -430,25 +454,27 @@ union yyalloc
430/* YYFINAL -- State number of the termination state. */ 454/* YYFINAL -- State number of the termination state. */
431#define YYFINAL 11 455#define YYFINAL 11
432/* YYLAST -- Last index in YYTABLE. */ 456/* YYLAST -- Last index in YYTABLE. */
433#define YYLAST 298 457#define YYLAST 301
434 458
435/* YYNTOKENS -- Number of terminals. */ 459/* YYNTOKENS -- Number of terminals. */
436#define YYNTOKENS 40 460#define YYNTOKENS 41
437/* YYNNTS -- Number of nonterminals. */ 461/* YYNNTS -- Number of nonterminals. */
438#define YYNNTS 50 462#define YYNNTS 50
439/* YYNRULES -- Number of rules. */ 463/* YYNRULES -- Number of rules. */
440#define YYNRULES 122 464#define YYNRULES 124
441/* YYNRULES -- Number of states. */ 465/* YYNSTATES -- Number of states. */
442#define YYNSTATES 199 466#define YYNSTATES 204
443 467
444/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 468/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
469 by yylex, with out-of-bounds checking. */
445#define YYUNDEFTOK 2 470#define YYUNDEFTOK 2
446#define YYMAXUTOK 294 471#define YYMAXUTOK 295
447 472
448#define YYTRANSLATE(YYX) \ 473#define YYTRANSLATE(YYX) \
449 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 474 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
450 475
451/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 476/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
477 as returned by yylex, without out-of-bounds checking. */
452static const yytype_uint8 yytranslate[] = 478static const yytype_uint8 yytranslate[] =
453{ 479{
454 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 480 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -480,90 +506,30 @@ static const yytype_uint8 yytranslate[] =
480 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 506 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
481 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 507 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
482 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 508 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
483 35, 36, 37, 38, 39 509 35, 36, 37, 38, 39, 40
484}; 510};
485 511
486#if YYDEBUG 512#if YYDEBUG
487/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 513 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
488 YYRHS. */
489static const yytype_uint16 yyprhs[] =
490{
491 0, 0, 3, 6, 8, 11, 13, 14, 17, 20,
492 23, 26, 31, 36, 40, 42, 44, 46, 48, 50,
493 52, 54, 56, 58, 60, 62, 64, 66, 68, 72,
494 75, 79, 82, 86, 89, 90, 93, 96, 99, 102,
495 105, 108, 112, 117, 122, 127, 133, 137, 138, 142,
496 143, 146, 150, 153, 155, 159, 160, 163, 166, 169,
497 172, 175, 180, 184, 187, 192, 193, 196, 200, 202,
498 206, 207, 210, 213, 216, 220, 224, 228, 230, 234,
499 235, 238, 241, 244, 248, 252, 255, 258, 261, 262,
500 265, 268, 271, 276, 277, 280, 283, 286, 287, 290,
501 292, 294, 297, 300, 303, 305, 308, 309, 312, 314,
502 318, 322, 326, 330, 334, 338, 342, 345, 349, 353,
503 355, 357, 358
504};
505
506/* YYRHS -- A `-1'-separated list of the rules' RHS. */
507static const yytype_int8 yyrhs[] =
508{
509 41, 0, -1, 85, 42, -1, 42, -1, 67, 43,
510 -1, 43, -1, -1, 43, 45, -1, 43, 59, -1,
511 43, 71, -1, 43, 84, -1, 43, 26, 1, 35,
512 -1, 43, 44, 1, 35, -1, 43, 1, 35, -1,
513 16, -1, 18, -1, 19, -1, 21, -1, 17, -1,
514 22, -1, 20, -1, 23, -1, 35, -1, 65, -1,
515 75, -1, 48, -1, 50, -1, 73, -1, 26, 1,
516 35, -1, 1, 35, -1, 10, 26, 35, -1, 47,
517 51, -1, 11, 26, 35, -1, 49, 51, -1, -1,
518 51, 52, -1, 51, 53, -1, 51, 79, -1, 51,
519 77, -1, 51, 46, -1, 51, 35, -1, 19, 82,
520 35, -1, 18, 83, 86, 35, -1, 20, 87, 86,
521 35, -1, 21, 26, 86, 35, -1, 22, 88, 88,
522 86, 35, -1, 24, 54, 35, -1, -1, 54, 26,
523 55, -1, -1, 38, 83, -1, 7, 89, 35, -1,
524 56, 60, -1, 84, -1, 57, 62, 58, -1, -1,
525 60, 61, -1, 60, 79, -1, 60, 77, -1, 60,
526 35, -1, 60, 46, -1, 18, 83, 86, 35, -1,
527 19, 82, 35, -1, 17, 35, -1, 20, 26, 86,
528 35, -1, -1, 62, 45, -1, 14, 87, 85, -1,
529 84, -1, 63, 66, 64, -1, -1, 66, 45, -1,
530 66, 71, -1, 66, 59, -1, 3, 83, 85, -1,
531 4, 83, 35, -1, 68, 80, 78, -1, 84, -1,
532 69, 72, 70, -1, -1, 72, 45, -1, 72, 71,
533 -1, 72, 59, -1, 6, 83, 35, -1, 9, 83,
534 35, -1, 74, 78, -1, 12, 35, -1, 76, 13,
535 -1, -1, 78, 79, -1, 78, 35, -1, 78, 46,
536 -1, 16, 25, 87, 35, -1, -1, 80, 81, -1,
537 80, 35, -1, 23, 86, -1, -1, 83, 86, -1,
538 26, -1, 27, -1, 5, 35, -1, 8, 35, -1,
539 15, 35, -1, 35, -1, 85, 35, -1, -1, 14,
540 87, -1, 88, -1, 88, 29, 88, -1, 88, 30,
541 88, -1, 88, 31, 88, -1, 88, 32, 88, -1,
542 88, 38, 88, -1, 88, 28, 88, -1, 34, 87,
543 33, -1, 39, 87, -1, 87, 36, 87, -1, 87,
544 37, 87, -1, 26, -1, 27, -1, -1, 26, -1
545};
546
547/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
548static const yytype_uint16 yyrline[] = 514static const yytype_uint16 yyrline[] =
549{ 515{
550 0, 108, 108, 108, 110, 110, 112, 114, 115, 116, 516 0, 109, 109, 109, 111, 111, 113, 115, 116, 117,
551 117, 118, 119, 123, 127, 127, 127, 127, 127, 127, 517 118, 119, 120, 124, 128, 128, 128, 128, 128, 128,
552 127, 127, 131, 132, 133, 134, 135, 136, 140, 141, 518 128, 128, 128, 132, 133, 134, 135, 136, 137, 141,
553 147, 155, 161, 169, 179, 181, 182, 183, 184, 185, 519 142, 148, 156, 162, 170, 180, 182, 183, 184, 185,
554 186, 189, 197, 203, 213, 219, 225, 228, 230, 241, 520 186, 187, 190, 198, 204, 214, 220, 226, 232, 235,
555 242, 247, 256, 261, 269, 272, 274, 275, 276, 277, 521 237, 248, 249, 254, 263, 268, 276, 279, 281, 282,
556 278, 281, 287, 298, 304, 314, 316, 321, 329, 337, 522 283, 284, 285, 288, 294, 305, 311, 321, 323, 328,
557 340, 342, 343, 344, 349, 356, 363, 368, 376, 379, 523 336, 344, 347, 349, 350, 351, 356, 363, 370, 375,
558 381, 382, 383, 386, 394, 401, 408, 414, 421, 423, 524 383, 386, 388, 389, 390, 393, 401, 408, 415, 421,
559 424, 425, 428, 436, 438, 439, 442, 449, 451, 456, 525 428, 430, 431, 432, 435, 443, 445, 446, 449, 456,
560 457, 460, 461, 462, 466, 467, 470, 471, 474, 475, 526 458, 463, 464, 467, 468, 469, 473, 474, 477, 478,
561 476, 477, 478, 479, 480, 481, 482, 483, 484, 487, 527 481, 482, 483, 484, 485, 486, 487, 488, 489, 490,
562 488, 491, 492 528 491, 494, 495, 498, 499
563}; 529};
564#endif 530#endif
565 531
566#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 532#if YYDEBUG || YYERROR_VERBOSE || 0
567/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 533/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
568 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 534 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
569static const char *const yytname[] = 535static const char *const yytname[] =
@@ -571,9 +537,9 @@ static const char *const yytname[] =
571 "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU", 537 "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
572 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", 538 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
573 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", 539 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
574 "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE", 540 "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_IMPLY",
575 "T_VISIBLE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", 541 "T_RANGE", "T_VISIBLE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE",
576 "T_LESS", "T_LESS_EQUAL", "T_GREATER", "T_GREATER_EQUAL", 542 "T_UNEQUAL", "T_LESS", "T_LESS_EQUAL", "T_GREATER", "T_GREATER_EQUAL",
577 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL", 543 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
578 "T_NOT", "$accept", "input", "start", "stmt_list", "option_name", 544 "T_NOT", "$accept", "input", "start", "stmt_list", "option_name",
579 "common_stmt", "option_error", "config_entry_start", "config_stmt", 545 "common_stmt", "option_error", "config_entry_start", "config_stmt",
@@ -585,260 +551,254 @@ static const char *const yytname[] =
585 "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt", 551 "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt",
586 "comment", "comment_stmt", "help_start", "help", "depends_list", 552 "comment", "comment_stmt", "help_start", "help", "depends_list",
587 "depends", "visibility_list", "visible", "prompt_stmt_opt", "prompt", 553 "depends", "visibility_list", "visible", "prompt_stmt_opt", "prompt",
588 "end", "nl", "if_expr", "expr", "symbol", "word_opt", YY_NULL 554 "end", "nl", "if_expr", "expr", "symbol", "word_opt", YY_NULLPTR
589}; 555};
590#endif 556#endif
591 557
592# ifdef YYPRINT 558# ifdef YYPRINT
593/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 559/* YYTOKNUM[NUM] -- (External) token number corresponding to the
594 token YYLEX-NUM. */ 560 (internal) symbol number NUM (which must be that of a token). */
595static const yytype_uint16 yytoknum[] = 561static const yytype_uint16 yytoknum[] =
596{ 562{
597 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 563 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
598 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 564 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
599 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 565 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
600 285, 286, 287, 288, 289, 290, 291, 292, 293, 294 566 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
567 295
601}; 568};
602# endif 569# endif
603 570
604/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 571#define YYPACT_NINF -92
605static const yytype_uint8 yyr1[] = 572
573#define yypact_value_is_default(Yystate) \
574 (!!((Yystate) == (-92)))
575
576#define YYTABLE_NINF -88
577
578#define yytable_value_is_error(Yytable_value) \
579 0
580
581 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
582 STATE-NUM. */
583static const yytype_int16 yypact[] =
606{ 584{
607 0, 40, 41, 41, 42, 42, 43, 43, 43, 43, 585 17, 41, -92, 15, -92, 150, -92, 19, -92, -92,
608 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 586 -13, -92, 28, 41, 38, 41, 50, 47, 41, 79,
609 44, 44, 45, 45, 45, 45, 45, 45, 46, 46, 587 82, 44, 76, -92, -92, -92, -92, -92, -92, -92,
610 47, 48, 49, 50, 51, 51, 51, 51, 51, 51, 588 -92, -92, 118, -92, 129, -92, -92, -92, -92, -92,
611 51, 52, 52, 52, 52, 52, 53, 54, 54, 55, 589 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
612 55, 56, 57, 58, 59, 60, 60, 60, 60, 60, 590 -92, -92, 184, -92, -92, 107, -92, 111, -92, 113,
613 60, 61, 61, 61, 61, 62, 62, 63, 64, 65, 591 -92, 116, -92, 139, 140, 151, -92, -92, 44, 44,
614 66, 66, 66, 66, 67, 68, 69, 70, 71, 72, 592 142, 256, -92, 160, 173, 27, 117, 80, 51, 255,
615 72, 72, 72, 73, 74, 75, 76, 77, 78, 78, 593 -15, 255, 217, -92, -92, -92, -92, -92, -92, -8,
616 78, 78, 79, 80, 80, 80, 81, 82, 82, 83, 594 -92, 44, 44, 107, 87, 87, 87, 87, 87, 87,
617 83, 84, 84, 84, 85, 85, 86, 86, 87, 87, 595 -92, -92, 174, 176, 187, 41, 41, 44, 188, 189,
618 87, 87, 87, 87, 87, 87, 87, 87, 87, 88, 596 87, -92, 213, -92, -92, -92, -92, 206, -92, -92,
619 88, 89, 89 597 193, 41, 41, 203, -92, -92, -92, -92, -92, -92,
598 -92, -92, -92, -92, -92, -92, -92, 229, -92, 241,
599 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
600 216, -92, -92, -92, -92, -92, -92, -92, -92, -92,
601 44, 229, 222, 229, 64, 229, 229, 87, 31, 231,
602 -92, -92, 229, 236, 229, 44, -92, 145, 242, -92,
603 -92, 243, 244, 245, 229, 251, -92, -92, 247, -92,
604 257, 125, -92, -92, -92, -92, -92, 260, 41, -92,
605 -92, -92, -92, -92
620}; 606};
621 607
622/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 608 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
623static const yytype_uint8 yyr2[] = 609 Performed when YYTABLE does not specify something else to do. Zero
610 means the default is an error. */
611static const yytype_uint8 yydefact[] =
624{ 612{
625 0, 2, 2, 1, 2, 1, 0, 2, 2, 2, 613 6, 0, 106, 0, 3, 0, 6, 6, 101, 102,
626 2, 4, 4, 3, 1, 1, 1, 1, 1, 1, 614 0, 1, 0, 0, 0, 0, 123, 0, 0, 0,
627 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 615 0, 0, 0, 14, 19, 15, 16, 21, 17, 18,
628 3, 2, 3, 2, 0, 2, 2, 2, 2, 2, 616 20, 22, 0, 23, 0, 7, 35, 26, 35, 27,
629 2, 3, 4, 4, 4, 5, 3, 0, 3, 0, 617 57, 67, 8, 72, 24, 95, 81, 9, 28, 90,
630 2, 3, 2, 1, 3, 0, 2, 2, 2, 2, 618 25, 10, 0, 107, 2, 76, 13, 0, 103, 0,
631 2, 4, 3, 2, 4, 0, 2, 3, 1, 3, 619 124, 0, 104, 0, 0, 0, 121, 122, 0, 0,
632 0, 2, 2, 2, 3, 3, 3, 1, 3, 0, 620 0, 110, 105, 0, 0, 0, 0, 0, 0, 0,
633 2, 2, 2, 3, 3, 2, 2, 2, 0, 2, 621 90, 0, 0, 77, 85, 53, 86, 31, 33, 0,
634 2, 2, 4, 0, 2, 2, 2, 0, 2, 1, 622 118, 0, 0, 69, 0, 0, 0, 0, 0, 0,
635 1, 2, 2, 2, 1, 2, 0, 2, 1, 3, 623 11, 12, 0, 0, 0, 0, 99, 0, 0, 0,
636 3, 3, 3, 3, 3, 3, 2, 3, 3, 1, 624 0, 49, 0, 41, 40, 36, 37, 0, 39, 38,
637 1, 0, 1 625 0, 0, 99, 0, 61, 62, 58, 60, 59, 68,
626 56, 55, 73, 75, 71, 74, 70, 108, 97, 0,
627 96, 82, 84, 80, 83, 79, 92, 93, 91, 117,
628 119, 120, 116, 111, 112, 113, 114, 115, 30, 88,
629 0, 108, 0, 108, 108, 108, 108, 0, 0, 0,
630 89, 65, 108, 0, 108, 0, 98, 0, 0, 42,
631 100, 0, 0, 0, 108, 51, 48, 29, 0, 64,
632 0, 109, 94, 43, 44, 45, 46, 0, 0, 50,
633 63, 66, 47, 52
638}; 634};
639 635
640/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. 636 /* YYPGOTO[NTERM-NUM]. */
641 Performed when YYTABLE doesn't specify something else to do. Zero 637static const yytype_int16 yypgoto[] =
642 means the default is an error. */
643static const yytype_uint8 yydefact[] =
644{ 638{
645 6, 0, 104, 0, 3, 0, 6, 6, 99, 100, 639 -92, -92, 285, 291, -92, 32, -66, -92, -92, -92,
646 0, 1, 0, 0, 0, 0, 121, 0, 0, 0, 640 -92, 261, -92, -92, -92, -92, -92, -92, -92, 1,
647 0, 0, 0, 14, 18, 15, 16, 20, 17, 19, 641 -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
648 21, 0, 22, 0, 7, 34, 25, 34, 26, 55, 642 -92, 24, -92, -92, -92, -92, -92, 221, 220, -64,
649 65, 8, 70, 23, 93, 79, 9, 27, 88, 24, 643 -92, -92, 179, -1, 67, 0, 110, -67, -91, -92
650 10, 0, 105, 2, 74, 13, 0, 101, 0, 122,
651 0, 102, 0, 0, 0, 119, 120, 0, 0, 0,
652 108, 103, 0, 0, 0, 0, 0, 0, 0, 88,
653 0, 0, 75, 83, 51, 84, 30, 32, 0, 116,
654 0, 0, 67, 0, 0, 0, 0, 0, 0, 11,
655 12, 0, 0, 0, 0, 97, 0, 0, 0, 47,
656 0, 40, 39, 35, 36, 0, 38, 37, 0, 0,
657 97, 0, 59, 60, 56, 58, 57, 66, 54, 53,
658 71, 73, 69, 72, 68, 106, 95, 0, 94, 80,
659 82, 78, 81, 77, 90, 91, 89, 115, 117, 118,
660 114, 109, 110, 111, 112, 113, 29, 86, 0, 106,
661 0, 106, 106, 106, 0, 0, 0, 87, 63, 106,
662 0, 106, 0, 96, 0, 0, 41, 98, 0, 0,
663 106, 49, 46, 28, 0, 62, 0, 107, 92, 42,
664 43, 44, 0, 0, 48, 61, 64, 45, 50
665}; 644};
666 645
667/* YYDEFGOTO[NTERM-NUM]. */ 646 /* YYDEFGOTO[NTERM-NUM]. */
668static const yytype_int16 yydefgoto[] = 647static const yytype_int16 yydefgoto[] =
669{ 648{
670 -1, 3, 4, 5, 33, 34, 112, 35, 36, 37, 649 -1, 3, 4, 5, 34, 35, 114, 36, 37, 38,
671 38, 74, 113, 114, 165, 194, 39, 40, 128, 41, 650 39, 75, 115, 116, 168, 199, 40, 41, 130, 42,
672 76, 124, 77, 42, 132, 43, 78, 6, 44, 45, 651 77, 126, 78, 43, 134, 44, 79, 6, 45, 46,
673 141, 46, 80, 47, 48, 49, 115, 116, 81, 117, 652 143, 47, 81, 48, 49, 50, 117, 118, 82, 119,
674 79, 138, 160, 161, 50, 7, 173, 69, 70, 60 653 80, 140, 162, 163, 51, 7, 176, 70, 71, 61
675}; 654};
676 655
677/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 656 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
678 STATE-NUM. */ 657 positive, shift that token. If negative, reduce the rule whose
679#define YYPACT_NINF -91 658 number is the opposite. If YYTABLE_NINF, syntax error. */
680static const yytype_int16 yypact[] = 659static const yytype_int16 yytable[] =
681{ 660{
682 19, 37, -91, 13, -91, 79, -91, 20, -91, -91, 661 10, 89, 90, 152, 153, 154, 155, 156, 157, 137,
683 -16, -91, 21, 37, 25, 37, 41, 36, 37, 78, 662 55, 125, 57, 128, 59, 11, 147, 63, 148, 167,
684 83, 31, 56, -91, -91, -91, -91, -91, -91, -91, 663 1, 138, 1, 2, 150, 151, 149, -32, 102, 91,
685 -91, 116, -91, 127, -91, -91, -91, -91, -91, -91, 664 92, -32, -32, -32, -32, -32, -32, -32, -32, 103,
686 -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, 665 164, -32, -32, 104, -32, 105, 106, 107, 108, 109,
687 -91, 147, -91, -91, 105, -91, 109, -91, 111, -91, 666 110, -32, 111, 2, 112, 53, 14, 15, 185, 17,
688 114, -91, 136, 137, 142, -91, -91, 31, 31, 76, 667 18, 19, 20, 113, 56, 21, 22, 186, 8, 9,
689 254, -91, 143, 146, 27, 115, 207, 258, 243, -14, 668 93, 66, 67, 147, 58, 148, 184, 60, 175, 68,
690 243, 179, -91, -91, -91, -91, -91, -91, -7, -91, 669 133, 102, 142, 62, 69, -54, -54, 33, -54, -54,
691 31, 31, 105, 51, 51, 51, 51, 51, 51, -91, 670 -54, -54, 103, 177, -54, -54, 104, 120, 121, 122,
692 -91, 156, 168, 181, 37, 37, 31, 178, 51, -91, 671 123, 91, 92, 135, 161, 144, 64, 112, 191, 65,
693 206, -91, -91, -91, -91, 196, -91, -91, 175, 37, 672 129, 132, 72, 141, 66, 67, 124, -34, 102, 73,
694 37, 185, -91, -91, -91, -91, -91, -91, -91, -91, 673 172, -34, -34, -34, -34, -34, -34, -34, -34, 103,
695 -91, -91, -91, -91, -91, 214, -91, 230, -91, -91, 674 74, -34, -34, 104, -34, 105, 106, 107, 108, 109,
696 -91, -91, -91, -91, -91, -91, -91, -91, 183, -91, 675 110, -34, 111, 53, 112, 131, 136, 83, 145, 84,
697 -91, -91, -91, -91, -91, -91, -91, -91, 31, 214, 676 -5, 12, 85, 113, 13, 14, 15, 16, 17, 18,
698 194, 214, 45, 214, 51, 26, 195, -91, -91, 214, 677 19, 20, 91, 92, 21, 22, 23, 24, 25, 26,
699 197, 214, 31, -91, 139, 208, -91, -91, 220, 224, 678 27, 28, 29, 30, 31, 86, 87, 32, 2, 91,
700 214, 222, -91, -91, 226, -91, 227, 123, -91, -91, 679 92, 192, 91, 92, -4, 12, 33, 88, 13, 14,
701 -91, -91, 235, 37, -91, -91, -91, -91, -91 680 15, 16, 17, 18, 19, 20, 100, 203, 21, 22,
681 23, 24, 25, 26, 27, 28, 29, 30, 31, 101,
682 158, 32, 159, 160, 169, 165, 166, -87, 102, 170,
683 33, -87, -87, -87, -87, -87, -87, -87, -87, 171,
684 174, -87, -87, 104, -87, -87, -87, -87, -87, -87,
685 -87, -87, 102, 175, 112, -78, -78, -78, -78, -78,
686 -78, -78, -78, 146, 92, -78, -78, 104, 179, 13,
687 14, 15, 16, 17, 18, 19, 20, 187, 112, 21,
688 22, 178, 189, 180, 181, 182, 183, 146, 193, 194,
689 195, 196, 188, 200, 190, 94, 95, 96, 97, 98,
690 198, 33, 54, 201, 197, 99, 202, 52, 127, 76,
691 139, 173
702}; 692};
703 693
704/* YYPGOTO[NTERM-NUM]. */ 694static const yytype_uint8 yycheck[] =
705static const yytype_int16 yypgoto[] =
706{ 695{
707 -91, -91, 264, 268, -91, 30, -65, -91, -91, -91, 696 1, 68, 69, 94, 95, 96, 97, 98, 99, 24,
708 -91, 238, -91, -91, -91, -91, -91, -91, -91, -12, 697 10, 77, 13, 77, 15, 0, 82, 18, 82, 110,
709 -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, 698 3, 36, 3, 36, 91, 92, 34, 0, 1, 37,
710 -91, -5, -91, -91, -91, -91, -91, 200, 209, -61, 699 38, 4, 5, 6, 7, 8, 9, 10, 11, 12,
711 -91, -91, 170, -1, 65, 0, 118, -66, -90, -91 700 107, 14, 15, 16, 17, 18, 19, 20, 21, 22,
701 23, 24, 25, 36, 27, 36, 5, 6, 27, 8,
702 9, 10, 11, 36, 36, 14, 15, 36, 27, 28,
703 70, 27, 28, 139, 36, 139, 167, 27, 14, 35,
704 79, 1, 81, 36, 40, 5, 6, 36, 8, 9,
705 10, 11, 12, 160, 14, 15, 16, 17, 18, 19,
706 20, 37, 38, 79, 105, 81, 27, 27, 175, 27,
707 78, 79, 36, 81, 27, 28, 36, 0, 1, 1,
708 121, 4, 5, 6, 7, 8, 9, 10, 11, 12,
709 1, 14, 15, 16, 17, 18, 19, 20, 21, 22,
710 23, 24, 25, 36, 27, 78, 79, 36, 81, 36,
711 0, 1, 36, 36, 4, 5, 6, 7, 8, 9,
712 10, 11, 37, 38, 14, 15, 16, 17, 18, 19,
713 20, 21, 22, 23, 24, 36, 36, 27, 36, 37,
714 38, 36, 37, 38, 0, 1, 36, 36, 4, 5,
715 6, 7, 8, 9, 10, 11, 36, 198, 14, 15,
716 16, 17, 18, 19, 20, 21, 22, 23, 24, 36,
717 36, 27, 36, 26, 1, 27, 27, 0, 1, 13,
718 36, 4, 5, 6, 7, 8, 9, 10, 11, 36,
719 27, 14, 15, 16, 17, 18, 19, 20, 21, 22,
720 23, 24, 1, 14, 27, 4, 5, 6, 7, 8,
721 9, 10, 11, 36, 38, 14, 15, 16, 36, 4,
722 5, 6, 7, 8, 9, 10, 11, 36, 27, 14,
723 15, 161, 36, 163, 164, 165, 166, 36, 36, 36,
724 36, 36, 172, 36, 174, 29, 30, 31, 32, 33,
725 39, 36, 7, 36, 184, 39, 36, 6, 77, 38,
726 80, 122
712}; 727};
713 728
714/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 729 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
715 positive, shift that token. If negative, reduce the rule which 730 symbol of state STATE-NUM. */
716 number is the opposite. If YYTABLE_NINF, syntax error. */ 731static const yytype_uint8 yystos[] =
717#define YYTABLE_NINF -86
718static const yytype_int16 yytable[] =
719{ 732{
720 10, 88, 89, 150, 151, 152, 153, 154, 155, 135, 733 0, 3, 36, 42, 43, 44, 68, 86, 27, 28,
721 54, 123, 56, 11, 58, 126, 145, 62, 164, 2, 734 84, 0, 1, 4, 5, 6, 7, 8, 9, 10,
722 146, 136, 1, 1, 148, 149, 147, -31, 101, 90, 735 11, 14, 15, 16, 17, 18, 19, 20, 21, 22,
723 91, -31, -31, -31, -31, -31, -31, -31, -31, 102, 736 23, 24, 27, 36, 45, 46, 48, 49, 50, 51,
724 162, -31, -31, 103, -31, 104, 105, 106, 107, 108, 737 57, 58, 60, 64, 66, 69, 70, 72, 74, 75,
725 -31, 109, 181, 110, 2, 52, 55, 65, 66, 172, 738 76, 85, 44, 36, 43, 86, 36, 84, 36, 84,
726 57, 182, 111, 8, 9, 67, 131, 59, 140, 92, 739 27, 90, 36, 84, 27, 27, 27, 28, 35, 40,
727 68, 61, 145, 133, 180, 142, 146, 65, 66, -5, 740 88, 89, 36, 1, 1, 52, 52, 61, 63, 67,
728 12, 90, 91, 13, 14, 15, 16, 17, 18, 19, 741 81, 73, 79, 36, 36, 36, 36, 36, 36, 88,
729 20, 71, 174, 21, 22, 23, 24, 25, 26, 27, 742 88, 37, 38, 86, 29, 30, 31, 32, 33, 39,
730 28, 29, 30, 159, 63, 31, 187, 127, 130, 64, 743 36, 36, 1, 12, 16, 18, 19, 20, 21, 22,
731 139, 2, 90, 91, 32, -33, 101, 72, 169, -33, 744 23, 25, 27, 36, 47, 53, 54, 77, 78, 80,
732 -33, -33, -33, -33, -33, -33, -33, 102, 73, -33, 745 17, 18, 19, 20, 36, 47, 62, 78, 80, 46,
733 -33, 103, -33, 104, 105, 106, 107, 108, -33, 109, 746 59, 85, 46, 60, 65, 72, 85, 24, 36, 79,
734 52, 110, 129, 134, 82, 143, 83, -4, 12, 84, 747 82, 46, 60, 71, 72, 85, 36, 47, 80, 34,
735 111, 13, 14, 15, 16, 17, 18, 19, 20, 90, 748 88, 88, 89, 89, 89, 89, 89, 89, 36, 36,
736 91, 21, 22, 23, 24, 25, 26, 27, 28, 29, 749 26, 84, 83, 84, 88, 27, 27, 89, 55, 1,
737 30, 85, 86, 31, 188, 90, 91, 87, 99, -85, 750 13, 36, 84, 83, 27, 14, 87, 88, 87, 36,
738 101, 100, 32, -85, -85, -85, -85, -85, -85, -85, 751 87, 87, 87, 87, 89, 27, 36, 36, 87, 36,
739 -85, 156, 198, -85, -85, 103, -85, -85, -85, -85, 752 87, 88, 36, 36, 36, 36, 36, 87, 39, 56,
740 -85, -85, -85, 157, 163, 110, 158, 166, 101, 167, 753 36, 36, 36, 84
741 168, 171, -52, -52, 144, -52, -52, -52, -52, 102,
742 91, -52, -52, 103, 118, 119, 120, 121, 172, 176,
743 183, 101, 185, 110, -76, -76, -76, -76, -76, -76,
744 -76, -76, 122, 189, -76, -76, 103, 13, 14, 15,
745 16, 17, 18, 19, 20, 190, 110, 21, 22, 191,
746 193, 195, 196, 14, 15, 144, 17, 18, 19, 20,
747 197, 53, 21, 22, 51, 75, 125, 175, 32, 177,
748 178, 179, 93, 94, 95, 96, 97, 184, 137, 186,
749 170, 0, 98, 32, 0, 0, 0, 0, 192
750}; 754};
751 755
752#define yypact_value_is_default(yystate) \ 756 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
753 ((yystate) == (-91)) 757static const yytype_uint8 yyr1[] =
754
755#define yytable_value_is_error(yytable_value) \
756 YYID (0)
757
758static const yytype_int16 yycheck[] =
759{ 758{
760 1, 67, 68, 93, 94, 95, 96, 97, 98, 23, 759 0, 41, 42, 42, 43, 43, 44, 44, 44, 44,
761 10, 76, 13, 0, 15, 76, 81, 18, 108, 35, 760 44, 44, 44, 44, 45, 45, 45, 45, 45, 45,
762 81, 35, 3, 3, 90, 91, 33, 0, 1, 36, 761 45, 45, 45, 46, 46, 46, 46, 46, 46, 47,
763 37, 4, 5, 6, 7, 8, 9, 10, 11, 12, 762 47, 48, 49, 50, 51, 52, 52, 52, 52, 52,
764 106, 14, 15, 16, 17, 18, 19, 20, 21, 22, 763 52, 52, 53, 53, 53, 53, 53, 53, 54, 55,
765 23, 24, 26, 26, 35, 35, 35, 26, 27, 14, 764 55, 56, 56, 57, 58, 59, 60, 61, 61, 61,
766 35, 35, 35, 26, 27, 34, 78, 26, 80, 69, 765 61, 61, 61, 62, 62, 62, 62, 63, 63, 64,
767 39, 35, 137, 78, 164, 80, 137, 26, 27, 0, 766 65, 66, 67, 67, 67, 67, 68, 69, 70, 71,
768 1, 36, 37, 4, 5, 6, 7, 8, 9, 10, 767 72, 73, 73, 73, 73, 74, 75, 76, 77, 78,
769 11, 35, 158, 14, 15, 16, 17, 18, 19, 20, 768 79, 79, 79, 79, 80, 81, 81, 81, 82, 83,
770 21, 22, 23, 104, 26, 26, 172, 77, 78, 26, 769 83, 84, 84, 85, 85, 85, 86, 86, 87, 87,
771 80, 35, 36, 37, 35, 0, 1, 1, 119, 4, 770 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
772 5, 6, 7, 8, 9, 10, 11, 12, 1, 14, 771 88, 89, 89, 90, 90
773 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
774 35, 26, 77, 78, 35, 80, 35, 0, 1, 35,
775 35, 4, 5, 6, 7, 8, 9, 10, 11, 36,
776 37, 14, 15, 16, 17, 18, 19, 20, 21, 22,
777 23, 35, 35, 26, 35, 36, 37, 35, 35, 0,
778 1, 35, 35, 4, 5, 6, 7, 8, 9, 10,
779 11, 35, 193, 14, 15, 16, 17, 18, 19, 20,
780 21, 22, 23, 35, 26, 26, 25, 1, 1, 13,
781 35, 26, 5, 6, 35, 8, 9, 10, 11, 12,
782 37, 14, 15, 16, 17, 18, 19, 20, 14, 35,
783 35, 1, 35, 26, 4, 5, 6, 7, 8, 9,
784 10, 11, 35, 35, 14, 15, 16, 4, 5, 6,
785 7, 8, 9, 10, 11, 35, 26, 14, 15, 35,
786 38, 35, 35, 5, 6, 35, 8, 9, 10, 11,
787 35, 7, 14, 15, 6, 37, 76, 159, 35, 161,
788 162, 163, 28, 29, 30, 31, 32, 169, 79, 171,
789 120, -1, 38, 35, -1, -1, -1, -1, 180
790}; 772};
791 773
792/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 774 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
793 symbol of state STATE-NUM. */ 775static const yytype_uint8 yyr2[] =
794static const yytype_uint8 yystos[] =
795{ 776{
796 0, 3, 35, 41, 42, 43, 67, 85, 26, 27, 777 0, 2, 2, 1, 2, 1, 0, 2, 2, 2,
797 83, 0, 1, 4, 5, 6, 7, 8, 9, 10, 778 2, 4, 4, 3, 1, 1, 1, 1, 1, 1,
798 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 779 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
799 23, 26, 35, 44, 45, 47, 48, 49, 50, 56, 780 2, 3, 2, 3, 2, 0, 2, 2, 2, 2,
800 57, 59, 63, 65, 68, 69, 71, 73, 74, 75, 781 2, 2, 3, 4, 4, 4, 4, 5, 3, 0,
801 84, 43, 35, 42, 85, 35, 83, 35, 83, 26, 782 3, 0, 2, 3, 2, 1, 3, 0, 2, 2,
802 89, 35, 83, 26, 26, 26, 27, 34, 39, 87, 783 2, 2, 2, 4, 3, 2, 4, 0, 2, 3,
803 88, 35, 1, 1, 51, 51, 60, 62, 66, 80, 784 1, 3, 0, 2, 2, 2, 3, 3, 3, 1,
804 72, 78, 35, 35, 35, 35, 35, 35, 87, 87, 785 3, 0, 2, 2, 2, 3, 3, 2, 2, 2,
805 36, 37, 85, 28, 29, 30, 31, 32, 38, 35, 786 0, 2, 2, 2, 4, 0, 2, 2, 2, 0,
806 35, 1, 12, 16, 18, 19, 20, 21, 22, 24, 787 2, 1, 1, 2, 2, 2, 1, 2, 0, 2,
807 26, 35, 46, 52, 53, 76, 77, 79, 17, 18, 788 1, 3, 3, 3, 3, 3, 3, 3, 2, 3,
808 19, 20, 35, 46, 61, 77, 79, 45, 58, 84, 789 3, 1, 1, 0, 1
809 45, 59, 64, 71, 84, 23, 35, 78, 81, 45,
810 59, 70, 71, 84, 35, 46, 79, 33, 87, 87,
811 88, 88, 88, 88, 88, 88, 35, 35, 25, 83,
812 82, 83, 87, 26, 88, 54, 1, 13, 35, 83,
813 82, 26, 14, 86, 87, 86, 35, 86, 86, 86,
814 88, 26, 35, 35, 86, 35, 86, 87, 35, 35,
815 35, 35, 86, 38, 55, 35, 35, 35, 83
816}; 790};
817 791
818#define yyerrok (yyerrstatus = 0) 792
819#define yyclearin (yychar = YYEMPTY) 793#define yyerrok (yyerrstatus = 0)
820#define YYEMPTY (-2) 794#define yyclearin (yychar = YYEMPTY)
821#define YYEOF 0 795#define YYEMPTY (-2)
822 796#define YYEOF 0
823#define YYACCEPT goto yyacceptlab 797
824#define YYABORT goto yyabortlab 798#define YYACCEPT goto yyacceptlab
825#define YYERROR goto yyerrorlab 799#define YYABORT goto yyabortlab
826 800#define YYERROR goto yyerrorlab
827 801
828/* Like YYERROR except do call yyerror. This remains here temporarily
829 to ease the transition to the new meaning of YYERROR, for GCC.
830 Once GCC version 2 has supplanted version 1, this can go. However,
831 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
832 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
833 discussed. */
834
835#define YYFAIL goto yyerrlab
836#if defined YYFAIL
837 /* This is here to suppress warnings from the GCC cpp's
838 -Wunused-macros. Normally we don't worry about that warning, but
839 some users do, and we want to make it easy for users to remove
840 YYFAIL uses, which will produce warnings from Bison 2.5. */
841#endif
842 802
843#define YYRECOVERING() (!!yyerrstatus) 803#define YYRECOVERING() (!!yyerrstatus)
844 804
@@ -855,55 +815,15 @@ do \
855 else \ 815 else \
856 { \ 816 { \
857 yyerror (YY_("syntax error: cannot back up")); \ 817 yyerror (YY_("syntax error: cannot back up")); \
858 YYERROR; \ 818 YYERROR; \
859 } \ 819 } \
860while (YYID (0)) 820while (0)
861
862
863#define YYTERROR 1
864#define YYERRCODE 256
865
866
867/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
868 If N is 0, then set CURRENT to the empty location which ends
869 the previous symbol: RHS[0] (always defined). */
870
871#define YYRHSLOC(Rhs, K) ((Rhs)[K])
872#ifndef YYLLOC_DEFAULT
873# define YYLLOC_DEFAULT(Current, Rhs, N) \
874 do \
875 if (YYID (N)) \
876 { \
877 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
878 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
879 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
880 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
881 } \
882 else \
883 { \
884 (Current).first_line = (Current).last_line = \
885 YYRHSLOC (Rhs, 0).last_line; \
886 (Current).first_column = (Current).last_column = \
887 YYRHSLOC (Rhs, 0).last_column; \
888 } \
889 while (YYID (0))
890#endif
891
892
893/* This macro is provided for backward compatibility. */
894
895#ifndef YY_LOCATION_PRINT
896# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
897#endif
898 821
822/* Error token number */
823#define YYTERROR 1
824#define YYERRCODE 256
899 825
900/* YYLEX -- calling `yylex' with the right arguments. */
901 826
902#ifdef YYLEX_PARAM
903# define YYLEX yylex (YYLEX_PARAM)
904#else
905# define YYLEX yylex ()
906#endif
907 827
908/* Enable debugging if requested. */ 828/* Enable debugging if requested. */
909#if YYDEBUG 829#if YYDEBUG
@@ -913,40 +833,36 @@ while (YYID (0))
913# define YYFPRINTF fprintf 833# define YYFPRINTF fprintf
914# endif 834# endif
915 835
916# define YYDPRINTF(Args) \ 836# define YYDPRINTF(Args) \
917do { \ 837do { \
918 if (yydebug) \ 838 if (yydebug) \
919 YYFPRINTF Args; \ 839 YYFPRINTF Args; \
920} while (YYID (0)) 840} while (0)
841
842/* This macro is provided for backward compatibility. */
843#ifndef YY_LOCATION_PRINT
844# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
845#endif
846
921 847
922# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 848# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
923do { \ 849do { \
924 if (yydebug) \ 850 if (yydebug) \
925 { \ 851 { \
926 YYFPRINTF (stderr, "%s ", Title); \ 852 YYFPRINTF (stderr, "%s ", Title); \
927 yy_symbol_print (stderr, \ 853 yy_symbol_print (stderr, \
928 Type, Value); \ 854 Type, Value); \
929 YYFPRINTF (stderr, "\n"); \ 855 YYFPRINTF (stderr, "\n"); \
930 } \ 856 } \
931} while (YYID (0)) 857} while (0)
932 858
933 859
934/*--------------------------------. 860/*----------------------------------------.
935| Print this symbol on YYOUTPUT. | 861| Print this symbol's value on YYOUTPUT. |
936`--------------------------------*/ 862`----------------------------------------*/
937 863
938/*ARGSUSED*/
939#if (defined __STDC__ || defined __C99__FUNC__ \
940 || defined __cplusplus || defined _MSC_VER)
941static void 864static void
942yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 865yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
943#else
944static void
945yy_symbol_value_print (yyoutput, yytype, yyvaluep)
946 FILE *yyoutput;
947 int yytype;
948 YYSTYPE const * const yyvaluep;
949#endif
950{ 866{
951 FILE *yyo = yyoutput; 867 FILE *yyo = yyoutput;
952 YYUSE (yyo); 868 YYUSE (yyo);
@@ -955,14 +871,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
955# ifdef YYPRINT 871# ifdef YYPRINT
956 if (yytype < YYNTOKENS) 872 if (yytype < YYNTOKENS)
957 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 873 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
958# else
959 YYUSE (yyoutput);
960# endif 874# endif
961 switch (yytype) 875 YYUSE (yytype);
962 {
963 default:
964 break;
965 }
966} 876}
967 877
968 878
@@ -970,22 +880,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
970| Print this symbol on YYOUTPUT. | 880| Print this symbol on YYOUTPUT. |
971`--------------------------------*/ 881`--------------------------------*/
972 882
973#if (defined __STDC__ || defined __C99__FUNC__ \
974 || defined __cplusplus || defined _MSC_VER)
975static void 883static void
976yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 884yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
977#else
978static void
979yy_symbol_print (yyoutput, yytype, yyvaluep)
980 FILE *yyoutput;
981 int yytype;
982 YYSTYPE const * const yyvaluep;
983#endif
984{ 885{
985 if (yytype < YYNTOKENS) 886 YYFPRINTF (yyoutput, "%s %s (",
986 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 887 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
987 else
988 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
989 888
990 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 889 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
991 YYFPRINTF (yyoutput, ")"); 890 YYFPRINTF (yyoutput, ")");
@@ -996,16 +895,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
996| TOP (included). | 895| TOP (included). |
997`------------------------------------------------------------------*/ 896`------------------------------------------------------------------*/
998 897
999#if (defined __STDC__ || defined __C99__FUNC__ \
1000 || defined __cplusplus || defined _MSC_VER)
1001static void 898static void
1002yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 899yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1003#else
1004static void
1005yy_stack_print (yybottom, yytop)
1006 yytype_int16 *yybottom;
1007 yytype_int16 *yytop;
1008#endif
1009{ 900{
1010 YYFPRINTF (stderr, "Stack now"); 901 YYFPRINTF (stderr, "Stack now");
1011 for (; yybottom <= yytop; yybottom++) 902 for (; yybottom <= yytop; yybottom++)
@@ -1016,49 +907,42 @@ yy_stack_print (yybottom, yytop)
1016 YYFPRINTF (stderr, "\n"); 907 YYFPRINTF (stderr, "\n");
1017} 908}
1018 909
1019# define YY_STACK_PRINT(Bottom, Top) \ 910# define YY_STACK_PRINT(Bottom, Top) \
1020do { \ 911do { \
1021 if (yydebug) \ 912 if (yydebug) \
1022 yy_stack_print ((Bottom), (Top)); \ 913 yy_stack_print ((Bottom), (Top)); \
1023} while (YYID (0)) 914} while (0)
1024 915
1025 916
1026/*------------------------------------------------. 917/*------------------------------------------------.
1027| Report that the YYRULE is going to be reduced. | 918| Report that the YYRULE is going to be reduced. |
1028`------------------------------------------------*/ 919`------------------------------------------------*/
1029 920
1030#if (defined __STDC__ || defined __C99__FUNC__ \
1031 || defined __cplusplus || defined _MSC_VER)
1032static void 921static void
1033yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 922yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
1034#else
1035static void
1036yy_reduce_print (yyvsp, yyrule)
1037 YYSTYPE *yyvsp;
1038 int yyrule;
1039#endif
1040{ 923{
924 unsigned long int yylno = yyrline[yyrule];
1041 int yynrhs = yyr2[yyrule]; 925 int yynrhs = yyr2[yyrule];
1042 int yyi; 926 int yyi;
1043 unsigned long int yylno = yyrline[yyrule];
1044 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 927 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1045 yyrule - 1, yylno); 928 yyrule - 1, yylno);
1046 /* The symbols being reduced. */ 929 /* The symbols being reduced. */
1047 for (yyi = 0; yyi < yynrhs; yyi++) 930 for (yyi = 0; yyi < yynrhs; yyi++)
1048 { 931 {
1049 YYFPRINTF (stderr, " $%d = ", yyi + 1); 932 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1050 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 933 yy_symbol_print (stderr,
1051 &(yyvsp[(yyi + 1) - (yynrhs)]) 934 yystos[yyssp[yyi + 1 - yynrhs]],
1052 ); 935 &(yyvsp[(yyi + 1) - (yynrhs)])
936 );
1053 YYFPRINTF (stderr, "\n"); 937 YYFPRINTF (stderr, "\n");
1054 } 938 }
1055} 939}
1056 940
1057# define YY_REDUCE_PRINT(Rule) \ 941# define YY_REDUCE_PRINT(Rule) \
1058do { \ 942do { \
1059 if (yydebug) \ 943 if (yydebug) \
1060 yy_reduce_print (yyvsp, Rule); \ 944 yy_reduce_print (yyssp, yyvsp, Rule); \
1061} while (YYID (0)) 945} while (0)
1062 946
1063/* Nonzero means print parse trace. It is left uninitialized so that 947/* Nonzero means print parse trace. It is left uninitialized so that
1064 multiple parsers can coexist. */ 948 multiple parsers can coexist. */
@@ -1072,7 +956,7 @@ int yydebug;
1072 956
1073 957
1074/* YYINITDEPTH -- initial size of the parser's stacks. */ 958/* YYINITDEPTH -- initial size of the parser's stacks. */
1075#ifndef YYINITDEPTH 959#ifndef YYINITDEPTH
1076# define YYINITDEPTH 200 960# define YYINITDEPTH 200
1077#endif 961#endif
1078 962
@@ -1095,15 +979,8 @@ int yydebug;
1095# define yystrlen strlen 979# define yystrlen strlen
1096# else 980# else
1097/* Return the length of YYSTR. */ 981/* Return the length of YYSTR. */
1098#if (defined __STDC__ || defined __C99__FUNC__ \
1099 || defined __cplusplus || defined _MSC_VER)
1100static YYSIZE_T 982static YYSIZE_T
1101yystrlen (const char *yystr) 983yystrlen (const char *yystr)
1102#else
1103static YYSIZE_T
1104yystrlen (yystr)
1105 const char *yystr;
1106#endif
1107{ 984{
1108 YYSIZE_T yylen; 985 YYSIZE_T yylen;
1109 for (yylen = 0; yystr[yylen]; yylen++) 986 for (yylen = 0; yystr[yylen]; yylen++)
@@ -1119,16 +996,8 @@ yystrlen (yystr)
1119# else 996# else
1120/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 997/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1121 YYDEST. */ 998 YYDEST. */
1122#if (defined __STDC__ || defined __C99__FUNC__ \
1123 || defined __cplusplus || defined _MSC_VER)
1124static char * 999static char *
1125yystpcpy (char *yydest, const char *yysrc) 1000yystpcpy (char *yydest, const char *yysrc)
1126#else
1127static char *
1128yystpcpy (yydest, yysrc)
1129 char *yydest;
1130 const char *yysrc;
1131#endif
1132{ 1001{
1133 char *yyd = yydest; 1002 char *yyd = yydest;
1134 const char *yys = yysrc; 1003 const char *yys = yysrc;
@@ -1158,27 +1027,27 @@ yytnamerr (char *yyres, const char *yystr)
1158 char const *yyp = yystr; 1027 char const *yyp = yystr;
1159 1028
1160 for (;;) 1029 for (;;)
1161 switch (*++yyp) 1030 switch (*++yyp)
1162 { 1031 {
1163 case '\'': 1032 case '\'':
1164 case ',': 1033 case ',':
1165 goto do_not_strip_quotes; 1034 goto do_not_strip_quotes;
1166 1035
1167 case '\\': 1036 case '\\':
1168 if (*++yyp != '\\') 1037 if (*++yyp != '\\')
1169 goto do_not_strip_quotes; 1038 goto do_not_strip_quotes;
1170 /* Fall through. */ 1039 /* Fall through. */
1171 default: 1040 default:
1172 if (yyres) 1041 if (yyres)
1173 yyres[yyn] = *yyp; 1042 yyres[yyn] = *yyp;
1174 yyn++; 1043 yyn++;
1175 break; 1044 break;
1176 1045
1177 case '"': 1046 case '"':
1178 if (yyres) 1047 if (yyres)
1179 yyres[yyn] = '\0'; 1048 yyres[yyn] = '\0';
1180 return yyn; 1049 return yyn;
1181 } 1050 }
1182 do_not_strip_quotes: ; 1051 do_not_strip_quotes: ;
1183 } 1052 }
1184 1053
@@ -1201,12 +1070,11 @@ static int
1201yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 1070yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1202 yytype_int16 *yyssp, int yytoken) 1071 yytype_int16 *yyssp, int yytoken)
1203{ 1072{
1204 YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); 1073 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1205 YYSIZE_T yysize = yysize0; 1074 YYSIZE_T yysize = yysize0;
1206 YYSIZE_T yysize1;
1207 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1075 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1208 /* Internationalized format string. */ 1076 /* Internationalized format string. */
1209 const char *yyformat = YY_NULL; 1077 const char *yyformat = YY_NULLPTR;
1210 /* Arguments of yyformat. */ 1078 /* Arguments of yyformat. */
1211 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1079 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1212 /* Number of reported tokens (one for the "unexpected", one per 1080 /* Number of reported tokens (one for the "unexpected", one per
@@ -1214,10 +1082,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1214 int yycount = 0; 1082 int yycount = 0;
1215 1083
1216 /* There are many possibilities here to consider: 1084 /* There are many possibilities here to consider:
1217 - Assume YYFAIL is not used. It's too flawed to consider. See
1218 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1219 for details. YYERROR is fine as it does not invoke this
1220 function.
1221 - If this state is a consistent state with a default action, then 1085 - If this state is a consistent state with a default action, then
1222 the only way this function was invoked is if the default action 1086 the only way this function was invoked is if the default action
1223 is an error action. In that case, don't check for expected 1087 is an error action. In that case, don't check for expected
@@ -1266,11 +1130,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1266 break; 1130 break;
1267 } 1131 }
1268 yyarg[yycount++] = yytname[yyx]; 1132 yyarg[yycount++] = yytname[yyx];
1269 yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); 1133 {
1270 if (! (yysize <= yysize1 1134 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1271 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1135 if (! (yysize <= yysize1
1272 return 2; 1136 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1273 yysize = yysize1; 1137 return 2;
1138 yysize = yysize1;
1139 }
1274 } 1140 }
1275 } 1141 }
1276 } 1142 }
@@ -1290,10 +1156,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1290# undef YYCASE_ 1156# undef YYCASE_
1291 } 1157 }
1292 1158
1293 yysize1 = yysize + yystrlen (yyformat); 1159 {
1294 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1160 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1295 return 2; 1161 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1296 yysize = yysize1; 1162 return 2;
1163 yysize = yysize1;
1164 }
1297 1165
1298 if (*yymsg_alloc < yysize) 1166 if (*yymsg_alloc < yysize)
1299 { 1167 {
@@ -1330,78 +1198,58 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1330| Release the memory associated to this symbol. | 1198| Release the memory associated to this symbol. |
1331`-----------------------------------------------*/ 1199`-----------------------------------------------*/
1332 1200
1333/*ARGSUSED*/
1334#if (defined __STDC__ || defined __C99__FUNC__ \
1335 || defined __cplusplus || defined _MSC_VER)
1336static void 1201static void
1337yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1202yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1338#else
1339static void
1340yydestruct (yymsg, yytype, yyvaluep)
1341 const char *yymsg;
1342 int yytype;
1343 YYSTYPE *yyvaluep;
1344#endif
1345{ 1203{
1346 YYUSE (yyvaluep); 1204 YYUSE (yyvaluep);
1347
1348 if (!yymsg) 1205 if (!yymsg)
1349 yymsg = "Deleting"; 1206 yymsg = "Deleting";
1350 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1207 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1351 1208
1209 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1352 switch (yytype) 1210 switch (yytype)
1353 { 1211 {
1354 case 57: /* "choice_entry" */ 1212 case 58: /* choice_entry */
1355 1213
1356 { 1214 {
1357 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1215 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1358 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); 1216 ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
1359 if (current_menu == (yyvaluep->menu)) 1217 if (current_menu == ((*yyvaluep).menu))
1360 menu_end_menu(); 1218 menu_end_menu();
1361}; 1219}
1220
1221 break;
1362 1222
1363 break; 1223 case 64: /* if_entry */
1364 case 63: /* "if_entry" */
1365 1224
1366 { 1225 {
1367 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1226 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1368 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); 1227 ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
1369 if (current_menu == (yyvaluep->menu)) 1228 if (current_menu == ((*yyvaluep).menu))
1370 menu_end_menu(); 1229 menu_end_menu();
1371}; 1230}
1372 1231
1373 break; 1232 break;
1374 case 69: /* "menu_entry" */
1375 1233
1376 { 1234 case 70: /* menu_entry */
1235
1236 {
1377 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1237 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1378 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno); 1238 ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
1379 if (current_menu == (yyvaluep->menu)) 1239 if (current_menu == ((*yyvaluep).menu))
1380 menu_end_menu(); 1240 menu_end_menu();
1381}; 1241}
1242
1243 break;
1382 1244
1383 break;
1384 1245
1385 default: 1246 default:
1386 break; 1247 break;
1387 } 1248 }
1249 YY_IGNORE_MAYBE_UNINITIALIZED_END
1388} 1250}
1389 1251
1390 1252
1391/* Prevent warnings from -Wmissing-prototypes. */
1392#ifdef YYPARSE_PARAM
1393#if defined __STDC__ || defined __cplusplus
1394int yyparse (void *YYPARSE_PARAM);
1395#else
1396int yyparse ();
1397#endif
1398#else /* ! YYPARSE_PARAM */
1399#if defined __STDC__ || defined __cplusplus
1400int yyparse (void);
1401#else
1402int yyparse ();
1403#endif
1404#endif /* ! YYPARSE_PARAM */
1405 1253
1406 1254
1407/* The lookahead symbol. */ 1255/* The lookahead symbol. */
@@ -1409,7 +1257,6 @@ int yychar;
1409 1257
1410/* The semantic value of the lookahead symbol. */ 1258/* The semantic value of the lookahead symbol. */
1411YYSTYPE yylval; 1259YYSTYPE yylval;
1412
1413/* Number of syntax errors so far. */ 1260/* Number of syntax errors so far. */
1414int yynerrs; 1261int yynerrs;
1415 1262
@@ -1418,35 +1265,16 @@ int yynerrs;
1418| yyparse. | 1265| yyparse. |
1419`----------*/ 1266`----------*/
1420 1267
1421#ifdef YYPARSE_PARAM
1422#if (defined __STDC__ || defined __C99__FUNC__ \
1423 || defined __cplusplus || defined _MSC_VER)
1424int
1425yyparse (void *YYPARSE_PARAM)
1426#else
1427int
1428yyparse (YYPARSE_PARAM)
1429 void *YYPARSE_PARAM;
1430#endif
1431#else /* ! YYPARSE_PARAM */
1432#if (defined __STDC__ || defined __C99__FUNC__ \
1433 || defined __cplusplus || defined _MSC_VER)
1434int 1268int
1435yyparse (void) 1269yyparse (void)
1436#else
1437int
1438yyparse ()
1439
1440#endif
1441#endif
1442{ 1270{
1443 int yystate; 1271 int yystate;
1444 /* Number of tokens to shift before error messages enabled. */ 1272 /* Number of tokens to shift before error messages enabled. */
1445 int yyerrstatus; 1273 int yyerrstatus;
1446 1274
1447 /* The stacks and their tools: 1275 /* The stacks and their tools:
1448 `yyss': related to states. 1276 'yyss': related to states.
1449 `yyvs': related to semantic values. 1277 'yyvs': related to semantic values.
1450 1278
1451 Refer to the stacks through separate pointers, to allow yyoverflow 1279 Refer to the stacks through separate pointers, to allow yyoverflow
1452 to reallocate them elsewhere. */ 1280 to reallocate them elsewhere. */
@@ -1466,7 +1294,7 @@ yyparse ()
1466 int yyn; 1294 int yyn;
1467 int yyresult; 1295 int yyresult;
1468 /* Lookahead token as an internal (translated) token number. */ 1296 /* Lookahead token as an internal (translated) token number. */
1469 int yytoken; 1297 int yytoken = 0;
1470 /* The variables used to return semantic value and location from the 1298 /* The variables used to return semantic value and location from the
1471 action routines. */ 1299 action routines. */
1472 YYSTYPE yyval; 1300 YYSTYPE yyval;
@@ -1484,9 +1312,8 @@ yyparse ()
1484 Keep to zero when no symbol should be popped. */ 1312 Keep to zero when no symbol should be popped. */
1485 int yylen = 0; 1313 int yylen = 0;
1486 1314
1487 yytoken = 0; 1315 yyssp = yyss = yyssa;
1488 yyss = yyssa; 1316 yyvsp = yyvs = yyvsa;
1489 yyvs = yyvsa;
1490 yystacksize = YYINITDEPTH; 1317 yystacksize = YYINITDEPTH;
1491 1318
1492 YYDPRINTF ((stderr, "Starting parse\n")); 1319 YYDPRINTF ((stderr, "Starting parse\n"));
@@ -1495,14 +1322,6 @@ yyparse ()
1495 yyerrstatus = 0; 1322 yyerrstatus = 0;
1496 yynerrs = 0; 1323 yynerrs = 0;
1497 yychar = YYEMPTY; /* Cause a token to be read. */ 1324 yychar = YYEMPTY; /* Cause a token to be read. */
1498
1499 /* Initialize stack pointers.
1500 Waste one element of value and location stack
1501 so that they stay on the same level as the state stack.
1502 The wasted elements are never initialized. */
1503 yyssp = yyss;
1504 yyvsp = yyvs;
1505
1506 goto yysetstate; 1325 goto yysetstate;
1507 1326
1508/*------------------------------------------------------------. 1327/*------------------------------------------------------------.
@@ -1523,23 +1342,23 @@ yyparse ()
1523 1342
1524#ifdef yyoverflow 1343#ifdef yyoverflow
1525 { 1344 {
1526 /* Give user a chance to reallocate the stack. Use copies of 1345 /* Give user a chance to reallocate the stack. Use copies of
1527 these so that the &'s don't force the real ones into 1346 these so that the &'s don't force the real ones into
1528 memory. */ 1347 memory. */
1529 YYSTYPE *yyvs1 = yyvs; 1348 YYSTYPE *yyvs1 = yyvs;
1530 yytype_int16 *yyss1 = yyss; 1349 yytype_int16 *yyss1 = yyss;
1531 1350
1532 /* Each stack pointer address is followed by the size of the 1351 /* Each stack pointer address is followed by the size of the
1533 data in use in that stack, in bytes. This used to be a 1352 data in use in that stack, in bytes. This used to be a
1534 conditional around just the two extra args, but that might 1353 conditional around just the two extra args, but that might
1535 be undefined if yyoverflow is a macro. */ 1354 be undefined if yyoverflow is a macro. */
1536 yyoverflow (YY_("memory exhausted"), 1355 yyoverflow (YY_("memory exhausted"),
1537 &yyss1, yysize * sizeof (*yyssp), 1356 &yyss1, yysize * sizeof (*yyssp),
1538 &yyvs1, yysize * sizeof (*yyvsp), 1357 &yyvs1, yysize * sizeof (*yyvsp),
1539 &yystacksize); 1358 &yystacksize);
1540 1359
1541 yyss = yyss1; 1360 yyss = yyss1;
1542 yyvs = yyvs1; 1361 yyvs = yyvs1;
1543 } 1362 }
1544#else /* no yyoverflow */ 1363#else /* no yyoverflow */
1545# ifndef YYSTACK_RELOCATE 1364# ifndef YYSTACK_RELOCATE
@@ -1547,22 +1366,22 @@ yyparse ()
1547# else 1366# else
1548 /* Extend the stack our own way. */ 1367 /* Extend the stack our own way. */
1549 if (YYMAXDEPTH <= yystacksize) 1368 if (YYMAXDEPTH <= yystacksize)
1550 goto yyexhaustedlab; 1369 goto yyexhaustedlab;
1551 yystacksize *= 2; 1370 yystacksize *= 2;
1552 if (YYMAXDEPTH < yystacksize) 1371 if (YYMAXDEPTH < yystacksize)
1553 yystacksize = YYMAXDEPTH; 1372 yystacksize = YYMAXDEPTH;
1554 1373
1555 { 1374 {
1556 yytype_int16 *yyss1 = yyss; 1375 yytype_int16 *yyss1 = yyss;
1557 union yyalloc *yyptr = 1376 union yyalloc *yyptr =
1558 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1377 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1559 if (! yyptr) 1378 if (! yyptr)
1560 goto yyexhaustedlab; 1379 goto yyexhaustedlab;
1561 YYSTACK_RELOCATE (yyss_alloc, yyss); 1380 YYSTACK_RELOCATE (yyss_alloc, yyss);
1562 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1381 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1563# undef YYSTACK_RELOCATE 1382# undef YYSTACK_RELOCATE
1564 if (yyss1 != yyssa) 1383 if (yyss1 != yyssa)
1565 YYSTACK_FREE (yyss1); 1384 YYSTACK_FREE (yyss1);
1566 } 1385 }
1567# endif 1386# endif
1568#endif /* no yyoverflow */ 1387#endif /* no yyoverflow */
@@ -1571,10 +1390,10 @@ yyparse ()
1571 yyvsp = yyvs + yysize - 1; 1390 yyvsp = yyvs + yysize - 1;
1572 1391
1573 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1392 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1574 (unsigned long int) yystacksize)); 1393 (unsigned long int) yystacksize));
1575 1394
1576 if (yyss + yystacksize - 1 <= yyssp) 1395 if (yyss + yystacksize - 1 <= yyssp)
1577 YYABORT; 1396 YYABORT;
1578 } 1397 }
1579 1398
1580 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1399 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1603,7 +1422,7 @@ yybackup:
1603 if (yychar == YYEMPTY) 1422 if (yychar == YYEMPTY)
1604 { 1423 {
1605 YYDPRINTF ((stderr, "Reading a token: ")); 1424 YYDPRINTF ((stderr, "Reading a token: "));
1606 yychar = YYLEX; 1425 yychar = yylex ();
1607 } 1426 }
1608 1427
1609 if (yychar <= YYEOF) 1428 if (yychar <= YYEOF)
@@ -1643,7 +1462,9 @@ yybackup:
1643 yychar = YYEMPTY; 1462 yychar = YYEMPTY;
1644 1463
1645 yystate = yyn; 1464 yystate = yyn;
1465 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1646 *++yyvsp = yylval; 1466 *++yyvsp = yylval;
1467 YY_IGNORE_MAYBE_UNINITIALIZED_END
1647 1468
1648 goto yynewstate; 1469 goto yynewstate;
1649 1470
@@ -1666,7 +1487,7 @@ yyreduce:
1666 yylen = yyr2[yyn]; 1487 yylen = yyr2[yyn];
1667 1488
1668 /* If YYLEN is nonzero, implement the default value of the action: 1489 /* If YYLEN is nonzero, implement the default value of the action:
1669 `$$ = $1'. 1490 '$$ = $1'.
1670 1491
1671 Otherwise, the following line sets YYVAL to garbage. 1492 Otherwise, the following line sets YYVAL to garbage.
1672 This behavior is undocumented and Bison 1493 This behavior is undocumented and Bison
@@ -1682,64 +1503,73 @@ yyreduce:
1682 case 10: 1503 case 10:
1683 1504
1684 { zconf_error("unexpected end statement"); } 1505 { zconf_error("unexpected end statement"); }
1506
1685 break; 1507 break;
1686 1508
1687 case 11: 1509 case 11:
1688 1510
1689 { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); } 1511 { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); }
1512
1690 break; 1513 break;
1691 1514
1692 case 12: 1515 case 12:
1693 1516
1694 { 1517 {
1695 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name); 1518 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[-2].id)->name);
1696} 1519}
1520
1697 break; 1521 break;
1698 1522
1699 case 13: 1523 case 13:
1700 1524
1701 { zconf_error("invalid statement"); } 1525 { zconf_error("invalid statement"); }
1526
1702 break; 1527 break;
1703 1528
1704 case 28: 1529 case 29:
1530
1531 { zconf_error("unknown option \"%s\"", (yyvsp[-2].string)); }
1705 1532
1706 { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); }
1707 break; 1533 break;
1708 1534
1709 case 29: 1535 case 30:
1710 1536
1711 { zconf_error("invalid option"); } 1537 { zconf_error("invalid option"); }
1538
1712 break; 1539 break;
1713 1540
1714 case 30: 1541 case 31:
1715 1542
1716 { 1543 {
1717 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); 1544 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1718 sym->flags |= SYMBOL_OPTIONAL; 1545 sym->flags |= SYMBOL_OPTIONAL;
1719 menu_add_entry(sym); 1546 menu_add_entry(sym);
1720 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); 1547 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1721} 1548}
1549
1722 break; 1550 break;
1723 1551
1724 case 31: 1552 case 32:
1725 1553
1726 { 1554 {
1727 menu_end_entry(); 1555 menu_end_entry();
1728 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); 1556 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1729} 1557}
1558
1730 break; 1559 break;
1731 1560
1732 case 32: 1561 case 33:
1733 1562
1734 { 1563 {
1735 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); 1564 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
1736 sym->flags |= SYMBOL_OPTIONAL; 1565 sym->flags |= SYMBOL_OPTIONAL;
1737 menu_add_entry(sym); 1566 menu_add_entry(sym);
1738 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); 1567 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1739} 1568}
1569
1740 break; 1570 break;
1741 1571
1742 case 33: 1572 case 34:
1743 1573
1744 { 1574 {
1745 if (current_entry->prompt) 1575 if (current_entry->prompt)
@@ -1749,352 +1579,410 @@ yyreduce:
1749 menu_end_entry(); 1579 menu_end_entry();
1750 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); 1580 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1751} 1581}
1582
1752 break; 1583 break;
1753 1584
1754 case 41: 1585 case 42:
1755 1586
1756 { 1587 {
1757 menu_set_type((yyvsp[(1) - (3)].id)->stype); 1588 menu_set_type((yyvsp[-2].id)->stype);
1758 printd(DEBUG_PARSE, "%s:%d:type(%u)\n", 1589 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1759 zconf_curname(), zconf_lineno(), 1590 zconf_curname(), zconf_lineno(),
1760 (yyvsp[(1) - (3)].id)->stype); 1591 (yyvsp[-2].id)->stype);
1761} 1592}
1593
1762 break; 1594 break;
1763 1595
1764 case 42: 1596 case 43:
1765 1597
1766 { 1598 {
1767 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); 1599 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1768 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); 1600 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1769} 1601}
1602
1770 break; 1603 break;
1771 1604
1772 case 43: 1605 case 44:
1773 1606
1774 { 1607 {
1775 menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr)); 1608 menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
1776 if ((yyvsp[(1) - (4)].id)->stype != S_UNKNOWN) 1609 if ((yyvsp[-3].id)->stype != S_UNKNOWN)
1777 menu_set_type((yyvsp[(1) - (4)].id)->stype); 1610 menu_set_type((yyvsp[-3].id)->stype);
1778 printd(DEBUG_PARSE, "%s:%d:default(%u)\n", 1611 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1779 zconf_curname(), zconf_lineno(), 1612 zconf_curname(), zconf_lineno(),
1780 (yyvsp[(1) - (4)].id)->stype); 1613 (yyvsp[-3].id)->stype);
1781} 1614}
1615
1782 break; 1616 break;
1783 1617
1784 case 44: 1618 case 45:
1785 1619
1786 { 1620 {
1787 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr)); 1621 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1788 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); 1622 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1789} 1623}
1624
1790 break; 1625 break;
1791 1626
1792 case 45: 1627 case 46:
1793 1628
1794 { 1629 {
1795 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr)); 1630 menu_add_symbol(P_IMPLY, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1631 printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
1632}
1633
1634 break;
1635
1636 case 47:
1637
1638 {
1639 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr));
1796 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); 1640 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1797} 1641}
1642
1798 break; 1643 break;
1799 1644
1800 case 48: 1645 case 50:
1801 1646
1802 { 1647 {
1803 const struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string))); 1648 const struct kconf_id *id = kconf_id_lookup((yyvsp[-1].string), strlen((yyvsp[-1].string)));
1804 if (id && id->flags & TF_OPTION) 1649 if (id && id->flags & TF_OPTION)
1805 menu_add_option(id->token, (yyvsp[(3) - (3)].string)); 1650 menu_add_option(id->token, (yyvsp[0].string));
1806 else 1651 else
1807 zconfprint("warning: ignoring unknown option %s", (yyvsp[(2) - (3)].string)); 1652 zconfprint("warning: ignoring unknown option %s", (yyvsp[-1].string));
1808 free((yyvsp[(2) - (3)].string)); 1653 free((yyvsp[-1].string));
1809} 1654}
1655
1810 break; 1656 break;
1811 1657
1812 case 49: 1658 case 51:
1813 1659
1814 { (yyval.string) = NULL; } 1660 { (yyval.string) = NULL; }
1661
1815 break; 1662 break;
1816 1663
1817 case 50: 1664 case 52:
1665
1666 { (yyval.string) = (yyvsp[0].string); }
1818 1667
1819 { (yyval.string) = (yyvsp[(2) - (2)].string); }
1820 break; 1668 break;
1821 1669
1822 case 51: 1670 case 53:
1823 1671
1824 { 1672 {
1825 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE); 1673 struct symbol *sym = sym_lookup((yyvsp[-1].string), SYMBOL_CHOICE);
1826 sym->flags |= SYMBOL_AUTO; 1674 sym->flags |= SYMBOL_AUTO;
1827 menu_add_entry(sym); 1675 menu_add_entry(sym);
1828 menu_add_expr(P_CHOICE, NULL, NULL); 1676 menu_add_expr(P_CHOICE, NULL, NULL);
1829 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); 1677 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1830} 1678}
1679
1831 break; 1680 break;
1832 1681
1833 case 52: 1682 case 54:
1834 1683
1835 { 1684 {
1836 (yyval.menu) = menu_add_menu(); 1685 (yyval.menu) = menu_add_menu();
1837} 1686}
1687
1838 break; 1688 break;
1839 1689
1840 case 53: 1690 case 55:
1841 1691
1842 { 1692 {
1843 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) { 1693 if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) {
1844 menu_end_menu(); 1694 menu_end_menu();
1845 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); 1695 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1846 } 1696 }
1847} 1697}
1698
1848 break; 1699 break;
1849 1700
1850 case 61: 1701 case 63:
1851 1702
1852 { 1703 {
1853 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); 1704 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1854 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); 1705 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1855} 1706}
1707
1856 break; 1708 break;
1857 1709
1858 case 62: 1710 case 64:
1859 1711
1860 { 1712 {
1861 if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) { 1713 if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) {
1862 menu_set_type((yyvsp[(1) - (3)].id)->stype); 1714 menu_set_type((yyvsp[-2].id)->stype);
1863 printd(DEBUG_PARSE, "%s:%d:type(%u)\n", 1715 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1864 zconf_curname(), zconf_lineno(), 1716 zconf_curname(), zconf_lineno(),
1865 (yyvsp[(1) - (3)].id)->stype); 1717 (yyvsp[-2].id)->stype);
1866 } else 1718 } else
1867 YYERROR; 1719 YYERROR;
1868} 1720}
1721
1869 break; 1722 break;
1870 1723
1871 case 63: 1724 case 65:
1872 1725
1873 { 1726 {
1874 current_entry->sym->flags |= SYMBOL_OPTIONAL; 1727 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1875 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); 1728 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1876} 1729}
1730
1877 break; 1731 break;
1878 1732
1879 case 64: 1733 case 66:
1880 1734
1881 { 1735 {
1882 if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) { 1736 if ((yyvsp[-3].id)->stype == S_UNKNOWN) {
1883 menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr)); 1737 menu_add_symbol(P_DEFAULT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
1884 printd(DEBUG_PARSE, "%s:%d:default\n", 1738 printd(DEBUG_PARSE, "%s:%d:default\n",
1885 zconf_curname(), zconf_lineno()); 1739 zconf_curname(), zconf_lineno());
1886 } else 1740 } else
1887 YYERROR; 1741 YYERROR;
1888} 1742}
1743
1889 break; 1744 break;
1890 1745
1891 case 67: 1746 case 69:
1892 1747
1893 { 1748 {
1894 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); 1749 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1895 menu_add_entry(NULL); 1750 menu_add_entry(NULL);
1896 menu_add_dep((yyvsp[(2) - (3)].expr)); 1751 menu_add_dep((yyvsp[-1].expr));
1897 (yyval.menu) = menu_add_menu(); 1752 (yyval.menu) = menu_add_menu();
1898} 1753}
1754
1899 break; 1755 break;
1900 1756
1901 case 68: 1757 case 70:
1902 1758
1903 { 1759 {
1904 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) { 1760 if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) {
1905 menu_end_menu(); 1761 menu_end_menu();
1906 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); 1762 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1907 } 1763 }
1908} 1764}
1765
1909 break; 1766 break;
1910 1767
1911 case 74: 1768 case 76:
1912 1769
1913 { 1770 {
1914 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL); 1771 menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1915} 1772}
1773
1916 break; 1774 break;
1917 1775
1918 case 75: 1776 case 77:
1919 1777
1920 { 1778 {
1921 menu_add_entry(NULL); 1779 menu_add_entry(NULL);
1922 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL); 1780 menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1923 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); 1781 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1924} 1782}
1783
1925 break; 1784 break;
1926 1785
1927 case 76: 1786 case 78:
1928 1787
1929 { 1788 {
1930 (yyval.menu) = menu_add_menu(); 1789 (yyval.menu) = menu_add_menu();
1931} 1790}
1791
1932 break; 1792 break;
1933 1793
1934 case 77: 1794 case 79:
1935 1795
1936 { 1796 {
1937 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) { 1797 if (zconf_endtoken((yyvsp[0].id), T_MENU, T_ENDMENU)) {
1938 menu_end_menu(); 1798 menu_end_menu();
1939 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); 1799 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1940 } 1800 }
1941} 1801}
1802
1942 break; 1803 break;
1943 1804
1944 case 83: 1805 case 85:
1945 1806
1946 { 1807 {
1947 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); 1808 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1948 zconf_nextfile((yyvsp[(2) - (3)].string)); 1809 zconf_nextfile((yyvsp[-1].string));
1949} 1810}
1811
1950 break; 1812 break;
1951 1813
1952 case 84: 1814 case 86:
1953 1815
1954 { 1816 {
1955 menu_add_entry(NULL); 1817 menu_add_entry(NULL);
1956 menu_add_prompt(P_COMMENT, (yyvsp[(2) - (3)].string), NULL); 1818 menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL);
1957 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); 1819 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1958} 1820}
1821
1959 break; 1822 break;
1960 1823
1961 case 85: 1824 case 87:
1962 1825
1963 { 1826 {
1964 menu_end_entry(); 1827 menu_end_entry();
1965} 1828}
1829
1966 break; 1830 break;
1967 1831
1968 case 86: 1832 case 88:
1969 1833
1970 { 1834 {
1971 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); 1835 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1972 zconf_starthelp(); 1836 zconf_starthelp();
1973} 1837}
1838
1974 break; 1839 break;
1975 1840
1976 case 87: 1841 case 89:
1977 1842
1978 { 1843 {
1979 current_entry->help = (yyvsp[(2) - (2)].string); 1844 current_entry->help = (yyvsp[0].string);
1980} 1845}
1846
1981 break; 1847 break;
1982 1848
1983 case 92: 1849 case 94:
1984 1850
1985 { 1851 {
1986 menu_add_dep((yyvsp[(3) - (4)].expr)); 1852 menu_add_dep((yyvsp[-1].expr));
1987 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); 1853 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1988} 1854}
1989 break;
1990
1991 case 96:
1992 1855
1993 {
1994 menu_add_visibility((yyvsp[(2) - (2)].expr));
1995}
1996 break; 1856 break;
1997 1857
1998 case 98: 1858 case 98:
1999 1859
2000 { 1860 {
2001 menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr)); 1861 menu_add_visibility((yyvsp[0].expr));
2002} 1862}
2003 break;
2004 1863
2005 case 101:
2006
2007 { (yyval.id) = (yyvsp[(1) - (2)].id); }
2008 break; 1864 break;
2009 1865
2010 case 102: 1866 case 100:
1867
1868 {
1869 menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
1870}
2011 1871
2012 { (yyval.id) = (yyvsp[(1) - (2)].id); }
2013 break; 1872 break;
2014 1873
2015 case 103: 1874 case 103:
2016 1875
2017 { (yyval.id) = (yyvsp[(1) - (2)].id); } 1876 { (yyval.id) = (yyvsp[-1].id); }
1877
2018 break; 1878 break;
2019 1879
2020 case 106: 1880 case 104:
1881
1882 { (yyval.id) = (yyvsp[-1].id); }
2021 1883
2022 { (yyval.expr) = NULL; }
2023 break; 1884 break;
2024 1885
2025 case 107: 1886 case 105:
1887
1888 { (yyval.id) = (yyvsp[-1].id); }
2026 1889
2027 { (yyval.expr) = (yyvsp[(2) - (2)].expr); }
2028 break; 1890 break;
2029 1891
2030 case 108: 1892 case 108:
2031 1893
2032 { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); } 1894 { (yyval.expr) = NULL; }
1895
2033 break; 1896 break;
2034 1897
2035 case 109: 1898 case 109:
2036 1899
2037 { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } 1900 { (yyval.expr) = (yyvsp[0].expr); }
1901
2038 break; 1902 break;
2039 1903
2040 case 110: 1904 case 110:
2041 1905
2042 { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } 1906 { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); }
1907
2043 break; 1908 break;
2044 1909
2045 case 111: 1910 case 111:
2046 1911
2047 { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } 1912 { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1913
2048 break; 1914 break;
2049 1915
2050 case 112: 1916 case 112:
2051 1917
2052 { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } 1918 { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1919
2053 break; 1920 break;
2054 1921
2055 case 113: 1922 case 113:
2056 1923
2057 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } 1924 { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1925
2058 break; 1926 break;
2059 1927
2060 case 114: 1928 case 114:
2061 1929
2062 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); } 1930 { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1931
2063 break; 1932 break;
2064 1933
2065 case 115: 1934 case 115:
2066 1935
2067 { (yyval.expr) = (yyvsp[(2) - (3)].expr); } 1936 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1937
2068 break; 1938 break;
2069 1939
2070 case 116: 1940 case 116:
2071 1941
2072 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); } 1942 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1943
2073 break; 1944 break;
2074 1945
2075 case 117: 1946 case 117:
2076 1947
2077 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } 1948 { (yyval.expr) = (yyvsp[-1].expr); }
1949
2078 break; 1950 break;
2079 1951
2080 case 118: 1952 case 118:
2081 1953
2082 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } 1954 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); }
1955
2083 break; 1956 break;
2084 1957
2085 case 119: 1958 case 119:
2086 1959
2087 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); } 1960 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
1961
2088 break; 1962 break;
2089 1963
2090 case 120: 1964 case 120:
2091 1965
2092 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); } 1966 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); }
1967
2093 break; 1968 break;
2094 1969
2095 case 121: 1970 case 121:
2096 1971
1972 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); }
1973
1974 break;
1975
1976 case 122:
1977
1978 { (yyval.symbol) = sym_lookup((yyvsp[0].string), SYMBOL_CONST); free((yyvsp[0].string)); }
1979
1980 break;
1981
1982 case 123:
1983
2097 { (yyval.string) = NULL; } 1984 { (yyval.string) = NULL; }
1985
2098 break; 1986 break;
2099 1987
2100 1988
@@ -2120,7 +2008,7 @@ yyreduce:
2120 2008
2121 *++yyvsp = yyval; 2009 *++yyvsp = yyval;
2122 2010
2123 /* Now `shift' the result of the reduction. Determine what state 2011 /* Now 'shift' the result of the reduction. Determine what state
2124 that goes to, based on the state we popped back to and the rule 2012 that goes to, based on the state we popped back to and the rule
2125 number reduced by. */ 2013 number reduced by. */
2126 2014
@@ -2135,9 +2023,9 @@ yyreduce:
2135 goto yynewstate; 2023 goto yynewstate;
2136 2024
2137 2025
2138/*------------------------------------. 2026/*--------------------------------------.
2139| yyerrlab -- here on detecting error | 2027| yyerrlab -- here on detecting error. |
2140`------------------------------------*/ 2028`--------------------------------------*/
2141yyerrlab: 2029yyerrlab:
2142 /* Make sure we have latest lookahead translation. See comments at 2030 /* Make sure we have latest lookahead translation. See comments at
2143 user semantic actions for why this is necessary. */ 2031 user semantic actions for why this is necessary. */
@@ -2188,20 +2076,20 @@ yyerrlab:
2188 if (yyerrstatus == 3) 2076 if (yyerrstatus == 3)
2189 { 2077 {
2190 /* If just tried and failed to reuse lookahead token after an 2078 /* If just tried and failed to reuse lookahead token after an
2191 error, discard it. */ 2079 error, discard it. */
2192 2080
2193 if (yychar <= YYEOF) 2081 if (yychar <= YYEOF)
2194 { 2082 {
2195 /* Return failure if at end of input. */ 2083 /* Return failure if at end of input. */
2196 if (yychar == YYEOF) 2084 if (yychar == YYEOF)
2197 YYABORT; 2085 YYABORT;
2198 } 2086 }
2199 else 2087 else
2200 { 2088 {
2201 yydestruct ("Error: discarding", 2089 yydestruct ("Error: discarding",
2202 yytoken, &yylval); 2090 yytoken, &yylval);
2203 yychar = YYEMPTY; 2091 yychar = YYEMPTY;
2204 } 2092 }
2205 } 2093 }
2206 2094
2207 /* Else will try to reuse lookahead token after shifting the error 2095 /* Else will try to reuse lookahead token after shifting the error
@@ -2220,7 +2108,7 @@ yyerrorlab:
2220 if (/*CONSTCOND*/ 0) 2108 if (/*CONSTCOND*/ 0)
2221 goto yyerrorlab; 2109 goto yyerrorlab;
2222 2110
2223 /* Do not reclaim the symbols of the rule which action triggered 2111 /* Do not reclaim the symbols of the rule whose action triggered
2224 this YYERROR. */ 2112 this YYERROR. */
2225 YYPOPSTACK (yylen); 2113 YYPOPSTACK (yylen);
2226 yylen = 0; 2114 yylen = 0;
@@ -2233,35 +2121,37 @@ yyerrorlab:
2233| yyerrlab1 -- common code for both syntax error and YYERROR. | 2121| yyerrlab1 -- common code for both syntax error and YYERROR. |
2234`-------------------------------------------------------------*/ 2122`-------------------------------------------------------------*/
2235yyerrlab1: 2123yyerrlab1:
2236 yyerrstatus = 3; /* Each real token shifted decrements this. */ 2124 yyerrstatus = 3; /* Each real token shifted decrements this. */
2237 2125
2238 for (;;) 2126 for (;;)
2239 { 2127 {
2240 yyn = yypact[yystate]; 2128 yyn = yypact[yystate];
2241 if (!yypact_value_is_default (yyn)) 2129 if (!yypact_value_is_default (yyn))
2242 { 2130 {
2243 yyn += YYTERROR; 2131 yyn += YYTERROR;
2244 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2132 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2245 { 2133 {
2246 yyn = yytable[yyn]; 2134 yyn = yytable[yyn];
2247 if (0 < yyn) 2135 if (0 < yyn)
2248 break; 2136 break;
2249 } 2137 }
2250 } 2138 }
2251 2139
2252 /* Pop the current state because it cannot handle the error token. */ 2140 /* Pop the current state because it cannot handle the error token. */
2253 if (yyssp == yyss) 2141 if (yyssp == yyss)
2254 YYABORT; 2142 YYABORT;
2255 2143
2256 2144
2257 yydestruct ("Error: popping", 2145 yydestruct ("Error: popping",
2258 yystos[yystate], yyvsp); 2146 yystos[yystate], yyvsp);
2259 YYPOPSTACK (1); 2147 YYPOPSTACK (1);
2260 yystate = *yyssp; 2148 yystate = *yyssp;
2261 YY_STACK_PRINT (yyss, yyssp); 2149 YY_STACK_PRINT (yyss, yyssp);
2262 } 2150 }
2263 2151
2152 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2264 *++yyvsp = yylval; 2153 *++yyvsp = yylval;
2154 YY_IGNORE_MAYBE_UNINITIALIZED_END
2265 2155
2266 2156
2267 /* Shift the error token. */ 2157 /* Shift the error token. */
@@ -2304,14 +2194,14 @@ yyreturn:
2304 yydestruct ("Cleanup: discarding lookahead", 2194 yydestruct ("Cleanup: discarding lookahead",
2305 yytoken, &yylval); 2195 yytoken, &yylval);
2306 } 2196 }
2307 /* Do not reclaim the symbols of the rule which action triggered 2197 /* Do not reclaim the symbols of the rule whose action triggered
2308 this YYABORT or YYACCEPT. */ 2198 this YYABORT or YYACCEPT. */
2309 YYPOPSTACK (yylen); 2199 YYPOPSTACK (yylen);
2310 YY_STACK_PRINT (yyss, yyssp); 2200 YY_STACK_PRINT (yyss, yyssp);
2311 while (yyssp != yyss) 2201 while (yyssp != yyss)
2312 { 2202 {
2313 yydestruct ("Cleanup: popping", 2203 yydestruct ("Cleanup: popping",
2314 yystos[*yyssp], yyvsp); 2204 yystos[*yyssp], yyvsp);
2315 YYPOPSTACK (1); 2205 YYPOPSTACK (1);
2316 } 2206 }
2317#ifndef yyoverflow 2207#ifndef yyoverflow
@@ -2322,14 +2212,11 @@ yyreturn:
2322 if (yymsg != yymsgbuf) 2212 if (yymsg != yymsgbuf)
2323 YYSTACK_FREE (yymsg); 2213 YYSTACK_FREE (yymsg);
2324#endif 2214#endif
2325 /* Make sure YYID is used. */ 2215 return yyresult;
2326 return YYID (yyresult);
2327} 2216}
2328 2217
2329 2218
2330 2219
2331
2332
2333void conf_parse(const char *name) 2220void conf_parse(const char *name)
2334{ 2221{
2335 struct symbol *sym; 2222 struct symbol *sym;
@@ -2501,6 +2388,11 @@ static void print_symbol(FILE *out, struct menu *menu)
2501 expr_fprint(prop->expr, out); 2388 expr_fprint(prop->expr, out);
2502 fputc('\n', out); 2389 fputc('\n', out);
2503 break; 2390 break;
2391 case P_IMPLY:
2392 fputs( " imply ", out);
2393 expr_fprint(prop->expr, out);
2394 fputc('\n', out);
2395 break;
2504 case P_RANGE: 2396 case P_RANGE:
2505 fputs( " range ", out); 2397 fputs( " range ", out);
2506 expr_fprint(prop->expr, out); 2398 expr_fprint(prop->expr, out);
@@ -2577,4 +2469,3 @@ void zconfdump(FILE *out)
2577#include "expr.c" 2469#include "expr.c"
2578#include "symbol.c" 2470#include "symbol.c"
2579#include "menu.c" 2471#include "menu.c"
2580
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 71bf8bff696a..001305fa080b 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -31,7 +31,7 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE];
31static struct menu *current_menu, *current_entry; 31static struct menu *current_menu, *current_entry;
32 32
33%} 33%}
34%expect 30 34%expect 32
35 35
36%union 36%union
37{ 37{
@@ -62,6 +62,7 @@ static struct menu *current_menu, *current_entry;
62%token <id>T_TYPE 62%token <id>T_TYPE
63%token <id>T_DEFAULT 63%token <id>T_DEFAULT
64%token <id>T_SELECT 64%token <id>T_SELECT
65%token <id>T_IMPLY
65%token <id>T_RANGE 66%token <id>T_RANGE
66%token <id>T_VISIBLE 67%token <id>T_VISIBLE
67%token <id>T_OPTION 68%token <id>T_OPTION
@@ -124,7 +125,7 @@ stmt_list:
124; 125;
125 126
126option_name: 127option_name:
127 T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE 128 T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_IMPLY | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE
128; 129;
129 130
130common_stmt: 131common_stmt:
@@ -216,6 +217,12 @@ config_option: T_SELECT T_WORD if_expr T_EOL
216 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); 217 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
217}; 218};
218 219
220config_option: T_IMPLY T_WORD if_expr T_EOL
221{
222 menu_add_symbol(P_IMPLY, sym_lookup($2, 0), $3);
223 printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
224};
225
219config_option: T_RANGE symbol symbol if_expr T_EOL 226config_option: T_RANGE symbol symbol if_expr T_EOL
220{ 227{
221 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4); 228 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4);
@@ -664,6 +671,11 @@ static void print_symbol(FILE *out, struct menu *menu)
664 expr_fprint(prop->expr, out); 671 expr_fprint(prop->expr, out);
665 fputc('\n', out); 672 fputc('\n', out);
666 break; 673 break;
674 case P_IMPLY:
675 fputs( " imply ", out);
676 expr_fprint(prop->expr, out);
677 fputc('\n', out);
678 break;
667 case P_RANGE: 679 case P_RANGE:
668 fputs( " range ", out); 680 fputs( " range ", out);
669 expr_fprint(prop->expr, out); 681 expr_fprint(prop->expr, out);
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 09fd6108e421..38b79d797aaf 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2525,7 +2525,8 @@ static void selinux_bprm_committing_creds(struct linux_binprm *bprm)
2525 rlim->rlim_cur = min(rlim->rlim_max, initrlim->rlim_cur); 2525 rlim->rlim_cur = min(rlim->rlim_max, initrlim->rlim_cur);
2526 } 2526 }
2527 task_unlock(current); 2527 task_unlock(current);
2528 update_rlimit_cpu(current, rlimit(RLIMIT_CPU)); 2528 if (IS_ENABLED(CONFIG_POSIX_TIMERS))
2529 update_rlimit_cpu(current, rlimit(RLIMIT_CPU));
2529 } 2530 }
2530} 2531}
2531 2532
@@ -2555,9 +2556,11 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)
2555 */ 2556 */
2556 rc = avc_has_perm(osid, sid, SECCLASS_PROCESS, PROCESS__SIGINH, NULL); 2557 rc = avc_has_perm(osid, sid, SECCLASS_PROCESS, PROCESS__SIGINH, NULL);
2557 if (rc) { 2558 if (rc) {
2558 memset(&itimer, 0, sizeof itimer); 2559 if (IS_ENABLED(CONFIG_POSIX_TIMERS)) {
2559 for (i = 0; i < 3; i++) 2560 memset(&itimer, 0, sizeof itimer);
2560 do_setitimer(i, &itimer, NULL); 2561 for (i = 0; i < 3; i++)
2562 do_setitimer(i, &itimer, NULL);
2563 }
2561 spin_lock_irq(&current->sighand->siglock); 2564 spin_lock_irq(&current->sighand->siglock);
2562 if (!fatal_signal_pending(current)) { 2565 if (!fatal_signal_pending(current)) {
2563 flush_sigqueue(&current->pending); 2566 flush_sigqueue(&current->pending);
diff --git a/tools/testing/selftests/timers/skew_consistency.c b/tools/testing/selftests/timers/skew_consistency.c
index 5562f84ee07c..2a996e072259 100644
--- a/tools/testing/selftests/timers/skew_consistency.c
+++ b/tools/testing/selftests/timers/skew_consistency.c
@@ -57,7 +57,7 @@ int main(int argv, char **argc)
57 pid_t pid; 57 pid_t pid;
58 58
59 59
60 printf("Running Asyncrhonous Frequency Changing Tests...\n"); 60 printf("Running Asynchronous Frequency Changing Tests...\n");
61 61
62 pid = fork(); 62 pid = fork();
63 if (!pid) 63 if (!pid)