[flang] Distinguish usage and portability warning messages

Using recently established message severity codes, upgrade
non-fatal messages to usage and portability warnings as
appropriate.

Differential Revision: https://reviews.llvm.org/D121246
This commit is contained in:
Peter Klausler 2022-03-07 13:57:37 -08:00
parent 06057248c8
commit a53967cd55
37 changed files with 200 additions and 188 deletions

View File

@ -410,7 +410,7 @@ std::optional<Expr<SomeType>> NonPointerInitializationExpr(const Symbol &symbol,
symbol.owner().context().ShouldWarn(
common::LanguageFeature::LogicalIntegerAssignment)) {
context.messages().Say(
"nonstandard usage: initialization of %s with %s"_en_US,
"nonstandard usage: initialization of %s with %s"_port_en_US,
symTS->type().AsFortran(), x.GetType().value().AsFortran());
}
}

View File

@ -16,20 +16,20 @@ namespace Fortran::evaluate {
void RealFlagWarnings(
FoldingContext &context, const RealFlags &flags, const char *operation) {
if (flags.test(RealFlag::Overflow)) {
context.messages().Say("overflow on %s"_en_US, operation);
context.messages().Say("overflow on %s"_warn_en_US, operation);
}
if (flags.test(RealFlag::DivideByZero)) {
if (std::strcmp(operation, "division") == 0) {
context.messages().Say("division by zero"_en_US);
context.messages().Say("division by zero"_warn_en_US);
} else {
context.messages().Say("division on %s"_en_US);
context.messages().Say("division on %s"_warn_en_US);
}
}
if (flags.test(RealFlag::InvalidArgument)) {
context.messages().Say("invalid argument on %s"_en_US, operation);
context.messages().Say("invalid argument on %s"_warn_en_US, operation);
}
if (flags.test(RealFlag::Underflow)) {
context.messages().Say("underflow on %s"_en_US, operation);
context.messages().Say("underflow on %s"_warn_en_US, operation);
}
}

View File

@ -30,7 +30,8 @@ Expr<Type<TypeCategory::Complex, KIND>> FoldIntrinsicFunction(
context, std::move(funcRef), *callable);
} else {
context.messages().Say(
"%s(complex(kind=%d)) cannot be folded on host"_en_US, name, KIND);
"%s(complex(kind=%d)) cannot be folded on host"_warn_en_US, name,
KIND);
}
} else if (name == "conjg") {
return FoldElementalIntrinsic<T, T>(

View File

@ -1534,7 +1534,7 @@ Expr<TO> FoldOperation(
auto converted{Scalar<TO>::ConvertSigned(*value)};
if (converted.overflow) {
ctx.messages().Say(
"INTEGER(%d) to INTEGER(%d) conversion overflowed"_en_US,
"INTEGER(%d) to INTEGER(%d) conversion overflowed"_warn_en_US,
Operand::kind, TO::kind);
}
return ScalarConstantToExpr(std::move(converted.value));
@ -1542,11 +1542,11 @@ Expr<TO> FoldOperation(
auto converted{value->template ToInteger<Scalar<TO>>()};
if (converted.flags.test(RealFlag::InvalidArgument)) {
ctx.messages().Say(
"REAL(%d) to INTEGER(%d) conversion: invalid argument"_en_US,
"REAL(%d) to INTEGER(%d) conversion: invalid argument"_warn_en_US,
Operand::kind, TO::kind);
} else if (converted.flags.test(RealFlag::Overflow)) {
ctx.messages().Say(
"REAL(%d) to INTEGER(%d) conversion overflowed"_en_US,
"REAL(%d) to INTEGER(%d) conversion overflowed"_warn_en_US,
Operand::kind, TO::kind);
}
return ScalarConstantToExpr(std::move(converted.value));
@ -1651,7 +1651,7 @@ Expr<T> FoldOperation(FoldingContext &context, Negate<T> &&x) {
auto negated{value->Negate()};
if (negated.overflow) {
context.messages().Say(
"INTEGER(%d) negation overflowed"_en_US, T::kind);
"INTEGER(%d) negation overflowed"_warn_en_US, T::kind);
}
return Expr<T>{Constant<T>{std::move(negated.value)}};
} else {
@ -1691,7 +1691,7 @@ Expr<T> FoldOperation(FoldingContext &context, Add<T> &&x) {
auto sum{folded->first.AddSigned(folded->second)};
if (sum.overflow) {
context.messages().Say(
"INTEGER(%d) addition overflowed"_en_US, T::kind);
"INTEGER(%d) addition overflowed"_warn_en_US, T::kind);
}
return Expr<T>{Constant<T>{sum.value}};
} else {
@ -1716,7 +1716,7 @@ Expr<T> FoldOperation(FoldingContext &context, Subtract<T> &&x) {
auto difference{folded->first.SubtractSigned(folded->second)};
if (difference.overflow) {
context.messages().Say(
"INTEGER(%d) subtraction overflowed"_en_US, T::kind);
"INTEGER(%d) subtraction overflowed"_warn_en_US, T::kind);
}
return Expr<T>{Constant<T>{difference.value}};
} else {
@ -1742,7 +1742,7 @@ Expr<T> FoldOperation(FoldingContext &context, Multiply<T> &&x) {
auto product{folded->first.MultiplySigned(folded->second)};
if (product.SignedMultiplicationOverflowed()) {
context.messages().Say(
"INTEGER(%d) multiplication overflowed"_en_US, T::kind);
"INTEGER(%d) multiplication overflowed"_warn_en_US, T::kind);
}
return Expr<T>{Constant<T>{product.lower}};
} else {
@ -1780,12 +1780,13 @@ Expr<T> FoldOperation(FoldingContext &context, Divide<T> &&x) {
if constexpr (T::category == TypeCategory::Integer) {
auto quotAndRem{folded->first.DivideSigned(folded->second)};
if (quotAndRem.divisionByZero) {
context.messages().Say("INTEGER(%d) division by zero"_en_US, T::kind);
context.messages().Say(
"INTEGER(%d) division by zero"_warn_en_US, T::kind);
return Expr<T>{std::move(x)};
}
if (quotAndRem.overflow) {
context.messages().Say(
"INTEGER(%d) division overflowed"_en_US, T::kind);
"INTEGER(%d) division overflowed"_warn_en_US, T::kind);
}
return Expr<T>{Constant<T>{quotAndRem.quotient}};
} else {
@ -1810,12 +1811,13 @@ Expr<T> FoldOperation(FoldingContext &context, Power<T> &&x) {
auto power{folded->first.Power(folded->second)};
if (power.divisionByZero) {
context.messages().Say(
"INTEGER(%d) zero to negative power"_en_US, T::kind);
"INTEGER(%d) zero to negative power"_warn_en_US, T::kind);
} else if (power.overflow) {
context.messages().Say("INTEGER(%d) power overflowed"_en_US, T::kind);
context.messages().Say(
"INTEGER(%d) power overflowed"_warn_en_US, T::kind);
} else if (power.zeroToZero) {
context.messages().Say(
"INTEGER(%d) 0**0 is not defined"_en_US, T::kind);
"INTEGER(%d) 0**0 is not defined"_warn_en_US, T::kind);
}
return Expr<T>{Constant<T>{power.power}};
} else {
@ -1824,7 +1826,8 @@ Expr<T> FoldOperation(FoldingContext &context, Power<T> &&x) {
Constant<T>{(*callable)(context, folded->first, folded->second)}};
} else {
context.messages().Say(
"Power for %s cannot be folded on host"_en_US, T{}.AsFortran());
"Power for %s cannot be folded on host"_warn_en_US,
T{}.AsFortran());
}
}
}
@ -1907,7 +1910,7 @@ Expr<Type<TypeCategory::Real, KIND>> ToReal(
From converted{From::ConvertUnsigned(real.RawBits()).value};
if (original != converted) { // C1601
context.messages().Say(
"Nonzero bits truncated from BOZ literal constant in REAL intrinsic"_en_US);
"Nonzero bits truncated from BOZ literal constant in REAL intrinsic"_warn_en_US);
}
} else if constexpr (IsNumericCategoryExpr<From>()) {
result = Fold(context, ConvertToType<Result>(std::move(x)));

View File

@ -420,7 +420,7 @@ Expr<Type<TypeCategory::Integer, KIND>> FoldIntrinsicFunction(
typename Scalar<T>::ValueWithOverflow j{i.ABS()};
if (j.overflow) {
context.messages().Say(
"abs(integer(kind=%d)) folding overflowed"_en_US, KIND);
"abs(integer(kind=%d)) folding overflowed"_warn_en_US, KIND);
}
return j.value;
}));
@ -440,7 +440,7 @@ Expr<Type<TypeCategory::Integer, KIND>> FoldIntrinsicFunction(
auto y{x.template ToInteger<Scalar<T>>(mode)};
if (y.flags.test(RealFlag::Overflow)) {
context.messages().Say(
"%s intrinsic folding overflow"_en_US, name);
"%s intrinsic folding overflow"_warn_en_US, name);
}
return y.value;
}));
@ -506,7 +506,7 @@ Expr<Type<TypeCategory::Integer, KIND>> FoldIntrinsicFunction(
if (len.value() != 1) {
// Do not die, this was not checked before
context.messages().Say(
"Character in intrinsic function %s must have length one"_en_US,
"Character in intrinsic function %s must have length one"_warn_en_US,
name);
} else {
return std::visit(
@ -761,9 +761,9 @@ Expr<Type<TypeCategory::Integer, KIND>> FoldIntrinsicFunction(
const Scalar<T> &y) -> Scalar<T> {
auto quotRem{x.DivideSigned(y)};
if (quotRem.divisionByZero) {
context.messages().Say("mod() by zero"_en_US);
context.messages().Say("mod() by zero"_warn_en_US);
} else if (quotRem.overflow) {
context.messages().Say("mod() folding overflowed"_en_US);
context.messages().Say("mod() folding overflowed"_warn_en_US);
}
return quotRem.remainder;
}));
@ -774,7 +774,8 @@ Expr<Type<TypeCategory::Integer, KIND>> FoldIntrinsicFunction(
const Scalar<T> &y) -> Scalar<T> {
auto result{x.MODULO(y)};
if (result.overflow) {
context.messages().Say("modulo() folding overflowed"_en_US);
context.messages().Say(
"modulo() folding overflowed"_warn_en_US);
}
return result.value;
}));
@ -894,7 +895,8 @@ Expr<Type<TypeCategory::Integer, KIND>> FoldIntrinsicFunction(
typename Scalar<T>::ValueWithOverflow result{j.SIGN(k)};
if (result.overflow) {
context.messages().Say(
"sign(integer(kind=%d)) folding overflowed"_en_US, KIND);
"sign(integer(kind=%d)) folding overflowed"_warn_en_US,
KIND);
}
return result.value;
}));
@ -915,7 +917,7 @@ Expr<Type<TypeCategory::Integer, KIND>> FoldIntrinsicFunction(
}
} else {
context.messages().Say(
"size(array,dim=%jd) dimension is out of range for rank-%d array"_en_US,
"size(array,dim=%jd) dimension is out of range for rank-%d array"_warn_en_US,
*dim, rank);
}
}

