1RUN: FileCheck --input-file %s %s 2 3; We use CHECK-NEXT directives to force a match on all lines with digits. 4 5; Numeric variable definition without spaces. 6DEF NO SPC 711 8CHECK-LABEL: DEF NO SPC 9CHECK-NEXT: [[#VAR1:]] 10 11; Numeric variable definition with different spacing. 12DEF SPC 1311 1411 1511 16CHECK-LABEL: DEF SPC 17CHECK-NEXT: [[# VAR1a:]] 18CHECK-NEXT: [[# VAR1b :]] 19CHECK-NEXT: [[# VAR1c : ]] 20 21; Numeric expressions using variables defined on other lines without spaces. 22USE NO SPC 2311 2412 2510 2611 2711 2811 29CHECK-LABEL: USE 30CHECK-NEXT: [[#VAR1]] 31CHECK-NEXT: [[#VAR1+1]] 32CHECK-NEXT: [[#VAR1-1]] 33CHECK-NEXT: [[#VAR1a]] 34CHECK-NEXT: [[#VAR1b]] 35CHECK-NEXT: [[#VAR1c]] 36 37; Numeric expressions using variables defined on other lines with different 38; spacing. 39USE SPC 4011 4111 4212 4312 4412 4512 4610 4710 4810 4910 50CHECK-LABEL: USE SPC 51CHECK-NEXT: [[# VAR1]] 52CHECK-NEXT: [[# VAR1 ]] 53CHECK-NEXT: [[# VAR1+1]] 54CHECK-NEXT: [[# VAR1 +1]] 55CHECK-NEXT: [[# VAR1 + 1]] 56CHECK-NEXT: [[# VAR1 + 1 ]] 57CHECK-NEXT: [[# VAR1-1]] 58CHECK-NEXT: [[# VAR1 -1]] 59CHECK-NEXT: [[# VAR1 - 1]] 60CHECK-NEXT: [[# VAR1 - 1 ]] 61 62; Numeric expressions using variables defined on the command-line and an 63; immediate interpreted as an unsigned value. 64; Note: 9223372036854775819 = 0x8000000000000000 + 11 65; 9223372036854775808 = 0x8000000000000000 66USE UNSIGNED IMM 679223372036854775819 68CHECK-LABEL: USE UNSIGNED IMM 69CHECK-NEXT: [[#VAR1+9223372036854775808]] 70 71; Numeric expression using undefined variable. 72RUN: not FileCheck --check-prefix UNDEF-USE --input-file %s %s 2>&1 \ 73RUN: | FileCheck --strict-whitespace --check-prefix UNDEF-USE-MSG %s 74 75UNDEF VAR USE 76UNDEFVAR: 11 77UNDEF-USE-LABEL: UNDEF VAR USE 78UNDEF-USE-NEXT: UNDEFVAR: [[#UNDEFVAR]] 79UNDEF-USE-MSG: numeric-expression.txt:[[#@LINE-1]]:30: error: using undefined numeric variable 'UNDEFVAR' 80UNDEF-USE-MSG-NEXT: {{U}}NDEF-USE-NEXT: UNDEFVAR: {{\[\[#UNDEFVAR\]\]}} 81UNDEF-USE-MSG-NEXT: {{^ \^$}} 82 83; Numeric expression with unsupported operator. 84RUN: not FileCheck -D#NUMVAR=10 --check-prefix INVAL-OP --input-file %s %s 2>&1 \ 85RUN: | FileCheck --strict-whitespace --check-prefix INVAL-OP-MSG %s 86 87INVALID OPERATOR 88NUMVAR*2: 22 89INVAL-OP-LABEL: INVALID OPERATOR 90INVAL-OP-NEXT: NUMVAR*2: [[#NUMVAR*2]] 91INVAL-OP-MSG: numeric-expression.txt:[[#@LINE-1]]:35: error: unsupported operation '*' 92INVAL-OP-MSG-NEXT: {{I}}NVAL-OP-NEXT: NUMVAR*2: {{\[\[#NUMVAR\*2\]\]}} 93INVAL-OP-MSG-NEXT: {{^ \^$}} 94 95; Name conflict between Numeric variable definition and string variable 96; definition whether from the command-line or input text. 97RUN: not FileCheck --check-prefixes CONFLICT,CONFLICT1,CONFLICT2 --input-file %s %s 2>&1 \ 98RUN: | FileCheck --strict-whitespace --check-prefix INPUT-STR-CONFLICT %s 99RUN: not FileCheck -D#NUMVAR=42 --check-prefixes CONFLICT,CONFLICT2 --input-file %s %s 2>&1 \ 100RUN: | FileCheck --strict-whitespace --check-prefix INPUT-STR-CONFLICT %s 101RUN: not FileCheck -D#NUMVAR=42 -DNUMVAR=foobar --check-prefix CONFLICT --input-file %s %s 2>&1 \ 102RUN: | FileCheck --strict-whitespace --check-prefix CLI-STR-CONFLICT %s 103RUN: not FileCheck --check-prefixes CONFLICT,CONFLICT3,CONFLICT4 --input-file %s %s 2>&1 \ 104RUN: | FileCheck --strict-whitespace --check-prefix INPUT-NUM-CONFLICT %s 105RUN: not FileCheck -DSTRVAR=foobar --check-prefixes CONFLICT,CONFLICT4 --input-file %s %s 2>&1 \ 106RUN: | FileCheck --strict-whitespace --check-prefix INPUT-NUM-CONFLICT %s 107RUN: not FileCheck -DSTRVAR=foobar -D#STRVAR=42 --check-prefix CONFLICT --input-file %s %s 2>&1 \ 108RUN: | FileCheck --strict-whitespace --check-prefix CLI-NUM-CONFLICT %s 109 110STRVAR NUMVAR CONFLICT 111redef1 42 112foobar 113redef2 42 114CONFLICT-LABEL: STRVAR NUMVAR CONFLICT 115CONFLICT1-NEXT: redef1 [[#NUMVAR:]] 116CONFLICT2: [[NUMVAR:foo.*]] 117CONFLICT3: [[STRVAR:foo.*]] 118CONFLICT4: redef2 [[#STRVAR:]] 119INPUT-STR-CONFLICT: numeric-expression.txt:[[#@LINE-3]]:14: error: numeric variable with name 'NUMVAR' already exists 120INPUT-STR-CONFLICT-NEXT: {{C}}ONFLICT2: {{\[\[NUMVAR:foo\.\*\]\]}} 121INPUT-STR-CONFLICT-NEXT: {{^ \^$}} 122CLI-STR-CONFLICT: Global defines:2:19: error: numeric variable with name 'NUMVAR' already exists 123CLI-STR-CONFLICT-NEXT: Global define #2: NUMVAR=foobar 124CLI-STR-CONFLICT-NEXT: {{^ \^$}} 125INPUT-NUM-CONFLICT: numeric-expression.txt:[[#@LINE-7]]:22: error: string variable with name 'STRVAR' already exists 126INPUT-NUM-CONFLICT-NEXT: CONFLICT4: redef2 {{\[\[#STRVAR:\]\]}} 127INPUT-NUM-CONFLICT-NEXT: {{^ \^$}} 128CLI-NUM-CONFLICT: Global defines:2:20: error: string variable with name 'STRVAR' already exists 129CLI-NUM-CONFLICT-NEXT: Global define #2: #STRVAR=42 130CLI-NUM-CONFLICT-NEXT: {{^ \^$}} 131 132; Numeric variable definition with too big value. 133RUN: not FileCheck --check-prefix BIGVAL --input-file %s %s 2>&1 \ 134RUN: | FileCheck --strict-whitespace --check-prefix BIGVAL-MSG %s 135 136BIG VALUE 137NUMVAR: 10000000000000000000000 138BIGVAL-LABEL: BIG VALUE 139BIGVAL-NEXT: NUMVAR: [[#NUMVAR:]] 140BIGVAL-MSG: numeric-expression.txt:[[#@LINE-3]]:9: error: Unable to represent numeric value 141BIGVAL-MSG-NEXT: {{N}}UMVAR: 10000000000000000000000 142BIGVAL-MSG-NEXT: {{^ \^$}} 143