summaryrefslogtreecommitdiff
path: root/flang/test/Preprocessing
diff options
context:
space:
mode:
Diffstat (limited to 'flang/test/Preprocessing')
-rw-r--r--flang/test/Preprocessing/cond-contin.F9021
-rw-r--r--flang/test/Preprocessing/directive-contin-with-pp.F9063
-rw-r--r--flang/test/Preprocessing/ff-args.h1
-rw-r--r--flang/test/Preprocessing/ff-include-args.F14
-rw-r--r--flang/test/Preprocessing/inc-contin-1.F6
-rw-r--r--flang/test/Preprocessing/inc-contin-1.h1
-rw-r--r--flang/test/Preprocessing/inc-contin-2.F909
-rw-r--r--flang/test/Preprocessing/inc-contin-2a.h1
-rw-r--r--flang/test/Preprocessing/inc-contin-2b.h1
-rw-r--r--flang/test/Preprocessing/include-args.F902
-rw-r--r--flang/test/Preprocessing/multi-cont.F906
11 files changed, 110 insertions, 15 deletions
diff --git a/flang/test/Preprocessing/cond-contin.F90 b/flang/test/Preprocessing/cond-contin.F90
new file mode 100644
index 000000000000..9221e34e013f
--- /dev/null
+++ b/flang/test/Preprocessing/cond-contin.F90
@@ -0,0 +1,21 @@
+! RUN: %flang_fc1 -E %s 2>&1 | FileCheck %s
+! CHECK: subroutine test(ARG1, FA, FB, ARG2)
+! CHECK: end
+
+subroutine test( &
+ARG1, &
+! test
+#ifndef SWAP
+#define ARG1 FA
+#define ARG2 FB
+#else
+#define ARG1 FB
+#define ARG2 FA
+#endif
+ARG1, ARG2, &
+! test
+#undef ARG1
+#undef ARG2
+&ARG2)
+! comment
+end
diff --git a/flang/test/Preprocessing/directive-contin-with-pp.F90 b/flang/test/Preprocessing/directive-contin-with-pp.F90
index 9a06ae843821..64f1dc43f72b 100644
--- a/flang/test/Preprocessing/directive-contin-with-pp.F90
+++ b/flang/test/Preprocessing/directive-contin-with-pp.F90
@@ -1,12 +1,17 @@
-! RUN: %flang -E %s 2>&1 | FileCheck %s
+! RUN: %flang_fc1 -fdebug-unparse -fopenmp %s 2>&1 | FileCheck %s
#define DIR_START !dir$
#define DIR_CONT !dir$&
#define FIRST(x) DIR_START x
#define NEXT(x) DIR_CONT x
#define AMPER &
+#define COMMENT !
+#define OMP_START !$omp
+#define OMP_CONT !$omp&
-subroutine s(x1, x2, x3, x4, x5, x6, x7)
+module m
+ contains
+ subroutine s(x1, x2, x3, x4, x5, x6, x7)
!dir$ ignore_tkr x1
@@ -24,18 +29,48 @@ FIRST(ignore_tkr &)
FIRST(ignore_tkr &)
NEXT(x6)
-FIRST(ignore_tkr &)
-NEXT(x7 &)
-NEXT(x8)
+COMMENT blah &
+COMMENT & more
+ stop 1
+
+OMP_START parallel &
+OMP_START do &
+OMP_START reduction(+:x)
+ do j1 = 1, n
+ end do
+
+OMP_START parallel &
+OMP_START & do &
+OMP_START & reduction(+:x)
+ do j2 = 1, n
+ end do
+OMP_START parallel &
+OMP_CONT do &
+OMP_CONT reduction(+:x)
+ do j3 = 1, n
+ end do
+ end
end
-!CHECK: subroutine s(x1, x2, x3, x4, x5, x6, x7)
-!CHECK: !dir$ ignore_tkr x1
-!CHECK: !dir$ ignore_tkr x2
-!CHECK: !dir$ ignore_tkr x3
-!CHECK: !dir$ ignore_tkr x4
-!CHECK: !dir$ ignore_tkr x5
-!CHECK: !dir$ ignore_tkr x6
-!CHECK: !dir$ ignore_tkr x7 x8
-!CHECK: end
+!CHECK: MODULE m
+!CHECK: CONTAINS
+!CHECK: SUBROUTINE s (x1, x2, x3, x4, x5, x6, x7)
+!CHECK: !DIR$ IGNORE_TKR x1
+!CHECK: !DIR$ IGNORE_TKR x2
+!CHECK: !DIR$ IGNORE_TKR x3
+!CHECK: !DIR$ IGNORE_TKR x4
+!CHECK: !DIR$ IGNORE_TKR x5
+!CHECK: !DIR$ IGNORE_TKR x6
+!CHECK: STOP 1_4
+!CHECK: !$OMP PARALLEL DO REDUCTION(+:x)
+!CHECK: DO j1=1_4,n
+!CHECK: END DO
+!CHECK: !$OMP PARALLEL DO REDUCTION(+:x)
+!CHECK: DO j2=1_4,n
+!CHECK: END DO
+!CHECK: !$OMP PARALLEL DO REDUCTION(+:x)
+!CHECK: DO j3=1_4,n
+!CHECK: END DO
+!CHECK: END SUBROUTINE
+!CHECK: END MODULE
diff --git a/flang/test/Preprocessing/ff-args.h b/flang/test/Preprocessing/ff-args.h
new file mode 100644
index 000000000000..99562784006c
--- /dev/null
+++ b/flang/test/Preprocessing/ff-args.h
@@ -0,0 +1 @@
+ +3.14159) \ No newline at end of file
diff --git a/flang/test/Preprocessing/ff-include-args.F b/flang/test/Preprocessing/ff-include-args.F
new file mode 100644
index 000000000000..81e4102598c2
--- /dev/null
+++ b/flang/test/Preprocessing/ff-include-args.F
@@ -0,0 +1,14 @@
+! RUN: %flang -E %s 2>&1 | FileCheck %s
+! CHECK: call foo ( 3.14159)
+! CHECK: subroutine foo(test)
+ call foo (
+#include "ff-args.h"
+ end
+#define TEST
+ subroutine foo(
+#ifdef TEST
+ +test)
+#else
+ +)
+#endif
+ end
diff --git a/flang/test/Preprocessing/inc-contin-1.F b/flang/test/Preprocessing/inc-contin-1.F
new file mode 100644
index 000000000000..7a4e3a0cb0b5
--- /dev/null
+++ b/flang/test/Preprocessing/inc-contin-1.F
@@ -0,0 +1,6 @@
+! RUN: %flang_fc1 -E %s 2>&1 | FileCheck %s
+! CHECK: call t(1 ,.false.)
+ program main
+#include "inc-contin-1.h"
+ $,.false.)
+ end
diff --git a/flang/test/Preprocessing/inc-contin-1.h b/flang/test/Preprocessing/inc-contin-1.h
new file mode 100644
index 000000000000..d4b6461e7527
--- /dev/null
+++ b/flang/test/Preprocessing/inc-contin-1.h
@@ -0,0 +1 @@
+ call t(1
diff --git a/flang/test/Preprocessing/inc-contin-2.F90 b/flang/test/Preprocessing/inc-contin-2.F90
new file mode 100644
index 000000000000..3386ee0dfcdd
--- /dev/null
+++ b/flang/test/Preprocessing/inc-contin-2.F90
@@ -0,0 +1,9 @@
+! RUN: %flang_fc1 -E %s 2>&1 | FileCheck %s
+! CHECK: print *, 3.14159
+! CHECK: print *, 3. 14159
+ program main
+#include "inc-contin-2a.h"
+ &14159
+#include "inc-contin-2b.h"
+ &14159
+ end program main
diff --git a/flang/test/Preprocessing/inc-contin-2a.h b/flang/test/Preprocessing/inc-contin-2a.h
new file mode 100644
index 000000000000..24a4fa4830fa
--- /dev/null
+++ b/flang/test/Preprocessing/inc-contin-2a.h
@@ -0,0 +1 @@
+print *, 3.&
diff --git a/flang/test/Preprocessing/inc-contin-2b.h b/flang/test/Preprocessing/inc-contin-2b.h
new file mode 100644
index 000000000000..b84a464af86e
--- /dev/null
+++ b/flang/test/Preprocessing/inc-contin-2b.h
@@ -0,0 +1 @@
+print *, 3. &
diff --git a/flang/test/Preprocessing/include-args.F90 b/flang/test/Preprocessing/include-args.F90
index 011e4dba13e7..7c521db666ff 100644
--- a/flang/test/Preprocessing/include-args.F90
+++ b/flang/test/Preprocessing/include-args.F90
@@ -1,5 +1,5 @@
! RUN: %flang -E %s 2>&1 | FileCheck %s
-! CHECK: call foo(3.14159)
+! CHECK: call foo(3.14159 )
call foo (&
#include "args.h"
)
diff --git a/flang/test/Preprocessing/multi-cont.F90 b/flang/test/Preprocessing/multi-cont.F90
new file mode 100644
index 000000000000..5a2c0b9c4797
--- /dev/null
+++ b/flang/test/Preprocessing/multi-cont.F90
@@ -0,0 +1,6 @@
+! RUN: %flang -E %s 2>&1 | FileCheck --strict-whitespace %s
+! CHECK: print *, 666
+pr&
+&i&
+&nt *, 666
+end