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 /miscutils | |
| 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.
Diffstat (limited to 'miscutils')
| -rw-r--r-- | miscutils/make.c | 30 |
1 files changed, 17 insertions, 13 deletions
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: |