View File

@ -35,7 +35,7 @@ Expr<Type<TypeCategory::Real, KIND>> FoldIntrinsicFunction(
context, std::move(funcRef), *callable);
} else {
context.messages().Say(
"%s(real(kind=%d)) cannot be folded on host"_en_US, name, KIND);
"%s(real(kind=%d)) cannot be folded on host"_warn_en_US, name, KIND);
}
} else if (name == "amax0" || name == "amin0" || name == "amin1" ||
name == "amax1" || name == "dmin1" || name == "dmax1") {
@ -48,7 +48,7 @@ Expr<Type<TypeCategory::Real, KIND>> FoldIntrinsicFunction(
context, std::move(funcRef), *callable);
} else {
context.messages().Say(
"%s(real(kind=%d), real(kind%d)) cannot be folded on host"_en_US,
"%s(real(kind=%d), real(kind%d)) cannot be folded on host"_warn_en_US,
name, KIND, KIND);
}
} else if (name == "bessel_jn" || name == "bessel_yn") {
@ -60,7 +60,7 @@ Expr<Type<TypeCategory::Real, KIND>> FoldIntrinsicFunction(
context, std::move(funcRef), *callable);
} else {
context.messages().Say(
"%s(integer(kind=4), real(kind=%d)) cannot be folded on host"_en_US,
"%s(integer(kind=4), real(kind=%d)) cannot be folded on host"_warn_en_US,
name, KIND);
}
}
@ -90,7 +90,8 @@ Expr<Type<TypeCategory::Real, KIND>> FoldIntrinsicFunction(
const Scalar<T> &x) -> Scalar<T> {
ValueWithRealFlags<Scalar<T>> y{x.ToWholeNumber(mode)};
if (y.flags.test(RealFlag::Overflow)) {
context.messages().Say("%s intrinsic folding overflow"_en_US, name);
context.messages().Say(
"%s intrinsic folding overflow"_warn_en_US, name);
}
return y.value;
}));
@ -148,7 +149,7 @@ Expr<Type<TypeCategory::Real, KIND>> FoldIntrinsicFunction(
SCALE(y)};
if (result.flags.test(RealFlag::Overflow)) {
context.messages().Say(
"SCALE intrinsic folding overflow"_en_US);
"SCALE intrinsic folding overflow"_warn_en_US);
}
return result.value;
}));

View File

@ -173,7 +173,7 @@ static Expr<T> FoldProduct(
}};
if (overflow) {
context.messages().Say(
"PRODUCT() of %s data overflowed"_en_US, T::AsFortran());
"PRODUCT() of %s data overflowed"_warn_en_US, T::AsFortran());
} else {
return Expr<T>{DoReduction<T>(*array, dim, identity, accumulator)};
}
@ -212,7 +212,7 @@ static Expr<T> FoldSum(FoldingContext &context, FunctionRef<T> &&ref) {
}};
if (overflow) {
context.messages().Say(
"SUM() of %s data overflowed"_en_US, T::AsFortran());
"SUM() of %s data overflowed"_warn_en_US, T::AsFortran());
} else {
return Expr<T>{DoReduction<T>(*array, dim, identity, accumulator)};
}

View File

@ -102,7 +102,7 @@ void HostFloatingPointEnvironment::SetUpHostFloatingPointEnvironment(
fesetround(FE_TONEAREST);
context.messages().Say(
"TiesAwayFromZero rounding mode is not available when folding constants"
" with host runtime; using TiesToEven instead"_en_US);
" with host runtime; using TiesToEven instead"_warn_en_US);
break;
}
flags_.clear();

View File

