From 29285882676388aacff123e8bdf025904abf8ea9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 24 Jun 2010 15:32:15 -0700 Subject: glsl2: Move the compiler to the subdirectory it will live in in Mesa. --- src/glsl/glcpp/tests/000-content-with-spaces.c | 1 + .../glcpp/tests/000-content-with-spaces.c.expected | 2 ++ src/glsl/glcpp/tests/001-define.c | 2 ++ src/glsl/glcpp/tests/001-define.c.expected | 3 ++ src/glsl/glcpp/tests/002-define-chain.c | 3 ++ src/glsl/glcpp/tests/002-define-chain.c.expected | 4 +++ src/glsl/glcpp/tests/003-define-chain-reverse.c | 3 ++ .../tests/003-define-chain-reverse.c.expected | 4 +++ src/glsl/glcpp/tests/004-define-recursive.c | 6 ++++ .../glcpp/tests/004-define-recursive.c.expected | 7 +++++ src/glsl/glcpp/tests/005-define-composite-chain.c | 3 ++ .../tests/005-define-composite-chain.c.expected | 4 +++ .../tests/006-define-composite-chain-reverse.c | 3 ++ .../006-define-composite-chain-reverse.c.expected | 4 +++ .../glcpp/tests/007-define-composite-recursive.c | 6 ++++ .../007-define-composite-recursive.c.expected | 7 +++++ src/glsl/glcpp/tests/008-define-empty.c | 2 ++ src/glsl/glcpp/tests/008-define-empty.c.expected | 3 ++ src/glsl/glcpp/tests/009-undef.c | 4 +++ src/glsl/glcpp/tests/009-undef.c.expected | 5 +++ src/glsl/glcpp/tests/010-undef-re-define.c | 6 ++++ .../glcpp/tests/010-undef-re-define.c.expected | 7 +++++ src/glsl/glcpp/tests/011-define-func-empty.c | 2 ++ .../glcpp/tests/011-define-func-empty.c.expected | 3 ++ src/glsl/glcpp/tests/012-define-func-no-args.c | 2 ++ .../glcpp/tests/012-define-func-no-args.c.expected | 3 ++ .../glcpp/tests/013-define-func-1-arg-unused.c | 2 ++ .../tests/013-define-func-1-arg-unused.c.expected | 3 ++ .../glcpp/tests/014-define-func-2-arg-unused.c | 2 ++ .../tests/014-define-func-2-arg-unused.c.expected | 3 ++ .../glcpp/tests/015-define-object-with-parens.c | 4 +++ .../tests/015-define-object-with-parens.c.expected | 5 +++ src/glsl/glcpp/tests/016-define-func-1-arg.c | 2 ++ .../glcpp/tests/016-define-func-1-arg.c.expected | 3 ++ src/glsl/glcpp/tests/017-define-func-2-args.c | 2 ++ .../glcpp/tests/017-define-func-2-args.c.expected | 3 ++ .../tests/018-define-func-macro-as-parameter.c | 3 ++ .../018-define-func-macro-as-parameter.c.expected | 4 +++ src/glsl/glcpp/tests/019-define-func-1-arg-multi.c | 2 ++ .../tests/019-define-func-1-arg-multi.c.expected | 3 ++ src/glsl/glcpp/tests/020-define-func-2-arg-multi.c | 2 ++ .../tests/020-define-func-2-arg-multi.c.expected | 3 ++ src/glsl/glcpp/tests/021-define-func-compose.c | 3 ++ .../glcpp/tests/021-define-func-compose.c.expected | 4 +++ .../glcpp/tests/022-define-func-arg-with-parens.c | 2 ++ .../022-define-func-arg-with-parens.c.expected | 3 ++ src/glsl/glcpp/tests/023-define-extra-whitespace.c | 8 +++++ .../tests/023-define-extra-whitespace.c.expected | 9 ++++++ .../tests/024-define-chain-to-self-recursion.c | 3 ++ .../024-define-chain-to-self-recursion.c.expected | 4 +++ src/glsl/glcpp/tests/025-func-macro-as-non-macro.c | 2 ++ .../tests/025-func-macro-as-non-macro.c.expected | 3 ++ .../glcpp/tests/026-define-func-extra-newlines.c | 6 ++++ .../026-define-func-extra-newlines.c.expected | 4 +++ .../glcpp/tests/027-define-chain-obj-to-func.c | 3 ++ .../tests/027-define-chain-obj-to-func.c.expected | 4 +++ .../glcpp/tests/028-define-chain-obj-to-non-func.c | 3 ++ .../028-define-chain-obj-to-non-func.c.expected | 4 +++ .../tests/029-define-chain-obj-to-func-with-args.c | 3 ++ ...9-define-chain-obj-to-func-with-args.c.expected | 4 +++ .../tests/030-define-chain-obj-to-func-compose.c | 4 +++ ...030-define-chain-obj-to-func-compose.c.expected | 5 +++ .../tests/031-define-chain-func-to-func-compose.c | 4 +++ ...31-define-chain-func-to-func-compose.c.expected | 5 +++ .../glcpp/tests/032-define-func-self-recurse.c | 2 ++ .../tests/032-define-func-self-recurse.c.expected | 3 ++ .../glcpp/tests/033-define-func-self-compose.c | 2 ++ .../tests/033-define-func-self-compose.c.expected | 3 ++ .../tests/034-define-func-self-compose-non-func.c | 2 ++ ...34-define-func-self-compose-non-func.c.expected | 3 ++ ...nc-self-compose-non-func-multi-token-argument.c | 2 ++ ...ompose-non-func-multi-token-argument.c.expected | 3 ++ ...36-define-func-non-macro-multi-token-argument.c | 3 ++ ...-func-non-macro-multi-token-argument.c.expected | 4 +++ .../glcpp/tests/037-finalize-unexpanded-macro.c | 3 ++ .../tests/037-finalize-unexpanded-macro.c.expected | 4 +++ src/glsl/glcpp/tests/038-func-arg-with-commas.c | 2 ++ .../tests/038-func-arg-with-commas.c.expected | 3 ++ .../tests/039-func-arg-obj-macro-with-comma.c | 3 ++ .../039-func-arg-obj-macro-with-comma.c.expected | 4 +++ src/glsl/glcpp/tests/040-token-pasting.c | 2 ++ src/glsl/glcpp/tests/040-token-pasting.c.expected | 3 ++ src/glsl/glcpp/tests/041-if-0.c | 5 +++ src/glsl/glcpp/tests/041-if-0.c.expected | 6 ++++ src/glsl/glcpp/tests/042-if-1.c | 5 +++ src/glsl/glcpp/tests/042-if-1.c.expected | 6 ++++ src/glsl/glcpp/tests/043-if-0-else.c | 7 +++++ src/glsl/glcpp/tests/043-if-0-else.c.expected | 8 +++++ src/glsl/glcpp/tests/044-if-1-else.c | 7 +++++ src/glsl/glcpp/tests/044-if-1-else.c.expected | 8 +++++ src/glsl/glcpp/tests/045-if-0-elif.c | 11 +++++++ src/glsl/glcpp/tests/045-if-0-elif.c.expected | 12 ++++++++ src/glsl/glcpp/tests/046-if-1-elsif.c | 11 +++++++ src/glsl/glcpp/tests/046-if-1-elsif.c.expected | 12 ++++++++ src/glsl/glcpp/tests/047-if-elif-else.c | 11 +++++++ src/glsl/glcpp/tests/047-if-elif-else.c.expected | 12 ++++++++ src/glsl/glcpp/tests/048-if-nested.c | 11 +++++++ src/glsl/glcpp/tests/048-if-nested.c.expected | 12 ++++++++ .../glcpp/tests/049-if-expression-precedence.c | 5 +++ .../tests/049-if-expression-precedence.c.expected | 6 ++++ src/glsl/glcpp/tests/050-if-defined.c | 17 ++++++++++ src/glsl/glcpp/tests/050-if-defined.c.expected | 18 +++++++++++ src/glsl/glcpp/tests/051-if-relational.c | 35 +++++++++++++++++++++ src/glsl/glcpp/tests/051-if-relational.c.expected | 36 ++++++++++++++++++++++ src/glsl/glcpp/tests/052-if-bitwise.c | 20 ++++++++++++ src/glsl/glcpp/tests/052-if-bitwise.c.expected | 21 +++++++++++++ src/glsl/glcpp/tests/053-if-divide-and-shift.c | 15 +++++++++ .../glcpp/tests/053-if-divide-and-shift.c.expected | 16 ++++++++++ src/glsl/glcpp/tests/054-if-with-macros.c | 34 ++++++++++++++++++++ src/glsl/glcpp/tests/054-if-with-macros.c.expected | 35 +++++++++++++++++++++ .../055-define-chain-obj-to-func-parens-in-text.c | 3 ++ ...ine-chain-obj-to-func-parens-in-text.c.expected | 4 +++ .../glcpp/tests/056-macro-argument-with-comma.c | 4 +++ .../tests/056-macro-argument-with-comma.c.expected | 5 +++ src/glsl/glcpp/tests/057-empty-arguments.c | 6 ++++ .../glcpp/tests/057-empty-arguments.c.expected | 7 +++++ .../tests/058-token-pasting-empty-arguments.c | 5 +++ .../058-token-pasting-empty-arguments.c.expected | 6 ++++ src/glsl/glcpp/tests/059-token-pasting-integer.c | 4 +++ .../tests/059-token-pasting-integer.c.expected | 5 +++ .../060-left-paren-in-macro-right-paren-in-text.c | 3 ++ ...t-paren-in-macro-right-paren-in-text.c.expected | 4 +++ .../tests/061-define-chain-obj-to-func-multi.c | 5 +++ .../061-define-chain-obj-to-func-multi.c.expected | 6 ++++ src/glsl/glcpp/tests/062-if-0-skips-garbage.c | 5 +++ .../glcpp/tests/062-if-0-skips-garbage.c.expected | 6 ++++ src/glsl/glcpp/tests/063-comments.c | 20 ++++++++++++ src/glsl/glcpp/tests/063-comments.c.expected | 14 +++++++++ src/glsl/glcpp/tests/064-version.c | 2 ++ src/glsl/glcpp/tests/064-version.c.expected | 3 ++ src/glsl/glcpp/tests/065-if-defined-parens.c | 17 ++++++++++ .../glcpp/tests/065-if-defined-parens.c.expected | 18 +++++++++++ src/glsl/glcpp/tests/071-punctuator.c | 1 + src/glsl/glcpp/tests/071-punctuator.c.expected | 2 ++ src/glsl/glcpp/tests/072-token-pasting-same-line.c | 2 ++ .../tests/072-token-pasting-same-line.c.expected | 3 ++ src/glsl/glcpp/tests/099-c99-example.c | 17 ++++++++++ src/glsl/glcpp/tests/099-c99-example.c.expected | 17 ++++++++++ src/glsl/glcpp/tests/glcpp-test | 7 +++++ 139 files changed, 889 insertions(+) create mode 100644 src/glsl/glcpp/tests/000-content-with-spaces.c create mode 100644 src/glsl/glcpp/tests/000-content-with-spaces.c.expected create mode 100644 src/glsl/glcpp/tests/001-define.c create mode 100644 src/glsl/glcpp/tests/001-define.c.expected create mode 100644 src/glsl/glcpp/tests/002-define-chain.c create mode 100644 src/glsl/glcpp/tests/002-define-chain.c.expected create mode 100644 src/glsl/glcpp/tests/003-define-chain-reverse.c create mode 100644 src/glsl/glcpp/tests/003-define-chain-reverse.c.expected create mode 100644 src/glsl/glcpp/tests/004-define-recursive.c create mode 100644 src/glsl/glcpp/tests/004-define-recursive.c.expected create mode 100644 src/glsl/glcpp/tests/005-define-composite-chain.c create mode 100644 src/glsl/glcpp/tests/005-define-composite-chain.c.expected create mode 100644 src/glsl/glcpp/tests/006-define-composite-chain-reverse.c create mode 100644 src/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected create mode 100644 src/glsl/glcpp/tests/007-define-composite-recursive.c create mode 100644 src/glsl/glcpp/tests/007-define-composite-recursive.c.expected create mode 100644 src/glsl/glcpp/tests/008-define-empty.c create mode 100644 src/glsl/glcpp/tests/008-define-empty.c.expected create mode 100644 src/glsl/glcpp/tests/009-undef.c create mode 100644 src/glsl/glcpp/tests/009-undef.c.expected create mode 100644 src/glsl/glcpp/tests/010-undef-re-define.c create mode 100644 src/glsl/glcpp/tests/010-undef-re-define.c.expected create mode 100644 src/glsl/glcpp/tests/011-define-func-empty.c create mode 100644 src/glsl/glcpp/tests/011-define-func-empty.c.expected create mode 100644 src/glsl/glcpp/tests/012-define-func-no-args.c create mode 100644 src/glsl/glcpp/tests/012-define-func-no-args.c.expected create mode 100644 src/glsl/glcpp/tests/013-define-func-1-arg-unused.c create mode 100644 src/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected create mode 100644 src/glsl/glcpp/tests/014-define-func-2-arg-unused.c create mode 100644 src/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected create mode 100644 src/glsl/glcpp/tests/015-define-object-with-parens.c create mode 100644 src/glsl/glcpp/tests/015-define-object-with-parens.c.expected create mode 100644 src/glsl/glcpp/tests/016-define-func-1-arg.c create mode 100644 src/glsl/glcpp/tests/016-define-func-1-arg.c.expected create mode 100644 src/glsl/glcpp/tests/017-define-func-2-args.c create mode 100644 src/glsl/glcpp/tests/017-define-func-2-args.c.expected create mode 100644 src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c create mode 100644 src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected create mode 100644 src/glsl/glcpp/tests/019-define-func-1-arg-multi.c create mode 100644 src/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected create mode 100644 src/glsl/glcpp/tests/020-define-func-2-arg-multi.c create mode 100644 src/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected create mode 100644 src/glsl/glcpp/tests/021-define-func-compose.c create mode 100644 src/glsl/glcpp/tests/021-define-func-compose.c.expected create mode 100644 src/glsl/glcpp/tests/022-define-func-arg-with-parens.c create mode 100644 src/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected create mode 100644 src/glsl/glcpp/tests/023-define-extra-whitespace.c create mode 100644 src/glsl/glcpp/tests/023-define-extra-whitespace.c.expected create mode 100644 src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c create mode 100644 src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected create mode 100644 src/glsl/glcpp/tests/025-func-macro-as-non-macro.c create mode 100644 src/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected create mode 100644 src/glsl/glcpp/tests/026-define-func-extra-newlines.c create mode 100644 src/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected create mode 100644 src/glsl/glcpp/tests/027-define-chain-obj-to-func.c create mode 100644 src/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected create mode 100644 src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c create mode 100644 src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected create mode 100644 src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c create mode 100644 src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected create mode 100644 src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c create mode 100644 src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected create mode 100644 src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c create mode 100644 src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected create mode 100644 src/glsl/glcpp/tests/032-define-func-self-recurse.c create mode 100644 src/glsl/glcpp/tests/032-define-func-self-recurse.c.expected create mode 100644 src/glsl/glcpp/tests/033-define-func-self-compose.c create mode 100644 src/glsl/glcpp/tests/033-define-func-self-compose.c.expected create mode 100644 src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c create mode 100644 src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected create mode 100644 src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c create mode 100644 src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected create mode 100644 src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c create mode 100644 src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected create mode 100644 src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c create mode 100644 src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected create mode 100644 src/glsl/glcpp/tests/038-func-arg-with-commas.c create mode 100644 src/glsl/glcpp/tests/038-func-arg-with-commas.c.expected create mode 100644 src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c create mode 100644 src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected create mode 100644 src/glsl/glcpp/tests/040-token-pasting.c create mode 100644 src/glsl/glcpp/tests/040-token-pasting.c.expected create mode 100644 src/glsl/glcpp/tests/041-if-0.c create mode 100644 src/glsl/glcpp/tests/041-if-0.c.expected create mode 100644 src/glsl/glcpp/tests/042-if-1.c create mode 100644 src/glsl/glcpp/tests/042-if-1.c.expected create mode 100644 src/glsl/glcpp/tests/043-if-0-else.c create mode 100644 src/glsl/glcpp/tests/043-if-0-else.c.expected create mode 100644 src/glsl/glcpp/tests/044-if-1-else.c create mode 100644 src/glsl/glcpp/tests/044-if-1-else.c.expected create mode 100644 src/glsl/glcpp/tests/045-if-0-elif.c create mode 100644 src/glsl/glcpp/tests/045-if-0-elif.c.expected create mode 100644 src/glsl/glcpp/tests/046-if-1-elsif.c create mode 100644 src/glsl/glcpp/tests/046-if-1-elsif.c.expected create mode 100644 src/glsl/glcpp/tests/047-if-elif-else.c create mode 100644 src/glsl/glcpp/tests/047-if-elif-else.c.expected create mode 100644 src/glsl/glcpp/tests/048-if-nested.c create mode 100644 src/glsl/glcpp/tests/048-if-nested.c.expected create mode 100644 src/glsl/glcpp/tests/049-if-expression-precedence.c create mode 100644 src/glsl/glcpp/tests/049-if-expression-precedence.c.expected create mode 100644 src/glsl/glcpp/tests/050-if-defined.c create mode 100644 src/glsl/glcpp/tests/050-if-defined.c.expected create mode 100644 src/glsl/glcpp/tests/051-if-relational.c create mode 100644 src/glsl/glcpp/tests/051-if-relational.c.expected create mode 100644 src/glsl/glcpp/tests/052-if-bitwise.c create mode 100644 src/glsl/glcpp/tests/052-if-bitwise.c.expected create mode 100644 src/glsl/glcpp/tests/053-if-divide-and-shift.c create mode 100644 src/glsl/glcpp/tests/053-if-divide-and-shift.c.expected create mode 100644 src/glsl/glcpp/tests/054-if-with-macros.c create mode 100644 src/glsl/glcpp/tests/054-if-with-macros.c.expected create mode 100644 src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c create mode 100644 src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected create mode 100644 src/glsl/glcpp/tests/056-macro-argument-with-comma.c create mode 100644 src/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected create mode 100644 src/glsl/glcpp/tests/057-empty-arguments.c create mode 100644 src/glsl/glcpp/tests/057-empty-arguments.c.expected create mode 100644 src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c create mode 100644 src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected create mode 100644 src/glsl/glcpp/tests/059-token-pasting-integer.c create mode 100644 src/glsl/glcpp/tests/059-token-pasting-integer.c.expected create mode 100644 src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c create mode 100644 src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected create mode 100644 src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c create mode 100644 src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected create mode 100644 src/glsl/glcpp/tests/062-if-0-skips-garbage.c create mode 100644 src/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected create mode 100644 src/glsl/glcpp/tests/063-comments.c create mode 100644 src/glsl/glcpp/tests/063-comments.c.expected create mode 100644 src/glsl/glcpp/tests/064-version.c create mode 100644 src/glsl/glcpp/tests/064-version.c.expected create mode 100644 src/glsl/glcpp/tests/065-if-defined-parens.c create mode 100644 src/glsl/glcpp/tests/065-if-defined-parens.c.expected create mode 100644 src/glsl/glcpp/tests/071-punctuator.c create mode 100644 src/glsl/glcpp/tests/071-punctuator.c.expected create mode 100644 src/glsl/glcpp/tests/072-token-pasting-same-line.c create mode 100644 src/glsl/glcpp/tests/072-token-pasting-same-line.c.expected create mode 100644 src/glsl/glcpp/tests/099-c99-example.c create mode 100644 src/glsl/glcpp/tests/099-c99-example.c.expected create mode 100755 src/glsl/glcpp/tests/glcpp-test (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/000-content-with-spaces.c b/src/glsl/glcpp/tests/000-content-with-spaces.c new file mode 100644 index 0000000000..696cb3a74f --- /dev/null +++ b/src/glsl/glcpp/tests/000-content-with-spaces.c @@ -0,0 +1 @@ +this is four tokens diff --git a/src/glsl/glcpp/tests/000-content-with-spaces.c.expected b/src/glsl/glcpp/tests/000-content-with-spaces.c.expected new file mode 100644 index 0000000000..83f7834d54 --- /dev/null +++ b/src/glsl/glcpp/tests/000-content-with-spaces.c.expected @@ -0,0 +1,2 @@ +this is four tokens + diff --git a/src/glsl/glcpp/tests/001-define.c b/src/glsl/glcpp/tests/001-define.c new file mode 100644 index 0000000000..cbf2fee0e7 --- /dev/null +++ b/src/glsl/glcpp/tests/001-define.c @@ -0,0 +1,2 @@ +#define foo 1 +foo diff --git a/src/glsl/glcpp/tests/001-define.c.expected b/src/glsl/glcpp/tests/001-define.c.expected new file mode 100644 index 0000000000..878fd15d6f --- /dev/null +++ b/src/glsl/glcpp/tests/001-define.c.expected @@ -0,0 +1,3 @@ + +1 + diff --git a/src/glsl/glcpp/tests/002-define-chain.c b/src/glsl/glcpp/tests/002-define-chain.c new file mode 100644 index 0000000000..87d75c6875 --- /dev/null +++ b/src/glsl/glcpp/tests/002-define-chain.c @@ -0,0 +1,3 @@ +#define foo 1 +#define bar foo +bar diff --git a/src/glsl/glcpp/tests/002-define-chain.c.expected b/src/glsl/glcpp/tests/002-define-chain.c.expected new file mode 100644 index 0000000000..43d484d713 --- /dev/null +++ b/src/glsl/glcpp/tests/002-define-chain.c.expected @@ -0,0 +1,4 @@ + + +1 + diff --git a/src/glsl/glcpp/tests/003-define-chain-reverse.c b/src/glsl/glcpp/tests/003-define-chain-reverse.c new file mode 100644 index 0000000000..a18b724eca --- /dev/null +++ b/src/glsl/glcpp/tests/003-define-chain-reverse.c @@ -0,0 +1,3 @@ +#define bar foo +#define foo 1 +bar diff --git a/src/glsl/glcpp/tests/003-define-chain-reverse.c.expected b/src/glsl/glcpp/tests/003-define-chain-reverse.c.expected new file mode 100644 index 0000000000..43d484d713 --- /dev/null +++ b/src/glsl/glcpp/tests/003-define-chain-reverse.c.expected @@ -0,0 +1,4 @@ + + +1 + diff --git a/src/glsl/glcpp/tests/004-define-recursive.c b/src/glsl/glcpp/tests/004-define-recursive.c new file mode 100644 index 0000000000..2ac56ea3dc --- /dev/null +++ b/src/glsl/glcpp/tests/004-define-recursive.c @@ -0,0 +1,6 @@ +#define foo bar +#define bar baz +#define baz foo +foo +bar +baz diff --git a/src/glsl/glcpp/tests/004-define-recursive.c.expected b/src/glsl/glcpp/tests/004-define-recursive.c.expected new file mode 100644 index 0000000000..4d2698b7a7 --- /dev/null +++ b/src/glsl/glcpp/tests/004-define-recursive.c.expected @@ -0,0 +1,7 @@ + + + +foo +bar +baz + diff --git a/src/glsl/glcpp/tests/005-define-composite-chain.c b/src/glsl/glcpp/tests/005-define-composite-chain.c new file mode 100644 index 0000000000..f5521df968 --- /dev/null +++ b/src/glsl/glcpp/tests/005-define-composite-chain.c @@ -0,0 +1,3 @@ +#define foo 1 +#define bar a foo +bar diff --git a/src/glsl/glcpp/tests/005-define-composite-chain.c.expected b/src/glsl/glcpp/tests/005-define-composite-chain.c.expected new file mode 100644 index 0000000000..c67358f4f6 --- /dev/null +++ b/src/glsl/glcpp/tests/005-define-composite-chain.c.expected @@ -0,0 +1,4 @@ + + +a 1 + diff --git a/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c b/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c new file mode 100644 index 0000000000..4bb91a1221 --- /dev/null +++ b/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c @@ -0,0 +1,3 @@ +#define bar a foo +#define foo 1 +bar diff --git a/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected b/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected new file mode 100644 index 0000000000..c67358f4f6 --- /dev/null +++ b/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected @@ -0,0 +1,4 @@ + + +a 1 + diff --git a/src/glsl/glcpp/tests/007-define-composite-recursive.c b/src/glsl/glcpp/tests/007-define-composite-recursive.c new file mode 100644 index 0000000000..5784565bdf --- /dev/null +++ b/src/glsl/glcpp/tests/007-define-composite-recursive.c @@ -0,0 +1,6 @@ +#define foo a bar +#define bar b baz +#define baz c foo +foo +bar +baz diff --git a/src/glsl/glcpp/tests/007-define-composite-recursive.c.expected b/src/glsl/glcpp/tests/007-define-composite-recursive.c.expected new file mode 100644 index 0000000000..30fe4dc1f6 --- /dev/null +++ b/src/glsl/glcpp/tests/007-define-composite-recursive.c.expected @@ -0,0 +1,7 @@ + + + +a b c foo +b c a bar +c a b baz + diff --git a/src/glsl/glcpp/tests/008-define-empty.c b/src/glsl/glcpp/tests/008-define-empty.c new file mode 100644 index 0000000000..b1bd17ec21 --- /dev/null +++ b/src/glsl/glcpp/tests/008-define-empty.c @@ -0,0 +1,2 @@ +#define foo +foo diff --git a/src/glsl/glcpp/tests/008-define-empty.c.expected b/src/glsl/glcpp/tests/008-define-empty.c.expected new file mode 100644 index 0000000000..b28b04f643 --- /dev/null +++ b/src/glsl/glcpp/tests/008-define-empty.c.expected @@ -0,0 +1,3 @@ + + + diff --git a/src/glsl/glcpp/tests/009-undef.c b/src/glsl/glcpp/tests/009-undef.c new file mode 100644 index 0000000000..3fc1fb4424 --- /dev/null +++ b/src/glsl/glcpp/tests/009-undef.c @@ -0,0 +1,4 @@ +#define foo 1 +foo +#undef foo +foo diff --git a/src/glsl/glcpp/tests/009-undef.c.expected b/src/glsl/glcpp/tests/009-undef.c.expected new file mode 100644 index 0000000000..03a7061af0 --- /dev/null +++ b/src/glsl/glcpp/tests/009-undef.c.expected @@ -0,0 +1,5 @@ + +1 + +foo + diff --git a/src/glsl/glcpp/tests/010-undef-re-define.c b/src/glsl/glcpp/tests/010-undef-re-define.c new file mode 100644 index 0000000000..32ff73798b --- /dev/null +++ b/src/glsl/glcpp/tests/010-undef-re-define.c @@ -0,0 +1,6 @@ +#define foo 1 +foo +#undef foo +foo +#define foo 2 +foo diff --git a/src/glsl/glcpp/tests/010-undef-re-define.c.expected b/src/glsl/glcpp/tests/010-undef-re-define.c.expected new file mode 100644 index 0000000000..f4f7efdc2b --- /dev/null +++ b/src/glsl/glcpp/tests/010-undef-re-define.c.expected @@ -0,0 +1,7 @@ + +1 + +foo + +2 + diff --git a/src/glsl/glcpp/tests/011-define-func-empty.c b/src/glsl/glcpp/tests/011-define-func-empty.c new file mode 100644 index 0000000000..d9ce13c228 --- /dev/null +++ b/src/glsl/glcpp/tests/011-define-func-empty.c @@ -0,0 +1,2 @@ +#define foo() +foo() diff --git a/src/glsl/glcpp/tests/011-define-func-empty.c.expected b/src/glsl/glcpp/tests/011-define-func-empty.c.expected new file mode 100644 index 0000000000..b28b04f643 --- /dev/null +++ b/src/glsl/glcpp/tests/011-define-func-empty.c.expected @@ -0,0 +1,3 @@ + + + diff --git a/src/glsl/glcpp/tests/012-define-func-no-args.c b/src/glsl/glcpp/tests/012-define-func-no-args.c new file mode 100644 index 0000000000..c2bb730b11 --- /dev/null +++ b/src/glsl/glcpp/tests/012-define-func-no-args.c @@ -0,0 +1,2 @@ +#define foo() bar +foo() diff --git a/src/glsl/glcpp/tests/012-define-func-no-args.c.expected b/src/glsl/glcpp/tests/012-define-func-no-args.c.expected new file mode 100644 index 0000000000..0353767297 --- /dev/null +++ b/src/glsl/glcpp/tests/012-define-func-no-args.c.expected @@ -0,0 +1,3 @@ + +bar + diff --git a/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c b/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c new file mode 100644 index 0000000000..f78fb8b118 --- /dev/null +++ b/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c @@ -0,0 +1,2 @@ +#define foo(x) 1 +foo(bar) diff --git a/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected b/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected new file mode 100644 index 0000000000..878fd15d6f --- /dev/null +++ b/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected @@ -0,0 +1,3 @@ + +1 + diff --git a/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c b/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c new file mode 100644 index 0000000000..11feb2624b --- /dev/null +++ b/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c @@ -0,0 +1,2 @@ +#define foo(x,y) 1 +foo(bar,baz) diff --git a/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected b/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected new file mode 100644 index 0000000000..878fd15d6f --- /dev/null +++ b/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected @@ -0,0 +1,3 @@ + +1 + diff --git a/src/glsl/glcpp/tests/015-define-object-with-parens.c b/src/glsl/glcpp/tests/015-define-object-with-parens.c new file mode 100644 index 0000000000..558da9c617 --- /dev/null +++ b/src/glsl/glcpp/tests/015-define-object-with-parens.c @@ -0,0 +1,4 @@ +#define foo ()1 +foo() +#define bar ()2 +bar() diff --git a/src/glsl/glcpp/tests/015-define-object-with-parens.c.expected b/src/glsl/glcpp/tests/015-define-object-with-parens.c.expected new file mode 100644 index 0000000000..d6f8cb9dc6 --- /dev/null +++ b/src/glsl/glcpp/tests/015-define-object-with-parens.c.expected @@ -0,0 +1,5 @@ + +()1() + +()2() + diff --git a/src/glsl/glcpp/tests/016-define-func-1-arg.c b/src/glsl/glcpp/tests/016-define-func-1-arg.c new file mode 100644 index 0000000000..a2e2404c7c --- /dev/null +++ b/src/glsl/glcpp/tests/016-define-func-1-arg.c @@ -0,0 +1,2 @@ +#define foo(x) ((x)+1) +foo(bar) diff --git a/src/glsl/glcpp/tests/016-define-func-1-arg.c.expected b/src/glsl/glcpp/tests/016-define-func-1-arg.c.expected new file mode 100644 index 0000000000..7f1828a3c6 --- /dev/null +++ b/src/glsl/glcpp/tests/016-define-func-1-arg.c.expected @@ -0,0 +1,3 @@ + +((bar)+1) + diff --git a/src/glsl/glcpp/tests/017-define-func-2-args.c b/src/glsl/glcpp/tests/017-define-func-2-args.c new file mode 100644 index 0000000000..c725383527 --- /dev/null +++ b/src/glsl/glcpp/tests/017-define-func-2-args.c @@ -0,0 +1,2 @@ +#define foo(x,y) ((x)*(y)) +foo(bar,baz) diff --git a/src/glsl/glcpp/tests/017-define-func-2-args.c.expected b/src/glsl/glcpp/tests/017-define-func-2-args.c.expected new file mode 100644 index 0000000000..9f341dac00 --- /dev/null +++ b/src/glsl/glcpp/tests/017-define-func-2-args.c.expected @@ -0,0 +1,3 @@ + +((bar)*(baz)) + diff --git a/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c b/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c new file mode 100644 index 0000000000..668130b8f9 --- /dev/null +++ b/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c @@ -0,0 +1,3 @@ +#define x 0 +#define foo(x) x +foo(1) diff --git a/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected b/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected new file mode 100644 index 0000000000..43d484d713 --- /dev/null +++ b/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected @@ -0,0 +1,4 @@ + + +1 + diff --git a/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c b/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c new file mode 100644 index 0000000000..c4e62b2550 --- /dev/null +++ b/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c @@ -0,0 +1,2 @@ +#define foo(x) (x) +foo(this is more than one word) diff --git a/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected b/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected new file mode 100644 index 0000000000..4314fc88d8 --- /dev/null +++ b/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected @@ -0,0 +1,3 @@ + +(this is more than one word) + diff --git a/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c b/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c new file mode 100644 index 0000000000..3049ad1546 --- /dev/null +++ b/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c @@ -0,0 +1,2 @@ +#define foo(x,y) x,two fish,red fish,y +foo(one fish, blue fish) diff --git a/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected b/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected new file mode 100644 index 0000000000..5648e4fb9d --- /dev/null +++ b/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected @@ -0,0 +1,3 @@ + +one fish,two fish,red fish,blue fish + diff --git a/src/glsl/glcpp/tests/021-define-func-compose.c b/src/glsl/glcpp/tests/021-define-func-compose.c new file mode 100644 index 0000000000..21ddd0e65f --- /dev/null +++ b/src/glsl/glcpp/tests/021-define-func-compose.c @@ -0,0 +1,3 @@ +#define bar(x) (1+(x)) +#define foo(y) (2*(y)) +foo(bar(3)) diff --git a/src/glsl/glcpp/tests/021-define-func-compose.c.expected b/src/glsl/glcpp/tests/021-define-func-compose.c.expected new file mode 100644 index 0000000000..1d62105de4 --- /dev/null +++ b/src/glsl/glcpp/tests/021-define-func-compose.c.expected @@ -0,0 +1,4 @@ + + +(2*((1+(3)))) + diff --git a/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c b/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c new file mode 100644 index 0000000000..c20d73a4a2 --- /dev/null +++ b/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c @@ -0,0 +1,2 @@ +#define foo(x) (x) +foo(argument(including parens)for the win) diff --git a/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected b/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected new file mode 100644 index 0000000000..66c1658175 --- /dev/null +++ b/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected @@ -0,0 +1,3 @@ + +(argument(including parens)for the win) + diff --git a/src/glsl/glcpp/tests/023-define-extra-whitespace.c b/src/glsl/glcpp/tests/023-define-extra-whitespace.c new file mode 100644 index 0000000000..7ebfed6516 --- /dev/null +++ b/src/glsl/glcpp/tests/023-define-extra-whitespace.c @@ -0,0 +1,8 @@ +#define noargs() 1 +# define onearg(foo) foo + # define twoargs( x , y ) x y + # define threeargs( a , b , c ) a b c +noargs ( ) +onearg ( 2 ) +twoargs ( 3 , 4 ) +threeargs ( 5 , 6 , 7 ) diff --git a/src/glsl/glcpp/tests/023-define-extra-whitespace.c.expected b/src/glsl/glcpp/tests/023-define-extra-whitespace.c.expected new file mode 100644 index 0000000000..573829c2d6 --- /dev/null +++ b/src/glsl/glcpp/tests/023-define-extra-whitespace.c.expected @@ -0,0 +1,9 @@ + + + + +1 +2 +3 4 +5 6 7 + diff --git a/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c b/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c new file mode 100644 index 0000000000..e788adce30 --- /dev/null +++ b/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c @@ -0,0 +1,3 @@ +#define foo foo +#define bar foo +bar diff --git a/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected b/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected new file mode 100644 index 0000000000..ad955fce6e --- /dev/null +++ b/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected @@ -0,0 +1,4 @@ + + +foo + diff --git a/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c b/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c new file mode 100644 index 0000000000..b433671d1b --- /dev/null +++ b/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c @@ -0,0 +1,2 @@ +#define foo(bar) bar +foo bar diff --git a/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected b/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected new file mode 100644 index 0000000000..960f44511a --- /dev/null +++ b/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected @@ -0,0 +1,3 @@ + +foo bar + diff --git a/src/glsl/glcpp/tests/026-define-func-extra-newlines.c b/src/glsl/glcpp/tests/026-define-func-extra-newlines.c new file mode 100644 index 0000000000..0d83740530 --- /dev/null +++ b/src/glsl/glcpp/tests/026-define-func-extra-newlines.c @@ -0,0 +1,6 @@ +#define foo(a) bar + +foo +( +1 +) diff --git a/src/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected b/src/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected new file mode 100644 index 0000000000..f0888f21b9 --- /dev/null +++ b/src/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected @@ -0,0 +1,4 @@ + + +bar + diff --git a/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c b/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c new file mode 100644 index 0000000000..5ccb52caba --- /dev/null +++ b/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c @@ -0,0 +1,3 @@ +#define failure() success +#define foo failure() +foo diff --git a/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected b/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected new file mode 100644 index 0000000000..aef762e1e6 --- /dev/null +++ b/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected @@ -0,0 +1,4 @@ + + +success + diff --git a/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c b/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c new file mode 100644 index 0000000000..44962a7187 --- /dev/null +++ b/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c @@ -0,0 +1,3 @@ +#define success() failure +#define foo success +foo diff --git a/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected b/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected new file mode 100644 index 0000000000..aef762e1e6 --- /dev/null +++ b/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected @@ -0,0 +1,4 @@ + + +success + diff --git a/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c b/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c new file mode 100644 index 0000000000..261f7d28fc --- /dev/null +++ b/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c @@ -0,0 +1,3 @@ +#define bar(failure) failure +#define foo bar(success) +foo diff --git a/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected b/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected new file mode 100644 index 0000000000..aef762e1e6 --- /dev/null +++ b/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected @@ -0,0 +1,4 @@ + + +success + diff --git a/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c b/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c new file mode 100644 index 0000000000..e56fbefd62 --- /dev/null +++ b/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c @@ -0,0 +1,4 @@ +#define baz(failure) failure +#define bar(failure) failure +#define foo bar(baz(success)) +foo diff --git a/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected b/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected new file mode 100644 index 0000000000..729bdd15f8 --- /dev/null +++ b/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected @@ -0,0 +1,5 @@ + + + +success + diff --git a/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c b/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c new file mode 100644 index 0000000000..3f4c8744df --- /dev/null +++ b/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c @@ -0,0 +1,4 @@ +#define baz(failure) failure +#define bar(failure) failure +#define foo() bar(baz(success)) +foo() diff --git a/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected b/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected new file mode 100644 index 0000000000..729bdd15f8 --- /dev/null +++ b/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected @@ -0,0 +1,5 @@ + + + +success + diff --git a/src/glsl/glcpp/tests/032-define-func-self-recurse.c b/src/glsl/glcpp/tests/032-define-func-self-recurse.c new file mode 100644 index 0000000000..b3ac70f499 --- /dev/null +++ b/src/glsl/glcpp/tests/032-define-func-self-recurse.c @@ -0,0 +1,2 @@ +#define foo(a) foo(2*(a)) +foo(3) diff --git a/src/glsl/glcpp/tests/032-define-func-self-recurse.c.expected b/src/glsl/glcpp/tests/032-define-func-self-recurse.c.expected new file mode 100644 index 0000000000..541d44db7a --- /dev/null +++ b/src/glsl/glcpp/tests/032-define-func-self-recurse.c.expected @@ -0,0 +1,3 @@ + +foo(2*(3)) + diff --git a/src/glsl/glcpp/tests/033-define-func-self-compose.c b/src/glsl/glcpp/tests/033-define-func-self-compose.c new file mode 100644 index 0000000000..f65e48286c --- /dev/null +++ b/src/glsl/glcpp/tests/033-define-func-self-compose.c @@ -0,0 +1,2 @@ +#define foo(a) foo(2*(a)) +foo(foo(3)) diff --git a/src/glsl/glcpp/tests/033-define-func-self-compose.c.expected b/src/glsl/glcpp/tests/033-define-func-self-compose.c.expected new file mode 100644 index 0000000000..6ea6905d80 --- /dev/null +++ b/src/glsl/glcpp/tests/033-define-func-self-compose.c.expected @@ -0,0 +1,3 @@ + +foo(2*(foo(2*(3)))) + diff --git a/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c b/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c new file mode 100644 index 0000000000..209a5f7e07 --- /dev/null +++ b/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c @@ -0,0 +1,2 @@ +#define foo(bar) bar +foo(foo) diff --git a/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected b/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected new file mode 100644 index 0000000000..24823b1b67 --- /dev/null +++ b/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected @@ -0,0 +1,3 @@ + +foo + diff --git a/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c b/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c new file mode 100644 index 0000000000..c307fbe830 --- /dev/null +++ b/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c @@ -0,0 +1,2 @@ +#define foo(bar) bar +foo(1+foo) diff --git a/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected b/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected new file mode 100644 index 0000000000..137a9ea2db --- /dev/null +++ b/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected @@ -0,0 +1,3 @@ + +1+foo + diff --git a/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c b/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c new file mode 100644 index 0000000000..b21ff33673 --- /dev/null +++ b/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c @@ -0,0 +1,3 @@ +#define bar success +#define foo(x) x +foo(more bar) diff --git a/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected b/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected new file mode 100644 index 0000000000..ff6360bfe4 --- /dev/null +++ b/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected @@ -0,0 +1,4 @@ + + +more success + diff --git a/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c b/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c new file mode 100644 index 0000000000..b3a2f37f1b --- /dev/null +++ b/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c @@ -0,0 +1,3 @@ +#define expand(x) expand(x once) +#define foo(x) x +foo(expand(just)) diff --git a/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected b/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected new file mode 100644 index 0000000000..cbadee848a --- /dev/null +++ b/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected @@ -0,0 +1,4 @@ + + +expand(just once) + diff --git a/src/glsl/glcpp/tests/038-func-arg-with-commas.c b/src/glsl/glcpp/tests/038-func-arg-with-commas.c new file mode 100644 index 0000000000..1407c7d6e3 --- /dev/null +++ b/src/glsl/glcpp/tests/038-func-arg-with-commas.c @@ -0,0 +1,2 @@ +#define foo(x) success +foo(argument (with,embedded , commas) -- tricky) diff --git a/src/glsl/glcpp/tests/038-func-arg-with-commas.c.expected b/src/glsl/glcpp/tests/038-func-arg-with-commas.c.expected new file mode 100644 index 0000000000..5a28fb3b66 --- /dev/null +++ b/src/glsl/glcpp/tests/038-func-arg-with-commas.c.expected @@ -0,0 +1,3 @@ + +success + diff --git a/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c b/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c new file mode 100644 index 0000000000..0f7fe632b5 --- /dev/null +++ b/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c @@ -0,0 +1,3 @@ +#define foo(a) (a) +#define bar two,words +foo(bar) diff --git a/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected b/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected new file mode 100644 index 0000000000..b73869d023 --- /dev/null +++ b/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected @@ -0,0 +1,4 @@ + + +(two,words) + diff --git a/src/glsl/glcpp/tests/040-token-pasting.c b/src/glsl/glcpp/tests/040-token-pasting.c new file mode 100644 index 0000000000..caab3ba736 --- /dev/null +++ b/src/glsl/glcpp/tests/040-token-pasting.c @@ -0,0 +1,2 @@ +#define paste(a,b) a ## b +paste(one , token) diff --git a/src/glsl/glcpp/tests/040-token-pasting.c.expected b/src/glsl/glcpp/tests/040-token-pasting.c.expected new file mode 100644 index 0000000000..36f6699253 --- /dev/null +++ b/src/glsl/glcpp/tests/040-token-pasting.c.expected @@ -0,0 +1,3 @@ + +onetoken + diff --git a/src/glsl/glcpp/tests/041-if-0.c b/src/glsl/glcpp/tests/041-if-0.c new file mode 100644 index 0000000000..2cab677d3e --- /dev/null +++ b/src/glsl/glcpp/tests/041-if-0.c @@ -0,0 +1,5 @@ +success_1 +#if 0 +failure +#endif +success_2 diff --git a/src/glsl/glcpp/tests/041-if-0.c.expected b/src/glsl/glcpp/tests/041-if-0.c.expected new file mode 100644 index 0000000000..3800024c6f --- /dev/null +++ b/src/glsl/glcpp/tests/041-if-0.c.expected @@ -0,0 +1,6 @@ +success_1 + + + +success_2 + diff --git a/src/glsl/glcpp/tests/042-if-1.c b/src/glsl/glcpp/tests/042-if-1.c new file mode 100644 index 0000000000..874a25cf41 --- /dev/null +++ b/src/glsl/glcpp/tests/042-if-1.c @@ -0,0 +1,5 @@ +success_1 +#if 1 +success_2 +#endif +success_3 diff --git a/src/glsl/glcpp/tests/042-if-1.c.expected b/src/glsl/glcpp/tests/042-if-1.c.expected new file mode 100644 index 0000000000..e591044adb --- /dev/null +++ b/src/glsl/glcpp/tests/042-if-1.c.expected @@ -0,0 +1,6 @@ +success_1 + +success_2 + +success_3 + diff --git a/src/glsl/glcpp/tests/043-if-0-else.c b/src/glsl/glcpp/tests/043-if-0-else.c new file mode 100644 index 0000000000..323351f9db --- /dev/null +++ b/src/glsl/glcpp/tests/043-if-0-else.c @@ -0,0 +1,7 @@ +success_1 +#if 0 +failure +#else +success_2 +#endif +success_3 diff --git a/src/glsl/glcpp/tests/043-if-0-else.c.expected b/src/glsl/glcpp/tests/043-if-0-else.c.expected new file mode 100644 index 0000000000..ee9e677096 --- /dev/null +++ b/src/glsl/glcpp/tests/043-if-0-else.c.expected @@ -0,0 +1,8 @@ +success_1 + + + +success_2 + +success_3 + diff --git a/src/glsl/glcpp/tests/044-if-1-else.c b/src/glsl/glcpp/tests/044-if-1-else.c new file mode 100644 index 0000000000..28dfc25c6f --- /dev/null +++ b/src/glsl/glcpp/tests/044-if-1-else.c @@ -0,0 +1,7 @@ +success_1 +#if 1 +success_2 +#else +failure +#endif +success_3 diff --git a/src/glsl/glcpp/tests/044-if-1-else.c.expected b/src/glsl/glcpp/tests/044-if-1-else.c.expected new file mode 100644 index 0000000000..129f5c8542 --- /dev/null +++ b/src/glsl/glcpp/tests/044-if-1-else.c.expected @@ -0,0 +1,8 @@ +success_1 + +success_2 + + + +success_3 + diff --git a/src/glsl/glcpp/tests/045-if-0-elif.c b/src/glsl/glcpp/tests/045-if-0-elif.c new file mode 100644 index 0000000000..e50f686d46 --- /dev/null +++ b/src/glsl/glcpp/tests/045-if-0-elif.c @@ -0,0 +1,11 @@ +success_1 +#if 0 +failure_1 +#elif 0 +failure_2 +#elif 1 +success_3 +#elif 1 +failure_3 +#endif +success_4 diff --git a/src/glsl/glcpp/tests/045-if-0-elif.c.expected b/src/glsl/glcpp/tests/045-if-0-elif.c.expected new file mode 100644 index 0000000000..97a11b4472 --- /dev/null +++ b/src/glsl/glcpp/tests/045-if-0-elif.c.expected @@ -0,0 +1,12 @@ +success_1 + + + + + +success_3 + + + +success_4 + diff --git a/src/glsl/glcpp/tests/046-if-1-elsif.c b/src/glsl/glcpp/tests/046-if-1-elsif.c new file mode 100644 index 0000000000..130515a01e --- /dev/null +++ b/src/glsl/glcpp/tests/046-if-1-elsif.c @@ -0,0 +1,11 @@ +success_1 +#if 1 +success_2 +#elif 0 +failure_1 +#elif 1 +failure_2 +#elif 0 +failure_3 +#endif +success_3 diff --git a/src/glsl/glcpp/tests/046-if-1-elsif.c.expected b/src/glsl/glcpp/tests/046-if-1-elsif.c.expected new file mode 100644 index 0000000000..b928b917e3 --- /dev/null +++ b/src/glsl/glcpp/tests/046-if-1-elsif.c.expected @@ -0,0 +1,12 @@ +success_1 + +success_2 + + + + + + + +success_3 + diff --git a/src/glsl/glcpp/tests/047-if-elif-else.c b/src/glsl/glcpp/tests/047-if-elif-else.c new file mode 100644 index 0000000000..e8f0838a9e --- /dev/null +++ b/src/glsl/glcpp/tests/047-if-elif-else.c @@ -0,0 +1,11 @@ +success_1 +#if 0 +failure_1 +#elif 0 +failure_2 +#elif 0 +failure_3 +#else +success_2 +#endif +success_3 diff --git a/src/glsl/glcpp/tests/047-if-elif-else.c.expected b/src/glsl/glcpp/tests/047-if-elif-else.c.expected new file mode 100644 index 0000000000..e5b53a3fa5 --- /dev/null +++ b/src/glsl/glcpp/tests/047-if-elif-else.c.expected @@ -0,0 +1,12 @@ +success_1 + + + + + + + +success_2 + +success_3 + diff --git a/src/glsl/glcpp/tests/048-if-nested.c b/src/glsl/glcpp/tests/048-if-nested.c new file mode 100644 index 0000000000..fc4679c3be --- /dev/null +++ b/src/glsl/glcpp/tests/048-if-nested.c @@ -0,0 +1,11 @@ +success_1 +#if 0 +failure_1 +#if 1 +failure_2 +#else +failure_3 +#endif +failure_4 +#endif +success_2 diff --git a/src/glsl/glcpp/tests/048-if-nested.c.expected b/src/glsl/glcpp/tests/048-if-nested.c.expected new file mode 100644 index 0000000000..c61fd0b315 --- /dev/null +++ b/src/glsl/glcpp/tests/048-if-nested.c.expected @@ -0,0 +1,12 @@ +success_1 + + + + + + + + + +success_2 + diff --git a/src/glsl/glcpp/tests/049-if-expression-precedence.c b/src/glsl/glcpp/tests/049-if-expression-precedence.c new file mode 100644 index 0000000000..833ea03882 --- /dev/null +++ b/src/glsl/glcpp/tests/049-if-expression-precedence.c @@ -0,0 +1,5 @@ +#if 1 + 2 * 3 + - (25 % 17 - + 1) +failure with operator precedence +#else +success +#endif diff --git a/src/glsl/glcpp/tests/049-if-expression-precedence.c.expected b/src/glsl/glcpp/tests/049-if-expression-precedence.c.expected new file mode 100644 index 0000000000..569debb0bb --- /dev/null +++ b/src/glsl/glcpp/tests/049-if-expression-precedence.c.expected @@ -0,0 +1,6 @@ + + + +success + + diff --git a/src/glsl/glcpp/tests/050-if-defined.c b/src/glsl/glcpp/tests/050-if-defined.c new file mode 100644 index 0000000000..34f0f95140 --- /dev/null +++ b/src/glsl/glcpp/tests/050-if-defined.c @@ -0,0 +1,17 @@ +#if defined foo +failure_1 +#else +success_1 +#endif +#define foo +#if defined foo +success_2 +#else +failure_2 +#endif +#undef foo +#if defined foo +failure_3 +#else +success_3 +#endif diff --git a/src/glsl/glcpp/tests/050-if-defined.c.expected b/src/glsl/glcpp/tests/050-if-defined.c.expected new file mode 100644 index 0000000000..3f01955ee4 --- /dev/null +++ b/src/glsl/glcpp/tests/050-if-defined.c.expected @@ -0,0 +1,18 @@ + + + +success_1 + + + +success_2 + + + + + + + +success_3 + + diff --git a/src/glsl/glcpp/tests/051-if-relational.c b/src/glsl/glcpp/tests/051-if-relational.c new file mode 100644 index 0000000000..c3db488e0d --- /dev/null +++ b/src/glsl/glcpp/tests/051-if-relational.c @@ -0,0 +1,35 @@ +#if 3 < 2 +failure_1 +#else +success_1 +#endif + +#if 3 >= 2 +success_2 +#else +failure_2 +#endif + +#if 2 + 3 <= 5 +success_3 +#else +failure_3 +#endif + +#if 3 - 2 == 1 +success_3 +#else +failure_3 +#endif + +#if 1 > 3 +failure_4 +#else +success_4 +#endif + +#if 1 != 5 +success_5 +#else +failure_5 +#endif diff --git a/src/glsl/glcpp/tests/051-if-relational.c.expected b/src/glsl/glcpp/tests/051-if-relational.c.expected new file mode 100644 index 0000000000..d2b76f1457 --- /dev/null +++ b/src/glsl/glcpp/tests/051-if-relational.c.expected @@ -0,0 +1,36 @@ + + + +success_1 + + + +success_2 + + + + + +success_3 + + + + + +success_3 + + + + + + + +success_4 + + + +success_5 + + + + diff --git a/src/glsl/glcpp/tests/052-if-bitwise.c b/src/glsl/glcpp/tests/052-if-bitwise.c new file mode 100644 index 0000000000..2d8e45eb61 --- /dev/null +++ b/src/glsl/glcpp/tests/052-if-bitwise.c @@ -0,0 +1,20 @@ +#if (0xaaaaaaaa | 0x55555555) != 4294967295 +failure_1 +#else +success_1 +#endif +#if (0x12345678 ^ 0xfdecba98) == 4023971040 +success_2 +#else +failure_2 +#endif +#if (~ 0xdeadbeef) != -3735928560 +failure_3 +#else +success_3 +#endif +#if (0667 & 0733) == 403 +success_4 +#else +failure_4 +#endif diff --git a/src/glsl/glcpp/tests/052-if-bitwise.c.expected b/src/glsl/glcpp/tests/052-if-bitwise.c.expected new file mode 100644 index 0000000000..bb5d92e8d9 --- /dev/null +++ b/src/glsl/glcpp/tests/052-if-bitwise.c.expected @@ -0,0 +1,21 @@ + + + +success_1 + + +success_2 + + + + + + +success_3 + + +success_4 + + + + diff --git a/src/glsl/glcpp/tests/053-if-divide-and-shift.c b/src/glsl/glcpp/tests/053-if-divide-and-shift.c new file mode 100644 index 0000000000..d24c54a88d --- /dev/null +++ b/src/glsl/glcpp/tests/053-if-divide-and-shift.c @@ -0,0 +1,15 @@ +#if (15 / 2) != 7 +failure_1 +#else +success_1 +#endif +#if (1 << 12) == 4096 +success_2 +#else +failure_2 +#endif +#if (31762 >> 8) != 124 +failure_3 +#else +success_3 +#endif diff --git a/src/glsl/glcpp/tests/053-if-divide-and-shift.c.expected b/src/glsl/glcpp/tests/053-if-divide-and-shift.c.expected new file mode 100644 index 0000000000..f97e93673c --- /dev/null +++ b/src/glsl/glcpp/tests/053-if-divide-and-shift.c.expected @@ -0,0 +1,16 @@ + + + +success_1 + + +success_2 + + + + + + +success_3 + + diff --git a/src/glsl/glcpp/tests/054-if-with-macros.c b/src/glsl/glcpp/tests/054-if-with-macros.c new file mode 100644 index 0000000000..3da79a0d96 --- /dev/null +++ b/src/glsl/glcpp/tests/054-if-with-macros.c @@ -0,0 +1,34 @@ +#define one 1 +#define two 2 +#define three 3 +#define five 5 +#if five < two +failure_1 +#else +success_1 +#endif +#if three >= two +success_2 +#else +failure_2 +#endif +#if two + three <= five +success_3 +#else +failure_3 +#endif +#if five - two == three +success_4 +#else +failure_4 +#endif +#if one > three +failure_5 +#else +success_5 +#endif +#if one != five +success_6 +#else +failure_6 +#endif diff --git a/src/glsl/glcpp/tests/054-if-with-macros.c.expected b/src/glsl/glcpp/tests/054-if-with-macros.c.expected new file mode 100644 index 0000000000..27ea496962 --- /dev/null +++ b/src/glsl/glcpp/tests/054-if-with-macros.c.expected @@ -0,0 +1,35 @@ + + + + + + + +success_1 + + +success_2 + + + + +success_3 + + + + +success_4 + + + + + + +success_5 + + +success_6 + + + + diff --git a/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c b/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c new file mode 100644 index 0000000000..00f2c2346d --- /dev/null +++ b/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c @@ -0,0 +1,3 @@ +#define failure() success +#define foo failure +foo() diff --git a/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected b/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected new file mode 100644 index 0000000000..aef762e1e6 --- /dev/null +++ b/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected @@ -0,0 +1,4 @@ + + +success + diff --git a/src/glsl/glcpp/tests/056-macro-argument-with-comma.c b/src/glsl/glcpp/tests/056-macro-argument-with-comma.c new file mode 100644 index 0000000000..58701d1f25 --- /dev/null +++ b/src/glsl/glcpp/tests/056-macro-argument-with-comma.c @@ -0,0 +1,4 @@ +#define bar with,embedded,commas +#define function(x) success +#define foo function +foo(bar) diff --git a/src/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected b/src/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected new file mode 100644 index 0000000000..729bdd15f8 --- /dev/null +++ b/src/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected @@ -0,0 +1,5 @@ + + + +success + diff --git a/src/glsl/glcpp/tests/057-empty-arguments.c b/src/glsl/glcpp/tests/057-empty-arguments.c new file mode 100644 index 0000000000..6140232865 --- /dev/null +++ b/src/glsl/glcpp/tests/057-empty-arguments.c @@ -0,0 +1,6 @@ +#define zero() success +zero() +#define one(x) success +one() +#define two(x,y) success +two(,) diff --git a/src/glsl/glcpp/tests/057-empty-arguments.c.expected b/src/glsl/glcpp/tests/057-empty-arguments.c.expected new file mode 100644 index 0000000000..4e3aad5217 --- /dev/null +++ b/src/glsl/glcpp/tests/057-empty-arguments.c.expected @@ -0,0 +1,7 @@ + +success + +success + +success + diff --git a/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c b/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c new file mode 100644 index 0000000000..8ac260c76b --- /dev/null +++ b/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c @@ -0,0 +1,5 @@ +#define paste(x,y) x ## y +paste(a,b) +paste(a,) +paste(,b) +paste(,) diff --git a/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected b/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected new file mode 100644 index 0000000000..a1c34e5c1f --- /dev/null +++ b/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected @@ -0,0 +1,6 @@ + +ab +a +b + + diff --git a/src/glsl/glcpp/tests/059-token-pasting-integer.c b/src/glsl/glcpp/tests/059-token-pasting-integer.c new file mode 100644 index 0000000000..37b895a423 --- /dev/null +++ b/src/glsl/glcpp/tests/059-token-pasting-integer.c @@ -0,0 +1,4 @@ +#define paste(x,y) x ## y +paste(1,2) +paste(1,000) +paste(identifier,2) diff --git a/src/glsl/glcpp/tests/059-token-pasting-integer.c.expected b/src/glsl/glcpp/tests/059-token-pasting-integer.c.expected new file mode 100644 index 0000000000..f1a2cd21c1 --- /dev/null +++ b/src/glsl/glcpp/tests/059-token-pasting-integer.c.expected @@ -0,0 +1,5 @@ + +12 +1000 +identifier2 + diff --git a/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c b/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c new file mode 100644 index 0000000000..ed80ea879c --- /dev/null +++ b/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c @@ -0,0 +1,3 @@ +#define double(a) a*2 +#define foo double( +foo 5) diff --git a/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected b/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected new file mode 100644 index 0000000000..c1f0d24a14 --- /dev/null +++ b/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected @@ -0,0 +1,4 @@ + + +5*2 + diff --git a/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c b/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c new file mode 100644 index 0000000000..6dbfd1f62d --- /dev/null +++ b/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c @@ -0,0 +1,5 @@ +#define foo(x) success +#define bar foo +#define baz bar +#define joe baz +joe (failure) diff --git a/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected b/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected new file mode 100644 index 0000000000..111f7d1063 --- /dev/null +++ b/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected @@ -0,0 +1,6 @@ + + + + +success + diff --git a/src/glsl/glcpp/tests/062-if-0-skips-garbage.c b/src/glsl/glcpp/tests/062-if-0-skips-garbage.c new file mode 100644 index 0000000000..d9e439bb89 --- /dev/null +++ b/src/glsl/glcpp/tests/062-if-0-skips-garbage.c @@ -0,0 +1,5 @@ +#define foo(a,b) +#if 0 +foo(bar) +foo( +#endif diff --git a/src/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected b/src/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected new file mode 100644 index 0000000000..6fb66a5e2f --- /dev/null +++ b/src/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/glsl/glcpp/tests/063-comments.c b/src/glsl/glcpp/tests/063-comments.c new file mode 100644 index 0000000000..e641d2f0f9 --- /dev/null +++ b/src/glsl/glcpp/tests/063-comments.c @@ -0,0 +1,20 @@ +/* this is a comment */ +// so is this +// */ +f = g/**//h; +/*//*/l(); +m = n//**/o ++ p; +/* this +comment spans +multiple lines and +contains *** stars +and slashes / *** / +and other stuff. +****/ +more code here +/* Test that /* nested + comments */ +are not treated like comments. +/*/ this is a comment */ +/*/*/ diff --git a/src/glsl/glcpp/tests/063-comments.c.expected b/src/glsl/glcpp/tests/063-comments.c.expected new file mode 100644 index 0000000000..ed4feedd45 --- /dev/null +++ b/src/glsl/glcpp/tests/063-comments.c.expected @@ -0,0 +1,14 @@ + + + +f = g /h; + l(); +m = n ++ p; + +more code here + +are not treated like comments. + + + diff --git a/src/glsl/glcpp/tests/064-version.c b/src/glsl/glcpp/tests/064-version.c new file mode 100644 index 0000000000..21326481b8 --- /dev/null +++ b/src/glsl/glcpp/tests/064-version.c @@ -0,0 +1,2 @@ +#version 130 +#define FOO diff --git a/src/glsl/glcpp/tests/064-version.c.expected b/src/glsl/glcpp/tests/064-version.c.expected new file mode 100644 index 0000000000..3af71113c8 --- /dev/null +++ b/src/glsl/glcpp/tests/064-version.c.expected @@ -0,0 +1,3 @@ +#version 130 + + diff --git a/src/glsl/glcpp/tests/065-if-defined-parens.c b/src/glsl/glcpp/tests/065-if-defined-parens.c new file mode 100644 index 0000000000..48aa0f8c3e --- /dev/null +++ b/src/glsl/glcpp/tests/065-if-defined-parens.c @@ -0,0 +1,17 @@ +#if defined(foo) +failure_1 +#else +success_1 +#endif +#define foo +#if defined ( foo ) +success_2 +#else +failure_2 +#endif +#undef foo +#if defined (foo) +failure_3 +#else +success_3 +#endif diff --git a/src/glsl/glcpp/tests/065-if-defined-parens.c.expected b/src/glsl/glcpp/tests/065-if-defined-parens.c.expected new file mode 100644 index 0000000000..3f01955ee4 --- /dev/null +++ b/src/glsl/glcpp/tests/065-if-defined-parens.c.expected @@ -0,0 +1,18 @@ + + + +success_1 + + + +success_2 + + + + + + + +success_3 + + diff --git a/src/glsl/glcpp/tests/071-punctuator.c b/src/glsl/glcpp/tests/071-punctuator.c new file mode 100644 index 0000000000..959d682598 --- /dev/null +++ b/src/glsl/glcpp/tests/071-punctuator.c @@ -0,0 +1 @@ +a = b diff --git a/src/glsl/glcpp/tests/071-punctuator.c.expected b/src/glsl/glcpp/tests/071-punctuator.c.expected new file mode 100644 index 0000000000..fee253b745 --- /dev/null +++ b/src/glsl/glcpp/tests/071-punctuator.c.expected @@ -0,0 +1,2 @@ +a = b + diff --git a/src/glsl/glcpp/tests/072-token-pasting-same-line.c b/src/glsl/glcpp/tests/072-token-pasting-same-line.c new file mode 100644 index 0000000000..e421e9d5e2 --- /dev/null +++ b/src/glsl/glcpp/tests/072-token-pasting-same-line.c @@ -0,0 +1,2 @@ +#define paste(x) success_ ## x +paste(1) paste(2) paste(3) diff --git a/src/glsl/glcpp/tests/072-token-pasting-same-line.c.expected b/src/glsl/glcpp/tests/072-token-pasting-same-line.c.expected new file mode 100644 index 0000000000..c780b43d70 --- /dev/null +++ b/src/glsl/glcpp/tests/072-token-pasting-same-line.c.expected @@ -0,0 +1,3 @@ + +success_1 success_2 success_3 + diff --git a/src/glsl/glcpp/tests/099-c99-example.c b/src/glsl/glcpp/tests/099-c99-example.c new file mode 100644 index 0000000000..d1976b1f26 --- /dev/null +++ b/src/glsl/glcpp/tests/099-c99-example.c @@ -0,0 +1,17 @@ +#define x 3 +#define f(a) f(x * (a)) +#undef x +#define x 2 +#define g f +#define z z[0] +#define h g(~ +#define m(a) a(w) +#define w 0,1 +#define t(a) a +#define p() int +#define q(x) x +#define r(x,y) x ## y +f(y+1) + f(f(z)) % t(t(g)(0) + t)(1); +g(x +(3,4)-w) | h 5) & m + (f)^m(m); +p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,)}; diff --git a/src/glsl/glcpp/tests/099-c99-example.c.expected b/src/glsl/glcpp/tests/099-c99-example.c.expected new file mode 100644 index 0000000000..19be750555 --- /dev/null +++ b/src/glsl/glcpp/tests/099-c99-example.c.expected @@ -0,0 +1,17 @@ + + + + + + + + + + + + + +f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1); +f(2 * (2 +(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1); +int i[] = { 1, 23, 4, 5, }; + diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test new file mode 100755 index 0000000000..396f6e175e --- /dev/null +++ b/src/glsl/glcpp/tests/glcpp-test @@ -0,0 +1,7 @@ +#!/bin/sh + +for test in *.c; do + echo "Testing $test" + ../glcpp < $test > $test.out + diff -u $test.expected $test.out +done -- cgit v1.2.3 From 3a530b8ef68a40526b33de2af8de85f71ebdb30d Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 19 Jul 2010 17:48:17 -0700 Subject: glcpp: Make test suite report final count of passed/total tests. And report PASS or FAIL for each test along the way as well. --- src/glsl/glcpp/tests/glcpp-test | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test index 396f6e175e..8277719715 100755 --- a/src/glsl/glcpp/tests/glcpp-test +++ b/src/glsl/glcpp/tests/glcpp-test @@ -1,7 +1,27 @@ #!/bin/sh +total=0 +pass=0 + for test in *.c; do - echo "Testing $test" + echo -n "Testing $test..." ../glcpp < $test > $test.out - diff -u $test.expected $test.out + total=$((total+1)) + if cmp $test.expected $test.out; then + echo "PASS" + pass=$((pass+1)) + else + echo "FAIL" + diff -u $test.expected $test.out + fi done + +echo "$pass/$total tests returned correct results" +echo "" + +if [ "$pass" = "$total" ] ; then + exit 0 +else + exit 1 +fi + -- cgit v1.2.3 From d1500f8a195b7afe871cd768a5d33ecfecad5f31 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 19 Jul 2010 17:49:23 -0700 Subject: glcpp: Make test suite test for valgrind cleanliness. As it turns out, 4 of our current tests are not valgrind clean, (use after free errors or so), so this will be helpful for investigating and fixing those. --- src/glsl/glcpp/tests/glcpp-test | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test index 8277719715..cfe7e97878 100755 --- a/src/glsl/glcpp/tests/glcpp-test +++ b/src/glsl/glcpp/tests/glcpp-test @@ -2,7 +2,9 @@ total=0 pass=0 +clean=0 +echo "====== Testing for correctness ======" for test in *.c; do echo -n "Testing $test..." ../glcpp < $test > $test.out @@ -16,10 +18,28 @@ for test in *.c; do fi done +echo "" echo "$pass/$total tests returned correct results" echo "" -if [ "$pass" = "$total" ] ; then +echo "====== Testing for valgrind cleanliness ======" +for test in *.c; do + echo -n "Testing $test with valgrind..." + if valgrind --error-exitcode=1 --log-file=$test.valgrind-errors ../glcpp < $test >/dev/null; then + echo "CLEAN" + clean=$((clean+1)) + rm $test.valgrind-errors + else + echo "ERRORS" + cat $test.valgrind-errors + fi +done + +echo "" +echo "$pass/$total tests returned correct results" +echo "$clean/$total tests are valgrind-clean" + +if [ "$pass" = "$total" ] && [ "$clean" = "$total" ]; then exit 0 else exit 1 -- cgit v1.2.3 From 17f9beb6c313b41ca08984add7b76ecb84a7339e Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 20 Jul 2010 13:16:17 -0700 Subject: glcpp: Support #if(expression) with no intervening space. And add a test case to ensure that this works. --- src/glsl/glcpp/glcpp-lex.l | 2 +- src/glsl/glcpp/tests/066-if-nospace-expression.c | 3 +++ src/glsl/glcpp/tests/066-if-nospace-expression.c.expected | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/glsl/glcpp/tests/066-if-nospace-expression.c create mode 100644 src/glsl/glcpp/tests/066-if-nospace-expression.c.expected (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index 53e85556c1..a81c8f92c1 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -99,7 +99,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? return HASH_IFNDEF; } -{HASH}if{HSPACE}/.*\n { +{HASH}if{HSPACE}*/[^_a-zA-Z0-9].*\n { yyextra->lexing_if = 1; yyextra->space_tokens = 0; return HASH_IF; diff --git a/src/glsl/glcpp/tests/066-if-nospace-expression.c b/src/glsl/glcpp/tests/066-if-nospace-expression.c new file mode 100644 index 0000000000..3b0b47349d --- /dev/null +++ b/src/glsl/glcpp/tests/066-if-nospace-expression.c @@ -0,0 +1,3 @@ +#if(1) +success +#endif diff --git a/src/glsl/glcpp/tests/066-if-nospace-expression.c.expected b/src/glsl/glcpp/tests/066-if-nospace-expression.c.expected new file mode 100644 index 0000000000..0e84a7cda3 --- /dev/null +++ b/src/glsl/glcpp/tests/066-if-nospace-expression.c.expected @@ -0,0 +1,4 @@ + +success + + -- cgit v1.2.3 From 1d7e03e48e87328ce0081021dde133921b78b406 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 20 Jul 2010 14:13:32 -0700 Subject: glcpp: Fix support for nested #ifdef and nested #ifndef Previously, if the outer #ifdef/#ifndef evaluated to false, the inner directive would not be parsed correctly, (the identifier as the subject of the #ifdef/#ifndef would inadvertently be skipped along with the other content correctly being skipped). We fix this by setting the lexing_if state in each case here. We also add a new test to the test suite to ensure that this case is tested. --- src/glsl/glcpp/glcpp-lex.l | 6 ++-- src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c | 40 +++++++++++++++++++++ .../glcpp/tests/067-nested-ifdef-ifndef.c.expected | 41 ++++++++++++++++++++++ 3 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c create mode 100644 src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index a81c8f92c1..6773832f29 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -90,16 +90,18 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } {HASH}ifdef/.*\n { + yyextra->lexing_if = 1; yyextra->space_tokens = 0; return HASH_IFDEF; } {HASH}ifndef/.*\n { + yyextra->lexing_if = 1; yyextra->space_tokens = 0; return HASH_IFNDEF; } -{HASH}if{HSPACE}*/[^_a-zA-Z0-9].*\n { +{HASH}if/[^_a-zA-Z0-9].*\n { yyextra->lexing_if = 1; yyextra->space_tokens = 0; return HASH_IF; @@ -122,7 +124,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } /* When skipping (due to an #if 0 or similar) consume anything - * up to a newline. We do this less priroty than any + * up to a newline. We do this with less priority than any * #if-related directive (#if, #elif, #else, #endif), but with * more priority than any other directive or token to avoid * any side-effects from skipped content. diff --git a/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c b/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c new file mode 100644 index 0000000000..f46cce4e60 --- /dev/null +++ b/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c @@ -0,0 +1,40 @@ +#define D1 +#define D2 + +#define result success + +#ifdef U1 +#ifdef U2 +#undef result +#define result failure +#endif +#endif +result + +#ifndef D1 +#ifndef D2 +#undef result +#define result failure +#endif +#endif +result + +#undef result +#define result failure +#ifdef D1 +#ifdef D2 +#undef result +#define result success +#endif +#endif +result + +#undef result +#define result failure +#ifndef U1 +#ifndef U2 +#undef result +#define result success +#endif +#endif +result diff --git a/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected b/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected new file mode 100644 index 0000000000..3340daaa1f --- /dev/null +++ b/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected @@ -0,0 +1,41 @@ + + + + + + + + + + + +success + + + + + + + +success + + + + + + + + + +success + + + + + + + + + +success + -- cgit v1.2.3 From e1acbfca322c4ac720707ec8d3fda08fab65a30b Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 20 Jul 2010 16:44:03 -0700 Subject: glcpp: Avoid accidental token pasting in preprocessed result. Consider this test case: #define EMPTY int foo = 1+EMPTY+4; The expression should compile as the sequence of tokens 1, PLUS, UNARY_POSITIVE, 4. But glcpp has been failing for this case since it results in the string "1++4" which a compiler correctly sees as a syntax error, (1, POST_INCREMENT, 4). We fix this by changing any macro with an empty definition to result in a single SPACE token rather than nothing. This then gives "1+ +4" which compiles correctly. This commit does touch up the two existing test cases which already have empty macros, (to add the space to the expected result). It also adds a new test case to exercise the above scenario. --- src/glsl/glcpp/glcpp-parse.y | 21 ++++++++++++++++++--- src/glsl/glcpp/tests/008-define-empty.c.expected | 2 +- .../glcpp/tests/011-define-func-empty.c.expected | 2 +- src/glsl/glcpp/tests/068-accidental-pasting.c | 11 +++++++++++ .../glcpp/tests/068-accidental-pasting.c.expected | 12 ++++++++++++ 5 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 src/glsl/glcpp/tests/068-accidental-pasting.c create mode 100644 src/glsl/glcpp/tests/068-accidental-pasting.c.expected (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index c37c9bcff0..e4dcc76e0a 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -1048,6 +1048,19 @@ _arguments_parse (argument_list_t *arguments, return FUNCTION_STATUS_SUCCESS; } +static token_list_t * +_token_list_create_with_one_space (void *ctx) +{ + token_list_t *list; + token_t *space; + + list = _token_list_create (ctx); + space = _token_create_ival (list, SPACE, SPACE); + _token_list_append (list, space); + + return list; +} + /* This is a helper function that's essentially part of the * implementation of _glcpp_parser_expand_node. It shouldn't be called * except for by that function. @@ -1097,9 +1110,10 @@ _glcpp_parser_expand_function (glcpp_parser_t *parser, return NULL; } + /* Replace a macro defined as empty with a SPACE token. */ if (macro->replacements == NULL) { talloc_free (arguments); - return _token_list_create (parser); + return _token_list_create_with_one_space (parser); } if (! ((_argument_list_length (arguments) == @@ -1203,7 +1217,7 @@ _glcpp_parser_expand_function (glcpp_parser_t *parser, * * Otherwise, returns the token list that results from the expansion * and sets *last to the last node in the list that was consumed by - * the expansion. Specificallty, *last will be set as follows: + * the expansion. Specifically, *last will be set as follows: * * As 'node' in the case of object-like macro expansion. * @@ -1262,8 +1276,9 @@ _glcpp_parser_expand_node (glcpp_parser_t *parser, { *last = node; + /* Replace a macro defined as empty with a SPACE token. */ if (macro->replacements == NULL) - return _token_list_create (parser); + return _token_list_create_with_one_space (parser); return _token_list_copy (parser, macro->replacements); } diff --git a/src/glsl/glcpp/tests/008-define-empty.c.expected b/src/glsl/glcpp/tests/008-define-empty.c.expected index b28b04f643..c0f53d75c7 100644 --- a/src/glsl/glcpp/tests/008-define-empty.c.expected +++ b/src/glsl/glcpp/tests/008-define-empty.c.expected @@ -1,3 +1,3 @@ - + diff --git a/src/glsl/glcpp/tests/011-define-func-empty.c.expected b/src/glsl/glcpp/tests/011-define-func-empty.c.expected index b28b04f643..c0f53d75c7 100644 --- a/src/glsl/glcpp/tests/011-define-func-empty.c.expected +++ b/src/glsl/glcpp/tests/011-define-func-empty.c.expected @@ -1,3 +1,3 @@ - + diff --git a/src/glsl/glcpp/tests/068-accidental-pasting.c b/src/glsl/glcpp/tests/068-accidental-pasting.c new file mode 100644 index 0000000000..699ac5144e --- /dev/null +++ b/src/glsl/glcpp/tests/068-accidental-pasting.c @@ -0,0 +1,11 @@ +#define empty +empty> +>empty= +=empty= +!empty= +&empty& +|empty| ++empty+ +-empty- diff --git a/src/glsl/glcpp/tests/068-accidental-pasting.c.expected b/src/glsl/glcpp/tests/068-accidental-pasting.c.expected new file mode 100644 index 0000000000..ce41cd6e52 --- /dev/null +++ b/src/glsl/glcpp/tests/068-accidental-pasting.c.expected @@ -0,0 +1,12 @@ + +< < +< = +> > +> = += = +! = +& & +| | ++ + +- - + -- cgit v1.2.3 From fbe4240626bfe102a9c4c889ee18cb9ea27bddec Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 22 Jul 2010 16:36:04 -0700 Subject: glcpp: Fix function-like macros with an argument used multiple times. It's really hard to believe that this case has been broken, but apparently no test previously exercised it. So this commit adds such a test and fixes it by making a copy of the argument token-list before expanding it. This fix causes the following glean tests to now pass: glsl1-Preprocessor test 6 (#if 0, #define macro) glsl1-Preprocessor test 7 (multi-line #define) --- src/glsl/glcpp/glcpp-parse.y | 10 +++++++--- src/glsl/glcpp/tests/069-repeated-argument.c | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 src/glsl/glcpp/tests/069-repeated-argument.c (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index e4dcc76e0a..5b7467836d 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -1075,7 +1075,7 @@ _token_list_create_with_one_space (void *ctx) * * Returns the token list that results from the expansion and sets * *last to the last node in the list that was consumed by the - * expansion. Specificallty, *last will be set as follows: as the + * expansion. Specifically, *last will be set as follows: as the * token of the closing right parenthesis. */ static token_list_t * @@ -1147,9 +1147,13 @@ _glcpp_parser_expand_function (glcpp_parser_t *parser, * tokens, or append a placeholder token for * an empty argument. */ if (argument->head) { + token_list_t *expanded_argument; + expanded_argument = _token_list_copy (parser, + argument); _glcpp_parser_expand_token_list (parser, - argument); - _token_list_append_list (substituted, argument); + expanded_argument); + _token_list_append_list (substituted, + expanded_argument); } else { token_t *new_token; diff --git a/src/glsl/glcpp/tests/069-repeated-argument.c b/src/glsl/glcpp/tests/069-repeated-argument.c new file mode 100644 index 0000000000..2b46ead294 --- /dev/null +++ b/src/glsl/glcpp/tests/069-repeated-argument.c @@ -0,0 +1,2 @@ +#define double(x) x x +double(1) -- cgit v1.2.3 From 279cc22dbc297b32ddc7301ed1790336cd1038ae Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 28 Jul 2010 12:19:44 -0700 Subject: glcpp: Add expected output for a recently-added test. I simply forgot to add this file when adding the test case originally. --- src/glsl/glcpp/tests/069-repeated-argument.c.expected | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/glsl/glcpp/tests/069-repeated-argument.c.expected (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/069-repeated-argument.c.expected b/src/glsl/glcpp/tests/069-repeated-argument.c.expected new file mode 100644 index 0000000000..755c4d4b56 --- /dev/null +++ b/src/glsl/glcpp/tests/069-repeated-argument.c.expected @@ -0,0 +1,3 @@ + +1 1 + -- cgit v1.2.3 From 93b10bd353e98670b627873e1da130c789646a4e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 1 Aug 2010 11:40:07 -0700 Subject: glcpp: Add a testcase for the failure in compiling xonotic's shader. gcc and mesa master agree that this is OK. --- src/glsl/glcpp/tests/073-if-in-ifdef.c | 4 ++++ src/glsl/glcpp/tests/073-if-in-ifdef.c.expected | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 src/glsl/glcpp/tests/073-if-in-ifdef.c create mode 100644 src/glsl/glcpp/tests/073-if-in-ifdef.c.expected (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/073-if-in-ifdef.c b/src/glsl/glcpp/tests/073-if-in-ifdef.c new file mode 100644 index 0000000000..b9155b521e --- /dev/null +++ b/src/glsl/glcpp/tests/073-if-in-ifdef.c @@ -0,0 +1,4 @@ +#if UNDEF +#if UNDEF > 1 +#endif +#endif diff --git a/src/glsl/glcpp/tests/073-if-in-ifdef.c.expected b/src/glsl/glcpp/tests/073-if-in-ifdef.c.expected new file mode 100644 index 0000000000..3f2ff2d6cc --- /dev/null +++ b/src/glsl/glcpp/tests/073-if-in-ifdef.c.expected @@ -0,0 +1,5 @@ + + + + + -- cgit v1.2.3 From c52b2be16689fbbe8a8ec190dbe9dc7e469956a0 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 4 Aug 2010 16:21:33 -0700 Subject: glcpp/tests: Fix 073-if-in-ifdef.c to use #ifdef, not #if. The original intention was to use #ifdef. --- src/glsl/glcpp/tests/073-if-in-ifdef.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/073-if-in-ifdef.c b/src/glsl/glcpp/tests/073-if-in-ifdef.c index b9155b521e..61a48097ca 100644 --- a/src/glsl/glcpp/tests/073-if-in-ifdef.c +++ b/src/glsl/glcpp/tests/073-if-in-ifdef.c @@ -1,4 +1,4 @@ -#if UNDEF +#ifdef UNDEF #if UNDEF > 1 #endif #endif -- cgit v1.2.3 From d65135a7661c320c618151df0a94c852dc9bc621 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 4 Aug 2010 16:22:31 -0700 Subject: glcpp/tests: Add a corollary to testcase 073 for testing #elif. --- src/glsl/glcpp/tests/074-elif-undef.c | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/glsl/glcpp/tests/074-elif-undef.c (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/074-elif-undef.c b/src/glsl/glcpp/tests/074-elif-undef.c new file mode 100644 index 0000000000..67aac8977e --- /dev/null +++ b/src/glsl/glcpp/tests/074-elif-undef.c @@ -0,0 +1,3 @@ +#ifndef UNDEF +#elif UNDEF < 0 +#endif -- cgit v1.2.3 From 4f9a64407c948a7a46d23e8d4f7caae6d0e83232 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 10 Aug 2010 18:25:30 -0700 Subject: glcpp: Fix expected result for the 064-version.c test. Commit d4a04f315560704bf1103df0b93723e468725df7 caused this test case to produce an additional blank line, which is otherwise harmless, but does need to be reflected in the .expected file for the test to pass. --- src/glsl/glcpp/tests/064-version.c.expected | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/064-version.c.expected b/src/glsl/glcpp/tests/064-version.c.expected index 3af71113c8..1c53467270 100644 --- a/src/glsl/glcpp/tests/064-version.c.expected +++ b/src/glsl/glcpp/tests/064-version.c.expected @@ -1,3 +1,4 @@ #version 130 + -- cgit v1.2.3 From 9b7fd2099f926b9cc187382ca75eb8dedf3d37ca Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 10 Aug 2010 18:27:31 -0700 Subject: glcpp: Discard output of cmp when running the test suite. We're already using the return-value of cmp to print either PASS or FAIL and in the case of failure, we're subsequently running and showing the output of diff. So any warnings/errors from cmp itself are not actually needed, and can be quite confusing. --- src/glsl/glcpp/tests/glcpp-test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test index cfe7e97878..c09e8a96b9 100755 --- a/src/glsl/glcpp/tests/glcpp-test +++ b/src/glsl/glcpp/tests/glcpp-test @@ -9,7 +9,7 @@ for test in *.c; do echo -n "Testing $test..." ../glcpp < $test > $test.out total=$((total+1)) - if cmp $test.expected $test.out; then + if cmp $test.expected $test.out >/dev/null 2>&1; then echo "PASS" pass=$((pass+1)) else -- cgit v1.2.3 From 298a6fcddef6a91084ae921fca0b8640eb2e2a16 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 10 Aug 2010 19:16:19 -0700 Subject: glcpp/tests: Commit forgotten file 074-elif-undef.c.expected. --- src/glsl/glcpp/tests/074-elif-undef.c.expected | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/glsl/glcpp/tests/074-elif-undef.c.expected (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/074-elif-undef.c.expected b/src/glsl/glcpp/tests/074-elif-undef.c.expected new file mode 100644 index 0000000000..fd40910d9e --- /dev/null +++ b/src/glsl/glcpp/tests/074-elif-undef.c.expected @@ -0,0 +1,4 @@ + + + + -- cgit v1.2.3 From 48ba058e7a4b808271ca987b1553efd7e9792da9 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 12:43:44 -0700 Subject: glcpp: Additional fixes for not evaluating skipped #if/#elif expressions. This adds a couple of test cases to expand our coverage of invalid #if and being skipped, (either by being nested inside an #if/#elif that evaluates to zero or by being after an #if/#elif that evaluates to non-zero). --- src/glsl/glcpp/glcpp-parse.y | 60 +++++++++++++++------- src/glsl/glcpp/tests/075-elif-elif-undef.c | 4 ++ .../glcpp/tests/075-elif-elif-undef.c.expected | 5 ++ src/glsl/glcpp/tests/076-elif-undef-nested.c | 5 ++ .../glcpp/tests/076-elif-undef-nested.c.expected | 6 +++ 5 files changed, 61 insertions(+), 19 deletions(-) create mode 100644 src/glsl/glcpp/tests/075-elif-elif-undef.c create mode 100644 src/glsl/glcpp/tests/075-elif-elif-undef.c.expected create mode 100644 src/glsl/glcpp/tests/076-elif-undef-nested.c create mode 100644 src/glsl/glcpp/tests/076-elif-undef-nested.c.expected (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index a438357450..643c449d0e 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -223,14 +223,22 @@ control_line: talloc_free ($2); } | HASH_IF conditional_tokens NEWLINE { - /* If we're skipping to the next #elif/#else case or to #endif, - * don't bother expanding or parsing the expression. - */ - if (parser->skip_stack != NULL && parser->skip_stack->type != SKIP_NO_SKIP) { + /* Be careful to only evaluate the 'if' expression if + * we are not skipping. When we are skipping, we + * simply push a new 0-valued 'if' onto the skip + * stack. + * + * This avoids generating diagnostics for invalid + * expressions that are being skipped. */ + if (parser->skip_stack == NULL || + parser->skip_stack->type == SKIP_NO_SKIP) + { + _glcpp_parser_expand_if (parser, IF_EXPANDED, $2); + } + else + { _glcpp_parser_skip_stack_push_if (parser, & @1, 0); parser->skip_stack->type = SKIP_TO_ENDIF; - } else { - _glcpp_parser_expand_if (parser, IF_EXPANDED, $2); } } | HASH_IFDEF IDENTIFIER junk NEWLINE { @@ -244,24 +252,38 @@ control_line: _glcpp_parser_skip_stack_push_if (parser, & @1, macro == NULL); } | HASH_ELIF conditional_tokens NEWLINE { - /* If we just finished a non-skipped #if/#ifdef/#ifndef block, - * don't bother expanding or parsing the expression. - */ - if (parser->skip_stack != NULL && parser->skip_stack->type == SKIP_NO_SKIP) - parser->skip_stack->type = SKIP_TO_ENDIF; - else + /* Be careful to only evaluate the 'elif' expression + * if we are not skipping. When we are skipping, we + * simply change to a 0-valued 'elif' on the skip + * stack. + * + * This avoids generating diagnostics for invalid + * expressions that are being skipped. */ + if (parser->skip_stack && + parser->skip_stack->type == SKIP_TO_ELSE) + { _glcpp_parser_expand_if (parser, ELIF_EXPANDED, $2); + } + else + { + _glcpp_parser_skip_stack_change_if (parser, & @1, + "elif", 0); + } } | HASH_ELIF NEWLINE { - /* #elif without an expression results in a warning if the - * condition doesn't matter (we just handled #if 1 or such) - * but an error otherwise. */ - if (parser->skip_stack != NULL && parser->skip_stack->type == SKIP_NO_SKIP) { - parser->skip_stack->type = SKIP_TO_ENDIF; - glcpp_warning(& @1, parser, "ignoring illegal #elif without expression"); - } else { + /* #elif without an expression is an error unless we + * are skipping. */ + if (parser->skip_stack && + parser->skip_stack->type == SKIP_TO_ELSE) + { glcpp_error(& @1, parser, "#elif needs an expression"); } + else + { + _glcpp_parser_skip_stack_change_if (parser, & @1, + "elif", 0); + glcpp_warning(& @1, parser, "ignoring illegal #elif without expression"); + } } | HASH_ELSE NEWLINE { _glcpp_parser_skip_stack_change_if (parser, & @1, "else", 1); diff --git a/src/glsl/glcpp/tests/075-elif-elif-undef.c b/src/glsl/glcpp/tests/075-elif-elif-undef.c new file mode 100644 index 0000000000..264bc4f10e --- /dev/null +++ b/src/glsl/glcpp/tests/075-elif-elif-undef.c @@ -0,0 +1,4 @@ +#ifndef UNDEF +#elif UNDEF < 0 +#elif UNDEF == 3 +#endif diff --git a/src/glsl/glcpp/tests/075-elif-elif-undef.c.expected b/src/glsl/glcpp/tests/075-elif-elif-undef.c.expected new file mode 100644 index 0000000000..3f2ff2d6cc --- /dev/null +++ b/src/glsl/glcpp/tests/075-elif-elif-undef.c.expected @@ -0,0 +1,5 @@ + + + + + diff --git a/src/glsl/glcpp/tests/076-elif-undef-nested.c b/src/glsl/glcpp/tests/076-elif-undef-nested.c new file mode 100644 index 0000000000..ebd550ed00 --- /dev/null +++ b/src/glsl/glcpp/tests/076-elif-undef-nested.c @@ -0,0 +1,5 @@ +#ifdef UNDEF +#if UNDEF == 4 +#elif UNDEF == 5 +#endif +#endif diff --git a/src/glsl/glcpp/tests/076-elif-undef-nested.c.expected b/src/glsl/glcpp/tests/076-elif-undef-nested.c.expected new file mode 100644 index 0000000000..6fb66a5e2f --- /dev/null +++ b/src/glsl/glcpp/tests/076-elif-undef-nested.c.expected @@ -0,0 +1,6 @@ + + + + + + -- cgit v1.2.3 From 8485f4d9aa6d98304bb0197dc4f1f357d81d1daa Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 12:46:16 -0700 Subject: glcpp: Clean up intermediate file when test suite is interrupted. The glcpp-test script was leaving around bogus *.valgrind-errors files if a valgrind test was interrupted. --- src/glsl/glcpp/tests/glcpp-test | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test index c09e8a96b9..2dca848b4a 100755 --- a/src/glsl/glcpp/tests/glcpp-test +++ b/src/glsl/glcpp/tests/glcpp-test @@ -1,5 +1,7 @@ #!/bin/sh +trap 'rm $test.valgrind-errors; exit 1' INT QUIT + total=0 pass=0 clean=0 -- cgit v1.2.3 From 2bcff4c879acec31ef0b39ecf04e9df41c5cbfab Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 13:06:36 -0700 Subject: glcpp-test: Capture the stderr output of the preprocessor. This allows writing tests that verify diagnostics from the preprocessor. --- src/glsl/glcpp/tests/glcpp-test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test index 2dca848b4a..6494d0c0e7 100755 --- a/src/glsl/glcpp/tests/glcpp-test +++ b/src/glsl/glcpp/tests/glcpp-test @@ -9,7 +9,7 @@ clean=0 echo "====== Testing for correctness ======" for test in *.c; do echo -n "Testing $test..." - ../glcpp < $test > $test.out + ../glcpp < $test > $test.out 2>&1 total=$((total+1)) if cmp $test.expected $test.out >/dev/null 2>&1; then echo "PASS" -- cgit v1.2.3 From cb5ea0c79bd74ea6263d54302ed19c243ceb05de Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 13:48:13 -0700 Subject: glcpp: Add several tests for diagnostics. Which are proving to be useful since some of these tests are not yet acting as desired, (in particular, the unterminated if test is not generating any diagnostic). --- src/glsl/glcpp/tests/070-undefined-macro-in-expression.c | 2 ++ .../glcpp/tests/070-undefined-macro-in-expression.c.expected | 2 ++ src/glsl/glcpp/tests/077-else-without-if.c | 1 + src/glsl/glcpp/tests/077-else-without-if.c.expected | 4 ++++ src/glsl/glcpp/tests/078-elif-without-if.c | 1 + src/glsl/glcpp/tests/078-elif-without-if.c.expected | 4 ++++ src/glsl/glcpp/tests/079-endif-without-if.c | 1 + src/glsl/glcpp/tests/079-endif-without-if.c.expected | 4 ++++ src/glsl/glcpp/tests/080-if-without-expression.c | 4 ++++ src/glsl/glcpp/tests/080-if-without-expression.c.expected | 3 +++ src/glsl/glcpp/tests/081-elif-without-expression.c | 3 +++ src/glsl/glcpp/tests/081-elif-without-expression.c.expected | 6 ++++++ src/glsl/glcpp/tests/082-invalid-paste.c | 2 ++ src/glsl/glcpp/tests/082-invalid-paste.c.expected | 5 +++++ src/glsl/glcpp/tests/083-unterminated-if.c | 2 ++ src/glsl/glcpp/tests/084-unbalanced-parentheses.c | 2 ++ src/glsl/glcpp/tests/085-incorrect-argument-count.c | 5 +++++ src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected | 12 ++++++++++++ src/glsl/glcpp/tests/086-reserved-macro-names.c | 2 ++ src/glsl/glcpp/tests/086-reserved-macro-names.c.expected | 7 +++++++ 20 files changed, 72 insertions(+) create mode 100644 src/glsl/glcpp/tests/070-undefined-macro-in-expression.c create mode 100644 src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected create mode 100644 src/glsl/glcpp/tests/077-else-without-if.c create mode 100644 src/glsl/glcpp/tests/077-else-without-if.c.expected create mode 100644 src/glsl/glcpp/tests/078-elif-without-if.c create mode 100644 src/glsl/glcpp/tests/078-elif-without-if.c.expected create mode 100644 src/glsl/glcpp/tests/079-endif-without-if.c create mode 100644 src/glsl/glcpp/tests/079-endif-without-if.c.expected create mode 100644 src/glsl/glcpp/tests/080-if-without-expression.c create mode 100644 src/glsl/glcpp/tests/080-if-without-expression.c.expected create mode 100644 src/glsl/glcpp/tests/081-elif-without-expression.c create mode 100644 src/glsl/glcpp/tests/081-elif-without-expression.c.expected create mode 100644 src/glsl/glcpp/tests/082-invalid-paste.c create mode 100644 src/glsl/glcpp/tests/082-invalid-paste.c.expected create mode 100644 src/glsl/glcpp/tests/083-unterminated-if.c create mode 100644 src/glsl/glcpp/tests/084-unbalanced-parentheses.c create mode 100644 src/glsl/glcpp/tests/085-incorrect-argument-count.c create mode 100644 src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected create mode 100644 src/glsl/glcpp/tests/086-reserved-macro-names.c create mode 100644 src/glsl/glcpp/tests/086-reserved-macro-names.c.expected (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c new file mode 100644 index 0000000000..b6dc2ba075 --- /dev/null +++ b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c @@ -0,0 +1,2 @@ +#if UNDEFINED_MACRO +#endif diff --git a/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected new file mode 100644 index 0000000000..2bb38a1411 --- /dev/null +++ b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected @@ -0,0 +1,2 @@ +0:1(21): preprocessor error: syntax error, unexpected IDENTIFIER + diff --git a/src/glsl/glcpp/tests/077-else-without-if.c b/src/glsl/glcpp/tests/077-else-without-if.c new file mode 100644 index 0000000000..81f00bfe27 --- /dev/null +++ b/src/glsl/glcpp/tests/077-else-without-if.c @@ -0,0 +1 @@ +#else diff --git a/src/glsl/glcpp/tests/077-else-without-if.c.expected b/src/glsl/glcpp/tests/077-else-without-if.c.expected new file mode 100644 index 0000000000..d289b36356 --- /dev/null +++ b/src/glsl/glcpp/tests/077-else-without-if.c.expected @@ -0,0 +1,4 @@ +0:1(2): preprocessor error: else without #if + + + diff --git a/src/glsl/glcpp/tests/078-elif-without-if.c b/src/glsl/glcpp/tests/078-elif-without-if.c new file mode 100644 index 0000000000..60466b3890 --- /dev/null +++ b/src/glsl/glcpp/tests/078-elif-without-if.c @@ -0,0 +1 @@ +#elif defined FOO diff --git a/src/glsl/glcpp/tests/078-elif-without-if.c.expected b/src/glsl/glcpp/tests/078-elif-without-if.c.expected new file mode 100644 index 0000000000..7d41f0ac79 --- /dev/null +++ b/src/glsl/glcpp/tests/078-elif-without-if.c.expected @@ -0,0 +1,4 @@ +0:1(2): preprocessor error: elif without #if + + + diff --git a/src/glsl/glcpp/tests/079-endif-without-if.c b/src/glsl/glcpp/tests/079-endif-without-if.c new file mode 100644 index 0000000000..69331c3ca9 --- /dev/null +++ b/src/glsl/glcpp/tests/079-endif-without-if.c @@ -0,0 +1 @@ +#endif diff --git a/src/glsl/glcpp/tests/079-endif-without-if.c.expected b/src/glsl/glcpp/tests/079-endif-without-if.c.expected new file mode 100644 index 0000000000..08dd33546f --- /dev/null +++ b/src/glsl/glcpp/tests/079-endif-without-if.c.expected @@ -0,0 +1,4 @@ +0:1(2): preprocessor error: #endif without #if + + + diff --git a/src/glsl/glcpp/tests/080-if-without-expression.c b/src/glsl/glcpp/tests/080-if-without-expression.c new file mode 100644 index 0000000000..a27ba36a36 --- /dev/null +++ b/src/glsl/glcpp/tests/080-if-without-expression.c @@ -0,0 +1,4 @@ +/* Error message for unskipped #if with no expression. */ +#if +#endif + diff --git a/src/glsl/glcpp/tests/080-if-without-expression.c.expected b/src/glsl/glcpp/tests/080-if-without-expression.c.expected new file mode 100644 index 0000000000..1a3e383e9a --- /dev/null +++ b/src/glsl/glcpp/tests/080-if-without-expression.c.expected @@ -0,0 +1,3 @@ +0:2(1): preprocessor error: #if with no expression + + diff --git a/src/glsl/glcpp/tests/081-elif-without-expression.c b/src/glsl/glcpp/tests/081-elif-without-expression.c new file mode 100644 index 0000000000..79c78663dd --- /dev/null +++ b/src/glsl/glcpp/tests/081-elif-without-expression.c @@ -0,0 +1,3 @@ +#if 0 +#elif +#endif diff --git a/src/glsl/glcpp/tests/081-elif-without-expression.c.expected b/src/glsl/glcpp/tests/081-elif-without-expression.c.expected new file mode 100644 index 0000000000..37dcdc3238 --- /dev/null +++ b/src/glsl/glcpp/tests/081-elif-without-expression.c.expected @@ -0,0 +1,6 @@ +0:2(1): preprocessor error: #elif with no expression + + + + + diff --git a/src/glsl/glcpp/tests/082-invalid-paste.c b/src/glsl/glcpp/tests/082-invalid-paste.c new file mode 100644 index 0000000000..40bf64411c --- /dev/null +++ b/src/glsl/glcpp/tests/082-invalid-paste.c @@ -0,0 +1,2 @@ +#define PASTE(x,y) x ## y +PASTE(<,>) diff --git a/src/glsl/glcpp/tests/082-invalid-paste.c.expected b/src/glsl/glcpp/tests/082-invalid-paste.c.expected new file mode 100644 index 0000000000..2c924406b5 --- /dev/null +++ b/src/glsl/glcpp/tests/082-invalid-paste.c.expected @@ -0,0 +1,5 @@ +0:2(7): preprocessor error: +Pasting "<" and ">" does not give a valid preprocessing token. + +< + diff --git a/src/glsl/glcpp/tests/083-unterminated-if.c b/src/glsl/glcpp/tests/083-unterminated-if.c new file mode 100644 index 0000000000..9180635092 --- /dev/null +++ b/src/glsl/glcpp/tests/083-unterminated-if.c @@ -0,0 +1,2 @@ +#if 1 + diff --git a/src/glsl/glcpp/tests/084-unbalanced-parentheses.c b/src/glsl/glcpp/tests/084-unbalanced-parentheses.c new file mode 100644 index 0000000000..0789ba5e52 --- /dev/null +++ b/src/glsl/glcpp/tests/084-unbalanced-parentheses.c @@ -0,0 +1,2 @@ +#define FUNC(x) (2*(x)) +FUNC(23 diff --git a/src/glsl/glcpp/tests/085-incorrect-argument-count.c b/src/glsl/glcpp/tests/085-incorrect-argument-count.c new file mode 100644 index 0000000000..91bea60061 --- /dev/null +++ b/src/glsl/glcpp/tests/085-incorrect-argument-count.c @@ -0,0 +1,5 @@ +#define MULT(x,y) ((x)*(y)) +MULT() +MULT(1) +MULT(1,2,3) + diff --git a/src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected b/src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected new file mode 100644 index 0000000000..1df30cbb56 --- /dev/null +++ b/src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected @@ -0,0 +1,12 @@ +0:2(1): preprocessor error: Error: macro MULT invoked with 1 arguments (expected 2) + +0:3(1): preprocessor error: Error: macro MULT invoked with 1 arguments (expected 2) + +0:4(1): preprocessor error: Error: macro MULT invoked with 3 arguments (expected 2) + + +MULT() +MULT(1) +MULT(1,2,3) + + diff --git a/src/glsl/glcpp/tests/086-reserved-macro-names.c b/src/glsl/glcpp/tests/086-reserved-macro-names.c new file mode 100644 index 0000000000..fd0c29f0c4 --- /dev/null +++ b/src/glsl/glcpp/tests/086-reserved-macro-names.c @@ -0,0 +1,2 @@ +#define __BAD reserved +#define GL_ALSO_BAD() also reserved diff --git a/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected new file mode 100644 index 0000000000..6a9df68268 --- /dev/null +++ b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected @@ -0,0 +1,7 @@ +0:1(10): preprocessor error: Macro names starting with "__" are reserved. + +0:2(9): preprocessor error: Macro names starting with "GL_" are reserved. + + + + -- cgit v1.2.3 From 624dd585c72103e5bffbc600cdf7bdfba5305a15 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 13:50:51 -0700 Subject: glcpp: Reword diagnostic for #elif with no expression Rather than telling the user what to fix, the standard convention is to describe what the detected problem is. With this change, test 081-elif-without-expression now passes. --- src/glsl/glcpp/glcpp-parse.c | 2 +- src/glsl/glcpp/glcpp-parse.y | 2 +- src/glsl/glcpp/tests/081-elif-without-expression.c.expected | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index 498d018764..05bb7ca48b 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -1950,7 +1950,7 @@ yyreduce: if (parser->skip_stack && parser->skip_stack->type == SKIP_TO_ELSE) { - glcpp_error(& (yylsp[(1) - (2)]), parser, "#elif needs an expression"); + glcpp_error(& (yylsp[(1) - (2)]), parser, "#elif with no expression"); } else { diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 643c449d0e..795030ecfe 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -276,7 +276,7 @@ control_line: if (parser->skip_stack && parser->skip_stack->type == SKIP_TO_ELSE) { - glcpp_error(& @1, parser, "#elif needs an expression"); + glcpp_error(& @1, parser, "#elif with no expression"); } else { diff --git a/src/glsl/glcpp/tests/081-elif-without-expression.c.expected b/src/glsl/glcpp/tests/081-elif-without-expression.c.expected index 37dcdc3238..974f0f550e 100644 --- a/src/glsl/glcpp/tests/081-elif-without-expression.c.expected +++ b/src/glsl/glcpp/tests/081-elif-without-expression.c.expected @@ -3,4 +3,3 @@ - -- cgit v1.2.3 From 253cad3f424f71f6984431e5edbde1694ccfae3f Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 13:59:22 -0700 Subject: glcpp: Add an explicit diagnostic for #if with no expression. This is more clear than the previously-generated diagnostic which was something confusing like "enexpected newline". This change makse test 080-if-witout-expression.c now pass. --- src/glsl/glcpp/glcpp-parse.y | 10 ++++++++++ src/glsl/glcpp/tests/080-if-without-expression.c.expected | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 795030ecfe..0e0d9d412b 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -241,6 +241,16 @@ control_line: parser->skip_stack->type = SKIP_TO_ENDIF; } } +| HASH_IF NEWLINE { + /* #if without an expression is only an error if we + * are not skipping */ + if (parser->skip_stack == NULL || + parser->skip_stack->type == SKIP_NO_SKIP) + { + glcpp_error(& @1, parser, "#if with no expression"); + } + _glcpp_parser_skip_stack_push_if (parser, & @1, 0); + } | HASH_IFDEF IDENTIFIER junk NEWLINE { macro_t *macro = hash_table_find (parser->defines, $2); talloc_free ($2); diff --git a/src/glsl/glcpp/tests/080-if-without-expression.c.expected b/src/glsl/glcpp/tests/080-if-without-expression.c.expected index 1a3e383e9a..768ba0f473 100644 --- a/src/glsl/glcpp/tests/080-if-without-expression.c.expected +++ b/src/glsl/glcpp/tests/080-if-without-expression.c.expected @@ -1,3 +1,6 @@ 0:2(1): preprocessor error: #if with no expression - + + + + -- cgit v1.2.3 From da6b10a7eb26c8a13056cbae9015d5b84f134142 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 14:09:11 -0700 Subject: glcpp: Fix "unterminated if" diagnostic. This was previously being appended to the output string *after* a copy of the supposedly final string was made and handed to the caller. So the diagnostic was never actually visible to the user. We fix this by moving the check for an unterminated #if from glcpp_parser_destroy to the calling function, preprocess. This fixes the test case 083-unterminated-if.c. --- src/glsl/glcpp/glcpp-parse.c | 2 -- src/glsl/glcpp/glcpp-parse.y | 2 -- src/glsl/glcpp/pp.c | 3 +++ src/glsl/glcpp/tests/083-unterminated-if.c.expected | 5 +++++ 4 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 src/glsl/glcpp/tests/083-unterminated-if.c.expected (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index fe7549e5c5..df26899a0f 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -3333,8 +3333,6 @@ glcpp_parser_parse (glcpp_parser_t *parser) void glcpp_parser_destroy (glcpp_parser_t *parser) { - if (parser->skip_stack) - glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n"); glcpp_lex_destroy (parser->scanner); hash_table_dtor (parser->defines); talloc_free (parser); diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 0e0d9d412b..7b08cd5807 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -1016,8 +1016,6 @@ glcpp_parser_parse (glcpp_parser_t *parser) void glcpp_parser_destroy (glcpp_parser_t *parser) { - if (parser->skip_stack) - glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n"); glcpp_lex_destroy (parser->scanner); hash_table_dtor (parser->defines); talloc_free (parser); diff --git a/src/glsl/glcpp/pp.c b/src/glsl/glcpp/pp.c index 3adccf72aa..52b6e96a65 100644 --- a/src/glsl/glcpp/pp.c +++ b/src/glsl/glcpp/pp.c @@ -151,6 +151,9 @@ preprocess(void *talloc_ctx, const char **shader, char **info_log, glcpp_parser_parse (parser); + if (parser->skip_stack) + glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n"); + *info_log = talloc_strdup_append(*info_log, parser->info_log); talloc_steal(talloc_ctx, parser->output); diff --git a/src/glsl/glcpp/tests/083-unterminated-if.c.expected b/src/glsl/glcpp/tests/083-unterminated-if.c.expected new file mode 100644 index 0000000000..a69f8bab58 --- /dev/null +++ b/src/glsl/glcpp/tests/083-unterminated-if.c.expected @@ -0,0 +1,5 @@ +0:1(7): preprocessor error: Unterminated #if + + + + -- cgit v1.2.3 From ede67e307142000a408e40b637132700a4dc2808 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Aug 2010 17:50:05 -0700 Subject: glcpp: Add testcase for #if handling bug that breaks Savage2. --- src/glsl/glcpp/tests/087-if-comments.c | 5 +++++ src/glsl/glcpp/tests/087-if-comments.c.expected | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 src/glsl/glcpp/tests/087-if-comments.c create mode 100644 src/glsl/glcpp/tests/087-if-comments.c.expected (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/087-if-comments.c b/src/glsl/glcpp/tests/087-if-comments.c new file mode 100644 index 0000000000..ce8dc43057 --- /dev/null +++ b/src/glsl/glcpp/tests/087-if-comments.c @@ -0,0 +1,5 @@ +#if (1 == 0) // dangerous comment +fail +#else +win +#endif diff --git a/src/glsl/glcpp/tests/087-if-comments.c.expected b/src/glsl/glcpp/tests/087-if-comments.c.expected new file mode 100644 index 0000000000..827e548fe5 --- /dev/null +++ b/src/glsl/glcpp/tests/087-if-comments.c.expected @@ -0,0 +1,6 @@ + + + +win + + -- cgit v1.2.3 From ce5d0a296c984a9b746f0b248f4cb10ed78bc647 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 17 Aug 2010 22:23:43 -0700 Subject: glcpp: Fix 064-version.c expected result to track recent change. In commit 6be3a8b70af4ba4fa4d037d54ecf6d5f055edbc9, the #version directive was fixed to stop generating a spurious newline. Here we simply update the expected result for the single test which includes a #version directive. --- src/glsl/glcpp/tests/064-version.c.expected | 1 - 1 file changed, 1 deletion(-) (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/064-version.c.expected b/src/glsl/glcpp/tests/064-version.c.expected index 1c53467270..3af71113c8 100644 --- a/src/glsl/glcpp/tests/064-version.c.expected +++ b/src/glsl/glcpp/tests/064-version.c.expected @@ -1,4 +1,3 @@ #version 130 - -- cgit v1.2.3 From 105e2137d67b98c24251be3586985fb61aeaf28a Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 17 Aug 2010 23:19:01 -0700 Subject: glcpp: Add two new tests for testing redefined macros. The specification says that redefining a macro is an error, unless the new definitions is identical to the old one, (identical replacement lists but ignoring differing amounts of whitespace). --- .../glcpp/tests/088-redefine-macro-legitimate.c | 5 ++++ .../tests/088-redefine-macro-legitimate.c.expected | 6 +++++ src/glsl/glcpp/tests/089-redefine-macro-error.c | 17 ++++++++++++ .../tests/089-redefine-macro-error.c.expected | 30 ++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 src/glsl/glcpp/tests/088-redefine-macro-legitimate.c create mode 100644 src/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected create mode 100644 src/glsl/glcpp/tests/089-redefine-macro-error.c create mode 100644 src/glsl/glcpp/tests/089-redefine-macro-error.c.expected (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c b/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c new file mode 100644 index 0000000000..0e0666b8b3 --- /dev/null +++ b/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c @@ -0,0 +1,5 @@ +#define abc 123 +#define abc 123 + +#define foo(x) (x)+23 +#define foo(x) ( x ) + 23 diff --git a/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected b/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected new file mode 100644 index 0000000000..6fb66a5e2f --- /dev/null +++ b/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/glsl/glcpp/tests/089-redefine-macro-error.c b/src/glsl/glcpp/tests/089-redefine-macro-error.c new file mode 100644 index 0000000000..b3d1391e16 --- /dev/null +++ b/src/glsl/glcpp/tests/089-redefine-macro-error.c @@ -0,0 +1,17 @@ +#define x y +#define x z + +#define abc 123 +#define abc() 123 + +#define foo() bar +#define foo(x) bar + +#define bar() baz +#define bar baz + +#define biff(a,b) a+b +#define biff(a,b,c) a+b + +#define oper(a,b) a+b +#define oper(a,b) a*b diff --git a/src/glsl/glcpp/tests/089-redefine-macro-error.c.expected b/src/glsl/glcpp/tests/089-redefine-macro-error.c.expected new file mode 100644 index 0000000000..6209ead559 --- /dev/null +++ b/src/glsl/glcpp/tests/089-redefine-macro-error.c.expected @@ -0,0 +1,30 @@ +0:2(9): preprocessor error: Redefinition of macro x + +0:5(9): preprocessor error: Redefinition of macro abc + +0:8(9): preprocessor error: Redefinition of macro foo + +0:11(9): preprocessor error: Redefinition of macro bar + +0:14(9): preprocessor error: Redefinition of macro biff + +0:17(9): preprocessor error: Redefinition of macro oper + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 0acd68c4050fea82797f80ad90212926df4cf001 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 23 Aug 2010 08:54:06 -0700 Subject: glcpp: Add test for the #error directive. This directive is already implemented nicely, but wasn't previously tested. It will be convenient to use this directive in further tests that rely on error messages, (such as ensuring that #line correctly sets the line number in the error message). --- src/glsl/glcpp/tests/090-hash-error.c | 1 + src/glsl/glcpp/tests/090-hash-error.c.expected | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 src/glsl/glcpp/tests/090-hash-error.c create mode 100644 src/glsl/glcpp/tests/090-hash-error.c.expected (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/090-hash-error.c b/src/glsl/glcpp/tests/090-hash-error.c new file mode 100644 index 0000000000..d19bb7faed --- /dev/null +++ b/src/glsl/glcpp/tests/090-hash-error.c @@ -0,0 +1 @@ +#error human error diff --git a/src/glsl/glcpp/tests/090-hash-error.c.expected b/src/glsl/glcpp/tests/090-hash-error.c.expected new file mode 100644 index 0000000000..f2f1fbeaf8 --- /dev/null +++ b/src/glsl/glcpp/tests/090-hash-error.c.expected @@ -0,0 +1,3 @@ +0:1(2): preprocessor error: #error human error + + -- cgit v1.2.3 From 2a9e791fdeb45080a98042d41c153ea19c17caae Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 23 Aug 2010 09:26:44 -0700 Subject: glcpp: Add new test for #line directive. This test exposes two current bugs: 1. The source number is not being correctly emitted in error messages (instead, it's always 0). 2. A directive of "#line 0" is resulting in the following parse error: preprocessor error: Invalid tokens after # --- src/glsl/glcpp/tests/091-hash-line.c | 8 ++++++++ src/glsl/glcpp/tests/091-hash-line.c.expected | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/glsl/glcpp/tests/091-hash-line.c create mode 100644 src/glsl/glcpp/tests/091-hash-line.c.expected (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/091-hash-line.c b/src/glsl/glcpp/tests/091-hash-line.c new file mode 100644 index 0000000000..fea35d37b0 --- /dev/null +++ b/src/glsl/glcpp/tests/091-hash-line.c @@ -0,0 +1,8 @@ +#line 0 +#error line 0 error +#line 25 +#error line 25 error +#line 0 1 +#error source 1, line 0 error +#line 30 2 +#error source 2, line 30 error diff --git a/src/glsl/glcpp/tests/091-hash-line.c.expected b/src/glsl/glcpp/tests/091-hash-line.c.expected new file mode 100644 index 0000000000..e663398c16 --- /dev/null +++ b/src/glsl/glcpp/tests/091-hash-line.c.expected @@ -0,0 +1,13 @@ +0:0(1): preprocessor error: #error line 0 error +0:25(1): preprocessor error: #error line 25 error +1:0(1): preprocessor error: #error source 1, line 0 error +2:30(1): preprocessor error: #error source 2, line 30 error + + + + + + + + + -- cgit v1.2.3 From 21560c40e8aa98624a225752b98babc7ae2938d5 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 23 Aug 2010 10:41:30 -0700 Subject: glcpp: Fix test suite to avoid flagging failed tests as valgrind errors. We recently added several tests that intentionally trigger preprocessor errors. During valgrind-based testing, our test script was noticing the non-zero return value from the preprocessor and incorrectly flagging the valgrind-based test as failing. To fix this, we make valgrind return an error code that is otherwise unused by the preprocessor. --- src/glsl/glcpp/tests/glcpp-test | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/glsl/glcpp/tests') diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test index 6494d0c0e7..5dc08ea6ac 100755 --- a/src/glsl/glcpp/tests/glcpp-test +++ b/src/glsl/glcpp/tests/glcpp-test @@ -27,13 +27,14 @@ echo "" echo "====== Testing for valgrind cleanliness ======" for test in *.c; do echo -n "Testing $test with valgrind..." - if valgrind --error-exitcode=1 --log-file=$test.valgrind-errors ../glcpp < $test >/dev/null; then + valgrind --error-exitcode=31 --log-file=$test.valgrind-errors ../glcpp < $test >/dev/null 2>&1 + if [ "$?" = "31" ]; then + echo "ERRORS" + cat $test.valgrind-errors + else echo "CLEAN" clean=$((clean+1)) rm $test.valgrind-errors - else - echo "ERRORS" - cat $test.valgrind-errors fi done -- cgit v1.2.3