diff options
author | Ron Yorston <rmy@pobox.com> | 2024-06-14 12:49:53 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-06-14 12:49:53 +0100 |
commit | edf069ffc299d88c2291c20736bd1463ff030e12 (patch) | |
tree | 8232c9300119af46c0d0cb481038ce9b31d83bc6 | |
parent | 9ee8e87d5affe019aeb2b8afe4b908672c4c2fa5 (diff) | |
download | busybox-w32-edf069ffc299d88c2291c20736bd1463ff030e12.tar.gz busybox-w32-edf069ffc299d88c2291c20736bd1463ff030e12.tar.bz2 busybox-w32-edf069ffc299d88c2291c20736bd1463ff030e12.zip |
make: update for POSIX 2024
Now that POSIX.1-2024 has been released we can replace all
references to the 202X draft standard with 2024.
Make this change throughout the code and testsuite.
The pragma 'posix_2024' has been added. 'posix_202x' remains as
an alias for the same.
The 2024 standard is enforced by default in POSIX mode.
-rw-r--r-- | configs/mingw32_defconfig | 6 | ||||
-rw-r--r-- | configs/mingw64_defconfig | 6 | ||||
-rw-r--r-- | configs/mingw64a_defconfig | 6 | ||||
-rw-r--r-- | configs/mingw64u_defconfig | 6 | ||||
-rw-r--r-- | miscutils/make.c | 30 | ||||
-rwxr-xr-x | testsuite/make.tests | 4 |
6 files changed, 31 insertions, 27 deletions
diff --git a/configs/mingw32_defconfig b/configs/mingw32_defconfig index c9343d577..14e1aa390 100644 --- a/configs/mingw32_defconfig +++ b/configs/mingw32_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Busybox version: 1.37.0.git | 3 | # Busybox version: 1.37.0.git |
4 | # Mon May 27 13:59:40 2024 | 4 | # Fri Jun 14 12:24:50 2024 |
5 | # | 5 | # |
6 | CONFIG_HAVE_DOT_CONFIG=y | 6 | CONFIG_HAVE_DOT_CONFIG=y |
7 | # CONFIG_PLATFORM_POSIX is not set | 7 | # CONFIG_PLATFORM_POSIX is not set |
@@ -852,8 +852,8 @@ CONFIG_FEATURE_LESS_ENV=y | |||
852 | CONFIG_MAKE=y | 852 | CONFIG_MAKE=y |
853 | CONFIG_PDPMAKE=y | 853 | CONFIG_PDPMAKE=y |
854 | CONFIG_FEATURE_MAKE_POSIX=y | 854 | CONFIG_FEATURE_MAKE_POSIX=y |
855 | CONFIG_FEATURE_MAKE_POSIX_2017=y | 855 | # CONFIG_FEATURE_MAKE_POSIX_2017 is not set |
856 | # CONFIG_FEATURE_MAKE_POSIX_202X is not set | 856 | CONFIG_FEATURE_MAKE_POSIX_2024=y |
857 | # CONFIG_MAKEDEVS is not set | 857 | # CONFIG_MAKEDEVS is not set |
858 | # CONFIG_FEATURE_MAKEDEVS_LEAF is not set | 858 | # CONFIG_FEATURE_MAKEDEVS_LEAF is not set |
859 | # CONFIG_FEATURE_MAKEDEVS_TABLE is not set | 859 | # CONFIG_FEATURE_MAKEDEVS_TABLE is not set |
diff --git a/configs/mingw64_defconfig b/configs/mingw64_defconfig index 0bd7d7a81..775e1bec1 100644 --- a/configs/mingw64_defconfig +++ b/configs/mingw64_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Busybox version: 1.37.0.git | 3 | # Busybox version: 1.37.0.git |
4 | # Mon May 27 13:59:40 2024 | 4 | # Fri Jun 14 12:24:50 2024 |
5 | # | 5 | # |
6 | CONFIG_HAVE_DOT_CONFIG=y | 6 | CONFIG_HAVE_DOT_CONFIG=y |
7 | # CONFIG_PLATFORM_POSIX is not set | 7 | # CONFIG_PLATFORM_POSIX is not set |
@@ -852,8 +852,8 @@ CONFIG_FEATURE_LESS_ENV=y | |||
852 | CONFIG_MAKE=y | 852 | CONFIG_MAKE=y |
853 | CONFIG_PDPMAKE=y | 853 | CONFIG_PDPMAKE=y |
854 | CONFIG_FEATURE_MAKE_POSIX=y | 854 | CONFIG_FEATURE_MAKE_POSIX=y |
855 | CONFIG_FEATURE_MAKE_POSIX_2017=y | 855 | # CONFIG_FEATURE_MAKE_POSIX_2017 is not set |
856 | # CONFIG_FEATURE_MAKE_POSIX_202X is not set | 856 | CONFIG_FEATURE_MAKE_POSIX_2024=y |
857 | # CONFIG_MAKEDEVS is not set | 857 | # CONFIG_MAKEDEVS is not set |
858 | # CONFIG_FEATURE_MAKEDEVS_LEAF is not set | 858 | # CONFIG_FEATURE_MAKEDEVS_LEAF is not set |
859 | # CONFIG_FEATURE_MAKEDEVS_TABLE is not set | 859 | # CONFIG_FEATURE_MAKEDEVS_TABLE is not set |
diff --git a/configs/mingw64a_defconfig b/configs/mingw64a_defconfig index 32f8a02b2..510936dc9 100644 --- a/configs/mingw64a_defconfig +++ b/configs/mingw64a_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Busybox version: 1.37.0.git | 3 | # Busybox version: 1.37.0.git |
4 | # Mon May 27 13:59:40 2024 | 4 | # Fri Jun 14 12:24:50 2024 |
5 | # | 5 | # |
6 | CONFIG_HAVE_DOT_CONFIG=y | 6 | CONFIG_HAVE_DOT_CONFIG=y |
7 | # CONFIG_PLATFORM_POSIX is not set | 7 | # CONFIG_PLATFORM_POSIX is not set |
@@ -852,8 +852,8 @@ CONFIG_FEATURE_LESS_ENV=y | |||
852 | CONFIG_MAKE=y | 852 | CONFIG_MAKE=y |
853 | CONFIG_PDPMAKE=y | 853 | CONFIG_PDPMAKE=y |
854 | CONFIG_FEATURE_MAKE_POSIX=y | 854 | CONFIG_FEATURE_MAKE_POSIX=y |
855 | CONFIG_FEATURE_MAKE_POSIX_2017=y | 855 | # CONFIG_FEATURE_MAKE_POSIX_2017 is not set |
856 | # CONFIG_FEATURE_MAKE_POSIX_202X is not set | 856 | CONFIG_FEATURE_MAKE_POSIX_2024=y |
857 | # CONFIG_MAKEDEVS is not set | 857 | # CONFIG_MAKEDEVS is not set |
858 | # CONFIG_FEATURE_MAKEDEVS_LEAF is not set | 858 | # CONFIG_FEATURE_MAKEDEVS_LEAF is not set |
859 | # CONFIG_FEATURE_MAKEDEVS_TABLE is not set | 859 | # CONFIG_FEATURE_MAKEDEVS_TABLE is not set |
diff --git a/configs/mingw64u_defconfig b/configs/mingw64u_defconfig index f31e1e82f..e0d5117f2 100644 --- a/configs/mingw64u_defconfig +++ b/configs/mingw64u_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Busybox version: 1.37.0.git | 3 | # Busybox version: 1.37.0.git |
4 | # Mon May 27 13:59:40 2024 | 4 | # Fri Jun 14 12:24:50 2024 |
5 | # | 5 | # |
6 | CONFIG_HAVE_DOT_CONFIG=y | 6 | CONFIG_HAVE_DOT_CONFIG=y |
7 | # CONFIG_PLATFORM_POSIX is not set | 7 | # CONFIG_PLATFORM_POSIX is not set |
@@ -852,8 +852,8 @@ CONFIG_FEATURE_LESS_ENV=y | |||
852 | CONFIG_MAKE=y | 852 | CONFIG_MAKE=y |
853 | CONFIG_PDPMAKE=y | 853 | CONFIG_PDPMAKE=y |
854 | CONFIG_FEATURE_MAKE_POSIX=y | 854 | CONFIG_FEATURE_MAKE_POSIX=y |
855 | CONFIG_FEATURE_MAKE_POSIX_2017=y | 855 | # CONFIG_FEATURE_MAKE_POSIX_2017 is not set |
856 | # CONFIG_FEATURE_MAKE_POSIX_202X is not set | 856 | CONFIG_FEATURE_MAKE_POSIX_2024=y |
857 | # CONFIG_MAKEDEVS is not set | 857 | # CONFIG_MAKEDEVS is not set |
858 | # CONFIG_FEATURE_MAKEDEVS_LEAF is not set | 858 | # CONFIG_FEATURE_MAKEDEVS_LEAF is not set |
859 | # CONFIG_FEATURE_MAKEDEVS_TABLE is not set | 859 | # CONFIG_FEATURE_MAKEDEVS_TABLE is not set |
diff --git a/miscutils/make.c b/miscutils/make.c index c9f8cc506..02f90f805 100644 --- a/miscutils/make.c +++ b/miscutils/make.c | |||
@@ -38,8 +38,8 @@ | |||
38 | //config:config FEATURE_MAKE_POSIX_2017 | 38 | //config:config FEATURE_MAKE_POSIX_2017 |
39 | //config: bool "2017" | 39 | //config: bool "2017" |
40 | //config: | 40 | //config: |
41 | //config:config FEATURE_MAKE_POSIX_202X | 41 | //config:config FEATURE_MAKE_POSIX_2024 |
42 | //config: bool "202X" | 42 | //config: bool "2024" |
43 | //config: | 43 | //config: |
44 | //config:endchoice | 44 | //config:endchoice |
45 | 45 | ||
@@ -78,13 +78,13 @@ | |||
78 | //usage: "\n -S Stop on error" | 78 | //usage: "\n -S Stop on error" |
79 | //usage: "\n -t Touch files instead of making them" | 79 | //usage: "\n -t Touch files instead of making them" |
80 | //usage: IF_FEATURE_MAKE_POSIX( | 80 | //usage: IF_FEATURE_MAKE_POSIX( |
81 | //usage: "\n\nThis build supports: non-POSIX extensions, POSIX 202X, POSIX 2017" | 81 | //usage: "\n\nThis build supports: non-POSIX extensions, POSIX 2024, POSIX 2017" |
82 | //usage: ) | 82 | //usage: ) |
83 | //usage: IF_FEATURE_MAKE_POSIX_2017( | 83 | //usage: IF_FEATURE_MAKE_POSIX_2017( |
84 | //usage: "\nIn strict POSIX mode the 2017 standard is enforced by default" | 84 | //usage: "\nIn strict POSIX mode the 2017 standard is enforced by default" |
85 | //usage: ) | 85 | //usage: ) |
86 | //usage: IF_FEATURE_MAKE_POSIX_202X( | 86 | //usage: IF_FEATURE_MAKE_POSIX_2024( |
87 | //usage: "\nIn strict POSIX mode the 202X standard is enforced by default" | 87 | //usage: "\nIn strict POSIX mode the 2024 standard is enforced by default" |
88 | //usage: ) | 88 | //usage: ) |
89 | 89 | ||
90 | #include "libbb.h" | 90 | #include "libbb.h" |
@@ -94,14 +94,14 @@ | |||
94 | 94 | ||
95 | // Supported POSIX levels | 95 | // Supported POSIX levels |
96 | #define STD_POSIX_2017 0 | 96 | #define STD_POSIX_2017 0 |
97 | #define STD_POSIX_202X 1 | 97 | #define STD_POSIX_2024 1 |
98 | 98 | ||
99 | #define POSIX_2017 (posix && posix_level == STD_POSIX_2017) | 99 | #define POSIX_2017 (posix && posix_level == STD_POSIX_2017) |
100 | 100 | ||
101 | #if ENABLE_FEATURE_MAKE_POSIX_2017 | 101 | #if ENABLE_FEATURE_MAKE_POSIX_2017 |
102 | # define DEFAULT_POSIX_LEVEL STD_POSIX_2017 | 102 | # define DEFAULT_POSIX_LEVEL STD_POSIX_2017 |
103 | #else | 103 | #else |
104 | # define DEFAULT_POSIX_LEVEL STD_POSIX_202X | 104 | # define DEFAULT_POSIX_LEVEL STD_POSIX_2024 |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | #define OPTSTR1 "eij:+knqrsSt" | 107 | #define OPTSTR1 "eij:+knqrsSt" |
@@ -240,6 +240,7 @@ enum { | |||
240 | BIT_WINDOWS, | 240 | BIT_WINDOWS, |
241 | #endif | 241 | #endif |
242 | BIT_POSIX_2017, | 242 | BIT_POSIX_2017, |
243 | BIT_POSIX_2024, | ||
243 | BIT_POSIX_202X, | 244 | BIT_POSIX_202X, |
244 | 245 | ||
245 | P_MACRO_NAME = (1 << BIT_MACRO_NAME), | 246 | P_MACRO_NAME = (1 << BIT_MACRO_NAME), |
@@ -648,6 +649,7 @@ set_pragma(const char *name) | |||
648 | "windows\0" | 649 | "windows\0" |
649 | #endif | 650 | #endif |
650 | "posix_2017\0" | 651 | "posix_2017\0" |
652 | "posix_2024\0" | ||
651 | "posix_202x\0" | 653 | "posix_202x\0" |
652 | ; | 654 | ; |
653 | int idx = index_in_strings(p_name, name); | 655 | int idx = index_in_strings(p_name, name); |
@@ -656,9 +658,11 @@ set_pragma(const char *name) | |||
656 | if (idx >= BIT_POSIX_2017) { | 658 | if (idx >= BIT_POSIX_2017) { |
657 | // POSIX level is stored in a separate variable. | 659 | // POSIX level is stored in a separate variable. |
658 | // No bits in 'pragma' are used. | 660 | // No bits in 'pragma' are used. |
659 | if (posix_level == DEFAULT_POSIX_LEVEL) | 661 | if (posix_level == DEFAULT_POSIX_LEVEL) { |
660 | posix_level = idx - BIT_POSIX_2017; | 662 | posix_level = idx - BIT_POSIX_2017; |
661 | else if (posix_level != idx - BIT_POSIX_2017) | 663 | if (posix_level > STD_POSIX_2024) |
664 | posix_level = STD_POSIX_2024; | ||
665 | } else if (posix_level != idx - BIT_POSIX_2017) | ||
662 | warning("unable to change POSIX level"); | 666 | warning("unable to change POSIX level"); |
663 | } else { | 667 | } else { |
664 | pragma |= 1 << idx; | 668 | pragma |= 1 << idx; |
@@ -1853,7 +1857,7 @@ run_command(const char *cmd) | |||
1853 | if (val == NULL) | 1857 | if (val == NULL) |
1854 | return NULL; | 1858 | return NULL; |
1855 | 1859 | ||
1856 | // Strip leading whitespace in POSIX 202X mode | 1860 | // Strip leading whitespace in POSIX 2024 mode |
1857 | if (posix) { | 1861 | if (posix) { |
1858 | s = val; | 1862 | s = val; |
1859 | while (isspace(*s)) { | 1863 | while (isspace(*s)) { |
@@ -2019,7 +2023,7 @@ input(FILE *fd, int ilevel) | |||
2019 | error("one include file per line"); | 2023 | error("one include file per line"); |
2020 | } | 2024 | } |
2021 | } else if (makefile == old_makefile) { | 2025 | } else if (makefile == old_makefile) { |
2022 | // In POSIX 202X no include file is unspecified behaviour. | 2026 | // In POSIX 2024 no include file is unspecified behaviour. |
2023 | if (posix) | 2027 | if (posix) |
2024 | error("no include file"); | 2028 | error("no include file"); |
2025 | } | 2029 | } |
@@ -2042,7 +2046,7 @@ input(FILE *fd, int ilevel) | |||
2042 | if (q - 1 > copy2) { | 2046 | if (q - 1 > copy2) { |
2043 | switch (q[-1]) { | 2047 | switch (q[-1]) { |
2044 | case ':': | 2048 | case ':': |
2045 | // '::=' and ':::=' are from POSIX 202X. | 2049 | // '::=' and ':::=' are from POSIX 2024. |
2046 | if (!POSIX_2017 && q - 2 > copy2 && q[-2] == ':') { | 2050 | if (!POSIX_2017 && q - 2 > copy2 && q[-2] == ':') { |
2047 | if (q - 3 > copy2 && q[-3] == ':') { | 2051 | if (q - 3 > copy2 && q[-3] == ':') { |
2048 | eq = 'B'; // BSD-style ':=' | 2052 | eq = 'B'; // BSD-style ':=' |
@@ -2060,7 +2064,7 @@ input(FILE *fd, int ilevel) | |||
2060 | case '+': | 2064 | case '+': |
2061 | case '?': | 2065 | case '?': |
2062 | case '!': | 2066 | case '!': |
2063 | // '+=', '?=' and '!=' are from POSIX 202X. | 2067 | // '+=', '?=' and '!=' are from POSIX 2024. |
2064 | if (POSIX_2017) | 2068 | if (POSIX_2017) |
2065 | break; | 2069 | break; |
2066 | set_eq: | 2070 | set_eq: |
diff --git a/testsuite/make.tests b/testsuite/make.tests index d9d56270a..2425ae99d 100755 --- a/testsuite/make.tests +++ b/testsuite/make.tests | |||
@@ -443,7 +443,7 @@ target: | |||
443 | b} | 443 | b} |
444 | ' | 444 | ' |
445 | 445 | ||
446 | # The CURDIR macro is supported in POSIX 202X. | 446 | # The CURDIR macro is supported in POSIX 2024. |
447 | testing "make CURDIR macro" \ | 447 | testing "make CURDIR macro" \ |
448 | "make -f -" \ | 448 | "make -f -" \ |
449 | "OK\n" "" ' | 449 | "OK\n" "" ' |
@@ -482,7 +482,7 @@ target: | |||
482 | @echo $(MYFLAG) | 482 | @echo $(MYFLAG) |
483 | ' | 483 | ' |
484 | 484 | ||
485 | # POSIX 202X permits additional characters in macro and target names | 485 | # POSIX 2024 permits additional characters in macro and target names |
486 | testing "make allow - and / in target names, - in macro names" \ | 486 | testing "make allow - and / in target names, - in macro names" \ |
487 | "make -f -" \ | 487 | "make -f -" \ |
488 | "/hello\nhel-lo\nmac-ro\n" "" ' | 488 | "/hello\nhel-lo\nmac-ro\n" "" ' |