From 089adc339e7dd6924d7e107fa362d9d12642f6e0 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Mon, 3 Aug 2020 10:50:42 -0700 Subject: [PATCH] [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 --- flang/lib/Parser/preprocessor.cpp | 2 +- flang/lib/Parser/preprocessor.h | 2 +- flang/lib/Parser/prescan.cpp | 30 ++++++++++++++++++++---------- flang/test/Preprocessing/lit.local.cfg.py | 7 ------- flang/test/Preprocessing/pp001.F | 6 ++++-- flang/test/Preprocessing/pp002.F | 6 ++++-- flang/test/Preprocessing/pp003.F | 6 ++++-- flang/test/Preprocessing/pp004.F | 6 ++++-- flang/test/Preprocessing/pp005.F | 6 ++++-- flang/test/Preprocessing/pp006.F | 6 ++++-- flang/test/Preprocessing/pp007.F | 6 ++++-- flang/test/Preprocessing/pp008.F | 6 ++++-- flang/test/Preprocessing/pp009.F | 6 ++++-- flang/test/Preprocessing/pp010.F | 6 ++++-- flang/test/Preprocessing/pp011.F | 6 ++++-- flang/test/Preprocessing/pp012.F | 6 ++++-- flang/test/Preprocessing/pp013.F | 6 ++++-- flang/test/Preprocessing/pp014.F | 6 ++++-- flang/test/Preprocessing/pp015.F | 6 ++++-- flang/test/Preprocessing/pp016.F | 6 ++++-- flang/test/Preprocessing/pp017.F | 6 ++++-- flang/test/Preprocessing/pp018.F | 6 ++++-- flang/test/Preprocessing/pp019.F | 6 ++++-- flang/test/Preprocessing/pp020.F | 6 ++++-- flang/test/Preprocessing/pp021.F | 7 +++++-- flang/test/Preprocessing/pp022.F | 7 +++++-- flang/test/Preprocessing/pp023.F | 7 +++++-- flang/test/Preprocessing/pp024.F | 7 +++++-- flang/test/Preprocessing/pp025.F | 6 ++++-- flang/test/Preprocessing/pp026.F | 6 ++++-- flang/test/Preprocessing/pp027.F | 7 +++++-- flang/test/Preprocessing/pp028.F | 6 ++++-- flang/test/Preprocessing/pp029.F | 6 ++++-- flang/test/Preprocessing/pp030.F | 6 ++++-- flang/test/Preprocessing/pp031.F | 5 ++++- flang/test/Preprocessing/pp032.F | 7 +++++-- flang/test/Preprocessing/pp033.F | 7 +++++-- flang/test/Preprocessing/pp034.F | 7 +++++-- flang/test/Preprocessing/pp035.F | 7 +++++-- flang/test/Preprocessing/pp036.F | 7 +++++-- flang/test/Preprocessing/pp037.F | 7 +++++-- flang/test/Preprocessing/pp038.F | 6 ++++-- flang/test/Preprocessing/pp039.F | 8 ++++++-- flang/test/Preprocessing/pp040.F | 4 +++- flang/test/Preprocessing/pp041.F | 6 ++++-- flang/test/Preprocessing/pp042.F | 6 ++++-- flang/test/Preprocessing/pp043.F | 6 ++++-- flang/test/Preprocessing/pp044.F | 6 ++++-- flang/test/Preprocessing/pp101.F90 | 6 ++++-- flang/test/Preprocessing/pp102.F90 | 6 ++++-- flang/test/Preprocessing/pp103.F90 | 6 ++++-- flang/test/Preprocessing/pp104.F90 | 6 ++++-- flang/test/Preprocessing/pp105.F90 | 6 ++++-- flang/test/Preprocessing/pp106.F90 | 6 ++++-- flang/test/Preprocessing/pp107.F90 | 6 ++++-- flang/test/Preprocessing/pp108.F90 | 6 ++++-- flang/test/Preprocessing/pp109.F90 | 6 ++++-- flang/test/Preprocessing/pp110.F90 | 6 ++++-- flang/test/Preprocessing/pp111.F90 | 6 ++++-- flang/test/Preprocessing/pp112.F90 | 6 ++++-- flang/test/Preprocessing/pp113.F90 | 6 ++++-- flang/test/Preprocessing/pp114.F90 | 6 ++++-- flang/test/Preprocessing/pp115.F90 | 6 ++++-- flang/test/Preprocessing/pp116.F90 | 6 ++++-- flang/test/Preprocessing/pp117.F90 | 6 ++++-- flang/test/Preprocessing/pp118.F90 | 6 ++++-- flang/test/Preprocessing/pp119.F90 | 6 ++++-- flang/test/Preprocessing/pp120.F90 | 6 ++++-- flang/test/Preprocessing/pp121.F90 | 7 +++++-- flang/test/Preprocessing/pp122.F90 | 6 ++++-- flang/test/Preprocessing/pp123.F90 | 6 ++++-- flang/test/Preprocessing/pp124.F90 | 6 ++++-- flang/test/Preprocessing/pp125.F90 | 6 ++++-- flang/test/Preprocessing/pp126.F90 | 6 ++++-- flang/test/Preprocessing/pp127.F90 | 6 ++++-- flang/test/Preprocessing/pp128.F90 | 6 ++++-- flang/test/Preprocessing/pp129.F90 | 4 +++- flang/test/Preprocessing/pp130.F90 | 6 ++++-- 78 files changed, 330 insertions(+), 164 deletions(-) delete mode 100644 flang/test/Preprocessing/lit.local.cfg.py diff --git a/flang/lib/Parser/preprocessor.cpp b/flang/lib/Parser/preprocessor.cpp index a1f0796..9c10ced 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 977d480..b4374a9 100644 --- a/flang/lib/Parser/preprocessor.h +++ b/flang/lib/Parser/preprocessor.h @@ -67,6 +67,7 @@ public: void Define(std::string macro, std::string value); void Undefine(std::string macro); + bool IsNameDefined(const CharBlock &); std::optional MacroReplacement( const TokenSequence &, const Prescanner &); @@ -79,7 +80,6 @@ private: 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 c81d6cb..face0d2 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 a7cf401..0000000 --- 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 ba131b4..9519864 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 f46baf7..b4cbd75 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 0470f19..4df10c4 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 @@ 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 800a96f..788d368 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 05fab7a..390e662 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 55b87df..3c44728 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 8be4396..ca78f4f 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 38c5b66..9dd7bd9 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 a53623f..c29021d 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 @@ 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 0769c98..4a812cd 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 @@ *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 4ec3766..c106c8b 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 @@ 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 703fabf..411cfb8 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 @@ 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 6fb8ca7..f05e2e3 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 @@ 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 397a31d..4709660 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 @@ *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 4c399a8..8320bd7 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 @@ 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 210ad0b..95c89f8 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 @@ +(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 e658fbd..a11f185 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 877c654..69c24e5 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 a2c9a02..d607ad3 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 @@ 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 f0d2635..8852500 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 @@ 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 45073ab6..1662a68 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 e9a1e8ba..026c02e 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 fb63d63..a0d053f 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 9072f6e..6ea76cc 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 42ad011..49521d4 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 e0ea032..b551f3b 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 @@ 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 e266380..c1b787f 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 2906d38..51eab84f 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 4374ef8..bb8efe6 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 3022e0d..c04cf94 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 0f59921..90b1464 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 9d9f142..6b77914 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 34cf199..3364527 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 a9ed984..0c64aca 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 0135c9c..8081741 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 ac922ae..b7024c4 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 6c3edb0..52bfa8f 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 3c83dda..7386aee 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 @@ 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 52e6dd7..9124474 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 @@ 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 59e901a..d589c384 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 33c5ced..dcf6153 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 439e1af..d5cc46a 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 be0069c..a079466 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 72ce6cc..c14b29c 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 694201a..b0f8601 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 22e4613..e2c3207 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 9df4c9d..3309d7f 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 @@ 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 b15f0db..51248c2 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 cd475db..898a4a1 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 e169ff7..d83085f 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 bf6d427..6973127 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 7ce6ccb..b07ec98 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 a80579d..e75fd10 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 @@ 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 f5bf3b1..681408e 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 @@ 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 668fcdc..4b49bf6 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 @@ 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 0a3c7f8..9828366 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 @@ 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 4c92803..56e3438 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 @@ 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 f6c0e02..4c44759 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 @@ 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 4a38aca..290f62e 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 @@ 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 8708f79..d41fab7 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 @@ 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 8b8687f..c8d1c2f 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 014d997..e71cc41 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 37470de..ea9a15c 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 @@ 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 f7e0ae1..9c4b88c 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 @@ 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 bd855fe..cdf25e15 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 dbad83a..14c8762 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 6e6c452..1768cec 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 2cf4d56..bb01151 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 5f3875d..cf3909b 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 c2684c5..fefb7fc 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 19f83b6..08feedf 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 @@ 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 84b338b..46918e0 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 @@ 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 a8eea86..ab7e7f0 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 c3d8079..af4ad12 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 -- 2.7.4