summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/glcpp/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/glsl/glcpp/tests')
-rw-r--r--src/compiler/glsl/glcpp/tests/.gitignore4
-rw-r--r--src/compiler/glsl/glcpp/tests/000-content-with-spaces.c1
-rw-r--r--src/compiler/glsl/glcpp/tests/000-content-with-spaces.c.expected1
-rw-r--r--src/compiler/glsl/glcpp/tests/001-define.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/001-define.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/002-define-chain.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/002-define-chain.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/003-define-chain-reverse.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/003-define-chain-reverse.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/004-define-recursive.c6
-rw-r--r--src/compiler/glsl/glcpp/tests/004-define-recursive.c.expected6
-rw-r--r--src/compiler/glsl/glcpp/tests/005-define-composite-chain.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/005-define-composite-chain.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/006-define-composite-chain-reverse.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/007-define-composite-recursive.c6
-rw-r--r--src/compiler/glsl/glcpp/tests/007-define-composite-recursive.c.expected6
-rw-r--r--src/compiler/glsl/glcpp/tests/008-define-empty.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/008-define-empty.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/009-undef.c4
-rw-r--r--src/compiler/glsl/glcpp/tests/009-undef.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/010-undef-re-define.c6
-rw-r--r--src/compiler/glsl/glcpp/tests/010-undef-re-define.c.expected6
-rw-r--r--src/compiler/glsl/glcpp/tests/011-define-func-empty.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/011-define-func-empty.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/012-define-func-no-args.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/012-define-func-no-args.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/013-define-func-1-arg-unused.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/014-define-func-2-arg-unused.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/015-define-object-with-parens.c4
-rw-r--r--src/compiler/glsl/glcpp/tests/015-define-object-with-parens.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/016-define-func-1-arg.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/016-define-func-1-arg.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/017-define-func-2-args.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/017-define-func-2-args.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/018-define-func-macro-as-parameter.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/019-define-func-1-arg-multi.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/020-define-func-2-arg-multi.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/021-define-func-compose.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/021-define-func-compose.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/022-define-func-arg-with-parens.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/023-define-extra-whitespace.c8
-rw-r--r--src/compiler/glsl/glcpp/tests/023-define-extra-whitespace.c.expected8
-rw-r--r--src/compiler/glsl/glcpp/tests/024-define-chain-to-self-recursion.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/025-func-macro-as-non-macro.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/026-define-func-extra-newlines.c6
-rw-r--r--src/compiler/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/027-define-chain-obj-to-func.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c4
-rw-r--r--src/compiler/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c4
-rw-r--r--src/compiler/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/032-define-func-self-recurse.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/032-define-func-self-recurse.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/033-define-func-self-compose.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/033-define-func-self-compose.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/034-define-func-self-compose-non-func.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/037-finalize-unexpanded-macro.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/038-func-arg-with-commas.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/038-func-arg-with-commas.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c24
-rw-r--r--src/compiler/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected26
-rw-r--r--src/compiler/glsl/glcpp/tests/040-token-pasting.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/040-token-pasting.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/041-if-0.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/041-if-0.c.expected5
-rw-r--r--src/compiler/glsl/glcpp/tests/042-if-1.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/042-if-1.c.expected5
-rw-r--r--src/compiler/glsl/glcpp/tests/043-if-0-else.c7
-rw-r--r--src/compiler/glsl/glcpp/tests/043-if-0-else.c.expected7
-rw-r--r--src/compiler/glsl/glcpp/tests/044-if-1-else.c7
-rw-r--r--src/compiler/glsl/glcpp/tests/044-if-1-else.c.expected7
-rw-r--r--src/compiler/glsl/glcpp/tests/045-if-0-elif.c11
-rw-r--r--src/compiler/glsl/glcpp/tests/045-if-0-elif.c.expected11
-rw-r--r--src/compiler/glsl/glcpp/tests/046-if-1-elsif.c11
-rw-r--r--src/compiler/glsl/glcpp/tests/046-if-1-elsif.c.expected11
-rw-r--r--src/compiler/glsl/glcpp/tests/047-if-elif-else.c11
-rw-r--r--src/compiler/glsl/glcpp/tests/047-if-elif-else.c.expected11
-rw-r--r--src/compiler/glsl/glcpp/tests/048-if-nested.c11
-rw-r--r--src/compiler/glsl/glcpp/tests/048-if-nested.c.expected11
-rw-r--r--src/compiler/glsl/glcpp/tests/049-if-expression-precedence.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/049-if-expression-precedence.c.expected5
-rw-r--r--src/compiler/glsl/glcpp/tests/050-if-defined.c17
-rw-r--r--src/compiler/glsl/glcpp/tests/050-if-defined.c.expected17
-rw-r--r--src/compiler/glsl/glcpp/tests/051-if-relational.c35
-rw-r--r--src/compiler/glsl/glcpp/tests/051-if-relational.c.expected35
-rw-r--r--src/compiler/glsl/glcpp/tests/052-if-bitwise.c20
-rw-r--r--src/compiler/glsl/glcpp/tests/052-if-bitwise.c.expected20
-rw-r--r--src/compiler/glsl/glcpp/tests/053-if-divide-and-shift.c15
-rw-r--r--src/compiler/glsl/glcpp/tests/053-if-divide-and-shift.c.expected15
-rw-r--r--src/compiler/glsl/glcpp/tests/054-if-with-macros.c34
-rw-r--r--src/compiler/glsl/glcpp/tests/054-if-with-macros.c.expected34
-rw-r--r--src/compiler/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/056-macro-argument-with-comma.c4
-rw-r--r--src/compiler/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/057-empty-arguments.c6
-rw-r--r--src/compiler/glsl/glcpp/tests/057-empty-arguments.c.expected6
-rw-r--r--src/compiler/glsl/glcpp/tests/058-token-pasting-empty-arguments.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected5
-rw-r--r--src/compiler/glsl/glcpp/tests/059-token-pasting-integer.c4
-rw-r--r--src/compiler/glsl/glcpp/tests/059-token-pasting-integer.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected5
-rw-r--r--src/compiler/glsl/glcpp/tests/062-if-0-skips-garbage.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected5
-rw-r--r--src/compiler/glsl/glcpp/tests/063-comments.c20
-rw-r--r--src/compiler/glsl/glcpp/tests/063-comments.c.expected20
-rw-r--r--src/compiler/glsl/glcpp/tests/064-version.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/064-version.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/065-if-defined-parens.c17
-rw-r--r--src/compiler/glsl/glcpp/tests/065-if-defined-parens.c.expected17
-rw-r--r--src/compiler/glsl/glcpp/tests/066-if-nospace-expression.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/066-if-nospace-expression.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/067-nested-ifdef-ifndef.c40
-rw-r--r--src/compiler/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected40
-rw-r--r--src/compiler/glsl/glcpp/tests/068-accidental-pasting.c11
-rw-r--r--src/compiler/glsl/glcpp/tests/068-accidental-pasting.c.expected11
-rw-r--r--src/compiler/glsl/glcpp/tests/069-repeated-argument.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/069-repeated-argument.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/070-undefined-macro-in-expression.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected5
-rw-r--r--src/compiler/glsl/glcpp/tests/071-punctuator.c1
-rw-r--r--src/compiler/glsl/glcpp/tests/071-punctuator.c.expected1
-rw-r--r--src/compiler/glsl/glcpp/tests/072-token-pasting-same-line.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/072-token-pasting-same-line.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/073-if-in-ifdef.c4
-rw-r--r--src/compiler/glsl/glcpp/tests/073-if-in-ifdef.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/074-elif-undef.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/074-elif-undef.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/075-elif-elif-undef.c4
-rw-r--r--src/compiler/glsl/glcpp/tests/075-elif-elif-undef.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/076-elif-undef-nested.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/076-elif-undef-nested.c.expected5
-rw-r--r--src/compiler/glsl/glcpp/tests/077-else-without-if.c1
-rw-r--r--src/compiler/glsl/glcpp/tests/077-else-without-if.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/078-elif-without-if.c1
-rw-r--r--src/compiler/glsl/glcpp/tests/078-elif-without-if.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/079-endif-without-if.c1
-rw-r--r--src/compiler/glsl/glcpp/tests/079-endif-without-if.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/080-if-without-expression.c4
-rw-r--r--src/compiler/glsl/glcpp/tests/080-if-without-expression.c.expected5
-rw-r--r--src/compiler/glsl/glcpp/tests/081-elif-without-expression.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/081-elif-without-expression.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/082-invalid-paste.c7
-rw-r--r--src/compiler/glsl/glcpp/tests/082-invalid-paste.c.expected19
-rw-r--r--src/compiler/glsl/glcpp/tests/083-unterminated-if.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/083-unterminated-if.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/085-incorrect-argument-count.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/085-incorrect-argument-count.c.expected11
-rw-r--r--src/compiler/glsl/glcpp/tests/086-reserved-macro-names.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/086-reserved-macro-names.c.expected9
-rw-r--r--src/compiler/glsl/glcpp/tests/087-if-comments.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/087-if-comments.c.expected5
-rw-r--r--src/compiler/glsl/glcpp/tests/088-redefine-macro-legitimate.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected5
-rw-r--r--src/compiler/glsl/glcpp/tests/089-redefine-macro-error.c17
-rw-r--r--src/compiler/glsl/glcpp/tests/089-redefine-macro-error.c.expected29
-rw-r--r--src/compiler/glsl/glcpp/tests/090-hash-error.c1
-rw-r--r--src/compiler/glsl/glcpp/tests/090-hash-error.c.expected1
-rw-r--r--src/compiler/glsl/glcpp/tests/091-hash-line.c14
-rw-r--r--src/compiler/glsl/glcpp/tests/091-hash-line.c.expected14
-rw-r--r--src/compiler/glsl/glcpp/tests/092-redefine-macro-error-2.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/092-redefine-macro-error-2.c.expected9
-rw-r--r--src/compiler/glsl/glcpp/tests/093-divide-by-zero.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/093-divide-by-zero.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c13
-rw-r--r--src/compiler/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c.expected14
-rw-r--r--src/compiler/glsl/glcpp/tests/095-recursive-define.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/095-recursive-define.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/096-paste-twice.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/096-paste-twice.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/097-paste-with-non-function-macro.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/097-paste-with-non-function-macro.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/098-elif-undefined.c7
-rw-r--r--src/compiler/glsl/glcpp/tests/098-elif-undefined.c.expected7
-rw-r--r--src/compiler/glsl/glcpp/tests/099-c99-example.c17
-rw-r--r--src/compiler/glsl/glcpp/tests/099-c99-example.c.expected16
-rw-r--r--src/compiler/glsl/glcpp/tests/100-macro-with-colon.c7
-rw-r--r--src/compiler/glsl/glcpp/tests/100-macro-with-colon.c.expected7
-rw-r--r--src/compiler/glsl/glcpp/tests/101-macros-used-twice.c16
-rw-r--r--src/compiler/glsl/glcpp/tests/101-macros-used-twice.c.expected16
-rw-r--r--src/compiler/glsl/glcpp/tests/102-garbage-after-endif.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/102-garbage-after-endif.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/103-garbage-after-else-0.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/103-garbage-after-else-0.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/104-hash-line-followed-by-code.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/104-hash-line-followed-by-code.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/105-multiline-hash-line.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/105-multiline-hash-line.c.expected5
-rw-r--r--src/compiler/glsl/glcpp/tests/106-multiline-hash-if.c6
-rw-r--r--src/compiler/glsl/glcpp/tests/106-multiline-hash-if.c.expected6
-rw-r--r--src/compiler/glsl/glcpp/tests/107-multiline-hash-elif.c7
-rw-r--r--src/compiler/glsl/glcpp/tests/107-multiline-hash-elif.c.expected7
-rw-r--r--src/compiler/glsl/glcpp/tests/108-no-space-after-hash-version.c1
-rw-r--r--src/compiler/glsl/glcpp/tests/108-no-space-after-hash-version.c.expected1
-rw-r--r--src/compiler/glsl/glcpp/tests/109-no-space-after-hash-line.c1
-rw-r--r--src/compiler/glsl/glcpp/tests/109-no-space-after-hash-line.c.expected1
-rw-r--r--src/compiler/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c19
-rw-r--r--src/compiler/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c.expected19
-rw-r--r--src/compiler/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c24
-rw-r--r--src/compiler/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c.expected24
-rw-r--r--src/compiler/glsl/glcpp/tests/113-line-and-file-macros.c7
-rw-r--r--src/compiler/glsl/glcpp/tests/113-line-and-file-macros.c.expected7
-rw-r--r--src/compiler/glsl/glcpp/tests/114-paste-integer-tokens.c7
-rw-r--r--src/compiler/glsl/glcpp/tests/114-paste-integer-tokens.c.expected7
-rw-r--r--src/compiler/glsl/glcpp/tests/115-line-continuations.c9
-rw-r--r--src/compiler/glsl/glcpp/tests/115-line-continuations.c.expected9
-rw-r--r--src/compiler/glsl/glcpp/tests/116-disable-line-continuations.c13
-rw-r--r--src/compiler/glsl/glcpp/tests/116-disable-line-continuations.c.expected13
-rw-r--r--src/compiler/glsl/glcpp/tests/117-line-continuation-and-non-continuation-backslash.c12
-rw-r--r--src/compiler/glsl/glcpp/tests/117-line-continuation-and-non-continuation-backslash.c.expected12
-rw-r--r--src/compiler/glsl/glcpp/tests/118-comment-becomes-space.c4
-rw-r--r--src/compiler/glsl/glcpp/tests/118-comment-becomes-space.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/119-elif-after-else.c6
-rw-r--r--src/compiler/glsl/glcpp/tests/119-elif-after-else.c.expected7
-rw-r--r--src/compiler/glsl/glcpp/tests/120-undef-builtin.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/120-undef-builtin.c.expected6
-rw-r--r--src/compiler/glsl/glcpp/tests/121-comment-bug-72686.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/121-comment-bug-72686.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c16
-rw-r--r--src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c.expected22
-rw-r--r--src/compiler/glsl/glcpp/tests/123-garbage-after-else-1.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/123-garbage-after-else-1.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/124-preprocessing-numbers.c37
-rw-r--r--src/compiler/glsl/glcpp/tests/124-preprocessing-numbers.c.expected37
-rw-r--r--src/compiler/glsl/glcpp/tests/125-es-short-circuit-undefined.c27
-rw-r--r--src/compiler/glsl/glcpp/tests/125-es-short-circuit-undefined.c.expected29
-rw-r--r--src/compiler/glsl/glcpp/tests/126-garbage-after-directive.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/126-garbage-after-directive.c.expected7
-rw-r--r--src/compiler/glsl/glcpp/tests/127-pragma-empty.c3
-rw-r--r--src/compiler/glsl/glcpp/tests/127-pragma-empty.c.expected3
-rw-r--r--src/compiler/glsl/glcpp/tests/128-space-before-hash.c21
-rw-r--r--src/compiler/glsl/glcpp/tests/128-space-before-hash.c.expected21
-rw-r--r--src/compiler/glsl/glcpp/tests/129-define-non-identifier.c1
-rw-r--r--src/compiler/glsl/glcpp/tests/129-define-non-identifier.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/130-define-comment.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/130-define-comment.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/131-eof-without-newline.c1
-rw-r--r--src/compiler/glsl/glcpp/tests/131-eof-without-newline.c.expected1
-rw-r--r--src/compiler/glsl/glcpp/tests/132-eof-without-newline-define.c1
-rw-r--r--src/compiler/glsl/glcpp/tests/132-eof-without-newline-define.c.expected1
-rw-r--r--src/compiler/glsl/glcpp/tests/133-eof-without-newline-comment.c1
-rw-r--r--src/compiler/glsl/glcpp/tests/133-eof-without-newline-comment.c.expected2
-rw-r--r--src/compiler/glsl/glcpp/tests/134-hash-comment-directive.c22
-rw-r--r--src/compiler/glsl/glcpp/tests/134-hash-comment-directive.c.expected22
-rw-r--r--src/compiler/glsl/glcpp/tests/135-duplicate-parameter.c2
-rw-r--r--src/compiler/glsl/glcpp/tests/135-duplicate-parameter.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/136-plus-plus-and-minus-minus.c8
-rw-r--r--src/compiler/glsl/glcpp/tests/136-plus-plus-and-minus-minus.c.expected8
-rw-r--r--src/compiler/glsl/glcpp/tests/137-expand-macro-after-period.c4
-rw-r--r--src/compiler/glsl/glcpp/tests/137-expand-macro-after-period.c.expected4
-rw-r--r--src/compiler/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c7
-rw-r--r--src/compiler/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c.expected7
-rw-r--r--src/compiler/glsl/glcpp/tests/139-define-without-macro-name.c5
-rw-r--r--src/compiler/glsl/glcpp/tests/139-define-without-macro-name.c.expected5
-rw-r--r--src/compiler/glsl/glcpp/tests/140-null-directive.c9
-rw-r--r--src/compiler/glsl/glcpp/tests/140-null-directive.c.expected9
-rw-r--r--src/compiler/glsl/glcpp/tests/141-pragma-and-__LINE__.c6
-rw-r--r--src/compiler/glsl/glcpp/tests/141-pragma-and-__LINE__.c.expected6
-rw-r--r--src/compiler/glsl/glcpp/tests/142-defined-within-macro.c94
-rw-r--r--src/compiler/glsl/glcpp/tests/142-defined-within-macro.c.expected94
-rw-r--r--src/compiler/glsl/glcpp/tests/143-multiple-else.c6
-rw-r--r--src/compiler/glsl/glcpp/tests/143-multiple-else.c.expected7
-rwxr-xr-xsrc/compiler/glsl/glcpp/tests/glcpp-test110
-rwxr-xr-xsrc/compiler/glsl/glcpp/tests/glcpp-test-cr-lf141
291 files changed, 2440 insertions, 0 deletions
diff --git a/src/compiler/glsl/glcpp/tests/.gitignore b/src/compiler/glsl/glcpp/tests/.gitignore
new file mode 100644
index 0000000..3802c85
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/.gitignore
@@ -0,0 +1,4 @@
+subtest-cr/
+subtest-lf/
+subtest-cr-lf/
+subtest-lf-cr/
diff --git a/src/compiler/glsl/glcpp/tests/000-content-with-spaces.c b/src/compiler/glsl/glcpp/tests/000-content-with-spaces.c
new file mode 100644
index 0000000..1f2320e
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/000-content-with-spaces.c
@@ -0,0 +1 @@
+ this is four tokens with spaces
diff --git a/src/compiler/glsl/glcpp/tests/000-content-with-spaces.c.expected b/src/compiler/glsl/glcpp/tests/000-content-with-spaces.c.expected
new file mode 100644
index 0000000..0079191
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/000-content-with-spaces.c.expected
@@ -0,0 +1 @@
+ this is four tokens with spaces
diff --git a/src/compiler/glsl/glcpp/tests/001-define.c b/src/compiler/glsl/glcpp/tests/001-define.c
new file mode 100644
index 0000000..cbf2fee
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/001-define.c
@@ -0,0 +1,2 @@
+#define foo 1
+foo
diff --git a/src/compiler/glsl/glcpp/tests/001-define.c.expected b/src/compiler/glsl/glcpp/tests/001-define.c.expected
new file mode 100644
index 0000000..a464d9d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/001-define.c.expected
@@ -0,0 +1,2 @@
+
+1
diff --git a/src/compiler/glsl/glcpp/tests/002-define-chain.c b/src/compiler/glsl/glcpp/tests/002-define-chain.c
new file mode 100644
index 0000000..87d75c6
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/002-define-chain.c
@@ -0,0 +1,3 @@
+#define foo 1
+#define bar foo
+bar
diff --git a/src/compiler/glsl/glcpp/tests/002-define-chain.c.expected b/src/compiler/glsl/glcpp/tests/002-define-chain.c.expected
new file mode 100644
index 0000000..c6c9ee3
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/002-define-chain.c.expected
@@ -0,0 +1,3 @@
+
+
+1
diff --git a/src/compiler/glsl/glcpp/tests/003-define-chain-reverse.c b/src/compiler/glsl/glcpp/tests/003-define-chain-reverse.c
new file mode 100644
index 0000000..a18b724
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/003-define-chain-reverse.c
@@ -0,0 +1,3 @@
+#define bar foo
+#define foo 1
+bar
diff --git a/src/compiler/glsl/glcpp/tests/003-define-chain-reverse.c.expected b/src/compiler/glsl/glcpp/tests/003-define-chain-reverse.c.expected
new file mode 100644
index 0000000..c6c9ee3
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/003-define-chain-reverse.c.expected
@@ -0,0 +1,3 @@
+
+
+1
diff --git a/src/compiler/glsl/glcpp/tests/004-define-recursive.c b/src/compiler/glsl/glcpp/tests/004-define-recursive.c
new file mode 100644
index 0000000..2ac56ea
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/004-define-recursive.c.expected b/src/compiler/glsl/glcpp/tests/004-define-recursive.c.expected
new file mode 100644
index 0000000..2d07687
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/004-define-recursive.c.expected
@@ -0,0 +1,6 @@
+
+
+
+foo
+bar
+baz
diff --git a/src/compiler/glsl/glcpp/tests/005-define-composite-chain.c b/src/compiler/glsl/glcpp/tests/005-define-composite-chain.c
new file mode 100644
index 0000000..f5521df
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/005-define-composite-chain.c
@@ -0,0 +1,3 @@
+#define foo 1
+#define bar a foo
+bar
diff --git a/src/compiler/glsl/glcpp/tests/005-define-composite-chain.c.expected b/src/compiler/glsl/glcpp/tests/005-define-composite-chain.c.expected
new file mode 100644
index 0000000..892975c
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/005-define-composite-chain.c.expected
@@ -0,0 +1,3 @@
+
+
+a 1
diff --git a/src/compiler/glsl/glcpp/tests/006-define-composite-chain-reverse.c b/src/compiler/glsl/glcpp/tests/006-define-composite-chain-reverse.c
new file mode 100644
index 0000000..4bb91a1
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected b/src/compiler/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected
new file mode 100644
index 0000000..892975c
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected
@@ -0,0 +1,3 @@
+
+
+a 1
diff --git a/src/compiler/glsl/glcpp/tests/007-define-composite-recursive.c b/src/compiler/glsl/glcpp/tests/007-define-composite-recursive.c
new file mode 100644
index 0000000..5784565
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/007-define-composite-recursive.c.expected b/src/compiler/glsl/glcpp/tests/007-define-composite-recursive.c.expected
new file mode 100644
index 0000000..0b0b477
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/007-define-composite-recursive.c.expected
@@ -0,0 +1,6 @@
+
+
+
+a b c foo
+b c a bar
+c a b baz
diff --git a/src/compiler/glsl/glcpp/tests/008-define-empty.c b/src/compiler/glsl/glcpp/tests/008-define-empty.c
new file mode 100644
index 0000000..b1bd17e
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/008-define-empty.c
@@ -0,0 +1,2 @@
+#define foo
+foo
diff --git a/src/compiler/glsl/glcpp/tests/008-define-empty.c.expected b/src/compiler/glsl/glcpp/tests/008-define-empty.c.expected
new file mode 100644
index 0000000..d148bc8
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/008-define-empty.c.expected
@@ -0,0 +1,2 @@
+
+
diff --git a/src/compiler/glsl/glcpp/tests/009-undef.c b/src/compiler/glsl/glcpp/tests/009-undef.c
new file mode 100644
index 0000000..3fc1fb4
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/009-undef.c
@@ -0,0 +1,4 @@
+#define foo 1
+foo
+#undef foo
+foo
diff --git a/src/compiler/glsl/glcpp/tests/009-undef.c.expected b/src/compiler/glsl/glcpp/tests/009-undef.c.expected
new file mode 100644
index 0000000..9c0b35a
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/009-undef.c.expected
@@ -0,0 +1,4 @@
+
+1
+
+foo
diff --git a/src/compiler/glsl/glcpp/tests/010-undef-re-define.c b/src/compiler/glsl/glcpp/tests/010-undef-re-define.c
new file mode 100644
index 0000000..32ff737
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/010-undef-re-define.c.expected b/src/compiler/glsl/glcpp/tests/010-undef-re-define.c.expected
new file mode 100644
index 0000000..5970f49
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/010-undef-re-define.c.expected
@@ -0,0 +1,6 @@
+
+1
+
+foo
+
+2
diff --git a/src/compiler/glsl/glcpp/tests/011-define-func-empty.c b/src/compiler/glsl/glcpp/tests/011-define-func-empty.c
new file mode 100644
index 0000000..d9ce13c
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/011-define-func-empty.c
@@ -0,0 +1,2 @@
+#define foo()
+foo()
diff --git a/src/compiler/glsl/glcpp/tests/011-define-func-empty.c.expected b/src/compiler/glsl/glcpp/tests/011-define-func-empty.c.expected
new file mode 100644
index 0000000..d148bc8
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/011-define-func-empty.c.expected
@@ -0,0 +1,2 @@
+
+
diff --git a/src/compiler/glsl/glcpp/tests/012-define-func-no-args.c b/src/compiler/glsl/glcpp/tests/012-define-func-no-args.c
new file mode 100644
index 0000000..c2bb730
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/012-define-func-no-args.c
@@ -0,0 +1,2 @@
+#define foo() bar
+foo()
diff --git a/src/compiler/glsl/glcpp/tests/012-define-func-no-args.c.expected b/src/compiler/glsl/glcpp/tests/012-define-func-no-args.c.expected
new file mode 100644
index 0000000..9f075f2
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/012-define-func-no-args.c.expected
@@ -0,0 +1,2 @@
+
+bar
diff --git a/src/compiler/glsl/glcpp/tests/013-define-func-1-arg-unused.c b/src/compiler/glsl/glcpp/tests/013-define-func-1-arg-unused.c
new file mode 100644
index 0000000..f78fb8b
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/013-define-func-1-arg-unused.c
@@ -0,0 +1,2 @@
+#define foo(x) 1
+foo(bar)
diff --git a/src/compiler/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected b/src/compiler/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected
new file mode 100644
index 0000000..a464d9d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected
@@ -0,0 +1,2 @@
+
+1
diff --git a/src/compiler/glsl/glcpp/tests/014-define-func-2-arg-unused.c b/src/compiler/glsl/glcpp/tests/014-define-func-2-arg-unused.c
new file mode 100644
index 0000000..11feb26
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected b/src/compiler/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected
new file mode 100644
index 0000000..a464d9d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected
@@ -0,0 +1,2 @@
+
+1
diff --git a/src/compiler/glsl/glcpp/tests/015-define-object-with-parens.c b/src/compiler/glsl/glcpp/tests/015-define-object-with-parens.c
new file mode 100644
index 0000000..558da9c
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/015-define-object-with-parens.c.expected b/src/compiler/glsl/glcpp/tests/015-define-object-with-parens.c.expected
new file mode 100644
index 0000000..a70321a
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/015-define-object-with-parens.c.expected
@@ -0,0 +1,4 @@
+
+()1()
+
+()2()
diff --git a/src/compiler/glsl/glcpp/tests/016-define-func-1-arg.c b/src/compiler/glsl/glcpp/tests/016-define-func-1-arg.c
new file mode 100644
index 0000000..a2e2404
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/016-define-func-1-arg.c
@@ -0,0 +1,2 @@
+#define foo(x) ((x)+1)
+foo(bar)
diff --git a/src/compiler/glsl/glcpp/tests/016-define-func-1-arg.c.expected b/src/compiler/glsl/glcpp/tests/016-define-func-1-arg.c.expected
new file mode 100644
index 0000000..6bfe04f
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/016-define-func-1-arg.c.expected
@@ -0,0 +1,2 @@
+
+((bar)+1)
diff --git a/src/compiler/glsl/glcpp/tests/017-define-func-2-args.c b/src/compiler/glsl/glcpp/tests/017-define-func-2-args.c
new file mode 100644
index 0000000..c725383
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/017-define-func-2-args.c.expected b/src/compiler/glsl/glcpp/tests/017-define-func-2-args.c.expected
new file mode 100644
index 0000000..f7a2b8c
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/017-define-func-2-args.c.expected
@@ -0,0 +1,2 @@
+
+((bar)*(baz))
diff --git a/src/compiler/glsl/glcpp/tests/018-define-func-macro-as-parameter.c b/src/compiler/glsl/glcpp/tests/018-define-func-macro-as-parameter.c
new file mode 100644
index 0000000..668130b
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected b/src/compiler/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected
new file mode 100644
index 0000000..c6c9ee3
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected
@@ -0,0 +1,3 @@
+
+
+1
diff --git a/src/compiler/glsl/glcpp/tests/019-define-func-1-arg-multi.c b/src/compiler/glsl/glcpp/tests/019-define-func-1-arg-multi.c
new file mode 100644
index 0000000..c4e62b2
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected b/src/compiler/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected
new file mode 100644
index 0000000..1e89b8c
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected
@@ -0,0 +1,2 @@
+
+(this is more than one word)
diff --git a/src/compiler/glsl/glcpp/tests/020-define-func-2-arg-multi.c b/src/compiler/glsl/glcpp/tests/020-define-func-2-arg-multi.c
new file mode 100644
index 0000000..3049ad1
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected b/src/compiler/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected
new file mode 100644
index 0000000..19f59f5
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected
@@ -0,0 +1,2 @@
+
+one fish,two fish,red fish,blue fish
diff --git a/src/compiler/glsl/glcpp/tests/021-define-func-compose.c b/src/compiler/glsl/glcpp/tests/021-define-func-compose.c
new file mode 100644
index 0000000..21ddd0e
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/021-define-func-compose.c.expected b/src/compiler/glsl/glcpp/tests/021-define-func-compose.c.expected
new file mode 100644
index 0000000..87f51f0
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/021-define-func-compose.c.expected
@@ -0,0 +1,3 @@
+
+
+(2*((1+(3))))
diff --git a/src/compiler/glsl/glcpp/tests/022-define-func-arg-with-parens.c b/src/compiler/glsl/glcpp/tests/022-define-func-arg-with-parens.c
new file mode 100644
index 0000000..c20d73a
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected b/src/compiler/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected
new file mode 100644
index 0000000..1dfc669
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected
@@ -0,0 +1,2 @@
+
+(argument(including parens)for the win)
diff --git a/src/compiler/glsl/glcpp/tests/023-define-extra-whitespace.c b/src/compiler/glsl/glcpp/tests/023-define-extra-whitespace.c
new file mode 100644
index 0000000..7ebfed6
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/023-define-extra-whitespace.c.expected b/src/compiler/glsl/glcpp/tests/023-define-extra-whitespace.c.expected
new file mode 100644
index 0000000..9c58275
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/023-define-extra-whitespace.c.expected
@@ -0,0 +1,8 @@
+
+
+
+
+1
+2
+3 4
+5 6 7
diff --git a/src/compiler/glsl/glcpp/tests/024-define-chain-to-self-recursion.c b/src/compiler/glsl/glcpp/tests/024-define-chain-to-self-recursion.c
new file mode 100644
index 0000000..e788adc
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected b/src/compiler/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected
new file mode 100644
index 0000000..15600af
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected
@@ -0,0 +1,3 @@
+
+
+foo
diff --git a/src/compiler/glsl/glcpp/tests/025-func-macro-as-non-macro.c b/src/compiler/glsl/glcpp/tests/025-func-macro-as-non-macro.c
new file mode 100644
index 0000000..b433671
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/025-func-macro-as-non-macro.c
@@ -0,0 +1,2 @@
+#define foo(bar) bar
+foo bar
diff --git a/src/compiler/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected b/src/compiler/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected
new file mode 100644
index 0000000..4a59f05
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected
@@ -0,0 +1,2 @@
+
+foo bar
diff --git a/src/compiler/glsl/glcpp/tests/026-define-func-extra-newlines.c b/src/compiler/glsl/glcpp/tests/026-define-func-extra-newlines.c
new file mode 100644
index 0000000..0d83740
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/026-define-func-extra-newlines.c
@@ -0,0 +1,6 @@
+#define foo(a) bar
+
+foo
+(
+1
+)
diff --git a/src/compiler/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected b/src/compiler/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected
new file mode 100644
index 0000000..5e3c70f
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected
@@ -0,0 +1,3 @@
+
+
+bar
diff --git a/src/compiler/glsl/glcpp/tests/027-define-chain-obj-to-func.c b/src/compiler/glsl/glcpp/tests/027-define-chain-obj-to-func.c
new file mode 100644
index 0000000..5ccb52c
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected b/src/compiler/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected
new file mode 100644
index 0000000..94c15f9
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected
@@ -0,0 +1,3 @@
+
+
+success
diff --git a/src/compiler/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c b/src/compiler/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c
new file mode 100644
index 0000000..44962a7
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected b/src/compiler/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected
new file mode 100644
index 0000000..94c15f9
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected
@@ -0,0 +1,3 @@
+
+
+success
diff --git a/src/compiler/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c b/src/compiler/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c
new file mode 100644
index 0000000..261f7d2
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected b/src/compiler/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected
new file mode 100644
index 0000000..94c15f9
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected
@@ -0,0 +1,3 @@
+
+
+success
diff --git a/src/compiler/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c b/src/compiler/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c
new file mode 100644
index 0000000..e56fbef
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected b/src/compiler/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected
new file mode 100644
index 0000000..bed826e
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected
@@ -0,0 +1,4 @@
+
+
+
+success
diff --git a/src/compiler/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c b/src/compiler/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c
new file mode 100644
index 0000000..3f4c874
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected b/src/compiler/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected
new file mode 100644
index 0000000..bed826e
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected
@@ -0,0 +1,4 @@
+
+
+
+success
diff --git a/src/compiler/glsl/glcpp/tests/032-define-func-self-recurse.c b/src/compiler/glsl/glcpp/tests/032-define-func-self-recurse.c
new file mode 100644
index 0000000..b3ac70f
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/032-define-func-self-recurse.c.expected b/src/compiler/glsl/glcpp/tests/032-define-func-self-recurse.c.expected
new file mode 100644
index 0000000..983f941
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/032-define-func-self-recurse.c.expected
@@ -0,0 +1,2 @@
+
+foo(2*(3))
diff --git a/src/compiler/glsl/glcpp/tests/033-define-func-self-compose.c b/src/compiler/glsl/glcpp/tests/033-define-func-self-compose.c
new file mode 100644
index 0000000..f65e482
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/033-define-func-self-compose.c.expected b/src/compiler/glsl/glcpp/tests/033-define-func-self-compose.c.expected
new file mode 100644
index 0000000..0818362
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/033-define-func-self-compose.c.expected
@@ -0,0 +1,2 @@
+
+foo(2*(foo(2*(3))))
diff --git a/src/compiler/glsl/glcpp/tests/034-define-func-self-compose-non-func.c b/src/compiler/glsl/glcpp/tests/034-define-func-self-compose-non-func.c
new file mode 100644
index 0000000..209a5f7
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected b/src/compiler/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected
new file mode 100644
index 0000000..3f808fe
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected
@@ -0,0 +1,2 @@
+
+foo
diff --git a/src/compiler/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c b/src/compiler/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c
new file mode 100644
index 0000000..c307fbe
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected b/src/compiler/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected
new file mode 100644
index 0000000..09dfdd6
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected
@@ -0,0 +1,2 @@
+
+1+foo
diff --git a/src/compiler/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c b/src/compiler/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c
new file mode 100644
index 0000000..b21ff33
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected b/src/compiler/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected
new file mode 100644
index 0000000..580ed95
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected
@@ -0,0 +1,3 @@
+
+
+more success
diff --git a/src/compiler/glsl/glcpp/tests/037-finalize-unexpanded-macro.c b/src/compiler/glsl/glcpp/tests/037-finalize-unexpanded-macro.c
new file mode 100644
index 0000000..b3a2f37
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected b/src/compiler/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected
new file mode 100644
index 0000000..e804d7e
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected
@@ -0,0 +1,3 @@
+
+
+expand(just once)
diff --git a/src/compiler/glsl/glcpp/tests/038-func-arg-with-commas.c b/src/compiler/glsl/glcpp/tests/038-func-arg-with-commas.c
new file mode 100644
index 0000000..1407c7d
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/038-func-arg-with-commas.c.expected b/src/compiler/glsl/glcpp/tests/038-func-arg-with-commas.c.expected
new file mode 100644
index 0000000..6544adb
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/038-func-arg-with-commas.c.expected
@@ -0,0 +1,2 @@
+
+success
diff --git a/src/compiler/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c b/src/compiler/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c
new file mode 100644
index 0000000..a7c053b
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c
@@ -0,0 +1,24 @@
+/* This works. */
+#define foo(a) (a)
+#define bar two,words
+foo(bar)
+
+/* So does this. */
+#define foo2(a,b) (a separate b)
+#define foo2_wrap(a) foo2(a)
+foo2_wrap(bar)
+
+/* But this generates an error. */
+#define foo_wrap(a) foo(a)
+foo_wrap(bar)
+
+/* Adding parentheses to foo_wrap fixes it. */
+#define foo_wrap_parens(a) foo((a))
+foo_wrap_parens(bar)
+
+/* As does adding parentheses to bar */
+#define bar_parens (two,words)
+foo_wrap(bar_parens)
+foo_wrap_parens(bar_parens)
+
+
diff --git a/src/compiler/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected b/src/compiler/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected
new file mode 100644
index 0000000..4cc7953
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected
@@ -0,0 +1,26 @@
+0:12(21): preprocessor error: Error: macro foo invoked with 2 arguments (expected 1)
+
+
+
+
+(two,words)
+
+
+
+
+(two separate words)
+
+
+
+foo(two,words)
+
+
+
+((two,words))
+
+
+
+((two,words))
+(((two,words)))
+
+
diff --git a/src/compiler/glsl/glcpp/tests/040-token-pasting.c b/src/compiler/glsl/glcpp/tests/040-token-pasting.c
new file mode 100644
index 0000000..caab3ba
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/040-token-pasting.c
@@ -0,0 +1,2 @@
+#define paste(a,b) a ## b
+paste(one , token)
diff --git a/src/compiler/glsl/glcpp/tests/040-token-pasting.c.expected b/src/compiler/glsl/glcpp/tests/040-token-pasting.c.expected
new file mode 100644
index 0000000..48e836e
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/040-token-pasting.c.expected
@@ -0,0 +1,2 @@
+
+onetoken
diff --git a/src/compiler/glsl/glcpp/tests/041-if-0.c b/src/compiler/glsl/glcpp/tests/041-if-0.c
new file mode 100644
index 0000000..2cab677
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/041-if-0.c
@@ -0,0 +1,5 @@
+success_1
+#if 0
+failure
+#endif
+success_2
diff --git a/src/compiler/glsl/glcpp/tests/041-if-0.c.expected b/src/compiler/glsl/glcpp/tests/041-if-0.c.expected
new file mode 100644
index 0000000..8b506b3
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/041-if-0.c.expected
@@ -0,0 +1,5 @@
+success_1
+
+
+
+success_2
diff --git a/src/compiler/glsl/glcpp/tests/042-if-1.c b/src/compiler/glsl/glcpp/tests/042-if-1.c
new file mode 100644
index 0000000..874a25c
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/042-if-1.c
@@ -0,0 +1,5 @@
+success_1
+#if 1
+success_2
+#endif
+success_3
diff --git a/src/compiler/glsl/glcpp/tests/042-if-1.c.expected b/src/compiler/glsl/glcpp/tests/042-if-1.c.expected
new file mode 100644
index 0000000..a6ae946
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/042-if-1.c.expected
@@ -0,0 +1,5 @@
+success_1
+
+success_2
+
+success_3
diff --git a/src/compiler/glsl/glcpp/tests/043-if-0-else.c b/src/compiler/glsl/glcpp/tests/043-if-0-else.c
new file mode 100644
index 0000000..323351f
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/043-if-0-else.c.expected b/src/compiler/glsl/glcpp/tests/043-if-0-else.c.expected
new file mode 100644
index 0000000..3d7e6be
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/043-if-0-else.c.expected
@@ -0,0 +1,7 @@
+success_1
+
+
+
+success_2
+
+success_3
diff --git a/src/compiler/glsl/glcpp/tests/044-if-1-else.c b/src/compiler/glsl/glcpp/tests/044-if-1-else.c
new file mode 100644
index 0000000..28dfc25
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/044-if-1-else.c.expected b/src/compiler/glsl/glcpp/tests/044-if-1-else.c.expected
new file mode 100644
index 0000000..4a31e1c
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/044-if-1-else.c.expected
@@ -0,0 +1,7 @@
+success_1
+
+success_2
+
+
+
+success_3
diff --git a/src/compiler/glsl/glcpp/tests/045-if-0-elif.c b/src/compiler/glsl/glcpp/tests/045-if-0-elif.c
new file mode 100644
index 0000000..e50f686
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/045-if-0-elif.c.expected b/src/compiler/glsl/glcpp/tests/045-if-0-elif.c.expected
new file mode 100644
index 0000000..a9bb158
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/045-if-0-elif.c.expected
@@ -0,0 +1,11 @@
+success_1
+
+
+
+
+
+success_3
+
+
+
+success_4
diff --git a/src/compiler/glsl/glcpp/tests/046-if-1-elsif.c b/src/compiler/glsl/glcpp/tests/046-if-1-elsif.c
new file mode 100644
index 0000000..130515a
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/046-if-1-elsif.c.expected b/src/compiler/glsl/glcpp/tests/046-if-1-elsif.c.expected
new file mode 100644
index 0000000..a499571
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/046-if-1-elsif.c.expected
@@ -0,0 +1,11 @@
+success_1
+
+success_2
+
+
+
+
+
+
+
+success_3
diff --git a/src/compiler/glsl/glcpp/tests/047-if-elif-else.c b/src/compiler/glsl/glcpp/tests/047-if-elif-else.c
new file mode 100644
index 0000000..e8f0838
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/047-if-elif-else.c.expected b/src/compiler/glsl/glcpp/tests/047-if-elif-else.c.expected
new file mode 100644
index 0000000..54d3086
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/047-if-elif-else.c.expected
@@ -0,0 +1,11 @@
+success_1
+
+
+
+
+
+
+
+success_2
+
+success_3
diff --git a/src/compiler/glsl/glcpp/tests/048-if-nested.c b/src/compiler/glsl/glcpp/tests/048-if-nested.c
new file mode 100644
index 0000000..fc4679c
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/048-if-nested.c.expected b/src/compiler/glsl/glcpp/tests/048-if-nested.c.expected
new file mode 100644
index 0000000..8beb9c3
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/048-if-nested.c.expected
@@ -0,0 +1,11 @@
+success_1
+
+
+
+
+
+
+
+
+
+success_2
diff --git a/src/compiler/glsl/glcpp/tests/049-if-expression-precedence.c b/src/compiler/glsl/glcpp/tests/049-if-expression-precedence.c
new file mode 100644
index 0000000..833ea03
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/049-if-expression-precedence.c.expected b/src/compiler/glsl/glcpp/tests/049-if-expression-precedence.c.expected
new file mode 100644
index 0000000..729bdd1
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/049-if-expression-precedence.c.expected
@@ -0,0 +1,5 @@
+
+
+
+success
+
diff --git a/src/compiler/glsl/glcpp/tests/050-if-defined.c b/src/compiler/glsl/glcpp/tests/050-if-defined.c
new file mode 100644
index 0000000..34f0f95
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/050-if-defined.c.expected b/src/compiler/glsl/glcpp/tests/050-if-defined.c.expected
new file mode 100644
index 0000000..737eb8d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/050-if-defined.c.expected
@@ -0,0 +1,17 @@
+
+
+
+success_1
+
+
+
+success_2
+
+
+
+
+
+
+
+success_3
+
diff --git a/src/compiler/glsl/glcpp/tests/051-if-relational.c b/src/compiler/glsl/glcpp/tests/051-if-relational.c
new file mode 100644
index 0000000..c3db488
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/051-if-relational.c.expected b/src/compiler/glsl/glcpp/tests/051-if-relational.c.expected
new file mode 100644
index 0000000..652fefd
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/051-if-relational.c.expected
@@ -0,0 +1,35 @@
+
+
+
+success_1
+
+
+
+success_2
+
+
+
+
+
+success_3
+
+
+
+
+
+success_3
+
+
+
+
+
+
+
+success_4
+
+
+
+success_5
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/052-if-bitwise.c b/src/compiler/glsl/glcpp/tests/052-if-bitwise.c
new file mode 100644
index 0000000..2d8e45e
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/052-if-bitwise.c.expected b/src/compiler/glsl/glcpp/tests/052-if-bitwise.c.expected
new file mode 100644
index 0000000..44e52b2
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/052-if-bitwise.c.expected
@@ -0,0 +1,20 @@
+
+
+
+success_1
+
+
+success_2
+
+
+
+
+
+
+success_3
+
+
+success_4
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/053-if-divide-and-shift.c b/src/compiler/glsl/glcpp/tests/053-if-divide-and-shift.c
new file mode 100644
index 0000000..d24c54a
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/053-if-divide-and-shift.c.expected b/src/compiler/glsl/glcpp/tests/053-if-divide-and-shift.c.expected
new file mode 100644
index 0000000..7e78e04
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/053-if-divide-and-shift.c.expected
@@ -0,0 +1,15 @@
+
+
+
+success_1
+
+
+success_2
+
+
+
+
+
+
+success_3
+
diff --git a/src/compiler/glsl/glcpp/tests/054-if-with-macros.c b/src/compiler/glsl/glcpp/tests/054-if-with-macros.c
new file mode 100644
index 0000000..3da79a0
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/054-if-with-macros.c.expected b/src/compiler/glsl/glcpp/tests/054-if-with-macros.c.expected
new file mode 100644
index 0000000..70f737c
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/054-if-with-macros.c.expected
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+success_1
+
+
+success_2
+
+
+
+
+success_3
+
+
+
+
+success_4
+
+
+
+
+
+
+success_5
+
+
+success_6
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c b/src/compiler/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c
new file mode 100644
index 0000000..00f2c23
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected b/src/compiler/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected
new file mode 100644
index 0000000..94c15f9
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected
@@ -0,0 +1,3 @@
+
+
+success
diff --git a/src/compiler/glsl/glcpp/tests/056-macro-argument-with-comma.c b/src/compiler/glsl/glcpp/tests/056-macro-argument-with-comma.c
new file mode 100644
index 0000000..58701d1
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected b/src/compiler/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected
new file mode 100644
index 0000000..bed826e
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected
@@ -0,0 +1,4 @@
+
+
+
+success
diff --git a/src/compiler/glsl/glcpp/tests/057-empty-arguments.c b/src/compiler/glsl/glcpp/tests/057-empty-arguments.c
new file mode 100644
index 0000000..6140232
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/057-empty-arguments.c.expected b/src/compiler/glsl/glcpp/tests/057-empty-arguments.c.expected
new file mode 100644
index 0000000..7d97e15
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/057-empty-arguments.c.expected
@@ -0,0 +1,6 @@
+
+success
+
+success
+
+success
diff --git a/src/compiler/glsl/glcpp/tests/058-token-pasting-empty-arguments.c b/src/compiler/glsl/glcpp/tests/058-token-pasting-empty-arguments.c
new file mode 100644
index 0000000..8ac260c
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected b/src/compiler/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected
new file mode 100644
index 0000000..e0967a1
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected
@@ -0,0 +1,5 @@
+
+ab
+a
+b
+
diff --git a/src/compiler/glsl/glcpp/tests/059-token-pasting-integer.c b/src/compiler/glsl/glcpp/tests/059-token-pasting-integer.c
new file mode 100644
index 0000000..37b895a
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/059-token-pasting-integer.c.expected b/src/compiler/glsl/glcpp/tests/059-token-pasting-integer.c.expected
new file mode 100644
index 0000000..f1288aa
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/059-token-pasting-integer.c.expected
@@ -0,0 +1,4 @@
+
+12
+1000
+identifier2
diff --git a/src/compiler/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c b/src/compiler/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c
new file mode 100644
index 0000000..ed80ea8
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected b/src/compiler/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected
new file mode 100644
index 0000000..3e5501a
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected
@@ -0,0 +1,3 @@
+
+
+5*2
diff --git a/src/compiler/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c b/src/compiler/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c
new file mode 100644
index 0000000..6dbfd1f
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected b/src/compiler/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected
new file mode 100644
index 0000000..15eb64b
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected
@@ -0,0 +1,5 @@
+
+
+
+
+success
diff --git a/src/compiler/glsl/glcpp/tests/062-if-0-skips-garbage.c b/src/compiler/glsl/glcpp/tests/062-if-0-skips-garbage.c
new file mode 100644
index 0000000..d9e439b
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected b/src/compiler/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected
new file mode 100644
index 0000000..3f2ff2d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/063-comments.c b/src/compiler/glsl/glcpp/tests/063-comments.c
new file mode 100644
index 0000000..e641d2f
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/063-comments.c.expected b/src/compiler/glsl/glcpp/tests/063-comments.c.expected
new file mode 100644
index 0000000..f6e10ce
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/063-comments.c.expected
@@ -0,0 +1,20 @@
+
+
+
+f = g /h;
+ l();
+m = n
++ p;
+
+
+
+
+
+
+
+more code here
+
+
+are not treated like comments.
+
+
diff --git a/src/compiler/glsl/glcpp/tests/064-version.c b/src/compiler/glsl/glcpp/tests/064-version.c
new file mode 100644
index 0000000..2132648
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/064-version.c
@@ -0,0 +1,2 @@
+#version 130
+#define FOO
diff --git a/src/compiler/glsl/glcpp/tests/064-version.c.expected b/src/compiler/glsl/glcpp/tests/064-version.c.expected
new file mode 100644
index 0000000..4036b1e
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/064-version.c.expected
@@ -0,0 +1,2 @@
+#version 130
+
diff --git a/src/compiler/glsl/glcpp/tests/065-if-defined-parens.c b/src/compiler/glsl/glcpp/tests/065-if-defined-parens.c
new file mode 100644
index 0000000..48aa0f8
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/065-if-defined-parens.c.expected b/src/compiler/glsl/glcpp/tests/065-if-defined-parens.c.expected
new file mode 100644
index 0000000..737eb8d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/065-if-defined-parens.c.expected
@@ -0,0 +1,17 @@
+
+
+
+success_1
+
+
+
+success_2
+
+
+
+
+
+
+
+success_3
+
diff --git a/src/compiler/glsl/glcpp/tests/066-if-nospace-expression.c b/src/compiler/glsl/glcpp/tests/066-if-nospace-expression.c
new file mode 100644
index 0000000..3b0b473
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/066-if-nospace-expression.c
@@ -0,0 +1,3 @@
+#if(1)
+success
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/066-if-nospace-expression.c.expected b/src/compiler/glsl/glcpp/tests/066-if-nospace-expression.c.expected
new file mode 100644
index 0000000..5a28fb3
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/066-if-nospace-expression.c.expected
@@ -0,0 +1,3 @@
+
+success
+
diff --git a/src/compiler/glsl/glcpp/tests/067-nested-ifdef-ifndef.c b/src/compiler/glsl/glcpp/tests/067-nested-ifdef-ifndef.c
new file mode 100644
index 0000000..f46cce4
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected b/src/compiler/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected
new file mode 100644
index 0000000..9a5ed2e
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+success
+
+
+
+
+
+
+
+success
+
+
+
+
+
+
+
+
+
+success
+
+
+
+
+
+
+
+
+
+success
diff --git a/src/compiler/glsl/glcpp/tests/068-accidental-pasting.c b/src/compiler/glsl/glcpp/tests/068-accidental-pasting.c
new file mode 100644
index 0000000..699ac51
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/068-accidental-pasting.c
@@ -0,0 +1,11 @@
+#define empty
+<empty<
+<empty=
+>empty>
+>empty=
+=empty=
+!empty=
+&empty&
+|empty|
++empty+
+-empty-
diff --git a/src/compiler/glsl/glcpp/tests/068-accidental-pasting.c.expected b/src/compiler/glsl/glcpp/tests/068-accidental-pasting.c.expected
new file mode 100644
index 0000000..27582cd
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/068-accidental-pasting.c.expected
@@ -0,0 +1,11 @@
+
+< <
+< =
+> >
+> =
+= =
+! =
+& &
+| |
++ +
+- -
diff --git a/src/compiler/glsl/glcpp/tests/069-repeated-argument.c b/src/compiler/glsl/glcpp/tests/069-repeated-argument.c
new file mode 100644
index 0000000..2b46ead
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/069-repeated-argument.c
@@ -0,0 +1,2 @@
+#define double(x) x x
+double(1)
diff --git a/src/compiler/glsl/glcpp/tests/069-repeated-argument.c.expected b/src/compiler/glsl/glcpp/tests/069-repeated-argument.c.expected
new file mode 100644
index 0000000..8b4b095
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/069-repeated-argument.c.expected
@@ -0,0 +1,2 @@
+
+1 1
diff --git a/src/compiler/glsl/glcpp/tests/070-undefined-macro-in-expression.c b/src/compiler/glsl/glcpp/tests/070-undefined-macro-in-expression.c
new file mode 100644
index 0000000..d15a484
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/070-undefined-macro-in-expression.c
@@ -0,0 +1,5 @@
+#if UNDEFINED_MACRO
+Failure
+#else
+Success
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected b/src/compiler/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected
new file mode 100644
index 0000000..44b93a4
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected
@@ -0,0 +1,5 @@
+
+
+
+Success
+
diff --git a/src/compiler/glsl/glcpp/tests/071-punctuator.c b/src/compiler/glsl/glcpp/tests/071-punctuator.c
new file mode 100644
index 0000000..959d682
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/071-punctuator.c
@@ -0,0 +1 @@
+a = b
diff --git a/src/compiler/glsl/glcpp/tests/071-punctuator.c.expected b/src/compiler/glsl/glcpp/tests/071-punctuator.c.expected
new file mode 100644
index 0000000..959d682
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/071-punctuator.c.expected
@@ -0,0 +1 @@
+a = b
diff --git a/src/compiler/glsl/glcpp/tests/072-token-pasting-same-line.c b/src/compiler/glsl/glcpp/tests/072-token-pasting-same-line.c
new file mode 100644
index 0000000..e421e9d
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/072-token-pasting-same-line.c.expected b/src/compiler/glsl/glcpp/tests/072-token-pasting-same-line.c.expected
new file mode 100644
index 0000000..7b80af7
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/072-token-pasting-same-line.c.expected
@@ -0,0 +1,2 @@
+
+success_1 success_2 success_3
diff --git a/src/compiler/glsl/glcpp/tests/073-if-in-ifdef.c b/src/compiler/glsl/glcpp/tests/073-if-in-ifdef.c
new file mode 100644
index 0000000..61a4809
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/073-if-in-ifdef.c
@@ -0,0 +1,4 @@
+#ifdef UNDEF
+#if UNDEF > 1
+#endif
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/073-if-in-ifdef.c.expected b/src/compiler/glsl/glcpp/tests/073-if-in-ifdef.c.expected
new file mode 100644
index 0000000..fd40910
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/073-if-in-ifdef.c.expected
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/074-elif-undef.c b/src/compiler/glsl/glcpp/tests/074-elif-undef.c
new file mode 100644
index 0000000..67aac89
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/074-elif-undef.c
@@ -0,0 +1,3 @@
+#ifndef UNDEF
+#elif UNDEF < 0
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/074-elif-undef.c.expected b/src/compiler/glsl/glcpp/tests/074-elif-undef.c.expected
new file mode 100644
index 0000000..b28b04f
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/074-elif-undef.c.expected
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/075-elif-elif-undef.c b/src/compiler/glsl/glcpp/tests/075-elif-elif-undef.c
new file mode 100644
index 0000000..264bc4f
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/075-elif-elif-undef.c.expected b/src/compiler/glsl/glcpp/tests/075-elif-elif-undef.c.expected
new file mode 100644
index 0000000..fd40910
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/075-elif-elif-undef.c.expected
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/076-elif-undef-nested.c b/src/compiler/glsl/glcpp/tests/076-elif-undef-nested.c
new file mode 100644
index 0000000..ebd550e
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/076-elif-undef-nested.c.expected b/src/compiler/glsl/glcpp/tests/076-elif-undef-nested.c.expected
new file mode 100644
index 0000000..3f2ff2d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/076-elif-undef-nested.c.expected
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/077-else-without-if.c b/src/compiler/glsl/glcpp/tests/077-else-without-if.c
new file mode 100644
index 0000000..81f00bf
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/077-else-without-if.c
@@ -0,0 +1 @@
+#else
diff --git a/src/compiler/glsl/glcpp/tests/077-else-without-if.c.expected b/src/compiler/glsl/glcpp/tests/077-else-without-if.c.expected
new file mode 100644
index 0000000..69f3404
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/077-else-without-if.c.expected
@@ -0,0 +1,3 @@
+0:1(1): preprocessor error: #else without #if
+
+
diff --git a/src/compiler/glsl/glcpp/tests/078-elif-without-if.c b/src/compiler/glsl/glcpp/tests/078-elif-without-if.c
new file mode 100644
index 0000000..60466b3
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/078-elif-without-if.c
@@ -0,0 +1 @@
+#elif defined FOO
diff --git a/src/compiler/glsl/glcpp/tests/078-elif-without-if.c.expected b/src/compiler/glsl/glcpp/tests/078-elif-without-if.c.expected
new file mode 100644
index 0000000..b8e40ec
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/078-elif-without-if.c.expected
@@ -0,0 +1,3 @@
+0:1(1): preprocessor error: #elif without #if
+
+
diff --git a/src/compiler/glsl/glcpp/tests/079-endif-without-if.c b/src/compiler/glsl/glcpp/tests/079-endif-without-if.c
new file mode 100644
index 0000000..69331c3
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/079-endif-without-if.c
@@ -0,0 +1 @@
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/079-endif-without-if.c.expected b/src/compiler/glsl/glcpp/tests/079-endif-without-if.c.expected
new file mode 100644
index 0000000..7ae579d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/079-endif-without-if.c.expected
@@ -0,0 +1,3 @@
+0:1(1): preprocessor error: #endif without #if
+
+
diff --git a/src/compiler/glsl/glcpp/tests/080-if-without-expression.c b/src/compiler/glsl/glcpp/tests/080-if-without-expression.c
new file mode 100644
index 0000000..a27ba36
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/080-if-without-expression.c.expected b/src/compiler/glsl/glcpp/tests/080-if-without-expression.c.expected
new file mode 100644
index 0000000..2e4cd73
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/080-if-without-expression.c.expected
@@ -0,0 +1,5 @@
+0:2(1): preprocessor error: #if with no expression
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/081-elif-without-expression.c b/src/compiler/glsl/glcpp/tests/081-elif-without-expression.c
new file mode 100644
index 0000000..79c7866
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/081-elif-without-expression.c
@@ -0,0 +1,3 @@
+#if 0
+#elif
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/081-elif-without-expression.c.expected b/src/compiler/glsl/glcpp/tests/081-elif-without-expression.c.expected
new file mode 100644
index 0000000..b607b84
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/081-elif-without-expression.c.expected
@@ -0,0 +1,4 @@
+0:2(1): preprocessor error: #elif with no expression
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/082-invalid-paste.c b/src/compiler/glsl/glcpp/tests/082-invalid-paste.c
new file mode 100644
index 0000000..8b84d50
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/082-invalid-paste.c
@@ -0,0 +1,7 @@
+#define PASTE(x,y) x ## y
+PASTE(<,>)
+PASTE(0,abc)
+PASTE(1,=)
+PASTE(2,@)
+PASTE(3,-4)
+PASTE(4,+5.2)
diff --git a/src/compiler/glsl/glcpp/tests/082-invalid-paste.c.expected b/src/compiler/glsl/glcpp/tests/082-invalid-paste.c.expected
new file mode 100644
index 0000000..b48a2d6
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/082-invalid-paste.c.expected
@@ -0,0 +1,19 @@
+0:2(7): preprocessor error:
+Pasting "<" and ">" does not give a valid preprocessing token.
+0:3(7): preprocessor error:
+Pasting "0" and "abc" does not give a valid preprocessing token.
+0:4(7): preprocessor error:
+Pasting "1" and "=" does not give a valid preprocessing token.
+0:5(7): preprocessor error:
+Pasting "2" and "@" does not give a valid preprocessing token.
+0:6(7): preprocessor error:
+Pasting "3" and "-" does not give a valid preprocessing token.
+0:7(7): preprocessor error:
+Pasting "4" and "+" does not give a valid preprocessing token.
+
+<
+0
+1
+2
+34
+45.2
diff --git a/src/compiler/glsl/glcpp/tests/083-unterminated-if.c b/src/compiler/glsl/glcpp/tests/083-unterminated-if.c
new file mode 100644
index 0000000..9180635
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/083-unterminated-if.c
@@ -0,0 +1,2 @@
+#if 1
+
diff --git a/src/compiler/glsl/glcpp/tests/083-unterminated-if.c.expected b/src/compiler/glsl/glcpp/tests/083-unterminated-if.c.expected
new file mode 100644
index 0000000..4659ab6
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/083-unterminated-if.c.expected
@@ -0,0 +1,4 @@
+0:1(6): preprocessor error: Unterminated #if
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c b/src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c
new file mode 100644
index 0000000..0789ba5
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c
@@ -0,0 +1,2 @@
+#define FUNC(x) (2*(x))
+FUNC(23
diff --git a/src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c.expected b/src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c.expected
new file mode 100644
index 0000000..af49a37
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c.expected
@@ -0,0 +1,2 @@
+0:2(8): preprocessor error: syntax error, unexpected $end
+
diff --git a/src/compiler/glsl/glcpp/tests/085-incorrect-argument-count.c b/src/compiler/glsl/glcpp/tests/085-incorrect-argument-count.c
new file mode 100644
index 0000000..91bea60
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/085-incorrect-argument-count.c.expected b/src/compiler/glsl/glcpp/tests/085-incorrect-argument-count.c.expected
new file mode 100644
index 0000000..d23845b
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/085-incorrect-argument-count.c.expected
@@ -0,0 +1,11 @@
+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/compiler/glsl/glcpp/tests/086-reserved-macro-names.c b/src/compiler/glsl/glcpp/tests/086-reserved-macro-names.c
new file mode 100644
index 0000000..a6b7201
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/086-reserved-macro-names.c
@@ -0,0 +1,3 @@
+#define __BAD reserved
+#define GL_ALSO_BAD() also reserved
+#define THIS__TOO__IS__BAD reserved
diff --git a/src/compiler/glsl/glcpp/tests/086-reserved-macro-names.c.expected b/src/compiler/glsl/glcpp/tests/086-reserved-macro-names.c.expected
new file mode 100644
index 0000000..38b089d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/086-reserved-macro-names.c.expected
@@ -0,0 +1,9 @@
+0:1(9): preprocessor warning: Macro names containing "__" are reserved for use by the implementation.
+
+0:2(9): preprocessor error: Macro names starting with "GL_" are reserved.
+
+0:3(9): preprocessor warning: Macro names containing "__" are reserved for use by the implementation.
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/087-if-comments.c b/src/compiler/glsl/glcpp/tests/087-if-comments.c
new file mode 100644
index 0000000..ce8dc43
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/087-if-comments.c
@@ -0,0 +1,5 @@
+#if (1 == 0) // dangerous comment
+fail
+#else
+win
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/087-if-comments.c.expected b/src/compiler/glsl/glcpp/tests/087-if-comments.c.expected
new file mode 100644
index 0000000..2783a9c
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/087-if-comments.c.expected
@@ -0,0 +1,5 @@
+
+
+
+win
+
diff --git a/src/compiler/glsl/glcpp/tests/088-redefine-macro-legitimate.c b/src/compiler/glsl/glcpp/tests/088-redefine-macro-legitimate.c
new file mode 100644
index 0000000..422c654
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected b/src/compiler/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected
new file mode 100644
index 0000000..3f2ff2d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/089-redefine-macro-error.c b/src/compiler/glsl/glcpp/tests/089-redefine-macro-error.c
new file mode 100644
index 0000000..b3d1391
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/089-redefine-macro-error.c.expected b/src/compiler/glsl/glcpp/tests/089-redefine-macro-error.c.expected
new file mode 100644
index 0000000..a945161
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/089-redefine-macro-error.c.expected
@@ -0,0 +1,29 @@
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/090-hash-error.c b/src/compiler/glsl/glcpp/tests/090-hash-error.c
new file mode 100644
index 0000000..d19bb7f
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/090-hash-error.c
@@ -0,0 +1 @@
+#error human error
diff --git a/src/compiler/glsl/glcpp/tests/090-hash-error.c.expected b/src/compiler/glsl/glcpp/tests/090-hash-error.c.expected
new file mode 100644
index 0000000..876a6ea
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/090-hash-error.c.expected
@@ -0,0 +1 @@
+0:1(1): preprocessor error: #error human error
diff --git a/src/compiler/glsl/glcpp/tests/091-hash-line.c b/src/compiler/glsl/glcpp/tests/091-hash-line.c
new file mode 100644
index 0000000..26d7038
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/091-hash-line.c
@@ -0,0 +1,14 @@
+#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
+#line 45 2 /* A line with a comment */
+#define NINETY 90
+#define TWO 2
+#line NINETY TWO /* A #line line with macro expansion */
+#define FUNCTION_LIKE_MACRO(source, line) source line
+#line FUNCTION_LIKE_MACRO(180,2)
diff --git a/src/compiler/glsl/glcpp/tests/091-hash-line.c.expected b/src/compiler/glsl/glcpp/tests/091-hash-line.c.expected
new file mode 100644
index 0000000..ac9ab25
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/091-hash-line.c.expected
@@ -0,0 +1,14 @@
+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
+#line 0
+#line 25
+#line 0 1
+#line 30 2
+#line 45 2
+
+
+#line 90 2
+
+#line 180 2
diff --git a/src/compiler/glsl/glcpp/tests/092-redefine-macro-error-2.c b/src/compiler/glsl/glcpp/tests/092-redefine-macro-error-2.c
new file mode 100644
index 0000000..3c161a5
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/092-redefine-macro-error-2.c
@@ -0,0 +1,5 @@
+#define A
+#define A 1
+
+#define B 1
+#define B
diff --git a/src/compiler/glsl/glcpp/tests/092-redefine-macro-error-2.c.expected b/src/compiler/glsl/glcpp/tests/092-redefine-macro-error-2.c.expected
new file mode 100644
index 0000000..698294d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/092-redefine-macro-error-2.c.expected
@@ -0,0 +1,9 @@
+0:2(9): preprocessor error: Redefinition of macro A
+
+0:5(9): preprocessor error: Redefinition of macro B
+
+
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/093-divide-by-zero.c b/src/compiler/glsl/glcpp/tests/093-divide-by-zero.c
new file mode 100644
index 0000000..bf65d4f
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/093-divide-by-zero.c
@@ -0,0 +1,2 @@
+#if (1 / 0)
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/093-divide-by-zero.c.expected b/src/compiler/glsl/glcpp/tests/093-divide-by-zero.c.expected
new file mode 100644
index 0000000..a858870
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/093-divide-by-zero.c.expected
@@ -0,0 +1,3 @@
+0:1(12): preprocessor error: division by 0 in preprocessor directive
+
+
diff --git a/src/compiler/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c b/src/compiler/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c
new file mode 100644
index 0000000..04497b1
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c
@@ -0,0 +1,13 @@
+/* glcpp is generating a division-by-zero error for this case. It's
+ * easy to argue that it should be short-circuiting the evaluation and
+ * not generating the diagnostic (which happens to be what gcc does).
+ * But it doesn't seem like we should force this behavior on our
+ * pre-processor, (and, as always, the GLSL specification of the
+ * pre-processor is too vague on this point).
+ *
+ * If a short-circuit evaluation optimization does get added to the
+ * pre-processor then it would legitimate to update the expected file
+ * for this test.
+*/
+#if 1 || (1 / 0)
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c.expected b/src/compiler/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c.expected
new file mode 100644
index 0000000..570952b
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c.expected
@@ -0,0 +1,14 @@
+0:12(17): preprocessor error: division by 0 in preprocessor directive
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/095-recursive-define.c b/src/compiler/glsl/glcpp/tests/095-recursive-define.c
new file mode 100644
index 0000000..801d90c
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/095-recursive-define.c
@@ -0,0 +1,3 @@
+#define A(a, b) B(a, b)
+#define C A(0, C)
+C
diff --git a/src/compiler/glsl/glcpp/tests/095-recursive-define.c.expected b/src/compiler/glsl/glcpp/tests/095-recursive-define.c.expected
new file mode 100644
index 0000000..493ab09
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/095-recursive-define.c.expected
@@ -0,0 +1,3 @@
+
+
+B(0, C)
diff --git a/src/compiler/glsl/glcpp/tests/096-paste-twice.c b/src/compiler/glsl/glcpp/tests/096-paste-twice.c
new file mode 100644
index 0000000..8da756f
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/096-paste-twice.c
@@ -0,0 +1,3 @@
+#define paste_twice(a,b,c) a ## b ## c
+paste_twice(just, one, token)
+
diff --git a/src/compiler/glsl/glcpp/tests/096-paste-twice.c.expected b/src/compiler/glsl/glcpp/tests/096-paste-twice.c.expected
new file mode 100644
index 0000000..96c57d2
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/096-paste-twice.c.expected
@@ -0,0 +1,3 @@
+
+justonetoken
+
diff --git a/src/compiler/glsl/glcpp/tests/097-paste-with-non-function-macro.c b/src/compiler/glsl/glcpp/tests/097-paste-with-non-function-macro.c
new file mode 100644
index 0000000..0f46835
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/097-paste-with-non-function-macro.c
@@ -0,0 +1,3 @@
+#define PASTE_MACRO one ## token
+PASTE_MACRO
+
diff --git a/src/compiler/glsl/glcpp/tests/097-paste-with-non-function-macro.c.expected b/src/compiler/glsl/glcpp/tests/097-paste-with-non-function-macro.c.expected
new file mode 100644
index 0000000..36f6699
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/097-paste-with-non-function-macro.c.expected
@@ -0,0 +1,3 @@
+
+onetoken
+
diff --git a/src/compiler/glsl/glcpp/tests/098-elif-undefined.c b/src/compiler/glsl/glcpp/tests/098-elif-undefined.c
new file mode 100644
index 0000000..1f520d4
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/098-elif-undefined.c
@@ -0,0 +1,7 @@
+#if 0
+Not this
+#elif UNDEFINED_MACRO
+Nor this
+#else
+Yes, this.
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/098-elif-undefined.c.expected b/src/compiler/glsl/glcpp/tests/098-elif-undefined.c.expected
new file mode 100644
index 0000000..c6ef689
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/098-elif-undefined.c.expected
@@ -0,0 +1,7 @@
+
+
+
+
+
+Yes, this.
+
diff --git a/src/compiler/glsl/glcpp/tests/099-c99-example.c b/src/compiler/glsl/glcpp/tests/099-c99-example.c
new file mode 100644
index 0000000..d1976b1
--- /dev/null
+++ b/src/compiler/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/compiler/glsl/glcpp/tests/099-c99-example.c.expected b/src/compiler/glsl/glcpp/tests/099-c99-example.c.expected
new file mode 100644
index 0000000..352bbff
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/099-c99-example.c.expected
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+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/compiler/glsl/glcpp/tests/100-macro-with-colon.c b/src/compiler/glsl/glcpp/tests/100-macro-with-colon.c
new file mode 100644
index 0000000..31dbb9a
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/100-macro-with-colon.c
@@ -0,0 +1,7 @@
+#define one 1
+#define two 2
+
+switch (1) {
+ case one + two:
+ break;
+}
diff --git a/src/compiler/glsl/glcpp/tests/100-macro-with-colon.c.expected b/src/compiler/glsl/glcpp/tests/100-macro-with-colon.c.expected
new file mode 100644
index 0000000..09f1f41
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/100-macro-with-colon.c.expected
@@ -0,0 +1,7 @@
+
+
+
+switch (1) {
+ case 1 + 2:
+ break;
+}
diff --git a/src/compiler/glsl/glcpp/tests/101-macros-used-twice.c b/src/compiler/glsl/glcpp/tests/101-macros-used-twice.c
new file mode 100644
index 0000000..e169380
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/101-macros-used-twice.c
@@ -0,0 +1,16 @@
+#define object 1
+#define function(x) 1
+
+#if object
+once
+#endif
+#if object
+twice
+#endif
+
+#if function(0)
+once
+#endif
+#if function(0)
+once again
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/101-macros-used-twice.c.expected b/src/compiler/glsl/glcpp/tests/101-macros-used-twice.c.expected
new file mode 100644
index 0000000..1e0b306
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/101-macros-used-twice.c.expected
@@ -0,0 +1,16 @@
+
+
+
+
+once
+
+
+twice
+
+
+
+once
+
+
+once again
+
diff --git a/src/compiler/glsl/glcpp/tests/102-garbage-after-endif.c b/src/compiler/glsl/glcpp/tests/102-garbage-after-endif.c
new file mode 100644
index 0000000..301779e
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/102-garbage-after-endif.c
@@ -0,0 +1,2 @@
+#if 0
+#endif garbage
diff --git a/src/compiler/glsl/glcpp/tests/102-garbage-after-endif.c.expected b/src/compiler/glsl/glcpp/tests/102-garbage-after-endif.c.expected
new file mode 100644
index 0000000..d9f3bdc
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/102-garbage-after-endif.c.expected
@@ -0,0 +1,2 @@
+0:2(8): preprocessor error: syntax error, unexpected IDENTIFIER, expecting NEWLINE
+
diff --git a/src/compiler/glsl/glcpp/tests/103-garbage-after-else-0.c b/src/compiler/glsl/glcpp/tests/103-garbage-after-else-0.c
new file mode 100644
index 0000000..c460fea
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/103-garbage-after-else-0.c
@@ -0,0 +1,3 @@
+#if 0
+#else garbage
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/103-garbage-after-else-0.c.expected b/src/compiler/glsl/glcpp/tests/103-garbage-after-else-0.c.expected
new file mode 100644
index 0000000..b053b39
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/103-garbage-after-else-0.c.expected
@@ -0,0 +1,4 @@
+0:2(7): preprocessor error: syntax error, unexpected IDENTIFIER, expecting NEWLINE
+0:1(6): preprocessor error: Unterminated #if
+
+
diff --git a/src/compiler/glsl/glcpp/tests/104-hash-line-followed-by-code.c b/src/compiler/glsl/glcpp/tests/104-hash-line-followed-by-code.c
new file mode 100644
index 0000000..3fbeec4
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/104-hash-line-followed-by-code.c
@@ -0,0 +1,2 @@
+#line 2
+int foo();
diff --git a/src/compiler/glsl/glcpp/tests/104-hash-line-followed-by-code.c.expected b/src/compiler/glsl/glcpp/tests/104-hash-line-followed-by-code.c.expected
new file mode 100644
index 0000000..3fbeec4
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/104-hash-line-followed-by-code.c.expected
@@ -0,0 +1,2 @@
+#line 2
+int foo();
diff --git a/src/compiler/glsl/glcpp/tests/105-multiline-hash-line.c b/src/compiler/glsl/glcpp/tests/105-multiline-hash-line.c
new file mode 100644
index 0000000..da156c6
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/105-multiline-hash-line.c
@@ -0,0 +1,5 @@
+#define X(x) x
+#line X( \
+ 1 \
+ )
+#line 2
diff --git a/src/compiler/glsl/glcpp/tests/105-multiline-hash-line.c.expected b/src/compiler/glsl/glcpp/tests/105-multiline-hash-line.c.expected
new file mode 100644
index 0000000..814cef1
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/105-multiline-hash-line.c.expected
@@ -0,0 +1,5 @@
+
+#line 1
+
+
+#line 2
diff --git a/src/compiler/glsl/glcpp/tests/106-multiline-hash-if.c b/src/compiler/glsl/glcpp/tests/106-multiline-hash-if.c
new file mode 100644
index 0000000..929e93e
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/106-multiline-hash-if.c
@@ -0,0 +1,6 @@
+#define X(x) x
+#if X( \
+ 1 \
+ )
+int foo();
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/106-multiline-hash-if.c.expected b/src/compiler/glsl/glcpp/tests/106-multiline-hash-if.c.expected
new file mode 100644
index 0000000..1c0cbc9
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/106-multiline-hash-if.c.expected
@@ -0,0 +1,6 @@
+
+
+
+
+int foo();
+
diff --git a/src/compiler/glsl/glcpp/tests/107-multiline-hash-elif.c b/src/compiler/glsl/glcpp/tests/107-multiline-hash-elif.c
new file mode 100644
index 0000000..8c1c67a
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/107-multiline-hash-elif.c
@@ -0,0 +1,7 @@
+#define X(x) x
+#if 0
+#elif X( \
+ 1 \
+ )
+int foo();
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/107-multiline-hash-elif.c.expected b/src/compiler/glsl/glcpp/tests/107-multiline-hash-elif.c.expected
new file mode 100644
index 0000000..b0601d7
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/107-multiline-hash-elif.c.expected
@@ -0,0 +1,7 @@
+
+
+
+
+
+int foo();
+
diff --git a/src/compiler/glsl/glcpp/tests/108-no-space-after-hash-version.c b/src/compiler/glsl/glcpp/tests/108-no-space-after-hash-version.c
new file mode 100644
index 0000000..0ce36f2
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/108-no-space-after-hash-version.c
@@ -0,0 +1 @@
+#version110
diff --git a/src/compiler/glsl/glcpp/tests/108-no-space-after-hash-version.c.expected b/src/compiler/glsl/glcpp/tests/108-no-space-after-hash-version.c.expected
new file mode 100644
index 0000000..4f4243f
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/108-no-space-after-hash-version.c.expected
@@ -0,0 +1 @@
+0:1(1): preprocessor error: Illegal non-directive after #
diff --git a/src/compiler/glsl/glcpp/tests/109-no-space-after-hash-line.c b/src/compiler/glsl/glcpp/tests/109-no-space-after-hash-line.c
new file mode 100644
index 0000000..f52966a
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/109-no-space-after-hash-line.c
@@ -0,0 +1 @@
+#line2
diff --git a/src/compiler/glsl/glcpp/tests/109-no-space-after-hash-line.c.expected b/src/compiler/glsl/glcpp/tests/109-no-space-after-hash-line.c.expected
new file mode 100644
index 0000000..4f4243f
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/109-no-space-after-hash-line.c.expected
@@ -0,0 +1 @@
+0:1(1): preprocessor error: Illegal non-directive after #
diff --git a/src/compiler/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c b/src/compiler/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c
new file mode 100644
index 0000000..6d7d0f3
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c
@@ -0,0 +1,3 @@
+#if 1
+#elif110
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c.expected b/src/compiler/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c.expected
new file mode 100644
index 0000000..4d93de4
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/110-no-space-digits-after-hash-elif.c.expected
@@ -0,0 +1,3 @@
+0:2(1): preprocessor error: Illegal non-directive after #
+
+
diff --git a/src/compiler/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c b/src/compiler/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c
new file mode 100644
index 0000000..b341337
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c
@@ -0,0 +1,19 @@
+#if(1)
+success
+#endif
+
+#if+1
+success
+#endif
+
+#if-1
+success
+#endif
+
+#if!1
+success
+#endif
+
+#if~1
+success
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c.expected b/src/compiler/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c.expected
new file mode 100644
index 0000000..5c005c3
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/111-no-space-operator-after-hash-if.c.expected
@@ -0,0 +1,19 @@
+
+success
+
+
+
+success
+
+
+
+success
+
+
+
+
+
+
+
+success
+
diff --git a/src/compiler/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c b/src/compiler/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c
new file mode 100644
index 0000000..e8221bc
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c
@@ -0,0 +1,24 @@
+#if 0
+#elif(1)
+success
+#endif
+
+#if 0
+#elif+1
+success
+#endif
+
+#if 0
+#elif-1
+success
+#endif
+
+#if 0
+#elif!1
+success
+#endif
+
+#if 0
+#elif~1
+success
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c.expected b/src/compiler/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c.expected
new file mode 100644
index 0000000..86b3703
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/112-no-space-operator-after-hash-elif.c.expected
@@ -0,0 +1,24 @@
+
+
+success
+
+
+
+
+success
+
+
+
+
+success
+
+
+
+
+
+
+
+
+
+success
+
diff --git a/src/compiler/glsl/glcpp/tests/113-line-and-file-macros.c b/src/compiler/glsl/glcpp/tests/113-line-and-file-macros.c
new file mode 100644
index 0000000..369c487
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/113-line-and-file-macros.c
@@ -0,0 +1,7 @@
+1. Number of dalmations: __LINE__ __FILE__ __LINE__
+2. Nominal visual acuity: __LINE__ __FILE__ / __LINE__ __FILE__
+3. Battle of Thermopylae, as film: __LINE__ __FILE__ __FILE__
+4. HTTP code for "Not Found": __LINE__ __FILE__ __LINE__
+5. Hexadecimal for 20560: __LINE__ __FILE__ __LINE__ __FILE__
+6: Zip code for Nortonville, KS: __LINE__ __LINE__ __FILE__ __LINE__ __FILE__
+7. James Bond, as a number: __FILE__ __FILE__ __LINE__
diff --git a/src/compiler/glsl/glcpp/tests/113-line-and-file-macros.c.expected b/src/compiler/glsl/glcpp/tests/113-line-and-file-macros.c.expected
new file mode 100644
index 0000000..55bc788
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/113-line-and-file-macros.c.expected
@@ -0,0 +1,7 @@
+1. Number of dalmations: 1 0 1
+2. Nominal visual acuity: 2 0 / 2 0
+3. Battle of Thermopylae, as film: 3 0 0
+4. HTTP code for "Not Found": 4 0 4
+5. Hexadecimal for 20560: 5 0 5 0
+6: Zip code for Nortonville, KS: 6 6 0 6 0
+7. James Bond, as a number: 0 0 7
diff --git a/src/compiler/glsl/glcpp/tests/114-paste-integer-tokens.c b/src/compiler/glsl/glcpp/tests/114-paste-integer-tokens.c
new file mode 100644
index 0000000..d80d9c7
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/114-paste-integer-tokens.c
@@ -0,0 +1,7 @@
+#define PASTE3(a,b,c) a ## b ## c
+#define PASTE4(a,b,c,d) a ## b ## c ## d
+#define PASTE5(a,b,c,d,e) a ## b ## c ## d ## e
+4. HTTP code for "Not Found": PASTE3(__LINE__, __FILE__ , __LINE__)
+5. Hexadecimal for 20560: PASTE4(__LINE__, __FILE__, __LINE__, __FILE__)
+6: Zip code for Nortonville, KS: PASTE5(__LINE__, __LINE__, __FILE__, __LINE__, __FILE__)
+7. James Bond, as a number: PASTE3(__FILE__, __FILE__, __LINE__)
diff --git a/src/compiler/glsl/glcpp/tests/114-paste-integer-tokens.c.expected b/src/compiler/glsl/glcpp/tests/114-paste-integer-tokens.c.expected
new file mode 100644
index 0000000..aa97110
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/114-paste-integer-tokens.c.expected
@@ -0,0 +1,7 @@
+
+
+
+4. HTTP code for "Not Found": 404
+5. Hexadecimal for 20560: 5050
+6: Zip code for Nortonville, KS: 66060
+7. James Bond, as a number: 007
diff --git a/src/compiler/glsl/glcpp/tests/115-line-continuations.c b/src/compiler/glsl/glcpp/tests/115-line-continuations.c
new file mode 100644
index 0000000..105590d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/115-line-continuations.c
@@ -0,0 +1,9 @@
+// This comment continues to the next line, hiding the define \
+#define CONTINUATION_UNSUPPORTED
+
+#ifdef CONTINUATION_UNSUPPORTED
+failure
+#else
+success
+#endif
+
diff --git a/src/compiler/glsl/glcpp/tests/115-line-continuations.c.expected b/src/compiler/glsl/glcpp/tests/115-line-continuations.c.expected
new file mode 100644
index 0000000..428b5e8
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/115-line-continuations.c.expected
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+success
+
+
diff --git a/src/compiler/glsl/glcpp/tests/116-disable-line-continuations.c b/src/compiler/glsl/glcpp/tests/116-disable-line-continuations.c
new file mode 100644
index 0000000..83d5ddf
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/116-disable-line-continuations.c
@@ -0,0 +1,13 @@
+// glcpp-args: --disable-line-continuations
+
+// This comments ends with a backslash \\
+#define NO_CONTINUATION
+
+#ifdef NO_CONTINUATION
+success
+#else
+failure
+#endif
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/116-disable-line-continuations.c.expected b/src/compiler/glsl/glcpp/tests/116-disable-line-continuations.c.expected
new file mode 100644
index 0000000..5ca7892
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/116-disable-line-continuations.c.expected
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+success
+
+
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/117-line-continuation-and-non-continuation-backslash.c b/src/compiler/glsl/glcpp/tests/117-line-continuation-and-non-continuation-backslash.c
new file mode 100644
index 0000000..6a6f282
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/117-line-continuation-and-non-continuation-backslash.c
@@ -0,0 +1,12 @@
+/* This test case is the minimal case to replicate the bug reported here:
+ *
+ * https://bugs.freedesktop.org/show_bug.cgi?id=65112
+ *
+ * To trigger the bug, there must be a line-continuation sequence
+ * (backslash newline), then an additional newline character, and
+ * finally another backslash that is not part of a line-continuation
+ * sequence.
+ */
+\
+
+/* \ */
diff --git a/src/compiler/glsl/glcpp/tests/117-line-continuation-and-non-continuation-backslash.c.expected b/src/compiler/glsl/glcpp/tests/117-line-continuation-and-non-continuation-backslash.c.expected
new file mode 100644
index 0000000..8aaa04d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/117-line-continuation-and-non-continuation-backslash.c.expected
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/118-comment-becomes-space.c b/src/compiler/glsl/glcpp/tests/118-comment-becomes-space.c
new file mode 100644
index 0000000..53e8039
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/118-comment-becomes-space.c
@@ -0,0 +1,4 @@
+#define FOO first/*
+*/second
+
+FOO
diff --git a/src/compiler/glsl/glcpp/tests/118-comment-becomes-space.c.expected b/src/compiler/glsl/glcpp/tests/118-comment-becomes-space.c.expected
new file mode 100644
index 0000000..1fa8135
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/118-comment-becomes-space.c.expected
@@ -0,0 +1,4 @@
+
+
+
+first second
diff --git a/src/compiler/glsl/glcpp/tests/119-elif-after-else.c b/src/compiler/glsl/glcpp/tests/119-elif-after-else.c
new file mode 100644
index 0000000..9b9e923
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/119-elif-after-else.c
@@ -0,0 +1,6 @@
+#if 0
+#else
+int foo;
+#elif 0
+int bar;
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/119-elif-after-else.c.expected b/src/compiler/glsl/glcpp/tests/119-elif-after-else.c.expected
new file mode 100644
index 0000000..6369567
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/119-elif-after-else.c.expected
@@ -0,0 +1,7 @@
+0:4(1): preprocessor error: #elif after #else
+
+
+int foo;
+
+int bar;
+
diff --git a/src/compiler/glsl/glcpp/tests/120-undef-builtin.c b/src/compiler/glsl/glcpp/tests/120-undef-builtin.c
new file mode 100644
index 0000000..49e7696
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/120-undef-builtin.c
@@ -0,0 +1,3 @@
+#undef __LINE__
+#undef __FILE__
+#undef __VERSION__
diff --git a/src/compiler/glsl/glcpp/tests/120-undef-builtin.c.expected b/src/compiler/glsl/glcpp/tests/120-undef-builtin.c.expected
new file mode 100644
index 0000000..3b736df
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/120-undef-builtin.c.expected
@@ -0,0 +1,6 @@
+0:1(1): preprocessor error: Built-in (pre-defined) macro names cannot be undefined.
+0:2(1): preprocessor error: Built-in (pre-defined) macro names cannot be undefined.
+0:3(1): preprocessor error: Built-in (pre-defined) macro names cannot be undefined.
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/121-comment-bug-72686.c b/src/compiler/glsl/glcpp/tests/121-comment-bug-72686.c
new file mode 100644
index 0000000..67ebe73
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/121-comment-bug-72686.c
@@ -0,0 +1,2 @@
+/*
+ */ //
diff --git a/src/compiler/glsl/glcpp/tests/121-comment-bug-72686.c.expected b/src/compiler/glsl/glcpp/tests/121-comment-bug-72686.c.expected
new file mode 100644
index 0000000..8cb7cb9
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/121-comment-bug-72686.c.expected
@@ -0,0 +1,2 @@
+
+
diff --git a/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c b/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c
new file mode 100644
index 0000000..ae7ea09
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c
@@ -0,0 +1,16 @@
+/* Original definitions. */
+#define TWO ( 1+1 )
+#define FOUR (2 + 2)
+#define SIX (3 + 3)
+
+/* Redefinitions with whitespace in same places, but different amounts, (so no
+ * error). */
+#define TWO ( 1+1 )
+#define FOUR (2 + 2)
+#define SIX (3/*comment is whitespace*/+ /* collapsed */ /* to */ /* one */ /* space */ 3)
+
+/* Redefinitions with whitespace in different places. Each of these should
+ * trigger an error. */
+#define TWO (1 + 1)
+#define FOUR ( 2+2 )
+#define SIX (/*not*/3 + 3/*expected*/)
diff --git a/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c.expected b/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c.expected
new file mode 100644
index 0000000..602bdef
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c.expected
@@ -0,0 +1,22 @@
+0:14(9): preprocessor error: Redefinition of macro TWO
+
+0:15(9): preprocessor error: Redefinition of macro FOUR
+
+0:16(9): preprocessor error: Redefinition of macro SIX
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/123-garbage-after-else-1.c b/src/compiler/glsl/glcpp/tests/123-garbage-after-else-1.c
new file mode 100644
index 0000000..0b341a3
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/123-garbage-after-else-1.c
@@ -0,0 +1,3 @@
+#if 1
+#else garbage
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/123-garbage-after-else-1.c.expected b/src/compiler/glsl/glcpp/tests/123-garbage-after-else-1.c.expected
new file mode 100644
index 0000000..b053b39
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/123-garbage-after-else-1.c.expected
@@ -0,0 +1,4 @@
+0:2(7): preprocessor error: syntax error, unexpected IDENTIFIER, expecting NEWLINE
+0:1(6): preprocessor error: Unterminated #if
+
+
diff --git a/src/compiler/glsl/glcpp/tests/124-preprocessing-numbers.c b/src/compiler/glsl/glcpp/tests/124-preprocessing-numbers.c
new file mode 100644
index 0000000..947ba18
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/124-preprocessing-numbers.c
@@ -0,0 +1,37 @@
+#define e THIS_SHOULD_NOT_BE_EXPANDED
+#define E NOR_THIS
+#define p NOT_THIS_EITHER
+#define P AND_SURELY_NOT_THIS
+#define OK CRAZY_BUT_TRUE_THIS_NEITHER
+
+/* This one is actually meant to be expanded */
+#define MUST_EXPAND GO
+
+/* The following are "preprocessing numbers" and should not trigger macro
+ * expansion. */
+1e
+1OK
+
+/* These are also "preprocessing numbers", so no expansion */
+123e+OK
+.23E+OK
+1.3e-OK
+12.E-OK
+123p+OK
+.23P+OK
+1.3p-OK
+12.P-OK
+123..OK
+.23.OK.OK
+
+/* Importantly, just before the MUST_EXPAND in each of these, the preceding
+ * "preprocessing number" ends and we have an actual expression. So the
+ * MUST_EXPAND macro must be expanded (who would have though?) in each case. */
+123ef+MUST_EXPAND
+.23E3-MUST_EXPAND
+1.3e--MUST_EXPAND
+12.E-&MUST_EXPAND
+123p+OK+MUST_EXPAND
+.23P+OK;MUST_EXPAND
+1.3p-OK-MUST_EXPAND
+12.P-OK&MUST_EXPAND
diff --git a/src/compiler/glsl/glcpp/tests/124-preprocessing-numbers.c.expected b/src/compiler/glsl/glcpp/tests/124-preprocessing-numbers.c.expected
new file mode 100644
index 0000000..6ec5888
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/124-preprocessing-numbers.c.expected
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+1e
+1OK
+
+
+123e+OK
+.23E+OK
+1.3e-OK
+12.E-OK
+123p+OK
+.23P+OK
+1.3p-OK
+12.P-OK
+123..OK
+.23.OK.OK
+
+
+
+
+123ef+GO
+.23E3-GO
+1.3e--GO
+12.E-&GO
+123p+OK+GO
+.23P+OK;GO
+1.3p-OK-GO
+12.P-OK&GO
diff --git a/src/compiler/glsl/glcpp/tests/125-es-short-circuit-undefined.c b/src/compiler/glsl/glcpp/tests/125-es-short-circuit-undefined.c
new file mode 100644
index 0000000..4ee29f6
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/125-es-short-circuit-undefined.c
@@ -0,0 +1,27 @@
+/* For GLSL in OpenGL ES, an undefined macro appearing in an #if or #elif
+ * expression, (other than as an argument to defined) is an error.
+ *
+ * Except in the case of a short-circuiting && or || operator, where the
+ * specification explicitly mandates that there be no error.
+ */
+#version 300 es
+
+/* These yield errors */
+#if NOT_DEFINED
+#endif
+
+#if 0
+#elif ALSO_NOT_DEFINED
+#endif
+
+/* But these yield no errors */
+#if 1 || STILL_NOT_DEFINED
+Success
+#endif
+
+#if 0
+#elif 0 && WILL_ANYONE_DEFINE_ANYTHING
+#else
+More success
+#endif
+
diff --git a/src/compiler/glsl/glcpp/tests/125-es-short-circuit-undefined.c.expected b/src/compiler/glsl/glcpp/tests/125-es-short-circuit-undefined.c.expected
new file mode 100644
index 0000000..616aa91
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/125-es-short-circuit-undefined.c.expected
@@ -0,0 +1,29 @@
+0:10(16): preprocessor error: undefined macro NOT_DEFINED in expression (illegal in GLES)
+0:14(23): preprocessor error: undefined macro ALSO_NOT_DEFINED in expression (illegal in GLES)
+
+
+
+
+
+
+#version 300 es
+
+
+
+
+
+
+
+
+
+
+
+Success
+
+
+
+
+
+More success
+
+
diff --git a/src/compiler/glsl/glcpp/tests/126-garbage-after-directive.c b/src/compiler/glsl/glcpp/tests/126-garbage-after-directive.c
new file mode 100644
index 0000000..4c0d290
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/126-garbage-after-directive.c
@@ -0,0 +1,5 @@
+#ifdef MACRO garbage
+#endif
+
+#ifndef MORE garbage
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/126-garbage-after-directive.c.expected b/src/compiler/glsl/glcpp/tests/126-garbage-after-directive.c.expected
new file mode 100644
index 0000000..82a06f8
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/126-garbage-after-directive.c.expected
@@ -0,0 +1,7 @@
+0:1(14): preprocessor error: extra tokens at end of directive
+0:4(14): preprocessor error: extra tokens at end of directive
+
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/127-pragma-empty.c b/src/compiler/glsl/glcpp/tests/127-pragma-empty.c
new file mode 100644
index 0000000..0f9b0b3
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/127-pragma-empty.c
@@ -0,0 +1,3 @@
+/* It seems an odd (and particularly useless) thing to have an empty pragma,
+ * but we probably shouldn't trigger an error in this case. */
+#pragma
diff --git a/src/compiler/glsl/glcpp/tests/127-pragma-empty.c.expected b/src/compiler/glsl/glcpp/tests/127-pragma-empty.c.expected
new file mode 100644
index 0000000..92371a0
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/127-pragma-empty.c.expected
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/128-space-before-hash.c b/src/compiler/glsl/glcpp/tests/128-space-before-hash.c
new file mode 100644
index 0000000..fba9596
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/128-space-before-hash.c
@@ -0,0 +1,21 @@
+ /* Any directive can be preceded by a space. */
+ #version 300
+ #pragma Testing spaces before hash
+ #
+ #line 3
+ #define FOO
+ #ifdef FOO
+ yes
+ #endif
+ #if 0
+ #elif defined FOO
+ yes again
+ #endif
+ #if 0
+ #else
+ for the third time, yes!
+ #endif
+ #undef FOO
+ #ifndef FOO
+ yes, of course
+ #endif
diff --git a/src/compiler/glsl/glcpp/tests/128-space-before-hash.c.expected b/src/compiler/glsl/glcpp/tests/128-space-before-hash.c.expected
new file mode 100644
index 0000000..9babb6f
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/128-space-before-hash.c.expected
@@ -0,0 +1,21 @@
+
+#version 300
+#pragma Testing spaces before hash
+
+#line 3
+
+
+ yes
+
+
+
+ yes again
+
+
+
+ for the third time, yes!
+
+
+
+ yes, of course
+
diff --git a/src/compiler/glsl/glcpp/tests/129-define-non-identifier.c b/src/compiler/glsl/glcpp/tests/129-define-non-identifier.c
new file mode 100644
index 0000000..a229179
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/129-define-non-identifier.c
@@ -0,0 +1 @@
+#define 123 456
diff --git a/src/compiler/glsl/glcpp/tests/129-define-non-identifier.c.expected b/src/compiler/glsl/glcpp/tests/129-define-non-identifier.c.expected
new file mode 100644
index 0000000..fd0b413
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/129-define-non-identifier.c.expected
@@ -0,0 +1,2 @@
+0:1(9): preprocessor error: #define followed by a non-identifier: 123
+0:1(9): preprocessor error: syntax error, unexpected INTEGER_STRING, expecting FUNC_IDENTIFIER or OBJ_IDENTIFIER
diff --git a/src/compiler/glsl/glcpp/tests/130-define-comment.c b/src/compiler/glsl/glcpp/tests/130-define-comment.c
new file mode 100644
index 0000000..3331236
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/130-define-comment.c
@@ -0,0 +1,2 @@
+#define /*...*/ FUNC( /*...*/ x /*...*/ ) /*...*/ FOO( /*...*/ x /*...*/ )
+FUNC(bar)
diff --git a/src/compiler/glsl/glcpp/tests/130-define-comment.c.expected b/src/compiler/glsl/glcpp/tests/130-define-comment.c.expected
new file mode 100644
index 0000000..d789e29
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/130-define-comment.c.expected
@@ -0,0 +1,2 @@
+
+FOO( bar )
diff --git a/src/compiler/glsl/glcpp/tests/131-eof-without-newline.c b/src/compiler/glsl/glcpp/tests/131-eof-without-newline.c
new file mode 100644
index 0000000..240292d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/131-eof-without-newline.c
@@ -0,0 +1 @@
+this file ends with no newline \ No newline at end of file
diff --git a/src/compiler/glsl/glcpp/tests/131-eof-without-newline.c.expected b/src/compiler/glsl/glcpp/tests/131-eof-without-newline.c.expected
new file mode 100644
index 0000000..5780030
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/131-eof-without-newline.c.expected
@@ -0,0 +1 @@
+this file ends with no newline
diff --git a/src/compiler/glsl/glcpp/tests/132-eof-without-newline-define.c b/src/compiler/glsl/glcpp/tests/132-eof-without-newline-define.c
new file mode 100644
index 0000000..6795e35
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/132-eof-without-newline-define.c
@@ -0,0 +1 @@
+#define \ No newline at end of file
diff --git a/src/compiler/glsl/glcpp/tests/132-eof-without-newline-define.c.expected b/src/compiler/glsl/glcpp/tests/132-eof-without-newline-define.c.expected
new file mode 100644
index 0000000..341e5e2
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/132-eof-without-newline-define.c.expected
@@ -0,0 +1 @@
+0:1(1): preprocessor error: #define without macro name
diff --git a/src/compiler/glsl/glcpp/tests/133-eof-without-newline-comment.c b/src/compiler/glsl/glcpp/tests/133-eof-without-newline-comment.c
new file mode 100644
index 0000000..56ec5f7
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/133-eof-without-newline-comment.c
@@ -0,0 +1 @@
+This file ends with no newline within a comment /* \ No newline at end of file
diff --git a/src/compiler/glsl/glcpp/tests/133-eof-without-newline-comment.c.expected b/src/compiler/glsl/glcpp/tests/133-eof-without-newline-comment.c.expected
new file mode 100644
index 0000000..d186f48
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/133-eof-without-newline-comment.c.expected
@@ -0,0 +1,2 @@
+0:1(51): preprocessor error: Unterminated comment
+This file ends with no newline within a comment
diff --git a/src/compiler/glsl/glcpp/tests/134-hash-comment-directive.c b/src/compiler/glsl/glcpp/tests/134-hash-comment-directive.c
new file mode 100644
index 0000000..3015f0e
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/134-hash-comment-directive.c
@@ -0,0 +1,22 @@
+/*...*/ # /*...*/ version 300
+ /*...*/#/*...*/ extension whatever
+ /*..*/ # /*..*/ pragma ignored
+/**/ # /**/ line 4
+ /*...*/# /*...*/ ifdef NOT_DEFINED
+ /*...*/# /*...*/ else
+ /*..*/ #/*..*/ endif
+ /*...*/# /*...*/ ifndef ALSO_NOT_DEFINED
+ /*...*/# /*...*/ else
+ /*..*/ #/*..*/ endif
+/*...*/ # /*...*/ if 0
+ /*...*/#/*...*/ elif 1
+ /*..*/ # /*..*/ else
+ /**/ # /**/ endif
+ /*...*/# /*...*/ define FOO bar
+ /*..*/ #/*..*/ define FUNC() baz
+ /*..*/ # /*..*/ define FUNC2(a,b) b a
+FOO
+FUNC()
+FUNC2(x,y)
+
+
diff --git a/src/compiler/glsl/glcpp/tests/134-hash-comment-directive.c.expected b/src/compiler/glsl/glcpp/tests/134-hash-comment-directive.c.expected
new file mode 100644
index 0000000..760c960
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/134-hash-comment-directive.c.expected
@@ -0,0 +1,22 @@
+#version 300
+#extension whatever
+#pragma ignored
+#line 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+bar
+baz
+y x
+
+
diff --git a/src/compiler/glsl/glcpp/tests/135-duplicate-parameter.c b/src/compiler/glsl/glcpp/tests/135-duplicate-parameter.c
new file mode 100644
index 0000000..fd96bd6
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/135-duplicate-parameter.c
@@ -0,0 +1,2 @@
+#define FOO(a,a) which a?
+#define BAR(x,y,z,x) so very x
diff --git a/src/compiler/glsl/glcpp/tests/135-duplicate-parameter.c.expected b/src/compiler/glsl/glcpp/tests/135-duplicate-parameter.c.expected
new file mode 100644
index 0000000..bc1a334
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/135-duplicate-parameter.c.expected
@@ -0,0 +1,4 @@
+0:1(9): preprocessor error: Duplicate macro parameter "a"
+0:2(9): preprocessor error: Duplicate macro parameter "x"
+
+
diff --git a/src/compiler/glsl/glcpp/tests/136-plus-plus-and-minus-minus.c b/src/compiler/glsl/glcpp/tests/136-plus-plus-and-minus-minus.c
new file mode 100644
index 0000000..167d3c8
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/136-plus-plus-and-minus-minus.c
@@ -0,0 +1,8 @@
+/* The body can include C expressions with ++ and -- */
+a = x++;
+b = ++x;
+c = x--;
+d = --x;
+/* But these are not legal in preprocessor expressions. */
+#if x++ > 4
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/136-plus-plus-and-minus-minus.c.expected b/src/compiler/glsl/glcpp/tests/136-plus-plus-and-minus-minus.c.expected
new file mode 100644
index 0000000..137921b
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/136-plus-plus-and-minus-minus.c.expected
@@ -0,0 +1,8 @@
+0:7(12): preprocessor error: syntax error, unexpected PLUS_PLUS
+
+a = x++;
+b = ++x;
+c = x--;
+d = --x;
+
+
diff --git a/src/compiler/glsl/glcpp/tests/137-expand-macro-after-period.c b/src/compiler/glsl/glcpp/tests/137-expand-macro-after-period.c
new file mode 100644
index 0000000..c8cd47f
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/137-expand-macro-after-period.c
@@ -0,0 +1,4 @@
+#define FIELD(x) foo.x
+#define FIELD_OF(s, x) s.x
+FIELD(bar)
+FIELD_OF(foo, bar)
diff --git a/src/compiler/glsl/glcpp/tests/137-expand-macro-after-period.c.expected b/src/compiler/glsl/glcpp/tests/137-expand-macro-after-period.c.expected
new file mode 100644
index 0000000..f9f5be1
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/137-expand-macro-after-period.c.expected
@@ -0,0 +1,4 @@
+
+
+foo.bar
+foo.bar
diff --git a/src/compiler/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c b/src/compiler/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c
new file mode 100644
index 0000000..38967dc
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c
@@ -0,0 +1,7 @@
+#if 0
+/*
+ * This multi-line comment needs to be 3 lines to test what's intended.
+ */
+#else
+SUCCESS
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c.expected b/src/compiler/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c.expected
new file mode 100644
index 0000000..0d6ef4d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c.expected
@@ -0,0 +1,7 @@
+
+
+
+
+
+SUCCESS
+
diff --git a/src/compiler/glsl/glcpp/tests/139-define-without-macro-name.c b/src/compiler/glsl/glcpp/tests/139-define-without-macro-name.c
new file mode 100644
index 0000000..30e128d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/139-define-without-macro-name.c
@@ -0,0 +1,5 @@
+#define
+#define
+#define /*...*/
+#define //...
+Errors expected because no macro name is ever given!
diff --git a/src/compiler/glsl/glcpp/tests/139-define-without-macro-name.c.expected b/src/compiler/glsl/glcpp/tests/139-define-without-macro-name.c.expected
new file mode 100644
index 0000000..42b02d1
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/139-define-without-macro-name.c.expected
@@ -0,0 +1,5 @@
+0:1(1): preprocessor error: #define without macro name
+0:2(1): preprocessor error: #define without macro name
+0:3(1): preprocessor error: #define without macro name
+0:4(1): preprocessor error: #define without macro name
+Errors expected because no macro name is ever given!
diff --git a/src/compiler/glsl/glcpp/tests/140-null-directive.c b/src/compiler/glsl/glcpp/tests/140-null-directive.c
new file mode 100644
index 0000000..1dcb26e
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/140-null-directive.c
@@ -0,0 +1,9 @@
+/* GLSL accepts a null directive. Let's test that in several variations: */
+#
+ #
+/*....*/#/*....*/
+ /*..*/ # /*..*/
+#//...
+ # //...
+/*....*/#/**///..
+ /*..*/ # /**/ //
diff --git a/src/compiler/glsl/glcpp/tests/140-null-directive.c.expected b/src/compiler/glsl/glcpp/tests/140-null-directive.c.expected
new file mode 100644
index 0000000..fa103f6
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/140-null-directive.c.expected
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/compiler/glsl/glcpp/tests/141-pragma-and-__LINE__.c b/src/compiler/glsl/glcpp/tests/141-pragma-and-__LINE__.c
new file mode 100644
index 0000000..a93f3ce
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/141-pragma-and-__LINE__.c
@@ -0,0 +1,6 @@
+Line 1 /* Test for a bug where #pragma was throwing off the __LINE__ count. */
+Line __LINE__ /* Line 2 */
+#pragma Line 3
+Line __LINE__ /* Line 4 */
+#pragma Line 5
+Line __LINE__ /* Line 6 */
diff --git a/src/compiler/glsl/glcpp/tests/141-pragma-and-__LINE__.c.expected b/src/compiler/glsl/glcpp/tests/141-pragma-and-__LINE__.c.expected
new file mode 100644
index 0000000..330731d
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/141-pragma-and-__LINE__.c.expected
@@ -0,0 +1,6 @@
+Line 1
+Line 2
+#pragma Line 3
+Line 4
+#pragma Line 5
+Line 6
diff --git a/src/compiler/glsl/glcpp/tests/142-defined-within-macro.c b/src/compiler/glsl/glcpp/tests/142-defined-within-macro.c
new file mode 100644
index 0000000..b60c042
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/142-defined-within-macro.c
@@ -0,0 +1,94 @@
+/* Macro using defined with a hard-coded identifier (no parentheses) */
+#define is_foo_defined defined /*...*/ foo
+#undef foo
+#if is_foo_defined
+failure
+#else
+success
+#endif
+#define foo
+#if is_foo_defined
+success
+#else
+failure
+#endif
+
+/* Macro using defined with a hard-coded identifier within parentheses */
+#define is_foo_defined_parens defined /*...*/ ( /*...*/ foo /*...*/ ) //
+#define foo
+#if is_foo_defined_parens
+success
+#else
+failure
+#endif
+#undef foo
+#if is_foo_defined_parens
+failure
+#else
+success
+#endif
+
+/* Macro using defined with an argument identifier (no parentheses) */
+#define is_defined(arg) defined /*...*/ arg
+#define foo bar
+#undef bar
+#if is_defined(foo)
+failure
+#else
+success
+#endif
+#define bar bar
+#if is_defined(foo)
+success
+#else
+failure
+#endif
+
+/* Macro using defined with an argument identifier within parentheses */
+#define is_defined_parens(arg) defined /*...*/ ( /*...*/ arg /*...*/ ) //
+#define foo bar
+#define bar bar
+#if is_defined_parens(foo)
+success
+#else
+failure
+#endif
+#undef bar
+#if is_defined_parens(foo)
+failure
+#else
+success
+#endif
+
+/* Multiple levels of macro resulting in defined */
+#define X defined A && Y
+#define Y defined B && Z
+#define Z defined C
+#define A
+#define B
+#define C
+#if X
+success
+#else
+failure
+#endif
+#undef A
+#if X
+failure
+#else
+success
+#endif
+#define A
+#undef B
+#if X
+failure
+#else
+success
+#endif
+#define B
+#undef C
+#if X
+failure
+#else
+success
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/142-defined-within-macro.c.expected b/src/compiler/glsl/glcpp/tests/142-defined-within-macro.c.expected
new file mode 100644
index 0000000..4eca90b
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/142-defined-within-macro.c.expected
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+success
+
+
+
+success
+
+
+
+
+
+
+
+
+success
+
+
+
+
+
+
+
+success
+
+
+
+
+
+
+
+
+
+success
+
+
+
+success
+
+
+
+
+
+
+
+
+
+success
+
+
+
+
+
+
+
+success
+
+
+
+
+
+
+
+
+
+
+success
+
+
+
+
+
+
+
+success
+
+
+
+
+
+
+success
+
+
+
+
+
+
+success
+
diff --git a/src/compiler/glsl/glcpp/tests/143-multiple-else.c b/src/compiler/glsl/glcpp/tests/143-multiple-else.c
new file mode 100644
index 0000000..62ad49c
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/143-multiple-else.c
@@ -0,0 +1,6 @@
+#if 0
+#else
+int foo;
+#else
+int bar;
+#endif
diff --git a/src/compiler/glsl/glcpp/tests/143-multiple-else.c.expected b/src/compiler/glsl/glcpp/tests/143-multiple-else.c.expected
new file mode 100644
index 0000000..00b3328
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/143-multiple-else.c.expected
@@ -0,0 +1,7 @@
+0:4(1): preprocessor error: multiple #else
+
+
+int foo;
+
+int bar;
+
diff --git a/src/compiler/glsl/glcpp/tests/glcpp-test b/src/compiler/glsl/glcpp/tests/glcpp-test
new file mode 100755
index 0000000..3945ee4
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/glcpp-test
@@ -0,0 +1,110 @@
+#!/bin/sh
+
+if [ ! -z "$srcdir" ]; then
+ testdir=$srcdir/glsl/glcpp/tests
+ outdir=`pwd`/glsl/glcpp/tests
+ glcpp=`pwd`/glsl/glcpp/glcpp
+else
+ testdir=.
+ outdir=.
+ glcpp=../glcpp
+fi
+
+trap 'rm $test.valgrind-errors; exit 1' INT QUIT
+
+usage ()
+{
+ cat <<EOF
+Usage: glcpp [options...]
+
+Run the test suite for mesa's GLSL pre-processor.
+
+Valid options include:
+
+ --testdir=<DIR> Use tests in the given <DIR> (default is ".")
+ --valgrind Run the test suite a second time under valgrind
+EOF
+}
+
+test_specific_args ()
+{
+ test="$1"
+
+ tr "\r" "\n" < "$test" | grep 'glcpp-args:' | sed -e 's,^.*glcpp-args: *,,'
+}
+
+# Parse command-line options
+for option; do
+ case "${option}" in
+ "--help")
+ usage
+ exit 0
+ ;;
+ "--valgrind")
+ do_valgrind=yes
+ ;;
+ "--testdir="*)
+ testdir="${option#--testdir=}"
+ outdir="${outdir}/${option#--testdir=}"
+ ;;
+ *)
+ echo "Unrecognized option: $option" >&2
+ echo >&2
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+total=0
+pass=0
+clean=0
+
+mkdir -p $outdir
+
+echo "====== Testing for correctness ======"
+for test in $testdir/*.c; do
+ out=$outdir/${test##*/}.out
+
+ printf "Testing $test... > $out ($test.expected) "
+ $glcpp $(test_specific_args $test) < $test > $out 2>&1
+ total=$((total+1))
+ if cmp $test.expected $out >/dev/null 2>&1; then
+ echo "PASS"
+ pass=$((pass+1))
+ else
+ echo "FAIL"
+ diff -u $test.expected $out
+ fi
+done
+
+echo ""
+echo "$pass/$total tests returned correct results"
+echo ""
+
+if [ "$do_valgrind" = "yes" ]; then
+ echo "====== Testing for valgrind cleanliness ======"
+ for test in $testdir/*.c; do
+ printf "Testing $test with valgrind..."
+ valgrind --error-exitcode=31 --log-file=$test.valgrind-errors $glcpp $(test_specific_args $test) < $test >/dev/null 2>&1
+ if [ "$?" = "31" ]; then
+ echo "ERRORS"
+ cat $test.valgrind-errors
+ else
+ echo "CLEAN"
+ clean=$((clean+1))
+ rm $test.valgrind-errors
+ fi
+ done
+
+ echo ""
+ echo "$pass/$total tests returned correct results"
+ echo "$clean/$total tests are valgrind-clean"
+fi
+
+if [ "$pass" = "$total" ] && [ "$do_valgrind" != "yes" ] || [ "$pass" = "$total" ]; then
+ exit 0
+else
+ exit 1
+fi
+
diff --git a/src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf b/src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf
new file mode 100755
index 0000000..c75370f
--- /dev/null
+++ b/src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf
@@ -0,0 +1,141 @@
+#!/bin/sh
+
+# The build system runs this test from a different working directory, and may
+# be in a build directory entirely separate from the source. So if the
+# "srcdir" variable is set, we must use it to locate the test files and the
+# glcpp-test script.
+
+if [ ! -z "$srcdir" ]; then
+ testdir="$srcdir/glsl/glcpp/tests"
+ glcpp_test="$srcdir/glsl/glcpp/tests/glcpp-test"
+else
+ testdir=.
+ glcpp_test=./glcpp-test
+fi
+
+total=0
+pass=0
+
+# This supports a pipe that doesn't destroy the exit status of first command
+#
+# http://unix.stackexchange.com/questions/14270/get-exit-status-of-process-thats-piped-to-another
+stdintoexitstatus() {
+ read exitstatus
+ return $exitstatus
+}
+
+run_test ()
+{
+ cmd="$1"
+
+ total=$((total+1))
+
+ if [ "$VERBOSE" = "yes" ]; then
+ if $cmd; then
+ echo "PASS"
+ pass=$((pass+1))
+ else
+ echo "FAIL"
+ fi
+ else
+ # This is "$cmd | tail -2" but with the exit status of "$cmd" not "tail -2"
+ if (((($cmd; echo $? >&3) | tail -2 | head -1 >&4) 3>&1) | stdintoexitstatus) 4>&1; then
+ echo "PASS"
+ pass=$((pass+1))
+ else
+ echo "FAIL"
+ fi
+ fi
+}
+
+usage ()
+{
+ cat <<EOF
+Usage: glcpp-cr-lf [options...]
+
+Run the entire glcpp-test suite several times, each time with each source
+file transformed to use a non-standard line-termination character. Each
+entire run with a different line-termination character is considered a
+single test.
+
+Valid options include:
+
+ -v|--verbose Print all output from the various sub-tests
+EOF
+}
+
+# Parse command-line options
+for option; do
+ case "${option}" in
+ -v|--verbose)
+ VERBOSE=yes;
+ ;;
+ *)
+ echo "Unrecognized option: $option" >&2
+ echo >&2
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+# All tests depend on the .out files being present. So first do a
+# normal run of the test suite, (silently) just to create the .out
+# files as a side effect.
+rm -rf ./subtest-lf
+mkdir subtest-lf
+for file in "$testdir"/*.c; do
+ base=$(basename "$file")
+ cp "$file" subtest-lf
+done
+
+${glcpp_test} --testdir=subtest-lf >/dev/null 2>&1
+
+echo "===== Testing with \\\\r line terminators (old Mac format) ====="
+
+# Prepare test files with '\r' instead of '\n'
+rm -rf ./subtest-cr
+mkdir subtest-cr
+for file in "$testdir"/*.c; do
+ base=$(basename "$file")
+ tr "\n" "\r" < "$file" > subtest-cr/"$base"
+ cp `pwd`/glsl/glcpp/tests/subtest-lf/"$base".out subtest-cr/"$base".expected
+done
+
+run_test "${glcpp_test} --testdir=subtest-cr"
+
+echo "===== Testing with \\\\r\\\\n line terminators (DOS format) ====="
+
+# Prepare test files with '\r\n' instead of '\n'
+rm -rf ./subtest-cr-lf
+mkdir subtest-cr-lf
+for file in "$testdir"/*.c; do
+ base=$(basename "$file")
+ sed -e 's/$/ /' < "$file" > subtest-cr-lf/"$base"
+ cp `pwd`/glsl/glcpp/tests/subtest-lf/"$base".out subtest-cr-lf/"$base".expected
+done
+
+run_test "${glcpp_test} --testdir=subtest-cr-lf"
+
+echo "===== Testing with \\\\n\\\\r (bizarre, but allowed by GLSL spec.) ====="
+
+# Prepare test files with '\n\r' instead of '\n'
+rm -rf ./subtest-lf-cr
+mkdir subtest-lf-cr
+for file in "$testdir"/*.c; do
+ base=$(basename "$file")
+ sed -e 's/$/ /' < "$file" | tr "\n\r" "\r\n" > subtest-lf-cr/"$base"
+ cp `pwd`/glsl/glcpp/tests/subtest-lf/"$base".out subtest-lf-cr/"$base".expected
+done
+
+run_test "${glcpp_test} --testdir=subtest-lf-cr"
+
+echo ""
+echo "$pass/$total tests returned correct results"
+echo ""
+
+if [ "$pass" = "$total" ]; then
+ exit 0
+else
+ exit 1
+fi