diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-09-10 23:29:52 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-09-12 23:57:06 +0900 |
| commit | d41a97e957ef616d194f60b9b79820cd0162d920 (patch) | |
| tree | 3438962f2594d9254c9163954ee989ac17978db4 /tests | |
| parent | b3efe5b6c04e809ba0a67308994c91adfbd15eff (diff) | |
| download | ducc-d41a97e957ef616d194f60b9b79820cd0162d920.tar.gz ducc-d41a97e957ef616d194f60b9b79820cd0162d920.tar.zst ducc-d41a97e957ef616d194f60b9b79820cd0162d920.zip | |
feat: implement macro argument prescan
cf. https://gcc.gnu.org/onlinedocs/cpp/Argument-Prescan.html
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/include_stdc.sh | 3 | ||||
| -rw-r--r-- | tests/test_macro_operators.sh | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/include_stdc.sh b/tests/include_stdc.sh index 7357bc9..deee597 100644 --- a/tests/include_stdc.sh +++ b/tests/include_stdc.sh @@ -3,6 +3,7 @@ EOF test_diff <<'EOF' #include <assert.h> +#include <ctype.h> #include <errno.h> #include <limits.h> #include <locale.h> @@ -11,6 +12,8 @@ test_diff <<'EOF' #include <stddef.h> #include <stdint.h> #include <stdio.h> +// #include <stdlib.h> +// #include <string.h> #include <time.h> #include <uchar.h> diff --git a/tests/test_macro_operators.sh b/tests/test_macro_operators.sh index daf8f47..a77d3ca 100644 --- a/tests/test_macro_operators.sh +++ b/tests/test_macro_operators.sh @@ -41,3 +41,19 @@ int main() { } EOF +cat <<'EOF' > expected +123 +EOF +test_diff <<'EOF' +int printf(const char*, ...); + +#define F(x) CHECK(G(x)) +#define G(x) CHECK(H(x)) +#define CHECK(x) x + +int H(int n) { return n; } + +int main() { + printf("%d\n", F(123)); +} +EOF |