@ -2476,7 +2476,7 @@ std::optional<SpecificCall> IntrinsicProcTable::Implementation::Probe(
context.messages().Say(
"argument types do not match specific intrinsic '%s' "
"requirements; using '%s' generic instead and converting the "
"result to %s if needed"_en_US,
"result to %s if needed"_port_en_US,
call.name, genericName, newType.AsFortran());
specificCall->specificIntrinsic.name = call.name;
specificCall->specificIntrinsic.characteristics.value()

View File

@ -223,14 +223,14 @@ std::optional<Expr<SomeCharacter>> Substring::Fold(FoldingContext &context) {
if (!result) { // error cases
if (*lbi < 1) {
context.messages().Say(
"Lower bound (%jd) on substring is less than one"_en_US,
"Lower bound (%jd) on substring is less than one"_warn_en_US,
static_cast<std::intmax_t>(*lbi));
*lbi = 1;
lower_ = AsExpr(Constant<SubscriptInteger>{1});
}
if (length && *ubi > *length) {
context.messages().Say(
"Upper bound (%jd) on substring is greater than character length (%jd)"_en_US,
"Upper bound (%jd) on substring is greater than character length (%jd)"_warn_en_US,
static_cast<std::intmax_t>(*ubi),
static_cast<std::intmax_t>(*length));
*ubi = *length;

View File

@ -856,7 +856,7 @@ public:
auto result{parser_.Parse(state)};
if (result) {
state.Nonstandard(CharBlock{at, std::max(state.GetLocation(), at + 1)},
LF, "nonstandard usage"_en_US);
LF, "nonstandard usage"_port_en_US);
}
return result;
}
@ -887,8 +887,8 @@ public:
auto at{state.GetLocation()};
auto result{parser_.Parse(state)};
if (result) {
state.Nonstandard(
CharBlock{at, state.GetLocation()}, LF, "deprecated usage"_en_US);
state.Nonstandard(CharBlock{at, state.GetLocation()}, LF,
"deprecated usage"_port_en_US);
}
return result;
}

View File

@ -495,7 +495,7 @@ void Preprocessor::Directive(const TokenSequence &dir, Prescanner &prescanner) {
} else {
if (dir.IsAnythingLeft(++j)) {
prescanner.Say(dir.GetIntervalProvenanceRange(j, tokens - j),
"#undef: excess tokens at end of directive"_en_US);
"#undef: excess tokens at end of directive"_port_en_US);
} else {
definitions_.erase(nameToken);
}
@ -509,7 +509,7 @@ void Preprocessor::Directive(const TokenSequence &dir, Prescanner &prescanner) {
} else {
if (dir.IsAnythingLeft(++j)) {
prescanner.Say(dir.GetIntervalProvenanceRange(j, tokens - j),
"#%s: excess tokens at end of directive"_en_US, dirName);
"#%s: excess tokens at end of directive"_port_en_US, dirName);
}
doThen = IsNameDefined(nameToken) == (dirName == "ifdef");
}
@ -529,7 +529,7 @@ void Preprocessor::Directive(const TokenSequence &dir, Prescanner &prescanner) {
} else if (dirName == "else") {
if (dir.IsAnythingLeft(j)) {
prescanner.Say(dir.GetIntervalProvenanceRange(j, tokens - j),
"#else: excess tokens at end of directive"_en_US);
"#else: excess tokens at end of directive"_port_en_US);
} else if (ifStack_.empty()) {
prescanner.Say(dir.GetTokenProvenanceRange(dirOffset),
"#else: not nested within #if, #ifdef, or #ifndef"_err_en_US);
@ -556,7 +556,7 @@ void Preprocessor::Directive(const TokenSequence &dir, Prescanner &prescanner) {
} else if (dirName == "endif") {
if (dir.IsAnythingLeft(j)) {
prescanner.Say(dir.GetIntervalProvenanceRange(j, tokens - j),
"#endif: excess tokens at end of directive"_en_US);
"#endif: excess tokens at end of directive"_port_en_US);
} else if (ifStack_.empty()) {
prescanner.Say(dir.GetTokenProvenanceRange(dirOffset),
"#endif: no #if, #ifdef, or #ifndef"_err_en_US);
@ -567,8 +567,11 @@ void Preprocessor::Directive(const TokenSequence &dir, Prescanner &prescanner) {
prescanner.Say(
dir.GetIntervalProvenanceRange(dirOffset, tokens - dirOffset),
"%s"_err_en_US, dir.ToString());
} else if (dirName == "warning" || dirName == "comment" ||
dirName == "note") {
} else if (dirName == "warning") {
prescanner.Say(
dir.GetIntervalProvenanceRange(dirOffset, tokens - dirOffset),
"%s"_warn_en_US, dir.ToString());
} else if (dirName == "comment" || dirName == "note") {
prescanner.Say(
dir.GetIntervalProvenanceRange(dirOffset, tokens - dirOffset),
"%s"_en_US, dir.ToString());
@ -593,7 +596,7 @@ void Preprocessor::Directive(const TokenSequence &dir, Prescanner &prescanner) {
}
if (k >= tokens) {
prescanner.Say(dir.GetIntervalProvenanceRange(j, tokens - j),
"#include: expected '>' at end of included file"_en_US);
"#include: expected '>' at end of included file"_port_en_US);
}
TokenSequence braced{dir, j + 1, k - j - 1};
include = ReplaceMacros(braced, prescanner).ToString();
@ -620,7 +623,7 @@ void Preprocessor::Directive(const TokenSequence &dir, Prescanner &prescanner) {
j = dir.SkipBlanks(j + 1);
if (j < tokens && dir.TokenAt(j).ToString() != "!") {
prescanner.Say(dir.GetIntervalProvenanceRange(j, tokens - j),
"#include: extra stuff ignored after file name"_en_US);
"#include: extra stuff ignored after file name"_port_en_US);
}
std::string buf;
llvm::raw_string_ostream error{buf};

View File

@ -181,7 +181,7 @@ void Prescanner::Statement() {
case LineClassification::Kind::DefinitionDirective:
case LineClassification::Kind::PreprocessorDirective:
Say(preprocessed->GetProvenanceRange(),
"Preprocessed line resembles a preprocessor directive"_en_US);
"Preprocessed line resembles a preprocessor directive"_warn_en_US);
preprocessed->ToLowerCase()
.CheckBadFortranCharacters(messages_)
.CheckBadParentheses(messages_)
@ -280,7 +280,7 @@ void Prescanner::LabelField(TokenSequence &token) {
}
if (bad && !preprocessor_.IsNameDefined(token.CurrentOpenToken())) {
Say(GetProvenance(bad),
"Character in fixed-form label field must be a digit"_en_US);
"Character in fixed-form label field must be a digit"_warn_en_US);
token.clear();
at_ = start;
return;
@ -296,7 +296,7 @@ void Prescanner::LabelField(TokenSequence &token) {
SkipToNextSignificantCharacter();
if (IsDecimalDigit(*at_)) {
Say(GetProvenance(at_),
"Label digit is not in fixed-form label field"_en_US);
"Label digit is not in fixed-form label field"_port_en_US);
}
}
@ -489,7 +489,8 @@ bool Prescanner::NextToken(TokenSequence &tokens) {
// Recognize and skip over classic C style /*comments*/ when
// outside a character literal.
if (features_.ShouldWarn(LanguageFeature::ClassicCComments)) {
Say(GetProvenance(at_), "nonstandard usage: C-style comment"_en_US);
Say(GetProvenance(at_),
"nonstandard usage: C-style comment"_port_en_US);
}
SkipCComments();
}
@ -698,7 +699,7 @@ void Prescanner::Hollerith(
if (PadOutCharacterLiteral(tokens)) {
} else if (*at_ == '\n') {
Say(GetProvenanceRange(start, at_),
"Possible truncated Hollerith literal"_en_US);
"Possible truncated Hollerith literal"_warn_en_US);
break;
} else {
NextChar();
@ -827,7 +828,7 @@ void Prescanner::FortranInclude(const char *firstQuote) {
for (; *p != '\n' && *p != '!'; ++p) {
}
Say(GetProvenanceRange(garbage, p),
"excess characters after path name"_en_US);
"excess characters after path name"_warn_en_US);
}
std::string buf;
llvm::raw_string_ostream error{buf};
@ -951,7 +952,7 @@ const char *Prescanner::FixedFormContinuationLine(bool mightNeedSpace) {
// Extension: '&' as continuation marker
if (features_.ShouldWarn(
LanguageFeature::FixedFormContinuationWithColumn1Ampersand)) {
Say(GetProvenance(nextLine_), "nonstandard usage"_en_US);
Say(GetProvenance(nextLine_), "nonstandard usage"_port_en_US);
}
return nextLine_ + 1;
}
@ -1045,7 +1046,7 @@ bool Prescanner::FreeFormContinuation() {
return false;
} else if (*p != '!' &&
features_.ShouldWarn(LanguageFeature::CruftAfterAmpersand)) {
Say(GetProvenance(p), "missing ! before comment after &"_en_US);
Say(GetProvenance(p), "missing ! before comment after &"_warn_en_US);
}
}
do {

View File

@ -82,7 +82,7 @@ constexpr Space space;
inline void MissingSpace(ParseState &state) {
if (!state.inFixedForm()) {
state.Nonstandard(
LanguageFeature::OptionalFreeFormSpace, "missing space"_en_US);
LanguageFeature::OptionalFreeFormSpace, "missing space"_port_en_US);
}
}
@ -294,8 +294,8 @@ struct BOZLiteral {
return std::nullopt;
}
if (**at == 'x' &&
!state.IsNonstandardOk(
LanguageFeature::BOZExtensions, "nonstandard BOZ literal"_en_US)) {
!state.IsNonstandardOk(LanguageFeature::BOZExtensions,
"nonstandard BOZ literal"_port_en_US)) {
return std::nullopt;
}
if (baseChar(**at)) {
@ -332,7 +332,7 @@ struct BOZLiteral {
// extension: base allowed to appear as suffix, too
if (!(at = nextCh.Parse(state)) || !baseChar(**at) ||
!state.IsNonstandardOk(LanguageFeature::BOZExtensions,
"nonstandard BOZ literal"_en_US)) {
"nonstandard BOZ literal"_port_en_US)) {
return std::nullopt;
}
spaceCheck.Parse(state);
@ -634,7 +634,7 @@ struct SkipStuffBeforeStatement {
}
} else if (**at == ';' &&
state.IsNonstandardOk(
LanguageFeature::EmptyStatement, "empty statement"_en_US)) {
LanguageFeature::EmptyStatement, "empty statement"_port_en_US)) {
state.UncheckedAdvance();
} else {
break;

View File

@ -93,7 +93,7 @@ static void PadShortCharacterActual(evaluate::Expr<evaluate::SomeType> &actual,
ToInt64(Fold(context, common::Clone(*actualType.LEN())))};
if (dummyLength && actualLength && *actualLength < *dummyLength) {
messages.Say(
"Actual length '%jd' is less than expected length '%jd'"_en_US,
"Actual length '%jd' is less than expected length '%jd'"_warn_en_US,
*actualLength, *dummyLength);
auto converted{ConvertToType(dummyType.type(), std::move(actual))};
CHECK(converted);
@ -124,7 +124,7 @@ static void ConvertIntegerActual(evaluate::Expr<evaluate::SomeType> &actual,
actual = std::move(*converted);
if (dummyType.type().kind() < actualType.type().kind()) {
messages.Say(
"Actual argument scalar expression of type INTEGER(%d) was converted to smaller dummy argument type INTEGER(%d)"_en_US,
"Actual argument scalar expression of type INTEGER(%d) was converted to smaller dummy argument type INTEGER(%d)"_port_en_US,
actualType.type().kind(), dummyType.type().kind());
}
actualType = dummyType;
@ -451,7 +451,7 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
if (dummy.intent == common::Intent::In && typesCompatible) {
// extension: allow with warning, rule is only relevant for definables
messages.Say(
"If a POINTER or ALLOCATABLE dummy or actual argument is polymorphic, both should be so"_en_US);
"If a POINTER or ALLOCATABLE dummy or actual argument is polymorphic, both should be so"_port_en_US);
} else {
messages.Say(
"If a POINTER or ALLOCATABLE dummy or actual argument is polymorphic, both must be so"_err_en_US);
@ -461,7 +461,7 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
if (dummy.intent == common::Intent::In) {
// extension: allow with warning, rule is only relevant for definables
messages.Say(
"POINTER or ALLOCATABLE dummy and actual arguments should have the same declared type and kind"_en_US);
"POINTER or ALLOCATABLE dummy and actual arguments should have the same declared type and kind"_port_en_US);
} else {
messages.Say(
"POINTER or ALLOCATABLE dummy and actual arguments must have the same declared type and kind"_err_en_US);
@ -577,7 +577,7 @@ static void CheckProcedureArg(evaluate::ActualArgument &arg,
messages.Say(
"Actual procedure argument has an implicit interface "
"which is not known to be compatible with %s which has an "
"explicit interface"_en_US,
"explicit interface"_warn_en_US,
dummyName);
}
}
@ -882,7 +882,7 @@ void CheckArguments(const characteristics::Procedure &proc,
CheckExplicitInterface(proc, actuals, context, scope, intrinsic)};
if (treatingExternalAsImplicit && !buffer.empty()) {
if (auto *msg{messages.Say(
"Warning: if the procedure's interface were explicit, this reference would be in error:"_en_US)}) {
"If the procedure's interface were explicit, this reference would be in error:"_warn_en_US)}) {
buffer.AttachTo(*msg);
}
}

