[flang-commits] [flang] 089adc3 - [flang] Make preprocessing behavior tests runnable as regression tests
peter klausler via flang-commits
flang-commits at lists.llvm.org
Mon Aug 3 15:08:02 PDT 2020
Author: peter klausler
Date: 2020-08-03T15:07:38-07:00
New Revision: 089adc339e7dd6924d7e107fa362d9d12642f6e0
URL: https://github.com/llvm/llvm-project/commit/089adc339e7dd6924d7e107fa362d9d12642f6e0
DIFF: https://github.com/llvm/llvm-project/commit/089adc339e7dd6924d7e107fa362d9d12642f6e0.diff
LOG: [flang] Make preprocessing behavior tests runnable as regression tests
And fix a minor bug exposed by doing so.
Differential Revision: https://reviews.llvm.org/D85164
Added:
Modified:
flang/lib/Parser/preprocessor.cpp
flang/lib/Parser/preprocessor.h
flang/lib/Parser/prescan.cpp
flang/test/Preprocessing/pp001.F
flang/test/Preprocessing/pp002.F
flang/test/Preprocessing/pp003.F
flang/test/Preprocessing/pp004.F
flang/test/Preprocessing/pp005.F
flang/test/Preprocessing/pp006.F
flang/test/Preprocessing/pp007.F
flang/test/Preprocessing/pp008.F
flang/test/Preprocessing/pp009.F
flang/test/Preprocessing/pp010.F
flang/test/Preprocessing/pp011.F
flang/test/Preprocessing/pp012.F
flang/test/Preprocessing/pp013.F
flang/test/Preprocessing/pp014.F
flang/test/Preprocessing/pp015.F
flang/test/Preprocessing/pp016.F
flang/test/Preprocessing/pp017.F
flang/test/Preprocessing/pp018.F
flang/test/Preprocessing/pp019.F
flang/test/Preprocessing/pp020.F
flang/test/Preprocessing/pp021.F
flang/test/Preprocessing/pp022.F
flang/test/Preprocessing/pp023.F
flang/test/Preprocessing/pp024.F
flang/test/Preprocessing/pp025.F
flang/test/Preprocessing/pp026.F
flang/test/Preprocessing/pp027.F
flang/test/Preprocessing/pp028.F
flang/test/Preprocessing/pp029.F
flang/test/Preprocessing/pp030.F
flang/test/Preprocessing/pp031.F
flang/test/Preprocessing/pp032.F
flang/test/Preprocessing/pp033.F
flang/test/Preprocessing/pp034.F
flang/test/Preprocessing/pp035.F
flang/test/Preprocessing/pp036.F
flang/test/Preprocessing/pp037.F
flang/test/Preprocessing/pp038.F
flang/test/Preprocessing/pp039.F
flang/test/Preprocessing/pp040.F
flang/test/Preprocessing/pp041.F
flang/test/Preprocessing/pp042.F
flang/test/Preprocessing/pp043.F
flang/test/Preprocessing/pp044.F
flang/test/Preprocessing/pp101.F90
flang/test/Preprocessing/pp102.F90
flang/test/Preprocessing/pp103.F90
flang/test/Preprocessing/pp104.F90
flang/test/Preprocessing/pp105.F90
flang/test/Preprocessing/pp106.F90
flang/test/Preprocessing/pp107.F90
flang/test/Preprocessing/pp108.F90
flang/test/Preprocessing/pp109.F90
flang/test/Preprocessing/pp110.F90
flang/test/Preprocessing/pp111.F90
flang/test/Preprocessing/pp112.F90
flang/test/Preprocessing/pp113.F90
flang/test/Preprocessing/pp114.F90
flang/test/Preprocessing/pp115.F90
flang/test/Preprocessing/pp116.F90
flang/test/Preprocessing/pp117.F90
flang/test/Preprocessing/pp118.F90
flang/test/Preprocessing/pp119.F90
flang/test/Preprocessing/pp120.F90
flang/test/Preprocessing/pp121.F90
flang/test/Preprocessing/pp122.F90
flang/test/Preprocessing/pp123.F90
flang/test/Preprocessing/pp124.F90
flang/test/Preprocessing/pp125.F90
flang/test/Preprocessing/pp126.F90
flang/test/Preprocessing/pp127.F90
flang/test/Preprocessing/pp128.F90
flang/test/Preprocessing/pp129.F90
flang/test/Preprocessing/pp130.F90
Removed:
flang/test/Preprocessing/lit.local.cfg.py
################################################################################
diff --git a/flang/lib/Parser/preprocessor.cpp b/flang/lib/Parser/preprocessor.cpp
index a1f07967d9b0..9c10cedfd53b 100644
--- a/flang/lib/Parser/preprocessor.cpp
+++ b/flang/lib/Parser/preprocessor.cpp
@@ -212,7 +212,7 @@ Preprocessor::Preprocessor(AllSources &allSources) : allSources_{allSources} {
}
void Preprocessor::Define(std::string macro, std::string value) {
- definitions_.emplace(SaveTokenAsName(macro), Definition{value, allSources_});
+ definitions_.emplace(macro, Definition{value, allSources_});
}
void Preprocessor::Undefine(std::string macro) { definitions_.erase(macro); }
diff --git a/flang/lib/Parser/preprocessor.h b/flang/lib/Parser/preprocessor.h
index 977d480c2482..b4374a9acf5c 100644
--- a/flang/lib/Parser/preprocessor.h
+++ b/flang/lib/Parser/preprocessor.h
@@ -67,6 +67,7 @@ class Preprocessor {
void Define(std::string macro, std::string value);
void Undefine(std::string macro);
+ bool IsNameDefined(const CharBlock &);
std::optional<TokenSequence> MacroReplacement(
const TokenSequence &, const Prescanner &);
@@ -79,7 +80,6 @@ class Preprocessor {
enum class CanDeadElseAppear { No, Yes };
CharBlock SaveTokenAsName(const CharBlock &);
- bool IsNameDefined(const CharBlock &);
TokenSequence ReplaceMacros(const TokenSequence &, const Prescanner &);
void SkipDisabledConditionalCode(
const std::string &, IsElseActive, Prescanner *, ProvenanceRange);
diff --git a/flang/lib/Parser/prescan.cpp b/flang/lib/Parser/prescan.cpp
index c81d6cb50846..face0d20e4fc 100644
--- a/flang/lib/Parser/prescan.cpp
+++ b/flang/lib/Parser/prescan.cpp
@@ -246,7 +246,7 @@ void Prescanner::NextLine() {
}
void Prescanner::LabelField(TokenSequence &token, int outCol) {
- bool badLabel{false};
+ const char *bad{nullptr};
for (; *at_ != '\n' && column_ <= 6; ++at_) {
if (*at_ == '\t') {
++at_;
@@ -256,16 +256,18 @@ void Prescanner::LabelField(TokenSequence &token, int outCol) {
if (*at_ != ' ' &&
!(*at_ == '0' && column_ == 6)) { // '0' in column 6 becomes space
EmitChar(token, *at_);
- if (!IsDecimalDigit(*at_) && !badLabel) {
- Say(GetProvenance(at_),
- "Character in fixed-form label field must be a digit"_en_US);
- badLabel = true;
+ if (!bad && !IsDecimalDigit(*at_)) {
+ bad = at_;
}
++outCol;
}
++column_;
}
if (outCol > 1) {
+ if (bad && !preprocessor_.IsNameDefined(token.CurrentOpenToken())) {
+ Say(GetProvenance(bad),
+ "Character in fixed-form label field must be a digit"_en_US);
+ }
token.CloseToken();
}
SkipToNextSignificantCharacter();
@@ -1098,6 +1100,15 @@ const char *Prescanner::IsCompilerDirectiveSentinel(
return iter == compilerDirectiveSentinels_.end() ? nullptr : iter->c_str();
}
+constexpr bool IsDirective(const char *match, const char *dir) {
+ for (; *match; ++match) {
+ if (*match != ToLowerCaseLetter(*dir++)) {
+ return false;
+ }
+ }
+ return true;
+}
+
Prescanner::LineClassification Prescanner::ClassifyLine(
const char *start) const {
if (inFixedForm_) {
@@ -1122,13 +1133,12 @@ Prescanner::LineClassification Prescanner::ClassifyLine(
return {LineClassification::Kind::IncludeLine, *quoteOffset};
}
if (const char *dir{IsPreprocessorDirectiveLine(start)}) {
- if (std::memcmp(dir, "if", 2) == 0 || std::memcmp(dir, "elif", 4) == 0 ||
- std::memcmp(dir, "else", 4) == 0 || std::memcmp(dir, "endif", 5) == 0) {
+ if (IsDirective("if", dir) || IsDirective("elif", dir) ||
+ IsDirective("else", dir) || IsDirective("endif", dir)) {
return {LineClassification::Kind::ConditionalCompilationDirective};
- } else if (std::memcmp(dir, "include", 7) == 0) {
+ } else if (IsDirective("include", dir)) {
return {LineClassification::Kind::IncludeDirective};
- } else if (std::memcmp(dir, "define", 6) == 0 ||
- std::memcmp(dir, "undef", 5) == 0) {
+ } else if (IsDirective("define", dir) || IsDirective("undef", dir)) {
return {LineClassification::Kind::DefinitionDirective};
} else {
return {LineClassification::Kind::PreprocessorDirective};
diff --git a/flang/test/Preprocessing/lit.local.cfg.py b/flang/test/Preprocessing/lit.local.cfg.py
deleted file mode 100644
index a7cf401d8c66..000000000000
--- a/flang/test/Preprocessing/lit.local.cfg.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Python -*-
-
-from lit.llvm import llvm_config
-
-# Added this line file to prevent lit from discovering these tests
-# See Issue #1052
-config.suffixes = []
diff --git a/flang/test/Preprocessing/pp001.F b/flang/test/Preprocessing/pp001.F
index ba131b4a24c6..95198641655a 100644
--- a/flang/test/Preprocessing/pp001.F
+++ b/flang/test/Preprocessing/pp001.F
@@ -1,9 +1,11 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(777.eq.777)then
* keyword macros
integer, parameter :: KWM = 666
#define KWM 777
if (KWM .eq. 777) then
- print *, 'pp001.F pass'
+ print *, 'pp001.F yes'
else
- print *, 'pp001.F FAIL: ', KWM
+ print *, 'pp001.F no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp002.F b/flang/test/Preprocessing/pp002.F
index f46baf73e289..b4cbd7545adf 100644
--- a/flang/test/Preprocessing/pp002.F
+++ b/flang/test/Preprocessing/pp002.F
@@ -1,10 +1,12 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(kwm.eq.777)then
* #undef
integer, parameter :: KWM = 777
#define KWM 666
#undef KWM
if (KWM .eq. 777) then
- print *, 'pp002.F pass'
+ print *, 'pp002.F yes'
else
- print *, 'pp002.F FAIL: ', KWM
+ print *, 'pp002.F no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp003.F b/flang/test/Preprocessing/pp003.F
index 0470f1909a69..4df10c47d235 100644
--- a/flang/test/Preprocessing/pp003.F
+++ b/flang/test/Preprocessing/pp003.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=((666)+111)
* function-like macros
integer function IFLM(x)
integer :: x
@@ -8,8 +10,8 @@ program main
integer :: res
res = IFLM(666)
if (res .eq. 777) then
- print *, 'pp003.F pass'
+ print *, 'pp003.F yes'
else
- print *, 'pp003.F FAIL: ', res
+ print *, 'pp003.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp004.F b/flang/test/Preprocessing/pp004.F
index 800a96fbedba..788d3682ab98 100644
--- a/flang/test/Preprocessing/pp004.F
+++ b/flang/test/Preprocessing/pp004.F
@@ -1,9 +1,11 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(kwm.eq.777)then
* KWMs case-sensitive
integer, parameter :: KWM = 777
#define KWM 666
if (kwm .eq. 777) then
- print *, 'pp004.F pass'
+ print *, 'pp004.F yes'
else
- print *, 'pp004.F FAIL: ', kwm
+ print *, 'pp004.F no: ', kwm
end if
end
diff --git a/flang/test/Preprocessing/pp005.F b/flang/test/Preprocessing/pp005.F
index 05fab7a92f1b..390e662e3557 100644
--- a/flang/test/Preprocessing/pp005.F
+++ b/flang/test/Preprocessing/pp005.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=777
* KWM split across continuation, implicit padding
integer, parameter :: KWM = 666
#define KWM 777
@@ -5,8 +7,8 @@
res = KW
+M
if (res .eq. 777) then
- print *, 'pp005.F pass'
+ print *, 'pp005.F yes'
else
- print *, 'pp005.F FAIL: ', res
+ print *, 'pp005.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp006.F b/flang/test/Preprocessing/pp006.F
index 55b87df8d430..3c44728f56b5 100644
--- a/flang/test/Preprocessing/pp006.F
+++ b/flang/test/Preprocessing/pp006.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=777
* ditto, but with intervening *comment line
integer, parameter :: KWM = 666
#define KWM 777
@@ -6,8 +8,8 @@
*comment
+M
if (res .eq. 777) then
- print *, 'pp006.F pass'
+ print *, 'pp006.F yes'
else
- print *, 'pp006.F FAIL: ', res
+ print *, 'pp006.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp007.F b/flang/test/Preprocessing/pp007.F
index 8be4396a2492..ca78f4f4c6c5 100644
--- a/flang/test/Preprocessing/pp007.F
+++ b/flang/test/Preprocessing/pp007.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=kwm
* KWM split across continuation, clipped after column 72
integer, parameter :: KWM = 666
#define KWM 777
@@ -8,8 +10,8 @@
res = KW comment
+M
if (res .eq. 777) then
- print *, 'pp007.F pass'
+ print *, 'pp007.F yes'
else
- print *, 'pp007.F FAIL: ', res
+ print *, 'pp007.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp008.F b/flang/test/Preprocessing/pp008.F
index 38c5b6657a87..9dd7bd92ea50 100644
--- a/flang/test/Preprocessing/pp008.F
+++ b/flang/test/Preprocessing/pp008.F
@@ -1,11 +1,13 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=kwm
* KWM with spaces in name at invocation NOT replaced
integer, parameter :: KWM = 777
#define KWM 666
integer :: res
res = K W M
if (res .eq. 777) then
- print *, 'pp008.F pass'
+ print *, 'pp008.F yes'
else
- print *, 'pp008.F FAIL: ', res
+ print *, 'pp008.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp009.F b/flang/test/Preprocessing/pp009.F
index a53623ff0369..c29021da484a 100644
--- a/flang/test/Preprocessing/pp009.F
+++ b/flang/test/Preprocessing/pp009.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=((666)+111)
* FLM call split across continuation, implicit padding
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFL
+M(666)
if (res .eq. 777) then
- print *, 'pp009.F pass'
+ print *, 'pp009.F yes'
else
- print *, 'pp009.F FAIL: ', res
+ print *, 'pp009.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp010.F b/flang/test/Preprocessing/pp010.F
index 0769c98274dd..4a812cde86af 100644
--- a/flang/test/Preprocessing/pp010.F
+++ b/flang/test/Preprocessing/pp010.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=((666)+111)
* ditto, but with intervening *comment line
integer function IFLM(x)
integer :: x
@@ -10,8 +12,8 @@ program main
*comment
+M(666)
if (res .eq. 777) then
- print *, 'pp010.F pass'
+ print *, 'pp010.F yes'
else
- print *, 'pp010.F FAIL: ', res
+ print *, 'pp010.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp011.F b/flang/test/Preprocessing/pp011.F
index 4ec376649422..c106c8bc3f5c 100644
--- a/flang/test/Preprocessing/pp011.F
+++ b/flang/test/Preprocessing/pp011.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=iflm(666)
* FLM call name split across continuation, clipped
integer function IFLM(x)
integer :: x
@@ -12,8 +14,8 @@ program main
res = IFL comment
+M(666)
if (res .eq. 777) then
- print *, 'pp011.F pass'
+ print *, 'pp011.F yes'
else
- print *, 'pp011.F FAIL: ', res
+ print *, 'pp011.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp012.F b/flang/test/Preprocessing/pp012.F
index 703fabf7d8db..411cfb887bb1 100644
--- a/flang/test/Preprocessing/pp012.F
+++ b/flang/test/Preprocessing/pp012.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=((666)+111)
* FLM call name split across continuation
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFL
+M(666)
if (res .eq. 777) then
- print *, 'pp012.F pass'
+ print *, 'pp012.F yes'
else
- print *, 'pp012.F FAIL: ', res
+ print *, 'pp012.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp013.F b/flang/test/Preprocessing/pp013.F
index 6fb8ca75b5c8..f05e2e30fee6 100644
--- a/flang/test/Preprocessing/pp013.F
+++ b/flang/test/Preprocessing/pp013.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=((666)+111)
* FLM call split between name and (
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFLM
+(666)
if (res .eq. 777) then
- print *, 'pp013.F pass'
+ print *, 'pp013.F yes'
else
- print *, 'pp013.F FAIL: ', res
+ print *, 'pp013.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp014.F b/flang/test/Preprocessing/pp014.F
index 397a31d1a8aa..470966096e4e 100644
--- a/flang/test/Preprocessing/pp014.F
+++ b/flang/test/Preprocessing/pp014.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=((666)+111)
* FLM call split between name and (, with intervening *comment
integer function IFLM(x)
integer :: x
@@ -10,8 +12,8 @@ program main
*comment
+(666)
if (res .eq. 777) then
- print *, 'pp014.F pass'
+ print *, 'pp014.F yes'
else
- print *, 'pp014.F FAIL: ', res
+ print *, 'pp014.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp015.F b/flang/test/Preprocessing/pp015.F
index 4c399a835567..8320bd704fed 100644
--- a/flang/test/Preprocessing/pp015.F
+++ b/flang/test/Preprocessing/pp015.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=((666)+111)
* FLM call split between name and (, clipped
integer function IFLM(x)
integer :: x
@@ -12,8 +14,8 @@ program main
res = IFLM comment
+(666)
if (res .eq. 777) then
- print *, 'pp015.F pass'
+ print *, 'pp015.F yes'
else
- print *, 'pp015.F FAIL: ', res
+ print *, 'pp015.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp016.F b/flang/test/Preprocessing/pp016.F
index 210ad0b3fddb..95c89f8e1a03 100644
--- a/flang/test/Preprocessing/pp016.F
+++ b/flang/test/Preprocessing/pp016.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=((666)+111)
* FLM call split between name and ( and in argument
integer function IFLM(x)
integer :: x
@@ -10,8 +12,8 @@ program main
+(66
+6)
if (res .eq. 777) then
- print *, 'pp016.F pass'
+ print *, 'pp016.F yes'
else
- print *, 'pp016.F FAIL: ', res
+ print *, 'pp016.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp017.F b/flang/test/Preprocessing/pp017.F
index e658fbd922cf..a11f18514783 100644
--- a/flang/test/Preprocessing/pp017.F
+++ b/flang/test/Preprocessing/pp017.F
@@ -1,10 +1,12 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(777.eq.777)then
* KLM rescan
integer, parameter :: KWM = 666, KWM2 = 667
#define KWM2 777
#define KWM KWM2
if (KWM .eq. 777) then
- print *, 'pp017.F pass'
+ print *, 'pp017.F yes'
else
- print *, 'pp017.F FAIL: ', KWM
+ print *, 'pp017.F no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp018.F b/flang/test/Preprocessing/pp018.F
index 877c6545e1c8..69c24e59f53d 100644
--- a/flang/test/Preprocessing/pp018.F
+++ b/flang/test/Preprocessing/pp018.F
@@ -1,11 +1,13 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(kwm2.eq.777)then
* KLM rescan with #undef (so rescan is after expansion)
integer, parameter :: KWM2 = 777, KWM = 667
#define KWM2 666
#define KWM KWM2
#undef KWM2
if (KWM .eq. 777) then
- print *, 'pp018.F pass'
+ print *, 'pp018.F yes'
else
- print *, 'pp018.F FAIL: ', KWM
+ print *, 'pp018.F no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp019.F b/flang/test/Preprocessing/pp019.F
index a2c9a0284857..d607ad348407 100644
--- a/flang/test/Preprocessing/pp019.F
+++ b/flang/test/Preprocessing/pp019.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=((666)+111)
* FLM rescan
integer function IFLM(x)
integer :: x
@@ -10,8 +12,8 @@ program main
integer :: res
res = IFLM(666)
if (res .eq. 777) then
- print *, 'pp019.F pass'
+ print *, 'pp019.F yes'
else
- print *, 'pp019.F FAIL: ', res
+ print *, 'pp019.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp020.F b/flang/test/Preprocessing/pp020.F
index f0d26357c5d2..88525003ba89 100644
--- a/flang/test/Preprocessing/pp020.F
+++ b/flang/test/Preprocessing/pp020.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=((111)+666)
* FLM expansion of argument
integer function IFLM(x)
integer :: x
@@ -10,8 +12,8 @@ program main
integer :: res
res = IFLM(KWM)
if (res .eq. 777) then
- print *, 'pp020.F pass'
+ print *, 'pp020.F yes'
else
- print *, 'pp020.F FAIL: ', res
+ print *, 'pp020.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp021.F b/flang/test/Preprocessing/pp021.F
index 45073ab6f1e6..1662a680f5aa 100644
--- a/flang/test/Preprocessing/pp021.F
+++ b/flang/test/Preprocessing/pp021.F
@@ -1,10 +1,13 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: ch='KWM'
+! CHECK: if(ch.eq.'KWM')then
* KWM NOT expanded in 'literal'
#define KWM 666
character(len=3) :: ch
ch = 'KWM'
if (ch .eq. 'KWM') then
- print *, 'pp021.F pass'
+ print *, 'pp021.F yes'
else
- print *, 'pp021.F FAIL: ', ch
+ print *, 'pp021.F no: ', ch
end if
end
diff --git a/flang/test/Preprocessing/pp022.F b/flang/test/Preprocessing/pp022.F
index e9a1e8ba4b91..026c02e9d4f0 100644
--- a/flang/test/Preprocessing/pp022.F
+++ b/flang/test/Preprocessing/pp022.F
@@ -1,10 +1,13 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: ch="KWM"
+! CHECK: if(ch.eq.'KWM')then
* KWM NOT expanded in "literal"
#define KWM 666
character(len=3) :: ch
ch = "KWM"
if (ch .eq. 'KWM') then
- print *, 'pp022.F pass'
+ print *, 'pp022.F yes'
else
- print *, 'pp022.F FAIL: ', ch
+ print *, 'pp022.F no: ', ch
end if
end
diff --git a/flang/test/Preprocessing/pp023.F b/flang/test/Preprocessing/pp023.F
index fb63d63f4fc1..a0d053f6addc 100644
--- a/flang/test/Preprocessing/pp023.F
+++ b/flang/test/Preprocessing/pp023.F
@@ -1,11 +1,14 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: ch=3hKWM
+! CHECK: if(ch.eq.'KWM')then
* KWM NOT expanded in 9HHOLLERITH literal
#define KWM 666
#define HKWM 667
character(len=3) :: ch
ch = 3HKWM
if (ch .eq. 'KWM') then
- print *, 'pp023.F pass'
+ print *, 'pp023.F yes'
else
- print *, 'pp023.F FAIL: ', ch
+ print *, 'pp023.F no: ', ch
end if
end
diff --git a/flang/test/Preprocessing/pp024.F b/flang/test/Preprocessing/pp024.F
index 9072f6e50cc8..6ea76cc9c24d 100644
--- a/flang/test/Preprocessing/pp024.F
+++ b/flang/test/Preprocessing/pp024.F
@@ -1,3 +1,6 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: 100format(3hKWM)
+! CHECK: if(ch.eq.'KWM')then
* KWM NOT expanded in Hollerith in FORMAT
#define KWM 666
#define HKWM 667
@@ -5,8 +8,8 @@
100 format(3HKWM)
write(ch, 100)
if (ch .eq. 'KWM') then
- print *, 'pp024.F pass'
+ print *, 'pp024.F yes'
else
- print *, 'pp024.F FAIL: ', ch
+ print *, 'pp024.F no: ', ch
end if
end
diff --git a/flang/test/Preprocessing/pp025.F b/flang/test/Preprocessing/pp025.F
index 42ad011842ff..49521d443bd3 100644
--- a/flang/test/Preprocessing/pp025.F
+++ b/flang/test/Preprocessing/pp025.F
@@ -1,11 +1,13 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=ikwm2z
* KWM expansion is before token pasting due to fixed-form space removal
integer, parameter :: IKWM2Z = 777
#define KWM KWM2
integer :: res
res = I KWM Z
if (res .eq. 777) then
- print *, 'pp025.F pass'
+ print *, 'pp025.F yes'
else
- print *, 'pp025.F FAIL: ', res
+ print *, 'pp025.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp026.F b/flang/test/Preprocessing/pp026.F
index e0ea032c383f..b551f3b173ed 100644
--- a/flang/test/Preprocessing/pp026.F
+++ b/flang/test/Preprocessing/pp026.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=((111)+666)
* ## token pasting works in FLM
integer function IFLM(x)
integer :: x
@@ -12,8 +14,8 @@ program main
integer :: res
res = IFLM(KWM)
if (res .eq. 777) then
- print *, 'pp026.F pass'
+ print *, 'pp026.F yes'
else
- print *, 'pp026.F FAIL: ', res
+ print *, 'pp026.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp027.F b/flang/test/Preprocessing/pp027.F
index e2663800c1ce..c1b787f9366d 100644
--- a/flang/test/Preprocessing/pp027.F
+++ b/flang/test/Preprocessing/pp027.F
@@ -1,9 +1,12 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: kwm=666
+! CHECK: if(777.eq.777)then
* #DEFINE works in fixed form
integer, parameter :: KWM = 666
#DEFINE KWM 777
if (KWM .eq. 777) then
- print *, 'pp027.F pass'
+ print *, 'pp027.F yes'
else
- print *, 'pp027.F FAIL: ', KWM
+ print *, 'pp027.F no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp028.F b/flang/test/Preprocessing/pp028.F
index 2906d389b57d..51eab84f3687 100644
--- a/flang/test/Preprocessing/pp028.F
+++ b/flang/test/Preprocessing/pp028.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=kw
* fixed-form clipping done before KWM expansion on source line
integer, parameter :: KW = 777
#define KWM 666
@@ -7,8 +9,8 @@
*234567890123456789012345678901234567890123456789012345678901234567890123
res = KWM
if (res .eq. 777) then
- print *, 'pp028.F pass'
+ print *, 'pp028.F yes'
else
- print *, 'pp028.F FAIL: ', res
+ print *, 'pp028.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp029.F b/flang/test/Preprocessing/pp029.F
index 4374ef84489b..bb8efe6c1a2e 100644
--- a/flang/test/Preprocessing/pp029.F
+++ b/flang/test/Preprocessing/pp029.F
@@ -1,10 +1,12 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(77 7.eq.777)then
* \ newline allowed in #define
integer, parameter :: KWM = 666
#define KWM 77\
7
if (KWM .eq. 777) then
- print *, 'pp029.F pass'
+ print *, 'pp029.F yes'
else
- print *, 'pp029.F FAIL: ', KWM
+ print *, 'pp029.F no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp030.F b/flang/test/Preprocessing/pp030.F
index 3022e0ddf3df..c04cf949f414 100644
--- a/flang/test/Preprocessing/pp030.F
+++ b/flang/test/Preprocessing/pp030.F
@@ -1,9 +1,11 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(777.eq.777)then
* /* C comment */ erased from #define
integer, parameter :: KWM = 666
#define KWM 777 /* C comment */
if (KWM .eq. 777) then
- print *, 'pp030.F pass'
+ print *, 'pp030.F yes'
else
- print *, 'pp030.F FAIL: ', KWM
+ print *, 'pp030.F no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp031.F b/flang/test/Preprocessing/pp031.F
index 0f59921bcb82..90b14647c4c9 100644
--- a/flang/test/Preprocessing/pp031.F
+++ b/flang/test/Preprocessing/pp031.F
@@ -1,9 +1,12 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(777//ccomment.eq.777)then
+! CHECK: print*,'pp031.F no: ',777//ccomment
* // C++ comment NOT erased from #define
integer, parameter :: KWM = 666
#define KWM 777 // C comment
if (KWM .eq. 777) then
print *, 'pp031.F FAIL (should not have compiled)'
else
- print *, 'pp031.F FAIL: ', KWM
+ print *, 'pp031.F no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp032.F b/flang/test/Preprocessing/pp032.F
index 9d9f14238d86..6b779141ecb5 100644
--- a/flang/test/Preprocessing/pp032.F
+++ b/flang/test/Preprocessing/pp032.F
@@ -1,10 +1,13 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(777.eq.777)then
+! CHECK: print*,'pp032.F no: ',777
* /* C comment */ \ newline erased from #define
integer, parameter :: KWM = 666
#define KWM 77/* C comment */\
7
if (KWM .eq. 777) then
- print *, 'pp032.F pass'
+ print *, 'pp032.F yes'
else
- print *, 'pp032.F FAIL: ', KWM
+ print *, 'pp032.F no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp033.F b/flang/test/Preprocessing/pp033.F
index 34cf1996cc74..3364527cba6a 100644
--- a/flang/test/Preprocessing/pp033.F
+++ b/flang/test/Preprocessing/pp033.F
@@ -1,10 +1,13 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(777.eq.777)then
+! CHECK: print*,'pp033.F no: ',777
* /* C comment \ newline */ erased from #define
integer, parameter :: KWM = 666
#define KWM 77/* C comment \
*/7
if (KWM .eq. 777) then
- print *, 'pp033.F pass'
+ print *, 'pp033.F yes'
else
- print *, 'pp033.F FAIL: ', KWM
+ print *, 'pp033.F no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp034.F b/flang/test/Preprocessing/pp034.F
index a9ed984b3b6e..0c64aca62b1d 100644
--- a/flang/test/Preprocessing/pp034.F
+++ b/flang/test/Preprocessing/pp034.F
@@ -1,10 +1,13 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(777.eq.777)then
+! CHECK: print*,'pp034.F no: ',777
* \ newline allowed in name on KWM definition
integer, parameter :: KWMC = 666
#define KWM\
C 777
if (KWMC .eq. 777) then
- print *, 'pp034.F pass'
+ print *, 'pp034.F yes'
else
- print *, 'pp034.F FAIL: ', KWMC
+ print *, 'pp034.F no: ', KWMC
end if
end
diff --git a/flang/test/Preprocessing/pp035.F b/flang/test/Preprocessing/pp035.F
index 0135c9c4551a..808174129b89 100644
--- a/flang/test/Preprocessing/pp035.F
+++ b/flang/test/Preprocessing/pp035.F
@@ -1,3 +1,6 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(777.eq.777)then
+! CHECK: print*,'pp035.F no: ',777
* #if 2 .LT. 3 works
integer, parameter :: KWM = 666
#if 2 .LT. 3
@@ -6,8 +9,8 @@
#define KWM 667
#endif
if (KWM .eq. 777) then
- print *, 'pp035.F pass'
+ print *, 'pp035.F yes'
else
- print *, 'pp035.F FAIL: ', KWM
+ print *, 'pp035.F no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp036.F b/flang/test/Preprocessing/pp036.F
index ac922ae42ceb..b7024c41fa60 100644
--- a/flang/test/Preprocessing/pp036.F
+++ b/flang/test/Preprocessing/pp036.F
@@ -1,8 +1,11 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(.true.)then
+! CHECK: print*,'pp036.F no: ',.true.
* #define FALSE TRUE ... .FALSE. -> .TRUE.
#define FALSE TRUE
if (.FALSE.) then
- print *, 'pp036.F pass'
+ print *, 'pp036.F yes'
else
- print *, 'pp036.F FAIL: ', .FALSE.
+ print *, 'pp036.F no: ', .FALSE.
end if
end
diff --git a/flang/test/Preprocessing/pp037.F b/flang/test/Preprocessing/pp037.F
index 6c3edb09eb6f..52bfa8ffdab3 100644
--- a/flang/test/Preprocessing/pp037.F
+++ b/flang/test/Preprocessing/pp037.F
@@ -1,11 +1,14 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(7777.eq.777)then
+! CHECK: print*,'pp037.F no: ',7777
* fixed-form clipping NOT applied to #define
integer, parameter :: KWM = 666
* 1 2 3 4 5 6 7
*234567890123456789012345678901234567890123456789012345678901234567890123
#define KWM 7777
if (KWM .eq. 777) then
- print *, 'pp037.F pass'
+ print *, 'pp037.F yes'
else
- print *, 'pp037.F FAIL: ', KWM
+ print *, 'pp037.F no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp038.F b/flang/test/Preprocessing/pp038.F
index 3c83dda7d03b..7386aeebddee 100644
--- a/flang/test/Preprocessing/pp038.F
+++ b/flang/test/Preprocessing/pp038.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=((666)+111)
* FLM call with closing ')' on next line (not a continuation)
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFLM(666
)
if (res .eq. 777) then
- print *, 'pp038.F pass'
+ print *, 'pp038.F yes'
else
- print *, 'pp038.F FAIL: ', res
+ print *, 'pp038.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp039.F b/flang/test/Preprocessing/pp039.F
index 52e6dd78603a..9124474b86ba 100644
--- a/flang/test/Preprocessing/pp039.F
+++ b/flang/test/Preprocessing/pp039.F
@@ -1,3 +1,7 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res=iflm
+! CHECK: (666)
+! CHECK-NOT: res=((666)+111)
* FLM call with '(' on next line (not a continuation)
integer function IFLM(x)
integer :: x
@@ -9,8 +13,8 @@ program main
res = IFLM
(666)
if (res .eq. 777) then
- print *, 'pp039.F pass'
+ print *, 'pp039.F yes'
else
- print *, 'pp039.F FAIL: ', res
+ print *, 'pp039.F no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp040.F b/flang/test/Preprocessing/pp040.F
index 59e901ac3c6b..d589c38489cf 100644
--- a/flang/test/Preprocessing/pp040.F
+++ b/flang/test/Preprocessing/pp040.F
@@ -1,5 +1,7 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK-NOT: FAIL HARD!
* #define KWM c, then KWM works as comment line initiator
#define KWM c
KWM print *, 'pp040.F FAIL HARD!'; stop
- print *, 'pp040.F pass'
+ print *, 'pp040.F yes'
end
diff --git a/flang/test/Preprocessing/pp041.F b/flang/test/Preprocessing/pp041.F
index 33c5ced3924d..dcf61536040b 100644
--- a/flang/test/Preprocessing/pp041.F
+++ b/flang/test/Preprocessing/pp041.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: j=666wmj=j+1wm211
* use KWM expansion as continuation indicators
#define KWM 0
#define KWM2 1
@@ -6,8 +8,8 @@
KWM j = j + 1
KWM2 11
if (j .eq. 777) then
- print *, 'pp041.F pass'
+ print *, 'pp041.F yes'
else
- print *, 'pp041.F FAIL', j
+ print *, 'pp041.F no', j
end if
end
diff --git a/flang/test/Preprocessing/pp042.F b/flang/test/Preprocessing/pp042.F
index 439e1affbca2..d5cc46a7a471 100644
--- a/flang/test/Preprocessing/pp042.F
+++ b/flang/test/Preprocessing/pp042.F
@@ -1,6 +1,8 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK-NOT: goto 2
* #define c 1, then use c as label in fixed-form
#define c 1
-c print *, 'pp042.F pass'; goto 2
- print *, 'pp042.F FAIL'
+c print *, 'pp042.F yes'; goto 2
+ print *, 'pp042.F no'
2 continue
end
diff --git a/flang/test/Preprocessing/pp043.F b/flang/test/Preprocessing/pp043.F
index be0069cf8557..a079466e64f9 100644
--- a/flang/test/Preprocessing/pp043.F
+++ b/flang/test/Preprocessing/pp043.F
@@ -1,11 +1,13 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(kwm.eq.777)then
* #define with # in column 6 is a continuation line in fixed-form
integer, parameter :: defineKWM666 = 555
integer, parameter :: KWM =
#define KWM 666
++222
if (KWM .eq. 777) then
- print *, 'pp043.F pass'
+ print *, 'pp043.F yes'
else
- print *, 'pp043.F FAIL: ', KWM
+ print *, 'pp043.F no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp044.F b/flang/test/Preprocessing/pp044.F
index 72ce6cc41159..c14b29c3050c 100644
--- a/flang/test/Preprocessing/pp044.F
+++ b/flang/test/Preprocessing/pp044.F
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK-NOT:z=111
* #define directive amid continuations
integer, parameter :: KWM = 222, KWM111 = 333, KWM222 = 555
integer, parameter :: KWMKWM = 333
@@ -5,8 +7,8 @@
#define KWM 111
+KWM+444
if (z .EQ. 777) then
- print *, 'pass'
+ print *, 'yes'
else
- print *, 'FAIL', z
+ print *, 'no', z
end if
end
diff --git a/flang/test/Preprocessing/pp101.F90 b/flang/test/Preprocessing/pp101.F90
index 694201a8f33e..b0f860157c82 100644
--- a/flang/test/Preprocessing/pp101.F90
+++ b/flang/test/Preprocessing/pp101.F90
@@ -1,9 +1,11 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(777 .eq. 777) then
! keyword macros
integer, parameter :: KWM = 666
#define KWM 777
if (KWM .eq. 777) then
- print *, 'pp101.F90 pass'
+ print *, 'pp101.F90 yes'
else
- print *, 'pp101.F90 FAIL: ', KWM
+ print *, 'pp101.F90 no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp102.F90 b/flang/test/Preprocessing/pp102.F90
index 22e4613b3b18..e2c3207a4c24 100644
--- a/flang/test/Preprocessing/pp102.F90
+++ b/flang/test/Preprocessing/pp102.F90
@@ -1,10 +1,12 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(kwm .eq. 777) then
! #undef
integer, parameter :: KWM = 777
#define KWM 666
#undef KWM
if (KWM .eq. 777) then
- print *, 'pp102.F90 pass'
+ print *, 'pp102.F90 yes'
else
- print *, 'pp102.F90 FAIL: ', KWM
+ print *, 'pp102.F90 no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp103.F90 b/flang/test/Preprocessing/pp103.F90
index 9df4c9dbdf7b..3309d7f8205f 100644
--- a/flang/test/Preprocessing/pp103.F90
+++ b/flang/test/Preprocessing/pp103.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = ((666)+111)
! function-like macros
integer function IFLM(x)
integer :: x
@@ -8,8 +10,8 @@ program main
integer :: res
res = IFLM(666)
if (res .eq. 777) then
- print *, 'pp103.F90 pass'
+ print *, 'pp103.F90 yes'
else
- print *, 'pp103.F90 FAIL: ', res
+ print *, 'pp103.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp104.F90 b/flang/test/Preprocessing/pp104.F90
index b15f0db7c5b9..51248c22154b 100644
--- a/flang/test/Preprocessing/pp104.F90
+++ b/flang/test/Preprocessing/pp104.F90
@@ -1,9 +1,11 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(kwm .eq. 777) then
! KWMs case-sensitive
integer, parameter :: KWM = 777
#define KWM 666
if (kwm .eq. 777) then
- print *, 'pp104.F90 pass'
+ print *, 'pp104.F90 yes'
else
- print *, 'pp104.F90 FAIL: ', kwm
+ print *, 'pp104.F90 no: ', kwm
end if
end
diff --git a/flang/test/Preprocessing/pp105.F90 b/flang/test/Preprocessing/pp105.F90
index cd475db01c39..898a4a168137 100644
--- a/flang/test/Preprocessing/pp105.F90
+++ b/flang/test/Preprocessing/pp105.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = 777
! KWM call name split across continuation, with leading &
integer, parameter :: KWM = 666
#define KWM 777
@@ -5,8 +7,8 @@
res = KW&
&M
if (res .eq. 777) then
- print *, 'pp105.F90 pass'
+ print *, 'pp105.F90 yes'
else
- print *, 'pp105.F90 FAIL: ', res
+ print *, 'pp105.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp106.F90 b/flang/test/Preprocessing/pp106.F90
index e169ff70b2ce..d83085fc1d71 100644
--- a/flang/test/Preprocessing/pp106.F90
+++ b/flang/test/Preprocessing/pp106.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = 777
! ditto, with & ! comment
integer, parameter :: KWM = 666
#define KWM 777
@@ -5,8 +7,8 @@
res = KW& ! comment
&M
if (res .eq. 777) then
- print *, 'pp106.F90 pass'
+ print *, 'pp106.F90 yes'
else
- print *, 'pp106.F90 FAIL: ', res
+ print *, 'pp106.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp107.F90 b/flang/test/Preprocessing/pp107.F90
index bf6d427c0400..6973127a4cfa 100644
--- a/flang/test/Preprocessing/pp107.F90
+++ b/flang/test/Preprocessing/pp107.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = kwm
! KWM call name split across continuation, no leading &, with & ! comment
integer, parameter :: KWM = 666
#define KWM 777
@@ -5,8 +7,8 @@
res = KW& ! comment
M
if (res .eq. 777) then
- print *, 'pp107.F90 pass'
+ print *, 'pp107.F90 yes'
else
- print *, 'pp107.F90 FAIL: ', res
+ print *, 'pp107.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp108.F90 b/flang/test/Preprocessing/pp108.F90
index 7ce6ccbdedc1..b07ec984fd81 100644
--- a/flang/test/Preprocessing/pp108.F90
+++ b/flang/test/Preprocessing/pp108.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = kwm
! ditto, but without & ! comment
integer, parameter :: KWM = 666
#define KWM 777
@@ -5,8 +7,8 @@
res = KW&
M
if (res .eq. 777) then
- print *, 'pp108.F90 pass'
+ print *, 'pp108.F90 yes'
else
- print *, 'pp108.F90 FAIL: ', res
+ print *, 'pp108.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp109.F90 b/flang/test/Preprocessing/pp109.F90
index a80579d18b3e..e75fd10c1cb8 100644
--- a/flang/test/Preprocessing/pp109.F90
+++ b/flang/test/Preprocessing/pp109.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = ((666)+111)
! FLM call name split with leading &
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFL&
&M(666)
if (res .eq. 777) then
- print *, 'pp109.F90 pass'
+ print *, 'pp109.F90 yes'
else
- print *, 'pp109.F90 FAIL: ', res
+ print *, 'pp109.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp110.F90 b/flang/test/Preprocessing/pp110.F90
index f5bf3b1867f4..681408ebfddf 100644
--- a/flang/test/Preprocessing/pp110.F90
+++ b/flang/test/Preprocessing/pp110.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = ((666)+111)
! ditto, with & ! comment
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFL& ! comment
&M(666)
if (res .eq. 777) then
- print *, 'pp110.F90 pass'
+ print *, 'pp110.F90 yes'
else
- print *, 'pp110.F90 FAIL: ', res
+ print *, 'pp110.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp111.F90 b/flang/test/Preprocessing/pp111.F90
index 668fcdc5f8d3..4b49bf6ad6c9 100644
--- a/flang/test/Preprocessing/pp111.F90
+++ b/flang/test/Preprocessing/pp111.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = iflm (666)
! FLM call name split across continuation, no leading &, with & ! comment
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFL& ! comment
M(666)
if (res .eq. 777) then
- print *, 'pp111.F90 pass'
+ print *, 'pp111.F90 yes'
else
- print *, 'pp111.F90 FAIL: ', res
+ print *, 'pp111.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp112.F90 b/flang/test/Preprocessing/pp112.F90
index 0a3c7f8906dc..9828366bef73 100644
--- a/flang/test/Preprocessing/pp112.F90
+++ b/flang/test/Preprocessing/pp112.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = iflm (666)
! ditto, but without & ! comment
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFL&
M(666)
if (res .eq. 777) then
- print *, 'pp112.F90 pass'
+ print *, 'pp112.F90 yes'
else
- print *, 'pp112.F90 FAIL: ', res
+ print *, 'pp112.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp113.F90 b/flang/test/Preprocessing/pp113.F90
index 4c928033638f..56e34389068f 100644
--- a/flang/test/Preprocessing/pp113.F90
+++ b/flang/test/Preprocessing/pp113.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = ((666)+111)
! FLM call split across continuation between name and (, leading &
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFLM&
&(666)
if (res .eq. 777) then
- print *, 'pp113.F90 pass'
+ print *, 'pp113.F90 yes'
else
- print *, 'pp113.F90 FAIL: ', res
+ print *, 'pp113.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp114.F90 b/flang/test/Preprocessing/pp114.F90
index f6c0e0263a2f..4c44759ba96e 100644
--- a/flang/test/Preprocessing/pp114.F90
+++ b/flang/test/Preprocessing/pp114.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = ((666)+111)
! ditto, with & ! comment, leading &
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFLM& ! comment
&(666)
if (res .eq. 777) then
- print *, 'pp114.F90 pass'
+ print *, 'pp114.F90 yes'
else
- print *, 'pp114.F90 FAIL: ', res
+ print *, 'pp114.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp115.F90 b/flang/test/Preprocessing/pp115.F90
index 4a38aca53311..290f62e68948 100644
--- a/flang/test/Preprocessing/pp115.F90
+++ b/flang/test/Preprocessing/pp115.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = iflm (666)
! ditto, with & ! comment, no leading &
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFLM& ! comment
(666)
if (res .eq. 777) then
- print *, 'pp115.F90 pass'
+ print *, 'pp115.F90 yes'
else
- print *, 'pp115.F90 FAIL: ', res
+ print *, 'pp115.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp116.F90 b/flang/test/Preprocessing/pp116.F90
index 8708f79347cc..d41fab771f84 100644
--- a/flang/test/Preprocessing/pp116.F90
+++ b/flang/test/Preprocessing/pp116.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = iflm (666)
! FLM call split between name and (, no leading &
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFLM&
(666)
if (res .eq. 777) then
- print *, 'pp116.F90 pass'
+ print *, 'pp116.F90 yes'
else
- print *, 'pp116.F90 FAIL: ', res
+ print *, 'pp116.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp117.F90 b/flang/test/Preprocessing/pp117.F90
index 8b8687f03743..c8d1c2ff3130 100644
--- a/flang/test/Preprocessing/pp117.F90
+++ b/flang/test/Preprocessing/pp117.F90
@@ -1,10 +1,12 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(777 .eq. 777) then
! KWM rescan
integer, parameter :: KWM = 666, KWM2 = 667
#define KWM2 777
#define KWM KWM2
if (KWM .eq. 777) then
- print *, 'pp117.F90 pass'
+ print *, 'pp117.F90 yes'
else
- print *, 'pp117.F90 FAIL: ', KWM
+ print *, 'pp117.F90 no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp118.F90 b/flang/test/Preprocessing/pp118.F90
index 014d99791f1a..e71cc410823b 100644
--- a/flang/test/Preprocessing/pp118.F90
+++ b/flang/test/Preprocessing/pp118.F90
@@ -1,11 +1,13 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(kwm2 .eq. 777) then
! KWM rescan with #undef, proving rescan after expansion
integer, parameter :: KWM2 = 777, KWM = 667
#define KWM2 666
#define KWM KWM2
#undef KWM2
if (KWM .eq. 777) then
- print *, 'pp118.F90 pass'
+ print *, 'pp118.F90 yes'
else
- print *, 'pp118.F90 FAIL: ', KWM
+ print *, 'pp118.F90 no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp119.F90 b/flang/test/Preprocessing/pp119.F90
index 37470de411a4..ea9a15cb02de 100644
--- a/flang/test/Preprocessing/pp119.F90
+++ b/flang/test/Preprocessing/pp119.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = ((666)+111)
! FLM rescan
integer function IFLM(x)
integer :: x
@@ -10,8 +12,8 @@ program main
integer :: res
res = IFLM(666)
if (res .eq. 777) then
- print *, 'pp119.F90 pass'
+ print *, 'pp119.F90 yes'
else
- print *, 'pp119.F90 FAIL: ', res
+ print *, 'pp119.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp120.F90 b/flang/test/Preprocessing/pp120.F90
index f7e0ae103490..9c4b88c8d15c 100644
--- a/flang/test/Preprocessing/pp120.F90
+++ b/flang/test/Preprocessing/pp120.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = ((111)+666)
! FLM expansion of argument
integer function IFLM(x)
integer :: x
@@ -10,8 +12,8 @@ program main
integer :: res
res = IFLM(KWM)
if (res .eq. 777) then
- print *, 'pp120.F90 pass'
+ print *, 'pp120.F90 yes'
else
- print *, 'pp120.F90 FAIL: ', res
+ print *, 'pp120.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp121.F90 b/flang/test/Preprocessing/pp121.F90
index bd855fe2f6ab..cdf25e15ee44 100644
--- a/flang/test/Preprocessing/pp121.F90
+++ b/flang/test/Preprocessing/pp121.F90
@@ -1,10 +1,13 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: ch = 'KWM'
+! CHECK: if(ch .eq. 'KWM') then
! KWM NOT expanded in 'literal'
#define KWM 666
character(len=3) :: ch
ch = 'KWM'
if (ch .eq. 'KWM') then
- print *, 'pp121.F90 pass'
+ print *, 'pp121.F90 yes'
else
- print *, 'pp121.F90 FAIL: ', ch
+ print *, 'pp121.F90 no: ', ch
end if
end
diff --git a/flang/test/Preprocessing/pp122.F90 b/flang/test/Preprocessing/pp122.F90
index dbad83a61c6a..14c8762af1c7 100644
--- a/flang/test/Preprocessing/pp122.F90
+++ b/flang/test/Preprocessing/pp122.F90
@@ -1,10 +1,12 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: ch = "KWM"
! KWM NOT expanded in "literal"
#define KWM 666
character(len=3) :: ch
ch = "KWM"
if (ch .eq. 'KWM') then
- print *, 'pp122.F90 pass'
+ print *, 'pp122.F90 yes'
else
- print *, 'pp122.F90 FAIL: ', ch
+ print *, 'pp122.F90 no: ', ch
end if
end
diff --git a/flang/test/Preprocessing/pp123.F90 b/flang/test/Preprocessing/pp123.F90
index 6e6c45244b8a..1768cec1c23b 100644
--- a/flang/test/Preprocessing/pp123.F90
+++ b/flang/test/Preprocessing/pp123.F90
@@ -1,11 +1,13 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: ch = 3hKWM
! KWM NOT expanded in Hollerith literal
#define KWM 666
#define HKWM 667
character(len=3) :: ch
ch = 3HKWM
if (ch .eq. 'KWM') then
- print *, 'pp123.F90 pass'
+ print *, 'pp123.F90 yes'
else
- print *, 'pp123.F90 FAIL: ', ch
+ print *, 'pp123.F90 no: ', ch
end if
end
diff --git a/flang/test/Preprocessing/pp124.F90 b/flang/test/Preprocessing/pp124.F90
index 2cf4d56dba23..bb011515ce1c 100644
--- a/flang/test/Preprocessing/pp124.F90
+++ b/flang/test/Preprocessing/pp124.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: 100 format(3hKWM)
! KWM NOT expanded in Hollerith in FORMAT
#define KWM 666
#define HKWM 667
@@ -5,8 +7,8 @@
100 format(3HKWM)
write(ch, 100)
if (ch .eq. 'KWM') then
- print *, 'pp124.F90 pass'
+ print *, 'pp124.F90 yes'
else
- print *, 'pp124.F90 FAIL: ', ch
+ print *, 'pp124.F90 no: ', ch
end if
end
diff --git a/flang/test/Preprocessing/pp125.F90 b/flang/test/Preprocessing/pp125.F90
index 5f3875d8e88e..cf3909b88824 100644
--- a/flang/test/Preprocessing/pp125.F90
+++ b/flang/test/Preprocessing/pp125.F90
@@ -1,9 +1,11 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(777 .eq. 777) then
! #DEFINE works in free form
integer, parameter :: KWM = 666
#DEFINE KWM 777
if (KWM .eq. 777) then
- print *, 'pp125.F90 pass'
+ print *, 'pp125.F90 yes'
else
- print *, 'pp125.F90 FAIL: ', KWM
+ print *, 'pp125.F90 no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp126.F90 b/flang/test/Preprocessing/pp126.F90
index c2684c51413b..fefb7fcf118f 100644
--- a/flang/test/Preprocessing/pp126.F90
+++ b/flang/test/Preprocessing/pp126.F90
@@ -1,10 +1,12 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: if(777 .eq. 777) then
! \ newline works in #define
integer, parameter :: KWM = 666
#define KWM 77\
7
if (KWM .eq. 777) then
- print *, 'pp126.F90 pass'
+ print *, 'pp126.F90 yes'
else
- print *, 'pp126.F90 FAIL: ', KWM
+ print *, 'pp126.F90 no: ', KWM
end if
end
diff --git a/flang/test/Preprocessing/pp127.F90 b/flang/test/Preprocessing/pp127.F90
index 19f83b6afbc9..08feedf95305 100644
--- a/flang/test/Preprocessing/pp127.F90
+++ b/flang/test/Preprocessing/pp127.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = iflm(666 )
! FLM call with closing ')' on next line (not a continuation)
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFLM(666
)
if (res .eq. 777) then
- print *, 'pp127.F90 pass'
+ print *, 'pp127.F90 yes'
else
- print *, 'pp127.F90 FAIL: ', res
+ print *, 'pp127.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp128.F90 b/flang/test/Preprocessing/pp128.F90
index 84b338bc7cc9..46918e05f5c3 100644
--- a/flang/test/Preprocessing/pp128.F90
+++ b/flang/test/Preprocessing/pp128.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: res = iflm
! FLM call with '(' on next line (not a continuation)
integer function IFLM(x)
integer :: x
@@ -9,8 +11,8 @@ program main
res = IFLM
(666)
if (res .eq. 777) then
- print *, 'pp128.F90 pass'
+ print *, 'pp128.F90 yes'
else
- print *, 'pp128.F90 FAIL: ', res
+ print *, 'pp128.F90 no: ', res
end if
end
diff --git a/flang/test/Preprocessing/pp129.F90 b/flang/test/Preprocessing/pp129.F90
index a8eea8699683..ab7e7f0baa8b 100644
--- a/flang/test/Preprocessing/pp129.F90
+++ b/flang/test/Preprocessing/pp129.F90
@@ -1,5 +1,7 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK-NOT: stop
! #define KWM !, then KWM works as comment line initiator
#define KWM !
KWM print *, 'pp129.F90 FAIL HARD!'; stop
- print *, 'pp129.F90 pass'
+ print *, 'pp129.F90 yes'
end
diff --git a/flang/test/Preprocessing/pp130.F90 b/flang/test/Preprocessing/pp130.F90
index c3d8079210c6..af4ad126e6fa 100644
--- a/flang/test/Preprocessing/pp130.F90
+++ b/flang/test/Preprocessing/pp130.F90
@@ -1,3 +1,5 @@
+! RUN: %f18 -E %s 2>&1 | FileCheck %s
+! CHECK: j = j + &
! #define KWM &, use for continuation w/o pasting (ifort and nag seem to continue #define)
#define KWM &
@@ -6,8 +8,8 @@
j = j + KWM
111
if (j .eq. 777) then
- print *, 'pp130.F90 pass'
+ print *, 'pp130.F90 yes'
else
- print *, 'pp130.F90 FAIL', j
+ print *, 'pp130.F90 no', j
end if
end
More information about the flang-commits
mailing list