View File

@ -50,7 +50,7 @@ private:
auto pair{ComputeBounds(range)};
if (pair.first && pair.second && *pair.first > *pair.second) {
context_.Say(stmt.source,
"CASE has lower bound greater than upper bound"_en_US);
"CASE has lower bound greater than upper bound"_warn_en_US);
} else {
if constexpr (T::category == TypeCategory::Logical) { // C1148
if ((pair.first || pair.second) &&

View File

@ -81,12 +81,12 @@ public:
}
if (IsProcedurePointer(symbol)) {
context_.Say(source_,
"Procedure pointer '%s' in a DATA statement is not standard"_en_US,
"Procedure pointer '%s' in a DATA statement is not standard"_port_en_US,
symbol.name());
}
if (IsInBlankCommon(symbol)) {
context_.Say(source_,
"Blank COMMON object '%s' in a DATA statement is not standard"_en_US,
"Blank COMMON object '%s' in a DATA statement is not standard"_port_en_US,
symbol.name());
}
return true;

View File

@ -588,7 +588,7 @@ void CheckHelper::CheckObjectEntity(
messages_.Say("A function result must not be initialized"_err_en_US);
} else if (IsInBlankCommon(symbol)) {
messages_.Say(
"A variable in blank COMMON should not be initialized"_en_US);
"A variable in blank COMMON should not be initialized"_port_en_US);
}
}
if (symbol.owner().kind() == Scope::Kind::BlockData) {
@ -1417,10 +1417,10 @@ void CheckHelper::WarnMissingFinal(const Symbol &symbol) {
!derivedDetails->GetFinalForRank(rank)) {
if (auto *msg{derivedSym == initialDerivedSym
? messages_.Say(symbol.name(),
"'%s' of derived type '%s' does not have a FINAL subroutine for its rank (%d)"_en_US,
"'%s' of derived type '%s' does not have a FINAL subroutine for its rank (%d)"_warn_en_US,
symbol.name(), derivedSym->name(), rank)
: messages_.Say(symbol.name(),
"'%s' of derived type '%s' extended from '%s' does not have a FINAL subroutine for its rank (%d)"_en_US,
"'%s' of derived type '%s' extended from '%s' does not have a FINAL subroutine for its rank (%d)"_warn_en_US,
symbol.name(), initialDerivedSym->name(),
derivedSym->name(), rank)}) {
msg->Attach(derivedSym->name(),

View File

@ -472,7 +472,7 @@ private:
if (isReal && !warn) {
// No messages for the default case
} else if (isReal && warn) {
context_.Say(sourceLocation, "DO controls should be INTEGER"_en_US);
context_.Say(sourceLocation, "DO controls should be INTEGER"_port_en_US);
} else {
SayBadDoControl(sourceLocation);
}
@ -520,7 +520,7 @@ private:
CheckDoExpression(*bounds.step);
if (IsZero(*bounds.step)) {
context_.Say(bounds.step->thing.value().source,
"DO step expression should not be zero"_en_US);
"DO step expression should not be zero"_warn_en_US);
}
}
}
@ -645,7 +645,7 @@ private:
if (hasDefaultNone) {
// C1127, you can only have one DEFAULT(NONE)
context_.Say(currentStatementSourcePosition_,
"Only one DEFAULT(NONE) may appear"_en_US);
"Only one DEFAULT(NONE) may appear"_port_en_US);
break;
}
hasDefaultNone = true;
@ -768,9 +768,8 @@ private:
assignment.u);
for (const Symbol &index : indexVars) {
if (symbols.count(index) == 0) {
context_.Say(
"Warning: FORALL index variable '%s' not used on left-hand side"
" of assignment"_en_US,
context_.Say("FORALL index variable '%s' not used on left-hand side"
" of assignment"_warn_en_US,
index.name());
}
}

View File

@ -235,7 +235,7 @@ void IoChecker::Enter(const parser::Format &spec) {
if (context_.ShouldWarn(
common::LanguageFeature::NonCharacterFormat)) {
context_.Say(format.source,
"Non-character format expression is not standard"_en_US);
"Non-character format expression is not standard"_port_en_US);
}
} else if (!type ||
type->kind() !=
@ -873,8 +873,9 @@ void IoChecker::CheckStringValue(IoSpecKind specKind, const std::string &value,
if (specKind == IoSpecKind::Access && upper == "APPEND") {
if (context_.languageFeatures().ShouldWarn(
common::LanguageFeature::OpenAccessAppend)) {
context_.Say(source, "ACCESS='%s' interpreted as POSITION='%s'"_en_US,
value, upper);
context_.Say(source,
"ACCESS='%s' interpreted as POSITION='%s'"_port_en_US, value,
upper);
}
} else {
context_.Say(source, "Invalid %s value '%s'"_err_en_US,

View File

@ -519,7 +519,7 @@ void OmpStructureChecker::CheckTargetNest(const parser::OpenMPConstruct &c) {
if (!eligibleTarget) {
context_.Say(parser::FindSourceLocation(c),
"If %s directive is nested inside TARGET region, the behaviour "
"is unspecified"_en_US,
"is unspecified"_port_en_US,
parser::ToUpperCaseLetters(
getDirectiveName(ineligibleTargetDir).str()));
}
@ -874,7 +874,7 @@ void OmpStructureChecker::CheckThreadprivateOrDeclareTargetVar(
llvm::omp::Directive::OMPD_declare_target)
context_.Say(name->source,
"The entity with PARAMETER attribute is used in a %s "
"directive"_en_US,
"directive"_warn_en_US,
ContextDirectiveAsFortran());
} else if (FindCommonBlockContaining(*name->symbol)) {
context_.Say(name->source,

View File

@ -37,7 +37,7 @@ void ReturnStmtChecker::Leave(const parser::ReturnStmt &returnStmt) {
context_.Say(
"RETURN with expression is only allowed in SUBROUTINE subprogram"_err_en_US);
} else if (context_.ShouldWarn(common::LanguageFeature::ProgramReturn)) {
context_.Say("RETURN should not appear in a main program"_en_US);
context_.Say("RETURN should not appear in a main program"_port_en_US);
}
}
}

View File

@ -290,7 +290,8 @@ DataInitializationCompiler<DSV>::ConvertElement(
exprAnalyzer_.GetFoldingContext(), type, expr)}) {
if (context.ShouldWarn(
common::LanguageFeature::LogicalIntegerAssignment)) {
context.Say("nonstandard usage: initialization of %s with %s"_en_US,
context.Say(
"nonstandard usage: initialization of %s with %s"_port_en_US,
type.AsFortran(), expr.GetType().value().AsFortran());
}
return {std::make_pair(std::move(*converted), false)};
@ -398,11 +399,11 @@ bool DataInitializationCompiler<DSV>::InitElement(
if (IsBOZLiteral(*expr) &&
designatorType->category() != TypeCategory::Integer) { // 8.6.7(11)
exprAnalyzer_.Say(
"BOZ literal should appear in a DATA statement only as a value for an integer object, but '%s' is '%s'"_en_US,
"BOZ literal should appear in a DATA statement only as a value for an integer object, but '%s' is '%s'"_port_en_US,
DescribeElement(), designatorType->AsFortran());
} else if (converted->second) {
exprAnalyzer_.context().Say(
"DATA statement value initializes '%s' of type '%s' with CHARACTER"_en_US,
"DATA statement value initializes '%s' of type '%s' with CHARACTER"_port_en_US,
DescribeElement(), designatorType->AsFortran());
}
auto folded{evaluate::Fold(context, std::move(converted->first))};

View File

@ -433,7 +433,7 @@ struct IntTypeVisitor {
LanguageFeature::BigIntLiterals)) {
analyzer.Say(digits,
"Integer literal is too large for default INTEGER(KIND=%d); "
"assuming INTEGER(KIND=%d)"_en_US,
"assuming INTEGER(KIND=%d)"_port_en_US,
kind, T::kind);
}
}
@ -556,7 +556,7 @@ MaybeExpr ExpressionAnalyzer::Analyze(const parser::RealLiteralConstant &x) {
auto kind{AnalyzeKindParam(x.kind, defaultKind)};
if (letterKind && kind != *letterKind && expoLetter != 'e') {
Say("Explicit kind parameter on real constant disagrees with "
"exponent letter '%c'"_en_US,
"exponent letter '%c'"_port_en_US,
expoLetter);
}
auto result{common::SearchTypes(
@ -1284,7 +1284,7 @@ void ArrayConstructorContext::Push(MaybeExpr &&x) {
if (exprAnalyzer_.context().ShouldWarn(
common::LanguageFeature::BOZAsDefaultInteger)) {
exprAnalyzer_.Say(
"BOZ literal in array constructor without explicit type is assumed to be default INTEGER"_en_US);
"BOZ literal in array constructor without explicit type is assumed to be default INTEGER"_port_en_US);
}
x = AsGenericExpr(ConvertToKind<TypeCategory::Integer>(
exprAnalyzer_.GetDefaultKind(TypeCategory::Integer),
@ -1299,7 +1299,7 @@ void ArrayConstructorContext::Push(MaybeExpr &&x) {
if (exprAnalyzer_.context().ShouldWarn(
common::LanguageFeature::BOZAsDefaultInteger)) {
exprAnalyzer_.Say(
"BOZ literal in array constructor without explicit type is assumed to be default INTEGER"_en_US);
"BOZ literal in array constructor without explicit type is assumed to be default INTEGER"_port_en_US);
}
x = AsGenericExpr(ConvertToKind<TypeCategory::Integer>(
exprAnalyzer_.GetDefaultKind(TypeCategory::Integer),
@ -1360,7 +1360,7 @@ void ArrayConstructorContext::Push(MaybeExpr &&x) {
if (!(messageDisplayedSet_ & 1)) {
exprAnalyzer_.Say(
"Character literal in array constructor without explicit "
"type has different length than earlier elements"_en_US);
"type has different length than earlier elements"_port_en_US);
messageDisplayedSet_ |= 1;
}
}
@ -1642,7 +1642,7 @@ MaybeExpr ExpressionAnalyzer::Analyze(
if (context().ShouldWarn(LanguageFeature::AnonymousParents)) {
Say(source,
"Whole parent component '%s' in structure "
"constructor should not be anonymous"_en_US,
"constructor should not be anonymous"_port_en_US,
symbol->name());
}
}
@ -2245,7 +2245,7 @@ void ExpressionAnalyzer::CheckBadExplicitType(
typeAndShape->Characterize(intrinsic, GetFoldingContext())}) {
if (!declared->type().IsTkCompatibleWith(typeAndShape->type())) {
if (auto *msg{Say(
"The result type '%s' of the intrinsic function '%s' is not the explicit declared type '%s'"_en_US,
"The result type '%s' of the intrinsic function '%s' is not the explicit declared type '%s'"_warn_en_US,
typeAndShape->AsFortran(), intrinsic.name(),
declared->AsFortran())}) {
msg->Attach(intrinsic.name(),
@ -3452,10 +3452,10 @@ bool ArgumentAnalyzer::OkLogicalIntegerAssignment(
std::optional<parser::MessageFixedText> msg;
if (lhs == TypeCategory::Integer && rhs == TypeCategory::Logical) {
// allow assignment to LOGICAL from INTEGER as a legacy extension
msg = "nonstandard usage: assignment of LOGICAL to INTEGER"_en_US;
msg = "nonstandard usage: assignment of LOGICAL to INTEGER"_port_en_US;
} else if (lhs == TypeCategory::Logical && rhs == TypeCategory::Integer) {
// ... and assignment to LOGICAL from INTEGER
msg = "nonstandard usage: assignment of INTEGER to LOGICAL"_en_US;
msg = "nonstandard usage: assignment of INTEGER to LOGICAL"_port_en_US;
} else {
return false;
}

View File

@ -954,7 +954,7 @@ Scope *ModFileReader::Read(const SourceName &name,
}
CHECK(sourceFile);
if (!VerifyHeader(sourceFile->content())) {
Say(name, ancestorName, "File has invalid checksum: %s"_en_US,
Say(name, ancestorName, "File has invalid checksum: %s"_warn_en_US,
sourceFile->path());
return nullptr;
}

View File

@ -868,7 +868,9 @@ void CheckBranchesIntoDoBody(const SourceStmtList &branches,
const auto &toPosition{branchTarget.parserCharBlock};
for (const auto &body : loopBodies) {
if (!InBody(fromPosition, body) && InBody(toPosition, body)) {
context.Say(fromPosition, "branch into loop body from outside"_en_US)
context
.Say(
fromPosition, "branch into loop body from outside"_warn_en_US)
.Attach(body.first, "the loop branched into"_en_US);
}
}
@ -937,7 +939,7 @@ void CheckLabelDoConstraints(const SourceStmtList &dos,
common::LanguageFeature::OldLabelDoEndStatements)) {
context
.Say(position,
"A DO loop should terminate with an END DO or CONTINUE"_en_US)
"A DO loop should terminate with an END DO or CONTINUE"_port_en_US)
.Attach(doTarget.parserCharBlock,
"DO loop currently ends at statement:"_en_US);
}
@ -1018,7 +1020,7 @@ void CheckBranchTargetConstraints(const SourceStmtList &stmts,
TargetStatementEnum::Branch)) { // warning
context
.Say(branchTarget.parserCharBlock,
"Label '%u' is not a branch target"_en_US, SayLabel(label))
"Label '%u' is not a branch target"_warn_en_US, SayLabel(label))
.Attach(stmt.parserCharBlock, "Control flow use of '%u'"_en_US,
SayLabel(label));
}
@ -1072,7 +1074,7 @@ void CheckAssignTargetConstraints(const SourceStmtList &stmts,
.Say(target.parserCharBlock,
target.labeledStmtClassificationSet.test(
TargetStatementEnum::CompatibleBranch)
? "Label '%u' is not a branch target or FORMAT"_en_US
? "Label '%u' is not a branch target or FORMAT"_warn_en_US
: "Label '%u' is not a branch target or FORMAT"_err_en_US,
SayLabel(label))
.Attach(stmt.parserCharBlock, "ASSIGN statement use of '%u'"_en_US,

View File

@ -436,9 +436,9 @@ bool EquivalenceSets::CheckCanEquivalence(
!(isAnyNum2 || isChar2)) { // C8110 - C8113
if (AreTkCompatibleTypes(type1, type2)) {
if (context_.ShouldWarn(LanguageFeature::EquivalenceSameNonSequence)) {
msg = "nonstandard: Equivalence set contains '%s' and '%s' with same "
"type "
"that is neither numeric nor character sequence type"_en_US;
msg =
"nonstandard: Equivalence set contains '%s' and '%s' with same "
"type that is neither numeric nor character sequence type"_port_en_US;
}
} else {
msg = "Equivalence set cannot contain '%s' and '%s' with distinct types "
@ -449,20 +449,17 @@ bool EquivalenceSets::CheckCanEquivalence(
if (context_.ShouldWarn(
LanguageFeature::EquivalenceNumericWithCharacter)) {
msg = "nonstandard: Equivalence set contains '%s' that is numeric "
"sequence "
"type and '%s' that is character"_en_US;
"sequence type and '%s' that is character"_port_en_US;
}
} else if (isAnyNum2 &&
context_.ShouldWarn(LanguageFeature::EquivalenceNonDefaultNumeric)) {
if (isDefaultNum1) {
msg =
"nonstandard: Equivalence set contains '%s' that is a default "
"numeric "
"sequence type and '%s' that is numeric with non-default kind"_en_US;
"numeric sequence type and '%s' that is numeric with non-default kind"_port_en_US;
} else if (!isDefaultNum2) {
msg = "nonstandard: Equivalence set contains '%s' and '%s' that are "
"numeric "
"sequence types with non-default kinds"_en_US;
"numeric sequence types with non-default kinds"_port_en_US;
}
}
}

View File

@ -1608,7 +1608,7 @@ void AttrsVisitor::SetBindNameOn(Symbol &symbol) {
auto first{label->find_first_not_of(" ")};
if (first == std::string::npos) {
// Empty NAME= means no binding at all (18.10.2p2)
Say(currStmtSource().value(), "Blank binding label ignored"_en_US);
Say(currStmtSource().value(), "Blank binding label ignored"_warn_en_US);
return;
}
auto last{label->find_last_not_of(" ")};
@ -1646,7 +1646,7 @@ bool AttrsVisitor::Pre(const parser::Pass &x) {
bool AttrsVisitor::IsDuplicateAttr(Attr attrName) {
if (attrs_->test(attrName)) {
Say(currStmtSource().value(),
"Attribute '%s' cannot be used more than once"_en_US,
"Attribute '%s' cannot be used more than once"_warn_en_US,
AttrToString(attrName));
return true;
}
@ -2280,7 +2280,7 @@ bool ScopeHandler::ImplicitlyTypeForwardRef(Symbol &symbol) {
if (context().languageFeatures().ShouldWarn(
common::LanguageFeature::ForwardRefDummyImplicitNone)) {
Say(symbol.name(),
"Dummy argument '%s' was used without being explicitly typed"_en_US,
"Dummy argument '%s' was used without being explicitly typed"_warn_en_US,
symbol.name());
}
symbol.set(Symbol::Flag::Implicit);
@ -3137,7 +3137,7 @@ void SubprogramVisitor::Post(const parser::FunctionStmt &stmt) {
Say(info.resultName->source,
"The function name should not appear in RESULT, references to '%s' "
"inside the function will be considered as references to the "
"result only"_en_US,
"result only"_warn_en_US,
name.source);
// RESULT name was ignored above, the only side effect from doing so will be
// the inability to make recursive calls. The related parser::Name is still
@ -3810,7 +3810,7 @@ bool DeclarationVisitor::Pre(const parser::IntrinsicStmt &x) {
// These warnings are worded so that they should make sense in either
// order.
Say(symbol.name(),
"Explicit type declaration ignored for intrinsic function '%s'"_en_US,
"Explicit type declaration ignored for intrinsic function '%s'"_warn_en_US,
symbol.name())
.Attach(name.source,
"INTRINSIC statement for explicitly-typed '%s'"_en_US,
@ -4328,14 +4328,14 @@ bool DeclarationVisitor::Pre(const parser::PrivateStmt &) {
derivedTypeInfo_.privateComps = true;
} else {
Say("PRIVATE may not appear more than once in"
" derived type components"_en_US); // C738
" derived type components"_warn_en_US); // C738
}
return false;
}
bool DeclarationVisitor::Pre(const parser::SequenceStmt &) {
if (derivedTypeInfo_.sequence) {
Say("SEQUENCE may not appear more than once in"
" derived type components"_en_US); // C738
" derived type components"_warn_en_US); // C738
}
derivedTypeInfo_.sequence = true;
return false;
@ -4427,7 +4427,7 @@ bool DeclarationVisitor::Pre(const parser::DataComponentDefStmt &x) {
if (GetAttrs().test(Attr::POINTER) &&
context().IsEnabled(common::LanguageFeature::PointerInSeqType)) {
if (context().ShouldWarn(common::LanguageFeature::PointerInSeqType)) {
Say("A sequence type data component that is a pointer to a non-sequence type is not standard"_en_US);
Say("A sequence type data component that is a pointer to a non-sequence type is not standard"_port_en_US);
}
} else {
Say("A sequence type data component must either be of an intrinsic type or a derived sequence type"_err_en_US);
@ -5037,7 +5037,7 @@ void DeclarationVisitor::AddSaveName(
std::set<SourceName> &set, const SourceName &name) {
auto pair{set.insert(name)};
if (!pair.second) {
Say2(name, "SAVE attribute was already specified on '%s'"_en_US,
Say2(name, "SAVE attribute was already specified on '%s'"_warn_en_US,
*pair.first, "Previous specification of SAVE attribute"_en_US);
}
}
@ -5453,7 +5453,7 @@ bool DeclarationVisitor::OkToAddComponent(
CHECK(scope->IsDerivedType());
if (auto *prev{FindInScope(*scope, name)}) {
if (!context().HasError(*prev)) {
auto msg{""_en_US};
parser::MessageFixedText msg;
if (extends) {
msg = "Type cannot be extended as it has a component named"
" '%s'"_err_en_US;
@ -5575,7 +5575,8 @@ bool ConstructVisitor::Pre(const parser::LocalitySpec::LocalInit &x) {
bool ConstructVisitor::Pre(const parser::LocalitySpec::Shared &x) {
for (const auto &name : x.v) {
if (!FindSymbol(name)) {
Say(name, "Variable '%s' with SHARED locality implicitly declared"_en_US);
Say(name,
"Variable '%s' with SHARED locality implicitly declared"_warn_en_US);
}
Symbol &prev{FindOrDeclareEnclosingEntity(name)};
if (PassesSharedLocalityChecks(name, prev)) {
@ -6175,7 +6176,7 @@ const parser::Name *DeclarationVisitor::ResolveName(const parser::Name &name) {
if (checkIndexUseInOwnBounds_ &&
*checkIndexUseInOwnBounds_ == name.source) {
Say(name,
"Implied DO index '%s' uses an object of the same name in its bounds expressions"_en_US,
"Implied DO index '%s' uses an object of the same name in its bounds expressions"_port_en_US,
name.source);
}
return &name;
@ -6655,7 +6656,7 @@ Symbol &ModuleVisitor::SetAccess(
Attr prev = attrs.test(Attr::PUBLIC) ? Attr::PUBLIC : Attr::PRIVATE;
Say(name,
WithSeverity(
"The accessibility of '%s' has already been specified as %s"_en_US,
"The accessibility of '%s' has already been specified as %s"_warn_en_US,
attr != prev ? parser::Severity::Error : parser::Severity::Warning),
MakeOpName(name), EnumToString(prev));
} else {

View File

@ -271,8 +271,8 @@ void SemanticsContext::CheckIndexVarRedefine(const parser::CharBlock &location,
void SemanticsContext::WarnIndexVarRedefine(
const parser::CharBlock &location, const Symbol &variable) {
CheckIndexVarRedefine(
location, variable, "Possible redefinition of %s variable '%s'"_en_US);
CheckIndexVarRedefine(location, variable,
"Possible redefinition of %s variable '%s'"_warn_en_US);
}
void SemanticsContext::CheckIndexVarRedefine(

View File

@ -20,4 +20,4 @@
!-------------------------------------
! EXPECTED OUTPUT FOR FIXED FORM MODE
!-------------------------------------
! FIXEDFORM:free-form-test.f90:1:1: Character in fixed-form label field must be a digit
! FIXEDFORM:free-form-test.f90:1:1: warning: Character in fixed-form label field must be a digit

View File

@ -15,32 +15,32 @@ module integer_tests
! Integer division by zero are not tested here because they are handled as fatal
! errors in constants.
!WARN: INTEGER(4) negation overflowed
!WARN: warning: INTEGER(4) negation overflowed
logical, parameter :: test_overflow_unary_minus1 = (-i4_nmax).EQ.i4_nmax
logical, parameter :: test_no_overflow_unary_minus1 = (-i4_pmax).EQ.(i4_nmax+1_4)
logical, parameter :: test_no_overflow_unary_plus1 = (+i4_pmax).EQ.i4_pmax
logical, parameter :: test_no_overflow_unary_plus2 = (+i4_nmax).EQ.i4_nmax
!WARN: INTEGER(4) addition overflowed
!WARN: warning: INTEGER(4) addition overflowed
logical, parameter :: test_overflow_add1 = (i4_pmax+1_4).EQ.i4_nmax
!WARN: INTEGER(4) addition overflowed
!WARN: warning: INTEGER(4) addition overflowed
logical, parameter :: test_overflow_add2 = (i4_nmax + (-1_4)).EQ.i4_pmax
!WARN: INTEGER(4) addition overflowed
!WARN: warning: INTEGER(4) addition overflowed
logical, parameter :: test_overflow_add3 = (i4_pmax + i4_pmax).EQ.(-2_4)
!WARN: INTEGER(4) addition overflowed
!WARN: warning: INTEGER(4) addition overflowed
logical, parameter :: test_overflow_add4 = (i4_nmax + i4_nmax).EQ.(0_4)
logical, parameter :: test_no_overflow_add1 = (i4_pmax + 0_4).EQ.i4_pmax
logical, parameter :: test_no_overflow_add2 = (i4_nmax + (-0_4)).EQ.i4_nmax
logical, parameter :: test_no_overflow_add3 = (i4_pmax + i4_nmax).EQ.(-1_4)
logical, parameter :: test_no_overflow_add4 = (i4_nmax + i4_pmax).EQ.(-1_4)
!WARN: INTEGER(4) subtraction overflowed
!WARN: warning: INTEGER(4) subtraction overflowed
logical, parameter :: test_overflow_sub1 = (i4_nmax - 1_4).EQ.i4_pmax
!WARN: INTEGER(4) subtraction overflowed
!WARN: warning: INTEGER(4) subtraction overflowed
logical, parameter :: test_overflow_sub2 = (i4_pmax - (-1_4)).EQ.i4_nmax
!WARN: INTEGER(4) subtraction overflowed
!WARN: warning: INTEGER(4) subtraction overflowed
logical, parameter :: test_overflow_sub3 = (i4_nmax - i4_pmax).EQ.(1_4)
!WARN: INTEGER(4) subtraction overflowed
!WARN: warning: INTEGER(4) subtraction overflowed
logical, parameter :: test_overflow_sub4 = (i4_pmax - i4_nmax).EQ.(-1_4)
logical, parameter :: test_no_overflow_sub1 = (i4_nmax - 0_4).EQ.i4_nmax
logical, parameter :: test_no_overflow_sub2 = (i4_pmax - (-0_4)).EQ.i4_pmax
@ -48,23 +48,23 @@ module integer_tests
logical, parameter :: test_no_overflow_sub4 = (i4_pmax - i4_pmax).EQ.0_4
!WARN: INTEGER(4) multiplication overflowed
!WARN: warning: INTEGER(4) multiplication overflowed
logical, parameter :: test_overflow_mult1 = (i4_pmax*2_4).EQ.(-2_4)
!WARN: INTEGER(4) multiplication overflowed
!WARN: warning: INTEGER(4) multiplication overflowed
logical, parameter :: test_overflow_mult2 = (i4_nmax*2_4).EQ.(0_4)
!WARN: INTEGER(4) multiplication overflowed
!WARN: warning: INTEGER(4) multiplication overflowed
logical, parameter :: test_overflow_mult3 = (i4_nmax*i4_nmax).EQ.(0_4)
!WARN: INTEGER(4) multiplication overflowed
!WARN: warning: INTEGER(4) multiplication overflowed
logical, parameter :: test_overflow_mult4 = (i4_pmax*i4_pmax).EQ.(1_4)
!WARN: INTEGER(4) division overflowed
!WARN: warning: INTEGER(4) division overflowed
logical, parameter :: test_overflow_div1 = (i4_nmax/(-1_4)).EQ.(i4_nmax)
logical, parameter :: test_no_overflow_div1 = (i4_nmax/(-2_4)).EQ.(1_4 + i4_pmax/2_4)
logical, parameter :: test_no_overflow_div2 = (i4_nmax/i4_nmax).EQ.(1_4)
!WARN: INTEGER(4) power overflowed
!WARN: warning: INTEGER(4) power overflowed
logical, parameter :: test_overflow_pow1 = (i4_pmax**2_4).EQ.(1_4)
!WARN: INTEGER(4) power overflowed
!WARN: warning: INTEGER(4) power overflowed
logical, parameter :: test_overflow_pow3 = (i4_nmax**2_4).EQ.(0_4)
logical, parameter :: test_no_overflow_pow1 = ((-1_4)**i4_nmax).EQ.(1_4)
logical, parameter :: test_no_overflow_pow2 = ((-1_4)**i4_pmax).EQ.(-1_4)
@ -76,12 +76,12 @@ module real_tests
real(4), parameter :: r4_pmax = 3.4028235E38
real(4), parameter :: r4_nmax = -3.4028235E38
!WARN: invalid argument on division
!WARN: warning: invalid argument on division
real(4), parameter :: r4_nan = 0._4/0._4
TEST_ISNAN(r4_nan)
!WARN: division by zero
!WARN: warning: division by zero
real(4), parameter :: r4_pinf = 1._4/0._4
!WARN: division by zero
!WARN: warning: division by zero
real(4), parameter :: r4_ninf = -1._4/0._4
logical, parameter :: test_r4_nan_parentheses1 = .NOT.(((r4_nan)).EQ.r4_nan)
@ -104,13 +104,13 @@ module real_tests
real(4), parameter :: r4_nan_plus = (+r4_nan)
TEST_ISNAN(r4_nan_plus)
!WARN: overflow on addition
!WARN: warning: overflow on addition
logical, parameter :: test_inf_r4_add9 = (r4_pmax + r4_pmax).eq.(r4_pinf)
!WARN: overflow on addition
!WARN: warning: overflow on addition
logical, parameter :: test_inf_r4_add10 = (r4_nmax + r4_nmax).eq.(r4_ninf)
!WARN: overflow on subtraction
!WARN: warning: overflow on subtraction
logical, parameter :: test_inf_r4_sub9 = (r4_pmax - r4_nmax).eq.(r4_pinf)
!WARN: overflow on subtraction
!WARN: warning: overflow on subtraction
logical, parameter :: test_inf_r4_sub10 = (r4_nmax - r4_pmax).eq.(r4_ninf)
! No warnings expected below (inf propagation).
@ -123,16 +123,16 @@ module real_tests
logical, parameter :: test_inf_r4_add7 = (r4_ninf + 0._4).EQ.(r4_ninf)
logical, parameter :: test_inf_r4_add8 = (r4_pinf + 0._4).EQ.(r4_pinf)
!WARN: invalid argument on subtraction
!WARN: warning: invalid argument on subtraction
real(4), parameter :: r4_nan_sub1 = r4_pinf - r4_pinf
TEST_ISNAN(r4_nan_sub1)
!WARN: invalid argument on subtraction
!WARN: warning: invalid argument on subtraction
real(4), parameter :: r4_nan_sub2 = r4_ninf - r4_ninf
TEST_ISNAN(r4_nan_sub2)
!WARN: invalid argument on addition
!WARN: warning: invalid argument on addition
real(4), parameter :: r4_nan_add1 = r4_ninf + r4_pinf
TEST_ISNAN(r4_nan_add1)
!WARN: invalid argument on addition
!WARN: warning: invalid argument on addition
real(4), parameter :: r4_nan_add2 = r4_pinf + r4_ninf
TEST_ISNAN(r4_nan_add2)
@ -154,13 +154,13 @@ module real_tests
real(4), parameter :: r4_nan_add6 = r4_nan + r4_nan
TEST_ISNAN(r4_nan_add6)
!WARN: overflow on multiplication
!WARN: warning: overflow on multiplication
logical, parameter :: test_inf_r4_mult1 = (1.5_4*r4_pmax).eq.(r4_pinf)
!WARN: overflow on multiplication
!WARN: warning: overflow on multiplication
logical, parameter :: test_inf_r4_mult2 = (1.5_4*r4_nmax).eq.(r4_ninf)
!WARN: overflow on division
!WARN: warning: overflow on division
logical, parameter :: test_inf_r4_div1 = (r4_nmax/(-0.5_4)).eq.(r4_pinf)
!WARN: overflow on division
!WARN: warning: overflow on division
logical, parameter :: test_inf_r4_div2 = (r4_pmax/(-0.5_4)).eq.(r4_ninf)
! No warnings expected below (inf propagation).
@ -177,25 +177,25 @@ module real_tests
logical, parameter :: test_inf_r4_div9 = (r4_nmax/r4_pinf).EQ.(0.)
logical, parameter :: test_inf_r4_div10 = (r4_nmax/r4_ninf).EQ.(0.)
!WARN: invalid argument on division
!WARN: warning: invalid argument on division
real(4), parameter :: r4_nan_div1 = 0._4/0._4
TEST_ISNAN(r4_nan_div1)
!WARN: invalid argument on division
!WARN: warning: invalid argument on division
real(4), parameter :: r4_nan_div2 = r4_ninf/r4_ninf
TEST_ISNAN(r4_nan_div2)
!WARN: invalid argument on division
!WARN: warning: invalid argument on division
real(4), parameter :: r4_nan_div3 = r4_ninf/r4_pinf
TEST_ISNAN(r4_nan_div3)
!WARN: invalid argument on division
!WARN: warning: invalid argument on division
real(4), parameter :: r4_nan_div4 = r4_pinf/r4_ninf
TEST_ISNAN(r4_nan_div4)
!WARN: invalid argument on division
!WARN: warning: invalid argument on division
real(4), parameter :: r4_nan_div5 = r4_pinf/r4_pinf
TEST_ISNAN(r4_nan_div5)
!WARN: invalid argument on multiplication
!WARN: warning: invalid argument on multiplication
real(4), parameter :: r4_nan_mult1 = r4_pinf*0._4
TEST_ISNAN(r4_nan_mult1)
!WARN: invalid argument on multiplication
!WARN: warning: invalid argument on multiplication
real(4), parameter :: r4_nan_mult2 = 0._4*r4_ninf
TEST_ISNAN(r4_nan_mult2)

View File

@ -10,30 +10,30 @@ module real_tests
real(4), parameter :: r4_pmax = 3.4028235E38
real(4), parameter :: r4_nmax = -3.4028235E38
!WARN: invalid argument on division
!WARN: warning: invalid argument on division
real(4), parameter :: r4_nan = 0._4/0._4
!WARN: division by zero
!WARN: warning: division by zero
real(4), parameter :: r4_pinf = 1._4/0._4
!WARN: division by zero
!WARN: warning: division by zero
real(4), parameter :: r4_ninf = -1._4/0._4
!WARN: invalid argument on intrinsic function
!WARN: warning: invalid argument on intrinsic function
real(4), parameter :: nan_r4_acos1 = acos(1.1)
TEST_ISNAN(nan_r4_acos1)
!WARN: invalid argument on intrinsic function
!WARN: warning: invalid argument on intrinsic function
real(4), parameter :: nan_r4_acos2 = acos(r4_pmax)
TEST_ISNAN(nan_r4_acos2)
!WARN: invalid argument on intrinsic function
!WARN: warning: invalid argument on intrinsic function
real(4), parameter :: nan_r4_acos3 = acos(r4_nmax)
TEST_ISNAN(nan_r4_acos3)
!WARN: invalid argument on intrinsic function
!WARN: warning: invalid argument on intrinsic function
real(4), parameter :: nan_r4_acos4 = acos(r4_ninf)
TEST_ISNAN(nan_r4_acos4)
!WARN: invalid argument on intrinsic function
!WARN: warning: invalid argument on intrinsic function
real(4), parameter :: nan_r4_acos5 = acos(r4_pinf)
TEST_ISNAN(nan_r4_acos5)
!WARN: overflow on intrinsic function
!WARN: warning: overflow on intrinsic function
logical, parameter :: test_exp_overflow = exp(256._4).EQ.r4_pinf
end module
@ -53,15 +53,15 @@ module specific_extremums
! The tests below are cases where an implementation that converts the arguments to the
! standard required types instead would give different results than the implementation
! specified for f18 (converting the result).
integer(8), parameter :: max_i32_8 = 2_8**31-1
integer(8), parameter :: max_i32_8 = 2_8**31-1
integer, parameter :: expected_min0 = int(min(max_i32_8, 2_8*max_i32_8), 4)
!WARN: argument types do not match specific intrinsic 'min0' requirements; using 'min' generic instead and converting the result to INTEGER(4) if needed
!WARN: portability: argument types do not match specific intrinsic 'min0' requirements; using 'min' generic instead and converting the result to INTEGER(4) if needed
integer, parameter :: result_min0 = min0(max_i32_8, 2_8*max_i32_8)
! result_min0 would be -2 if arguments were converted to default integer.
logical, parameter :: test_min0 = expected_min0 .EQ. result_min0
real, parameter :: expected_amax0 = real(max(max_i32_8, 2_8*max_i32_8), 4)
!WARN: argument types do not match specific intrinsic 'amax0' requirements; using 'max' generic instead and converting the result to REAL(4) if needed
!WARN: portability: argument types do not match specific intrinsic 'amax0' requirements; using 'max' generic instead and converting the result to REAL(4) if needed
real, parameter :: result_amax0 = amax0(max_i32_8, 2_8*max_i32_8)
! result_amax0 would be 2.1474836E+09 if arguments were converted to default integer first.
logical, parameter :: test_amax0 = expected_amax0 .EQ. result_amax0

View File

@ -4,9 +4,9 @@ module m1
logical, parameter :: results(*) = isnan([ &
0., &
-0., &
!WARN: division by zero
!WARN: warning: division by zero
1./0., &
!WARN: invalid argument on division
!WARN: warning: invalid argument on division
0./0., &
real(z'7ff80001',kind=4), &
real(z'fff80001',kind=4), &

View File

@ -15,7 +15,7 @@ module m
! -0 (sqrt is -0)
real(8), parameter :: n08 = z'8000000000000000'
real(8), parameter :: sqrt_n08 = sqrt(n08)
!WARN: division by zero
!WARN: warning: division by zero
real(8), parameter :: inf_n08 = 1.0_8 / sqrt_n08, inf_n08z = z'fff0000000000000'
logical, parameter :: test_n08 = inf_n08 == inf_n08z
! min normal

View File

@ -18,8 +18,8 @@
!-----------------------
! EXPECTED OUTPUT
!-----------------------
! CHECK: prescanner-diag.f90:27:20: #include: extra stuff ignored after file name
! CHECK: prescanner-diag.f90:28:20: #include: extra stuff ignored after file name
! CHECK: prescanner-diag.f90:27:20: portability: #include: extra stuff ignored after file name
! CHECK: prescanner-diag.f90:28:20: portability: #include: extra stuff ignored after file name
!-------
! INPUT

View File

@ -5,7 +5,7 @@
#include <empty.h> /* comment */
! CHECK-NOT: :7:
#include <empty.h> !comment
! CHECK: :9:20: #include: extra stuff ignored after file name
! CHECK: :9:20: portability: #include: extra stuff ignored after file name
#include <empty.h> comment
! CHECK-NOT: :11:
#include "empty.h" ! comment
@ -13,6 +13,6 @@
#include "empty.h" /* comment */
! CHECK-NOT: :15:
#include "empty.h" !comment
! CHECK: :17:20: #include: extra stuff ignored after file name
! CHECK: :17:20: portability: #include: extra stuff ignored after file name
#include "empty.h" comment
end

View File

@ -43,7 +43,7 @@ program main
call subr2(notChar)
call subr3(explicitLength)
call subr3(assumedLength)
!CHECK: Warning: if the procedure's interface were explicit, this reference would be in error:
!CHECK: warning: If the procedure's interface were explicit, this reference would be in error:
!CHECK: Actual argument function associated with procedure dummy argument 'f=' has incompatible result type
call subr3(notChar)
end program